# elements[B3.id] = B3 # elements[B4.id] = B4 # Create event stack oEvents = events('events.evnt') # event1 = [10.3, 'LOAD', 2, -10, -10] # event2 = [10.35, 'LOAD', 2, -10, -10] # event3 = [1.38, 'LOAD',3, -100, -100] # oEvents.event_stack.append(event1) # oEvents.event_stack.append(event2) # oEvents.event_stack.append(event3) # oEvents = mf.addRandomEvents(ppc, oEvents, 5, dynopt['h'], dynopt['t_sim'], 0.05, 0.03) # Create recorder object oRecord = recorder('recorder.rcd') # Run simulation oRecord = run_sim(ppc, elements, dynopt, oEvents, oRecord) # # Calculate relative rotor angles # rel_delta01 = np.array(oRecord.results['GEN1:delta']) # rel_delta02 = np.array(oRecord.results['BUS1:delta']) # rel_delta11 = np.array(oRecord.results['GEN2:delta']) # rel_delta12 = np.array(oRecord.results['BUS2:delta']) # rel_delta21 = np.array(oRecord.results['GEN3:delta']) # rel_delta22 = np.array(oRecord.results['BUS3:delta']) # rel_delta31 = np.array(oRecord.results['GEN1:P']) # rel_delta32 = np.array(oRecord.results['BUS1:P']) # rel_delta42 = np.array(oRecord.results['BUS2:P']) # rel_delta52 = np.array(oRecord.results['BUS3:P'])
oMach = sym_order6a('smib_round.mach', dynopt) #oMach = sym_order4('smib_round.mach', iopt) oGrid = ext_grid('GRID1', 0, 0.1, 99999, dynopt) # Create dictionary of elements # Hard-coded placeholder (to be replaced by a more generic loop) elements = {} elements[oCtrl.id] = oCtrl elements[oMach.id] = oMach elements[oGrid.id] = oGrid # Create event stack oEvents = events('smib_events.evnt') # Create recorder object oRecord = recorder('smib_recorder.rcd') # Run simulation oRecord = run_sim(ppc,elements,dynopt,oEvents,oRecord) # Calculate relative rotor angles rel_delta = np.array(oRecord.results['GEN1:delta']) - np.array(oRecord.results['GRID1:delta']) # Plot variables #plt.plot(oRecord.t_axis,rel_delta) plt.plot(oRecord.t_axis,oRecord.results['GEN1:Vt']) plt.xlabel('Time (s)') plt.ylabel('GEN1:Vt (pu)') plt.show() # Write recorded variables to output file
oMach = sym_order6a('smib_round.mach', dynopt) #oMach = sym_order4('smib_round.mach', iopt) oGrid = ext_grid('GRID1', 0, 0.1, 99999, dynopt) # Create dictionary of elements # Hard-coded placeholder (to be replaced by a more generic loop) elements = {} elements[oCtrl.id] = oCtrl elements[oMach.id] = oMach elements[oGrid.id] = oGrid # Create event stack oEvents = events('smib_events.evnt') # Create recorder object oRecord = recorder('smib_recorder.rcd') # Run simulation oRecord = run_sim(ppc, elements, dynopt, oEvents, oRecord) # Calculate relative rotor angles rel_delta = np.array(oRecord.results['GEN1:delta']) - np.array( oRecord.results['GRID1:delta']) # Plot variables #plt.plot(oRecord.t_axis,rel_delta) plt.plot(oRecord.t_axis, oRecord.results['GEN1:Vt']) plt.xlabel('Time (s)') plt.ylabel('GEN1:Vt (pu)') plt.show()
G1 = sym_order6b('G1.mach', dynopt) G2 = sym_order6b('G2.mach', dynopt) G3 = sym_order6b('G3.mach', dynopt) # Create dictionary of elements elements = {} elements[G1.id] = G1 elements[G2.id] = G2 elements[G3.id] = G3 #elements[oCtrl.id] = oCtrl # Create event stack oEvents = events('events.evnt') # Create recorder object oRecord = recorder('recorder.rcd') # Run simulation oRecord = run_sim(ppc,elements,dynopt,oEvents,oRecord) # Calculate relative rotor angles rel_delta1 = np.array(oRecord.results['GEN2:delta']) - np.array(oRecord.results['GEN1:delta']) rel_delta2 = np.array(oRecord.results['GEN3:delta']) - np.array(oRecord.results['GEN1:delta']) # Plot variables plt.plot(oRecord.t_axis,rel_delta1 * 180 / np.pi, 'r-', oRecord.t_axis, rel_delta2 *180 / np.pi, 'b-') plt.xlabel('Time (s)') plt.ylabel('Rotor Angles (relative to GEN1)') plt.show() # Write recorded variables to output file