citylearn.internal.units module

Unit conversion helpers shared by runtime services.

citylearn.internal.units.energy_kwh_to_power_kw(energy_kwh: float, seconds_per_time_step: float) float[source]

Convert control-step energy in kWh to average power in kW.

citylearn.internal.units.normalized_capacity_action_to_energy_kwh(action: float, capacity_kwh: float, *, seconds_per_time_step: float | None = None, scale_with_time: bool = False) float[source]

Convert a normalized capacity action to control-step energy in kWh.

citylearn.internal.units.normalized_power_action_to_energy_kwh(action: float, nominal_power_kw: float, seconds_per_time_step: float) float[source]

Convert a normalized power action to control-step energy in kWh.

citylearn.internal.units.power_kw_to_energy_kwh(power_kw: float, seconds_per_time_step: float) float[source]

Convert power in kW to control-step energy in kWh.

citylearn.internal.units.seconds_to_hours(seconds_per_time_step: float) float[source]

Convert a control-step duration in seconds to hours.

citylearn.internal.units.to_dataset_resolution_energy(energy_kwh: float, time_step_ratio: float | None) float[source]

Convert control-step energy to dataset-resolution energy when needed.