New functions using Azure SDK for Python

This commit is contained in:
2025-03-17 08:33:46 +01:00
parent 139f271905
commit 888352d3b8
5 changed files with 418 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
import math
# Given values
V_LL_AB = 135 # Line-to-line voltage AB in Volts
V_LL_BC = 0 # Line-to-line voltage BC in Volts
V_LL_CA = 135 # Line-to-line voltage CA in Volts
I_A = 0.1 # Current in phase A in Amperes
I_B = 0 # Current in phase B in Amperes
I_C = 0 # Current in phase C in Amperes
cos_phi_A = 0.98 # Power factor for phase A
cos_phi_B = 1 # Power factor for phase B
cos_phi_C = 1 # Power factor for phase C
# Calculate phase voltage from line-to-line voltage
V_ph = V_LL_AB / math.sqrt(3)
# Power calculations for each phase
# Phase A
P_A = V_ph * I_A * cos_phi_A
Q_A = V_ph * I_A * math.sqrt(1 - cos_phi_A**2) if I_A > 0 else 0
# Phase B
P_B = V_ph * I_B * cos_phi_B
Q_B = V_ph * I_B * math.sqrt(1 - cos_phi_B**2) if I_B > 0 else 0
# Phase C
P_C = V_ph * I_C * cos_phi_C
Q_C = V_ph * I_C * math.sqrt(1 - cos_phi_C**2) if I_C > 0 else 0
# Total power calculations
P_total = P_A + P_B + P_C
Q_total = Q_A + Q_B + Q_C
# Output the results
print(f"Phase Voltage (V_ph): {V_ph:.2f} V")
print(f"Active Power (P_A): {P_A:.2f} W")
print(f"Reactive Power (Q_A): {Q_A:.2f} VAR")
print(f"Active Power (P_B): {P_B:.2f} W")
print(f"Reactive Power (Q_B): {Q_B:.2f} VAR")
print(f"Active Power (P_C): {P_C:.2f} W")
print(f"Reactive Power (Q_C): {Q_C:.2f} VAR")
print(f"Total Active Power (P_total): {P_total:.2f} W")
print(f"Total Reactive Power (Q_total): {Q_total:.2f} VAR")