add the function add_missing_carrier

add_missing_carrier() are applied on python script where new components are added. The function runs ideally after all of the new components are added and before add_nice_carrier_names()
This commit is contained in:
virio-andreyana 2023-04-25 14:43:04 +02:00 committed by GitHub
parent e550ba915d
commit 71c1a7fbef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,6 +120,11 @@ def calculate_annuity(n, r):
else:
return 1 / n
def add_missing_carrier(n):
components = [n.buses, n.generators, n.lines, n.links, n.storage_units, n.stores]
for c in components:
missing_carrier = np.setdiff1d(c.carrier.unique(),n.carriers.index)
n.madd("Carrier",missing_carrier)
def _add_missing_carriers_from_costs(n, costs, carriers):
missing_carriers = pd.Index(carriers).difference(n.carriers.index)
@ -832,7 +837,8 @@ if __name__ == "__main__":
estimate_renewable_capacities(n, snakemake.config)
update_p_nom_max(n)
add_missing_carrier(n)
add_nice_carrier_names(n, snakemake.config)
n.meta = snakemake.config