#Calculate base impedence
#Given data :
BaseVoltage=1100.##in Volts
BasekVA=10**6##kVA
BasekV=BaseVoltage/1000.##kV
IB=BasekVA/BasekV##in Ampere
ZB=BasekV*1000./IB##in ohm
print '%s %.5f' %("Base Impedence (in ohm) :",ZB)#
#calculate Per unit resistance
#Given data :
R=5.##in ohm
kVA_B=10.##kVA
kV_B=11.##kV
RB=kV_B**2*1000/kVA_B##in ohm
Rpu=R/RB##in ohm
print '%s %.6f' %("Per unit resistance (pu) :",Rpu)#
#calculate Leakage reactance Per unit
#Given data :
kVA_B=2.5##kVA
kV_B=0.4##kV
reactance=0.96##in ohm
Z_BLV=kV_B**2*1000./kVA_B##in ohm
Zpu=reactance/Z_BLV##in ohm
print '%s %.3f' %("Leakage reactance Per unit (pu) :",Zpu)#
#calculate Leakage reactance Per unit
import cmath
import math
#Given data :
Zr=30.
Zi=110.##in ohm
kVA_B=100.*1000.##kVA
kV_B=132.##kV
Z_BLV=kV_B**2*1000./kVA_B##in ohm
Zpur=Zr*kVA_B/kV_B**2/1000.##pu
Zpui=Zi*kVA_B/kV_B**2/1000.##pu
print '%s' %("Leakage reactance Per unit (pu) :")#
print '%.3f %s %.3f' %(Zpur,'+j',Zpui)
#calculate New Per unit impedence
#Given data :
oldkVA_B=30000##kVA
oldkV_B=11##kV
oldZpu=0.2##pu
newkVA_B=50000.##kVA
newkV_B=33.##kV
newZpu=oldZpu*newkVA_B/oldkVA_B*(oldkV_B/newkV_B)**2##pu
print '%s %.3f' %("New Per unit impedence(pu) :",newZpu)#