Connection models for fluid routing
Information
This package contains models that allow connecting component
fluid ports together with various routing arrangements.
Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).
Package Content
Name |
Description |
MultipleToMultiple
|
Multiple inlet ports, multiple outlet ports |
MultipleToSingle
|
Multiple inlet port, single outlet ports |
PassThroughFluid
|
Direct fluid pass-through |
SingleToMultiple
|
Single inlet port, multiple outlet ports |
Multiple inlet ports, multiple outlet ports
Information
This is a model of a many-to-many fluid connector with an
optional control volume, and an optional mixing port (common leg).
It is typically used to connect parallel pumps with parallel
chillers or boilers.
Selecting a mixing port allows modeling a headered pumping arrangement.
Without any mixing port, a dedicated pumping arrangement is modeled.
Parameters
Type | Name | Default | Description |
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component |
Configuration |
Integer | nPorts_a | | Number of inlet ports |
Integer | nPorts_b | nPorts_a | Number of outlet ports |
Boolean | have_comLeg | false | Set to true for common leg between inlet and outlet ports (headered connection) |
Nominal condition |
MassFlowRate | m_flow_nominal | | Nominal mass flow rate [kg/s] |
Dynamics |
Nominal condition |
Time | tau | 10 | Time constant at nominal flow [s] |
Conservation equations |
Dynamics | energyDynamics | Modelica.Fluid.Types.Dynamic... | Type of energy balance: dynamic (3 initialization options) or steady state |
Assumptions |
Boolean | allowFlowReversal | true | = true to allow flow reversal, false restricts to design direction (ports_a -> ports_b) |
Advanced |
Diagnostics |
Boolean | show_T | false | Set to true if actual temperature at port is computed |
Graphics |
Integer | icon_extend | 0 | Extend lines by this amount in x-direction in icon layer: >0 at outlet, <0 at inlet |
Integer | icon_dy | 100 | Distance in y-direction between each branch in icon layer |
IconPipe | icon_pipe | Buildings.Templates.Componen... | Pipe symbol |
Connectors
Type | Name | Description |
replaceable package Medium | Medium in the component |
FluidPorts_a | ports_a[nPorts_a] | Fluid connector a (positive design flow direction is from ports_a to ports_b) |
FluidPorts_b | ports_b[nPorts_b] | Fluid connectors b (positive design flow direction is from ports_a to ports_b) |
FluidPort_a | port_aComLeg | Common leg port - Case with common leg |
Modelica definition
model MultipleToMultiple
replaceable package Medium =
Modelica.Media.Interfaces.PartialMedium ;
parameter Integer nPorts_a
;
parameter Integer nPorts_b = nPorts_a
;
parameter Boolean have_comLeg = false
;
parameter Modelica.Units.SI.MassFlowRate m_flow_nominal(min=0)
;
parameter Modelica.Units.SI.Time tau=10
;
parameter Modelica.Fluid.Types.Dynamics energyDynamics=
Modelica.Fluid.Types.Dynamics.DynamicFreeInitial
;
parameter Boolean allowFlowReversal=true
;
parameter Boolean show_T = false
;
parameter Integer icon_extend = 0
;
parameter Integer icon_dy = 100
;
parameter Buildings.Templates.Components.Types.IconPipe icon_pipe =
Buildings.Templates.Components.Types.IconPipe.Supply
;
Modelica.Fluid.Interfaces.FluidPorts_a ports_a[nPorts_a](
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))
;
Modelica.Fluid.Interfaces.FluidPorts_b ports_b[nPorts_b](
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))
;
Modelica.Fluid.Interfaces.FluidPort_a port_aComLeg(
redeclare final package Medium=
Medium,
m_flow(min=
if allowFlowReversal
then -Modelica.Constants.inf
else 0),
h_outflow(start=Medium.h_default, nominal=Medium.h_default))
if have_comLeg ;
PassThroughFluid pasDed[nPorts_a](
redeclare each final package Medium=
Medium)
if not have_comLeg
;
Medium.ThermodynamicState sta_a[nPorts_a]=
Medium.setState_phX(ports_a.p,
noEvent(
actualStream(ports_a.h_outflow)),
noEvent(
actualStream(ports_a.Xi_outflow)))
if show_T ;
Medium.ThermodynamicState sta_b[nPorts_b]=
Medium.setState_phX(ports_b.p,
noEvent(
actualStream(ports_b.h_outflow)),
noEvent(
actualStream(ports_b.Xi_outflow)))
if show_T ;
Fluid.Delays.DelayFirstOrder del(
redeclare final package Medium=
Medium,
final tau=tau,
final m_flow_nominal=m_flow_nominal,
final energyDynamics=energyDynamics,
final allowFlowReversal=allowFlowReversal,
final prescribedHeatFlowRate=false,
final nPorts=nPorts_a+nPorts_b+1)
if have_controlVolume
and have_comLeg
;
PassThroughFluid pasSteInl(
redeclare final package Medium =
Medium)
if have_comLeg
and not have_controlVolume
;
PassThroughFluid pasSteOut(
redeclare final package Medium =
Medium)
if have_comLeg
and not have_controlVolume
;
protected
parameter Boolean have_controlVolume=
energyDynamics<>Modelica.Fluid.Types.Dynamics.SteadyState
;
initial equation
if not have_comLeg
then
assert(nPorts_a==nPorts_b,
"In "+
getInstanceName() + ": "+
"In the absence of a common leg (dedicated connection), the number of inlet ports (" +
String(nPorts_a) + ") must be equal to the number of outlet ports (" +
String(nPorts_b) +")");
end if;
equation
for i
in 1:nPorts_a
loop
connect(ports_a[i], pasSteInl.port_a);
end for;
for i
in 1:nPorts_b
loop
connect(pasSteOut.port_b, ports_b[i]);
end for;
connect(ports_a, pasDed.port_a);
connect(pasDed.port_b, ports_b);
connect(del.ports[nPorts_a+nPorts_b+1], port_aComLeg);
connect(ports_a, del.ports[1:nPorts_a]);
connect(del.ports[(nPorts_a+1):(nPorts_a+nPorts_b)], ports_b);
connect(pasSteInl.port_b, port_aComLeg);
connect(port_aComLeg, pasSteOut.port_a);
end MultipleToMultiple;
Multiple inlet port, single outlet ports
Information
This is a model of a many-to-one fluid connector with an
optional control volume.
It is typically used to represent an outlet manifold or
multiple junctions converging into a single pipe.
Parameters
Type | Name | Default | Description |
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component |
Configuration |
Integer | nPorts | | Number of ports |
Nominal condition |
MassFlowRate | m_flow_nominal | | Nominal mass flow rate [kg/s] |
Dynamics |
Nominal condition |
Time | tau | 10 | Time constant at nominal flow [s] |
Conservation equations |
Dynamics | energyDynamics | Modelica.Fluid.Types.Dynamic... | Type of energy balance: dynamic (3 initialization options) or steady state |
Assumptions |
Boolean | allowFlowReversal | true | Set to true to allow flow reversal, false restricts to design direction (ports_a -> port_b) |
Advanced |
Diagnostics |
Boolean | show_T | false | Set to true if actual temperature at port is computed |
Graphics |
Integer | icon_offset | 0 | Offset in y-direction between inlet and outlet in icon layer |
Integer | icon_dy | 100 | Distance in y-direction between each branch in icon layer |
IconPipe | icon_pipe | Buildings.Templates.Componen... | Pipe symbol |
Connectors
Type | Name | Description |
replaceable package Medium | Medium in the component |
FluidPorts_a | ports_a[nPorts] | Fluid connector a (positive design flow direction is from ports_a to port_b) |
FluidPort_b | port_b | Fluid connectors b (positive design flow direction is from ports_a to port_b) |
Modelica definition
model MultipleToSingle
replaceable package Medium =
Modelica.Media.Interfaces.PartialMedium ;
parameter Integer nPorts
;
parameter Modelica.Units.SI.MassFlowRate m_flow_nominal(min=0)
;
parameter Modelica.Units.SI.Time tau=10
;
parameter Modelica.Fluid.Types.Dynamics energyDynamics=
Modelica.Fluid.Types.Dynamics.DynamicFreeInitial
;
parameter Boolean allowFlowReversal=true
;
parameter Boolean show_T = false
;
parameter Integer icon_offset = 0
;
parameter Integer icon_dy = 100
;
parameter Buildings.Templates.Components.Types.IconPipe icon_pipe =
Buildings.Templates.Components.Types.IconPipe.Supply
;
Modelica.Fluid.Interfaces.FluidPorts_a ports_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))
;
Modelica.Fluid.Interfaces.FluidPort_b port_b(
redeclare final package Medium =
Medium,
m_flow(max=
if allowFlowReversal
then +Modelica.Constants.inf
else 0),
h_outflow(start=Medium.h_default, nominal=Medium.h_default))
;
Fluid.Delays.DelayFirstOrder del(
redeclare final package Medium =
Medium,
final tau=tau,
final m_flow_nominal=m_flow_nominal,
final energyDynamics=energyDynamics,
final allowFlowReversal=allowFlowReversal,
final prescribedHeatFlowRate=false,
final nPorts=nPorts+1)
if have_controlVolume
;
PassThroughFluid pasSte(
redeclare final package Medium=
Medium)
if not have_controlVolume
;
Medium.ThermodynamicState sta_a[nPorts]=
Medium.setState_phX(ports_a.p,
noEvent(
actualStream(ports_a.h_outflow)),
noEvent(
actualStream(ports_a.Xi_outflow)))
if show_T ;
Medium.ThermodynamicState sta_b=
Medium.setState_phX(port_b.p,
noEvent(
actualStream(port_b.h_outflow)),
noEvent(
actualStream(port_b.Xi_outflow)))
if show_T ;
protected
parameter Boolean have_controlVolume=
energyDynamics<>Modelica.Fluid.Types.Dynamics.SteadyState
;
equation
for i
in 1:nPorts
loop
connect(ports_a[i], pasSte.port_a);
end for;
connect(ports_a, del.ports[1:nPorts]);
connect(del.ports[nPorts+1], port_b);
connect(pasSte.port_b, port_b);
end MultipleToSingle;
Direct fluid pass-through
Information
This is a model of a direct fluid pass-through used for
templating purposes.
Extends from Buildings.Fluid.Interfaces.PartialTwoPort (Partial component with two ports).
Parameters
Type | Name | Default | Description |
replaceable package Medium | PartialMedium | Medium in the component |
Assumptions |
Boolean | allowFlowReversal | true | = false to simplify equations, assuming, but not enforcing, no flow reversal |
Connectors
Type | Name | Description |
FluidPort_a | port_a | Fluid connector a (positive design flow direction is from port_a to port_b) |
FluidPort_b | port_b | Fluid connector b (positive design flow direction is from port_a to port_b) |
Modelica definition
Single inlet port, multiple outlet ports
Information
This is a model of a one-to-many fluid connector with an
optional control volume.
It is typically used to represent an inlet manifold or
a single pipe diverging into multiple junctions.
Parameters
Type | Name | Default | Description |
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component |
Configuration |
Integer | nPorts | | Number of ports |
Nominal condition |
MassFlowRate | m_flow_nominal | | Nominal mass flow rate [kg/s] |
Dynamics |
Nominal condition |
Time | tau | 10 | Time constant at nominal flow [s] |
Conservation equations |
Dynamics | energyDynamics | Modelica.Fluid.Types.Dynamic... | Type of energy balance: dynamic (3 initialization options) or steady state |
Assumptions |
Boolean | allowFlowReversal | true | Set to true to allow flow reversal, false restricts to design direction (port_a -> ports_b) |
Advanced |
Diagnostics |
Boolean | show_T | false | Set to true if actual temperature at port is computed |
Graphics |
Integer | icon_offset | 0 | Offset in y-direction between inlet and outlet in icon layer |
Integer | icon_dy | 100 | Distance in y-direction between each branch in icon layer |
IconPipe | icon_pipe | Buildings.Templates.Componen... | Pipe symbol |
Connectors
Type | Name | Description |
replaceable package Medium | Medium in the component |
FluidPort_a | port_a | Fluid connector a (positive design flow direction is from port_a to ports_b) |
FluidPorts_b | ports_b[nPorts] | Fluid connectors b (positive design flow direction is from port_a to ports_b) |
Modelica definition
model SingleToMultiple
replaceable package Medium =
Modelica.Media.Interfaces.PartialMedium ;
parameter Integer nPorts
;
parameter Modelica.Units.SI.MassFlowRate m_flow_nominal(min=0)
;
parameter Modelica.Units.SI.Time tau=10
;
parameter Modelica.Fluid.Types.Dynamics energyDynamics=
Modelica.Fluid.Types.Dynamics.DynamicFreeInitial
;
parameter Boolean allowFlowReversal=true
;
parameter Boolean show_T = false
;
parameter Integer icon_offset = 0
;
parameter Integer icon_dy = 100
;
parameter Buildings.Templates.Components.Types.IconPipe icon_pipe =
Buildings.Templates.Components.Types.IconPipe.Supply
;
Modelica.Fluid.Interfaces.FluidPort_a port_a(
redeclare final package Medium =
Medium,
m_flow(min=
if allowFlowReversal
then -Modelica.Constants.inf
else 0),
h_outflow(start=Medium.h_default, nominal=Medium.h_default))
;
Modelica.Fluid.Interfaces.FluidPorts_b ports_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))
;
Fluid.Delays.DelayFirstOrder del(
redeclare final package Medium =
Medium,
final tau=tau,
final m_flow_nominal=m_flow_nominal,
final energyDynamics=energyDynamics,
final allowFlowReversal=allowFlowReversal,
final prescribedHeatFlowRate=false,
final nPorts=nPorts+1)
if have_controlVolume
;
PassThroughFluid pasSte(
redeclare final package Medium=
Medium)
if not have_controlVolume
;
Medium.ThermodynamicState sta_a=
Medium.setState_phX(port_a.p,
noEvent(
actualStream(port_a.h_outflow)),
noEvent(
actualStream(port_a.Xi_outflow)))
if show_T ;
Medium.ThermodynamicState sta_b[nPorts]=
Medium.setState_phX(ports_b.p,
noEvent(
actualStream(ports_b.h_outflow)),
noEvent(
actualStream(ports_b.Xi_outflow)))
if show_T ;
protected
parameter Boolean have_controlVolume=
energyDynamics<>Modelica.Fluid.Types.Dynamics.SteadyState
;
equation
for i
in 1:nPorts
loop
connect(pasSte.port_b, ports_b[i]);
end for;
connect(port_a, pasSte.port_a);
connect(del.ports[2:nPorts+1], ports_b);
connect(del.ports[1], port_a);
end SingleToMultiple;