When I tested OSeMOSYS-PuLP using UTOPIA_BASE.xlsx, the CapacityFactor dictionary was loaded in Python correctly; that is, as described in the Excel file.
Nonetheless, when I started working on a personal file, the code seemed to only read the values for one of the timeslices and assign them to all the remaining ones. This happened under the condition that I was only defining the capacity factor for one (1) technology. Therefore, I looked into the original code (enumrated by lines):
CapacityFactor_specified = tuple([(str(r), str(t), str(l), str(y))
for r, t, l, y in zip(p_df[p_df['PARAM'] == "CapacityFactor"].REGION,
p_df[p_df['PARAM'] == "CapacityFactor"].TECHNOLOGY,
p_df[p_df['PARAM'] == "CapacityFactor"].TIMESLICE,
p_df[p_df['PARAM'] == "CapacityFactor"].YEAR)])
CapacityFactor = {str(r): {str(t): {str(l): {str(y): p_df[(p_df['PARAM'] == "CapacityFactor") & (p_df['REGION'] == r) & (p_df['TECHNOLOGY'] == t) & (p_df['YEAR'] == y)].VALUE.iat[0] if (str(r),str(t),str(l),str(y)) in CapacityFactor_specified else CapacityFactor_default_value for y in YEAR} for l in TIMESLICE} for t in TECHNOLOGY} for r in REGION}
I saw that in the third line, the CapacityFactor is not using the condition for TIMESLICE. So I changed it to:
CapacityFactor = {str(r): {str(t): {str(l): {str(y): p_df[(p_df['PARAM'] == "CapacityFactor") &
(p_df['REGION'] == r) &
(p_df['TECHNOLOGY'] == t) &
(p_df['YEAR'] == y) &
(p_df['TIMESLICE'] == l)].VALUE.iat[0]
if (str(r),str(t),str(l),str(y)) in CapacityFactor_specified
else CapacityFactor_default_value for y in YEAR}
for l in TIMESLICE} for t in TECHNOLOGY} for r in REGION}
See that I added: & (p_df['TIMESLICE'] == l)
And it then it read it properly. Although this could also be some sort of incompatibility I have been having with Excel.
Please let me know whether adding that is actually necessary.
Hello,
When I tested OSeMOSYS-PuLP using UTOPIA_BASE.xlsx, the CapacityFactor dictionary was loaded in Python correctly; that is, as described in the Excel file.
Nonetheless, when I started working on a personal file, the code seemed to only read the values for one of the timeslices and assign them to all the remaining ones. This happened under the condition that I was only defining the capacity factor for one (1) technology. Therefore, I looked into the original code (enumrated by lines):
CapacityFactor
CapacityFactor_default_value = p_default_df[p_default_df['PARAM'] == "CapacityFactor"].VALUE.iat[0]
I saw that in the third line, the CapacityFactor is not using the condition for TIMESLICE. So I changed it to:
See that I added:
& (p_df['TIMESLICE'] == l)
And it then it read it properly. Although this could also be some sort of incompatibility I have been having with Excel.
Please let me know whether adding that is actually necessary.
Best,
Luiscarlos