def theworks(context): """All technologies. >>> class C: pass >>> c = C() >>> c.generators = [] >>> theworks(c) >>> len(c.generators) 28 """ re100(context) # pylint: disable=redefined-outer-name # use polygon 38 geo = generators.Geothermal_HSA(regions.nsw, 0, configfile.get('generation', 'hsa-geothermal-trace'), 38) pt = generators.ParabolicTrough(regions.nsw, 0, 2, 6, configfile.get('generation', 'cst-trace'), 12) coal = generators.Black_Coal(regions.nsw, 0) coal_ccs = generators.Coal_CCS(regions.nsw, 0) ccgt = generators.CCGT(regions.nsw, 0) ccgt_ccs = generators.CCGT_CCS(regions.nsw, 0) ocgt = generators.OCGT(regions.nsw, 0) batt = generators.Battery(regions.nsw, 0, 0) diesel = generators.Diesel(regions.nsw, 0) dem = generators.DemandResponse(regions.nsw, 0, 300) g = context.generators context.generators = [geo, pt, coal, coal_ccs, ccgt, ccgt_ccs] + \ g[:-4] + [ocgt, diesel, batt, dem]
def _one_per_poly(region): """Return three lists of wind, PV and CST generators, one per polygon. >>> import regions >>> wind, pv, cst = _one_per_poly(regions.tas) >>> len(wind), len(pv), len(cst) (4, 4, 4) """ pv = [] wind = [] cst = [] for poly in polygons.in_region(region): wind.append(generators.Wind(region, 0, configfile.get('generation', 'wind-trace'), poly - 1, delimiter=',', build_limit=polygons.wind_limit[poly], label='poly %d wind' % poly)) pv.append(generators.PV1Axis(region, 0, configfile.get('generation', 'pv1axis-trace'), poly - 1, build_limit=polygons.pv_limit[poly], label='poly %d PV' % poly)) cst.append(generators.CentralReceiver(region, 0, 2, 6, configfile.get('generation', 'cst-trace'), poly - 1, build_limit=polygons.cst_limit[poly], label='poly %d CST' % poly)) return wind, pv, cst
def _one_per_poly(region): """Return three lists of wind, PV and CST generators, one per polygon. >>> import regions >>> wind, pv, cst = _one_per_poly(regions.tas) >>> len(wind), len(pv), len(cst) (4, 4, 4) """ pv = [] wind = [] cst = [] for poly in region.polygons: wind.append( generators.Wind( poly, 0, configfile.get("generation", "wind-trace"), poly - 1, delimiter=",", build_limit=polygons.wind_limit[poly], label="poly %d wind" % poly, ) ) pv.append( generators.PV1Axis( poly, 0, configfile.get("generation", "pv1axis-trace"), poly - 1, build_limit=polygons.pv_limit[poly], label="poly %d PV" % poly, ) ) cst.append( generators.CentralReceiver( poly, 0, 2, 6, configfile.get("generation", "cst-trace"), poly - 1, build_limit=polygons.cst_limit[poly], label="poly %d CST" % poly, ) ) return wind, pv, cst
def theworks(context): """All technologies. >>> class C: pass >>> c = C() >>> c.generators = [] >>> theworks(c) >>> len(c.generators) 190 """ re100(context) # pylint: disable=redefined-outer-name geo = generators.Geothermal_HSA(polygons.wildcard, 0, configfile.get("generation", "hsa-geothermal-trace"), 38) pt = generators.ParabolicTrough(polygons.wildcard, 0, 2, 6, configfile.get("generation", "cst-trace"), 12) coal = generators.Black_Coal(polygons.wildcard, 0) coal_ccs = generators.Coal_CCS(polygons.wildcard, 0) ccgt = generators.CCGT(polygons.wildcard, 0) ccgt_ccs = generators.CCGT_CCS(polygons.wildcard, 0) ocgt = generators.OCGT(polygons.wildcard, 0) batt = generators.Battery(polygons.wildcard, 0, 0) diesel = generators.Diesel(polygons.wildcard, 0) dem = generators.DemandResponse(polygons.wildcard, 0, 300) g = context.generators context.generators = [geo, pt, coal, coal_ccs, ccgt, ccgt_ccs] + g[:-4] + [ocgt, diesel, batt, dem]
def re100_geothermal_hsa(context): """100% renewables plus HSA geothermal. >>> class C: pass >>> c = C() >>> re100_geothermal_hsa(c) >>> isinstance(c.generators[0], generators.Geothermal_HSA) True """ re100(context) g = context.generators poly = 38 geo = generators.Geothermal_HSA( poly, 0, configfile.get("generation", "hsa-geothermal-trace"), poly, "HSA geothermal" ) context.generators = [geo] + g
def re100_geothermal_egs(context): """100% renewables plus EGS geothermal. >>> class C: pass >>> c = C() >>> re100_geothermal_egs(c) >>> isinstance(c.generators[0], generators.Geothermal) True """ re100(context) g = context.generators poly = 14 geo = generators.Geothermal_EGS( poly, 0, configfile.get("generation", "egs-geothermal-trace"), poly, "EGS geothermal" ) context.generators = [geo] + g
def re100_geothermal_hsa(context): """100% renewables plus HSA geothermal. >>> class C: pass >>> c = C() >>> re100_geothermal_hsa(c) >>> isinstance(c.generators[0], generators.Geothermal_HSA) True """ re100(context) g = context.generators geo = generators.Geothermal_HSA(regions.vic, 0, configfile.get('generation', 'hsa-geothermal-trace'), 38, # (polygon 38) 'HSA geothermal') context.generators = [geo] + g
def re100_geothermal_egs(context): """100% renewables plus EGS geothermal. >>> class C: pass >>> c = C() >>> re100_geothermal_egs(c) >>> isinstance(c.generators[0], generators.Geothermal) True """ re100(context) g = context.generators geo = generators.Geothermal_EGS(regions.qld, 0, configfile.get('generation', 'egs-geothermal-trace'), 14, # (polygon 14) 'EGS geothermal') context.generators = [geo] + g
import matplotlib.dates as mdates import matplotlib.pyplot as plt import numpy as np import configfile import consts import generators import regions import polygons # Demand is in 30 minute intervals. NOTE: the number of rows in the # demand file now dictates the number of timesteps in the simulation. # Generate a list of column numbers cols = tuple(range(regions.numregions + 2)) demand = np.genfromtxt(configfile.get('demand', 'demand-trace'), comments='#', usecols=cols) demand = demand.transpose() # Check for date, time and n demand columns (for n regions). assert demand.shape[0] == 2 + regions.numregions, demand.shape[0] # The number of rows must be even. assert demand.shape[1] % 2 == 0, "odd number of rows in half-hourly demand data" # Find the start date of the demand data. f = open(configfile.get('demand', 'demand-trace')) for line in f: if re.search(r'^\s*#', line): continue cols = line.split() year, month, day = cols[0].split('/') startdate = dt.datetime(int(year), int(month), int(day))
def re100(context): """100% renewable electricity. >>> class C: pass >>> c = C() >>> re100(c) >>> len(c.generators) 184 """ from generators import CentralReceiver, Wind, PV1Axis, Hydro, PumpedHydro, Biofuel result = [] # The following list is in merit order. for g in [PV1Axis, Wind, PumpedHydro, Hydro, CentralReceiver, Biofuel]: if g == PumpedHydro: result += [h for h in _hydro() if isinstance(h, PumpedHydro)] elif g == Hydro: result += [h for h in _hydro() if isinstance(h, Hydro) and not isinstance(h, PumpedHydro)] elif g == Biofuel: for poly in range(1, 44): result.append(g(poly, 0, label="polygon %d GT" % poly)) elif g == PV1Axis: for poly in range(1, 44): result.append( g( poly, 0, configfile.get("generation", "pv1axis-trace"), poly - 1, build_limit=polygons.pv_limit[poly], label="polygon %d PV" % poly, ) ) elif g == CentralReceiver: for poly in range(1, 44): result.append( g( poly, 0, 2, 6, configfile.get("generation", "cst-trace"), poly - 1, build_limit=polygons.cst_limit[poly], label="polygon %d CST" % poly, ) ) elif g == Wind: for poly in range(1, 44): result.append( g( poly, 0, configfile.get("generation", "wind-trace"), poly - 1, delimiter=",", build_limit=polygons.wind_limit[poly], label="polygon %d wind" % poly, ) ) else: # pragma: no cover raise ValueError context.generators = result
def re100(context): # pylint: disable=unused-argument """100% renewable electricity. >>> class C: pass >>> c = C() >>> re100(c) >>> len(c.generators) 22 """ from generators import CentralReceiver, Wind, PV1Axis, Hydro, PumpedHydro, Biofuel capfactor = {CentralReceiver: 0.60, Wind: 0.40, PV1Axis: 0.33, Hydro: None, PumpedHydro: None, Biofuel: None} energy_fraction = {CentralReceiver: 0.40, Wind: 0.30, PV1Axis: 0.10, Hydro: None, PumpedHydro: None, Biofuel: None} result = [] # The following list is in merit order. for g in [PV1Axis, Wind, PumpedHydro, Hydro, CentralReceiver, Biofuel]: if capfactor[g] is not None: capacity = 204.4 * consts.twh * energy_fraction[g] / (capfactor[g] * 8760) if g == PumpedHydro: result += [h for h in _hydro() if isinstance(h, PumpedHydro)] elif g == Hydro: result += [h for h in _hydro() if isinstance(h, Hydro) and not isinstance(h, PumpedHydro)] elif g == Biofuel: # 24 GW biofuelled gas turbines (fixed) # distribute 24GW of biofuelled turbines across chosen regions # the region list is in order of approximate demand rgns = [regions.nsw, regions.qld, regions.sa, regions.tas, regions.vic] for r in rgns: result.append(Biofuel(r, 24000 / len(rgns), label=r.id + ' GT')) elif g == PV1Axis: # Hand chosen polygons with high capacity factors for poly in [14, 21, 13, 37]: rgn = polygons.region_table[poly] # Put 25% PV capacity in each region. result.append(g(rgn, capacity * 0.25, configfile.get('generation', 'pv1axis-trace'), poly - 1, build_limit=polygons.pv_limit[poly], label='polygon %d PV' % poly)) elif g == CentralReceiver: polys = [14, 20, 21] capacity /= len(polys) for poly in polys: rgn = polygons.region_table[poly] result.append(g(rgn, capacity, 2, 6, configfile.get('generation', 'cst-trace'), poly - 1, build_limit=polygons.cst_limit[poly], label='polygon %d CST' % poly)) elif g == Wind: # Hand chosen polygons with high capacity factors for poly in [1, 20, 24, 39, 43]: rgn = polygons.region_table[poly] # Put 20% wind capacity in each region. result.append(g(rgn, capacity * 0.2, configfile.get('generation', 'wind-trace'), poly - 1, delimiter=',', build_limit=polygons.wind_limit[poly], label='polygon %d wind' % poly)) else: # pragma: no cover raise(ValueError) context.generators = result