Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces

Package with interface for bore field models

Information

This package contains basic classes that are used to build component models that change the state of the fluid. The classes are not directly usable, but can be extended when building a new model.

Extends from Modelica.Icons.InterfacesPackage (Icon for packages containing interfaces).

Package Content

Name Description
Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces.PartialTwoNPorts PartialTwoNPorts Partial component with vectors of ports
Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces.PartialTwoNPortsInterface PartialTwoNPortsInterface Partial model with two vectors of ports and declaration of quantities for bore field models
Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces.TwoNPortsFlowResistanceParameters TwoNPortsFlowResistanceParameters Parameters for flow resistance for models with two N ports

Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces.PartialTwoNPorts Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces.PartialTwoNPorts

Partial component with vectors of ports

Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces.PartialTwoNPorts

Information

This partial model defines an interface for components with multiple pairs of inlet and outlet ports, here implemented as two vectors of ports. The treatment of the design flow direction and of flow reversal are predefined based on the parameter allowFlowReversal. The component may transport fluid and may have internal storage for a given fluid Medium. The definitions of flow reversal and the Medium apply to all ports.

Implementation

This model is similar to Modelica.Fluid.Interfaces.PartialTwoPort but it does not use the outer system declaration. This declaration is omitted as in building energy simulation, many models use multiple media, an in practice, users have not used this global definition to assign parameters. The ports are vectorized, to allow multiple pairs of inlet and outlet ports.

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium in the component
IntegernPorts Number of fluid ports on each side
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
FluidPort_aport_a[nPorts]Fluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_b[nPorts]Fluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

partial model PartialTwoNPorts "Partial component with vectors of ports" replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the component"; parameter Boolean allowFlowReversal = true "= false to simplify equations, assuming, but not enforcing, no flow reversal"; parameter Integer nPorts(min=1) "Number of fluid ports on each side"; Modelica.Fluid.Interfaces.FluidPort_a port_a[nPorts]( redeclare each final package Medium = Medium, each m_flow(min=if allowFlowReversal then -Modelica.Constants.inf else 0), each h_outflow(start = Medium.h_default, nominal = Medium.h_default), each p(start=Medium.p_default)) "Fluid connector a (positive design flow direction is from port_a to port_b)"; Modelica.Fluid.Interfaces.FluidPort_b port_b[nPorts]( redeclare each final package Medium = Medium, each m_flow(max=if allowFlowReversal then +Modelica.Constants.inf else 0), each h_outflow(start = Medium.h_default, nominal = Medium.h_default), each p(start=Medium.p_default)) "Fluid connector b (positive design flow direction is from port_a to port_b)"; end PartialTwoNPorts;

Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces.PartialTwoNPortsInterface Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces.PartialTwoNPortsInterface

Partial model with two vectors of ports and declaration of quantities for bore field models

Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces.PartialTwoNPortsInterface

Information

This component defines the interface for models with multiple pairs of inlet and outlet ports, here implemented as two vectors of ports. It is similar to Modelica.Fluid.Interfaces.PartialTwoPortTransport, but it does not include the species balance

  port_b[i].Xi_outflow = inStream(port_a[i].Xi_outflow);

Thus, it can be used as a base class for a heat and mass transfer component

The partial model extends Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces.PartialTwoNPorts and adds quantities that are used by many models such as m_flow_nominal, m_flow and dp.

Extends from Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces.PartialTwoNPorts (Partial component with vectors of ports).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
IntegernPorts Number of fluid ports on each side
Nominal condition
MassFlowRatem_flow_nominal[nPorts] Nominal mass flow rate [kg/s]
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small[nPorts]1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
FluidPort_aport_a[nPorts]Fluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_b[nPorts]Fluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

partial model PartialTwoNPortsInterface "Partial model with two vectors of ports and declaration of quantities for bore field models" extends Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces.PartialTwoNPorts; parameter Modelica.Units.SI.MassFlowRate m_flow_nominal[nPorts] "Nominal mass flow rate"; parameter Modelica.Units.SI.MassFlowRate m_flow_small[nPorts](each min=0) = 1E-4*abs( m_flow_nominal) "Small mass flow rate for regularization of zero flow"; // Diagnostics parameter Boolean show_T = false "= true, if actual temperature at port is computed"; Modelica.Units.SI.MassFlowRate m_flow[nPorts](each start=_m_flow_start) = port_a[:].m_flow "Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction)"; Modelica.Units.SI.PressureDifference dp[nPorts]( each start=_dp_start, each displayUnit="Pa") = port_a[:].p - port_b[:].p "Pressure difference between port_a and port_b"; Medium.ThermodynamicState sta_a[nPorts]= if allowFlowReversal then Medium.setState_phX(port_a.p, noEvent(actualStream(port_a.h_outflow)), noEvent(actualStream(port_a.Xi_outflow))) else Medium.setState_phX(port_a.p, noEvent(inStream(port_a.h_outflow)), noEvent(inStream(port_a.Xi_outflow))) if show_T "Medium properties in port_a"; Medium.ThermodynamicState sta_b[nPorts]= if allowFlowReversal then Medium.setState_phX(port_b.p, noEvent(actualStream(port_b.h_outflow)), noEvent(actualStream(port_b.Xi_outflow))) else Medium.setState_phX(port_b.p, noEvent(port_b.h_outflow), noEvent(port_b.Xi_outflow)) if show_T "Medium properties in port_b"; protected final parameter Modelica.Units.SI.MassFlowRate _m_flow_start=0 "Start value for m_flow, used to avoid a warning if not set in m_flow, and to avoid m_flow.start in parameter window"; final parameter Modelica.Units.SI.PressureDifference _dp_start( displayUnit="Pa") = 0 "Start value for dp, used to avoid a warning if not set in dp, and to avoid dp.start in parameter window"; end PartialTwoNPortsInterface;

Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces.TwoNPortsFlowResistanceParameters Buildings.Fluid.Geothermal.ZonedBorefields.Interfaces.TwoNPortsFlowResistanceParameters

Parameters for flow resistance for models with two N ports

Information

This class contains parameters that are used to compute the pressure drop in models that have one fluid stream. Note that the nominal mass flow rate is not declared here because the model PartialTwoNPortsInterface already declares it.

Extends from Modelica.Icons.Record (Icon for records).

Contents

TypeNameDefaultDescription
IntegernPorts Number of fluid ports on each side
Nominal condition
PressureDifferencedp_nominal[nPorts] Pressure difference [Pa]
Flow resistance
BooleancomputeFlowResistance[nPorts]fill(true, nPorts)=true, compute flow resistance. Set to false to assume no friction
Booleanfrom_dp[nPorts]fill(false, nPorts)= true, use m_flow = f(dp) else dp = f(m_flow)
BooleanlinearizeFlowResistance[nPorts]fill(false, nPorts)= true, use linear relation between m_flow and dp for any flow rate
RealdeltaM[nPorts]fill(0.1, nPorts)Fraction of nominal flow rate where flow transitions to laminar

Modelica definition

record TwoNPortsFlowResistanceParameters "Parameters for flow resistance for models with two N ports" extends Modelica.Icons.Record; parameter Integer nPorts(min=1) "Number of fluid ports on each side"; parameter Boolean computeFlowResistance[nPorts] = fill(true, nPorts) "=true, compute flow resistance. Set to false to assume no friction"; parameter Boolean from_dp[nPorts] = fill(false, nPorts) "= true, use m_flow = f(dp) else dp = f(m_flow)"; parameter Modelica.Units.SI.PressureDifference dp_nominal[nPorts]( each min=0, each displayUnit="Pa") "Pressure difference"; parameter Boolean linearizeFlowResistance[nPorts] = fill(false, nPorts) "= true, use linear relation between m_flow and dp for any flow rate"; parameter Real deltaM[nPorts] = fill(0.1, nPorts) "Fraction of nominal flow rate where flow transitions to laminar"; end TwoNPortsFlowResistanceParameters;