Architecture Overview¶
Opti-VGI is designed with a modular architecture to separate concerns:
Core Components¶
Translation Layer (`optivgi.translation`): Defines the interface (Translation abstract class) for communication with external systems (like a CSMS). Concrete implementations handle fetching EV data, power constraints, and sending charging commands.
SCM Runner (`optivgi.scm_runner`): Orchestrates the main scheduling logic. It uses a Translation implementation to get inputs, passes them to an Algorithm implementation, and sends the results back via the Translation layer.
SCM Algorithm (`optivgi.scm.algorithm`): Defines the interface (Algorithm abstract class) for different charging optimization strategies. Concrete implementations (PulpNumericalAlgorithm, GoAlgorithm) contain the core optimization logic.
EV Data Structure (`optivgi.scm.ev`): Defines the EV dataclass used throughout the system to represent electric vehicles and their charging parameters/state.
Worker Threads (`optivgi.threads`): Provides helper functions (timer_thread_worker, scm_worker) to run the SCM logic periodically or in response to events in background threads.
Utilities (`optivgi.utils`): Contains helper functions, like date/time rounding.
Execution Flow¶
An event (e.g., timer, external trigger due to new reservation) is placed on a queue.
The scm_worker thread picks up the event.
It instantiates the configured Translation and Algorithm classes.
It calls scm_runner, passing the translation and algorithm classes.
scm_runner uses the Translation object to: * Get EV data (get_evs). * Get power constraints (get_peak_power_demand).
scm_runner instantiates the Algorithm with the fetched data.
It calls the algorithm’s calculate method to determine charging schedules.
It retrieves the charging profiles (get_charging_profiles).
It uses the Translation object to send the profiles to the external system (send_power_to_evs).