Skip to content

Commit

Permalink
updated scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Eggimann committed Feb 22, 2019
1 parent 64ab00b commit 43384ac
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
12 changes: 10 additions & 2 deletions energy_demand/scripts/init_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ def switch_calculations(
techs_affected_spatial_f=data['assumptions'].techs_affected_spatial_f,
service_switches_from_capacity=service_switches_incl_cap)

'''print(share_s_tech_ey_p.keys())
try:
print("aa " + str(share_s_tech_ey_p['E06000001'][2050]))
except:
print("FFAIL")
print("aa " + str(share_s_tech_ey_p['electrical_equipment']['E06000001'][2050]))
pass
raise Exception("TT")'''
# ========================================================================================
# Fuel switches
#
Expand All @@ -242,7 +250,7 @@ def switch_calculations(
for sector in data['sectors'][submodel_name]:
print("... calculating fuel switches {} {} {}".format(submodel_name, enduse, sector))
print("======d======= " + str(data['assumptions'].fuel_tech_p_by[enduse][sector]))
print("Z " + str(s_fueltype_by_p))
print("Z " + str(s_fueltype_by_p[sector][enduse]))
diffusion_param_tech[enduse][sector] = sig_param_calc_incl_fuel_switch(
narrative_timesteps,
data['assumptions'].base_yr,
Expand Down Expand Up @@ -773,7 +781,7 @@ def sig_param_calc_incl_fuel_switch(
print("---------- switches %s %s %s", enduse, crit_switch_service, crit_fuel_switch)
if crit_all_the_same:
print("... calc parameters of `{}` for year `{}` {}".format(enduse, switch_yr, sector))
print("FF {} ".format(s_tech_switched_p[any_region][switch_yr]))
print("FF {} {} ".format(switch_yr, s_tech_switched_p[any_region][switch_yr]))
print("---")
print(fuel_tech_p_by)
sig_param_tech_all_regs_value = s_generate_sigmoid.tech_sigmoid_parameters(
Expand Down
16 changes: 8 additions & 8 deletions energy_demand/technologies/fuel_service_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def create_switches_from_s_shares(
enduse,
s_tech_by_p,
switch_technologies,
specified_tech_enduse_by,
tech_enduse_by,
enduse_switches,
s_tot_defined,
sector,
Expand All @@ -136,8 +136,8 @@ def create_switches_from_s_shares(
Service share per technology in base year
switch_technologies : list
Technologies involved in switch
specified_tech_enduse_by : list
Technologies per enduse
tech_enduse_by : list
Technologies of enduse and sector
enduse_switches : list
Switches
s_tot_defined : float
Expand All @@ -157,7 +157,7 @@ def create_switches_from_s_shares(
# Calculate relative by proportion of not assigned technologies in base year
tech_not_assigned_by_p = {}

for tech in specified_tech_enduse_by[enduse][sector]:
for tech in tech_enduse_by:
if tech not in switch_technologies:
tech_not_assigned_by_p[tech] = s_tech_by_p[sector][enduse][tech]

Expand All @@ -172,7 +172,7 @@ def create_switches_from_s_shares(
tech_not_assigned_by_p[tech] = share_by / tot_share_not_assigned

# Get all defined technologies in base year
for tech in specified_tech_enduse_by[enduse][sector]:
for tech in tech_enduse_by:
if tech not in switch_technologies:
if s_tot_defined == 1.0:
# All technologies are fully defined
Expand Down Expand Up @@ -310,12 +310,12 @@ def autocomplete_switches(
Criteria wheter regionally specific or not
regions : list
Regions
f_diffusion :
f_diffusion :
Diffusion factors
techs_affected_spatial_f : list
Technologies affected by spatial diffusion
service_switches_from_capacity : list
Transformed capacity swithces into service switches
Transformed capacity swithces into service switches
Returns
-------
Expand Down Expand Up @@ -383,7 +383,7 @@ def autocomplete_switches(
enduse=enduse,
s_tech_by_p=s_tech_by_p,
switch_technologies=switch_technologies,
specified_tech_enduse_by=specified_tech_enduse_by,
tech_enduse_by=specified_tech_enduse_by[enduse][sector],
enduse_switches=enduse_switches,
s_tot_defined=s_tot_defined,
sector=sector,
Expand Down
2 changes: 1 addition & 1 deletion tests/technologies/test_fuel_service_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_create_switches_from_s_shares():
enduse='heating',
s_tech_by_p= {None:{'heating': {'techA': 0.2, 'techB': 0.8}}},
switch_technologies=['techA'],
specified_tech_enduse_by={'heating': {None: ['techA', 'techB']}},
tech_enduse_by=['techA', 'techB'],
enduse_switches=enduse_switches,
s_tot_defined=0.6,
sector=None,
Expand Down

0 comments on commit 43384ac

Please sign in to comment.