add EU oil bus already when adding land transport to be able to run the model without industry and avoid warning of missing bus. Add a check for scaling down total electricity demand to avoid warning of invalid value in double_scalar (#100)

This commit is contained in:
lisazeyen 2021-05-25 09:03:02 +02:00 committed by GitHub
parent e367f8ae11
commit 0e3d21f5a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1154,6 +1154,12 @@ def add_land_transport(network):
if ice_share > 0:
if "EU oil" not in network.buses.index:
network.madd("Bus",
["EU oil"],
location="EU",
carrier="oil")
network.madd("Load",
nodes,
suffix=" land transport oil",
@ -1769,6 +1775,7 @@ def add_industry(network):
#remove today's industrial electricity demand by scaling down total electricity demand
for ct in n.buses.country.unique():
loads = n.loads.index[(n.loads.index.str[:2] == ct) & (n.loads.carrier == "electricity")]
if n.loads_t.p_set[loads].empty: continue
factor = 1 - industrial_demand.loc[loads,"current electricity"].sum()/n.loads_t.p_set[loads].sum().sum()
n.loads_t.p_set[loads] *= factor