def main(): # only called if solve.py is executed from a command line # (not called by 'import solve') parser.add_argument('--tag', type=str) parser.add_argument('--ph_year', type=int) parser.add_argument('--ph_mw', type=float) parser.add_argument('--biofuel_limit', type=float) parser.add_argument('--dr_shares', nargs='+', type=float) parser.add_argument('--ev_flat', action='store_true', default=None) # Note: ev_flat has to have None as default, otherwise it's always considered to be set # True or False on the command line and that overrides the scenario definitions. cmd_line_args = scenarios.cmd_line_args() required_scenarios = scenarios.get_required_scenario_names() if len(required_scenarios) > 0: # user specified some specific scenarios to run for s in required_scenarios: # flag that the scenario is running/completed scenarios.report_completed_scenario(s) # get the scenario definition, including any changes specified on the command line args = scenarios.get_scenario_args(s) # solve the model print "\n\n=======================================================================" print 'running scenario {s}'.format(s=append_tag(s, args["tag"])) print 'arguments: {}'.format(args) print "=======================================================================" solve(**args) else: # they want to run the standard scenarios, possibly with some command-line modifications while True: s = scenarios.start_next_standard_scenario() if s is None: break else: # solve the model print 'running scenario {s}'.format(s=append_tag(s["scenario_name"], s["tag"])) print 'arguments: {}'.format(s) solve(**s)
scenario_list_fossil = [ # '--scenario_name x_low_oil_price -n rps -n renewables -n demand_response -n pumped_hydro --inputs_subdir low_oil_price', # '--scenario_name x_high_oil_price -n rps -n renewables -n demand_response -n pumped_hydro --inputs_subdir high_oil_price', # '--scenario_name x_lng_oil_peg -n rps -n renewables -n demand_response -n pumped_hydro --inputs_subdir lng_oil_peg', # '--scenario_name x_high_oil_and_lng_price -n rps -n renewables -n demand_response -n pumped_hydro --inputs_subdir high_lng_oil_peg', # '--scenario_name no_wind_ph2037_150 --ph_year=2037 --ph_mw=150 -n wind', ] with open('scenarios_to_run.txt', 'w') as f: f.writelines(s + '\n' for s in scenario_list) scenarios.parser.add_argument('--skip_cf', action='store_true') scenarios.parser.add_argument('--time_sample') cmd_line_args = scenarios.cmd_line_args() # particular settings chosen for this case # (these will be passed as arguments when the queries are run) args = dict( inputs_dir = cmd_line_args.get('inputs_dir', 'inputs'), # directory to store data in skip_cf = cmd_line_args['skip_cf'], # skip writing capacity factors file if specified (for speed) time_sample = cmd_line_args.get('time_sample', "rps_mini"), # could be 'tiny', 'rps', 'rps_mini' or possibly # '2007', '2016test', 'rps_test_45', or 'main' load_zones = ('Oahu',), # subset of load zones to model load_scen_id = "med", # "hist"=pseudo-historical, "med"="Moved by Passion", "flat"=2015 levels fuel_scen_id = 'EIA_ref', # '1'=low, '2'=high, '3'=reference, 'EIA_ref'=EIA-derived reference level ev_scen_id = 2, # 1=low, 2=high, 3=reference (omitted or None=none) enable_must_run = 0, # should the must_run flag be converted to # set minimum commitment for existing plants?
#!/usr/bin/env python import sys, os from textwrap import dedent path_to_core = os.path.abspath( os.path.join(os.path.dirname(__file__), 'switch-hawaii-core')) sys.path.append(path_to_core) import scenario_data, scenarios scenarios.parser.add_argument('--skip_cf', action='store_true') scenarios.parser.add_argument('--write_rhos', action='store_true') scenarios.parser.add_argument('--time_sample') cmd_line_args = scenarios.cmd_line_args() # particular settings chosen for this case # (these will be passed as arguments when the queries are run) args = dict( inputs_dir=cmd_line_args.get('inputs_dir', 'inputs'), # directory to store data in skip_cf=cmd_line_args[ 'skip_cf'], # skip writing capacity factors file if specified (for speed) time_sample=cmd_line_args.get( 'time_sample', "rps_mini"), # could be 'tiny', 'rps', 'rps_mini' or possibly # '2007', '2016test', 'rps_test_45', or 'main' load_zones=('Oahu', ), # subset of load zones to model load_scen_id= "med", # "hist"=pseudo-historical, "med"="Moved by Passion", "flat"=2015 levels fuel_scen_id=