This repository holds the code for Chargify, focused on machine learning based EV charge scheduling. This project started in the AI in Practice course together with Porsche Digital.
Module Name | Folder | Description |
---|---|---|
Model related | model | Code related to training the different models. |
Model results | model_results | The weights and checkpoints of the trained models. |
Frontend | frontend | Code for the frontend. |
API | api | The backend API code. |
Experimental Notebooks | experiments | Experiments we did during development. |
Experimental Data | data | Experimental data we used during development. |
We use a local MongoDB as database.
docker run --name chargify -d -p 27017:27017 mongo
Import a sample dataset to mongodb:
docker exec -i chargify /usr/bin/mongorestore --uri "mongodb://localhost:27017" --archive < api/mongodb.dump
With this import the database is set up to hold a test user called chargify, which can be used in the frontend.
It is recommended to run the backend in a virtual environment.
In the project root, run to create the conda environment and install all required packages.
conda env create -f environment.yml && conda activate aip-porsche
To start the backend API, move into the api directory (cd api/app
) and run
python -m uvicorn main:app --host=0.0.0.0
As soon as the backend is running you can add your own user. Therefore, visit http://localhost:8000/docs and scroll down to the endpoint POST /user. Past the following body into the request body field (replace the name with your desired username) and execute the request.
{
"name": "your-user-name",
"carModelId": "porsche-taycan-4s-performance-battery-plus"
}
NOTE: The frontend supports Firefox and Chrome. Using Safari might lead to problems.
Move into the frontend folder
cd frontend
Install the required packages
npm install
Start the local frontend
npm start
This repository provides an already trained model to predict the future energy mix in the grid seven days in advance.
The default model used can be found in model_results/lstm
, which was trained in January 2024.
If you want to retrain the model, go through the following steps.
It's recommended to use mamba
to manage dependencies. mamba
is a drop-in replacement for conda
re-written in C++ to speed things up significantly (you can stick with conda
though).
Installing mamba
On Unix-like platforms, run the snippet below. Otherwise, visit the mambaforge repo. Note this does not use the Anaconda installer, which reduces bloat.
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh
After having installed mamba
, you can create a mamba
environment from the environment_model.yml
with all necessary dependencies installed. Alternatively, you can use conda (the commands stay the same only replace mamba with conda).
mamba env create -f environment_model.yml
You can then activate your environment with
mamba activate chargify-model
Working together with many people in a shared environment requires caution.
If you want to add a dependency to the environment.yml
, install the dependency locally and test that there are no conflicts with the existing environment.
Then open a pull request with an updated environment.yml
to ensure that all collaborators can reproduce the environment.
Chargify is openly developed in the wild and contributions (both internal and external) are highly appreciated. See CONTRIBUTING.md on how to get started.
If you have feedback or want to propose a new feature, please open an issue. Thank you! 😊
This project is a joint initiative of Porsche AG, Porsche Digital and the Hasso Plattner Institute (Seminar: AI in Practice). ✨
Copyright © 2023 Dr. Ing. h.c. F. Porsche AG
Dr. Ing. h.c. F. Porsche AG publishes this open source software and accompanied documentation (if any) subject to the terms of the MIT license. All rights not explicitly granted to you under the MIT license remain the sole and exclusive property of Dr. Ing. h.c. F. Porsche AG.
Apart from the software and documentation described above, the texts, images, graphics, animations, video and audio files as well as all other contents on this website are subject to the legal provisions of copyright law and, where applicable, other intellectual property rights. The aforementioned proprietary content of this website may not be duplicated, distributed, reproduced, made publicly accessible or otherwise used without the prior consent of the right holder.