13 MassFlowController::MassFlowController() : FlowDevice() {
17 void MassFlowController::setMassFlowRate(
double mdot)
25 void MassFlowController::updateMassFlowRate(
double time)
28 throw CanteraError(
"MassFlowController::updateMassFlowRate",
29 "Device is not ready; some parameters have not been set.");
31 double mdot = m_coeff;
33 mdot *= m_tfunc->eval(time);
35 m_mdot = std::max(mdot, 0.0);
38 PressureController::PressureController() :
FlowDevice(), m_master(0) {
39 m_type = PressureController_Type;
45 throw CanteraError(
"PressureController::updateMassFlowRate",
46 "Device is not ready; some parameters have not been set.");
57 m_mdot = std::max(mdot, 0.0);
68 "Device is not ready; some parameters have not been set.");
80 m_mdot = std::max(mdot, 0.0);
Base class for exceptions thrown by Cantera classes.
Base class for 'flow devices' (valves, pressure regulators, etc.) connecting reactors.
Func1 * m_tfunc
Function set by setTimeFunction; used by updateMassFlowRate.
double m_coeff
Coefficient set by derived classes; used by updateMassFlowRate.
double massFlowRate(double time=-999.0)
Mass flow rate (kg/s).
virtual void updateMassFlowRate(double time)
Update the mass flow rate at time 'time'.
ReactorBase & in() const
Return a reference to the upstream reactor.
const ReactorBase & out() const
Return a const reference to the downstream reactor.
Func1 * m_pfunc
Function set by setPressureFunction; used by updateMassFlowRate.
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual void updateMassFlowRate(double time)
Update the mass flow rate at time 'time'.
doublereal pressure() const
Returns the current pressure (Pa) of the reactor.
virtual void updateMassFlowRate(double time)
Compute the currrent mass flow rate, based on the pressure difference.
Some flow devices derived from class FlowDevice.
Namespace for the Cantera kernel.
const int MFC_Type
Magic numbers.