我正在尝试编写一个允许使用命令 psspy.change_vref 运行迭代的程序,它每次都会更改 Meas_Bus_Voltage[i]。这是我的代码:
print 'LengthOfData=',LengthOfData
for i in range(0,LengthOfData):
print 'i=',i
time_point=Time_Tag[i]
if i>=1:
psspy.powerflowmode()
print 'Meas_Bus_Voltage[i]=',Meas_Bus_Voltage[i]
print type(Meas_Bus_Voltage[i])
ierr,realaro = psspy.change_vref(1, '1', Meas_Bus_Voltage[i])
ierr,realaro = psspy.change_gref(1, '1', Meas_Bus_Frequency[i])
psspy.fact()
psspy.dynamicsmode(0)
psspy.run(0,time_point,10,10,0)
然后我得到了错误:
LengthOfData= 2000 i= 0 i= 1 Meas_Bus_Voltage[i]= 1.04118376974
ierr,realaro = psspy.change_vref(1, '1', Meas_Bus_Voltage[i])
TypeError: 'int' object is not iterable
我在这里使用范围为 i,它是从 0 到 2000,为什么它不可迭代?有人可以帮我吗?