def adding_assets_to_energysystem_model(dict_values, dict_model, model,
                                            **kwargs):
        """

        Parameters
        ----------
        dict_values: dict
            dict of simulation data

        dict_model:
            Updated list of assets in the oemof energy system model

        model: oemof.solph.network.EnergySystem
            Model of oemof energy system

        Returns
        -------

        """
        logging.info("Adding components to oemof energy system model...")

        # Busses have to be defined first
        for bus in dict_values[ENERGY_BUSSES]:
            D1.bus(model, dict_values[ENERGY_BUSSES][bus][LABEL], **dict_model)

        # Adding step by step all assets defined within the asset groups
        for asset_group in ACCEPTED_ASSETS_FOR_ASSET_GROUPS:
            if asset_group in dict_values:
                for asset in dict_values[asset_group]:
                    type = dict_values[asset_group][asset][OEMOF_ASSET_TYPE]
                    # Checking if the asset type is one accepted for the asset group (security measure)
                    if type in ACCEPTED_ASSETS_FOR_ASSET_GROUPS[asset_group]:
                        # if so, then the appropriate function of D1 should be called
                        if type == OEMOF_TRANSFORMER:
                            D1.transformer(model,
                                           dict_values[asset_group][asset],
                                           **dict_model)
                        elif type == OEMOF_SINK:
                            D1.sink(model, dict_values[asset_group][asset],
                                    **dict_model)
                        elif type == OEMOF_SOURCE:
                            D1.source(model, dict_values[asset_group][asset],
                                      **dict_model)
                        elif type == OEMOF_GEN_STORAGE:
                            D1.storage(model, dict_values[asset_group][asset],
                                       **dict_model)
                        else:
                            raise UnknownOemofAssetType(
                                f"Asset {asset} has type {type}, "
                                f"but this type is not a defined oemof asset type."
                            )

                    else:
                        raise WrongOemofAssetForGroupError(
                            f"Asset {asset} has type {type}, "
                            f"but this type is not an asset type attributed to asset group {asset_group}"
                            f" for oemof model generation.")

        logging.debug("All components added.")
        return model
    def test_source_non_dispatchable_fix(self):
        dict_asset = self.dict_values[ENERGY_PRODUCTION][
            "non_dispatchable_source_fix"]
        dict_asset[TIMESERIES] = self.time_series
        dict_asset[TIMESERIES_PEAK] = {
            "unit": "kWp/H",
            "value": self.time_series.max()
        }

        D1.source(
            model=self.model,
            dict_asset=dict_asset,
            source=self.sources,
            bus=self.busses,
        )

        # checks done with helper function (see func for more information)
        self.helper_test_source_in_model_and_dict(dict_asset=dict_asset,
                                                  dispatchable=False,
                                                  mode="fix")
    def test_source_dispatchable_fix_normalized_timeseries(self):
        dict_asset = self.dict_values[ENERGY_PRODUCTION][
            "dispatchable_source_fix"]
        dict_asset[TIMESERIES_NORMALIZED] = self.time_series / max(
            self.time_series)
        dict_asset[TIMESERIES_PEAK] = {
            "unit": "kWp/H",
            "value": self.time_series.max()
        }

        D1.source(
            model=self.model,
            dict_asset=dict_asset,
            source=self.sources,
            bus=self.busses,
        )
        # checks done with helper function (see func for more information)
        self.helper_test_source_in_model_and_dict(
            dict_asset=dict_asset,
            dispatchable=True,
            mode="fix",
            timeseries="normalized",
        )