A Python library for three-phase electrical system calculations.
Project description
electricalsystemcalculator
electricalsystemcalculator is a Python library for performing advanced calculations in three-phase electrical power systems. It is designed for engineers, students, and researchers who need to analyze, simulate, or monitor three-phase systems in industrial, commercial, or academic settings.
Features
- Calculate active, reactive, and apparent power and energy for three-phase systems
- Compute average current and voltage
- Calculate RMS voltage and voltage imbalance
- Phase calculations: phase difference, phase sequence detection, phase angle from real/imaginary parts, and phase unbalance
- Built-in logging for debugging and analysis
- Well-documented, type-annotated API
Installation
Clone or download this repository, then use the library directly in your project:
git clone https://github.com/Modular-Minds/ElectricalSystemCalculator
Or copy the electricalsystemcalculator folder into your project.
Usage Example
from electricalsystemcalculator.three_phase_calculations import ThreePhaseCalculations
# Example data for a three-phase system
amplitude = [230, 230, 230, 10, 10, 10] # [V_A, V_B, V_C, I_A, I_B, I_C]
phase = [0, -120, 120, 10, -110, 130] # [V_A, V_B, V_C, I_A, I_B, I_C]
time = 2 # hours
tpc = ThreePhaseCalculations()
active_power = tpc.calculate_active_power(amplitude, phase)
print(f"Active Power (kW): {active_power}")
reactive_power = tpc.calculate_reactive_power(amplitude, phase)
print(f"Reactive Power (kVAR): {reactive_power}")
apparent_power = tpc.calculate_apparent_power(amplitude)
print(f"Apparent Power (kVA): {apparent_power}")
active_energy = tpc.calculate_active_energy(amplitude, phase, time)
print(f"Active Energy (kWh): {active_energy}")
phase_diff = tpc.phase_difference(30, 10)
print(f"Phase Difference (deg): {phase_diff}")
API Overview
Class: ThreePhaseCalculations
Power and Energy
calculate_power_factor(phase: List[float]) -> floatcalculate_active_power(amplitude: List[float], phase: List[float]) -> floatcalculate_reactive_power(amplitude: List[float], phase: List[float]) -> floatcalculate_apparent_power(amplitude: List[float]) -> floatcalculate_active_energy(amplitude: List[float], phase: List[float], time: float) -> floatcalculate_reactive_energy(amplitude: List[float], phase: List[float], time: float) -> floatcalculate_apparent_energy(amplitude: List[float], time: float) -> float
Current and Voltage
calculate_average_current(amplitude: List[float]) -> floatcalculate_average_voltage(amplitude: List[float]) -> floatcalculate_rms_voltage(amplitude: float) -> floatcalculate_rms_voltage_for_imbalance(amplitude1: float, amplitude2: float, phase1: float, phase2: float) -> float
Phase Calculations
phase_difference(phase1: float, phase2: float) -> floatphase_sequence(phases: List[float]) -> strphase_angle_from_complex(real: float, imag: float) -> floatphase_unbalance(phases: List[float]) -> float
Logging
The library uses Python's built-in logging module. You can control the verbosity by setting the logging level in your application:
import logging
logging.basicConfig(level=logging.DEBUG) # or INFO, WARNING, etc.
Example Scripts
See the example/ folder for a ready-to-run script demonstrating all major features.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file electricalsystemcalculator-0.1.1.tar.gz.
File metadata
- Download URL: electricalsystemcalculator-0.1.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20c200a712b3f758f130755d102a663022f05d1caf9d8f6665624f2f521f5da6
|
|
| MD5 |
fbcc79db7e7b7954fce743d3234a57bd
|
|
| BLAKE2b-256 |
5467b26d736e7254b692ccc8e2aedb70048d0a6ec9bafdcc701a58767db5ad83
|
File details
Details for the file electricalsystemcalculator-0.1.1-py3-none-any.whl.
File metadata
- Download URL: electricalsystemcalculator-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
454adee8fc8490ee579ac806a39358728186d7dd361c02f7bd5c992c1e127824
|
|
| MD5 |
cf1f4244751a27ed228d1a2a461cfef1
|
|
| BLAKE2b-256 |
f20997506df92d78df0ca374d4816f18869379ec9ef9efb369e8a9dc82b81cf7
|