Caution
This software is experimental and subject to change.
This project is a Rust library for real-time phasor analytics. It provides a python interface for processing and accumulating IEEE C37.118 synchrophasor data into an in-memory arrow table. The core libraries found in the Rust code can also be used independently for other downstream applications.
- Efficient Data Processing: RTPA is designed to handle large volumes of synchrophasor data efficiently, ensuring minimal latency and high throughput.
- Real-time Analysis: RTPA can perform real-time analysis on incoming data streams, enabling immediate response to changes in the power grid.
- Automatic Phasor Data Conversion: RTPA optionally converts incoming synchrophasor data into Polar or Rectangular format if desired.
Clone the entire repo
git clone https://github.com/G-PST/pmu-data-analytics.git
Running the CLI using cargo:
cargo run --help
It is recommended to create a virtual environment to install dependencies for building the RTPA python module.
python3 -m venv venv
source venv/bin/activate
- On Windows:
.venv\Scripts\activate
- On Linux or macOS:
source .venv/bin/activate
Next install the dependencies required to compile the Rust code into a python module.
pip install maturin patchelf
Navigate to the py directory and build+install the python wheel.
cd py
Build and install the wheel into your activated virtual environment.
maturin develop
To build a release wheel. (This will create a wheel file in the RTPA-core/target/wheels directory)
maturin build --release
To test, build and start the mock pdc using the following command.
cargo run mock-pdc
Then test the rtpa module, which points to the running mock pdc server above. It will wait and fill the buffer with data before returning a dataframe result.
python test_openpdc.py --host 127.0.0.1 --port 8123
To facilitate testing and development of synchrophasor data processing, you can run either a mock PDC server using a Rust-based tool or an openPDC
container using Docker. Below are simple instructions for setting up and running these services.
If you prefer a lightweight mock server for testing purposes, you can use the mock PDC provided by the Rust package. This option does not require Docker and runs directly on your system.
- Ensure you have Rust and Cargo installed. If not, follow the installation instructions at https://www.rust-lang.org/tools/install.
- Open a terminal or command prompt.
- Run the following command to start the mock PDC server:
Run the mock-pdc with variable number of PMUs. (Max of ~130 PMUs) If --num-pmus not given, the mock-pdc will send repeated copies of the IEEE example data frame, with updated timestamps.
cargo run mock-pdc --num-pmus=100
This will start the mock PDC server on 127.0.0.1:8123
. If you need to run it in the background, you can append &
on Linux/macOS or use a tool like start
on Windows.
To stop the server, simply press Ctrl+C
in the terminal where it's running, or if it's in the background, find and kill the process.
The openPDC
container provides a fully functional Phasor Data Concentrator (PDC) server. This option uses Docker to run the containerized application.
- Open a terminal or command prompt.
- Run the following command to pull and start the
openPDC
container in detached mode (this runs it in the background and prevents terminal spam):
docker run -d --name openPDC -p 8280:8280 -p 8900:8900 gridprotectionalliance/openpdc:v2.9.148
This will download the image (if not already present) and start the container, making it accessible on ports 8280
and 8900
on your local machine.
Visit the dockerhub page for more information about the latest releases.
To stop and remove the container, run:
docker stop openPDC && docker rm openPDC
If you don't have Docker installed on your system, follow the appropriate link below for installation instructions:
- Windows: Install Docker Desktop on Windows
- macOS: Install Docker Desktop on Mac
- Linux: Install Docker Engine on Linux
Docker Desktop (for Windows and macOS) or Docker Engine (for Linux) will provide the necessary tools to run containers on your machine.
Once either the mock PDC server or the openPDC
container is running, you can execute the Python script to connect and process data:
- Ensure your Python environment is set up with the required dependencies (e.g., the
rtpa
package. See Building The Python Module above). - Run the script with:
python test_openpdc.py
If you're connecting to the openPDC
container instead of the mock server, modify the connection details in test_openpdc.py
to point to 127.0.0.1:8900
(as shown in the commented-out line in the script).
You can log in to the local openPDC instance and update the configuration. The default username and password are.
USER
.\admin
PASSWORD
admin
You can also install the latest release of openPDC with more features here
Another option for Windows users is to install the PMU Connection Tester found here. Users will need to read the documentation for the PMU Connection Tester to understand how to use it effectively.