Skip to main content

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

Metadata

Release files for pqopen-lib 0.10.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pqopen-lib 0.10.3
File Size Uploaded Provenance Actions
pqopen_lib-0.10.3.tar.gz 44.2 kB Without provenance Details for pqopen_lib-0.10.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pqopen-lib 0.10.3
File Interpreter ABI Platform Actions
pqopen_lib-0.10.3-py3-none-any.whl Python 3 none any Details for pqopen_lib-0.10.3-py3-none-any.whl

Total release size: 77.3 kB

Release files / pqopen_lib-0.10.3.tar.gz

Download URL pqopen_lib-0.10.3.tar.gz
Size 44.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f50f4fff99411daab823204111350bdf17689ca259615efb410453b8e55f5f48
BLAKE2b-256 checksum
How to use checksums
e473a28df7e131f5966e8164d6fa4cefe20b0dbb9808451e7e780b3d7cf46785
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pqopen_lib-0.10.3-py3-none-any.whl

Download URL pqopen_lib-0.10.3-py3-none-any.whl
Size 33.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae7b182f2c5c6362ac2f484470ac90ca7af5fdf72866004343827353f7205495
BLAKE2b-256 checksum
How to use checksums
90d10cae65dfc06c8d1e3909cf121dca1a4a8289ad4686d38f85ba89be3a5590
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for pqopen-lib 0.10.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page