A multi-agent system for the automation of configuration and simulation of photovoltaic grid-connected systems
The project is organized into the following directories:
- Frontend. Web application constructed with React, which lets the user design and visualize the Smart Grid behavior and the energy transactions between the grid buildings.
- Backend. Backend API responsible for the roof-top PV panel fitting algorithm, for the PV energy inference module and for the data persistence among other things.
- Multiagent. REST API which launches the multiagent systems that simulate the energy distribution between the buildings which conforms a Smart Grid.
- Python 3, 3.8.10
- Pip, 20.2.4
- Node, 12.18.2
- Npm, 6.14.8
- Java 8, 1.8 (OpenJDK 8 or JAVA SE 8)
- Apache Maven 3.6.3
First, it is necessary to clone the repository.
git clone --recursive https://github.com/EnriqueCepeda/TFG-EnriqueCepeda.git
Afterwards, in the Backend directory, there is a requirements file containing all the dependencies with their version number. These are meant to be installed in an isolated virtual environment using Python v3.8.10, however, they can also be installed in the default Python interpreter. In order to install the dependencies, the user must navigate to the backend directory and execute the following commands:
pip install -r requirements.txt
pip install -e ./lib/pvlib-python/.\[all\]
P.S: Python and pip must be installed first
Regarding the Frontend application, the dependencies are also isolated, but instead of installing them with pip package manager, npm must be employed. So, the user must navigate to the frontend directory and run:
npm install
P.S: Node Js and npm must be installed first
Regarding the multiagent system, the installation of certain packages and dependencies is needed. For that, maven is used. To install the dependencies, the user must navigate to the multiagent folder and run the following command:
mvn install
mvn dependency:copy-dependencies
P.S: Maven and Java must be installed first
Afterwards, set the GOOGLE_MAPS_APIKEY environment variable in your system using the provided value by e-mail. Also add the following environment variables for the multiagent system to work properly:
PROJECT_FOLDER="{path_to_repo}/TFG/multiagent"
CLASSPATH="$PROJECT_FOLDER/lib/*:$PROJECT_FOLDER/target/classes:$PROJECT_FOLDER/target/dependency/*"
P.S: The way in which the environment variables are introduced may vary depending on the system, in this case, it was done on an Ubuntu 21.10 machine using zsh shell. The dollar sign ($) references other variable value, and the colon divides one value from another. If you have not received the api key, please contact me.
To use the application, first is necessary to activate the JADE Agent Platform and the Spring-boot server. To activate the Agent Platform, the user must navigate to the multiagent folder and run the following command:
java jade.Boot -name -SmartGrid -gui
To run the Spring-boot server, the user must also be in the multiagent folder and execute the following command:
mvn spring-boot:run
To use the application, first is necessary to run the backend server, which uses uvicorn ASGI server. To run it, the user must navigate to the backend folder and execute the following command:
uvicorn api.main:app --port 8000
To run the API test suite, the user must execute the following command on the backend folder:
pytest api
Lastly, to watch the backend documentation, the user must open a web browser and navigate to http://localhost:8000/docs.
To run the application in the browser, the application needs to be constructed and minified. For that, the user must navigate to the frontend directory and must run the following command:
npm run build
To serve the application build generated by the previous command, the user must run the following command:
sudo npm install -g serve
serve -s build
Lastly, to use the application, it is necessary to open a web browser and navigate to http://localhost:5000.