【编程实例PSS/E】自己用python写的一个三相短路故障的例子
import globedefimport fault
psspy.case('c:\sav.sav')
psspy.close_report()# close REPORT windows
options=(0,0,0,0,0,0,0)
psspy.progress_output(6, "", options)
psspy.report_output(6, "", options)
fault.three_phase(33600)
[ 本帖最后由 dsyljh 于 2008-8-8 08:40 编辑 ]-%-96529-%- 这是FAULT.PY的内容
import globedef
import psspy
#a=(1,1,1)
#psspy.seqd(a)
def one_phase_ground(bus,r,x):
options=(1,1,1,0,0,0,0)
rval=(r,x,0.0,0.0,0.0)
cktarg=''
psspy.scmu(1,options,rval,cktarg)
options=(1,bus,1,0,0,0,0)
psspy.scmu(2,options,rval,cktarg)
psspy.scmu(3,options,rval,cktarg)
return 0
def two_phase(i):
return 0
def three_phase(bus):
options=(1,1,1,0,0,0,0)
rval=(0.0,0.0,0.0,0.0,0.0)
cktarg=''
psspy.scmu(1,options,rval,cktarg)
options=(7,bus,1,0,0,0,0)
psspy.scmu(2,options,rval,cktarg)
psspy.scmu(3,options,rval,cktarg)
return 0
def line_LG_fault_both_ends_close(bus_i,bus_j,ckt,location,r,x):
options=(1,1,1,0,0,0,0)
rval=(0.0,0.0,0.0,0.0,location)
cktarg=ckt
psspy.scmu(1,options,rval,cktarg)
options=(9,bus_i,bus_j,1,1,0,0)
psspy.scmu(2,options,rval,cktarg)
psspy.scmu(3,options,rval,cktarg)
return 0
def line_LL_fault_both_ends_close(bus_i,bus_j,ckt,location,r,x):
options=(1,1,1,0,0,0,0)
rval=(0.0,0.0,0.0,0.0,location)
cktarg=ckt
psspy.scmu(1,options,rval,cktarg)
options=(9,bus_i,bus_j,2,1,0,0)
psspy.scmu(2,options,rval,cktarg)
psspy.scmu(3,options,rval,cktarg)
return 0
def get_breaker_cline_LG_fault_both_ends_close(bus_i,bus_j,ckt,location,r,x):
options=(1,1,1,0,0,0,0)
rval=(0.0,0.0,0.0,0.0,location)
cktarg=ckt
psspy.scmu(1,options,rval,cktarg)
options=(9,bus_i,bus_j,1,1,0,0)
psspy.scmu(2,options,rval,cktarg)
psspy.scmu(3,options,rval,cktarg)
return 0 咋一个三相短路写这么复杂呢?
高手详细对比一下python和IPLAN吧
各有哪些优势 恩
高手说说两者各自的优缺点吧 楼主上述故障实现没有直接用官方提供的disturbance APIs
不知为什么
看起来官方的dist_branch_fault、dist_bus_fault等更简洁
但没试过 原先用IPLAN写branch trip:
PUSH 'ALTR'
PUSH '0'
PUSH '1' !CHANGE NETWORKDATA
PUSH '0'
PUSH '3' !BRANCH DATA
PUSH '151,201,1'
PUSH '1'
PUSH '0,' !ISOLATE THIS BRANCH
PUSH '0' !NO MORE CHANGES TO THIS BRANCH
PUSH ' ' !NO CHANGE IN METERED END
PUSH ' ' !NO MORE BRANCHES TO BE CHANGED
PUSH'0' !EXIT ALTR ACTIVITY
现在python:
dist_branch_trip(151,201,'1')
一句就可以了
确实比较简洁 亨利版主是IPLAN的行家。觉得python很多东西藏的太深了。不像直接调用activities这样明显。 用官方提供的应该可靠性高点
就是不容易出错
要想玩PSSE,还是基于最基本命令单元,呵呵 直接看不懂呀
页:
[1]