oemof / oemof-tabular

Load oemof energy systems from tabular data sources.
https://oemof-tabular.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
7 stars 5 forks source link

Only one profile for efficiency possible #117

Open MaGering opened 1 year ago

MaGering commented 1 year ago

It is not possible to pass different foreign efficiency profiles, since the sequences name written into the datapackage.json is efficiency_profile for all components that have efficiency as attribute.

This is due to this code:

            # Define all undefined foreign keys for as <var name>_profile
            for key in foreign_keys:
                if key not in (
                    ["profile"] + list(config.FOREIGN_KEY_DESCRIPTORS)
                ):
                    if r.name in foreign_keys[key]:
                        r.descriptor["schema"]["foreignKeys"].append(
                            {
                                "fields": key,
                                "reference": {"resource": key + "_profile"},
                            }
                        )

In case where key equals to efficiency the name is set with reference to efficiency_profile. Instead it should be set to r.name + "_" + key + "_profile"

This way different efficiency sequences for different components can be passed.

nailend commented 1 year ago

@MaGering I am not sure if I understand the problem. Wouldn't it be enough to just pass another foreign key to the infer method and save the additional profiles in a separate csv file? At least, this is how its currently handled.

building.infer_metadata(
    package_name="oemof-tabular-dispatch-example",
    foreign_keys={
        "bus": ["volatile", "dispatchable", "storage", "load"],
        "profile": ["load", "volatile"],
        "from_to_bus": ["link"],
        "chp": [],
        "a_efficiency": ["dispatchable"],
        "b_efficiency": ["dispatchable"],
    },
    **kwargs,
)
nailend commented 1 year ago

I think I am getting it: You are having multiple components of the same type, e.g. heat_pumps, but you don't want to give all of them the same efficiencies due to e.g. local differences.

In this case it should be enough to write different names in the cells of the efficiency column of your component. Compare with the volatile component and respective volatile_profiles

MaGering commented 1 year ago

I think I am getting it: You are having multiple components of the same type, e.g. heat_pumps, but you don't want to give all of them the same efficiencies due to e.g. local differences.

In this case it should be enough to write different names in the cells of the efficiency column of your component. Compare with the volatile component and respective volatile_profiles

Yes exactly, that's the case where the problem occurs. For the field profile this works just fine. But how about that efficiency or marginal_cost etc.?

Concerning the solution in your first comment: Will oemof.tabular map it to the correct attribute if I put for example "heatpump_small_efficiency" in front of it? I assumed that the key must be named exactly the same as the name of the attribute. So that the key must be called marginal_cost for example and not wind_marginal_cost.

nailend commented 8 months ago

@MaGering sorry for not answering... is this solved anyways?