matlab过期了,无法在线使用,对于授课来说无法进行计算展示。
python可以弥补计算问题。
python在线:
Online Python Interpreter - online editorOnlineGDB is online IDE with python interpreter. Quick and easy way to run python program online. It supports python3.https://www.onlinegdb.com/online_python_interpreter
相关计算,包括余弦,幅值和相位角,基本满足电工课程的phasor 计算用。
import numpy as np
import math
import cmath
#print("Hello World")
in_array=30/180*np.pi
cos_Values = np.cos(in_array)
print ("\nCosine values : \n", cos_Values)
c1=1+2j
print("\n complex nuber:\n ",c1)
print("\n conjugate:\n",c1.conjugate())
print("\n amplitude:\n ",abs(c1))
print("\n angle \n",cmath.phase(c1)*180/np.pi)
pf=np.cos(-75/180*np.pi)
print("\n Power factor:",pf)
S=100/np.sin(75/180*np.pi)
print("\n apparant power/VA:",S)
vrms=np.sqrt(S*1000*250)/1000
print("\n rms of voltage/kV:",vrms)
#print("Hello World")
import numpy as np
import math
import cmath
pf1=0.8
pf2=0.95
theta1=math.acos(pf1);
theta2=math.acos(pf2)
print("angle of power factor 1:",theta1*180/np.pi)
print("angle of power factor 2:",theta2*180/np.pi)
P=4000 #kw
QC=P*(np.tan(theta1)-np.tan(theta2)) # kVAR
print("\n QC /k VAR=",QC)
w=np.pi*2*60
Vrms=120
Ca=QC/(w*Vrms**2)
print("\n the connected capacitive is uF", Ca*1000000)
angle of power factor 1: 36.86989764584401
angle of power factor 2: 18.194872338766785
QC /k VAR= 1685.2635792845463
the connected capacitive is uF 310.4375336294859
import numpy as np
import math
import cmath
ia=1
theta=120/180*np.pi
ib=complex(np.cos(theta),np.sin(theta))
ic=complex(np.cos(2*theta),np.sin(2*theta))
print("\n ib=",ib)
print("\n ic=",ic)
print("\n ib+ic=",ib+ic)
print("\n current of netural line /A ",ia+ib+ic)
这个结果接近0. 所以还需要理论推导
A balanced Y-connected load with a phase impedance 40+j25 W is supplied by a balanced, positive-sequence Δ-connected source with a line voltage of 210V. Calculate the phase currents. Use Vab as reference.
Code
import numpy as np
import math
import cmath
ZY=complex(40,25) # Y impedance
print("\n ZY=",ZY)
Vab=complex(210,0)# delta source, line voltage
phab=cmath.phase(Vab)
#print("\n phase=",cmath.phase(ZY)*180/np.pi)
#print("\n amplitude=",abs(ZY))
phn30=cmath.rect(1, -30/180*np.pi) # -30 degree
print("\ phn30=",phn30)
print("\n phase angle of -30=", cmath.phase(phn30)*180/np.pi) # double check the -30 degree
Van=Vab/np.sqrt(3)*phn30
print("\n phase voltage van=", Van)
Ia=Van/ZY
print("\n amplitude of Ia=",abs(Ia))
print("\n phase angle of Ia=",cmath.phase(Ia)*180/np.pi)