This repository hosts the backend for a Photovoltaic Emulator hardware device, which was designed as part of the final year undergraduate project at the University of Moratuwa.
The design of the software is modular, ensuring each unit can be individually developed, tested, and reused. We've built this entire system on a foundation of open-source technologies.
- Function: Enables photovoltaic module parameter extraction, handles serial communication with the hardware (Microcontroller Unit), and exposes an API for the UI and dashboard.
- Technology Stack:
Python
+Flask
.
The backend (this repository) is a Python web API implemented using the Flask web microframework. The choice of Python is due to its robust scientific computing libraries needed for parameter extraction. The backend is divided into three components:
- Flask API: Provides the interface for frontend communication and overseeing PV model and emulator operations.
- PV Model and Algorithms: Parameter calculations, heavily reliant on the
SciPy
andNumPy
libraries for various mathematical implementations. - Hardware Interface: Hardware management and communication, delivering a real-time data display. Uses Python serial library for serial communications with the hardware. Interactions with the dashboard are done through the Python client for Influx DB.
- Repository Link: https://github.com/sathira10/pv-emulator-backend
- Function: Accepts user-input of pv module data, displays calculated SDM parameters, and triggers hardware emulation.
- Technology Stack:
JavaScript
+React
(Next.js
).
- Function: Provides a real-time display of crucial parameters, including voltage, current, and reference voltage.
- Technology Stack:
Influx DB
+Grafana
.
Note: If you're using Windows, you might need to adjust some commands. (environment variables and virtual environment activation)
-
Clone the repository:
git clone https://github.com/sathira10/pv-emulator-backend.git cd pv-emulator-backend
-
(Optional) Create a virtual environment:
virtualenv venv source venv/bin/activate
-
Install the required packages:
pip install -r requirements.txt
-
Run the Flask application:
export FLASK_APP=app/app.py export FLASK_ENV=development flask run
This will start the Flask API on the default port (usually 5000) and in development mode.
-
Test the API
Access the backend API at http://127.0.0.1:5000. If everything is set up correctly, you should see a message saying that the API is online.
If the backend API is active and online, you can seamlessly integrate it with the frontend UI available here. This will ebable youto interract with the API and Calculate parameters and curves for the single diode model for any given PV module.
Note that only the pvmodel
functionality will be accessible through this interface. The emulator
section requires the physical hardware device.
However, this setup provides a comprehensive platform for PV module parameter extraction.
- Sathira Tennakoon
- Imasha Balahewa
- Hasitha Umayanga
For a detailed dive into the project, you can read our published paper on IEEE Xplore.