Index

Docstrings

HVAC

HVAC.AirChannelCrossFlowInitMethod
AirChannelCrossFlowInit(
;
    steadyState,
    P_start,
    mdot_start,
    T_in_start,
    T_out_start,
    Xi_in_start,
    Xi_out_start,
    phi_in_start,
    phi_out_start,
    Q_start,
    k,
    Ploss_start,
    kwargs...
) -> NamedTuple{(:steadyState, :mdot_start, :P_start, :T_in_start, :T_out_start, :Xi_in_start, :Xi_out_start, :phi_in_start, :phi_out_start, :Q_start, :k, :PSat_start, :w_start, :Xi_start, :Ploss_start), _A} where _A<:Tuple{Bool, Float64, Any, Float64, Float64, Any, Any, Any, Any, Float64, Float64, Float64, Any, Any, Int64}

Named tuple holding the initial conditions for an air channel of a HEXCrossflow in cross flow configuration with a single control volume (i.e., N = 1).

Arguments:

(; steadyState, P_start, mdot_start, T_in_start, T_out_start, Xi_in_start, Xi_out_start, phi_in_start, phi_out_start, Q_start, k, kwargs...) where:

  • steadyState: Indicates if the initialization is to be in steady state (defaults to true).
  • P_start: Initial pressure (defaults to reference pressure moistair.P_ref [Pa]).
  • mdot_start: Initial mass flow rate (defaults to 0.2 [kg/s]).
  • T_in_start: Initial inlet temperature (defaults to 25°C in K).
  • T_out_start: Initial outlet temperature (defaults to 18°C in K).
  • Xi_in_start: Initial inlet humidity ratio (defaults to reference humidity ratio moistair.Xi_ref [kg/kg]).
  • Xi_out_start: Initial outlet humidity ratio (defaults to reference humidity ratio moistair.Xi_ref [kg/kg]).
  • phi_in_start: Initial relative humidity at inlet, calculated based on P_start, T_in_start, Xi_in_start, and moistair.
  • phi_out_start: Initial relative humidity at outlet, calculated based on P_start, T_out_start, Xi_out_start, and moistair.
  • Q_start: Initial heat flow rate (defaults to 0.02 [W]). Assumes flow into the AirChannel.
  • k: Proportionality constant in the equation for humidity (defaults to 0.621964713077499).

Returns:

A named tuple containing the initial conditions of an air channel cross flow system. The named tuple also includes:

  • PSat_start: Initial saturation pressure, calculated based on the T_in_start [Pa].
  • w_start: Initial water content, calculated based on phi_in_start, k and P_start.
  • Xi_start: Initial water mass fraction in kg water/kg moist air, equals to w_start.

The function can take additional arguments (kwargs) that can be merged into the output named tuple.

Note:

The calculation of w_start uses the equation phi_in_start*k/(k*phi_in_start+P_start/PSat_start-phi_in_start).

source
HVAC.AirChannelGeoMethod
AirChannelGeo(
;
    Nfins,
    S_l,
    S_t,
    depth,
    layers,
    d0,
    delta,
    l_pipesegment
) -> NamedTuple{(:Nfins, :S_l, :S_t, :depth, :layers, :d0, :delta, :l_pipesegment, :Nchannels, :bf, :lf, :F_p, :a, :Af, :At, :Af_tube, :At_tube, :A_total, :A_face, :U, :A, :Dhyd, :V), Tuple{Int64, Float64, Float64, Float64, Int64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64}}

Named tuple holding the geometry and dimensions of an air channel with fins in a heat exchanger.

Arguments:

(; Nfins, S_l, S_t, depth, layers, d0, delta, l_pipesegment) where:

  • Nfins: Number of fins per decimeter (defaults to 5).
  • S_l: Tube spacing in air flow direction (defaults to 0.02 [m]).
  • S_t: Tube spacing normal to air flow (defaults to 0.02 [m]).
  • depth: Total length of the channel along flow direction (defaults to 0.06 [m]).
  • layers: Number of refrigerant passes along the flow (defaults to 3).
  • d0: Outer diameter of tube (defaults to 0.007 [m]).
  • delta: Fin thickness (defaults to 0.00012 [m]).
  • l_pipesegment: Length of a tube segment (defaults to 0.5 [m]).

Returns:

(; Nfins, S_l, S_t, depth, layers, d0, delta, l_pipesegment, Nchannels, bf, lf, F_p, a, Af, At, Af_tube, At_tube, A_total, A_face, U, A, Dhyd, V) where:

  • Nchannels: Number of air channels per pipe segment.
  • bf: Height of the fin (normal to flow).
  • lf: Length of one air channel.
  • F_p: Fin pitch.
  • a: Spacing between fins.
  • Af: Area of fins per tube (or layer) per channel.
  • At: Tube surface area per channel.
  • Af_tube: Fin surface area per tube.
  • At_tube: Tube surface area per tube.
  • A_total: Total heat transfer area per channel.
  • A_face: Frontal face area.
  • U: Perimeter of one air channel.
  • A: Cross-section of one air channel.
  • Dhyd: Hydraulic diameter of one air channel.
  • V: Volume of one air channel.
source
HVAC.AirChannelInitMethod
AirChannelInit(
;
    steadyState,
    T_start,
    P_start,
    phi_start,
    mdot_start,
    k
) -> NamedTuple{(:steadyState, :T_start, :P_start, :phi_start, :mdot_start, :k, :PSat_start, :w_start, :Xi_start), Tuple{Bool, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64}}

Named tuple holding the initial values for an air channel.

Arguments:

(; steadyState, T_start, P_start, phi_start, mdot_start, k) where:

  • steadyState: True if initialization is to be in steady state (defaults to true).
  • T_start: Initial temperature (defaults to 280.0 [K]).
  • P_start: Initial pressure (defaults to 1.0e5 [Pa]).
  • phi_start: Initial relative humidity (defaults to 0.5).
  • mdot_start: Initial mass flow rate (defaults to 0.2 [kg/s]).
  • k: Ratio of molar masses (defaults to 0.621964713077499).

Returns:

(; steadyState, T_start, P_start, phi_start, mdot_start, k, PSat_start, w_start, Xi_start) where:

  • PSat_start: Initial saturation pressure.
  • w_start: Initial water content.
  • Xi_start: Water mass fraction in kg water/kg moist air.
source
HVAC.AirSplitterMergerMethod
AirSplitterMerger(; name, isSplitter, nFlows)

Description

Constructs a model for an air splitter or merger. This function represents a component in an air circuit that either splits a single flow into multiple flows (splitter) or merges multiple flows into a single flow (merger).

Sub-systems

  • Air Ports: port_a::MultiComponentFluidPort, port_b::MultiComponentFluidPort

Equations

  • Mass, Component and Energy Balance

Returns

  • ODESystem
source
HVAC.BasePropertiesMethod
BaseProperties(
    data::HVAC.MoistAirData;
    name,
    P_start,
    T_start,
    Xi_start
)

Function to calculate other relevant thermodynamic properties (from an independent ThermodynamicState) for moist air.

Sub-systems:

  • state::ThermodynamicState for moist air (3 states)

States (12):

  • P: Absolute pressure [N/m²]
  • T: Temperature [K]
  • Xi: Mixture mass fraction of water vapor.
  • ρ: Density [kg/m³]
  • h: Specific enthalpy [J/kg]
  • e: Specific internal energy [J/kg]
  • cv: Specific heat capacity at constant volume [J/(kg*K)]
  • R: Specific gas constant [J/(kg*K)]
  • ϕ: Relative humidity.

Equations (9):

Relationships for dependent thermodynamic variables.

Returns:

ODESystem composed of state::ThermodynamicState, 12 states and 9 equations.

source
HVAC.BasePropertiesMethod
BaseProperties(
    data::HVAC.SimpleData;
    name,
    P_start,
    T_start,
    h_start
)

Function to calculate other relevant thermodynamic properties (from an independent ThermodynamicState) for dry air. BaseProperties calls other tailored functions registered in ModelingToolkit.jlusing the @register_symbolic macro.

Sub-systems (2 states, 0 equations):

  • state::ThermodynamicState

States (7):

  • P: Pressure Pa
  • T: Temperature K
  • ρ: Density kg/m³
  • h: Specific enthalpy J/kg
  • e: Specific internal energy J/kg
  • cv: Specific heat capacity at constant volume J/(kg*K)
  • R: Specific gas constant J/(kg*K)

Returns:

ODESystem composed of state::ThermodynamicState, 9 states and 7 equations.

source
HVAC.BasePropertiesMethod
BaseProperties(
    data::RefpropSplines.MultisurfaceFluidData;
    name
)

Function to calculate other relevant thermodynamic properties (from an independent ThermodynamicState) for pure refrigerants. BaseProperties calls other tailored functions that leverage spline interpolations to calculate thermodynamic properties.

States:

Independent states (2):

  • P: [N/m²] Pressure (equal to state.P where state is the ThermodynamicState)
  • h: [J/kg] Specific enthalpy (equal to state.h where state is the ThermodynamicState)

Dependent states (8):

  • ρ: [kg/m³] Density
  • T: [K] Temperature
  • e: [J/kg] Specific internal energy
  • dρdh_P: [kg/m³] Derivative of density with respect to enthalpy (at constant pressure)
  • dρdP_h: [kg/m³] Derivative of density with respect to pressure (at constant enthalpy)

-. dhdP_ρ: [J/kg] Derivative of specific enthalpy with respect to pressure (at constant density)

  • dhdρ_P: [J/kg] Derivative of specific enthalpy with respect to density (at constant pressure)
  • xq: [-] Quality of refrigerant (0: liquid, 1: vapor)

Returns:

  • ODESystem with above 10 top-level states.

Composed of 3 sub-systems:

  • state, liq and vap which are ThermodynamicState ODESystems (each with 2 states).

Thus, the entire system has 16 states and defines 14 equations. The connecting model needs to define 2 more equations (involving P and h) to provide a balanced system.

source
HVAC.Boundary_PTMethod
Boundary_PT(; name, nPorts, P_in, T_in, use_input)

Defines a boundary component with nPorts of type SingleComponentFluidPort. The P and T states of both the component and the medium subsystem are fixed to P_in and T_in respectively.

Sub-systems (3*SingleComponentFluidPort + 2 undefined states):

  • ports::Vector{SingleComponentFluidPort} of size nPorts.
  • medium::BaseProperties

States (0):

Equations (4*nPorts):

Total:

  • States: 3*nPorts + 2
  • Eqns: 2*nPorts + 2

Connections/Extensions: Using a connect statement with a connector of type SingleComponentFluidPort for each of the nPorts.

Returns:

ODESystem composed of the 2 subsystems.

source
HVAC.Boundary_PTϕMethod
Boundary_PTϕ(; name, nPorts, P_in, T_in, ϕ_in, use_input)

Works with MoistAir medium. Defines a boundary component with nPorts of type MultiComponentFluidPort. The P and T states of both the component and the medium subsystem are fixed to P_in and T_in respectively.

Sub-systems (`3*nPorts + 3 undefined states):

  • ports::Vector{MultiComponentFluidPort} of size nPorts.
  • medium::BaseProperties

Parameters (2):

  • P_in: Specified pressure [Pa], default 1.01325e5
  • T_in: Specified temperature [K], default 293
  • ϕ_in: Specified moisture fraction, default 0.5

States (0):

Equations (3*nPorts + 3):

Total:

  • States: 3*nPorts + 3
  • Eqns: 3*nPorts + 3

Connections/Extensions: Using a connect statement with a connector of type MultiComponentFluidPort for each of the nPorts.

Returns:

ODESystem composed of the 2 subsystems.

source
HVAC.Boundary_PhMethod
Boundary_Ph(; name, nPorts, P_in, h_in, m_flow_start)

Defines a boundary component with nPorts of type TwoPhaseFluidPort. The P and h states of both the component and the medium subsystem are fixed to P_in and h_in respectively.

Sub-systems (3*nPorts + 2 undefined states):

  • port::Vector{TwoPhaseFluidPort} of size nPorts.
  • medium::BaseProperties

States (2):

  • P: Pressure [Pa]
  • h: Specific enthalpy [J/kg]

Equations (2*nPorts + 4):

Total:

  • States: 3*nPorts + 4
  • Eqns: 2*nPorts + 4

Connecting/Extending components should define port.m_flow for each of the nPorts.

Returns:

ODESystem composed of the 2 subsystems.

source
HVAC.ConstantPhasicMethod
ConstantPhasic(
;
    N,
    alpha_liq,
    alpha_2ph,
    alpha_vap,
    xdot_1,
    xdot_2,
    states,
    norm,
    name,
    kwargs...
)

Component for heat transfer from/to a two-phase fluid. Extends PartialTwoPhase.

Arguments:

  • N=1: Number of volumes
  • alpha_liq=700: Initial liquid phase heat transfer coefficient
  • alpha_2ph=2000: Initial two-phase heat transfer coefficient
  • alpha_vap=500: Initial vapor phase heat transfer coefficient
  • xdot_1=0.05: Transition point from liquid HTC to two-phase HTC
  • xdot_2=0.9: Transition point from two-phase HTC to vapor HTC

Equations:

Relations for the alphas equation as a function of xs and the given parameters.

Returns:

ODESystem composed of 2 subsystems

source
HVAC.DryAirSplitterMergerMethod
DryAirSplitterMerger(; name, isSplitter, nFlows)

Description

Constructs a model for a dry air splitter or merger. This function represents a component in an air circuit that either splits a single flow into multiple flows (splitter) or merges multiple flows into a single flow (merger).

Sub-systems

  • Air Ports: port_a::SingleComponentFluidPort, port_b::SingleComponentFluidPort

Equations

  • Mass, Component and Energy Balance

Returns

  • ODESystem
source
HVAC.DryHEXCrossflowMethod
DryHEXCrossflow(; name, N, CF_HeatTransfer, kwargs...)

Full model for thermo-fluid flow of dry air on the hot-side of a TubeFinHEX with distributed heat transfer.

  • Note: Each instance corresponds to a single cross-flow dry air stream. Thus, for a cross-flow configuration: If the tube side has N_tube finite volumes, it is necessary to create N_tube instances.

The kwarg N denotes the number of control volumes in each instance perpendicular to the tube flow direction.

  • Currently, only a steady-state model is implemented.

Kwargs:

  • N: The number of control volumes, defaults to 1
  • CF_HeatTransfer: Multiplicative correction factor for heat transfer, defaults to 1.0

Sub-systems (26 + 16N states, 23 + 11N equations, 2 + N connect equations)

This model is composed of the following subsystems:

Parameters

  • lambda: Thermal conductivity of air [W/(m*K)], defaults to 25.69e-3.
  • kfin: Fin thermal conductivity [W/(m*K)], defaults to 237.
  • Ka: Constant for calculating airflow pressure drop [Pa/(m^2/s^2)], defaults to 3e-3.
  • Ap: Total surface area of the tube per unit length [m^2/m], taken from the geometry configuration.
  • As: Fin surface area per unit length [m^2/m], taken from the geometry configuration.

Variables (N states)

  • Qdot_sens[1:N](t): Sensible heat flow rate [W].

Equations (1 + 5N)

Contains equations for pressure drop, fin efficiency, and energy balance (mass balance is taken care of in the partial model). The flow direction is assumed to be from port_a to port_b.

Returns

Returns an ODESystem (26 + 17N states, 24 + 16N equations, 2 + N connect equations)

source
HVAC.DrySimpleFanMethod
DrySimpleFan(
;
    name,
    vdot_nominal,
    power_nominal,
    speed_nominal,
    zFw,
    dP0,
    init,
    kwargs...
)

Arguments:

  • name (String): The name identifier for the fan.
  • vdot_nominal (Float, default=1.0): The nominal volumetric flow rate in m³/s.
  • power_nominal (Float, default=100): The nominal power consumption in Watts.
  • speed_nominal (Float, default=300): The nominal speed in RPM.
  • zFw (Float, default=1.0): Performance correction factor, dimensionless.
  • dP0 (Float, default=20): The nominal pressure drop in Pa.
  • kwargs (KeyValue): Other optional arguments.

Sub-systems:

  • partial_at::PartialDryAirTransport

Parameters:

  • vdot_nominal: The nominal volumetric flow rate in m³/s.
  • power_nominal: The nominal power consumption in Watts.
  • speed_nominal: The nominal speed in RPM.
  • zFw: Performance correction factor, dimensionless.
  • dP0: The nominal pressure drop in Pa.

States:

  • speed(t): The fan speed in RPM.
  • vdot(t): The volumetric flow rate in m³/s.
  • power(t): The power consumption of the fan in Watts.
  • Tout(t): The outlet temperature from the fan in K.

Returns: ODESystem composed of 1 sub-system.

source
HVAC.EnclosureWallGeoPropsMethod
EnclosureWallGeoProps(
;
    N,
    lambda_wall,
    Cp_wall,
    d_wall,
    L_wall,
    A_wall
) -> NamedTuple{(:lambda_wall, :Cp_wall, :d_wall, :L_wall, :A_seg, :m_wall, :N), Tuple{Int64, Int64, Int64, Float64, Int64, Float64, Int64}}

Named tuple holding the geometry and thermal properties of an enclosure wall segment.

Arguments:

(; N, lambda_wall, Cp_wall, d_wall, L_wall, A_wall) where:

  • N: Number of volumes (defaults to 1).
  • lambda_wall: Thermal conductivity of the wall material (defaults to 401 [W/m.K]).
  • Cp_wall: Specific heat capacity of the wall material (defaults to 381 [J/kg.K]).
  • d_wall: Density of the wall material (defaults to 8960 [kg/m³]).
  • L_wall: Thickness of the wall element (defaults to 0.75e-3 [m]).
  • A_wall: Area of the wall element (defaults to 20 [m²]).

Returns:

(; lambda_wall, Cp_wall, d_wall, L_wall, A_seg, m_wall, N) where:

  • A_seg: Inner area of the wall element.
  • m_wall: Mass of the wall segment.
source
HVAC.HEXCrossflowMethod
HEXCrossflow(
;
    name,
    N,
    ρ_constant,
    CF_MassTransfer,
    CF_HeatTransfer,
    kwargs...
)

Model for thermo-fluid flow of air through a cross-flow heat exchanger with optional condensation and mass transfer.

  • Note: Each instance corresponds to a single cross-flow moist air stream. Thus, for a cross-flow configuration: If the tube side has N_tube finite volumes, it is necessary to create N_tube instances.

The kwarg N denotes the number of control volumes in each instance perpendicular to the tube flow direction.

  • Currently, only a steady-state model is implemented.

Kwargs:

  • N: The number of control volumes, defaults to 1
  • ρ_constant: Density of incompressible fluid [kg/m^3], defaults to 1.1
  • CF_MassTransfer: Multiplicative correction factor for mass transfer, defaults to 1.0
  • CF_HeatTransfer: Multiplicative correction factor for heat transfer, defaults to 1.0

Sub-systems

  • partial_hc: PartialHEXCrossflow (34 + 21N states, 31 + 14N equations, 2 + N connection equations)

Parameters

  • P_ambient: Ambient pressure [Pa].
  • CF_HeatTransfer: Multiplicative correction factor for heat transfer [dimensionless].
  • htc[1:N]: Nominal heat transfer coefficient [W/(m^2*K)].
  • lambda: Thermal conductivity of air [W/(m*K)], defaults to 25.69e-3.
  • kfin: Fin thermal conductivity [W/(m*K)], defaults to 237.
  • Ka: Constant for calculating airflow pressure drop [Pa/(m^2/s^2)], defaults to 3e-3.

Variables (11N states)

  • Qdot_lat[1:N](t): Latent heat flow rate [W].
  • Qdot_sens[1:N](t): Sensible heat flow rate [W].
  • xsat_w[1:N](t): Saturation water load at wall surface [kg/kg].
  • eta[1:N](t): Dynamic viscosity [Pa*s].
  • psat_w[1:N](t): Saturation pressure at wall surface [Pa].
  • mtc[1:N](t): Mass transfer coefficient [kg/(m^2*s)].
  • dgradient[1:N](t): Driving gradient of the mass transfer process.
  • heff[1:N](t): Effective heat transfer coefficient [W/(m^2*K)].

Equations (1 + 17N equations)

Contains equations for mass, energy, and species conservation, as well as for the pressure and temperature in the channels. The flow direction is assumed to be from porta to portb.

Returns

Returns an extended ODESystem (34 + 32N states, 32 + 31N equations, 2 + N connection equations)

source
HVAC.HeatPortMethod
HeatPort(; name, T_start, Q_flow_start)

Connector for 1-D heat flow between components.

States (2):

  • T: Temperature [K]
  • Q_flow: (Flow connection) Heat flow rate [W]

Returns: ODESystem with 2 states, 0 equations.

source
HVAC.HeatTransferTwoPortMethod
HeatTransferTwoPort(
;
    N,
    alpha,
    area,
    use_radiation,
    epsilon,
    sigma,
    name
)

Component for heat transfer between two ports of type HeatPort.

If q_a[1].Q_flow > 0, this implies heat flows from q_a to q_b.

Sub-systems:

  • q_a::Vector{HeatPort}: Heat port a
  • q_b::Vector{HeatPort}: Heat port b

Equations (2):

  • Convective or Radiative heat transfer law between ports
  • Energy balance

Returns:

ODESystem composed of 2 subsystems

source
HVAC.MassFlowMultiComponentMethod
MassFlowMultiComponent(; name)

Interface between the blocks/signal domain and the Fluid domain - Mass flow

Subsystems:

  • input::RealInput
  • output_port::MultiComponentFluidPort

Equations (1):

Returns:

ODESystem composed of the 2 subsystems.

source
HVAC.MassFlowSource_TMethod
MassFlowSource_T(; name, T_in, m_flow_in, use_input)

Defines a boundary component that provides a fixed mass flow m_flow_in of fluid at a given temperature T_in. m_flow_in > 0 if mass flows into the component connected to port,

Sub-systems (3 undefined states):

  • port::SingleComponentFluidPort

Parameters (2):

  • T_in: Specified temperature [K], default 293
  • m_flow_in: Mass flow [kg/s] default -0.01

States (2):

  • P: Pressure [Pa]
  • h: Specific enthalpy [J/kg]

Equations (4)

Required Connections/Extensions:

  • P (may be defined using KVL, using a connect statement with another SingleComponentFluidPort)

Returns:

ODESystem composed of the 1 subsystem.

source
HVAC.MassFlowSource_TϕMethod
MassFlowSource_Tϕ(
;
    name,
    T_in,
    ϕ_in,
    m_flow_in,
    use_input,
    P_start
)

Works with the MoistAir medium. Defines a boundary component that provides a fixed mass flow m_flow_in of fluid at a given temperature T_in, and given moisture fraction ϕ_in. m_flow_in > 0 if mass flows into the component connected to port,

Sub-systems (4 undefined states):

  • port::MultiComponentFluidPort

Parameters (3):

  • T_in: Specified temperature [K], default 293
  • m_flow_in: Mass flow [kg/s] default -0.01
  • ϕ_in: Specified moisture fraction, default 0.5

States (3):

  • P: Pressure [Pa]
  • h: Specific enthalpy [J/kg]
  • Xi: Moisture fraction

Equations (6)

Required Connections/Extensions:

  • P (may be defined using KVL, using a connect statement with another MultiComponentFluidPort)

Returns:

ODESystem composed of the 1 subsystem.

source
HVAC.MassFlowSource_hMethod
MassFlowSource_h(; name, h_in, m_flow_in)

Defines a boundary component that provides a fixed mass flow m_flow_in of fluid at a given specific enthalpy h_in. m_flow_in > 0 if mass flows into the component connected to port,

Sub-systems (3 undefined states):

  • port::TwoPhaseFluidPort

Parameters (2):

  • h_in: Specific enthalpy [J/kg], default 420e3
  • m_flow_in: Mass flow [kg/s] default -0.01

States (1):

  • P: Pressure [Pa]

Equations (3)

Required Connections/Extensions:

  • P (may be defined using KVL, using a connect statement with another TwoPhaseFluidPort)

Returns:

ODESystem composed of the 1 subsystem.

source
HVAC.MassFlowTwoPhaseMethod
MassFlowTwoPhase(; name)

Interface between the blocks/signal domain and the Fluid domain - Mass flow

Subsystems:

  • input::RealInput
  • output_port::TwoPhaseFluidPort

Equations (1):

Returns:

ODESystem composed of the 2 subsystems.

source
HVAC.MultiComponentFluidPortMethod
MultiComponentFluidPort(
;
    name,
    P_start,
    m_flow_start,
    T_start,
    Xi_outflow_start,
    h_outflow_start
)

Two-phase fluid port connector for a multi-component mixture.

States:

  • P: Absolute pressure in the connection point [N/m²]
  • m_flow: Total mass flow rate from the connection point into the component [kg/s]
  • h_outflow: Specific thermodynamic enthalpy close to the connection point [J/kg]
  • Xi_outflow: Mixture mass fraction of each component close to the connection point if m_flow < 0

Returns: ODESystem.

source
HVAC.OneTempWall1DMethod
OneTempWall1D(
;
    name,
    N,
    T_in_start,
    T_out_start,
    T_start,
    dT,
    geo,
    kwargs...
)

Model for conductive heat transfer through the tube walls of a TubeFinHEX. Distributed heat transfer between the fluids flowing in two StraightPipe or HEXCrossflow models.

Sub-systems:

  • heatPort_a::Vector{HeatPort}: Heat ports for the refrigerant side of the heat exchanger.
  • heatPort_b::Vector{HeatPort}: Heat ports for the air side of the heat exchanger.

Parameters:

  • T_initial::Vector{Real}: Initial temperatures of the wall segments.

The parameters of the wall (such as Cp_wall and m_wall) are defined in a named-tuple (record) called geo. This is defined using the TubeWallGeoProps function.

States:

  • T: Temperatures of the wall segments 1 to N.

Equations:

  • Temperature T is set to be equal to both heat port temperatures.
  • Dynamics of T as a result of heat flow
source
HVAC.PartialDistributedFlowMethod
PartialDistributedFlow(; name, m, m_flow_start, kwargs...)

Base component for m momentum balances equations. Separate class to allow for different discretization scheme from PartialDistributedVolume e.g., for staggered grid approach: m = n-1. Currently, steady-state conditions are assumed (D(Is) = 0)

States (5*m):

  • m_flows[i] [kg/s] Mass flow rate in flow segment i
  • Is[i] [kg.m/s ] Momentum of flow segment i
  • Fs_p[i] [N] Pressure forces acting on flow segment i
  • Fs_fg[i] [N] Friction and gravitational forces acting on flow segment i
  • Ib_flows[i] [N] Flow of momentum across boundaries into i.

Parameters (m):

  • pathLengths[i] [m] Length along flow path.

Equations (2m):

  • Definition of Is[i]
  • Steady-state momentum balance

Returns:

  • ODESystem
source
HVAC.PartialDistributedVolumeMethod
PartialDistributedVolume(
;
    name,
    N,
    use_dist_start,
    P_a_start,
    P_b_start,
    h_a_start,
    h_b_start,
    dρdP_h_start,
    dρdh_P_start,
    m_flow_start,
    kwargs...
)

Base component for N ideally mixed fluid volumes with the ability to store mass and energy. 1-D spatial discretization in direction of fluid flow using the Finite Volume Method.

Defines mass and energy balance equations.

Subsystems:

  • medium::BaseProperties, defined at centroids of CV i in 1:N

For two-phase refrigerants, typically P and h are used as independent ThermodynamicState variables. The function arguments are used to pass initial values to these states.

Parameters:

  • fluidVolumes[i] [] Volume of i (specifed in extending component)

States:

  • dms[i] [kg/s] Rate of change of mass contained in control volume i, for i in 1:N
  • dUs[i] [J/s] Rate of change of internal energy contained in control volume i, for i in 1:N
  • m_flows[i] [kg/s] Mass flow rate into face of control volume i, defined for N+1 faces
  • H_flows[i] [J/s] Enthalpy flow rate into face of control volume i, defined for N+1 faces. Defined using upwind discretization.
  • mb_flows[i] [kg/s] Source/Sink mass flow rate into/out of control volume i, for i in 1:N (specifed in extending component)
  • Hb_flows[i] [J/s] Source/Sink enthalpy flow rate into/out of control volume i, for i in 1:N (specifed in extending component)
  • Qb_flows[i] [J/s] Source/Sink heat flow rate into/out of control volume i, for i in 1:N (specifed in extending component)
  • Wb_flows[i] [J/s] Source/Sink work flow into/out of control volume i, for i in 1:N (specifed in extending component)

Equations:

  • Conservation of mass and internal energy
  • Upwind discretization scheme for enthalpy flows

Remarks:

  • mb_flows[i] and Hb_flows[i] are define net inflows into control volume, i.e., mb_flows[i] ~ m_flows[i] - m_flows[i+1] and Hb_flows[i] ~ H_flows[i] - H_flows[i+1], for i in 1:N.
  • H_flows[i-1] and H_flows[i] denotes the convected enthalpy fluxes into and out of volume i respectively.

In FVM, these face fluxes are interpolated from quantities defined at the cell centre. For convective fluxes (unlike diffusive fluxes), it is numerically advantageous to consider the flow direction in this interpolation: Rather than using a central-difference interpolation scheme that uses information stored at the centroid of the downstream volume, an upwind scheme is used where only one-sided information is used based on the flow direction. Thus: For face i, if m_flows[i] > 0, H_flows[i] ~ medium.h[i-1]*m_flows[i] and if m_flows[i] < 0, H_flows[i] ~ medium.h[i]*m_flows[i] written compactly using the semilinear function

Returns:

  • mediums[i]: ODESystem defining medium BaseProperties for control volume i
  • sys: Partial ODESystem
source
HVAC.PartialDryHEXCrossflowMethod
PartialDryHEXCrossflow(
;
    name,
    N,
    P_ambient,
    CF_HeatTransfer,
    htc_nominal,
    init,
    geo,
    kwargs...
)

Partial model for thermo-fluid flow of dry air on the hot-side of a TubeFinHEX with distributed heat transfer.

Kwargs:

  • N: The number of control volumes, defaults to 1
  • P_ambient: The ambient pressure, defaults to 101.325e3 Pa
  • CF_HeatTransfer: Multiplicative correction factor for heat transfer, defaults to 1.0
  • htc_nominal: Nominal heat transfer coefficient, defaults to 50
  • init: Initialization configuration for the model, defaults to AirChannelInit(;mdot_start=0.2)
  • geo: Geometry configuration for the model, defaults to AirChannelGeo()

Sub-systems: (17 + 11N states, 7 + 7N equations)

Parameters

  • P_ambient: Ambient pressure [Pa].
  • CF_HeatTransfer: Multiplicative correction factor for heat transfer [dimensionless].
  • htc[1:N]: Nominal heat transfer coefficient [W/(m^2*K)].

Variables: (9 + 5N states)

  • P(t): Pressure [Pa].
  • T[1:N+1](t): Temperature [K].
  • H_flow[1:N+1](t): Enthalpy flow [J/s].
  • mdot[1:N+1](t): Total mass flow [kg/s].
  • Q_flow[1:N](t): Heat flow rate [W].
  • Ploss(t): Pressure drop over the entire channel [Pa].
  • ρ_mean(t): Mean density of all channels [kg/m^3].
  • cp_mean(t): Mean heat capacity of air [J/(kg*K)].
  • T_in(t): Inlet air temperature [K].
  • T_out(t): Outlet air temperature [K].
  • eta_fin[1:N](t): Fin efficiency [dimensionless].

Equations: (14 + 2N + 2(N+1) equations)

Mass and Energy balance (without storage). Pressure drop correlation. The flow direction is assumed to be from porta to portb.

Returns

Returns an ODESystem (26 + 16N states, 23 + 11N equations, 2 + N connect equations)

source
HVAC.PartialHEXCrossflowMethod
PartialHEXCrossflow(
;
    name,
    N,
    condensing,
    moist_air,
    P_ambient,
    ρ_constant,
    CF_MassTransfer,
    CF_HeatTransfer,
    htc_nominal,
    init,
    geo,
    verbose,
    eta_start,
    P_loss_start,
    kwargs...
)

1D thermo-fluid flow of moist air. Crossflow configuration on the fin side of a TubeFinHEX.

Kwargs:

  • N: The number of control volumes, defaults to 1
  • condensing: Whether condensation should be taken into account, defaults to true
  • moist_air: Whether air is considered moist, defaults to true
  • P_ambient: Ambient pressure [Pa], defaults to 101.325e3
  • ρ_constant: Density of incompressible fluid [kg/m^3], defaults to 1.1
  • CF_MassTransfer: Multiplicative correction factor for mass transfer, defaults to 1.0
  • CF_HeatTransfer: Multiplicative correction factor for heat transfer, defaults to 1.0
  • htc_nominal: Nominal heat transfer coefficient [W/(m^2*K)], defaults to 50

Sub-systems

Parameters

  • htc[1:N]: Heat transfer coefficients for each air channel [W/(m^2*K)]

Variables (11 + 7N states)

  • P(t): Pressure [Pa]
  • T[1:N+1](t): Temperature [K]
  • H_flow[1:N+1](t): Enthalpy flow [J/s]
  • mdot[1:N+1](t): Total mass flow [kg/s]
  • mXi_flow[1:N+1](t): Water transported by air [kg/s]
  • Q_flow[1:N](t): Heat flow rate [W]
  • mcond_flow[1:N](t): Condensing water flow rate [kg/s]
  • Ploss(t): Pressure drop over the entire channel [Pa]
  • ρ_mean(t): Mean density of all channels [kg/m^3]
  • Q_water(t): Liquid water enthalpy flow [J/s]
  • cp_mean(t): Mean heat capacity of air [J/(kg*K)]
  • T_in(t): Inlet air temperature [K]
  • T_out(t): Outlet air temperature [K]
  • eta_fin[1:N](t): Fin efficiency

Equations (22 + 5N equations)

Contains equations for mass, energy, and species conservation, as well as for the pressure and temperature in the channels.

Returns

Returns the heatPorts, mediums, and a composed ODESystem. (34 + 21N states, 31 + 14N equations, 8 + 2*N connection equations)

source
HVAC.PartialStraightPipeMethod
PartialStraightPipe(
;
    name,
    N,
    model_structure,
    dP_small,
    m_flow_small,
    flowNorm,
    kwargs...
)

Extends PartialDistributedVolume and SimpleStaggeredFlowModel

Parameters:

  • lengths[i] [m] Length of flow segment i in 1:N
  • crossAreas[i] [] Cross-sectional area of flow segment i in 1:N
  • dimensions[i] [m] Hydraulic diameter of flow segment i in 1:N
  • roughnesses[i] [m] Average height of surface asperities in flow segment i in 1:N
  • dheights[i] [m] Difference in height of flow segment i in 1:N compared to volume i-1

States:

  • Mtot [kg] Total mass of fluid in set of differential models
  • dms[i] [kg/s] Rate of change of mass flow in control volume i in 1:N
  • dUs[i] [J/s] Rate of change of internal energy change in control volume i in 1:N
  • vs[i] [m/s] Mean velocities in flow segment i in 1:N

Returns: ODESystem composed of extensions to PartialDistributedFlow composed with states[i] containing the ThermodynamicState of the medium in control volume i Sub-systems:

  • port_a::TwoPhaseFluidPort: Port at start of pipe
  • port_b::TwoPhaseFluidPort: Port at end of pipe
  • state_a::ThermodynamicState: Thermodynamic state defined by volume outside port_a
  • state_b::ThermodynamicState Thermodynamic state defined by volume outside port_b
  • flowModel::SimpleStaggeredFlowModel: Flow model for pipe
  • statesFM::Vector{ThermodynamicState}: Thermodynamic states defined by volumes inside pipe
source
HVAC.PartialTwoPhaseMethod
PartialTwoPhase(; name, N, alpha0, states)

Base component for heat transfer from/to a two-phase fluid. 1-D spatial discretization using the Finite Volume Method.

Sub-systems:

  • heatPorts::Vector{HeatPort}: Heat ports for each volume
  • states::Vector{ThermodynamicState}: Thermodynamic states for each volume

Parameters:

  • surfaceAreas[1:N]: Surface area of each volume [m^2]
  • lengths[1:N]: Length of each volume [m]
  • dimensions[1:N]: Diameter of each volume [m]
  • roughnesses[1:N]: Roughness of each volume [m]
  • diameters[1:N]: Diameter of each volume [m]
  • As[1:N]: Cross-sectional area of each volume [m^2]

States (7*N):

vs[1:N]: Flow velocities [m/s] Ts[1:N]: Fluid temperature [K] ρs[1:N]: Density [kg/m^3] m_flows[1:N]: Mass flow rate [kg/s]

  • alphas[1:N]: Heat transfer coefficient [W/(m^2 K)]
  • xs[1:N]: Vapor quality [-]
  • Q_flows[1:N]: Heat flow rate [W]

Equations (5*N):

Returns:

ODESystem composed of 2 subsystems

source
HVAC.PrescribedHeatFlowMethod
PrescribedHeatFlow(; name, nPorts, Q_flow_in, use_input)

Component that provides a distributed heat source or sink with a fixed heat flow Q_flow_in. If Q_flow_in > 0.0, the component is a heat source i.e. heat flows into the component that connects to it.

Sub-systems:

  • ports::Vector{HeatPort} (2 undefined states)

Parameters (1):

  • Q_flow_in: Heat flow [W], default 1e3

Equations:

1 for each port to fix temperature.

Connections/Extensions:

  • Usually connect ports

Returns:

ODESystem composed of the 1 subsystem.

source
HVAC.PrescribedTemperatureMethod
PrescribedTemperature(; name, nPorts, T_in, use_input)

Component that provides a distributed heat source or sink at fixed temperature T_in

Sub-systems:

  • ports::Vector{HeatPort} (2 undefined states)

Parameters (1):

  • T_in: Specified temperature [K], default 293

Equations:

1 for each port to fix temperature.

Connections/Extensions:

  • Usually connect ports

Returns:

ODESystem composed of the 1 subsystem.

source
HVAC.PressureMultiComponentMethod
PressureMultiComponent(; name)

Interface between the blocks/signal domain and the Fluid domain - Pressure

Subsystems:

  • input::RealInput
  • output_port::MultiComponentFluidPort

Equations (1):

Returns:

ODESystem composed of the 2 subsystems.

source
HVAC.PressureTwoPhaseMethod
PressureTwoPhase(; name)

Interface between the blocks/signal domain and the Fluid domain - Pressure

Subsystems:

  • input::RealInput
  • output_port::TwoPhaseFluidPort

Equations (1):

Returns:

ODESystem composed of the 2 subsystems.

source
HVAC.RefChannelNormMethod
RefChannelNorm(
;
    mdot0,
    dP0,
    K_dP,
    dP_exp
) -> NamedTuple{(:mdot0, :dP0, :K_dP, :dP_exp), Tuple{Float64, Float64, Int64, Int64}}

Named tuple holding coefficients defininng The relationship between the pressure drop and the mass flow rate.

(mdot0, dp0, K_dP, dP_exp) where:

  • mdot0 = 0.01 [kg/s]: Reference mass flow rate.
  • dP0 = 10e3 [Pa]: Reference pressure drop.
  • K_dP = 1 [Pa/kg/s]: Correction for pressure drop correlation (accounts for deviation from nominal behavior)
  • dP_exp = 2 [-]: Exponent for pressure drop correlation
source
HVAC.RefrigerantSplitterMergerMethod
RefrigerantSplitterMerger(; name, isSplitter, nFlows)

Description

Constructs a model for a refrigerant splitter or merger. Splits a single flow into multiple flows (splitter) or merges multiple flows into a single flow (merger).

Sub-systems:

port_a::TwoPhaseFluidPortport_b::TwoPhaseFluidPort

Equations:

Mass and Energy Balance

Returns

  • ODESystem
source
HVAC.RoomGeoPropsMethod
RoomGeoProps(
;
    A_wall,
    L_wall,
    U_inner,
    U_outer,
    d_wall,
    Cp_wall,
    lambda_wall
) -> NamedTuple{(:A_wall, :L_wall, :U_inner, :U_outer, :d_wall, :Cp_wall, :lambda_wall), Tuple{Int64, Float64, Float64, Float64, Int64, Int64, Float64}}

Named tuple holding the geometry and thermal properties of a room.

Arguments:

(; A_wall, L_wall, U_inner, U_outer, d_wall, Cp_wall, lambda_wall) where:

  • A_wall: Wall surface area (defaults to 20 [m²]).
  • L_wall: Wall thickness (defaults to 0.2 [m]).
  • U_inner: Inner wall U-value (defaults to 1.5 [W/m².K]).
  • U_outer: Outer wall U-value (defaults to 3.5 [W/m².K]).
  • d_wall: Wall density (defaults to 1600 [kg/m³]).
  • Cp_wall: Wall specific heat capacity (defaults to 840 [J/kg.K]).
  • lambda_wall: Wall thermal conductivity (defaults to 0.7 [W/m.K]).

Returns:

(; A_wall, L_wall, U_inner, U_outer, d_wall, Cp_wall, lambda_wall)

source
HVAC.SimpleFanMethod
function SimpleFan(;name,
vdot_nominal=1.0,   # nominal volumetric flow rate
power_nominal=100,  # nominal power consumption
speed_nominal=300,  # nominal speed
zFw=1.0,            # performance correction factor
dP0=20,             # nominal pressure drop
kwargs...,
)

Arguments:

  • name (String): The name identifier for the fan.
  • vdot_nominal (Float, default=1.0): The nominal volumetric flow rate in m³/s.
  • power_nominal (Float, default=100): The nominal power consumption in Watts.
  • speed_nominal (Float, default=300): The nominal speed in RPM.
  • zFw (Float, default=1.0): Performance correction factor, dimensionless.
  • dP0 (Float, default=20): The nominal pressure drop in Pa.
  • kwargs (KeyValue): Other optional arguments.

Sub-systems:

  • partial_at::PartialAirTransport

Parameters:

  • vdot_nominal: The nominal volumetric flow rate in m³/s.
  • power_nominal: The nominal power consumption in Watts.
  • speed_nominal: The nominal speed in RPM.
  • zFw: Performance correction factor, dimensionless.
  • dP0: The nominal pressure drop in Pa.

States:

  • speed(t): The fan speed in RPM.
  • vdot(t): The volumetric flow rate in m³/s.
  • power(t): The power consumption of the fan in Watts.
  • Tout(t): The outlet temperature from the fan in K.

Returns: ODESystem composed of 1 sub-system.

source
HVAC.SimpleStaggeredFlowModelMethod
SimpleStaggeredFlowModel(
;
    name,
    N,
    from_dP,
    P_a_start,
    P_b_start,
    m_flow_start,
    dP_small,
    m_flow_small,
    g_n,
    states,
    flowNorm,
    kwargs...
)

Extends PartialDistributedFlow to define m momentum balance equations. Defines additional equations for Ib_flows, Fs_p and Fs_fg. Since the upwind-discretization scheme is used, m = N-1 where N is the number of control volumes (as defined in extending classes of PartialDistributedVolume).

States:

  • dps_f[i] [Pa] Pressure drop between states due to friction, i in 1:N-1
  • dps_fg[i] [Pa] Pressure drop between states due to gravity, i in 1:N-1

Parameters:

  • crossAreas[i] [] Cross-sectional area of control volume i in 1:N
  • dimensions[i] [m] Characteristic dimensions for fluid flow (diameters for pipe flow) i in 1:N
  • diameters[i] [m] Average diameter of control volume i in 1:N-1, determined from dimensions
  • roughnesses[i] [m] Average height of surface asperities for control volume i in 1:N
  • dheights[i] [m] Static head of fluid in control volume i in 1:N-1 compared to volume i-1
  • dP_nominal, m_flow_nominal, K_dP, dP_exp: Nominal coefficients for pressure drop-flow rate correlation. See: RefChannelNorm.

Returns: ODESystem composed of extensions to PartialDistributedFlow composed with states[i] containing the ThermodynamicState of the medium in control volume i

source
HVAC.SingleIOMethod
SingleIO(; name, val_start)

A connector for a single input/output port with a real-valued signal. Returns: ODESystem.

source
HVAC.StraightPipeMethod
StraightPipe(
;
    name,
    N,
    len,
    diameter,
    crossArea,
    perimeter,
    roughness,
    V,
    height_ab,
    g_n,
    pipeNorm,
    init,
    kwargs...
)

Complete model for one-dimensional fluid flow in a straight cylindrical pipe of dimensions fixed in the args. Constructs the distributed mass, energy and momentum balances extending PartialDistributedVolume and PartialStraightPipe. Mass and energy balanced discretized using finite volume method. Staggered grid scheme for momentum balances. kwargs are passed to PartialStraightPipe and eventually to PartialDistributedVolume.

Model settings:

  • Flow resistance model: model_structure = av_vb, can change to a_vb, a_v_b
  • Heat transfer model: heatTransfer = ConstantPhasic()

Extends PartialStraightPipe.

Since the upwind-discretization scheme is used, m = N-1 where N is the number of control volumes (as defined in extending classes of PartialDistributedVolume).

States:

Parameters:

Returns: ODESystem composed of extensions to PartialDistributedFlow composed with states[i] containing the ThermodynamicState of the medium in control volume i

source
HVAC.StraightPipeInitMethod
StraightPipeInit(
;
    p_in_start,
    p_out_start,
    h_in_start,
    h_out_start,
    m_flow_start
) -> NamedTuple{(:p_in_start, :p_out_start, :h_in_start, :h_out_start, :m_flow_start), NTuple{5, Float64}}

Sets the initialization for the StraightPipe model.

Arguments:

  • p_in_start (Float, default=1e6): The starting pressure of the 1st CV of the pipe
  • p_out_start (Float, default=1e6): The starting pressure of the last CV of the pipe
  • h_in_start (Float, default=230e3): The starting enthalpy of the 1st CV of the pipe
  • h_out_start (Float, default=430e3): The starting enthalpy of the last CV of the pipe
  • m_flow_start (Float, default=0.01): The starting mass flow rate in kg/s.
source
HVAC.ThermodynamicStateMethod
ThermodynamicState(
    data::HVAC.MoistAirData;
    name,
    P_start,
    T_start,
    Xi_start
)

Declares the minimum set of independent thermodynamic variables to fully define the state of moist air (defaults to pressure P [N/m²], temperature T [K] and mass fractions Xi). Returns: ODESystem.

source
HVAC.ThermodynamicStateMethod
ThermodynamicState(
    data::HVAC.SimpleData;
    name,
    P_start,
    T_start
)

Declares the minimum set of independent thermodynamic variables to fully define the state of dry air (defaults to pressure P [N/m²] and temperature T [K]).

Returns: ODESystem.

source
HVAC.ThermodynamicStateMethod
ThermodynamicState(
    data::RefpropSplines.MultisurfaceFluidData;
    name,
    P_start,
    h_start
)

Declares the minimum set of independent thermodynamic variables to fully define the state of a refrigerant (integrated with RefpropSplines). The pressure P and specific enthalpy h are chosen as independent variables.

source
HVAC.TubeFinHEXMethod
TubeFinHEX(
;
    name,
    nFlows_distributor,
    model_structure,
    use_dist_start,
    htc_air,
    N_air,
    init,
    circuitNorm,
    circuitFlowNorm,
    geo,
    kwargs...
)

Kwargs:

N_air: Discretization of air-flow perpendicular to the tubes, fixed to be 1.

Description

Constructs a tube-fin heat exchanger model. Refrigerant flows inside the tubes and air flows over the fins.

Initialization routines:

  • The init kwarg is used to pass in a TubeFinHEXInit record for initialization.

Internally, the values are used to initialize the sub-components:

Sub-systems:

Refrigerant side:

Air side:

  • airPort_a: AirPort Airflow (hot-side) for the entire tube-fin HX.
  • air_distributor: AirSplitterMerger which splits the air flow into nFlows_distributor flows. Thus, the flow in each HEXCrossflow is m_flow_air/nFlows_distributor.
  • airFlow: HEXCrossflow which models the air thermo-fluid flow in a cross-flow configuration.
  • air_merger: AirSplitterMerger which merges the air flows
  • airPort_b: AirPort for the entire tube-fin HX.
  • medium_out: BaseProperties of moist air.

Wall model:

  • wall: OneTempWall1D which models the heat transfer between the refrigerant and air.

States:

  • dP_hx(t): Pressure drop across the heat exchanger [Pa].
  • Q_tot(t): Total heat flow rate in the heat exchanger [W].
  • Qsen_tot(t): Total sensible heat flow rate in the heat exchanger [W].
  • Qlat_tot(t): Total latent heat flow rate in the heat exchanger [W].
  • Mtot(t): Total mass inside the heat exchanger [kg].
  • Tair_out(t): Outlet air temperature from the heat exchanger [K].
  • mcond_out(t): Total mass flow rate of the condensed liquid in the heat exchanger [kg/s].

Equations:

Connections between the sub-components:

  • ref_port_a to ref_distributor to circuit to ref_merger to ref_port_b.
  • airPort_a to air_distributor to airFlow to air_merger to airPort_b.

Returns

Returns an ODESystem system, which includes the equations, parameters, and sub-components of the heat exchanger.

source
HVAC.TubeFinHEXDryMethod
TubeFinHEXDry(;name, nFlows_distributor=1, model_structure::ModelStructure=av_vb,
            use_dist_start::Bool=false, htc_air=50, N_air=1, init=nothing,
            circuitNorm=nothing, circuitFlowNorm=nothing, geo=nothing, kwargs...)

Kwargs:

N_air: Discretization of air-flow perpendicular to the tubes, fixed to be 1.

Description

Constructs a tube-fin heat exchanger model. Refrigerant flows inside the tubes and air flows over the fins.

Sub-systems:

Refrigerant side:

Air side:

  • airPort_a: AirPort Airflow (hot-side) for the entire tube-fin HX.
  • air_distributor: AirSplitterMerger which splits the air flow into nFlows_distributor flows. Thus, the flow in each HEXCrossflow is m_flow_air/nFlows_distributor.
  • airFlow: HEXCrossflow which models the air thermo-fluid flow in a cross-flow configuration.
  • air_merger: AirSplitterMerger which merges the air flows
  • airPort_b: AirPort for the entire tube-fin HX.
  • medium_out: BaseProperties of dry air.

Wall model:

  • wall: OneTempWall1D which models the heat transfer between the refrigerant and air.

States:

  • dP_hx(t): Pressure drop across the heat exchanger [Pa].
  • Q_tot(t): Total heat flow rate in the heat exchanger [W].
  • Qsen_tot(t): Total sensible heat flow rate in the heat exchanger [W].
  • Qlat_tot(t): Total latent heat flow rate in the heat exchanger [W].
  • Mtot(t): Total mass inside the heat exchanger [kg].
  • Tair_out(t): Outlet air temperature from the heat exchanger [K].
  • mcond_out(t): Total mass flow rate of the condensed liquid in the heat exchanger [kg/s].

Equations:

Connections between the sub-components:

  • ref_port_a to ref_distributor to circuit to ref_merger to ref_port_b.
  • airPort_a to air_distributor to airFlow to air_merger to airPort_b.

Returns

Returns an ODESystem system, which includes the equations, parameters, and sub-components of the heat exchanger.

source
HVAC.TubeFinHEXGeoMethod
TubeFinHEXGeo(
;
    nTube,
    nCir,
    nHeader,
    nRow,
    nSeg,
    Lt,
    Di,
    Do,
    FPI,
    Pt,
    Pr,
    tf,
    height_fin,
    width_fin,
    n_fin,
    helix_angle,
    apex_angle,
    T,
    T,
    nTubeOfCircuit,
    T,
    T,
    TubeNoSequenceOfCircuit,
    Di_Header,
    Do_Header,
    Lt_Header,
    kt,
    kf,
    rhot,
    rhof,
    cpt,
    cpf
) -> NamedTuple{(:nTube, :nCir, :nHeader, :nRow, :nSeg, :Lt, :Di, :Do, :FPI, :Pt, :Pr, :tf, :height_fin, :width_fin, :n_fin, :helix_angle, :apex_angle, :nTubePerRow, :Ap, :As, :Ai, :Aface, :tubemass, :finmass, :meanCp, :meanRho, :nTubeOfCircuit, :TubeNoSequenceOfCircuit, :kt, :kf, :rhot, :rhof, :cpt, :cpf), Tuple{Int64, Int64, Int64, Int64, Int64, Float64, Float64, Float64, Int64, Float64, Float64, Float64, Int64, Int64, Int64, Int64, Int64, Int64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Vector{Int64}, Vector{Vector{Int64}}, Int64, Int64, Int64, Int64, Int64, Int64}}

Named tuple holding the geometry and thermal properties of a tube-fin heat exchanger.

Arguments:

(; nTube, nCir, nHeader, nRow, nSeg, Lt, Di, Do, FPI, Pt, Pr, tf, height_fin, width_fin, n_fin, helix_angle, apex_angle, nTubeOfCircuit, TubeNoSequenceOfCircuit, Di_Header, Do_Header, Lt_Header, kt, kf, rhot, rhof, cpt, cpf) where:

  • nTube: Total number of tubes (defaults to 48).
  • nCir: Number of circuits (defaults to 4).
  • nHeader: Number of headers (defaults to 2).
  • nRow: Number of tube banks (defaults to 3).
  • nSeg: Number of segments for each tube (defaults to 2).
  • Lt: Tube length (defaults to 0.5 [m]).
  • Di: Tube inner diameter (defaults to 0.009449 [m]).
  • Do: Tube outer diameter (defaults to 0.010058 [m]).
  • FPI: Fin density (fins per inch, defaults to 12).
  • Pt: Tube pitch (defaults to 0.0254 [m]).
  • Pr: Row pitch (defaults to 0.01905 [m]).
  • tf: Fin thickness (defaults to 0.00011 [m]).
  • height_fin: Fin height (defaults to 0).
  • width_fin: Fin tip width (defaults to 0).
  • n_fin: Number of microfins (defaults to 0).
  • helix_angle: Microfin helix angle (defaults to 0).
  • apex_angle: Fin apex angle (defaults to 0).
  • nTubeOfCircuit: Number of tubes in each circuit (defaults to [12, 12, 12, 12]).
  • TubeNoSequenceOfCircuit: Tube number sequence for each circuit (defaults to [[1, 36, 35, 34, 33, 17, 18, 19, 20, 4, 3, 2, 1, 2], [1, 40, 39, 38, 37, 21, 22, 23, 24, 8, 7, 6, 5, 2], [1, 44, 43, 42, 41, 25, 26, 27, 28, 12, 11, 10, 9, 2], [1, 48, 47, 46, 45, 29, 30, 31, 32, 16, 15, 14, 13, 2]]).
  • Di_Header: Header inner diameter (defaults to [0.020, 0.020]).
  • Do_Header: Header outer diameter (defaults to [0.025, 0.025]).
  • Lt_Header: Header length (defaults to [nTube/nRow * Pt, nTube/nRow * Pt]).
  • kt: Tube thermal conductivity (defaults to 400 [W/m.K]).
  • kf: Fin thermal conductivity (defaults to 237 [W/m.K]).
  • rhot: Tube density (defaults to 8900 [kg/m³]).
  • rhof: Fin density (defaults to 2700 [kg/m³]).
  • cpt: Tube specific heat capacity (defaults to 385 [J/kg.K]).
  • cpf: Fin specific heat capacity (defaults to 897 [J/kg.K]).

Returns:

A named tuple containing the geometry and thermal properties of a tube-fin heat exchanger.

source
HVAC.TubeFinHEXInitMethod
TubeFinHEXInit(
;
    circuit_h_in_start,
    circuit_h_out_start,
    circuit_p_in_start,
    circuit_p_out_start,
    circuit_mdot_start,
    Twall_in_start,
    Twall_out_start,
    Twall_start,
    air_mdot_start,
    air_Tin_start,
    air_Ploss_start,
    T_air_out_ref_port_a_start,
    T_air_out_ref_port_b_start,
    Q_init
) -> NamedTuple{(:circuit_h_in_start, :circuit_h_out_start, :circuit_p_in_start, :circuit_p_out_start, :circuit_mdot_start, :Twall_in_start, :Twall_out_start, :Twall_start, :air_mdot_start, :air_Tin_start, :air_Ploss_start, :T_air_out_ref_port_a_start, :T_air_out_ref_port_b_start, :Q_init), Tuple{Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Int64, Float64, Float64, Int64}}

Named tuple holding the initial conditions of a tube-fin heat exchanger.

Arguments:

  • circuit_h_in_start: Refrigerant side initial enthalpy at inlet (defaults to 200e3 [J/kg]).
  • circuit_h_out_start: Refrigerant side initial enthalpy at outlet (defaults to 300e3 [J/kg]).
  • circuit_p_in_start: Refrigerant side initial pressure at inlet (defaults to 5e5 [Pa]).
  • circuit_p_out_start: Refrigerant side initial pressure at outlet (defaults to 4.8e5 [Pa]).
  • circuit_mdot_start: Initial mass flow rate (defaults to 0.02 [kg/s]).
  • Twall_in_start: Initial wall temperature at inlet (defaults to 298.15 [K]).
  • Twall_out_start: Initial wall temperature at outlet (defaults to 298.15 [K]).
  • air_mdot_start: Air side mass flow rate (defaults to 0.01 [kg/s]).
  • air_Tin_start: Air side entry temperature (defaults to 300.0 [K]).
  • air_Ploss_start: Air side pressure loss (defaults to 1000 [Pa]).
  • T_air_out_ref_port_a_start: Air side outlet temperature on side close to refrigerant entry (defaults to 18 [degC]).
  • T_air_out_ref_port_b_start: Air side outlet temperature on side close to refrigerant exit (defaults to 20 [degC]).
  • Q_init: Initial heat flow rate (defaults to -50 [W]). Positive implies heat flows from air side to refrigerant.

Returns:

A named tuple containing the initial conditions of a tube-fin heat exchanger.

source
HVAC.TubeWallGeoPropsMethod
TubeWallGeoProps(
;
    N,
    lambda_wall,
    Cp_wall,
    d_wall,
    L_wall,
    L_tube,
    d_innertube
) -> NamedTuple{(:lambda_wall, :Cp_wall, :d_wall, :L_wall, :L_tube, :d_outertube, :d_innertube, :L_seg, :A_seg, :Rw, :m_wall, :totalmass, :N), Tuple{Int64, Int64, Int64, Float64, Int64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Int64}}

Named tuple holding the geometry and thermal properties of a tube wall segment.

Arguments:

(; N, lambda_wall, Cp_wall, d_wall, L_wall, L_tube, d_innertube) where:

  • N: Number of volumes or segments along the tube length (defaults to 1).
  • lambda_wall: Thermal conductivity of the wall material (defaults to 401 [W/m.K]).
  • Cp_wall: Specific heat capacity of the wall material (defaults to 381 [J/kg.K]).
  • d_wall: Density of the wall material (defaults to 8960 [kg/m³]).
  • L_wall: Thickness of the wall element (defaults to 0.75e-3 [m]).
  • L_tube: Total length of the tube (defaults to 25 [m]).
  • d_innertube: Inner diameter of the tube (defaults to 3.92e-3 [m]).

Returns:

(; lambda_wall, Cp_wall, d_wall, L_wall, L_tube, d_outertube, d_innertube, L_seg, A_seg, Rw, m_wall, totalmass, N) where:

  • d_outertube [m]: Outer diameter of the tube.
  • L_seg [m]: Length of one wall segment.
  • A_seg [m²]: Inner area of wall element.
  • Rw [K/W]: Thermal resistance of the wall element.
  • m_wall [kg]: Mass of one wall segment.
  • totalmass [kg]: Total mass of the tube wall.
source
HVAC.TwoPhaseFluidPortMethod
TwoPhaseFluidPort(
;
    name,
    P_start,
    m_flow_start,
    h_outflow_start
)

Two-phase fluid port connector for a pure substance.

States (3):

  • P: Absolute pressure in the connection point [N/m²]
  • m_flow: (Flow connection) Mass flow rate from the connection point into the component [kg/s]
  • h_outflow: (Stream connection) Specific thermodynamic enthalpy close to the connection point if m_flow < 0 [J/kg]

Returns: ODESystem with 3 states, 0 equations.

source
HVAC.TypicalCompressorMethod
TypicalCompressor(
;
    name,
    Vmax,
    Vrel,
    zFw_shell,
    maxPower,
    c_vol,
    c_pow,
    init,
    zFw,
    scP,
    scCF,
    scVdot,
    kwargs...
)

Compressor model assuming no mass or energy storage. m_flow_start > 0.0 means flow is into the compressor through port_a and out through port_b.

Arguments:

  • name (String): The name identifier for the compressor.
  • Vmax (Float, default=15.0e-6): The maximum volume of the compressor in m³.
  • Vrel (Float, default=1.0): The relative volume of the compressor, dimensionless.
  • zFw_shell (Float, default=1.0): The shell friction factor, dimensionless.
  • maxPower (Float, default=3000): The maximum power the compressor can consume in watts.
  • c_vol (Array, default=[ 0.5017699260096695, 0.20971734265244935, -0.003471916297145014, -0.4859645588775612, -0.48736361168824505, 0.03212756255276267]): Volume coefficients, dimensionless.
  • c_pow (Array, default=[-0.26687347217418095, 34.55656142435249, 3.2225853695000795, 0.0015410753190719896, 1.0000837990733853]): Power coefficients, dimensionless.
  • zFw (Float, default=0.92): The wetness fraction, dimensionless.
  • scP (Float, default=1e-6): The pressure scale factor, dimensionless.
  • scCF (Float, default=1e-1): The correction factor scale, dimensionless.
  • scVdot (Float, default=1e5): The volumetric flow rate scale factor, dimensionless.
  • kwargs (optional): Additional keyword arguments.

Defines a typical compressor model.

Sub-systems:

  • input = RealInput()`
  • port_a::TwoPhaseFluidPort
  • port_b::TwoPhaseFluidPort
  • state_a::ThermodynamicState
  • state_b::ThermodynamicState

States (22):

  • speed(t) (Float): Speed of the compressor in rpm.
  • m_flow_comp(t) (Float): Mass flow rate through the compressor in kg/s.
  • hDischarge(t) (Float): Discharge enthalpy in J/kg.
  • eta_v(t) (Float): Volumetric efficiency, dimensionless.
  • eta_therm(t) (Float): Thermal efficiency, dimensionless.
  • eta_is_eff(t) (Float): Isentropic efficiency, dimensionless.
  • dp(t) (Float): Pressure difference across the compressor in Pa.
  • pRat(t) (Float): Pressure ratio across the compressor, dimensionless.
  • dSuction(t`julia dSuction(t) (Float): Suction diameter in m.
  • dDischarge(t) (Float): Discharge diameter in m.
  • Vdot(t) (Float): Volumetric flow rate in m³/s.
  • Qdot(t) (Float): Heat flow rate in W.
  • Pdot(t) (Float): Power consumption in W.
  • T_a(t) (Float): Temperature at port_a in K.
  • T_b(t) (Float): Temperature at port_b in K.
  • p_a(t) (Float): Pressure at port_a in Pa.
  • p_b(t) (Float): Pressure at port_b in Pa.
  • h_a(t) (Float): Enthalpy at port_a in J/kg.
  • h_b(t) (Float): Enthalpy at port_b in J/kg.
  • rho_a(t) (Float): Density at port_a in kg/m³.
  • rho_b(t) (Float): Density at port_b in kg/m³.
  • x_a(t) (Float): Vapor quality at port_a, dimensionless.
  • x_b(t) (Float): Vapor quality at port_b, dimensionless.

Returns: ODESystem

source
HVAC.TypicalCompressorInitMethod
TypicalCompressorInit(
;
    P_a_start,
    P_b_start,
    m_flow_start,
    speed_start,
    hSuction_start,
    hDischarge_start
) -> NamedTuple{(:P_a_start, :P_b_start, :m_flow_start, :speed_start, :hSuction_start, :hDischarge_start, :dp_start), Tuple{Float64, Float64, Float64, Int64, Float64, Float64, Float64}}

Sets the initialization for the TypicalCompressor model.

Arguments:

  • P_a_start (Float, default=1e6): The starting pressure at port_a in Pa.
  • P_b_start (Float, default=3e6): The starting pressure at port_b in Pa.
  • m_flow_start (Float, default=0.01): The starting mass flow rate in kg/s.
  • speed_start (Float, default=50): The starting speed in rpm.
  • hSuction_start (Float, default=430e3): The starting suction enthalpy in J/kg.
  • hDischarge_start (Float, default=520e3): The starting discharge enthalpy in J/kg.
source
HVAC.TypicalLEVMethod

function TypicalLEV(;name, dpsmall=100, NTheta=3, NThresh=3, theta=[1e-3, 5e-5, 3e-4], thresh=[30, 300, 450], xt=10, useyd0 = false, yd0=1, init=nothing ) Defines a simple isenthalpic expansion valve component. The orifice area of the valve is controlled using the `uininput signal using a correlation given by the [CvLookup](@ref) function. ArgumentsNTheta,NThresh,theta,threshare passed toCvLookup.mflow> 0.0 implies that mass is flowing intoporta` of the valve

Arguments:

  • name (String): The name identifier for the expansion valve.
  • dp_small (Float, default=100): The small pressure drop in Pa.
  • NTheta (Integer, default=3): The number of theta parameters.
  • NThresh (Integer, default=3): The number of threshold parameters.
  • theta (Array, default=[1e-3, 5e-5, 3e-4]): The theta parameters, dimensionless.
  • thresh (Array, default=[30, 300, 450]): The threshold parameters, dimensionless.
  • x_t (Integer, default=10): The exponent for the CvLookup function.
  • use_yd0 (Boolean, default=false): Flag to use initial yd0 value.
  • yd0 (Float, default=1): The initial yd0 value.
  • init (Initialization): The initialization parameters for the valve.

Sub-systems (6 states, 0 equations):

  • port_a::TwoPhaseFluidPort
  • port_b::TwoPhaseFluidPort

States (6):

  • u_in Position of the valve (determined from control signal)
  • m_flow [kg/s] Mass flow rate into the valve
  • rho [kg/m³] Density of fluid inside valve.
  • rho_a [kg/m³] Density of fluid at port_a (for flow into valve i.e., where m_flow > 0)
  • rho_b [kg/m³] Density of fluid at port_b (for flow into valve i.e., where m_flow > 0)
  • dp [Pa] Pressure drop across valve

Parameters:

ZCv: Correction factor for correlation model between mass flow and pressure drop

Equations (9):

Returns: ODESystem composed of 2 sub systems.

source
HVAC.TypicalLEVInitMethod
TypicalLEVInit(
;
    P_a_start,
    P_b_start,
    m_flow_start,
    LEV_position_start,
    h_in_start,
    h_out_start
) -> NamedTuple{(:P_a_start, :P_b_start, :m_flow_start, :LEV_position_start, :h_in_start, :h_out_start, :dp_start, :rho_start), _A} where _A<:Tuple{Float64, Float64, Float64, Int64, Float64, Float64, Float64, Any}

Named tuple holding the initial conditions of a typical linear expansion valve (LEV).

Arguments:

(; P_a_start, P_b_start, m_flow_start, LEV_position_start, h_in_start, h_out_start) where:

  • P_a_start: Initial pressure at point 'a' (defaults to 2.5e6 [Pa]).
  • P_b_start: Initial pressure at point 'b' (defaults to 1e6 [Pa]).
  • m_flow_start: Initial mass flow rate (defaults to 1e-3 [kg/s]).
  • LEV_position_start: Initial position of the LEV (defaults to 300 [mm]).
  • h_in_start: Refrigerant side initial enthalpy at inlet (defaults to 230e3 [J/kg]). Defaults are hard-coded to R32.
  • h_out_start: Refrigerant side initial enthalpy at outlet (defaults to 230e3 [J/kg]). Defaults are hard-coded to R32.

Returns:

A named tuple containing the initial conditions of a typical linear expansion valve (LEV). The named tuple also includes:

  • dp_start: Initial pressure difference (equals to Pastart - Pbstart [Pa]).
  • rho_start: Initial density, determined based on the mass flow rate. If the mass flow rate is greater than or equal to 0, rho_start equals rho_a, otherwise rho_start equals rho_b.
source
HVAC.VolumeFlowSource_TMethod
VolumeFlowSource_T(
;
    name,
    T_in,
    v_flow_in,
    P_start,
    use_input
)

Works with the DryAir medium. Defines a boundary component that provides a fixed volume flow v_flow_in of fluid at a given temperature T_in. v_flow_in > 0 if the fluid flows into the component connected to port,

Sub-systems (6 undefined states):

  • port::SingleComponentFluidPort
  • state::ThermodynamicState

Parameters (3):

  • T_in: Specified temperature [K], default 293
  • v_flow_in: Volume flow [m^3/s] default 0.01

States (4):

  • P: Pressure [Pa]
  • h: Specific enthalpy [J/kg]
  • d: Density [kg/m^3]

Equations (10)

Required Connections/Extensions:

  • P (may be defined using KVL, using a connect statement with another SingleComponentFluidPort)

Returns:

ODESystem composed of the 1 subsystem.

source
HVAC.VolumeFlowSource_TϕMethod
VolumeFlowSource_Tϕ(
;
    name,
    T_in,
    ϕ_in,
    v_flow_in,
    P_start,
    use_input
)

Works with the MoistAir medium. Defines a boundary component that provides a fixed volume flow v_flow_in of fluid at a given temperature T_in, and given moisture fraction ϕ_in. v_flow_in > 0 if the fluid flows into the component connected to port,

Sub-systems (6 undefined states):

  • port::MultiComponentFluidPort
  • state::ThermodynamicState

Parameters (3):

  • T_in: Specified temperature [K], default 293
  • ϕ_in: Specified moisture fraction, default 0.5
  • v_flow_in: Volume flow [m^3/s] default 0.01

States (4):

  • P: Pressure [Pa]
  • h: Specific enthalpy [J/kg]
  • d: Density [kg/m^3]
  • Xi: Moisture fraction

Equations (10)

Required Connections/Extensions:

  • P (may be defined using KVL, using a connect statement with another MultiComponentFluidPort)

Returns:

ODESystem composed of the 1 subsystem.

source
HVAC.plot_compMethod
`plot_comp(name::Symbol, comp, nNodes, sol; display = false)`. For condensers and evaporators of type `StraightPipe`
Returns: `(;m_flows_plot, q_flows_plot, T_plot, h_plot, p_plot, ρ_plot, xq_plot)`

`plot_comp(name::Symbol, comp, sol; display = false)`
Returns: `(; m_flows_plot, h_flows_plot, p_plot)`

Plots component comp::ODESystem of name name::Symbol

source