def main(): """ Calculates the t_ccl for given BusFaults and control coefficients """ control_coefs = [.3*x for x in range(0,20)] buses = range(1,40) builder = dynamic_simulation.DynamicSimulationBuilder().withRawFile("normal_case39.raw").withDyrFile("normal_case39.dyr").\ withEndTime(20).withNumIterations(2000) exportToLatex(buses,control_coefs,builder,.003,table_file="table_latex.txt",res_file="temp.txt")
def main(): """ Calculating the t_ccl for all bus faults on the case39 and a range of control_coefficients """ control_coefficients = [0.1 * x for x in range(0, 30)] control_objects = [ control.SimpleLocalControl(each) for each in control_coefficients ] builder = dynamic_simulation.DynamicSimulationBuilder().withRawFile("normal_case39.raw").withDyrFile("normal_case39.dyr").\ withEndTime(30).withNumIterations(1000) all_builders = getAllBuildersWithControl(getAllBusFaultsBuilders(builder), control_objects) calculatetccl(all_builders)
def main(): ds = dynamic_simulation.DynamicSimulationBuilder().withControl(control.NoControl()).withEndTime(15).withNumIterations(500).\ withRawFile("1rts96_reduced_gens.raw").withDyrFile("1rts96.dyr").withChannel(channel_utils.CHANNELS.P_LOAD).withExportFigures().\ withDisturbance(disturbances.LoadChange(2,.1,range(1,24),1)).build() ds.runSimulation() res, times = ds._channels.getFrequencysForPEVS() for f in res: s = [] t = [] for i in range(len(times) - 1): if times[i + 1] == times[i]: continue s.append((f[i + 1] - f[i]) / (times[i + 1] - times[i])) t.append(times[i + 1]) pylab.plot(t, s) pylab.show()
def main(): builder = dynamic_simulation.DynamicSimulationBuilder().withEndTime(30).withNumIterations(3000).\ withRawFile("1rts96_reduced_gens.raw").withDyrFile("1rts96.dyr").withChannel(channel_utils.CHANNELS.PEV_POWER) #hs = [i*0.05 for i in range(1,10)] h = 0.5 buses = [1,3,4,8,10,11,14,16,18,21] bus_arrays = [[1,3,10,14,16,18,21],[1,3,4,8,11,16,21],[3,4,8,10,11,16,21],[1,3,8,10,11,14,16],[9],[11],[6],[5],[20],[7],[22],[14],[10],[1],[21],[18],[1,2,5],[16,18,21],[10,11,14],\ [1,8,21],[4,8,11],[1,3,10],[4,8,11],[1,3,8],[3,4,10],[1,3,10,14,18],[4,8,11,16,21],[3,4,10,11,21],[8,10,11,14,18]] controls = [] for bus_array in bus_arrays: controls.append(control.LocalControlUniform(h,bus_array)) controls.append(control.SimpleLocalControl(h,bus_array)) #controls = [control.SimpleLocalControl(h,[1,3,10,14,16,18,21]),control.SimpleLocalControl(h,[1,3,4,8,11,16,21]),control.SimpleLocalControl(h,[3,4,8,10,11,16,21]),\ # control.SimpleLocalControl(h,[1,3,8,10,11,14,16])] #controls = [control.LocalControlUniform(h,[9]),control.LocalControlUniform(h,[12]),control.LocalControlUniform(h,[11]),\ # control.LocalControlUniform(h,[5]),control.LocalControlUniform(h,[6]),\ # control.LocalControlUniform(h,[20]),control.LocalControlUniform(h,[7]),control.LocalControlUniform(h,[22])] #controls = [control.NoControl(),control.SimpleLocalControl(h),control.LocalControlUniform(h),control.LocalControlAtOneBus(h,1),control.LocalControlAtOneBus(h,21),\ # control.LocalControlAtOneBus(h,14),control.LocalControlAtOneBus(h,10),control.LocalControlAtOneBus(h,4),control.LocalControlAtOneBus(h,18)] ds = [disturbances.BusFault(2,.03,19), disturbances.BranchTrip(2,2,9,3,"1"),disturbances.BranchTrip(2,.1,15,24,"1"),disturbances.BranchTrip(2,.03,14,16,"1"),disturbances.BranchTrip(2,.2,11,13,"1"),\ disturbances.BusFault(2,.06,5), disturbances.BusFault(2,.01,16), disturbances.BusFault(2,.01,21),disturbances.BusFault(2,.06,3)] with open("times4.txt","w") as f: pass with concurrent.futures.ProcessPoolExecutor(max_workers=7) as executor: for d in ds: for c in controls: dsim = copy.deepcopy(builder).withControl(c).withDisturbance(d).build() #executor.submit(asd,dsim,d,c) asd(dsim,d,c)
import channel_utils