Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problems running large number of simulations using same raw and dyr file

I tried running around a 1000 different N-2 line outages followed by a fault on the savnw raw and dyr set using psspy. The script abruptly terminates after 800-900 simulations, with the following message in the output:

Array allocation failed in DYRE

Here is the gist of my script: It tries to run every event in simList. The event string itself contains the simulation info. I am guessing there is some memory allocation problem while using DYRE. Is there a way to change the script so that i dont have to read the dyr file for every simulation.

# Local imports
import redirect
import psspy
import dyntools
##### Get everything set up on the PSSE side
redirect.psse2py()



psspy.psseinit(buses=80000)
_i=psspy.getdefaultint()
_f=psspy.getdefaultreal()
_s=psspy.getdefaultchar()



for event in simList:
    #Parameters. 
    settings = {
    # #####################################
        'filename':rawFile,
    ################################################################################
        'dyr_file':dyrFile,
        'out_file':'output2.out',
        'pf_options':[
            0,  #disable taps
            0,  #disable area exchange
            0,  #disable phase-shift
            0,  #disable dc-tap
            0,  #disable switched shunts
            0,  #do not flat start
            0,  #apply var limits immediately
            0,  #disable non-div solution
        ]
    }


        ierr = psspy.read(0, settings['filename'])
        ierr = psspy.fnsl(settings['pf_options'])


        ##### Prepare case for dynamic simulation
        # Load conversion (multiple-step)
        psspy.conl(_i,_i,1,[0,_i],[_f,_f,_f,_f])
        psspy.conl(1,1,2,[_i,_i],[100.0, 0.0,0.0, 100.0]) 
        psspy.conl(_i,_i,3,[_i,_i],[_f,_f,_f,_f])


        ierr = psspy.cong(0) #converting generators
        ierr = psspy.ordr(0) #order the network nodes to maintain sparsity
        ierr = psspy.fact()  #factorise the network admittance matrix
        ierr = psspy.tysl(0) #solving the converted case
        ierr = psspy.dynamicsmode(0) #enter dynamics mode

        ierr = psspy.dyre_new([1,1,1,1], settings['dyr_file'])
        ierr=psspy.docu(0,1,[0,3,1]) #print the starting point of state variables

        # select time step ##############################################################
        ierr = psspy.dynamics_solution_params([_i,_i,_i,_i,_i,_i,_i,_i], [_f,_f,0.00833333333333333,_f,_f,_f,_f,_f], 'out_file') # the number here is the time step
        ################################################################################

        ##### select channels
        ierr = psspy.delete_all_plot_channels() # clear channels

        BusDataDict = getBusData(rawFile)
        # get all the bus voltages, angles and frequencies
        for bus  in BusDataDict:
            bus = int(bus)
            ierr = psspy.voltage_and_angle_channel([-1, -1, -1, bus])
            ierr = psspy.bus_frequency_channel([-1, bus])


    # get the nominal voltages as well as the fault impedance in ohms
    FaultBusNomVolt = float(BusDataDict[str(FaultBus)].NominalVolt)
    Zbase = FaultBusNomVolt**2/Sbase  # float since Sbase is a float
    Rohm = FaultRpu*Zbase # fault impedance in ohms 





    ierr = psspy.strt(0,settings['out_file'])
    ierr = psspy.run(0,0.1,1,1,1)
    ierr = psspy.dist_branch_trip(L1Bus1, L1Bus2, L1cktID)


    ierr = psspy.run(0,0.2,1,1,1) #fault on time




    ierr = psspy.dist_bus_fault(int(FaultBus), 3, 0.0, [Rohm, 0.0])
    ierr = psspy.run(0,0.3,1,1,1) #fault off time
    ierr = psspy.dist_clear_fault(1)

    ierr = psspy.run(0,0.31,1,1,1) #fault off time
    ierr = psspy.dist_branch_trip(L2Bus1, L2Bus2,L2cktID)
    ierr = psspy.run(0,0.35,1,1,1) #fault off time
    ierr = psspy.run(0,10.0,1,1,1) #exit time (second argument is the end time)