# B3 = sym_order6b('B3.mach', dynopt) # B4 = sym_order6b('B4.mach', dynopt) # Create dictionary of elements elements = {} # elements[oCtrl.id] = oCtrl elements[G1.id] = G1 elements[G2.id] = G2 # elements[G3.id] = G3 # elements[B1.id] = B1 # elements[B2.id] = B2 # 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)
# Create dynamic model objects oCtrl = controller('smib.dyn', dynopt) 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)')
# Create dynamic model objects oCtrl = controller('smib.dyn', dynopt) 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)')
dynopt['iopt'] = 'runge_kutta' # Create dynamic model objects 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)')
# Integrator option dynopt['iopt'] = 'mod_euler' #dynopt['iopt'] = 'runge_kutta' # Create dynamic model objects oMach = asym_1cage('motor.mach', dynopt) oGrid = ext_grid('GRID1', 0, 0.1, 99999, dynopt) # Create dictionary of elements elements = {} elements[oMach.id] = oMach elements[oGrid.id] = oGrid # Create event stack oEvents = events('test_events.evnt') # Create recorder object oRecord = recorder('recorder.rcd') # Run simulation oRecord = run_sim(ppc, elements, dynopt, oEvents, oRecord) # Plot variables plt.plot(oRecord.t_axis, oRecord.results['MOT1:Vt']) plt.xlabel('Time (s)') plt.ylabel('MOT1:Vt (pu)') plt.show() # Write recorded variables to output file oRecord.write_output('output.csv')
# Integrator option dynopt['iopt'] = 'mod_euler' #dynopt['iopt'] = 'runge_kutta' # Create dynamic model objects oMach = asym_1cage('motor.mach', dynopt) oGrid = ext_grid('GRID1', 0, 0.1, 99999, dynopt) # Create dictionary of elements elements = {} elements[oMach.id] = oMach elements[oGrid.id] = oGrid # Create event stack oEvents = events('test_events.evnt') # Create recorder object oRecord = recorder('recorder.rcd') # Run simulation oRecord = run_sim(ppc,elements,dynopt,oEvents,oRecord) # Plot variables plt.plot(oRecord.t_axis,oRecord.results['MOT1:Vt']) plt.xlabel('Time (s)') plt.ylabel('MOT1:Vt (pu)') plt.show() # Write recorded variables to output file oRecord.write_output('output.csv')