fan
Modules
fan_torch_system module
- class FanTorchSystem(nominalPowerRate=None, nominalAirFlowRate=None, c1=None, c2=None, c3=None, c4=None, f_total=None, **kwargs)[source]
Bases:
System,ModuleA fan system model implemented with PyTorch for gradient-based optimization.
This model represents a fan that controls air flow rate and temperature, considering both the power consumption and the heat added to the air stream.
- Parameters:
nominalPowerRate (
Optional[float]) – Nominal power rate [W]nominalAirFlowRate (
Optional[float]) – Nominal air flow rate [m³/s]c1 (
Optional[float]) – Constant term in power polynomialc2 (
Optional[float]) – Linear term coefficient in power polynomialc3 (
Optional[float]) – Quadratic term coefficient in power polynomialc4 (
Optional[float]) – Cubic term coefficient in power polynomialf_total (
Optional[float]) – Total fan efficiency factor (0-1)
Mathematical Formulation
The fan power is calculated using a polynomial equation:
\[P = P_{nom} \cdot \left(c_1 + c_2\frac{\dot{m}}{\dot{m}_{nom}} + c_3\left(\frac{\dot{m}}{\dot{m}_{nom}}\right)^2 + c_4\left(\frac{\dot{m}}{\dot{m}_{nom}}\right)^3\right)\]- where:
\(P\) is the fan power [W]
\(P_{nom}\) is the nominal power [W]
\(\dot{m}\) is the air mass flow rate [kg/s]
\(\dot{m}_{nom}\) is the nominal air mass flow rate [kg/s]
\(c_1\) to \(c_4\) are polynomial coefficients that can be calibrated
The outlet air temperature is calculated considering the heat added by the fan:
\[T_{out} = T_{in} + \frac{P \cdot f_{total}}{\dot{m} \cdot c_p}\]- where:
\(T_{out}\) is the outlet temperature [°C]
\(T_{in}\) is the inlet temperature [°C]
\(f_{total}\) is the fraction of power that is converted to heat and added to the air stream
\(c_p\) is the specific heat capacity of air [J/(kg·K)]
Notes
- Model Assumptions:
Fan power follows polynomial relationship with flow rate
All heat from fan power is added to air stream
Constant air density and specific heat capacity
No mechanical losses considered separately
- Implementation Details:
Uses PyTorch for gradient-based optimization
Parameters are stored as trainable PyTorch parameters
Includes safety checks for numerical stability
All calculations performed in SI units
- do_step(secondTime, dateTime, step_size, stepIndex)[source]
Perform one step of the fan system simulation.
The fan power is calculated using a polynomial equation: P = P_nom * (c1 + c2*(m/m_nom) + c3*(m/m_nom)^2 + c4*(m/m_nom)^3) where: - P is the fan power - P_nom is the nominal power - m is the air flow rate - m_nom is the nominal air flow rate - c1-c4 are polynomial coefficients
The outlet air temperature is calculated considering the heat added by the fan: T_out = T_in + (P * f_total) / (m * c_p) where: - T_out is the outlet temperature - T_in is the inlet temperature - f_total is the total fan efficiency - c_p is the specific heat capacity of air
- Return type:
None
- initialize(start_time, end_time, step_size, simulator)[source]
Initialize the fan system.
- Return type:
None
- property config
Get the configuration of the fan system.
- property input: dict
Get the input ports of the fan system.
- Returns:
- Dictionary containing input ports:
”airFlowRate”: Air flow rate [m³/s]
”inletAirTemperature”: Inlet air temperature [°C]
- Return type:
dict
- property output: dict
Get the output ports of the fan system.
- Returns:
- Dictionary containing output ports:
”outletAirTemperature”: Outlet air temperature [°C]
”Power”: Fan power consumption [W]
- Return type:
dict