Exemplo n.º 1
0
    # 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'])
    # # Plot variables
    # plt.plot(oRecord.t_axis,rel_delta01 * 180 / np.pi, 'r-', oRecord.t_axis, rel_delta11 *180 / np.pi, 'b-', oRecord.t_axis, rel_delta21 *180 / np.pi, 'g-')
    # plt.xlabel('Time (s)')
Exemplo n.º 2
0
 #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
 oRecord.write_output('output.csv')