Sources.MassFlowSource_T ​
Ideal fluid source with prescribed total mass flow, temperature, composition, and trace substances.
Positive prescribed mass flow leaves the source through its fluid ports. The mass flow may be supplied by a parameter or by a signal input.
This component extends from FluidComponents.Sources.BaseClasses.PartialFlowSource
Usage ​
FluidComponents.Sources.MassFlowSource_T(m_flow, T, X=MediaComponents.Interfaces.medium_X_default(medium_data), C=MediaComponents.Interfaces.medium_C_default(medium_data))
Parameters: ​
| Name | Description | Units | Default value |
|---|---|---|---|
medium_data | – | ||
nPorts | – | ||
nX | – | FluidCompon...edium_data) | |
nXi | – | FluidCompon...edium_data) | |
nC | – | FluidCompon...edium_data) | |
use_m_flow_in | – | ||
m_flow | kg/s | ||
T | K | ||
X | kg/kg | MediaCompon...edium_data) | |
C | – | MediaCompon...edium_data) |
Connectors ​
ports- Generic fluid connector at the design outlet. (FluidPort_b)m_flow_in- This connector represents a real signal as an input to a component (RealInput)
Variables ​
| Name | Description | Units |
|---|---|---|
m_flow_internal | kg/s | |
port_m_flows | kg/s |
Behavior ​
This component has required parameters without default values, so it is not constructed here; see the Parameters table.
Source ​
"""
Ideal fluid source with prescribed total mass flow, temperature, composition,
and trace substances.
Positive prescribed mass flow leaves the source through its fluid ports. The
mass flow may be supplied by a parameter or by a signal input.
"""
component MassFlowSource_T
extends FluidComponents.Sources.BaseClasses.PartialFlowSource(nPorts(min = 1))
# Whether the mass flow is supplied through a signal input [-]
structural parameter use_m_flow_in::Boolean
# Fixed mass flow rate leaving the source [kg/s]
parameter m_flow::MediaComponents.Types.MassFlowRate if !use_m_flow_in
# Source temperature [K]
parameter T::MediaComponents.Types.Temperature
# Source mass fractions [kg/kg]
parameter X::MediaComponents.Types.MassFraction[nX] = MediaComponents.Interfaces.medium_X_default(medium_data)
# Source trace substances [-]
parameter C::MediaComponents.Types.ExtraProperty[nC] = MediaComponents.Interfaces.medium_C_default(medium_data) if nC > 0
"Prescribed mass-flow signal."
m_flow_in = RealInput(units = "kg/s") if use_m_flow_in {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -100, "y1": 0, "x2": 100, "y2": 200, "rot": 0},
"icon": {"iconName": "default", "x1": -100, "y1": 0, "x2": 100, "y2": 200, "rot": 0}
}
}
}
# Effective prescribed mass flow rate [kg/s]
variable m_flow_internal::MediaComponents.Types.MassFlowRate
# Mass flow rate at each fluid port [kg/s]
variable port_m_flows::MediaComponents.Types.MassFlowRate[nPorts]
relations
if use_m_flow_in
m_flow_internal = m_flow_in
else
m_flow_internal = m_flow
end
medium.T = T
for i in 1:nPorts
port_m_flows[i] = ports[i].m_flow
end
sum(port_m_flows) = -m_flow_internal
if nXi > 0
for j in 1:nXi
medium.Xi[j] = X[j]
end
end
if nC > 0
for i in 1:nPorts
for j in 1:nC
ports[i].C_outflow[j] = C[j]
end
end
end
metadata {
"Dyad": {
"labels": [{"label": "$(instance)", "x": 500, "y": 950, "rot": 0, "layer": "icon"}],
"icons": {"default": "dyad://FluidComponents/icons/MassFlowSource_T.svg"}
}
}
endFlattened Source
"""
Ideal fluid source with prescribed total mass flow, temperature, composition,
and trace substances.
Positive prescribed mass flow leaves the source through its fluid ports. The
mass flow may be supplied by a parameter or by a signal input.
"""
component MassFlowSource_T
# Immutable medium definition selected at model construction [-]
structural parameter medium_data::MediaComponents.Interfaces.AbstractPartialMediumData
# Number of fluid ports [-]
structural parameter nPorts::Integer(min = 0)
# Number of mass fractions [-]
final structural parameter nX::Integer = MediaComponents.Interfaces.medium_nX(medium_data)
# Number of independent mass fractions [-]
final structural parameter nXi::Integer = MediaComponents.Interfaces.medium_nXi(medium_data)
# Number of extra transported properties [-]
final structural parameter nC::Integer = MediaComponents.Interfaces.medium_nC(medium_data)
"Thermodynamic properties inside the source."
medium = MediaComponents.Interfaces.BaseProperties(medium_data = medium_data)
"Fluid ports connected to the source."
ports = [FluidComponents.Interfaces.FluidPort_b(medium_data = medium_data) for i in 1:nPorts] {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0},
"icon": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0}
}
}
}
# Whether the mass flow is supplied through a signal input [-]
structural parameter use_m_flow_in::Boolean
# Fixed mass flow rate leaving the source [kg/s]
parameter m_flow::MediaComponents.Types.MassFlowRate if !use_m_flow_in
# Source temperature [K]
parameter T::MediaComponents.Types.Temperature
# Source mass fractions [kg/kg]
parameter X::MediaComponents.Types.MassFraction[nX] = MediaComponents.Interfaces.medium_X_default(medium_data)
# Source trace substances [-]
parameter C::MediaComponents.Types.ExtraProperty[nC] = MediaComponents.Interfaces.medium_C_default(medium_data) if nC > 0
"Prescribed mass-flow signal."
m_flow_in = RealInput(units = "kg/s") if use_m_flow_in {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -100, "y1": 0, "x2": 100, "y2": 200, "rot": 0},
"icon": {"iconName": "default", "x1": -100, "y1": 0, "x2": 100, "y2": 200, "rot": 0}
}
}
}
# Effective prescribed mass flow rate [kg/s]
variable m_flow_internal::MediaComponents.Types.MassFlowRate
# Mass flow rate at each fluid port [kg/s]
variable port_m_flows::MediaComponents.Types.MassFlowRate[nPorts]
relations
for i in 1:nPorts
ports[i].p = medium.p
ports[i].h_outflow = medium.h
if nXi > 0
for j in 1:nXi
ports[i].Xi_outflow[j] = medium.Xi[j]
end
else
ports[i].Xi_outflow[1] = 0
end
if nC == 0
ports[i].C_outflow[1] = 0
end
end
if use_m_flow_in
m_flow_internal = m_flow_in
else
m_flow_internal = m_flow
end
medium.T = T
for i in 1:nPorts
port_m_flows[i] = ports[i].m_flow
end
sum(port_m_flows) = -m_flow_internal
if nXi > 0
for j in 1:nXi
medium.Xi[j] = X[j]
end
end
if nC > 0
for i in 1:nPorts
for j in 1:nC
ports[i].C_outflow[j] = C[j]
end
end
end
metadata {
"Dyad": {
"labels": [{"label": "$(instance)", "x": 500, "y": 950, "rot": 0, "layer": "icon"}],
"icons": {"default": "dyad://FluidComponents/icons/MassFlowSource_T.svg"}
}
}
endTest Cases ​
No test cases defined.
Related ​
Examples
Experiments
Analyses