Skip to main content

A power quality processing library for calculating parameters from waveform data

Project description

pqopen-lib

pqopen-lib is a Python library designed for advanced power system and power quality analysis. It provides tools for creating and analyzing power systems, detecting events, managing data storage, and more. Built with modularity and flexibility in mind, it supports single-phase to multi-phase systems and complies with IEC standards for power quality analysis.

Features

  • Power System Modeling: Create single-phase or multi-phase power systems with detailed phase configuration.
  • Power Quality Analysis: Perform harmonic, fluctuation, and power quality calculations in compliance with standards like IEC 61000-4-7 and IEC 61000-4-30.
  • Event Detection: Detect and classify events such as overvoltage, undervoltage, and other anomalies in real-time.
  • Data Storage and Export: Manage time-series and aggregated data with support for various storage backends like CSV, and MQTT
  • Zero-Crossing Detection: Enable accurate cycle-by-cycle processing for fundamental frequency synchronization.
  • High Performance: Efficiently handle high-resolution waveform data and sampling rates.

Installation

Ensure you have Python 3.11 or later installed. To install pqopen-lib along with its dependencies:

pip install pqopen-lib

Documentation

Detailed documentation is available for each module and function. Key modules include:

  • powersystem: Define and manage power systems and phases.
  • powerquality: Perform power quality and harmonic analyses.
  • eventdetector: Detect and analyze power events.
  • storagecontroller: Manage and export time-series and aggregated data.
  • zcd: Handle zero-crossing detection for waveform synchronization.

Use Cases

  • Education: Learn to understand how power and power quality analysis works
  • Power Quality Monitoring: Ensure compliance with power quality standards.
  • Industrial Power Systems: Monitor and analyze complex, multi-phase systems.
  • Research and Development: Use as a reference platform for power quality testing

Getting Started

Here’s a quick example to get you started:

Create a Simple Power System

import numpy as np

from pqopen.powersystem import PowerSystem
from daqopen.channelbuffer import AcqBuffer

samplerate = 10_000 # Hz
signal_duration = 1.0 # seconds

voltage_magnitude = 230.0 # Volt
current_magnitude = 10.0 # Ampere

frequency = 50.0 # Hz

# Create time signal
t = np.linspace(0,int(signal_duration),int(samplerate*signal_duration),endpoint=False)
# Create voltage signal
u = voltage_magnitude*np.sqrt(2)*np.sin(2*np.pi*t*frequency)
# Create current signal
i = current_magnitude*np.sqrt(2)*np.sin(2*np.pi*t*frequency)

# Create Channel/Buffer for input waveform
ch_t = AcqBuffer()
ch_u = AcqBuffer()
ch_i = AcqBuffer()

# Create minimal power system
my_power_system = PowerSystem(zcd_channel=ch_u,
                              input_samplerate=samplerate)

# Create power phase and append to power system
my_power_system.add_phase(u_channel=ch_u, i_channel=ch_i)

# Add data to channels (we can apply all data at once because the 
# buffer is big enough to hold the test dataset)
ch_t.put_data(t)
ch_u.put_data(u)
ch_i.put_data(i)

# Perform calculation
my_power_system.process()

# View the results
for ch_name, ch_buffer in my_power_system.output_channels.items():
    print(f"{ch_name:<14} {ch_buffer.last_sample_value:.2f} {ch_buffer.unit}")

Contributing

Contributions are welcome! Please open issues for bugs or feature requests and submit pull requests for improvements.

  1. Fork the repository.
  2. Create your feature branch (git checkout -b feature/my-feature).
  3. Commit your changes (git commit -m 'Add my feature').
  4. Push to the branch (git push origin feature/my-feature).
  5. Open a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.


For any questions or support, feel free to reach out via the issues page or contact me michael@daqopen.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pqopen_lib-0.4.2.tar.gz (33.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pqopen_lib-0.4.2-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file pqopen_lib-0.4.2.tar.gz.

File metadata

  • Download URL: pqopen_lib-0.4.2.tar.gz
  • Upload date:
  • Size: 33.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.2

File hashes

Hashes for pqopen_lib-0.4.2.tar.gz
Algorithm Hash digest
SHA256 37ea1327a3c44a37ee3e4aa288dd76e87ec0bf80ffd9003a9d41c7469a05be23
MD5 adfaf890d0e83df768969bf99c616d4f
BLAKE2b-256 e5981d4373c4b07c766463b910f7cf08c911de674d105389ce8dc33d98d6259d

See more details on using hashes here.

File details

Details for the file pqopen_lib-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: pqopen_lib-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.2

File hashes

Hashes for pqopen_lib-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ece2423c99ed34428163b98f3b7279562b90b50e6bce12987113e8046b7e2147
MD5 e1fb704cd1b2a883dda1e723a9b3d2c8
BLAKE2b-256 581f6cec2390f763675760619a4ca5f6a9d9c78a647ea007b3808a6ba1ee7654

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page