psspy.conl(1, 0, 2, [0, 0], [100.0, 0.0, 0.0, 100.0]) psspy.conl(0, 1, 2, [0, 0], [100.0, 0.0, -306.02, 303.0]) psspy.conl(0, 1, 3, [0, 0], [100.0, 0.0, -306.02, 303.0]) psspy.ordr(0) psspy.fact() psspy.tysl(0) psspy.bsys(0, 0, [0.4, 500.], 0, [], 0, [], 0, [], 0, []) # start simulation psspy.strt_2([0,0], OutputFilePath) psspy.run(0, 1, 1000, 1, 0) ## psspy.change_var(var_ppc_setp+10,115) ## psspy.change_var(var_ppc_setp+11,-25) psspy.run(0, 5, 1000, 1, 0) if fault_type == 1: # three phase psspy.dist_branch_fault(Branch_Outage_List_Start[i], Branch_Outage_List_End[i], '1', 1, Branch_kV[i], [0.0, -0.2E+10]) fault_name = 'ThreePhase' if Branch_kV[i] == 330 or Branch_kV[i] == 275: fault_time = 0.120 if Branch_kV[i] == 132: fault_time = 0.500 if fault_type == 2: # single phase, no path to ground, line-to-ground, breaker @ bus i, psspy.dist_spcb_fault(Branch_Outage_List_Start[i], Branch_Outage_List_End[i], '1', [3, 0, 1, 1, 0, 0], [0.5, 0.0, 0.000001, 0.0, 0.0]) fault_name = 'SinglePhase' if Branch_kV[i] == 330 or Branch_kV[i] == 275: fault_time = 0.250 if Branch_kV[i] == 132: fault_time = 0.720
def applyDisturbance(self): psspy.dist_branch_fault(self.__ibus,self.__jbus,self.__branch_id,self.__units,self.__basekv,self.__values)
[8, -1, -1, 400], [r"""POC_Voltage Mag""", r"""POC Voltage Ang"""]) psspy.cong(0) psspy.conl(0, 1, 1, [0, 0], [0.0, 0.0, 0.1, 0.0]) psspy.conl(0, 1, 2, [0, 0], [0.0, 0.0, 0.1, 0.0]) psspy.conl(0, 1, 3, [0, 0], [0.0, 0.0, 0.1, 0.0]) psspy.ordr(1) psspy.fact() psspy.tysl(1) #psspy.change_plmod_con(600, r"""1""", r"""GENCLS""", 1, 8.0) OutputFilePath = ProgramPath + ClauseName + str( test_no) + "_Simulation.outx" # start simulation psspy.strt_2([0, 0], OutputFilePath) psspy.run(0, 2, 500, 1, 1) psspy.dist_branch_fault(400, 46660, r"""1""", 3, 275.0, [r_f[test_no], x_f[test_no]]) test_name = 'Test_' + str(test_no + 31) psspy.run(0, 2.0 + fault_time, 500, 1, 1) psspy.dist_clear_fault(1) psspy.run(0, 5, 500, 1, 1) # start draw curves # new folder if necessary GraphPath = FigurePath + ClauseName + '/' if not os.path.exists(GraphPath): os.makedirs(GraphPath) # read data curves chnfobj = dyntools.CHNF(OutputFilePath) short_title, chanid, chandata = chnfobj.get_data() freq_data = numpy.array(chandata[1])
def run_savnw_simulation(datapath, outfile1, outfile2, outfile3, prgfile): _F1_start=100 _F1_end=100+70*1/60.0; _F2_start = 300 _F2_end = 400; _runto=300; import psspy psspy.psseinit() savfile = 'IEEE 9 Bus_modifiedj4ab.sav' snpfile = 'IEEE 9 Bus_modifiedj4ab.snp' _i = psspy.getdefaultint() _f = psspy.getdefaultreal() _s = psspy.getdefaultchar() INTGAR = [_i] * 7 REALAR = [_f] * 8 if datapath: savfile = os.path.join(datapath, savfile) snpfile = os.path.join(datapath, snpfile) psspy.lines_per_page_one_device(1,90) psspy.progress_output(2,prgfile,[0,0]) #Use this API to specify the progress output device. ierr = psspy.case(savfile) #Use this API to open a PSSE Saved Case file and transfers its data into the PSSE working case if ierr: psspy.progress_output(1,"",[0,0]) print(" psspy.case Error") return ierr = psspy.rstr(snpfile)#Use this API to read a dynamics Snapshot File into PSSE working memory (activity RSTR). if ierr: psspy.progress_output(1,"",[0,0]) print(" psspy.rstr Error") return psspy.strt(0,outfile1) #strt(option, outfile) #Use this API to initialize a PSSE dynamic simulation for state-space simulations (i.e., in preparation for activity RUN) and to specify the Channel Output File into which the output channel values are to be recorded during the dynamic simulation (activity STRT). psspy.run(0, _F1_start,5000,1,0) #Use this API to calculate PSSE state-space dynamic simulations (activity RUN). #psspy.dist_bus_fault(8,1, 230.0,[0.0,-0.2E+10]) #Use this API routine to apply a fault at a bus during dynamic simulations. (Note: use DIST_BUS_FAULT_2 if phase voltages are to be calculated during the simulation.) businfo = subsystem_info('bus', ['NUMBER', 'NAME', 'PU'], sid=-1) print businfo psspy.dist_branch_fault(8,9, '1',3,0.0,[0.0,0.000001]) ##psspy.dist_branch_trip(8, 7, '1') ##psspy.load_chng_5(11, r"""1""", [0, _i, _i, _i, _i, _i, _i], [_f, _f, _f, _f, _f, _f, _f, _f]) businfo = subsystem_info('bus', ['NUMBER', 'NAME', 'PU'], sid=-1) print businfo psspy.run(0, _F1_end+1.5*1/60,5000,1,0) businfo = subsystem_info('bus', ['NUMBER', 'NAME', 'PU'], sid=-1) print businfo #psspy.dist_branch_close(8,7,'1') ## psspy.load_chng_5(11, r"""1""", [1, _i, _i, _i, _i, _i, _i], [_f, _f, _f, _f, _f, _f, _f, _f]) psspy.dist_clear_fault(1) psspy.run(0, _F1_end+2.0, 5000, 1, 0) businfo = subsystem_info('bus', ['NUMBER', 'NAME', 'PU'], sid=-1) print businfo #psspy.dist_clear_fault(1) #Use this API to clear a fault during dynamic simulations. The fault must have previously been applied using one of the following APIs: psspy.run(0, _runto,5000,1,0) #trigger machine # psspy.case(savfile) #Use this API to open a PSSE Saved Case file and transfers its data into the PSSE working case # psspy.rstr(snpfile) #Use this API to read a dynamics Snapshot File into PSSE working memory (activity RSTR). # psspy.strt(0,outfile2) # psspy.run(0, 1.0,1000,1,0) # psspy.dist_machine_trip(2,'1') # psspy.run(0, 10.0,1000,1,0) #trigger line # psspy.case(savfile) # psspy.rstr(snpfile) # psspy.strt(0,outfile3) # psspy.run(0, 1.0,1000,1,0) # psspy.dist_branch_trip(7,8,'1') # psspy.run(0, 10.0,1000,1,0) psspy.lines_per_page_one_device(2,10000000) psspy.progress_output(1,"",[0,0])
psspy.load_array_channel([-1, 2, 8], r"""1""", "") psspy.chsb(0, 1, [-1, -1, -1, 1, 5, 0]) psspy.chsb(0, 1, [-1, -1, -1, 1, 27, 0]) psspy.strt(0, out_file) # Run simulation DELTA = 0.005 psspy.dynamics_solution_param_2(realar3=DELTA) # set sample time, DELTA sec. # Simulation Procedure ##1. System initialization and run simulation to t = 1 s. psspy.run(0, 1, 0, 0, 0) ##2. Apply 3-phase fault at line B6 – B7 at t = 1s. psspy.dist_branch_fault(6, 7, '1', 3, 0.0, [75.625e-5, 0]) ##3. Continue simulation to t = 1.1s. psspy.run(0, 1.1, 0, 0, 0) ##4. Trip line B6 – B7 and clear fault at t = 1.1s. psspy.dist_clear_fault() psspy.dist_branch_trip(6, 7, '1') ##5. Continue simulation to t = 6.1s. psspy.run(0, 6.1, 0, 0, 0) ##6. Reschedule generator with run-up M1 from 250 MW to 500 MW and run-down M2 from about 573 MW to 300 MW, and trip load at B7 at t = 6.1s at t = 6.1s psspy.increment_gref(30, '1', 0.25) psspy.increment_gref(31, '1', -0.273) psspy.dist_branch_trip(7, 71, '1') ##7. Continue simulation to t = 30s. psspy.run(0, 30, 0, 0, 0) ### Reconnect Load
psspy.conl(1, 0, 2, [0, 0], [51.36, 59.32, -228.04, 254.01]) psspy.bsys(1, 0, [0.0, 0.0], 0, [], 9, [40320, 40340, 40350, 40970, 40980, 40990, 41050, 41071, 41120], 0, [], 0, []) psspy.conl(1, 0, 2, [0, 0], [100.0, 0.0, 0.0, 100.0]) psspy.conl(0, 1, 2, [0, 0], [100.0, 0.0, -306.02, 303.0]) psspy.conl(0, 1, 3, [0, 0], [100.0, 0.0, -306.02, 303.0]) psspy.ordr(0) psspy.fact() psspy.tysl(0) psspy.bsys(0, 0, [0.4, 500.], 0, [], 0, [], 0, [], 0, []) # start simulation psspy.strt_2([0,0], OutputFilePath) psspy.run(0, 1, 1000, 1, 0) psspy.run(0, 5, 1000, 1, 0) psspy.dist_branch_fault(46523, 46660, '1', 1, 275.0, [0.00, -0.2E+10]) fault_name = 'ThreePhase' psspy.run(0, 5.12, 1000, 1, 0) psspy.dist_branch_trip(46523, 46660, '1') psspy.run(0, 20.12, 1000, 1, 0) psspy.dist_branch_close(46523,46660,r"""1""") psspy.run(0, 20.22, 1000, 1, 0) psspy.dist_branch_trip(46523, 46660, '1') psspy.run(0, 30, 1000, 1, 0) # start draw curves # new folder if necessary GraphPath = FigurePath + ClauseName + '/' + LoadScenario + '/' + fault_name if not os.path.exists(GraphPath): os.makedirs(GraphPath)