Python 用于电路课程

6 篇文章 0 订阅

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)

 

Power Factor correction

Question:

 

code

#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

current on the Neutral line :

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. 所以还需要理论推导

Chapter 12 three phase system

Ex12.5  balanced delta-wye connection

      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)

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

做一个码农都是奢望

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值