Skip to content

Commit 55f29f6

Browse files
authored
Merge branch 'wecc' into update_transmission_lifetime
2 parents 576c088 + 8d542cf commit 55f29f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1853
-598
lines changed

REAM Model Changelog.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# REAM Model Breaking Changes
22

33
This file specifies the breaking changes that we have done to the model.
4-
A breaking change is any change that would change the results of previously
4+
A breaking change is any change that might change the results of previously
55
completed runs.
66

77
## List of breaking changes to model
@@ -18,4 +18,5 @@ Changes are listed from oldest (first line) to newest (last line of table).
1818
| #68 | June 2021 | Change financial params to 2018 dollars & 5% interest rate. Start using terrain multipliers (which now include the economic multiplier). |
1919
| #72 | July 2021 | Drop build and O&M costs of existing transmission lines. |
2020
| #89 | August 2021 | Change hydro module average flow constraint to a monthly constraint rather than per timeseries and change it to a <= rather than ==. |
21-
| #90 | August 2021 | Change the lifetime of transmission lines from 20yr to 85yr |
21+
| #90 | August 2021 | Change the lifetime of transmission lines from 20yr to 85yr |
22+
| #117 | January 2022 | Revert hydro module change (#89) to disallow curtailment of hydro (see #114). |
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
2+
3+
-- Shiny + PHG, Nov 24th, 2021
4+
-- New scenario that includes wave energy candidates (23 locations from 2017 data)
5+
6+
7+
-- Ran:
8+
-- insert into switch.generation_plant_cost_scenario
9+
-- values(26,'SWITCH 2020 Baseline costs from id 25. DOE_wave',
10+
-- 'same costs as id 25, and added costs for wave candidates from 2017 data (Deborah S., Brian, PHG),
11+
-- Shinys runs');
12+
13+
-- Ran:
14+
-- select * from switch.generation_plant_cost_scenario;
15+
16+
-- Ran:
17+
-- insert into switch.generation_plant_cost
18+
-- select 26 as generation_plant_cost_scenario_id, generation_plant_id, build_year, fixed_o_m, overnight_cost,
19+
-- storage_energy_capacity_cost_per_mwh
20+
-- from switch.generation_plant_cost
21+
-- where generation_plant_cost_scenario_id = 25 -- 25 is the previous baseline scenario used for CEC LDES 2020-2022
22+
-- union
23+
-- select 26 as generation_plant_cost_scenario_id, t."GENERATION_PROJECT" as generation_plant_id,
24+
-- build_year, gen_fixed_om as fixed_o_m, gen_overnight_cost as overnight_cost,
25+
-- NULL as storage_energy_capacity_cost_per_mwh
26+
-- from public.gen_build_costs_wave as t;
27+
28+
-- reality check: -----------------------------------------------------------------------
29+
-----------------------------------------------------------------------------------------
30+
-- select * from switch.generation_plant_cost
31+
-- join switch.generation_plant using(generation_plant_id)
32+
-- where generation_plant_cost_scenario_id=25;
33+
-- and energy_source not in ('Wave');
34+
35+
-- select *
36+
-- from switch.generation_plant_cost
37+
-- where generation_plant_cost_scenario_id = 26;
38+
39+
40+
-- -- 303495 rows
41+
-- select 26 as generation_plant_cost_scenario_id, generation_plant_id, build_year, fixed_o_m, overnight_cost,
42+
-- storage_energy_capacity_cost_per_mwh
43+
-- from switch.generation_plant_cost
44+
-- where generation_plant_cost_scenario_id = 25;
45+
46+
-- -- 828 rows
47+
-- select 26 as generation_plant_cost_scenario_id, t."GENERATION_PROJECT" as generation_plant_id,
48+
-- build_year, gen_fixed_om as fixed_o_m, gen_overnight_cost as overnight_cost,
49+
-- NULL as storage_energy_capacity_cost_per_mwh
50+
-- from public.gen_build_costs_wave as t;
51+
52+
53+
-- id 25: 303495 rows (2050-2010+1)
54+
55+
-- wave (gen_ids, year) should be 828 rows
56+
57+
-- id 26 should have 303495 + 828 = 304323
58+
59+
-- end of reality check -----------------------------------------------------------------------------
60+
---------------------------------------------------------------------------------------------------
61+
62+
-- Summary: tables updated: generation_plant_cost_scenario, generation_plant_cost
63+
64+
-- delete from switch.generation_plant_scenario where generation_plant_scenario_id = 24;
65+
66+
-- Ran:
67+
-- insert into switch.generation_plant_scenario
68+
-- values(24,
69+
-- 'EIA-WECC Existing and Proposed 2018 + wave, AMPL Basecase for Canada and Mex, AMPL proposed non-wind plants (only best of solar), Env Screen Wind Cat 3, No CAES',
70+
-- 'same as id 22 adding wave energy data from 2017 (Deborah, PHG, Brian), but no Compressed Air Energy Storage gen_tech among candidate generators'
71+
-- );
72+
73+
select * from switch.generation_plant_scenario;
74+
75+
76+
-- 10349 rows
77+
-- insert into switch.generation_plant_scenario_member
78+
-- select 24 as generation_plant_scenario_id, t1."GENERATION_PROJECT" as generation_plant_id
79+
-- from public.generation_projects_info_wave as t1
80+
-- union
81+
-- select 24 as generation_plant_scenario_id, generation_plant_id
82+
-- from switch.generation_plant_scenario_member
83+
-- where generation_plant_scenario_id=23;
84+
85+
86+
select * from switch.generation_plant_scenario_member where generation_plant_scenario_id = 24;
87+
88+
89+
90+
91+
92+
93+
94+
95+
-- __________________________________________________________________________________________________
96+
-- __________________________________________________________________________________________________
97+
98+
-- Ran: new table with wave capacity factors duplicated from 2006 for 2010-2060
99+
-- drop table public.test_variable_capacity_factors_wave;
100+
-- create table public.test_variable_capacity_factors_wave(
101+
-- generation_plant_id double precision,
102+
-- capacity_factor double precision,
103+
-- time_stamp_utc text);
104+
105+
106+
-- Ran:
107+
-- do
108+
-- $$
109+
-- begin
110+
-- for year in 2010..2060 loop
111+
-- raise notice 'year: %', year;
112+
113+
-- insert into public.test_variable_capacity_factors_wave
114+
-- select t."GENERATION_PROJECT" as generation_plant_id,
115+
-- gen_max_capacity_factor as capacity_factor,
116+
-- CONCAT(year, TRIM(LEADING '2006' FROM timestamp)) as new_stamp
117+
-- from public.variable_capacity_factors_wave as t;
118+
-- end loop;
119+
-- end;
120+
-- $$
121+
122+
-- 26280 rows (=(2012-2010+1)*8760)
123+
-- 10275480 rows ( = (2060-2010+1) * 8760 * 23 )
124+
-- select * from public.test_variable_capacity_factors_wave;
125+
126+
127+
128+
129+
-- 359,400 (2011 - 2051)
130+
-- select * from switch.variable_capacity_factors_exist_and_candidate_gen
131+
-- where generation_plant_id = 1191183122
132+
-- order by timestamp_utc asc;
133+
134+
-- continue here:
135+
-- 8,260,680 rows = (2051-2011+1) * 8760 * 23
136+
insert into switch.variable_capacity_factors_exist_and_candidate_gen
137+
select t.generation_plant_id as generation_plant_id, raw_timepoint_id, t2.timestamp_utc,
138+
t.capacity_factor as capacity_factor, 1 as is_new_cap_factor
139+
from public.test_variable_capacity_factors_wave as t
140+
join switch.variable_capacity_factors_exist_and_candidate_gen as t2 on (t.time_stamp_utc=to_char(t2.timestamp_utc, 'YYYY-MM-DD HH24:MI:SS'))
141+
where t2.generation_plant_id=1191183122 -- random plant_id chosen to match raw_timepoint_id
142+
order by 1,2 desc;

docs/Database.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,18 @@ The command to enter PostgreSQL while SSH'd into the server is `psql wecc`.
4141

4242
## Making changes to the database
4343

44-
Whether it's adding data to the database or changing its schema, it's important
45-
to proceed carefully when making changes to the database. Always make sure to
44+
### Common operations
45+
46+
Some database changes are common operations that are used repeatedly.
47+
For these operations, it's helpful to make a command line tool to make the process easy.
48+
49+
For example, adding a scenario to the database is a common operation. Therefore, we have built
50+
the `switch db save_scenario` command to easily do this. (Run `switch db save_scenario --help` for details).
51+
52+
### Custom operations
53+
54+
When running custom operations on the database it's very important
55+
to proceed carefully. Always make sure to
4656
**test and keep track of your changes**.
4757

4858
Here are the steps to make a change.
@@ -61,9 +71,7 @@ to the convention `YYYY-MM-DD_<script_name>`.
6171
5. Open a pull request to add your script to the repository (see [`docs/Contribute.md`](Contribute.md))
6272
so we can keep track of the changes that have been made.
6373

64-
### Bigger changes
65-
66-
Sometimes, it isn't feasible to have your entire change as a single SQL script.
74+
Note that sometimes, it isn't feasible to have your entire change as a single SQL script.
6775
One way to make bigger changes is to use a Python script. Use the same process
6876
as for the SQL scripts. That is save your Python scripts in the `/database` folder.
6977

0 commit comments

Comments
 (0)