citylearn.internal.physics_invariants module

class citylearn.internal.physics_invariants.CityLearnPhysicsInvariantService(env: CityLearnEnv)[source]

Bases: object

Runtime physics/assertion checks evaluated per control step.

ENERGY_EPS = 0.0005
SOC_EPS = 0.0001
assert_step_invariants(time_step: int)[source]

Raise AssertionError if hard physics invariants are violated.

capture_battery_energy_before_actions(time_step: int)[source]

Snapshot actual SOC after arrivals/losses and before control actions.

Do not read energy_init: the independent check must detect a model that silently replaces measured energy with its operational reserve.