我正在尝试通过使用 python 程序来改变 PSS/E 中的总线负载。所以我试图在 python 中编写一个脚本,我可以在 PSS/E 中的两条总线之间将负载更改为不同的值。
问问题
5184 次
4 回答
1
您可以使用名为“LOAD_CHNG_4”的 API 例程(在 API.pdf 文档中搜索此例程)。该例程属于加载数据规范函数集。它可用于修改工作案例中现有负载的数据。
于 2014-09-24T15:46:49.453 回答
1
我编写了这个类来处理 PSSE 中的负载......它最初是用 SQL alchemy 发送的,所以它有一些我删除的附加功能:
class Load():
def __init__(self,busnumber,loadID):
# Initialize the Branch Class Instance Variables to a Default 0; Except for the From,To and Circuit ID
self.bus = Bus(busnumber)
self.busI = busnumber
self.loadID = loadID
self.status = 0
self.Pload = 0.0
self.Qload = 0.0
self.errorList = []
self.init()
def init(self):
# Setup the load from the case
# Check to see if bus exists
busOk = self.bus.init()
if not busOk[0]:
return (False,self.bus.number,"The bus number %d is invalid or does not exist..." % self.bus.number)
if psspy.loddt2(self.bus.number,self.loadID,'TOTAL','ACT')[0] != 0:
return (False,False)
Scomplex = self.check(psspy.loddt2(self.bus.number,self.loadID,'TOTAL','ACT'),'loddt2','ACT') # Grab the S vector/phasor from the power flow case for the load specified at the BUS number
self.Pload = Scomplex.real
self.Qload = Scomplex.imag
self.status = self.check(psspy.lodint(self.bus.number,self.loadID,'STATUS'),'lodint','STATUS') # Grab the Status of the Load
return (True,self.bus.number)
def check(self,tuple,funName,subFun):
# Define Error Messages that should be accesable by the end-user and developer
loddt2 = {
0:'No error; P and Q or CMPVAL returned',
1:'Bus not found; P and Q or CMPVAL unchanged.',
2:'Load not found; P and Q or CMPVAL unchanged.',
3:'Bus type code is not 1, 2 or 3; P and Q or CMPVAL returned.',
4:'Load out-of-service; P and Q or CMPVAL returned.',
5:'Invalid value of STRING1 or STRING2; P and Q or CMPVAL unchanged.'
}
lodint = {
0:'No error; IVAL returned.',
1:'Bus not found; IVAL unchanged.',
2:'Load not found; IVAL unchanged.',
3:'Bus type code is not 1, 2 or 3; IVAL returned.',
4:'Load out-of-service; IVAL returned.',
5:'Invalid value of STRING; IVAL unchanged.'
}
funDic = {
'loddt2':loddt2,
'lodint':lodint
}
# Retrieve the Right Error Message
list = funDic[funName]
msg = list[tuple[0]]
if tuple[0] > 0:
logging.debug("Function Name: %s Sub Function Name: %s Error Message: %s"%(funName,subFun,msg))
return tuple[1]
def setLoad(self,loadP):
self.Pload = loadP
def updateCase(self):
# Setup Defaults
_i = psspy.getdefaultint()
_f = psspy.getdefaultreal()
cDef = psspy.getdefaultchar()
psspy.load_data_3(self.bus.number,self.loadID,[self.status,_i,_i,_i,_i],[self.Pload, self.Qload,_f,_f,_f,_f])
# To String Method
def __repr__(self):
return "%d %s %d %d" %(self.bus.number,self.loadID,self.Pload,self.Qload)
# printf Statement that Dumps information to CMD line...Homeage to C and C++
def printf(self):
print "\n Bus: %d \n Load ID: %s \n MW Value: %d \n MVAR Value: %d \n" % (self.bus.number,self.loadID,self.Pload,self.Qload)
如果您调用名为“updateCase”的函数,它将获取加载对象中存储的任何值并刷新 PSSE 案例。
于 2015-10-06T02:07:23.060 回答
1
查看 PSSE python API 的第二章。它完全涵盖了不断变化的潮流数据。负载数据可以通过总线编号和负载 ID 引用。当您手动输入负载数据本身时,您可以更改在铭牌中看到的所有参数。使用下面的这个函数来改变负载:
ierr = psspy.load_chang(bus_number, load_id, intgar,realar)
有关详细信息,请参阅 API 手册的第 728 页。
于 2015-08-17T15:55:47.687 回答
0
http://www.whit.com.au/blog/2011/07/run-psse-from-python-and-not-other-way/
我发现这篇关于如何从 PSSE 运行 Python 命令的博客文章。不过,我认为您的问题与 ASP.NET 没有任何关系。
于 2012-07-07T18:31:57.077 回答