How m0in92/ev_sim works
Main Components
• Core Simulation Engine (EV_sim)
• Contains the simulation classes (such as EV, DriveCycle, ExternalConditions, and VehicleDynamics) along with the simulation engine logic.
• Manages the computational methods derived from Gillespie and Plett for calculating motor power and vehicle dynamics.
• Data Management
• EV and drive cycle data are stored in CSV and text files under the EV_sim/data directory.
• A separate “reference” folder stores additional vehicle parameter reference data.
• Configuration and Utilities
• The EV_sim/config directory provides necessary configuration definitions.
• Utility modules (e.g., EV_sim/utils) include helper functions for timing, constants, and getting database info.
• Graphical User Interfaces
• Tkinter-based GUIs are provided in EV_sim/tkinter_gui (and the depreciated version, EV_sim/tkinter_gui_depreciated).
• Web Application (Django)
• The django_app and django_project directories host a Django application with models, views, and templates to provide an alternative web-accessible interface.
• Testing and Examples
• The tests directory has unit tests to verify simulation correctness.
• The examples directory shows use-case scripts demonstrating how to run simulations using different EVs and drive cycles.
Relationships and Interactions
• The user (or an API consumer) will interact with the simulation engine via one of several frontends:
• For desktop GUI interactions, the Tkinter GUI interfaces since invoked by “python -m EV_sim”.
• For web interactions, the Django app serves front-end requests.
• For programmatic use, users import the EV_sim package directly.
• Each of these interfaces triggers the simulation process, which involves:
a. Instantiating core classes (EV, DriveCycle, ExternalConditions).
b. Fetching necessary data from CSV files and reference directories.
c. Running simulation logic in the VehicleDynamics (or similar) module to compute model outputs.
• Utility modules and configuration files support every stage by providing common constants, settings, and helper functionalities.
Architectural Patterns and Design Principles
• Modularity: The project is organized into self-contained modules (simulation engine, data handling, GUIs, and Django) that interact via clearly defined interfaces.
• Separation of Concerns: Data handling, computational simulation logic, and user interface code are well separated to facilitate maintainability and extensibility.
• Multi-front-end Support: The design allows for multiple UIs (Graphical desktop via Tkinter and web via Django) to invoke the same core simulation logic.
• Extensibility: Examples and tests indicate the design is structured to allow easy addition of new drive cycles, vehicle types, or even a new user interface.
Relevant Technologies, Frameworks, and Libraries
• Python as the core language.
• Tkinter for the desktop GUI.
• Django for the web application.
• CSV file processing for loading drive cycle and vehicle data.
• Standard libraries for configuration and utilities.
• Testing frameworks as shown in the tests directory.