Closed yardasol closed 3 years ago
Note: commit f32e095 also extends MinActivity of IMPSOL, CHWS, and MaxCapacity of IMPWIND
@samgdotson @robfairh I'm finished with the databases. Some notes:
MinActivity
for GSLVCL
, DSLVCL
, and E85VCL
in both UIUC_2050_land.sql
and UIUC_2050_cost.sql
Efficiency
for IMPNATGAS
, IMPGSL
, IMPDSL
, IMPE85
, and IMPH2
in both UIUC_2050_land.sql
and UIUC_2050_cost.sql
MaxCapacity
for NTURBINE
in both UIUC_2050_land.sql
and UIUC_2050_cost.sql
snakemake
:
Traceback (most recent call last):
File "/home/ooblack/anaconda3/envs/temoa-py3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/home/ooblack/anaconda3/envs/temoa-py3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/ooblack/projects/temoa-py3/temoa/temoa_model/__main__.py", line 28, in <module>
from temoa_model import *
File "/home/ooblack/projects/temoa-py3/temoa/temoa_model/temoa_model.py", line 26, in <module>
from temoa_run import *
File "/home/ooblack/projects/temoa-py3/temoa/temoa_model/temoa_run.py", line 50, in <module>
from pformat_results import pformat_results
File "/home/ooblack/projects/temoa-py3/temoa/temoa_model/pformat_results.py", line 39, in <module>
from DB_to_Excel import make_excel
ModuleNotFoundError: No module named 'DB_to_Excel'
Where do I find this missing module? I feel like it should be in the temoa-py3 environment considering the file that calls it is in the temoa repo
- The next error I got was
source error message="Index '('uiuc', 2046, 'IMPWIND', 2016)' is not valid for indexed component 'CostVariable'"
This error occurred because the specified vintage for that year was beyond the lifetime of the technology. I went into the
CostVariable
table and updated the vintages such that the years would work out.
@samgdotson What values did you set the vintages to?
@samgdotson see my above comment
@yardasol It doesn't really matter as long as the cost for a particular year doesn't rely on a vintage that older than the lifetime of the technology. Pick your favorite.
E.g. Wind lasts for 25 years (check?), then 2046-2016 > 25. So those don't work. But as long as YEAR - VINTAGE < LIFETIME then it will work.
@samgdotson I'm running into a similar issue with IMPSOL
regarding vintages and technology lifetimes. I assume the simulation does this because it at the end of the technology lifetime, it wants to buy more but sees a vintage from a year in the past instead of a vintage for the current year. Is that correct?
It's okay for the vintage and the year to be different, but for a given year you cannot have a vintage that is older than the lifetime of the technology.
What I'm asking is why the simulation behaves this way.
You can't buy, use, nor maintain a technology that has exceeded its lifetime. I'm not really understanding your question.
My understanding after browsing the TEMOA docs and forums (I found this post to be particularly helpful) is that the pairing of a technology and a vintage is called a process. The process is the fundamental unit that TEMOA operates with. In the case of our IMPWIND
and IMPSOLAR
technologies, there exists a corresponding process for each vintage that exists. Currently we only have one vintage -- and therefore one process -- each for IMPWIND
and IMPSOLAR
. When these processes reach the end of their lifetimes specified by LifetimeTech
, they end.
With this in mind, I do not see the logic in just changing the vintage of the processes we have been working with. I would like to understand your reasoning a bit @samgdotson for why changing to vintage to get around the technology lifetime constraint is a valid fix in the context of modeling the UIUC microgrid.
An alternative solution would be to add a new process for IMPWIND
and IMPSOLAR
with a new vintage corresponding to the end of their respective technology lifetimes. That being said, we would need to list our assumptions we make about these new processes as the technologies will have advanced in cost and efficiency that far into the future.
You're right. We need to add a new vintage. "Changing the vintage" is equivalent to adding a new vintage. This does not mean adding "existing capacity," it means just changing the vintage that is referenced. It doesn't force the model to build a particular vintage. It just makes one available for a given year, if Temoa decides that's what it wants to do. I believe I've been explicit throughout that we are assuming the costs do not change through time. This is precisely the function of Temoa -- dealing with future uncertainty. We can make an infinite number of assumptions about the future of technology costs and we could argue about them until we're blue in the face, so let's not do that.
By reading your comments @yardasol and @samgdotson, I can think of the following strategies to solve this issue.
a- Extend LifetimeTech
for IMPWIND
and IMPSOL
b- Remove the entries for years beyond Vintage + LifetimeTech
I believe @samgdotson is suggesting something else, maybe:
c- change Vintage
so that Vintage + LifetimeTech
is greater than 2051
or
d- add a new entry in ExistingCapacity
for IMPWIND
and IMPSOL
Which strategy do you think is the best? @samgdotson If your suggestion is not included in this list, then I don't understand how to solve the issue.
@robfairh I don't think we need to add new ExistingCapacity
entry because that would make TEMOA avoid paying the investment costs for the new process. What we want is (I think), in the tables where there is a vintage
entry for IMPWIND
and IMPSOLAR
, change the vintage
entry for periods that are beyond LifetimeTech
+ the current process' vintage to a newer vintage.
For example, in CostVariable
, we have the <IMPWIND
, 2016
> process as an entry for all periods. We could, say, add entries for a <IMPWIND
, 2040
> process in the table for all periods >= 2040. For all periods >= 2046, we would delete the <IMPWIND
, 2016
> process entries, forcing TEMOA to consider the costs of the new <IMPWIND
, 2040
> process in its model. We would do the same for any other tables that have both a period
and vintage
column.
Ok, let's look at wind power, IMPWIND
.
INSERT INTO "CostVariable" VALUES('uiuc', 2021, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2022, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2023, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2024, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2025, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2026, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2027, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2028, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2029, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2030, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
Notice that the variable cost is the same for each year. In our model, we are assuming the following
Now we have to extend this table to the year 2050, rather than 2030. Seems easy enough:
INSERT INTO "CostVariable" VALUES('uiuc', 2021, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2022, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2023, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2024, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2025, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2026, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2027, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2028, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2029, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2030, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
-- Add years
INSERT INTO "CostVariable" VALUES('uiuc', 2031, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2032, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2033, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2034, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2035, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2036, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2037, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2038, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2039, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2040, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2041, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2042, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2043, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2044, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2045, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2046, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2047, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2048, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2049, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2050, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
But this will produce the error @yardasol mentions above. Why? Because each entry references the vintage 2016. This works for the 2030 case because the technology is built in 2016 (the first vintage) and will last until (2016+25 = 2041) 2041. At that point that vintage is retired. We want to give Temoa the option to use wind power. So how do we fix this? Change the vintage.
INSERT INTO "CostVariable" VALUES('uiuc', 2021, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2022, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2023, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2024, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2025, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2026, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2027, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2028, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2029, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2030, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
-- Add years
INSERT INTO "CostVariable" VALUES('uiuc', 2031, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2032, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2033, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2034, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2035, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2036, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2037, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2038, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2039, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2040, 'IMPWIND', 2016, 0.0384, 'M$/GWh', 'wind farm PPA');
-- Change the vintage to a year that will work, like 2026.
INSERT INTO "CostVariable" VALUES('uiuc', 2041, 'IMPWIND', 2026, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2042, 'IMPWIND', 2026, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2043, 'IMPWIND', 2026, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2044, 'IMPWIND', 2026, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2045, 'IMPWIND', 2026, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2046, 'IMPWIND', 2026, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2047, 'IMPWIND', 2026, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2048, 'IMPWIND', 2026, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2049, 'IMPWIND', 2026, 0.0384, 'M$/GWh', 'wind farm PPA');
INSERT INTO "CostVariable" VALUES('uiuc', 2050, 'IMPWIND', 2026, 0.0384, 'M$/GWh', 'wind farm PPA');
Now it should run. All the way out to 2050. Why did I pick 2026? Because that was the first year that would cover everything until 2050. It was a fairly arbitrary choice, I could have picked a different year for each entry with no change in the solution. I didn't have to start in 2041, either. I could have started in 2027, for example. Why doesn't this change the solution?
We should not add ExistingCapacity
because that's not true. That table also only works for existing
time periods. In this model the existing time periods are (2000, 2016, 2020). Otherwise we'd have to start our simulation in 2026 or later, which kind of defeats the purpose of our analysis.
Can you try that @yardasol ? And let us know if it works.
Probably when you updated your branch by merging the master branch, there were some conflicts. Those conflicts haven't been fixed entirely yet. I believe you created UIUC_2050_cost.sql from your 11_uiuc.sql with conflicts.
@yardasol you should spend some time trying to figure out what happened and fix it.
@robfairh I looked through the UIUC_2050_cost.sql
and UIUC_2050_land.sql
files and didn't see any other differences between my version and the current main version here other than the vehicle technology lifetimes, which I fixed with the most recent commit.
@robfairh I looked through the
UIUC_2050_cost.sql
andUIUC_2050_land.sql
files and didn't see any other differences between my version and the current main version here other than the vehicle technology lifetimes, which I fixed with the most recent commit.
You should diff the files. You should diff UIUC_2050_cost.sql
against 11_uiuc.sql
(from the master branch) and make sure that you haven't introduced any more changes.
@robfairh a few questions
MinActivitiy
for GSLVCL
, DSLVCL
, and E85VCL
, Efficiency
for IMPNATGAS
, IMPGSL
, IMPDSL
, IMPE85
, and IMPH2
are not extended to 2050. Should I add entries in the table for these up to 2050?Commit 134462b resolves Issue #140
@yardasol There are merge conflicts that need to be addressed. Please also adapt and extend the new implementation of the geothermal plant.
@samgdotson I'm not seeing the merge conflicts you are talking about. Unless you mean 11_uiuc.sql
, which I do still need to fix (I think),
The merge conflicts are in 11_uiuc.sql
. But the land case and the cost case scenarios do not include the updates to geothermal or the chilled water system. Those need to be changed as well. The changes were to added in 13_uiuc.sql
.
@yardasol I am working on implementing these changes. I'll let you know when I am done. Also, if you want to change anything, remember to do git pull
before doing so.
@yardasol and @samgdotson I have implemented the update of both scenarios. However, TEMOA is missing to find a solution. Could I get some help with the debugging? I am trying to find the error, but so far I haven't been able to.
@robfairh scenario14 seems to run fine for me. It's clear that you didn't extend the model but it does have a solution.
The scenarios run. However, the accuracy of some results is dubious. I think this PR can be merged after @samgdotson review. I made issue #155 to understand the results.
This PR adds two new scenarios:
UIUC_2050_cost
, a cost-constrained scenario based on11_uiuc
extended to 2050UIUC_2050_land
, a land-constrained scenario based on12_uiuc
extended to 2050This PR partially addresses #140 This is an active PR and I will be adding note and question here as comments.