# Program options dynopt = {} dynopt['h'] = 0.01 # step length (s) dynopt['t_sim'] = 15 # simulation time (s) dynopt['max_err'] = 0.0001 # Maximum error in network iteration (voltage mismatches) dynopt['max_iter'] = 25 # Maximum number of network iterations dynopt['verbose'] = False # option for verbose messages dynopt['fn'] = 50 # Nominal system frequency (Hz) # Integrator option #dynopt['iopt'] = 'mod_euler' dynopt['iopt'] = 'runge_kutta' # 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
# Program options dynopt = {} dynopt['h'] = 0.01 # step length (s) dynopt['t_sim'] = 15 # simulation time (s) dynopt[ 'max_err'] = 0.0001 # Maximum error in network iteration (voltage mismatches) dynopt['max_iter'] = 25 # Maximum number of network iterations dynopt['verbose'] = False # option for verbose messages dynopt['fn'] = 50 # Nominal system frequency (Hz) # Integrator option #dynopt['iopt'] = 'mod_euler' dynopt['iopt'] = 'runge_kutta' # 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
# Create dictionary of elements elements = {} for i in range(n_gen): #G_i = sym_order6b('Generator'+ str(i) +'.mach', dynopt) G_i = ext_grid('GEN' + str(i), i, 0.1198, H[i], dynopt) elements[G_i.id] = G_i #Ctrl_i = controller('volt_ctrl'+ str(i) +'.dyn', dynopt) #elements[Ctrl_i.id] = Ctrl_i #sec_ctrl_i = controller('sec_volt_ctrl'+ str(i) +'.dyn', dynopt) #elements[sec_ctrl_i.id] = sec_ctrl_i freq_ctrl_i = controller('freq_ctrl' + str(i) + '.dyn', dynopt) elements[freq_ctrl_i.id] = freq_ctrl_i #i=0 #Ctrl_i = controller('ctrl'+ str(i) +'.dyn', dynopt) #elements[Ctrl_i.id] = Ctrl_i sync1 = controller('sync.dyn', dynopt) elements[sync1.id] = sync1 # Create event stack oEvents = events('events.evnt') # Create recorder object oRecord = recorder('recorder.rcd') # Run simulation