Buildings.Fluid.FMI.Conversion.Validation

Collection of models that illustrate model use and test models

Information

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

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

Package Content

Name Description
Buildings.Fluid.FMI.Conversion.Validation.AirToOutlet AirToOutlet Validation model for air to outlet conversion
Buildings.Fluid.FMI.Conversion.Validation.AirToOutletFlowReversal AirToOutletFlowReversal Validation model for air to outlet converter with flow reversal enabled
Buildings.Fluid.FMI.Conversion.Validation.InletToAirDryAir InletToAirDryAir Validation model for inlet to air with dry air medium
Buildings.Fluid.FMI.Conversion.Validation.InletToAirDryAirCO2 InletToAirDryAirCO2 Validation model for inlet to air with dry air medium and CO2
Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAir InletToAirMoistAir Validation model for inlet to Buildings.Media.Air conversion without trace substances
Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAirCO2 InletToAirMoistAirCO2 Validation model for inlet to Buildings.Media.Air conversion with C02 trace substances

Buildings.Fluid.FMI.Conversion.Validation.AirToOutlet Buildings.Fluid.FMI.Conversion.Validation.AirToOutlet

Validation model for air to outlet conversion

Buildings.Fluid.FMI.Conversion.Validation.AirToOutlet

Information

This example validates the conversion model Buildings.Fluid.FMI.Conversion.AirToOutlet for the situation without reverse flow.

The conversion elements all have either a dry or moist air medium, with our without trace substances, in order to test all combinations of air.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
BooleanallowFlowReversalfalse= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Modelica definition

model AirToOutlet "Validation model for air to outlet conversion" extends Modelica.Icons.Example; parameter Boolean allowFlowReversal = false "= true to allow flow reversal, false restricts to design direction (inlet -> outlet)"; Modelica.Blocks.Sources.Constant m_flow(k=0.2) "Mass flow rate"; Modelica.Blocks.Sources.Constant h(k=3E5) "Specific enthalpy"; Modelica.Blocks.Sources.Constant Xi[1](k={0.01}) "Water vapor concentration"; Modelica.Blocks.Sources.Constant C[1](k={1E-5}) "Trace substances"; Buildings.Fluid.FMI.Conversion.AirToOutlet conAirNoC( redeclare package Medium = Buildings.Media.Air, final allowFlowReversal=allowFlowReversal) "Converter for air without trace substances"; Buildings.Fluid.FMI.Conversion.AirToOutlet conAirWithC( redeclare package Medium = Buildings.Media.Air(extraPropertiesNames={"CO2"}), final allowFlowReversal=allowFlowReversal) "Converter for air with trace substances"; Buildings.Fluid.FMI.Conversion.AirToOutlet conDryAirNoC( redeclare package Medium = Modelica.Media.Air.SimpleAir, final allowFlowReversal=allowFlowReversal) "Converter for dry air without trace substances"; Buildings.Fluid.FMI.Conversion.AirToOutlet conDryAirWithC( redeclare package Medium = Modelica.Media.Air.SimpleAir(extraPropertiesNames={"CO2"}), final allowFlowReversal=allowFlowReversal) "Converter for dry air with trace substances"; equation connect(m_flow.y, conAirNoC.m_flow); connect(h.y, conAirNoC.h); connect(Xi.y, conAirNoC.Xi); connect(m_flow.y, conAirWithC.m_flow); connect(h.y, conAirWithC.h); connect(Xi.y, conAirWithC.Xi); connect(m_flow.y, conDryAirNoC.m_flow); connect(h.y, conDryAirNoC.h); connect(m_flow.y, conDryAirWithC.m_flow); connect(h.y, conDryAirWithC.h); connect(C.y, conAirWithC.C); connect(C.y, conDryAirWithC.C); end AirToOutlet;

Buildings.Fluid.FMI.Conversion.Validation.AirToOutletFlowReversal Buildings.Fluid.FMI.Conversion.Validation.AirToOutletFlowReversal

Validation model for air to outlet converter with flow reversal enabled

Buildings.Fluid.FMI.Conversion.Validation.AirToOutletFlowReversal

Information

This example is identical to Buildings.Fluid.FMI.Conversion.Validation.AirToOutlet, except that it has reverse flow. This tests whether the fluid properties from the upstream media are correctly converted to the output signals of Buildings.Fluid.FMI.Conversion.AirToOutlet.

Extends from Buildings.Fluid.FMI.Conversion.Validation.AirToOutlet (Validation model for air to outlet conversion).

Parameters

TypeNameDefaultDescription
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Modelica definition

model AirToOutletFlowReversal "Validation model for air to outlet converter with flow reversal enabled" extends Buildings.Fluid.FMI.Conversion.Validation.AirToOutlet( allowFlowReversal = true); BoundaryCondition bouAirNoC( redeclare package Medium = Buildings.Media.Air ( X_default={0.015, 0.985})) "Boundary condition"; BoundaryCondition bouAirWithC( redeclare package Medium = Buildings.Media.Air ( X_default={0.015, 0.985}, extraPropertiesNames={"CO2"})) "Boundary condition"; BoundaryCondition bouDryAirNoC( redeclare package Medium = Modelica.Media.Air.SimpleAir) "Boundary condition"; BoundaryCondition bouDryAirWithC( redeclare package Medium = Modelica.Media.Air.SimpleAir ( extraPropertiesNames={"CO2"})) "Boundary condition"; protected model BoundaryCondition extends Modelica.Blocks.Icons.Block; replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the component"; final parameter Boolean use_p_in=false "= true to use a pressure from connector, false to output Medium.p_default"; Adaptors.Inlet bouInlAirNoC( redeclare package Medium = Medium, allowFlowReversal=true, use_p_in=false) "Boundary condition for air inlet"; Sources.Boundary_pT bou( redeclare package Medium = Medium, nPorts=1, p=Medium.p_default + 1000, T=298.15, C=fill(0.7, Medium.nC)) "Boundary condition"; Interfaces.Inlet inlet( use_p_in=use_p_in, redeclare package Medium = Medium, allowFlowReversal=true) "Fluid inlet"; FixedResistances.PressureDrop res( redeclare package Medium = Medium, m_flow_nominal=0.1, dp_nominal=1000, linearized=true) "Flow resistance"; equation connect(bouInlAirNoC.inlet, inlet); connect(res.port_b, bou.ports[1]); connect(res.port_a, bouInlAirNoC.port_b); end BoundaryCondition; equation connect(bouAirNoC.inlet, conAirNoC.outlet); connect(bouAirWithC.inlet, conAirWithC.outlet); connect(bouDryAirNoC.inlet, conDryAirNoC.outlet); connect(bouDryAirWithC.inlet, conDryAirWithC.outlet); end AirToOutletFlowReversal;

Buildings.Fluid.FMI.Conversion.Validation.InletToAirDryAir Buildings.Fluid.FMI.Conversion.Validation.InletToAirDryAir

Validation model for inlet to air with dry air medium

Buildings.Fluid.FMI.Conversion.Validation.InletToAirDryAir

Information

This validation test is identical to Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAir except that it uses a medium model without moisture. Hence, it tests whether the water vapor connectors are correctly removed.

Extends from Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAir (Validation model for inlet to Buildings.Media.Air conversion without trace substances).

Parameters

TypeNameDefaultDescription
replaceable package MediumAirMedium model
Booleanuse_p_infalse= true to use a pressure from connector, false to output Medium.p_default

Connectors

TypeNameDescription
replaceable package MediumMedium model

Modelica definition

model InletToAirDryAir "Validation model for inlet to air with dry air medium" extends Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAir( redeclare replaceable package Medium = Modelica.Media.Air.SimpleAir); end InletToAirDryAir;

Buildings.Fluid.FMI.Conversion.Validation.InletToAirDryAirCO2 Buildings.Fluid.FMI.Conversion.Validation.InletToAirDryAirCO2

Validation model for inlet to air with dry air medium and CO2

Buildings.Fluid.FMI.Conversion.Validation.InletToAirDryAirCO2

Information

This validation test is identical to Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAirCO2 except that it uses a medium model without moisture. Hence, it tests whether the water vapor connectors are correctly removed.

Extends from Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAirCO2 (Validation model for inlet to Buildings.Media.Air conversion with C02 trace substances).

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Air.SimpleAir...Medium model
Booleanuse_p_infalse= true to use a pressure from connector, false to output Medium.p_default

Connectors

TypeNameDescription
replaceable package MediumMedium model

Modelica definition

model InletToAirDryAirCO2 "Validation model for inlet to air with dry air medium and CO2" extends Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAirCO2( redeclare replaceable package Medium = Modelica.Media.Air.SimpleAir(extraPropertiesNames={"CO2"})); end InletToAirDryAirCO2;

Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAir Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAir

Validation model for inlet to Buildings.Media.Air conversion without trace substances

Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAir

Information

This example validates the conversion model Buildings.Fluid.FMI.Conversion.InletToAir . The medium used is Buildings.Media.Air without trace substances. The top model has no reverse flow, whereas the bottom model has reverse flow.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
replaceable package MediumBuildings.Media.AirMedium model
Booleanuse_p_infalse= true to use a pressure from connector, false to output Medium.p_default

Connectors

TypeNameDescription
replaceable package MediumMedium model

Modelica definition

model InletToAirMoistAir "Validation model for inlet to Buildings.Media.Air conversion without trace substances" extends Modelica.Icons.Example; replaceable package Medium = Buildings.Media.Air constrainedby Modelica.Media.Interfaces.PartialMedium "Medium model"; parameter Boolean use_p_in = false "= true to use a pressure from connector, false to output Medium.p_default"; Modelica.Blocks.Sources.Constant m_flow(k=0.2) "Mass flow rate"; Modelica.Blocks.Sources.Constant T(k=295.13) "Room temperature"; Buildings.Fluid.FMI.Conversion.InletToAir conAir( redeclare package Medium = Medium, allowFlowReversal=false) "Converter for air"; Source_T sou( redeclare package Medium = Medium, use_p_in=use_p_in, allowFlowReversal=false) "Source for mass flow rate and pressure"; Modelica.Blocks.Sources.Constant pIn(k=100000) "Inlet pressure"; Modelica.Blocks.Sources.Constant X_w_in(k=0.01) "Inlet mass fraction"; Modelica.Blocks.Sources.Constant C[Medium.nC](each k=0.01) if Medium.nC > 0 "Trace substances for forward flow"; Buildings.Fluid.FMI.Conversion.InletToAir conAirRevFlo(redeclare package Medium = Medium, allowFlowReversal=true) "Converter for air with reverse flow"; Source_T souRev( redeclare package Medium = Medium, use_p_in=use_p_in, allowFlowReversal=true) "Source for mass flow rate and pressure with reverse flow"; Modelica.Blocks.Sources.Constant TRev(k=283.15) "Temperature for reverse flow"; Modelica.Blocks.Sources.Constant X_w(k=0.012) "Mass flow fraction for reverse flow"; equation connect(m_flow.y, sou.m_flow_in); connect(sou.outlet, conAir.inlet); connect(sou.T_in, T.y); connect(pIn.y, sou.p_in); connect(X_w_in.y, sou.X_w_in); connect(C.y, sou.C_in); connect(m_flow.y, souRev.m_flow_in); connect(souRev.outlet, conAirRevFlo.inlet); connect(souRev.T_in, T.y); connect(pIn.y, souRev.p_in); connect(X_w_in.y, souRev.X_w_in); connect(C.y, souRev.C_in); connect(TRev.y, conAirRevFlo.TAirZon); connect(X_w.y, conAirRevFlo.X_wZon); end InletToAirMoistAir;

Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAirCO2 Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAirCO2

Validation model for inlet to Buildings.Media.Air conversion with C02 trace substances

Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAirCO2

Information

This example validates the conversion model Buildings.Fluid.FMI.Conversion.InletToAir . It is identical to Buildings.Fluid.FMI.Conversion.Validation.InletToAirMoistAir except that the medium has C02 trace substances.

Extends from Buildings.Fluid.FMI.Conversion.Validation.InletToAirDryAir (Validation model for inlet to air with dry air medium).

Parameters

TypeNameDefaultDescription
replaceable package MediumSimpleAirMedium model
Booleanuse_p_infalse= true to use a pressure from connector, false to output Medium.p_default

Connectors

TypeNameDescription
replaceable package MediumMedium model

Modelica definition

model InletToAirMoistAirCO2 "Validation model for inlet to Buildings.Media.Air conversion with C02 trace substances" extends Buildings.Fluid.FMI.Conversion.Validation.InletToAirDryAir( redeclare replaceable package Medium = Buildings.Media.Air(extraPropertiesNames={"CO2"})); Modelica.Blocks.Sources.Constant CRev[Medium.nC](each k=0.8) "Trace substance for reverse flow"; equation connect(CRev.y, conAirRevFlo.CZon); end InletToAirMoistAirCO2;

Buildings.Fluid.FMI.Conversion.Validation.AirToOutletFlowReversal.BoundaryCondition Buildings.Fluid.FMI.Conversion.Validation.AirToOutletFlowReversal.BoundaryCondition


Buildings.Fluid.FMI.Conversion.Validation.AirToOutletFlowReversal.BoundaryCondition

Information

Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium in the component

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
InletinletFluid inlet

Modelica definition

model BoundaryCondition extends Modelica.Blocks.Icons.Block; replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the component"; final parameter Boolean use_p_in=false "= true to use a pressure from connector, false to output Medium.p_default"; Adaptors.Inlet bouInlAirNoC( redeclare package Medium = Medium, allowFlowReversal=true, use_p_in=false) "Boundary condition for air inlet"; Sources.Boundary_pT bou( redeclare package Medium = Medium, nPorts=1, p=Medium.p_default + 1000, T=298.15, C=fill(0.7, Medium.nC)) "Boundary condition"; Interfaces.Inlet inlet( use_p_in=use_p_in, redeclare package Medium = Medium, allowFlowReversal=true) "Fluid inlet"; FixedResistances.PressureDrop res( redeclare package Medium = Medium, m_flow_nominal=0.1, dp_nominal=1000, linearized=true) "Flow resistance"; equation connect(bouInlAirNoC.inlet, inlet); connect(res.port_b, bou.ports[1]); connect(res.port_a, bouInlAirNoC.port_b); end BoundaryCondition;