optivgi.scm.algorithm¶
Defines the abstract base class for Smart Charging Management (SCM) algorithms.
All specific charging optimization algorithms within Opti-VGI should inherit from the Algorithm class defined here and implement the calculate method.
- class optivgi.scm.algorithm.Algorithm(evs, peak_power_demand, now)¶
Bases:
ABC
Abstract Base Class for SCM Optimization Algorithms.
Provides a common interface and initialization for different charging strategies.
- peak_power_demand¶
A list representing the maximum allowed aggregate power for each time step over the planning horizon. The length must match AlgorithmConstants.TIMESTEPS.
- now¶
The reference start time for the scheduling calculation.
- Type:
datetime
- abstractmethod calculate()¶
Executes the core logic of the charging algorithm.
Implementations of this method should determine the power allocation for each EV over the planning horizon (filling the ev.power list for each EV in self.evs).
- Return type:
- get_current_power(unit=None)¶
Generates charging profiles containing only the power for the current time step.
This is useful for systems that only need the immediate power setting rather than the full future plan. It calls ev.current_charging_profile for each EV.
- Parameters:
unit (
Optional
[ChargingRateUnit
]) – The desired charging rate unit (W or A) for the output profiles. If None, the unit from the EV object is used.- Returns:
dict
[EV
,dict
] – A dictionary where keys are EV objects and values are their charging profiles formatted for the current time step.
- get_charging_profiles(unit=None)¶
Generates the full charging profiles for all EVs over the planning horizon.
This method compiles the results of the calculate method into a format suitable for sending to the external system (e.g., via the Translation layer). It calls ev.charging_profile for each EV.
- Parameters:
unit (
Optional
[ChargingRateUnit
]) – The desired charging rate unit (W or A) for the output profiles. If None, the unit from the EV object is used.- Returns:
dict
[EV
,dict
] – A dictionary where keys are EV objects and values are their complete charging profiles over the planning horizon.
- get_total_energy_charged()¶
Calculates the total energy scheduled to be delivered to each EV.
Sums the energy delivered in each time step based on the calculated power profile. It calls ev.energy_charged() for each EV.