24 throw CanteraError(
"MassFlowController::updateMassFlowRate",
25 "Device is not ready; some parameters have not been set.");
31 m_mdot = std::max(mdot, 0.0);
37 throw CanteraError(
"PressureController::updateMassFlowRate",
38 "Device is not ready; some parameters have not been set.");
49 m_mdot = std::max(mdot, 0.0);
54 auto dev = std::dynamic_pointer_cast<FlowDevice>(primary);
57 "Invalid primary mass flow controller with type {}.",
60 m_primary = dev.get();
67 "Device is not ready; some parameters have not been set.");
79 m_mdot = std::max(mdot, 0.0);
Base class for exceptions thrown by Cantera classes.
Func1 * m_tfunc
Function set by setTimeFunction; used by updateMassFlowRate.
double m_coeff
Coefficient set by derived classes; used by updateMassFlowRate.
ReactorBase & in() const
Return a reference to the upstream reactor.
double massFlowRate()
Mass flow rate (kg/s).
const ReactorBase & out() const
Return a const reference to the downstream reactor.
virtual void updateMassFlowRate(double time)
Update the mass flow rate at time 'time'.
Func1 * m_pfunc
Function set by setPressureFunction; used by updateMassFlowRate.
virtual double eval(double t) const
Evaluate the function.
void updateMassFlowRate(double time) override
If a function of time has been specified for mdot, then update the stored mass flow rate.
void setMassFlowRate(double mdot) override
Set the fixed mass flow rate (kg/s) through a flow device.
void updateMassFlowRate(double time) override
Update the mass flow rate at time 'time'.
void setPrimary(shared_ptr< ConnectorNode > primary) override
Set the primary mass flow controller.
double pressure() const
Returns the current pressure (Pa) of the reactor.
void updateMassFlowRate(double time) override
Compute the current mass flow rate, based on the pressure difference.
Some flow devices derived from class FlowDevice.
Namespace for the Cantera kernel.