Buildings.Fluid.FMI.ExportContainers.Examples.FMUs

Collection of example models

Information

This package contains examples for the use of models that can be found in Buildings.Fluid.FMI.ExportContainers.

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

Name Description
Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.Fan Fan Declaration of an FMU that exports a fan
Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.FlowSplitter_u FlowSplitter_u Declaration of an FMU that exports a flow splitter
Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZone HVACZone Declaration of an FMU that exports a simple convective only HVAC system
Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZones HVACZones Declaration of an FMU that exports a simple convective only HVAC system for two zones
Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HeaterCooler_T HeaterCooler_T Declaration of an FMU that exports an ideal heater or cooler with prescribed outlet temperature
Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HeaterCooler_u HeaterCooler_u Declaration of an FMU that exports an ideal heater or cooler with prescribed heat flow rate
Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.Humidifier_u Humidifier_u Declaration of an FMU that exports an ideal humidifier
Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.IdealSource_m_flow IdealSource_m_flow Declaration of an FMU that exports a mass flow source and sink
Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.MixingVolume MixingVolume Declaration of an FMU that exports a control volume
Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.PressureDrop PressureDrop Declaration of an FMU that exports a fixed resistance
Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ResistanceVolume ResistanceVolume Declaration of an FMU that exports a flow resistance and control volume
Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ThermalZone ThermalZone Declaration of an FMU that exports a thermal zone
Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ThermalZones ThermalZones Declaration of an FMU that exports multiple thermal zones
Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.TwoPortPassThrough TwoPortPassThrough Declaration of an FMU that exports a block that simply passes all the inputs to the outputs

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.Fan Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.Fan

Declaration of an FMU that exports a fan

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.Fan

Information

This example demonstrates how to export an FMU with a fluid flow component. The FMU has an instance of Buildings.Fluid.FixedResistances.FlowMachine_dp.

See Buildings.Fluid.FMI.UsersGuide for why there is no model that exports Buildings.Fluid.Movers.FlowMachine_m_flow.

Extends from Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort (Container to export thermofluid flow models with two ports as an FMU).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Booleanuse_p_intrue= true to use a pressure from connector, false to output Medium.p_default
MassFlowRatem_flow_nominal0.01Nominal mass flow rate [kg/s]
PressureDifferencedp_nominal500Pressure drop at nominal mass flow rate [Pa]
Assumptions
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
InletinletFluid inlet
OutletoutletFluid outlet
input RealInputdp_inPrescribed pressure rise [Pa]

Modelica definition

block Fan "Declaration of an FMU that exports a fan" extends Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort( redeclare replaceable package Medium = Buildings.Media.Air, redeclare final Movers.FlowControlled_dp com( final m_flow_nominal=m_flow_nominal, final use_inputFilter= false, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState)); parameter Modelica.SIunits.MassFlowRate m_flow_nominal=0.01 "Nominal mass flow rate"; parameter Modelica.SIunits.PressureDifference dp_nominal(displayUnit="Pa")=500 "Pressure drop at nominal mass flow rate"; Modelica.Blocks.Interfaces.RealInput dp_in(min=0, final unit="Pa") "Prescribed pressure rise"; equation connect(dp_in, com.dp_in); end Fan;

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.FlowSplitter_u Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.FlowSplitter_u

Declaration of an FMU that exports a flow splitter

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.FlowSplitter_u

Information

This example demonstrates how to export an FMU with a fluid flow component. The FMU is an instance of Buildings.Fluid.FMI.FlowSplitter_u.

Extends from Buildings.Fluid.FMI.FlowSplitter_u (Model of a flow splitter that can be exported as an FMU).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
MassFlowRatem_flow_nominal[nout]{0.1,0.2}Nominal mass flow rate for each outlet [kg/s]
Integernout2Number of outlets
Booleanuse_p_intrue= true to use a pressure from connector, false to output Medium.p_default

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
InletinletFluid inlet
Outletoutlet[nout]Fluid outlet
input RealInputu[nout]Control signal for the mass flow rates [1]

Modelica definition

block FlowSplitter_u "Declaration of an FMU that exports a flow splitter" extends Buildings.Fluid.FMI.FlowSplitter_u( redeclare replaceable package Medium = Buildings.Media.Air, nout=2, m_flow_nominal={0.1, 0.2}, allowFlowReversal(start=false)); end FlowSplitter_u;

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZone Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZone

Declaration of an FMU that exports a simple convective only HVAC system

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZone

Information

This example demonstrates how to export a model of an HVAC system that only provides convective cooling to a single thermal zone. The HVAC system is adapted from Buildings.Examples.Tutorial.SpaceCooling.System3, but flow resistances have been added to have the same configuration as Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZones. Having the same configuration is needed for the validation test Buildings.Fluid.FMI.ExportContainers.Validation.RoomHVAC.

The example extends from Buildings.Fluid.FMI.ExportContainers.HVACZone which provides the input and output signals that are needed to interface the acausal HVAC system model with causal connectors of FMI. The instance hvacAda is the HVAC adapter that contains on the left a fluid port, and on the right signal ports which are then used to connect at the top-level of the model to signal ports which are exposed at the FMU interface.

Extends from Buildings.Fluid.FMI.ExportContainers.HVACZone (Partial block to export an HVAC system that has no radiative component and that serves multiple zones as an FMU).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
replaceable package MediumABuildings.Media.AirMedium for air
replaceable package MediumWBuildings.Media.WaterMedium for water
Realeps0.8Heat recovery effectiveness
TemperatureTASup_nominal273.15 + 18Nominal air temperature supplied to room [K]
TemperatureTRooSet273.15 + 24Nominal room air temperature [K]
TemperatureTOut_nominal273.15 + 30Design outlet air temperature [K]
TemperatureTHeaRecLvgTOut_nominal - eps*(TOut_nom...Air temperature leaving the heat recovery [K]
RealUA10E3Average UA-value of the room [W/K]
HeatFlowRateQRooInt_flow1000Internal heat gains of the room [W]
HeatFlowRateQRooC_flow_nominal-QRooInt_flow - UA/30*(TOut_...Nominal cooling load of the room [W]
MassFlowRatemA_flow_nominal1.3*QRooC_flow_nominal/1006/...Nominal air mass flow rate, increased by factor 1.3 to allow for recovery after temperature setback [kg/s]
TemperatureDifferencedTFan2Estimated temperature raise across fan that needs to be made up by the cooling coil [K]
HeatFlowRateQCoiC_flow_nominal4*(QRooC_flow_nominal + mA_f...Cooling load of coil, taking into account economizer, and increased due to latent heat removal [W]
TemperatureTWSup_nominal273.15 + 16Water supply temperature [K]
TemperatureTWRet_nominal273.15 + 12Water return temperature [K]
MassFlowRatemW_flow_nominalQCoiC_flow_nominal/(TWRet_no...Nominal water mass flow rate [kg/s]
ConstantEffectivenesscooCoiredeclare Buildings.Fluid.He...Cooling coil (with sensible cooling only)
Assumptions
BooleanallowFlowReversalfalse= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
OutletfluPor[size(hvacAda.fluPor, 1)]Fluid connector
input RealInputTRadZonRadiative temperature of the zone [K]
output RealOutputQGaiRad_flowRadiant heat input into zone (positive if heat gain) [W]
output RealOutputQGaiSenCon_flowConvective sensible heat input into zone (positive if heat gain) [W]
output RealOutputQGaiLat_flowLatent heat input into zone (positive if heat gain) [W]
replaceable package MediumAMedium for air
replaceable package MediumWMedium for water
BusweaBusWeather data bus
output RealOutputTOutOutdoor temperature [K]

Modelica definition

block HVACZone "Declaration of an FMU that exports a simple convective only HVAC system" extends Buildings.Fluid.FMI.ExportContainers.HVACZone( redeclare final package Medium = MediumA, hvacAda(nPorts=2)); replaceable package MediumA = Buildings.Media.Air "Medium for air"; replaceable package MediumW = Buildings.Media.Water "Medium for water"; parameter Boolean allowFlowReversal = false "= true to allow flow reversal, false restricts to design direction (inlet -> outlet)"; ////////////////////////////////////////////////////////// // Heat recovery effectiveness parameter Real eps = 0.8 "Heat recovery effectiveness"; ///////////////////////////////////////////////////////// // Air temperatures at design conditions parameter Modelica.SIunits.Temperature TASup_nominal = 273.15+18 "Nominal air temperature supplied to room"; parameter Modelica.SIunits.Temperature TRooSet = 273.15+24 "Nominal room air temperature"; parameter Modelica.SIunits.Temperature TOut_nominal = 273.15+30 "Design outlet air temperature"; parameter Modelica.SIunits.Temperature THeaRecLvg= TOut_nominal - eps*(TOut_nominal-TRooSet) "Air temperature leaving the heat recovery"; ///////////////////////////////////////////////////////// // Cooling loads and air mass flow rates parameter Real UA(unit="W/K") = 10E3 "Average UA-value of the room"; parameter Modelica.SIunits.HeatFlowRate QRooInt_flow= 1000 "Internal heat gains of the room"; parameter Modelica.SIunits.HeatFlowRate QRooC_flow_nominal= -QRooInt_flow-UA/30*(TOut_nominal-TRooSet) "Nominal cooling load of the room"; parameter Modelica.SIunits.MassFlowRate mA_flow_nominal= 1.3*QRooC_flow_nominal/1006/(TASup_nominal-TRooSet) "Nominal air mass flow rate, increased by factor 1.3 to allow for recovery after temperature setback"; parameter Modelica.SIunits.TemperatureDifference dTFan = 2 "Estimated temperature raise across fan that needs to be made up by the cooling coil"; parameter Modelica.SIunits.HeatFlowRate QCoiC_flow_nominal=4* (QRooC_flow_nominal + mA_flow_nominal*(TASup_nominal-THeaRecLvg-dTFan)*1006) "Cooling load of coil, taking into account economizer, and increased due to latent heat removal"; ///////////////////////////////////////////////////////// // Water temperatures and mass flow rates parameter Modelica.SIunits.Temperature TWSup_nominal = 273.15+16 "Water supply temperature"; parameter Modelica.SIunits.Temperature TWRet_nominal = 273.15+12 "Water return temperature"; parameter Modelica.SIunits.MassFlowRate mW_flow_nominal= QCoiC_flow_nominal/(TWRet_nominal-TWSup_nominal)/4200 "Nominal water mass flow rate"; ///////////////////////////////////////////////////////// // HVAC models Modelica.Blocks.Sources.Constant zero(k=0) "Zero output signal"; Movers.FlowControlled_m_flow fan( redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, allowFlowReversal=allowFlowReversal, nominalValuesDefineDefaultPressureCurve=true) "Supply air fan"; HeatExchangers.ConstantEffectiveness hex( redeclare package Medium1 = MediumA, redeclare package Medium2 = MediumA, m1_flow_nominal=mA_flow_nominal, m2_flow_nominal=mA_flow_nominal, dp1_nominal=200, dp2_nominal=200, eps=eps, allowFlowReversal1=allowFlowReversal, allowFlowReversal2=allowFlowReversal) "Heat recovery"; replaceable Buildings.Fluid.HeatExchangers.ConstantEffectiveness cooCoi( dp1_nominal=6000, dp2_nominal=200, show_T=true, allowFlowReversal1=allowFlowReversal, allowFlowReversal2=allowFlowReversal) constrainedby Buildings.Fluid.Interfaces.PartialFourPortInterface( redeclare package Medium1 = MediumW, redeclare package Medium2 = MediumA, m1_flow_nominal=mW_flow_nominal, m2_flow_nominal=mA_flow_nominal) "Cooling coil (with sensible cooling only)"; Buildings.Fluid.Sources.Outside out( redeclare package Medium = MediumA, nPorts=2) "Outside air boundary condition"; Sources.MassFlowSource_T souWat( redeclare package Medium = MediumW, nPorts=1, use_m_flow_in=true, T=TWSup_nominal) "Source for water flow rate"; Sources.FixedBoundary sinWat( redeclare package Medium = MediumW, nPorts=1) "Sink for water circuit"; Modelica.Blocks.Sources.Constant mAir_flow(k=mA_flow_nominal) "Fan air flow rate"; Sensors.TemperatureTwoPort senTemHXOut( redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal, allowFlowReversal=allowFlowReversal) "Temperature sensor for heat recovery outlet on supply side"; Sensors.TemperatureTwoPort senTemSupAir( redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal, allowFlowReversal=allowFlowReversal) "Temperature sensor for supply air"; Modelica.Blocks.Logical.OnOffController con(bandwidth=1) "Controller for coil water flow rate"; Modelica.Blocks.Sources.Constant TRooSetPoi(k=TRooSet) "Room temperature set point"; Modelica.Blocks.Math.BooleanToReal mWat_flow( realTrue = 0, realFalse = mW_flow_nominal) "Conversion from boolean to real for water flow rate"; BoundaryConditions.WeatherData.ReaderTMY3 weaDat( pAtmSou=Buildings.BoundaryConditions.Types.DataSource.Parameter, TDryBul=TOut_nominal, filNam="modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos", TDryBulSou=Buildings.BoundaryConditions.Types.DataSource.File, computeWetBulbTemperature=false) "Weather data reader"; BoundaryConditions.WeatherData.Bus weaBus "Weather data bus"; Modelica.Blocks.Interfaces.RealOutput TOut(final unit="K") "Outdoor temperature"; FixedResistances.PressureDrop resSup1( redeclare package Medium = MediumA, linearized=true, dp_nominal=10, m_flow_nominal=mA_flow_nominal) "Fixed resistance for supply air inlet"; FixedResistances.PressureDrop resRet1( redeclare package Medium = MediumA, dp_nominal=200, linearized=true, m_flow_nominal=mA_flow_nominal) "Fixed resistance for return air duct"; equation connect(zero.y, QGaiRad_flow); connect(zero.y, QGaiSenCon_flow); connect(zero.y, QGaiLat_flow); connect(out.ports[1],hex. port_a1); connect(out.ports[2],hex. port_b2); connect(souWat.ports[1],cooCoi. port_a1); connect(fan.m_flow_in,mAir_flow. y); connect(hex.port_b1,senTemHXOut. port_a); connect(senTemHXOut.port_b,cooCoi. port_a2); connect(cooCoi.port_b2,senTemSupAir. port_a); connect(senTemSupAir.port_b,fan. port_a); connect(TRooSetPoi.y,con. reference); connect(con.y,mWat_flow. u); connect(mWat_flow.y,souWat. m_flow_in); connect(weaDat.weaBus,weaBus); connect(TOut,weaBus. TDryBul); connect(sinWat.ports[1], cooCoi.port_b1); connect(con.u, hvacAda.TAirZon[1]); connect(resSup1.port_b, hvacAda.ports[1]); connect(resRet1.port_a, hvacAda.ports[2]); connect(fan.port_b, resSup1.port_a); connect(resRet1.port_b, hex.port_a2); connect(out.weaBus, weaBus); end HVACZone;

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZones Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZones

Declaration of an FMU that exports a simple convective only HVAC system for two zones

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZones

Information

This example demonstrates how to export a model of an HVAC system that only provides convective cooling to two thermal zones. The example is similar to Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZone except that is serves two thermal zones rather than one.

The example extends from Buildings.Fluid.FMI.ExportContainers.HVACZones which provides the input and output signals that are needed to interface the acausal HVAC system model with causal connectors of FMI. The instance hvacAda is the HVAC adapter that contains on the left a fluid port, and on the right signal ports which are then used to connect at the top-level of the model to signal ports which are exposed at the FMU interface.

Extends from Buildings.Fluid.FMI.ExportContainers.HVACZones (Partial block to export an HVAC system that has no radiative component and that serves multiple zones as an FMU).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
IntegernZon2Number of thermal zones served by the HVAC system
IntegernPorts3Number of fluid ports for each zone (must be the same for every zone)
replaceable package MediumABuildings.Media.AirMedium for air
replaceable package MediumWBuildings.Media.WaterMedium for water
Realeps0.8Heat recovery effectiveness
TemperatureTASup_nominal273.15 + 18Nominal air temperature supplied to room [K]
TemperatureTRooSet273.15 + 24Nominal room air temperature [K]
TemperatureTOut_nominal273.15 + 30Design outlet air temperature [K]
TemperatureTHeaRecLvgTOut_nominal - eps*(TOut_nom...Air temperature leaving the heat recovery [K]
RealUA10E3Average UA-value of the room [W/K]
HeatFlowRateQRooInt_flow1000Internal heat gains of the room [W]
HeatFlowRateQRooC_flow_nominal-QRooInt_flow - UA/30*(TOut_...Nominal cooling load of the room [W]
MassFlowRatemA_flow_nominal1.3*QRooC_flow_nominal/1006/...Nominal air mass flow rate, increased by factor 1.3 to allow for recovery after temperature setback [kg/s]
TemperatureDifferencedTFan2Estimated temperature raise across fan that needs to be made up by the cooling coil [K]
HeatFlowRateQCoiC_flow_nominal4*(QRooC_flow_nominal + mA_f...Cooling load of coil, taking into account economizer, and increased due to latent heat removal [W]
TemperatureTWSup_nominal273.15 + 16Water supply temperature [K]
TemperatureTWRet_nominal273.15 + 12Water return temperature [K]
MassFlowRatemW_flow_nominalQCoiC_flow_nominal/(TWRet_no...Nominal water mass flow rate [kg/s]
ConstantEffectivenesscooCoiredeclare Buildings.Fluid.He...Cooling coil (with sensible cooling only)
Assumptions
BooleanallowFlowReversalfalse= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
OutletfluPor[nZon, nPorts]Fluid connectors
input RealInputTRadZon[nZon]Radiative temperature of the zone [K]
output RealOutputQGaiRad_flow[nZon]Radiant heat input into the zones (positive if heat gain) [W]
output RealOutputQGaiSenCon_flow[nZon]Convective sensible heat input into the zones (positive if heat gain) [W]
output RealOutputQGaiLat_flow[nZon]Latent heat input into the zones (positive if heat gain) [W]
replaceable package MediumAMedium for air
replaceable package MediumWMedium for water
BusweaBusWeather data bus
output RealOutputTOutOutdoor temperature [K]

Modelica definition

block HVACZones "Declaration of an FMU that exports a simple convective only HVAC system for two zones" extends Buildings.Fluid.FMI.ExportContainers.HVACZones( redeclare final package Medium = MediumA, nZon = 2, nPorts = 3); replaceable package MediumA = Buildings.Media.Air "Medium for air"; replaceable package MediumW = Buildings.Media.Water "Medium for water"; parameter Boolean allowFlowReversal = false "= true to allow flow reversal, false restricts to design direction (inlet -> outlet)"; // parameter Modelica.SIunits.Volume V=6*10*3 "Room volume"; ////////////////////////////////////////////////////////// // Heat recovery effectiveness parameter Real eps = 0.8 "Heat recovery effectiveness"; ///////////////////////////////////////////////////////// // Air temperatures at design conditions parameter Modelica.SIunits.Temperature TASup_nominal = 273.15+18 "Nominal air temperature supplied to room"; parameter Modelica.SIunits.Temperature TRooSet = 273.15+24 "Nominal room air temperature"; parameter Modelica.SIunits.Temperature TOut_nominal = 273.15+30 "Design outlet air temperature"; parameter Modelica.SIunits.Temperature THeaRecLvg= TOut_nominal - eps*(TOut_nominal-TRooSet) "Air temperature leaving the heat recovery"; ///////////////////////////////////////////////////////// // Cooling loads and air mass flow rates parameter Real UA(unit="W/K") = 10E3 "Average UA-value of the room"; parameter Modelica.SIunits.HeatFlowRate QRooInt_flow= 1000 "Internal heat gains of the room"; parameter Modelica.SIunits.HeatFlowRate QRooC_flow_nominal= -QRooInt_flow-UA/30*(TOut_nominal-TRooSet) "Nominal cooling load of the room"; parameter Modelica.SIunits.MassFlowRate mA_flow_nominal= 1.3*QRooC_flow_nominal/1006/(TASup_nominal-TRooSet) "Nominal air mass flow rate, increased by factor 1.3 to allow for recovery after temperature setback"; parameter Modelica.SIunits.TemperatureDifference dTFan = 2 "Estimated temperature raise across fan that needs to be made up by the cooling coil"; parameter Modelica.SIunits.HeatFlowRate QCoiC_flow_nominal=4* (QRooC_flow_nominal + mA_flow_nominal*(TASup_nominal-THeaRecLvg-dTFan)*1006) "Cooling load of coil, taking into account economizer, and increased due to latent heat removal"; ///////////////////////////////////////////////////////// // Water temperatures and mass flow rates parameter Modelica.SIunits.Temperature TWSup_nominal = 273.15+16 "Water supply temperature"; parameter Modelica.SIunits.Temperature TWRet_nominal = 273.15+12 "Water return temperature"; parameter Modelica.SIunits.MassFlowRate mW_flow_nominal= QCoiC_flow_nominal/(TWRet_nominal-TWSup_nominal)/4200 "Nominal water mass flow rate"; ///////////////////////////////////////////////////////// // HVAC models Modelica.Blocks.Sources.Constant zer[nZon](each k=0) "Zero output signal"; Movers.FlowControlled_m_flow fan( redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, allowFlowReversal=allowFlowReversal) "Supply air fan"; HeatExchangers.ConstantEffectiveness hex( redeclare package Medium1 = MediumA, redeclare package Medium2 = MediumA, m1_flow_nominal=mA_flow_nominal, m2_flow_nominal=mA_flow_nominal, dp1_nominal=200, dp2_nominal=200, eps=eps, allowFlowReversal1=allowFlowReversal, allowFlowReversal2=allowFlowReversal) "Heat recovery"; replaceable Buildings.Fluid.HeatExchangers.ConstantEffectiveness cooCoi( dp1_nominal=6000, dp2_nominal=200, show_T=true, allowFlowReversal1=allowFlowReversal, allowFlowReversal2=allowFlowReversal) constrainedby Buildings.Fluid.Interfaces.PartialFourPortInterface( redeclare package Medium1 = MediumW, redeclare package Medium2 = MediumA, m1_flow_nominal=mW_flow_nominal, m2_flow_nominal=mA_flow_nominal) "Cooling coil (with sensible cooling only)"; Buildings.Fluid.Sources.Outside out( redeclare package Medium = MediumA, nPorts=3) "Outside air boundary condition"; Sources.MassFlowSource_T souWat( nPorts=1, redeclare package Medium = MediumW, use_m_flow_in=true, T=TWSup_nominal) "Source for water flow rate"; Sources.FixedBoundary sinWat( redeclare package Medium = MediumW, nPorts=1) "Sink for water circuit"; Modelica.Blocks.Sources.Constant mAir_flow(k=mA_flow_nominal) "Fan air flow rate"; Sensors.TemperatureTwoPort senTemHXOut( redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal, allowFlowReversal=allowFlowReversal) "Temperature sensor for heat recovery outlet on supply side"; Sensors.TemperatureTwoPort senTemSupAir( redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal, allowFlowReversal=allowFlowReversal) "Temperature sensor for supply air"; Modelica.Blocks.Logical.OnOffController con(bandwidth=1) "Controller for coil water flow rate"; Modelica.Blocks.Sources.Constant TRooSetPoi(k=TRooSet) "Room temperature set point"; Modelica.Blocks.Math.BooleanToReal mWat_flow( realTrue = 0, realFalse = mW_flow_nominal) "Conversion from boolean to real for water flow rate"; BoundaryConditions.WeatherData.ReaderTMY3 weaDat( pAtmSou=Buildings.BoundaryConditions.Types.DataSource.Parameter, TDryBul=TOut_nominal, filNam="modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos", TDryBulSou=Buildings.BoundaryConditions.Types.DataSource.File, computeWetBulbTemperature=false) "Weather data reader"; BoundaryConditions.WeatherData.Bus weaBus "Weather data bus"; Modelica.Blocks.Interfaces.RealOutput TOut(final unit="K") "Outdoor temperature"; Modelica.Blocks.Math.Min min; Movers.FlowControlled_m_flow fan2( redeclare package Medium = MediumA, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, allowFlowReversal=allowFlowReversal, m_flow_nominal=mA_flow_nominal/10, inputType=Buildings.Fluid.Types.InputType.Constant) "Supply air fan that extracts a constant amount of outside air"; Buildings.Fluid.FixedResistances.PressureDrop res( redeclare package Medium = MediumA, m_flow_nominal=0.1*mA_flow_nominal, dp_nominal=200, linearized=true) "Fixed resistance for exhaust air duct"; Buildings.Fluid.FixedResistances.PressureDrop resSup1( redeclare package Medium = MediumA, linearized=true, m_flow_nominal=0.5*mA_flow_nominal, dp_nominal=10) "Fixed resistance for supply air inlet"; Buildings.Fluid.FixedResistances.PressureDrop resSup2( redeclare package Medium = MediumA, linearized=true, m_flow_nominal=0.5*mA_flow_nominal, dp_nominal=10) "Fixed resistance for supply air inlet"; Buildings.Fluid.FixedResistances.PressureDrop resRet1( redeclare package Medium = MediumA, dp_nominal=200, linearized=true, m_flow_nominal=0.5*mA_flow_nominal) "Fixed resistance for return air duct"; Buildings.Fluid.FixedResistances.PressureDrop resRet2( redeclare package Medium = MediumA, dp_nominal=200, linearized=true, m_flow_nominal=0.5*mA_flow_nominal) "Fixed resistance for return air duct"; equation connect(zer.y, QGaiRad_flow); connect(zer.y, QGaiSenCon_flow); connect(zer.y, QGaiLat_flow); connect(out.ports[1],hex. port_a1); connect(out.ports[2],hex. port_b2); connect(souWat.ports[1],cooCoi. port_a1); connect(fan.m_flow_in,mAir_flow. y); connect(hex.port_b1,senTemHXOut. port_a); connect(senTemHXOut.port_b,cooCoi. port_a2); connect(cooCoi.port_b2,senTemSupAir. port_a); connect(senTemSupAir.port_b,fan. port_a); connect(TRooSetPoi.y,con. reference); connect(con.y,mWat_flow. u); connect(mWat_flow.y,souWat. m_flow_in); connect(weaDat.weaBus,weaBus); connect(TOut,weaBus. TDryBul); connect(sinWat.ports[1], cooCoi.port_b1); connect(min.y, con.u); connect(fan2.port_b, res.port_a); connect(res.port_b, out.ports[3]); connect(fan.port_b, resSup1.port_a); connect(fan.port_b, resSup2.port_a); connect(resSup1.port_b, hvacAda[1].ports[1]); connect(resSup2.port_b, hvacAda[2].ports[1]); connect(hvacAda[1].ports[3], fan2.port_a); connect(hvacAda[2].ports[3], fan2.port_a); connect(hvacAda[1].TAirZon[1], min.u1); connect(hvacAda[2].TAirZon[1], min.u2); connect(resRet1.port_b, hex.port_a2); connect(resRet2.port_b, hex.port_a2); connect(resRet1.port_a, hvacAda[1].ports[2]); connect(resRet2.port_a, hvacAda[2].ports[2]); connect(out.weaBus, weaBus); end HVACZones;

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HeaterCooler_T Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HeaterCooler_T

Declaration of an FMU that exports an ideal heater or cooler with prescribed outlet temperature

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HeaterCooler_T

Information

This example demonstrates how to export an FMU with a heater that takes as an input signal the leaving fluid temperature. The FMU has an instance of Buildings.Fluid.HeatExchangers.HeaterCooler_T.

Extends from Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort (Container to export thermofluid flow models with two ports as an FMU).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Booleanuse_p_intrue= true to use a pressure from connector, false to output Medium.p_default
HeatFlowRateQ_flow_maxHeatModelica.Constants.infMaximum heat flow rate for heating (positive) [W]
HeatFlowRateQ_flow_maxCool-Modelica.Constants.infMaximum heat flow rate for cooling (negative) [W]
MassFlowRatem_flow_nominal0.01Nominal mass flow rate [kg/s]
PressureDifferencedp_nominal0Pressure [Pa]
Assumptions
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
InletinletFluid inlet
OutletoutletFluid outlet
input RealInputTSetSet point temperature of the fluid that leaves port_b [K]
output RealOutputQ_flowHeat added to the fluid (if flow is from port_a to port_b) [W]

Modelica definition

block HeaterCooler_T "Declaration of an FMU that exports an ideal heater or cooler with prescribed outlet temperature" extends Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort( redeclare replaceable package Medium = Buildings.Media.Air, redeclare final Buildings.Fluid.HeatExchangers.HeaterCooler_T com( final m_flow_nominal=m_flow_nominal, final dp_nominal=if use_p_in then dp_nominal else 0, final Q_flow_maxHeat=Q_flow_maxHeat, final Q_flow_maxCool=Q_flow_maxCool, final energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState)); parameter Modelica.SIunits.HeatFlowRate Q_flow_maxHeat=Modelica.Constants.inf "Maximum heat flow rate for heating (positive)"; parameter Modelica.SIunits.HeatFlowRate Q_flow_maxCool=-Modelica.Constants.inf "Maximum heat flow rate for cooling (negative)"; parameter Modelica.SIunits.MassFlowRate m_flow_nominal=0.01 "Nominal mass flow rate"; parameter Modelica.SIunits.PressureDifference dp_nominal(displayUnit="Pa")=0 "Pressure"; Modelica.Blocks.Interfaces.RealInput TSet(unit="K", displayUnit="degC") "Set point temperature of the fluid that leaves port_b"; Modelica.Blocks.Interfaces.RealOutput Q_flow(unit="W") "Heat added to the fluid (if flow is from port_a to port_b)"; equation connect(com.TSet, TSet); connect(com.Q_flow, Q_flow); end HeaterCooler_T;

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HeaterCooler_u Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HeaterCooler_u

Declaration of an FMU that exports an ideal heater or cooler with prescribed heat flow rate

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HeaterCooler_u

Information

This example demonstrates how to export an FMU with a heater that takes as an input signal the normalized heat flow rate. The FMU has an instance of Buildings.Fluid.HeatExchangers.HeaterCooler_u.

The mass dynamics has been set to massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState. See the user's guide for the rationale.

Extends from Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort (Container to export thermofluid flow models with two ports as an FMU).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Booleanuse_p_intrue= true to use a pressure from connector, false to output Medium.p_default
MassFlowRatem_flow_nominal0.01Nominal mass flow rate [kg/s]
PressureDifferencedp_nominal0Pressure [Pa]
HeatFlowRateQ_flow_nominal100Heat flow rate at u=1, positive for heating [W]
Assumptions
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
InletinletFluid inlet
OutletoutletFluid outlet
input RealInputuControl input [1]

Modelica definition

block HeaterCooler_u "Declaration of an FMU that exports an ideal heater or cooler with prescribed heat flow rate" extends Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort( redeclare replaceable package Medium = Buildings.Media.Air, redeclare final Buildings.Fluid.HeatExchangers.HeaterCooler_u com( final m_flow_nominal=m_flow_nominal, final dp_nominal=if use_p_in then dp_nominal else 0, final Q_flow_nominal=Q_flow_nominal, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState)); parameter Modelica.SIunits.MassFlowRate m_flow_nominal=0.01 "Nominal mass flow rate"; parameter Modelica.SIunits.PressureDifference dp_nominal(displayUnit="Pa")=0 "Pressure"; parameter Modelica.SIunits.HeatFlowRate Q_flow_nominal=100 "Heat flow rate at u=1, positive for heating"; Modelica.Blocks.Interfaces.RealInput u(min=0, max=1, unit="1") "Control input"; equation connect(com.u, u); end HeaterCooler_u;

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.Humidifier_u Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.Humidifier_u

Declaration of an FMU that exports an ideal humidifier

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.Humidifier_u

Information

This example demonstrates how to export an FMU with a humidifier that takes as an input signal the normalized mass flow rate of water that will be added to the medium. The FMU has an instance of Buildings.Fluid.MassExchangers.Humidifier_u.

The mass dynamics has been set to massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState. See the user's guide for the rationale.

Extends from Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort (Container to export thermofluid flow models with two ports as an FMU).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Booleanuse_p_intrue= true to use a pressure from connector, false to output Medium.p_default
MassFlowRatem_flow_nominal0.01Nominal mass flow rate [kg/s]
PressureDifferencedp_nominal0Pressure [Pa]
TemperatureT293.15Temperature of water that is added to the fluid stream (used if use_T_in=false) [K]
MassFlowRatemWat_flow_nominal0.01*0.005Water mass flow rate at u=1, positive for humidification [kg/s]
Assumptions
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
InletinletFluid inlet
OutletoutletFluid outlet
input RealInputuControl input [1]

Modelica definition

block Humidifier_u "Declaration of an FMU that exports an ideal humidifier" extends Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort( redeclare replaceable package Medium = Buildings.Media.Air, redeclare final Buildings.Fluid.MassExchangers.Humidifier_u com( final m_flow_nominal=m_flow_nominal, final dp_nominal=if use_p_in then dp_nominal else 0, final mWat_flow_nominal=mWat_flow_nominal, final T=T, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, final energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState)); parameter Modelica.SIunits.MassFlowRate m_flow_nominal=0.01 "Nominal mass flow rate"; parameter Modelica.SIunits.PressureDifference dp_nominal(displayUnit="Pa")=0 "Pressure"; parameter Modelica.SIunits.Temperature T = 293.15 "Temperature of water that is added to the fluid stream (used if use_T_in=false)"; parameter Modelica.SIunits.MassFlowRate mWat_flow_nominal=0.01*0.005 "Water mass flow rate at u=1, positive for humidification"; Modelica.Blocks.Interfaces.RealInput u(min=0, max=1, unit="1") "Control input"; equation connect(com.u, u); end Humidifier_u;

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.IdealSource_m_flow Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.IdealSource_m_flow

Declaration of an FMU that exports a mass flow source and sink

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.IdealSource_m_flow

Information

This example demonstrates how to export an FMU that sets the mass flow rate.

Extends from Buildings.Fluid.FMI.ExportContainers.PartialTwoPort (Partial block to be used as a container to export a thermofluid flow model with two ports).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Booleanuse_p_intrue= true to use a pressure from connector, false to output Medium.p_default
Assumptions
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
InletinletFluid inlet
OutletoutletFluid outlet
input RealInputm_flow_inPrescribed mass flow rate [kg/s]

Modelica definition

block IdealSource_m_flow "Declaration of an FMU that exports a mass flow source and sink" extends Buildings.Fluid.FMI.ExportContainers.PartialTwoPort( redeclare replaceable package Medium = Buildings.Media.Air); Modelica.Blocks.Interfaces.RealInput m_flow_in(final unit="kg/s") "Prescribed mass flow rate"; equation assert(abs(inlet.m_flow-outlet.m_flow) < 1E-2, "The mass flow rate of port_a and port_b is not conserved. This indicates a wrong configuration of your system model."); outlet.m_flow = m_flow_in; // We use connect statements // because outlet.backward and inlet.backward // is removed if allowFlowReversal=false. // The connect is applied on the components of the port // to avoid also connecting the mass flow rate which would // yield an overdetermined system of equations. connect(inlet.forward, outlet.forward); connect(outlet.backward, inlet.backward); connect(outlet.p, inlet.p); end IdealSource_m_flow;

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.MixingVolume Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.MixingVolume

Declaration of an FMU that exports a control volume

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.MixingVolume

Information

This example demonstrates how to export an FMU with a control volume. The FMU has an instance of Buildings.Fluid.MixingVolumes.MixingVolume.

The mass dynamics has been set to massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState. See the user's guide for the rationale.

Extends from Buildings.Fluid.FMI.ExportContainers.PartialTwoPort (Partial block to be used as a container to export a thermofluid flow model with two ports).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Booleanuse_p_intrue= true to use a pressure from connector, false to output Medium.p_default
VolumeV1Volume [m3]
MassFlowRatem_flow_nominal0.01Nominal mass flow rate [kg/s]
Assumptions
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
InletinletFluid inlet
OutletoutletFluid outlet

Modelica definition

block MixingVolume "Declaration of an FMU that exports a control volume" extends Buildings.Fluid.FMI.ExportContainers.PartialTwoPort( redeclare package Medium = Buildings.Media.Air); parameter Modelica.SIunits.Volume V=1 "Volume"; parameter Modelica.SIunits.MassFlowRate m_flow_nominal=0.01 "Nominal mass flow rate"; protected Buildings.Fluid.FMI.Adaptors.Inlet bouIn( redeclare final package Medium=Medium, final allowFlowReversal=allowFlowReversal) "Boundary model for inlet"; Buildings.Fluid.FMI.Adaptors.Outlet bouOut( redeclare final package Medium=Medium, final allowFlowReversal=allowFlowReversal) "Boundary component for outlet"; Buildings.Fluid.MixingVolumes.MixingVolume vol( redeclare final package Medium = Medium, final m_flow_nominal=m_flow_nominal, final allowFlowReversal=allowFlowReversal, final V=V, nPorts=2, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) "Control volume"; equation connect(inlet, bouIn.inlet); connect(bouOut.outlet, outlet); connect(bouIn.p, bouOut.p); connect(bouIn.port_b, vol.ports[1]); connect(vol.ports[2], bouOut.port_a); end MixingVolume;

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.PressureDrop Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.PressureDrop

Declaration of an FMU that exports a fixed resistance

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.PressureDrop

Information

This example demonstrates how to export an FMU with a fluid flow component. The FMU has an instance of Buildings.Fluid.FixedResistances.PressureDrop.

Extends from Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort (Container to export thermofluid flow models with two ports as an FMU).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Booleanuse_p_intrue= true to use a pressure from connector, false to output Medium.p_default
MassFlowRatem_flow_nominal0.01Nominal mass flow rate [kg/s]
PressureDifferencedp_nominal100Pressure drop at nominal mass flow rate [Pa]
Assumptions
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
InletinletFluid inlet
OutletoutletFluid outlet

Modelica definition

block PressureDrop "Declaration of an FMU that exports a fixed resistance" extends Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort( redeclare replaceable package Medium = Buildings.Media.Air, redeclare final Buildings.Fluid.FixedResistances.PressureDrop com(final m_flow_nominal= m_flow_nominal, final dp_nominal=if use_p_in then dp_nominal else 0)); parameter Modelica.SIunits.MassFlowRate m_flow_nominal=0.01 "Nominal mass flow rate"; parameter Modelica.SIunits.PressureDifference dp_nominal(displayUnit="Pa")=100 "Pressure drop at nominal mass flow rate"; end PressureDrop;

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ResistanceVolume Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ResistanceVolume

Declaration of an FMU that exports a flow resistance and control volume

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ResistanceVolume

Information

This example demonstrates how to export an FMU with a flow resistance and a control volume. The FMU has an instance of Buildings.Fluid.FixedResistances.PressureDrop and Buildings.Fluid.MixingVolumes.MixingVolume.

The mass dynamics has been set to massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState. See the user's guide for the rationale.

Extends from Buildings.Fluid.FMI.ExportContainers.PartialTwoPort (Partial block to be used as a container to export a thermofluid flow model with two ports).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Booleanuse_p_intrue= true to use a pressure from connector, false to output Medium.p_default
VolumeV1Volume [m3]
MassFlowRatem_flow_nominal0.01Nominal mass flow rate [kg/s]
PressureDifferencedp_nominal100Nominal pressure drop [Pa]
Assumptions
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
InletinletFluid inlet
OutletoutletFluid outlet

Modelica definition

block ResistanceVolume "Declaration of an FMU that exports a flow resistance and control volume" extends Buildings.Fluid.FMI.ExportContainers.PartialTwoPort( redeclare package Medium = Buildings.Media.Air); parameter Modelica.SIunits.Volume V=1 "Volume"; parameter Modelica.SIunits.MassFlowRate m_flow_nominal=0.01 "Nominal mass flow rate"; parameter Modelica.SIunits.PressureDifference dp_nominal=100 "Nominal pressure drop"; Modelica.Blocks.Sources.RealExpression dpCom(y=res.port_a.p - res.port_b.p) if use_p_in "Pressure drop of the component"; protected Buildings.Fluid.FMI.Adaptors.Inlet bouIn( redeclare final package Medium=Medium, final allowFlowReversal=allowFlowReversal, final use_p_in=use_p_in) "Boundary model for inlet"; Buildings.Fluid.FMI.Adaptors.Outlet bouOut( redeclare final package Medium=Medium, final allowFlowReversal=allowFlowReversal, final use_p_in=use_p_in) "Boundary component for outlet"; Modelica.Blocks.Math.Feedback pOut if use_p_in "Pressure at component outlet"; FixedResistances.PressureDrop res( redeclare final package Medium = Medium, final m_flow_nominal=m_flow_nominal, final dp_nominal=if use_p_in then dp_nominal else 0, final allowFlowReversal=allowFlowReversal) "Flow resistance"; Buildings.Fluid.MixingVolumes.MixingVolume vol( nPorts=2, redeclare final package Medium = Medium, final m_flow_nominal=m_flow_nominal, final allowFlowReversal=allowFlowReversal, final V=V, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) "Control volume"; equation connect(inlet, bouIn.inlet); connect(bouOut.outlet, outlet); connect(pOut.u1, bouIn.p); connect(pOut.y, bouOut.p); connect(res.port_b, vol.ports[1]); connect(bouIn.port_b, res.port_a); connect(dpCom.y, pOut.u2); connect(vol.ports[2], bouOut.port_a); end ResistanceVolume;

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ThermalZone Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ThermalZone

Declaration of an FMU that exports a thermal zone

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ThermalZone

Information

This example demonstrates how to export a model that contains one thermal zone with convective heat input from the HVAC system only. The thermal zone is connected to an adaptor so that it can be coupled to an air-based HVAC system. The thermal zone is taken from Buildings.Examples.Tutorial.SpaceCooling.System3 .

The example extends from Buildings.Fluid.FMI.ExportContainers.ThermalZone which provides the input and output signals that are needed to interface the acausal thermal zone model with causal connectors of FMI. The instance theZonAda is the thermal zone adaptor that contains on the right a fluid port, and on the left signal ports which are then used to connect at the top-level of the model to signal ports which are exposed at the FMU interface.

Extends from Buildings.Fluid.FMI.ExportContainers.ThermalZone (Partial block to export a model of a thermal zone as an FMU).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium model
IntegernPorts2Number of fluid ports
replaceable package MediumABuildings.Media.AirMedium for air
VolumeV6*10*3Room volume [m3]
TemperatureTASup_nominal273.15 + 18Nominal air temperature supplied to room [K]
TemperatureTRooSet273.15 + 24Nominal room air temperature [K]
TemperatureTOut_nominal273.15 + 30Design outlet air temperature [K]
HeatFlowRateQRooInt_flow1000Internal heat gains of the room [W]
HeatFlowRateQRooC_flow_nominal-QRooInt_flow - 10E3/30*(TOu...Nominal cooling load of the room [W]
MassFlowRatemA_flow_nominal1.3*QRooC_flow_nominal/1006/...Nominal air mass flow rate, increased by factor 1.3 to allow for recovery after temperature setback [kg/s]

Connectors

TypeNameDescription
replaceable package MediumMedium model
InletfluPor[nPorts]Fluid connector
replaceable package MediumAMedium for air
BusweaBusWeather data bus
output RealOutputTOutOutdoor temperature [K]
output RealOutputTRadRadiative temperature [K]

Modelica definition

model ThermalZone "Declaration of an FMU that exports a thermal zone" extends Buildings.Fluid.FMI.ExportContainers.ThermalZone( redeclare final package Medium = MediumA, nPorts = 2); replaceable package MediumA = Buildings.Media.Air "Medium for air"; parameter Modelica.SIunits.Volume V=6*10*3 "Room volume"; ///////////////////////////////////////////////////////// // Air temperatures at design conditions parameter Modelica.SIunits.Temperature TASup_nominal = 273.15+18 "Nominal air temperature supplied to room"; parameter Modelica.SIunits.Temperature TRooSet = 273.15+24 "Nominal room air temperature"; parameter Modelica.SIunits.Temperature TOut_nominal = 273.15+30 "Design outlet air temperature"; ///////////////////////////////////////////////////////// // Cooling loads and air mass flow rates parameter Modelica.SIunits.HeatFlowRate QRooInt_flow= 1000 "Internal heat gains of the room"; parameter Modelica.SIunits.HeatFlowRate QRooC_flow_nominal= -QRooInt_flow-10E3/30*(TOut_nominal-TRooSet) "Nominal cooling load of the room"; parameter Modelica.SIunits.MassFlowRate mA_flow_nominal= 1.3*QRooC_flow_nominal/1006/(TASup_nominal-TRooSet) "Nominal air mass flow rate, increased by factor 1.3 to allow for recovery after temperature setback"; BoundaryConditions.WeatherData.ReaderTMY3 weaDat( pAtmSou=Buildings.BoundaryConditions.Types.DataSource.Parameter, TDryBul=TOut_nominal, filNam="modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos", TDryBulSou=Buildings.BoundaryConditions.Types.DataSource.File, computeWetBulbTemperature=false) "Weather data reader"; BoundaryConditions.WeatherData.Bus weaBus "Weather data bus"; Modelica.Blocks.Interfaces.RealOutput TOut(final unit="K") "Outdoor temperature"; Modelica.Blocks.Interfaces.RealOutput TRad(final unit="K") "Radiative temperature"; Buildings.HeatTransfer.Sources.PrescribedTemperature TAirOut "Outside air temperature"; Modelica.Thermal.HeatTransfer.Components.ThermalConductor theCon(G=10000/30) "Thermal conductance with the ambient"; Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow preHea(Q_flow= QRooInt_flow) "Prescribed heat flow"; MixingVolumes.MixingVolumeMoistAir vol( redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal, V=V, mSenFac=3, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, nPorts=2); Modelica.Blocks.Sources.Constant mWat_flow(k=0.0) "mass flow rate"; Modelica.Blocks.Sources.Constant TWat(k=280.15) "Water temperature"; Sensors.MassFlowRate senMasFlo[nPorts](redeclare final package Medium = MediumA) "Mass flow rate sensor to connect thermal adapter with thermal zone."; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temSen "Temperature sensor (that approximates the radiative temperature by the air temperature)"; equation connect(weaDat.weaBus,weaBus); connect(theCon.port_b,vol. heatPort); connect(preHea.port,vol. heatPort); connect(TAirOut.T, weaBus.TDryBul); connect(TAirOut.port, theCon.port_a); connect(theZonAda.heaPorAir, vol.heatPort); connect(TOut, weaBus.TDryBul); connect(vol.mWat_flow, mWat_flow.y); connect(TWat.y, vol.TWat); connect(theZonAda.ports, senMasFlo.port_a); connect(senMasFlo.port_b, vol.ports[1:2]); connect(temSen.port, vol.heatPort); connect(temSen.T, TRad); end ThermalZone;

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ThermalZones Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ThermalZones

Declaration of an FMU that exports multiple thermal zones

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ThermalZones

Information

This example demonstrates how to export a model that contains two thermal zones with convective heat input from the HVAC system only. The thermal zones are connected to an adaptor so that they can be coupled to an air-based HVAC system. The thermal zone is taken from Buildings.Examples.Tutorial.SpaceCooling.System3 .

The example extends from Buildings.Fluid.FMI.ExportContainers.ThermalZones which provides the input and output signals that are needed to interface the acausal thermal zone models with causal connectors of FMI. The instance theZonAda is the thermal zone adaptor that contains on the right a fluid port, and on the left signal ports which are then used to connect at the top-level of the model to signal ports which are exposed at the FMU interface.

Extends from Buildings.Fluid.FMI.ExportContainers.ThermalZones (Partial block to export a model of multiple thermal zones as an FMU).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium model
IntegernZon2Number of thermal zones in this container
IntegernPorts3Number of fluid ports for each zone (must be the same for every zone)
replaceable package MediumABuildings.Media.AirMedium for air
VolumeV6*10*3Room volume [m3]
TemperatureTASup_nominal273.15 + 18Nominal air temperature supplied to room [K]
TemperatureTRooSet273.15 + 24Nominal room air temperature [K]
TemperatureTOut_nominal273.15 + 30Design outlet air temperature [K]
HeatFlowRateQRooInt_flow1000Internal heat gains of the room [W]
HeatFlowRateQRooC_flow_nominal-QRooInt_flow - 10E3/30*(TOu...Nominal cooling load of the room [W]
MassFlowRatemA_flow_nominal1.3*QRooC_flow_nominal/1006/...Nominal air mass flow rate, increased by factor 1.3 to allow for recovery after temperature setback [kg/s]

Connectors

TypeNameDescription
replaceable package MediumMedium model
InletfluPor[nZon, nPorts]Fluid connectors
replaceable package MediumAMedium for air
BusweaBusWeather data bus
output RealOutputTOutOutdoor temperature [K]
output RealOutputTRad1Radiative temperature [K]
output RealOutputTRad2Radiative temperature [K]

Modelica definition

model ThermalZones "Declaration of an FMU that exports multiple thermal zones" extends Buildings.Fluid.FMI.ExportContainers.ThermalZones( redeclare final package Medium = MediumA, nPorts = 3, nZon = 2); replaceable package MediumA = Buildings.Media.Air "Medium for air"; parameter Modelica.SIunits.Volume V=6*10*3 "Room volume"; ///////////////////////////////////////////////////////// // Air temperatures at design conditions parameter Modelica.SIunits.Temperature TASup_nominal = 273.15+18 "Nominal air temperature supplied to room"; parameter Modelica.SIunits.Temperature TRooSet = 273.15+24 "Nominal room air temperature"; parameter Modelica.SIunits.Temperature TOut_nominal = 273.15+30 "Design outlet air temperature"; ///////////////////////////////////////////////////////// // Cooling loads and air mass flow rates parameter Modelica.SIunits.HeatFlowRate QRooInt_flow= 1000 "Internal heat gains of the room"; parameter Modelica.SIunits.HeatFlowRate QRooC_flow_nominal= -QRooInt_flow-10E3/30*(TOut_nominal-TRooSet) "Nominal cooling load of the room"; parameter Modelica.SIunits.MassFlowRate mA_flow_nominal= 1.3*QRooC_flow_nominal/1006/(TASup_nominal-TRooSet) "Nominal air mass flow rate, increased by factor 1.3 to allow for recovery after temperature setback"; BoundaryConditions.WeatherData.ReaderTMY3 weaDat( pAtmSou=Buildings.BoundaryConditions.Types.DataSource.Parameter, TDryBul=TOut_nominal, filNam="modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos", TDryBulSou=Buildings.BoundaryConditions.Types.DataSource.File, computeWetBulbTemperature=false) "Weather data reader"; BoundaryConditions.WeatherData.Bus weaBus "Weather data bus"; Modelica.Blocks.Interfaces.RealOutput TOut(final unit="K") "Outdoor temperature"; Modelica.Blocks.Interfaces.RealOutput TRad1(final unit="K") "Radiative temperature"; Modelica.Blocks.Interfaces.RealOutput TRad2(final unit="K") "Radiative temperature"; Buildings.HeatTransfer.Sources.PrescribedTemperature TAirOut "Outside air temperature"; Modelica.Thermal.HeatTransfer.Components.ThermalConductor theCon1(G=10000/30) "Thermal conductance with the ambient"; Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow preHea1(Q_flow= QRooInt_flow) "Prescribed heat flow for internal gains"; MixingVolumes.MixingVolume vol1( redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal, V=V, mSenFac=3, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, nPorts=3) "Room volume"; Modelica.Thermal.HeatTransfer.Components.ThermalConductor theCon2( G=10000/30) "Thermal conductance with the ambient"; Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow preHea2(Q_flow= QRooInt_flow) "Prescribed heat flow for internal gains"; MixingVolumes.MixingVolume vol2( redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal, V=V, mSenFac=3, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, nPorts=3) "Room volume"; Sensors.MassFlowRate senMasFlo[nPorts](redeclare final package Medium = MediumA) "Mass flow rate sensor to connect thermal adapter with thermal zone."; Sensors.MassFlowRate senMasFlo1[nPorts]( redeclare final package Medium = MediumA) "Mass flow rate sensor to connect thermal adapter with thermal zone."; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temSen1 "Temperature sensor (that approximates the radiative temperature by the air temperature)"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temSen2 "Temperature sensor (that approximates the radiative temperature by the air temperature)"; equation connect(weaDat.weaBus,weaBus); connect(theCon1.port_b, vol1.heatPort); connect(preHea1.port, vol1.heatPort); connect(TAirOut.T, weaBus.TDryBul); connect(TAirOut.port, theCon1.port_a); connect(TOut, weaBus.TDryBul); connect(theCon2.port_b, vol2.heatPort); connect(preHea2.port, vol2.heatPort); connect(TAirOut.port, theCon2.port_a); connect(vol1.heatPort, theZonAda[1].heaPorAir); connect(vol2.heatPort, theZonAda[2].heaPorAir); connect(theZonAda[2].ports, senMasFlo1.port_a); connect(senMasFlo.port_a, theZonAda[1].ports); connect(senMasFlo1.port_b, vol2.ports[1:3]); connect(senMasFlo.port_b, vol1.ports[1:3]); connect(temSen1.port, vol1.heatPort); connect(temSen2.port, vol2.heatPort); connect(temSen1.T, TRad1); connect(temSen2.T, TRad2); end ThermalZones;

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.TwoPortPassThrough Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.TwoPortPassThrough

Declaration of an FMU that exports a block that simply passes all the inputs to the outputs

Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.TwoPortPassThrough

Information

This example demonstrates how to export an FMU that simply passes all its inputs to its outputs. Such an FMU could for example be used in a block diagram as a place-holder for another FMU that provides an actual implementation of a component.

Extends from Buildings.Fluid.FMI.ExportContainers.PartialTwoPort (Partial block to be used as a container to export a thermofluid flow model with two ports).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Booleanuse_p_intrue= true to use a pressure from connector, false to output Medium.p_default
Assumptions
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
InletinletFluid inlet
OutletoutletFluid outlet

Modelica definition

block TwoPortPassThrough "Declaration of an FMU that exports a block that simply passes all the inputs to the outputs" extends Buildings.Fluid.FMI.ExportContainers.PartialTwoPort( redeclare replaceable package Medium = Buildings.Media.Air); equation connect(inlet, outlet); end TwoPortPassThrough;