def outages(self, name): scen = Scenario("outage" + name, "opf") scen.kill_bus = [bus.bus_id for bus in self.busses if fail(bus.pout)] scen.kill_line = [line.name for line in self.lines if fail(line.pout)] scen.kill_gen = [generator.name for generator in self.generators if fail(generator.pout)] scen.kill_line = scen.kill_line + self.crow_fails(scen.kill_line) # quantize the forecast scen.all_demand = buslevel.quantised_05(buslevel.random_bus_forecast()) return scen
def failures(self, name): scen = Scenario("failure" + name, "pf") scen.kill_bus = [bus.bus_id for bus in self.busses if fail(bus.pfail)] scen.kill_line = [line.name for line in self.lines if fail(line.pfail)] scen.kill_gen = [generator.name for generator in self.generators if fail(generator.pfail)] scen.kill_line = scen.kill_line + self.crow_fails(scen.kill_line) # NOTE:: 1.0 should be the value of forcast load which will always # be lower than 1, but it shouldn't make too much difference. scen.all_demand = buslevel.quantised_05(buslevel.actual_load2(1.0)) # mx = [g.pfail for g in self.generators] # print "%s\t%f\t%f\t%f\t%d\n" % (name, min(mx), max(mx), avg(mx), len(mx)) return scen