Add location attribute to each bus

E.g. "DE0 0 residential rural heat" has location "DE0 0", and "EU gas"
and "co2 atmosphere" have location "EU".
This commit is contained in:
Tom Brown 2020-08-11 11:07:55 +02:00
parent 1d6b6483e0
commit a59b2bce19

View File

@ -61,8 +61,10 @@ def add_carrier_buses(n, carriers):
n.add("Carrier", n.add("Carrier",
carrier) carrier)
n.add("Bus", #use madd to get location inserted
"EU " + carrier, n.madd("Bus",
["EU " + carrier],
location="EU",
carrier=carrier) carrier=carrier)
#use madd to get carrier inserted #use madd to get carrier inserted
@ -108,7 +110,9 @@ def add_co2_tracking(n):
co2_emissions=-1.) co2_emissions=-1.)
#this tracks CO2 in the atmosphere #this tracks CO2 in the atmosphere
n.add("Bus","co2 atmosphere", n.madd("Bus",
["co2 atmosphere"],
location="EU",
carrier="co2") carrier="co2")
#NB: can also be negative #NB: can also be negative
@ -119,7 +123,9 @@ def add_co2_tracking(n):
bus="co2 atmosphere") bus="co2 atmosphere")
#this tracks CO2 stored, e.g. underground #this tracks CO2 stored, e.g. underground
n.add("Bus","co2 stored", n.madd("Bus",
["co2 stored"],
location="EU",
carrier="co2 stored") carrier="co2 stored")
#TODO move cost to data/costs.csv #TODO move cost to data/costs.csv
@ -506,8 +512,9 @@ def add_generation(network):
network.add("Carrier", network.add("Carrier",
carrier) carrier)
network.add("Bus", network.madd("Bus",
"EU " + carrier, ["EU " + carrier],
location="EU",
carrier=carrier) carrier=carrier)
#use madd to get carrier inserted #use madd to get carrier inserted
@ -583,6 +590,7 @@ def insert_electricity_distribution_grid(network):
network.madd("Bus", network.madd("Bus",
nodes+ " low voltage", nodes+ " low voltage",
location=nodes,
carrier="low voltage") carrier="low voltage")
network.madd("Link", network.madd("Link",
@ -631,6 +639,7 @@ def insert_electricity_distribution_grid(network):
network.madd("Bus", network.madd("Bus",
nodes + " home battery", nodes + " home battery",
location=nodes,
carrier="home battery") carrier="home battery")
network.madd("Store", network.madd("Store",
@ -679,6 +688,7 @@ def add_storage(network):
network.madd("Bus", network.madd("Bus",
nodes+ " H2", nodes+ " H2",
location=nodes,
carrier="H2") carrier="H2")
network.madd("Link", network.madd("Link",
@ -751,6 +761,7 @@ def add_storage(network):
network.madd("Bus", network.madd("Bus",
nodes + " battery", nodes + " battery",
location=nodes,
carrier="battery") carrier="battery")
network.madd("Store", network.madd("Store",
@ -846,6 +857,7 @@ def add_transport(network):
network.madd("Bus", network.madd("Bus",
nodes, nodes,
location=nodes,
suffix=" EV battery", suffix=" EV battery",
carrier="Li ion") carrier="Li ion")
@ -932,6 +944,7 @@ def add_heat(network):
network.madd("Bus", network.madd("Bus",
nodes[name] + " " + name + " heat", nodes[name] + " " + name + " heat",
location=nodes[name],
carrier=name + " heat") carrier=name + " heat")
## Add heat load ## Add heat load
@ -983,6 +996,7 @@ def add_heat(network):
network.madd("Bus", network.madd("Bus",
nodes[name] + " " + name + " water tanks", nodes[name] + " " + name + " water tanks",
location=nodes[name],
carrier=name + " water tanks") carrier=name + " water tanks")
network.madd("Link", network.madd("Link",
@ -1232,10 +1246,12 @@ def add_biomass(network):
network.madd("Bus", network.madd("Bus",
["EU biogas"], ["EU biogas"],
location="EU",
carrier="biogas") carrier="biogas")
network.madd("Bus", network.madd("Bus",
["EU solid biomass"], ["EU solid biomass"],
location="EU",
carrier="solid biomass") carrier="solid biomass")
network.madd("Store", network.madd("Store",
@ -1342,6 +1358,7 @@ def add_industry(network):
network.madd("Bus", network.madd("Bus",
["solid biomass for industry"], ["solid biomass for industry"],
location="EU",
carrier="solid biomass for industry") carrier="solid biomass for industry")
network.madd("Load", network.madd("Load",
@ -1375,6 +1392,7 @@ def add_industry(network):
network.madd("Bus", network.madd("Bus",
["gas for industry"], ["gas for industry"],
location="EU",
carrier="gas for industry") carrier="gas for industry")
network.madd("Load", network.madd("Load",
@ -1423,8 +1441,9 @@ def add_industry(network):
carrier="H2 for shipping", carrier="H2 for shipping",
p_set = nodal_energy_totals.loc[nodes,["total international navigation","total domestic navigation"]].sum(axis=1)*1e6*options['shipping_average_efficiency']/costs.at["fuel cell","efficiency"]/8760.) p_set = nodal_energy_totals.loc[nodes,["total international navigation","total domestic navigation"]].sum(axis=1)*1e6*options['shipping_average_efficiency']/costs.at["fuel cell","efficiency"]/8760.)
network.add("Bus", network.madd("Bus",
"Fischer-Tropsch", ["Fischer-Tropsch"],
location="EU",
carrier="Fischer-Tropsch") carrier="Fischer-Tropsch")
#use madd to get carrier inserted #use madd to get carrier inserted
@ -1513,6 +1532,7 @@ def add_industry(network):
network.madd("Bus", network.madd("Bus",
["process emissions"], ["process emissions"],
location="EU",
carrier="process emissions") carrier="process emissions")
#this should be process emissions fossil+feedstock #this should be process emissions fossil+feedstock
@ -1660,6 +1680,7 @@ if __name__ == "__main__":
n.loads["carrier"] = "electricity" n.loads["carrier"] = "electricity"
n.buses["location"] = n.buses.index
if snakemake.config["foresight"]=='myopic': if snakemake.config["foresight"]=='myopic':
add_lifetime_wind_solar(n) add_lifetime_wind_solar(n)