coil
Package
Modules
coil_torch_system module
- class CoilTorchSystem(**kwargs)[source]
Bases:
System,ModuleA coil system model implemented with PyTorch for gradient-based optimization.
This model represents a heating/cooling coil that transfers heat between air and water, calculating the required heating or cooling power based on air flow rate and temperature differences.
Mathematical Formulation
The heating/cooling power is calculated using the following equations:
For heating mode (when \(T_{in} < T_{out,set}\)):
\[P_{heat} = \dot{m}_{air} \cdot c_{p,air} \cdot (T_{out,set} - T_{in})\]\[P_{cool} = 0\]For cooling mode (when \(T_{in} \geq T_{out,set}\)):
\[P_{heat} = 0\]\[P_{cool} = \dot{m}_{air} \cdot c_{p,air} \cdot (T_{in} - T_{out,set})\]- where:
\(P_{heat}\) is the heating power [W]
\(P_{cool}\) is the cooling power [W]
\(\dot{m}_{air}\) is the air flow rate [kg/s]
\(c_{p,air}\) is the specific heat capacity of air [J/(kg·K)]
\(T_{in}\) is the inlet air temperature [°C]
\(T_{out,set}\) is the outlet air temperature setpoint [°C]
Notes
- Model Assumptions:
Perfect heat transfer (outlet temperature equals setpoint)
Constant specific heat capacity of air
No heat losses to the environment
No water-side calculations (focus on air-side performance)
- Implementation Details:
If air flow rate is below threshold (1e-5 kg/s), both heating and cooling powers are set to zero
The model uses PyTorch tensors for gradient-based optimization
All calculations are performed in SI units
The specific heat capacity is stored as a non-trainable PyTorch parameter
- do_step(secondTime, dateTime, step_size, stepIndex)[source]
Perform one step of the coil system simulation.
The model calculates heating/cooling power based on: - Air flow rate - Inlet air temperature - Outlet air temperature setpoint
If the air flow rate is zero, the output power is set to 0.
- Return type:
None
- initialize(start_time, end_time, step_size, simulator)[source]
Initialize the coil system.
- Return type:
None
- property config
Get the configuration of the coil system.
- property input: dict
Get the input ports of the coil system.
- Returns:
- Dictionary containing input ports:
”inletAirTemperature”: Inlet air temperature [°C]
”outletAirTemperatureSetpoint”: Outlet air temperature setpoint [°C]
”airFlowRate”: Air flow rate [kg/s]
- Return type:
dict
- property output: dict
Get the output ports of the coil system.
- Returns:
- Dictionary containing output ports:
”heatingPower”: Heating power [W]
”coolingPower”: Cooling power [W]
”outletAirTemperature”: Outlet air temperature [°C]
- Return type:
dict