Skip to content

aeromaps.models.impacts.generic_energy_model.common.energy_carriers_factory

Factory to create energy carriers models based on yaml configuration files.

AviationEnergyCarriersFactory

Factory to create energy carriers models based on yaml configuration files.

create_carrier staticmethod

create_carrier(pathway_name, energy_carriers_data, resources_data, process_data)

Create energy carrier models based on the configuration data.

Parameters:

Name Type Description Default
pathway_name str

Name of the energy pathway to create models for.

required
energy_carriers_data dict

Configuration data for energy carriers.

required
resources_data dict

Configuration data for energy resources.

required
process_data dict

Configuration data for processes.

required

Returns:

Type Description
dict

Dictionary of instantiated energy carrier models.

Source code in aeromaps/models/impacts/generic_energy_model/common/energy_carriers_factory.py
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
@staticmethod
def create_carrier(pathway_name, energy_carriers_data, resources_data, process_data):
    """
    Create energy carrier models based on the configuration data.

    Parameters
    ----------
    pathway_name : str
        Name of the energy pathway to create models for.
    energy_carriers_data : dict
        Configuration data for energy carriers.
    resources_data : dict
        Configuration data for energy resources.
    process_data : dict
        Configuration data for processes.

    Returns
    -------
    dict
        Dictionary of instantiated energy carrier models.
    """
    pathway_data = energy_carriers_data[pathway_name]
    environmental_model_type = pathway_data["environmental_model"]
    cost_model_type = pathway_data["cost_model"]
    # case distinction between energy model types
    # TODO split the config file into two separate files here instead in the inits ?
    models = {}
    if environmental_model_type == "top-down":
        models.update(
            {
                f"{pathway_name}_top_down_unit_environmental": TopDownEnvironmental(
                    f"{pathway_name}_top_down_unit_environmental",
                    pathway_data,
                    resources_data,
                    process_data,
                )
            }
        )
    elif environmental_model_type == "bottom-up":
        models.update(
            {
                f"{pathway_name}_bottom_up_unit_environmental": BottomUpEnvironmental(
                    f"{pathway_name}_bottom_up_unit_environmental",
                    pathway_data,
                    resources_data,
                    process_data,
                )
            }
        )
    else:
        raise ValueError(f"Unsupported environmental model type: {environmental_model_type}")
    if cost_model_type == "top-down":
        models.update(
            {
                f"{pathway_name}_top_down_unit_cost": TopDownCost(
                    f"{pathway_name}_top_down_unit_cost",
                    pathway_data,
                    resources_data,
                    process_data,
                )
            }
        )
    elif cost_model_type == "bottom-up":
        models.update(
            {
                f"{pathway_name}_bottom_up_unit_cost": BottomUpCost(
                    f"{pathway_name}_bottom_up_unit_cost",
                    pathway_data,
                    resources_data,
                    process_data,
                )
            }
        )
    else:
        raise ValueError(f"Unsupported cost model type: {cost_model_type}")
    # add capacity model
    if environmental_model_type == "bottom-up" or cost_model_type == "bottom-up":
        models.update(
            {
                f"{pathway_name}_bottom_up_capacity": BottomUpCapacity(
                    f"{pathway_name}_bottom_up_capacity", pathway_data, process_data
                )
            }
        )
    if pathway_data.get("abatement_cost"):
        if cost_model_type != "bottom-up":
            raise ValueError(
                "Abatement cost model can only be used with bottom-up cost models."
            )
        if environmental_model_type != "bottom-up":
            print(
                "⚠️ Warning: Using Top-Down environmental model for abatement cost. Not recommended."
            )
        # add abatement cost and effective models
        models.update(
            {
                f"{pathway_name}_bottom_up_abatement_cost": EnergyAbatementCost(
                    f"{pathway_name}_bottom_up_abatement_cost",
                    pathway_name,
                    pathway_data,
                ),
                f"{pathway_name}_abatement_effective": EnergyAbatementEffective(
                    f"{pathway_name}_abatement_effective",
                    pathway_name,
                ),
            }
        )
    if pathway_data.get("abatement_cost_reference"):
        models.update(
            {
                f"{pathway_name}_abatement_cost_reference": ReferenceAbatementCost(
                    f"{pathway_name}_abatement_cost_reference",
                    pathway_name,
                    pathway_data,
                )
            }
        )
    return models

instantiate_energy_carriers_models staticmethod

instantiate_energy_carriers_models(energy_carriers_data, pathways_manager)

Instantiates energy carriers related models. Energy use choice, means, mean LHV, ...

Parameters:

Name Type Description Default
energy_carriers_data dict

Configuration data for energy carriers.

required
pathways_manager PathwaysManager

Manager for handling energy pathways.

required

Returns:

Type Description
dict

Dictionary of instantiated energy carriers models.

Source code in aeromaps/models/impacts/generic_energy_model/common/energy_carriers_factory.py
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
@staticmethod
def instantiate_energy_carriers_models(energy_carriers_data, pathways_manager):
    """
    Instantiates energy carriers related models. Energy use choice, means, mean LHV, ...

    Parameters
    ----------
    energy_carriers_data : dict
        Configuration data for energy carriers.
    pathways_manager : PathwaysManager
        Manager for handling energy pathways.

    Returns
    -------
    dict
        Dictionary of instantiated energy carriers models.
    """
    return {
        "energy_use_choice": EnergyUseChoice(
            "energy_use_choice", energy_carriers_data, pathways_manager
        ),
        "energy_carriers_means": EnergyCarriersMeans(
            "energy_carriers_means", energy_carriers_data, pathways_manager
        ),
        "energy_carriers_mean_lhv": EnergyCarriersMeanLHV("energy_carriers_mean_lhv"),
    }

instantiate_resource_consumption_models staticmethod

instantiate_resource_consumption_models(resources_data, pathways_manager)

Instantiates energy resource consumption models.

Parameters:

Name Type Description Default
resources_data dict

Configuration data for energy resources.

required
pathways_manager PathwaysManager

Manager for handling energy pathways.

required

Returns:

Type Description
dict

Dictionary of instantiated energy resource consumption models.

Source code in aeromaps/models/impacts/generic_energy_model/common/energy_carriers_factory.py
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
@staticmethod
def instantiate_resource_consumption_models(resources_data, pathways_manager):
    """
    Instantiates energy resource consumption models.

    Parameters
    ----------
    resources_data : dict
        Configuration data for energy resources.
    pathways_manager : PathwaysManager
        Manager for handling energy pathways.

    Returns
    -------
    dict
        Dictionary of instantiated energy resource consumption models.
    """
    models = {}
    for resource in resources_data.keys():
        models.update(
            {
                f"{resource}_consumption": EnergyResourceConsumption(
                    f"{resource}_consumption", resources_data[resource], pathways_manager
                )
            }
        )
    models.update(
        {
            "overall_resources_consumption": OverallResourcesConsumption(
                "overall_resources_consumption",
                resources_data,
            ),
        }
    )
    return models