Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Multiple simulations, strt command and .OUT files

Hi! I’m new with python and I try to do multiple simulations. I made this code based on: link text

from: link text

import os,sys
sys.path.append(r"C:\Program Files\PTI\PSSE32\PSSBIN")
os.environ['PATH'] = (r"C:\Program Files\PTI\PSSE32\PSSBIN;"
                      + os.environ['PATH'])
import psspy
import redirect
_i=psspy.getdefaultint()
_f=psspy.getdefaultreal()
_s=psspy.getdefaultchar()
redirect.psse2py()
psspy.psseinit(50)

Escenar="10"
RR="-"
Event=['A', 'B']
SAVFile="000"
SizeEvent=len(Event)

for i in range(0,SizeEvent):

    CASE=Escenar+RR+Event[i]+"-"+SAVFile
    psspy.lines_per_page_one_device(1,60)
    psspy.progress_output(2,r'%s_Progress.sal' %CASE,[0,0])
    psspy.snap([-1, -1, -1, -1, -1 ],"%s.snp" %CASE)

    CASEbas=Escenar+RR+"000-"+SAVFile
    psspy.case(r'%s.SAV' %CASEbas)

    psspy.fnsl([0,0,0,1,0,0,99,0])
    psspy.switched_shunt_data_3(11,[_i,_i,_i,_i,_i,_i,_i,_i,1,_i,_i,_i],[_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f],_s)
    psspy.conl(0,1,1,[0,0],[ 80.0, 20.0, 50.0, 50.0])
    psspy.conl(0,1,2,[0,0],[ 80.0, 20.0, 50.0, 50.0])
    psspy.conl(0,1,3,[0,0],[ 80.0, 20.0, 50.0, 50.0])
    psspy.load_data_3(12,r"""1""",[1,_i,_i,_i,_i],[ 130.0, 73.7,0.0,0.0,0.0,0.0])
    psspy.fnsl([0,0,0,1,0,0,99,0])
    psspy.cong(0)
    psspy.ordr(0)
    psspy.fact()
    psspy.tysl(0)
    psspy.dyre_new([1,1,1,1],r"""mnd.dyr""",r"""cc1.flx""",r"""ct1.flx""",r"""compile.bat""")

    # Channel definition
    psspy.bus_frequency_channel([-1,15],"Frec in 15")

    psspy.set_netfrq(1)
    psspy.set_osscan(1,0)
    psspy.set_genang(1, 180.0)
    psspy.set_vltscn(1, 1.2,0.0)
    psspy.set_voltage_rec_check(1,1, 0.7,0.0, 0.8, 1.0)
    psspy.dynamics_solution_param_2([_i,_i,_i,_i,_i,_i,_i,_i],[_f,_f, 0.001,_f,_f,_f,_f,_f])

    # Open .OUT file
    psspy.strt(0,r'%s_.OUT' %CASE)

    psspy.run(0, 1.0,1000,10,0)    

    # Trip Line Event[0]
    execfile('Event%s.py' %Event[0])
    psspy.run(0, 60,1000,1,0)
    psspy.save('%s.sav' %CASE)

    psspy.close_powerflow()
    psspy.close_report()

    # Reference point 1

psspy.pssehalt_2()

The script do almost all stuff pretty well and I get all the files. The problem is when I try to plot the files 10-A-000.OUT and 10-B-000.OUT. The files are like “superimposed”. The file 10-B-000.OUT it’s about two times the size of 10-A-000.OUT. When I try to plot “B” case, I see the frequency of “A” case!

It´s seems like the -strt- command still working with the same memory space. I tried to solve the problem with a “force brute” solution in -Reference point 1- like:

os.system('COPY %s_.OUT %s.OUT' %(CASE,CASE))
os.system('DEL %s_.OUT' %CASE)

but doesn’t work. How can I “stop” the -strt- command? What can I do to have the rights OUT files? Thanks a lot in advance!