unit_converters
Modules
functions module
Unit conversion and mathematical operation functions.
Mathematical Formulation:
Temperature Conversions: a) Kelvin to Celsius:
\[T_{C} = T_{K} - 273.15\]where: - \(T_{C}\) is temperature in Celsius - \(T_{K}\) is temperature in Kelvin
Celsius to Kelvin:
\[T_{K} = T_{C} + 273.15\]
Mathematical Operations: a) Multiplication by Constant:
\[y = x \cdot c\]where \(c\) is the constant factor
Regularization:
\[y = \max(x, l)\]where \(l\) is the lower limit
Addition:
\[y = \sum_{i=1}^{n} f_i(x_i)\]where \(f_i\) are conversion functions
Multiplication:
\[y = \prod_{i=1}^{n} f_i(x_i)\]Integration:
\[y(t) = y(t-\Delta t) + f(x(t)) \cdot \Delta t\]where: - \(y(t)\) is the integrated value at time t - \(\Delta t\) is the time step - \(f(x(t))\) is the conversion function
to_degC_from_degK module
- class ToDegCFromDegK[source]
Bases:
SystemSystem for converting temperature from Kelvin to Celsius.
Mathematical Formulation:
\[T_{C} = T_{K} - 273.15\]where: - \(T_{C}\) is temperature in Celsius - \(T_{K}\) is temperature in Kelvin
- do_step(secondTime=None, dateTime=None, step_size=None)[source]
Do a single step of the system.
- Parameters:
secondTime (float) – The current time in seconds.
dateTime (datetime.datetime) – The current date and time.
step_size (int) – The step size of the simulation in seconds.
stepIndex (int) – The current step index.
- initialize(start_time=None, end_time=None, step_size=None, model=None)[source]
Initialize the system.
- Parameters:
start_time (datetime.datetime) – The start time of the simulation.
end_time (datetime.datetime) – The end time of the simulation.
step_size (int) – The step size of the simulation in seconds.
simulator (core.Simulator) – The simulator.
to_degK_from_degC module
- class ToDegKFromDegC[source]
Bases:
SystemSystem for converting temperature from Celsius to Kelvin.
Mathematical Formulation:
\[T_{K} = T_{C} + 273.15\]where: - \(T_{K}\) is temperature in Kelvin - \(T_{C}\) is temperature in Celsius
- do_step(secondTime=None, dateTime=None, step_size=None)[source]
Do a single step of the system.
- Parameters:
secondTime (float) – The current time in seconds.
dateTime (datetime.datetime) – The current date and time.
step_size (int) – The step size of the simulation in seconds.
stepIndex (int) – The current step index.
- initialize(start_time=None, end_time=None, step_size=None, model=None)[source]
Initialize the system.
- Parameters:
start_time (datetime.datetime) – The start time of the simulation.
end_time (datetime.datetime) – The end time of the simulation.
step_size (int) – The step size of the simulation in seconds.
simulator (core.Simulator) – The simulator.