Ask Your Question
0

Multiple simulations, strt command and .OUT files

asked 2016-05-27 11:53:46 -0500

SAE_2016 gravatar image

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 ... (more)

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
0

answered 2016-05-27 21:10:38 -0500

jconto gravatar image

The case is fixed, the snp file changes according to the event A or B. So there are two scenarios. Only the event "A" is applied to both scenarios. To use different events:

replace: execfile('Event%s.py' %Event[0])

with: execfile('Event%s.py' %Event[i])

On the different size for the out files, check the snp files for channels defined twice.

edit flag offensive delete link more
0

answered 2016-06-01 20:18:20 -0500

SAE_2016 gravatar image

updated 2016-06-03 10:54:48 -0500

I really sorry for my fool error! I forget to change the [0] for a [i]. I run with [i] instead of [0] and I get rights .out files. The Solution for the channels/out file size is:

if i==0:
    # Channel definition
    psspy.bus_frequency_channel([-1,15],"Frec in 15")

Thank you very much for your answer!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: 2016-05-27 11:53:46 -0500

Seen: 968 times

Last updated: Jun 03 '16