Exemple #1
0
def create_and_run_model(override, iterative_warmstart=False):
    locations = """
        locations:
            1:
                techs: ['ccgt', 'demand_power']
                override:
                    ccgt:
                        constraints:
                            e_cap.max: 100
                    demand_power:
                        constraints:
                            r: -10
        links:
    """
    config_run = """
        mode: plan
        model: ['{techs}', '{locations}']
        subset_t: ['2005-01-01', '2005-01-02']
    """
    override = AttrDict.from_yaml_string(override)
    override.set_key('solver', solver)
    override.set_key('solver_io', solver_io)
    with tempfile.NamedTemporaryFile(delete=False) as f:
        f.write(locations.encode('utf-8'))
        f.read()
        model = common.simple_model(config_run=config_run,
                                    config_locations=f.name,
                                    override=override,
                                    path=_add_test_path('common/t_constraints_from_file'))
    model.run(iterative_warmstart)
    return model
def create_and_run_model(override=""):
    locations = """
        locations:
            1:
                techs: ['ccgt', 'test_storage', 'demand_power',
                        'unmet_demand_power']
                override:
                    ccgt:
                        constraints:
                            e_cap.max: 9.5
                    demand_power:
                        x_map: '1: demand'
                        constraints:
                            r: file=demand-sin_r.csv
        links:
    """
    config_run = """
        mode: plan
        model: ['{techs}', '{locations}']
        subset_t: ['2005-01-01', '2005-01-03']
    """

    override = AttrDict.from_yaml_string(override)
    override.set_key('solver', solver)
    override.set_key('solver_io', solver_io)
    with tempfile.NamedTemporaryFile(delete=False) as f:
        f.write(locations.encode('utf-8'))
        f.read()
        model = common.simple_model(config_run=config_run,
                                    config_locations=f.name,
                                    override=override)
    model.run()
    return model
Exemple #3
0
def create_and_run_model(override, iterative_warmstart=False,
                         demand_file='demand-static_r.csv'):
    locations = """
        locations:
            1:
                techs: ['ccgt', 'demand_power', 'unmet_demand_power']
                override:
                    ccgt:
                        constraints:
                            e_cap.max: 100
                    demand_power:
                        x_map: '1: demand'
                        constraints:
                            r: file={demand_file}
        links:
    """
    config_run = """
        mode: operate
        model: ['{techs}', '{locations}']
    """
    override = AttrDict.from_yaml_string(override)
    override.set_key('solver', solver)
    override.set_key('solver_io', solver_io)
    with tempfile.NamedTemporaryFile(delete=False) as f:
        f.write(locations.format(demand_file=demand_file).encode('utf-8'))
        f.read()
        model = common.simple_model(config_run=config_run,
                                    config_locations=f.name,
                                    override=override,
                                    path=_add_test_path('common/t_time'))
    model.run(iterative_warmstart)
    return model
def create_and_run_model(override=""):
    locations = """
        locations:
            1:
                techs: ['ccgt', 'test_conversion', 'test_conversion_plus',
                        'demand_power', 'unmet_demand_power', 'demand_heat',
                        'demand_low_T', 'demand_V_low_T', 'supply_gas',
                        'unmet_demand_heat', 'unmet_demand_low_T',
                        'unmet_demand_V_low_T']
                override:
                    ccgt:
                        constraints:
                            e_cap.max: 30
                    test_conversion:
                        constraints:
                            e_cap.max: 20
                    demand_power:
                        constraints:
                            r: -10
                    demand_heat:
                        constraints:
                            r: -6
            2:
                techs: ['demand_V_low_T', 'unmet_demand_V_low_T']
                override:
                    demand_low_T:
                        constraints:
                            e_cap.max: 0
    """
    config_run = """
        mode: plan
        model: ['{techs}', '{locations}']
        subset_t: ['2005-01-01', '2005-01-01']
    """

    override = AttrDict.from_yaml_string(override)
    override.set_key('solver', solver)
    override.set_key('solver_io', solver_io)
    with tempfile.NamedTemporaryFile(delete=False) as f:
        f.write(locations.encode('utf-8'))
        f.read()
        model = common.simple_model(config_run=config_run,
                                    config_locations=f.name,
                                    override=override)
    model.run()
    return model
Exemple #5
0
def create_and_run_model(override=""):
    locations = """
        locations:
            1:
                techs: ['ccgt', 'test_conversion', 'test_conversion_plus',
                        'demand_power', 'unmet_demand_power',
                        'demand_heat', 'unmet_demand_heat',
                        'demand_low_T', 'unmet_demand_low_T',
                        'demand_V_low_T', 'unmet_demand_V_low_T']
                override:
                    demand_power:
                            x_map: '1: demand'
                            constraints:
                                r_scale_to_peak: -10
                                r: file=demand-sin_r.csv
                    demand_heat:
                            x_map: '1: demand'
                            constraints:
                                r_scale_to_peak: -5
                                r: file=demand-sin_r.csv
                    demand_low_T:
                            constraints:
                                r: -12
                    demand_V_low_T:
                            constraints:
                                r: -12
        links:
    """
    config_run = """
        mode: plan
        model: ['{techs}', '{locations}']
        subset_t: ['2005-01-01', '2005-01-01']
    """

    override = AttrDict.from_yaml_string(override)
    override.set_key('solver', solver)
    override.set_key('solver_io', solver_io)
    with tempfile.NamedTemporaryFile(delete=False) as f:
        f.write(locations.encode('utf-8'))
        f.read()
        model = common.simple_model(config_run=config_run,
                                    config_locations=f.name,
                                    override=override)
    model.run()
    return model