This is a master's degree project that was developed for the Distributed and Pervasive Systems course (A.Y 2024/25).
The DESM (Distributed Energy Supply Management) project simulates a renewable energy supply networkRepository. A renewable energy provider generates power from sources like wind, hydro, and solar. When renewable energy alone can't meet demand, the provider relies on a networkRepository of thermal power plants to cover the shortfall.
These thermal plants compete to fulfill energy requests, with the lowest bidder winning the assignment. An administration server manages the registration/removement of thermal plants and collects environmental data, such as pollutant emissions, from their sensors. This data is periodically sent to the server, which an administration client can query for statistics.
For sake of simplicity and ease of development, this project is structured as a Gradle multi-module project, rather than a full-fledged microservices architecture, even though it comprises distinct logical services. The main goal of the project is focused on inter-process communication and application of algorithms for distributed systems.
This entity represents the source of energy demand in the system. It initiates energy production requests when renewable sources are insufficient, transmitting this data to the Network Thermal Power Plants through MQTT.
This is the core distributed component, a networkRepository of interconnected Thermal Power Plant Peers operating in a ring topology. Each peer is an independent node responsible for:
- Network Management: Manage the ring structure, maintaining an up-to-date local view of the ring topology.
- Election Manager: Manage the elections for the incoming energy request that have to be fulfilled using the adapted Chang-Roberts algorithm.
- Pollution Monitoring: Collecting CO2 emission data and periodically transmitting this data to the Administration Server through MQTT, processed using a sliding window mechanism.
A REST server that dynamically adds/removes power plants to DESM and allows the administration client to see the currently active plants in the networkRepository and to compute statistics about pollution levels.
A client cli that allows querying the administration server to obtain information about the currently active thermal power plants in the networkRepository and their emissions.
To set up and run the DESM project, follow these steps:
- Java Development Kit: Version 17 or higher.
- MQTT Broker: An MQTT broker (e.g. Mosquitto, HiveMQ Community Edition) must be running and accessible. The system defaults to
tcp://localhost:1883.
-
Clone the Repository: First, clone the project repository to your local machine:
git clone https://github.com/Luca-02/desm.git
-
Clean and Build: Navigate to the root directory of the cloned repository and perform a clean build for all subprojects:
cd desm ./gradlew clean build
Ensure your MQTT broker is running before proceeding. You should start the components in the following order: Administration Server, Administration Client, then the Power Plant Peers, and finally, the Renewable Energy Provider.
-
Administration Server: Navigate to the
desm-serverdirectory and run the server application:cd .\desm-server\ ../gradlew run --console=plain
-
Administration Client: Navigate to the
desm-clientdirectory, and run the client application to interact with the Administration Server:cd .\desm-client\ ../gradlew run --console=plain
-
Power Plant Peers: Open a new terminal windows for each power plant peer you want to run. Navigate to the
desm-networkRepositorydirectory and run the application. Each instance will represent a single power plant:cd .\desm-networkRepository\ ../gradlew run --console=plain
-
Renewable Energy Provider: Navigate to the
desm-providerdirectory and run the renewable energy provider application to generate energy requests:cd .\desm-provider\ ../gradlew run --console=plain
- Java: Core programming language for all components.
- Gradle: For project build automation.
- Eclipse Paho MQTT Client: For MQTT communication.
- gRPC: For RPC communication between networkRepository peers.
- Spring Boot: Framework for developing the Administration Server.
- RESTful APIs: For client-server communication.
- Gson: For JSON serialization/deserialization across components.
- JUnit 5: For unit and integration testing.
