optivgi.scm_runner¶
Core Smart Charging Management (SCM) runner logic.
This module orchestrates the process of fetching data via the Translation layer, running the selected SCM algorithm, and sending the results back through the Translation layer.
- optivgi.scm_runner.scm_runner(translation, algorithm_cls)¶
Executes one cycle of the Smart Charging Management logic for configured groups.
This function performs the following steps for each station group defined in the STATION_GROUPS environment variable: 1. Retrieves the list of EVs (get_evs) and peak power demand (get_peak_power_demand) from the provided translation object. 2. Instantiates the specified Algorithm with the fetched data and current time. 3. Runs the algorithm’s calculate method to determine charging schedules. 4. Retrieves the calculated charging profiles using get_charging_profiles. 5. Sends the profiles back to the external system via translation.send_power_to_evs.
The current time is rounded down to the nearest algorithm resolution interval.
- Parameters:
translation (
Translation
) – An instantiated object of a class inheriting from optivgi.translation.Translation. Used for interacting with the external system.algorithm_cls (
Type
[Algorithm
]) – The class type of the SCM algorithm to use (must inherit from optivgi.scm.algorithm.Algorithm).