Buildings.Fluid.Movers.BaseClasses

Package with base classes for Buildings.Fluid.Movers

Information


This package contains base classes that are used to construct the models in Buildings.Fluid.Movers.

Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).

Package Content

NameDescription
Buildings.Fluid.Movers.BaseClasses.Characteristics Characteristics Functions for fan or pump characteristics
Buildings.Fluid.Movers.BaseClasses.ControlledFlowMachine ControlledFlowMachine Partial model for fan or pump with ideally controlled mass flow rate or head as input signal
Buildings.Fluid.Movers.BaseClasses.PrescribedFlowMachine PrescribedFlowMachine Partial model for fan or pump with speed (y or Nrpm) as input signal
Buildings.Fluid.Movers.BaseClasses.PartialFlowMachine PartialFlowMachine Partial model to interface fan or pump models with the medium
FlowMachineInterface Partial model with performance curves for fans or pumps
Buildings.Fluid.Movers.BaseClasses.IdealSource IdealSource Base class for pressure and mass flow source with optional power input
PowerInterface Partial model to compute power draw and heat dissipation of fans and pumps


Buildings.Fluid.Movers.BaseClasses.ControlledFlowMachine Buildings.Fluid.Movers.BaseClasses.ControlledFlowMachine

Partial model for fan or pump with ideally controlled mass flow rate or head as input signal

Buildings.Fluid.Movers.BaseClasses.ControlledFlowMachine

Information


This model describes a fan or pump that takes as an input the head or the mass flow rate.

Extends from Buildings.Fluid.Movers.BaseClasses.PartialFlowMachine (Partial model to interface fan or pump models with the medium), Buildings.Fluid.Movers.BaseClasses.PowerInterface (Partial model to compute power draw and heat dissipation of fans and pumps).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
BooleanaddPowerToMediumtrueSet to false to avoid any power (=heat and flow work) being added to medium (may give simpler equations)
Densityrho_nominalMedium.density(sta_nominal)Nominal fluid density [kg/m3]
MassFlowRatem_flow_maxm_flow_nominalMaximum mass flow rate (at zero head) [kg/s]
Booleancontrol_m_flow = false to control head instead of m_flow
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Initialization
MassFlowRatem_flow.start0Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction) [kg/s]
Pressuredp.start0Pressure difference between port_a and port_b [Pa]
Realr_V.start1Ratio V_flow/V_flow_max = V_flow/V_flow(dp=0, N=N_nominal)
Characteristics
Booleanuse_powerCharacteristicfalseUse powerCharacteristic (vs. efficiencyCharacteristic)
BooleanmotorCooledByFluidtrueIf true, then motor heat is added to fluid stream
replaceable function motorEfficiencyBuildings.Fluid.Movers.BaseC...Efficiency vs. normalized volume flow rate
replaceable function hydraulicEfficiencyBuildings.Fluid.Movers.BaseC...Efficiency vs. normalized volume flow rate
Assumptions
BooleanallowFlowReversalsystem.allowFlowReversal= true to allow flow reversal, false restricts to design direction (port_a -> port_b)
Dynamics
BooleandynamicBalancetrueSet to true to use a dynamic balance, which often leads to smaller systems of equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Formulation of energy balance (used if dynamicBalance=true)
Timetau1Time constant of fluid volume for nominal flow, used if dynamicBalance=true [s]
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
BooleanhomotopyInitializationtrue= true, use homotopy method
Diagnostics
Booleanshow_V_flowtrue= true, if volume flow rate at inflowing port is computed
Booleanshow_Ttrue= true, if actual temperature at port is computed (may lead to events)
Initialization
Booleanuse_T_starttrue= true, use T_start, otherwise h_start
TemperatureT_startif use_T_start then system.T...Start value of temperature [K]
SpecificEnthalpyh_startif use_T_start then Medium.s...Start value of inlet specific enthalpy [J/kg]
MassFractionX_start[Medium.nX]Medium.X_defaultStart value of mass fractions m_i/m [kg/kg]
ExtraPropertyC_start[Medium.nC]fill(0, Medium.nC)Start value of trace substances
Pressurep_startMedium.p_defaultStart value of inlet pressure [Pa]

Connectors

TypeNameDescription
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)
HeatPort_aheatPort 
input RealInputm_flow_inPrescribed mass flow rate
input RealInputdp_inPrescribed outlet pressure

Modelica definition

model ControlledFlowMachine 
  "Partial model for fan or pump with ideally controlled mass flow rate or head as input signal"
  extends Buildings.Fluid.Movers.BaseClasses.PartialFlowMachine(
   final show_V_flow = true,
   souSta(final control_m_flow=control_m_flow),
   souDyn(final control_m_flow=control_m_flow));

  extends Buildings.Fluid.Movers.BaseClasses.PowerInterface(
     final use_powerCharacteristic = false,
     final rho_nominal = Medium.density(sta_nominal));

  parameter Medium.MassFlowRate m_flow_nominal 
    "Nominal mass flow rate, used as flow rate if control_m_flow";
  parameter Modelica.SIunits.MassFlowRate m_flow_max = m_flow_nominal 
    "Maximum mass flow rate (at zero head)";
  // what to control
  constant Boolean control_m_flow "= false to control head instead of m_flow";

  Modelica.Blocks.Interfaces.RealInput m_flow_in if control_m_flow 
    "Prescribed mass flow rate";
  Modelica.Blocks.Interfaces.RealInput dp_in if not control_m_flow 
    "Prescribed outlet pressure";

protected 
  final parameter Medium.AbsolutePressure p_a_nominal(displayUnit="Pa") = Medium.p_default 
    "Nominal inlet pressure for predefined fan or pump characteristics";
  parameter Medium.ThermodynamicState sta_nominal = Medium.setState_pTX(T=T_start,
     p=p_a_nominal, X=X_start[1:Medium.nXi]);

public 
  Modelica.Blocks.Sources.RealExpression PToMedium_flow(y=Q_flow + dpMachine*
        V_in_flow) "Heat and work input into medium";
protected 
  Modelica.Blocks.Math.Gain gain(final k=-1) if not control_m_flow;
initial equation 
  V_flow_max=m_flow_max/rho_nominal;
equation 
  etaHyd = hydraulicEfficiency(r_V=r_V);
  etaMot = motorEfficiency(r_V=r_V);
  dpMachine = -dp;
  VMachine_flow = V_flow;

  connect(m_flow_in, souDyn.m_flow_in);
  connect(m_flow_in, souSta.m_flow_in);
  connect(gain.u, dp_in);
  connect(gain.y, souDyn.dp_in);
  connect(gain.y, souSta.dp_in);

  connect(PToMedium_flow.y, prePow.Q_flow);
  connect(PToMedium_flow.y, souSta.P_in);
end ControlledFlowMachine;

Buildings.Fluid.Movers.BaseClasses.PrescribedFlowMachine Buildings.Fluid.Movers.BaseClasses.PrescribedFlowMachine

Partial model for fan or pump with speed (y or Nrpm) as input signal

Buildings.Fluid.Movers.BaseClasses.PrescribedFlowMachine

Information


This is the base model for fans and pumps that take as input a control signal in the form of the pump speed Nrpm or the normalized pump speed y=Nrpm/N_nominal.

Extends from Buildings.Fluid.Movers.BaseClasses.PartialFlowMachine (Partial model to interface fan or pump models with the medium), Buildings.Fluid.Movers.BaseClasses.FlowMachineInterface (Partial model with performance curves for fans or pumps).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
BooleanaddPowerToMediumtrueSet to false to avoid any power (=heat and flow work) being added to medium (may give simpler equations)
Densityrho_nominalMedium.density_pTX(Medium.p_...Nominal fluid density [kg/m3]
VolumeFlowRateV_flow_nominalm_flow_nominal/rho_nominalNominal volume flow rate, used for homotopy [m3/s]
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Initialization
MassFlowRatem_flow.start0Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction) [kg/s]
Pressuredp.start0Pressure difference between port_a and port_b [Pa]
Realr_V.start1Ratio V_flow/V_flow_max = V_flow/V_flow(dp=0, N=N_nominal)
Realr_N.start1Ratio N/N_nominal [1]
Characteristics
Booleanuse_powerCharacteristicfalseUse powerCharacteristic (vs. efficiencyCharacteristic)
BooleanmotorCooledByFluidtrueIf true, then motor heat is added to fluid stream
replaceable function motorEfficiencyBuildings.Fluid.Movers.BaseC...Efficiency vs. normalized volume flow rate
replaceable function hydraulicEfficiencyBuildings.Fluid.Movers.BaseC...Efficiency vs. normalized volume flow rate
replaceable function flowCharacteristicbaseFlowTotal pressure vs. V_flow characteristic at nominal speed
AngularVelocity_rpmN_nominal1500Nominal rotational speed for flow characteristic [1/min]
replaceable function powerCharacteristicBuildings.Fluid.Movers.BaseC...Power consumption vs. V_flow at nominal speed and density
Assumptions
BooleanallowFlowReversalsystem.allowFlowReversal= true to allow flow reversal, false restricts to design direction (port_a -> port_b)
Dynamics
BooleandynamicBalancetrueSet to true to use a dynamic balance, which often leads to smaller systems of equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Formulation of energy balance (used if dynamicBalance=true)
Timetau1Time constant of fluid volume for nominal flow, used if dynamicBalance=true [s]
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
BooleanhomotopyInitializationtrue= true, use homotopy method
Diagnostics
Booleanshow_V_flowfalse= true, if volume flow rate at inflowing port is computed
Booleanshow_Ttrue= true, if actual temperature at port is computed (may lead to events)
Initialization
Booleanuse_T_starttrue= true, use T_start, otherwise h_start
TemperatureT_startif use_T_start then system.T...Start value of temperature [K]
SpecificEnthalpyh_startif use_T_start then Medium.s...Start value of inlet specific enthalpy [J/kg]
MassFractionX_start[Medium.nX]Medium.X_defaultStart value of mass fractions m_i/m [kg/kg]
ExtraPropertyC_start[Medium.nC]fill(0, Medium.nC)Start value of trace substances
Pressurep_startMedium.p_defaultStart value of inlet pressure [Pa]

Connectors

TypeNameDescription
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)
HeatPort_aheatPort 

Modelica definition

partial model PrescribedFlowMachine 
  "Partial model for fan or pump with speed (y or Nrpm) as input signal"
  extends Buildings.Fluid.Movers.BaseClasses.PartialFlowMachine(
      final show_V_flow = false,
      souDyn(final control_m_flow=false),
      souSta(final control_m_flow=false));

  extends Buildings.Fluid.Movers.BaseClasses.FlowMachineInterface(
    V_flow_nominal=m_flow_nominal/rho_nominal,
    V_flow_max(start=V_flow_nominal),
    final rho_nominal = Medium.density_pTX(Medium.p_default, Medium.T_default, Medium.X_default));

  // Models
protected 
  Modelica.Blocks.Sources.RealExpression dpMac(y=-dpMachine) 
    "Pressure drop of the pump or fan";
  Modelica.Blocks.Sources.RealExpression QMac_flow(y=Q_flow + dpMachine*
        V_in_flow) 
    "Heat input into the medium from the fan or pump (not including flow work)";

equation 
 VMachine_flow = V_in_flow;
 rho = rho_in;

  connect(dpMac.y, souSta.dp_in);
  connect(dpMac.y, souDyn.dp_in);

  connect(QMac_flow.y, prePow.Q_flow);
  connect(QMac_flow.y, souSta.P_in);
end PrescribedFlowMachine;

Buildings.Fluid.Movers.BaseClasses.PartialFlowMachine Buildings.Fluid.Movers.BaseClasses.PartialFlowMachine

Partial model to interface fan or pump models with the medium

Buildings.Fluid.Movers.BaseClasses.PartialFlowMachine

Information


This is the base model for fans and pumps. It provides an interface between the equations that compute head and power consumption, and the implementation of the energy and pressure balance of the fluid.

The model has two fluid streams. Depending on the value of the parameter dynamicBalance, one of the streams is removed.

The parameter addPowerToMedium determines whether any power is added to the fluid. The default is addPowerToMedium=true, and hence the outlet enthalpy is higher than the inlet enthalpy if the flow device is operating. The setting addPowerToMedium=false is physically incorrect (since the flow work, the flow friction and the fan heat do not increase the enthalpy of the medium), but this setting does in some cases lead to simpler equations and more robust simulation, in particular if the mass flow is equal to zero.

Extends from Buildings.Fluid.Interfaces.PartialStaticTwoPortInterface (Partial model transporting fluid between two ports without storing mass or energy).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
BooleanaddPowerToMediumtrueSet to false to avoid any power (=heat and flow work) being added to medium (may give simpler equations)
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Initialization
MassFlowRatem_flow.start0Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction) [kg/s]
Pressuredp.start0Pressure difference between port_a and port_b [Pa]
Assumptions
BooleanallowFlowReversalsystem.allowFlowReversal= true to allow flow reversal, false restricts to design direction (port_a -> port_b)
Dynamics
BooleandynamicBalancetrueSet to true to use a dynamic balance, which often leads to smaller systems of equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Formulation of energy balance (used if dynamicBalance=true)
Timetau1Time constant of fluid volume for nominal flow, used if dynamicBalance=true [s]
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
BooleanhomotopyInitializationtrue= true, use homotopy method
Diagnostics
Booleanshow_V_flowfalse= true, if volume flow rate at inflowing port is computed
Booleanshow_Ttrue= true, if actual temperature at port is computed (may lead to events)
Initialization
Booleanuse_T_starttrue= true, use T_start, otherwise h_start
TemperatureT_startif use_T_start then system.T...Start value of temperature [K]
SpecificEnthalpyh_startif use_T_start then Medium.s...Start value of inlet specific enthalpy [J/kg]
MassFractionX_start[Medium.nX]Medium.X_defaultStart value of mass fractions m_i/m [kg/kg]
ExtraPropertyC_start[Medium.nC]fill(0, Medium.nC)Start value of trace substances
Pressurep_startMedium.p_defaultStart value of inlet pressure [Pa]

Connectors

TypeNameDescription
HeatPort_aheatPort 

Modelica definition

partial model PartialFlowMachine 
  "Partial model to interface fan or pump models with the medium"
  import Modelica.Constants;

  extends Buildings.Fluid.Interfaces.PartialStaticTwoPortInterface(show_T=true,
    port_a(
      h_outflow(start=h_start),
      final m_flow(min = if allowFlowReversal then -Constants.inf else 0)),
    port_b(
      h_outflow(start=h_start),
      p(start=p_start),
      final m_flow(max = if allowFlowReversal then +Constants.inf else 0)));

  Delays.DelayFirstOrder vol(
    redeclare package Medium = Medium,
    tau=tau,
    energyDynamics=energyDynamics,
    massDynamics=massDynamics,
    use_T_start=use_T_start,
    T_start=T_start,
    h_start=h_start,
    X_start=X_start,
    C_start=C_start,
    m_flow_nominal=m_flow_nominal,
    use_HeatTransfer=true,
    redeclare model HeatTransfer =
        Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.IdealHeatTransfer,
    nPorts=2,
    p_start=p_start) if 
       dynamicBalance "Fluid volume for dynamic model";
   parameter Boolean dynamicBalance = true 
    "Set to true to use a dynamic balance, which often leads to smaller systems of equations";

  parameter Boolean addPowerToMedium=true 
    "Set to false to avoid any power (=heat and flow work) being added to medium (may give simpler equations)";

  parameter Modelica.Fluid.Types.Dynamics energyDynamics=
                     Modelica.Fluid.Types.Dynamics.SteadyStateInitial 
    "Formulation of energy balance (used if dynamicBalance=true)";
  final parameter Modelica.Fluid.Types.Dynamics massDynamics=energyDynamics 
    "Formulation of mass balance (used if dynamicBalance=true)";

  parameter Modelica.SIunits.Time tau=1 
    "Time constant of fluid volume for nominal flow, used if dynamicBalance=true";

  // Parameters for initialization
  // Initialization
  parameter Boolean use_T_start=true "= true, use T_start, otherwise h_start";
  parameter Modelica.Media.Interfaces.PartialMedium.Temperature T_start=if 
      use_T_start then system.T_start else Medium.temperature_phX(
      p_start,
      h_start,
      X_start) "Start value of temperature";
  parameter Modelica.Media.Interfaces.PartialMedium.SpecificEnthalpy h_start=
      if use_T_start then Medium.specificEnthalpy_pTX(
      p_start,
      T_start,
      X_start) else Medium.h_default "Start value of inlet specific enthalpy";
  parameter Modelica.Media.Interfaces.PartialMedium.MassFraction X_start[Medium.nX]=
     Medium.X_default "Start value of mass fractions m_i/m";
  parameter Modelica.Media.Interfaces.PartialMedium.ExtraProperty C_start[
    Medium.nC]=fill(0, Medium.nC) "Start value of trace substances";
  parameter Modelica.SIunits.Pressure p_start = Medium.p_default 
    "Start value of inlet pressure";
  Modelica.SIunits.Density rho_in "Density of inflowing fluid";
  Modelica.SIunits.VolumeFlowRate V_in_flow 
    "Volume flow rate that flows into the device";
  // Models
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort if dynamicBalance;

protected 
  IdealSource souDyn(redeclare package Medium =
                       Medium, final addPowerToMedium=false) if dynamicBalance 
    "Pressure source for dynamic model, this changes the pressure in the medium";
  Buildings.Fluid.Movers.BaseClasses.IdealSource souSta(
                            redeclare package Medium = Medium,
                            final addPowerToMedium=addPowerToMedium) if not dynamicBalance 
    "Source for static model, this changes the pressure in the medium and adds heat";
  Buildings.HeatTransfer.Sources.PrescribedHeatFlow prePow if (dynamicBalance and addPowerToMedium) 
    "Prescribed power (=heat and flow work) flow for dynamic model";

equation 
  // For computing the density, we assume that the fan operates in the design flow direction.
  rho_in = Medium.density(
       Medium.setState_phX(port_a.p, inStream(port_a.h_outflow), inStream(port_a.Xi_outflow)));
  V_in_flow = m_flow/rho_in;
  connect(prePow.port, vol.heatPort);

  connect(souSta.port_b, port_b);

  connect(vol.heatPort, heatPort);
  connect(port_a, vol.ports[1]);
  connect(souDyn.port_b, port_b);
  connect(souSta.port_a, port_a);
  connect(vol.ports[2], souDyn.port_a);
end PartialFlowMachine;

Buildings.Fluid.Movers.BaseClasses.FlowMachineInterface

Partial model with performance curves for fans or pumps

Information


This is an interface that implements the functions to compute the head, power draw and efficiency of fans and pumps. It is used by the model PrescribedFlowMachine.

The nominal hydraulic characteristic (total pressure vs. volume flow rate) is given by the the replaceable function flowCharacteristic.

The fan or pump energy balance can be specified in two alternative ways: