Пример #1
0
    def test_add_to_oemof_model(self):
        sim_params = SimulationParameters({})
        comp = PemElectrolyzer({
            "bus_h2": "bus1",
            "bus_el": "bus2",
            "bus_th": "bus3",
            "sim_params": sim_params
        })

        oemof_model = solph.EnergySystem(
            timeindex=sim_params.date_time_index[0:1],
            freq='{}min'.format(sim_params.interval_time)
        )
        comp.add_to_oemof_model({
            "bus1": solph.Bus(label="bus1"),
            "bus2": solph.Bus(label="bus2"),
            "bus3": solph.Bus(label="bus3")
        }, oemof_model)
        assert comp.model_h2 is not None and comp.model_th is not None

        assert type(comp.model_h2) == solph.custom.PiecewiseLinearTransformer
        assert type(comp.model_th) == solph.custom.PiecewiseLinearTransformer
        assert len(comp.model_h2.inputs) == 1
        assert len(comp.model_h2.outputs) == 1
        assert len(comp.model_th.inputs) == 1
        assert len(comp.model_th.outputs) == 1
Пример #2
0
class TestBasic:
    sim_params = SimulationParameters({})

    def test_init(self):

        comp = H2Chp({"sim_params": self.sim_params, "power_max": 1})
        assert comp.h2_input_max > 0

    def test_add_to_oemof_model(self):
        h2_chp = H2Chp({
            "power_max": 1,
            "bus_h2": "bus1",
            "bus_el": "bus2",
            "bus_th": "bus3",
            "sim_params": self.sim_params
        })

        oemof_model = solph.EnergySystem()
        h2_chp.add_to_oemof_model(
            {
                "bus1": solph.Bus(label="bus1"),
                "bus2": solph.Bus(label="bus2"),
                "bus3": solph.Bus(label="bus3")
            }, oemof_model)
        assert h2_chp.model_el is not None and h2_chp.model_th is not None

        assert len(oemof_model.entities) == 2
        assert type(h2_chp.model_el) == solph.custom.PiecewiseLinearTransformer
        assert type(h2_chp.model_th) == solph.custom.PiecewiseLinearTransformer
        assert len(h2_chp.model_el.inputs) == 1
        assert len(h2_chp.model_el.outputs) == 1
        assert len(h2_chp.model_th.inputs) == 1
        assert len(h2_chp.model_th.outputs) == 1
Пример #3
0
 def test_add_to_oemof_model(self):
     ch2 = CompressorH2({
         "bus_h2_in":
         "bus1",
         "bus_h2_out":
         "bus2",
         "bus_el":
         "bus3",
         "sim_params":
         SimulationParameters({"interval_time": 15}),
         "m_flow_max":
         60
     })
     oemof_model = solph.EnergySystem()
     component = ch2.add_to_oemof_model(
         {
             "bus1": solph.Bus(label="bus1"),
             "bus2": solph.Bus(label="bus2"),
             "bus3": solph.Bus(label="bus3"),
         }, oemof_model)
     assert type(component) == solph.Transformer
     assert len(component.inputs) == 2
     assert len(component.outputs) == 1
     for k, v in component.inputs.items():
         if str(k) == "bus1":
             assert v.nominal_value == 15
class TestBasic:

    sim_params = SimulationParameters({"interval_time": 30})

    def test_init(self):
        with pytest.raises(KeyError):
            ely = ElectrolyzerWasteHeat({"sim_params": self.sim_params})
        ely = ElectrolyzerWasteHeat({
            "bus_th": None,
            "power_max": 100,
            "sim_params": self.sim_params
        })
        assert ely.energy_max == 50  # 100W, 30 minutes
        assert ely.area_separator is not None

    def test_add_to_oemof_model(self):
        ely = ElectrolyzerWasteHeat({
            "bus_el": "bus1",
            "bus_h2": "bus2",
            "bus_th": "bus3",
            "sim_params": self.sim_params
        })
        oemof_model = solph.EnergySystem(
            timeindex=self.sim_params.date_time_index[0:1],
            freq='{}min'.format(self.sim_params.interval_time))
        ely.add_to_oemof_model(
            {
                "bus1": solph.Bus(label="bus1"),
                "bus2": solph.Bus(label="bus2"),
                "bus3": solph.Bus(label="bus3")
            }, oemof_model)
        assert ely.model_h2 is not None and ely.model_th is not None

        assert type(ely.model_th) == solph.custom.PiecewiseLinearTransformer
        assert len(ely.model_th.inputs) == 1
        assert len(ely.model_th.outputs) == 1

    def test_update_non_linear_behaviour(self):
        ely = ElectrolyzerWasteHeat({
            "bus_th": None,
            "sim_params": self.sim_params
        })
        ely.update_nonlinear_behaviour()

        # test supporting points. Assumes default values (apart from interval_time)
        # should any of these fail, have fun testing the associated functions

        n_supporting_point = 10
        temp = [295, 299, 303, 307, 310, 314, 317, 320, 323, 326, 327]
        h2 = [0, 103, 196, 283, 366, 445, 521, 594, 665, 733, 800]
        energy = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]

        for i in range(n_supporting_point + 1):
            points = ely.supporting_points
            assert temp[i] == int(points["temperature"][i])
            assert h2[i] == int(points["h2_produced"][i] * 1000)
            assert energy[i] == int(points["energy"][i] / 1000)
            assert points["energy_halved"][i] == points["energy"][i] / 2
            assert points["thermal_energy"][i] == 0
Пример #5
0
def plot_smooth_results(smooth_result,
                        comp_label_dict=comp_dict_german,
                        bus_dict=bus_dict_german,
                        y_dict=y_dict_german):
    """Create figures of smooth run.

    All plots are drawn in a new window.

    :param smooth_result: result from run_smooth containing all components
    :type smooth_result: list of :class:`~smooth.components.component.Component`
    :param comp_label_dict: component labels,
        key being the component name in the model and value the name to display.
        Defaults to comp_dict_german from example_plotting_dicts.
    :type comp_label_dict: dictionary, optional
    :param bus_dict: bus labels,
        key being the bus name in the model and value the name to display.
        Defaults to bus_dict_german from example_plotting_dicts.
    :type bus_dict: dictionary, optional
    :param y_dict: labels for y-axes,
        key being the bus names from the model to plot and value the y-axis labels.
        Defaults to y_dict_german from example_plotting_dicts.
    :type y_dict: dictionary, optional
    """

    # Extract dict containing the busses that will be plotted.
    busses_to_plot = extract_flow_per_bus(smooth_result, comp_label_dict)

    # get first sim_params from smooth_result component for interval_time
    sim_params = next(
        (comp.sim_params
         for comp in smooth_result if hasattr(comp, 'sim_params')),
        SimulationParameters({})  # default values
    )

    # Plot each bus in a new window.
    for this_bus in busses_to_plot:
        plt.figure()
        for this_component, this_flow in busses_to_plot[this_bus].items():
            # get time axis (in hours, interval_time is in minutes)
            timeseries = [
                sim_params.interval_time / 60 * t
                for t in range(len(this_flow))
            ]
            plt.plot(timeseries, this_flow, label=str(this_component))
        plt.legend()
        plt.xlabel('Stunden des Jahres')
        try:
            plt.title(bus_dict[this_bus])
            plt.ylabel(y_dict[this_bus])
        except KeyError:
            plt.title('bus: ' + this_bus)
            # no label for y axis
    plt.show(block=False)
Пример #6
0
class TestUpdate:

    sim_params = SimulationParameters({"interval_time": 30, "n_intervals": 2})
    sim_params.i_interval = 0
    oemof_model = solph.EnergySystem(timeindex=sim_params.date_time_index[0:1],
                                     freq='{}min'.format(
                                         sim_params.interval_time))

    def test_update_states(self):
        # simulate one smooth iteration
        # simulate a single hydrogen storage, not connected to anything
        bus_in = solph.Bus(label="foo")
        bus_out = solph.Bus(label="bar")
        self.oemof_model.add(bus_in)
        self.oemof_model.add(bus_out)

        s = StorageH2({
            "bus_in": "bus_in",
            "bus_out": "bus_out",
            "sim_params": self.sim_params
        })
        storage_h2_model = s.add_to_oemof_model(
            {
                "bus_in": bus_in,
                "bus_out": bus_out
            }, self.oemof_model)
        self.oemof_model.add(storage_h2_model)

        model_to_solve = solph.Model(self.oemof_model)

        # solve model
        oemof_results = model_to_solve.solve(solver='cbc',
                                             solve_kwargs={'tee': False})
        assert oemof_results["Solver"][0]["Status"] == "ok"
        results = solph.processing.results(model_to_solve)
        assert results is not None

        # update storage states
        s.update_states(results)
        s.update_var_costs()
        s.update_var_emissions()
        s.generate_results()

        assert hasattr(s, "states")
        assert "storage_level" in s.states.keys()
        assert "pressure" in s.states.keys()
        assert len(s.states["storage_level"]) == self.sim_params.n_intervals
        assert len(s.states["pressure"]) == self.sim_params.n_intervals
        assert s.states["storage_level"][
            self.sim_params.i_interval] == s.storage_level
        assert s.states["pressure"][self.sim_params.i_interval] == s.pressure
        assert s.storage_level > s.storage_level_min
Пример #7
0
def test_create_component_obj():
    # dummy sim_params
    sim_params = SimulationParameters({})
    test_path = os.path.join(os.path.dirname(__file__), 'test_timeseries')

    # can all components be created?
    _, _, files = next(os.walk("smooth/components/"))
    for f in files:
        if f == "__init__.py":
            continue
        if f == "component.py":
            # parent class
            continue
        if f.startswith("external"):
            # external components
            continue

        # get component name from file
        name, ext = f.split('.')
        # remove "component_" prefix from name
        name = "_".join(name.split("_")[1:])
        comp = {"component": name}

        # special arguments for some components
        if name == "electrolyzer_waste_heat":
            comp["bus_th"] = None
        if name == "fuel_cell_chp":
            comp["power_max"] = 1
        if name == "gas_engine_chp_biogas":
            comp["power_max"] = 1
        if name == "h2_chp":
            comp["power_max"] = 1
        if name.endswith("csv"):
            comp["csv_filename"] = "test_csv.csv"
            comp["path"] = test_path
        if name == "h2_refuel_cooling_system":
            comp["csv_filename"] = "test_csv.csv"
            comp["path"] = test_path
        if name == "air_source_heat_pump":
            # problem with oemof.thermal
            continue
        if name == "var_grid":
            comp["life_time"] = 1
            continue

        try:
            func.create_component_obj({"components": {
                "comp": comp
            }}, sim_params)
        except Exception:
            raise Exception("Exeption while creating {}".format(name))
class TestUpdate:

    sim_params = SimulationParameters({"interval_time": 30, "n_intervals": 2})
    sim_params.i_interval = 0
    oemof_model = solph.EnergySystem(timeindex=sim_params.date_time_index[0:1],
                                     freq='{}min'.format(
                                         sim_params.interval_time))

    def test_update_states(self):
        # simulate one smooth iteration
        # simulate a single electrolyzer with waste heat, not connected to other components
        bus_el = solph.Bus(label="bus_el")
        bus_h2 = solph.Bus(label="bus_h2")
        bus_th = solph.Bus(label="bus_th")
        self.oemof_model.add(bus_el)
        self.oemof_model.add(bus_h2)
        self.oemof_model.add(bus_th)

        ely = ElectrolyzerWasteHeat({
            "bus_el": "bus_el",
            "bus_h2": "bus_h2",
            "bus_th": "bus_th",
            "sim_params": self.sim_params
        })
        ely.add_to_oemof_model(
            {
                "bus_el": bus_el,
                "bus_h2": bus_h2,
                "bus_th": bus_th
            }, self.oemof_model)

        model_to_solve = solph.Model(self.oemof_model)

        # solve model
        oemof_results = model_to_solve.solve(solver='cbc',
                                             solve_kwargs={'tee': False})
        assert oemof_results["Solver"][0]["Status"] == "ok"
        results = solph.processing.results(model_to_solve)
        assert results is not None

        ely.update_states(results)
        # idle: cooling down, no water consumption
        assert ely.temperature < ely.temp_init
        assert ely.states["temperature"][0] == ely.temperature
        assert ely.states["water_consumption"][0] == 0
class TestBasic:
    sim_params = SimulationParameters({})

    def test_init(self):
        test_path = os.path.join(os.path.dirname(__file__), 'test_timeseries')

        rcs = H2RefuelCoolingSystem({
            "csv_filename": "test_csv.csv",
            "path": test_path
        })
        assert hasattr(rcs, "nominal_value")
        assert hasattr(rcs, "csv_separator")
        assert hasattr(rcs, "column_title")
        assert hasattr(rcs, "bus_el")
        assert hasattr(rcs, "cool_spec_energy")
        assert hasattr(rcs, "standby_energy")
        assert hasattr(rcs, "number_of_units")

        rcs = H2RefuelCoolingSystem({
            "csv_filename": "test_csv.csv",
            "path": test_path,
            "nominal_value": 1,
            "cool_spec_energy": 600,
            "standby_energy": 3000
        })
        assert rcs.nominal_value == 1
        assert rcs.electrical_energy.loc[0][0] == 1000

    def test_add_to_oemof_model(self):
        test_path = os.path.join(os.path.dirname(__file__), 'test_timeseries')
        self.sim_params.i_interval = 0

        rcs = H2RefuelCoolingSystem({
            "bus_el": "foo",
            "csv_filename": "test_csv.csv",
            "path": test_path,
            "sim_params": self.sim_params
        })

        oemof_model = solph.EnergySystem()
        component = rcs.add_to_oemof_model({"foo": solph.Bus(label="foo")},
                                           oemof_model)
        assert type(component) == solph.network.Sink
        assert len(component.inputs) == 1
        assert len(component.outputs) == 0
class TestBasic:
    sim_params = SimulationParameters({})

    def test_init(self):
        comp = GasEngineChpBiogas({
            "sim_params": self.sim_params,
            "power_max": 1
        })
        assert comp.bg_input_max > 0

        with pytest.raises(ValueError):
            # share != 1
            GasEngineChpBiogas({
                "sim_params": self.sim_params,
                "power_max": 1,
                "ch4_share": 0,
                "co2_share": 0
            })

    def test_add_to_oemof_model(self):
        comp = GasEngineChpBiogas({
            "power_max": 1,
            "bus_bg": "bus1",
            "bus_el": "bus2",
            "bus_th": "bus3",
            "sim_params": self.sim_params
        })

        oemof_model = solph.EnergySystem(
            timeindex=self.sim_params.date_time_index[0:1],
            freq='{}min'.format(self.sim_params.interval_time))
        comp.add_to_oemof_model(
            {
                "bus1": solph.Bus(label="bus1"),
                "bus2": solph.Bus(label="bus2"),
                "bus3": solph.Bus(label="bus3")
            }, oemof_model)
        assert comp.model_el is not None and comp.model_th is not None

        assert type(comp.model_el) == solph.custom.PiecewiseLinearTransformer
        assert type(comp.model_th) == solph.custom.PiecewiseLinearTransformer
        assert len(comp.model_el.inputs) == 1
        assert len(comp.model_el.outputs) == 1
        assert len(comp.model_th.inputs) == 1
        assert len(comp.model_th.outputs) == 1
class TestBasic:

    sim_params = SimulationParameters({})

    def test_init(self):

        test_path = os.path.join(os.path.dirname(__file__), 'test_timeseries')

        demand = EnergyDemandFromCsv({
            "csv_filename": "test_csv.csv",
            "path": test_path
        })
        assert hasattr(demand, "nominal_value")
        assert hasattr(demand, "csv_separator")
        assert hasattr(demand, "column_title")
        assert hasattr(demand, "bus_in")

        demand = EnergyDemandFromCsv({
            "csv_filename": "test_csv.csv",
            "path": test_path,
            "nominal_value": 2
        })
        assert demand.nominal_value == 2

        # todo: raise error if "None" is passed as csv_filename variable
        # todo: assert file is csv type

    def test_add_to_oemof_model(self):

        test_path = os.path.join(os.path.dirname(__file__), 'test_timeseries')
        self.sim_params.i_interval = 0

        demand = EnergyDemandFromCsv({
            "bus_in": "foo",
            "csv_filename": "test_csv.csv",
            "path": test_path,
            "sim_params": self.sim_params
        })
        oemof_model = solph.EnergySystem()
        component = demand.add_to_oemof_model({"foo": solph.Bus(label="foo")},
                                              oemof_model)
        assert type(component) == solph.network.Sink
        assert len(component.inputs) == 1
        assert len(component.outputs) == 0
Пример #12
0
class TestBasic:

    sim_params = SimulationParameters({"interval_time": 30})

    def test_init(self):
        ely = Electrolyzer({"power_max": 100, "sim_params": self.sim_params})
        assert ely.energy_max == 50  # 100W, 30 minutes
        assert ely.max_production_per_step is not None

    def test_add_to_oemof_model(self):
        ely = Electrolyzer({
            "bus_el": "bus1",
            "bus_h2": "bus2",
            "sim_params": self.sim_params
        })
        oemof_model = solph.EnergySystem()
        component = ely.add_to_oemof_model(
            {
                "bus1": solph.Bus(label="bus1"),
                "bus2": solph.Bus(label="bus2")
            }, oemof_model)
        assert type(component) == solph.custom.PiecewiseLinearTransformer
        assert len(component.inputs) == 1
        assert len(component.outputs) == 1

    def test_update_non_linear_behaviour(self):
        ely = Electrolyzer({"sim_params": self.sim_params})
        ely.update_nonlinear_behaviour()

        # test supporting points. Assumes default values (apart from interval_time)
        # should any of these fail, have fun testing the associated functions

        n_supporting_point = 10
        temp = [295, 299, 303, 307, 310, 314, 317, 320, 323, 326, 327]
        h2 = [0, 103, 196, 283, 366, 445, 521, 594, 665, 733, 800]
        energy = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]

        for i in range(n_supporting_point + 1):
            assert temp[i] == int(ely.supporting_points["temperature"][i])
            assert h2[i] == int(ely.supporting_points["h2_produced"][i] * 1000)
            assert energy[i] == int(ely.supporting_points["energy"][i] / 1000)
Пример #13
0
class TestBasic:

    sim_params = SimulationParameters({})
    test_path = os.path.join(os.path.dirname(__file__), 'test_timeseries')

    def test_init(self):

        sts = StratifiedThermalStorage({"sim_params": self.sim_params})
        assert sts.volume > 0

        # temperature from CSV: overide given argument
        sts = StratifiedThermalStorage({
            "sim_params": self.sim_params,
            "csv_filename": "test_csv.csv",
            "column_title": "Simple test csv",
            "temp_env": 0,
            "path": self.test_path
        })
        assert sts.temp_env != 0 and len(sts.temp_env) > 0

    def test_add_to_oemof_model(self):

        sts = StratifiedThermalStorage({
            "bus_in": "bus1",
            "bus_out": "bus2",
            "sim_params": self.sim_params
        })

        sts.sim_params.i_interval = 0

        oemof_model = solph.EnergySystem()
        component = sts.add_to_oemof_model(
            {
                "bus1": solph.Bus(label="bus1"),
                "bus2": solph.Bus(label="bus2")
            }, oemof_model)
        assert type(component) == solph.components.GenericStorage
        assert len(component.inputs) == 1
        assert len(component.outputs) == 1
Пример #14
0
class TestBasic:

    sim_params = SimulationParameters({})

    def test_init(self):
        s = StorageH2({"sim_params": self.sim_params})
        assert hasattr(s, "bus_in")
        assert hasattr(s, "bus_out")

        assert 0 < s.initial_storage_factor < 1

        assert s.storage_level_wanted is None

        s = StorageH2({
            "sim_params": self.sim_params,
            "storage_capacity": 100,
            "initial_storage_factor": 0.8,
            "slw_factor": 0.8
        })

        assert s.storage_level_init == 80
        assert s.storage_level_wanted == 80

    def test_prepare_simulation(self):
        s = StorageH2({
            "sim_params": self.sim_params,
            "vac_in": 3,
            "vac_out": 4
        })

        # uninitialized
        assert s.current_vac == [0, 0]

        # set VAC
        s.prepare_simulation(None)
        assert s.current_vac == [3, 4]

        s = StorageH2({
            "sim_params": self.sim_params,
            "storage_capacity": 100,
            "vac_low_in": 1,
            "vac_low_out": 2,
            "vac_in": 3,
            "vac_out": 4,
            "slw_factor": 1,
            "initial_storage_factor": 0.5
        })

        s.prepare_simulation(None)
        assert s.current_vac == [1, 2]
        assert s.delta_max == 100

    def test_add_to_oemof_model(self):
        s = StorageH2({
            "bus_in": "foo",
            "bus_out": "bar",
            "sim_params": self.sim_params
        })

        oemof_model = solph.EnergySystem()
        component = s.add_to_oemof_model(
            {
                "foo": solph.Bus(label="foo"),
                "bar": solph.Bus(label="bar")
            }, oemof_model)
        assert type(component) == solph.components.GenericStorage
        assert len(component.inputs) == 1
        assert len(component.outputs) == 1
Пример #15
0
class TestUpdate:

    sim_params = SimulationParameters({"interval_time": 60, "n_intervals": 2})
    sim_params.i_interval = 0

    def test_update_states(self):
        # simulate one smooth iteration

        oemof_model = solph.EnergySystem(
            timeindex=self.sim_params.date_time_index[0:1],
            freq='{}min'.format(self.sim_params.interval_time)
        )

        # build energy model with two batteries, not connected to anything
        bus1 = solph.Bus(label="bus1")
        bus2 = solph.Bus(label="bus2")
        oemof_model.add(bus1, bus2)
        # one battery with loss_rate
        b1 = Battery({
            "name": "bat1",
            "bus_in_and_out": "bus1",
            "soc_init": 1,
            "loss_rate": 12,  # 0.5/h
            "sim_params": self.sim_params
        })
        b1.prepare_simulation(None)
        b1.add_to_oemof_model({"bus1": bus1}, oemof_model)
        # one battery without loss rate
        b2 = Battery({
            "name": "bat2",
            "bus_in_and_out": "bus2",
            "loss_rate": 0,
            "sim_params": self.sim_params
        })
        b2.prepare_simulation(None)
        b2.add_to_oemof_model({"bus2": bus2}, oemof_model)
        model_to_solve = solph.Model(oemof_model)

        # solve model
        oemof_results = model_to_solve.solve(solver='cbc', solve_kwargs={'tee': False})
        assert oemof_results["Solver"][0]["Status"] == "ok"
        results = solph.processing.results(model_to_solve)
        assert results is not None

        # update battery states
        for battery in [b1, b2]:
            battery.update_flows(results)
            battery.update_states(results)
            battery.update_var_costs()
            battery.update_var_emissions()
            battery.generate_results()

            assert hasattr(battery, "states")
            assert "soc" in battery.states.keys()
            assert len(battery.states["soc"]) == self.sim_params.n_intervals
            assert battery.states["soc"][self.sim_params.i_interval] == battery.soc
            assert battery.soc > battery.soc_min

        # check loss rate
        assert b1.soc == 0.5
        assert b2.soc == b2.soc_init
Пример #16
0
class TestBasic:
    sim_params = SimulationParameters({})

    def test_init(self):
        fc_chp = FuelCellChp({"sim_params": self.sim_params})
        assert hasattr(fc_chp, "bus_h2")
        assert hasattr(fc_chp, "bus_el")
        assert hasattr(fc_chp, "bus_th")
        assert hasattr(fc_chp, "life_time")
        assert hasattr(fc_chp, "heating_value_h2")

        fc_chp = FuelCellChp({"sim_params": self.sim_params, "power_max": 100})
        assert fc_chp.power_max == 100
        assert fc_chp.h2_input_max == 20000 / 2463087
        # todo: move to actual component, then test what happens when other type is passed in
        if not isinstance(fc_chp.bp_load_el, list):
            raise TypeError(
                "A list is needed for the electrical efficiency load break points!"
            )
        if not isinstance(fc_chp.bp_eff_el, list):
            raise TypeError(
                "A list is needed for the electrical efficiency break points!")
        if not isinstance(fc_chp.bp_load_th, list):
            raise TypeError(
                "A list is needed for the thermal efficiency load break points!"
            )
        if not isinstance(fc_chp.bp_eff_th, list):
            raise TypeError(
                "A list is needed for the thermal efficiency break points!")

        bp_ld_el = [
            0.0, 0.0481, 0.0694, 0.0931, 0.1272, 0.1616, 0.2444, 0.5912, 1.0
        ]
        h2_cons_el = [this_bp * (20000 / 2463087) for this_bp in bp_ld_el]

        for i in range(len(h2_cons_el)):
            assert h2_cons_el[i] == fc_chp.bp_h2_consumed_el[i]

        bp_ld_th = [0.0, 0.0517, 0.1589, 0.2482, 1.0]
        h2_cons_th = [this_bp * (20000 / 2463087) for this_bp in bp_ld_th]

        for i in range(len(h2_cons_th)):
            assert h2_cons_th[i] == fc_chp.bp_h2_consumed_th[i]

    def test_add_to_oemof_model(self):
        fc_chp = FuelCellChp({
            "bus_h2": "bus1",
            "bus_el": "bus2",
            "bus_th": "bus3",
            "sim_params": self.sim_params
        })

        oemof_model = solph.EnergySystem(
            timeindex=self.sim_params.date_time_index[0:1],
            freq='{}min'.format(self.sim_params.interval_time))
        fc_chp.add_to_oemof_model(
            {
                "bus1": solph.Bus(label="bus1"),
                "bus2": solph.Bus(label="bus2"),
                "bus3": solph.Bus(label="bus3")
            }, oemof_model)
        assert fc_chp.model_el is not None and fc_chp.model_th is not None

        assert type(fc_chp.model_el) == solph.custom.PiecewiseLinearTransformer
        assert type(fc_chp.model_th) == solph.custom.PiecewiseLinearTransformer
        assert len(fc_chp.model_el.inputs) == 1
        assert len(fc_chp.model_el.outputs) == 1
        assert len(fc_chp.model_th.inputs) == 1
        assert len(fc_chp.model_th.outputs) == 1