Skip to content

Commit cabfa4e

Browse files
author
IlkaCu
authored
Merge pull request #196 from openego/release/v0.3-fix
Release/v0.3 fix
2 parents e5e31bd + 1f7af23 commit cabfa4e

6 files changed

Lines changed: 160 additions & 105 deletions

File tree

dataprocessing/sql_snippets/ego_dp_powerflow_create_pp_mview.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
SQL Script to create mviews diyplaying power plants by scenario.
33
44
__copyright__ = "Europa-Universität Flensburg - ZNES"
@@ -184,6 +184,7 @@ CREATE MATERIALIZED VIEW model_draft.ego_supply_res_powerplant_ego100_mview AS
184184
And preversion = 'v0.3.0'
185185
AND electrical_capacity > 0
186186
AND generation_type in ('solar','wind')
187+
AND generation_subtype not in ('wind_offshore')
187188
ORDER BY id
188189
) as sub
189190
UNION

dataprocessing/sql_snippets/ego_dp_versioning.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ ALTER MATERIALIZED VIEW supply.ego_dp_res_powerplant_nep2035_mview
680680
-- MView for eGo 100
681681
DROP MATERIALIZED VIEW IF EXISTS supply.ego_dp_res_powerplant_ego100_mview CASCADE;
682682
CREATE MATERIALIZED VIEW supply.ego_dp_res_powerplant_ego100_mview AS
683-
SELECT
683+
SELECT DISTINCT ON (id)
684684
sub.*
685685
FROM (
686686
SELECT DISTINCT ON (id)
@@ -699,10 +699,11 @@ CREATE MATERIALIZED VIEW supply.ego_dp_res_powerplant_ego100_mview AS
699699
AND version = 'v0.3.0'
700700
AND electrical_capacity > 0
701701
AND generation_type in ('solar','wind')
702+
AND generation_subtype not in ('wind_offshore')
702703
ORDER BY id
703704
) as sub
704705
UNION
705-
SELECT
706+
SELECT DISTINCT ON (id)
706707
sub2.*
707708
FROM (
708709
SELECT DISTINCT ON (id)
@@ -725,7 +726,7 @@ CREATE MATERIALIZED VIEW supply.ego_dp_res_powerplant_ego100_mview AS
725726
ORDER BY id
726727
) sub2
727728
UNION
728-
SELECT
729+
SELECT DISTINCT ON (id)
729730
sub3.*
730731
FROM (
731732
SELECT DISTINCT ON (id)
@@ -739,6 +740,7 @@ CREATE MATERIALIZED VIEW supply.ego_dp_res_powerplant_ego100_mview AS
739740
AND version = 'v0.3.0'
740741
AND generation_type not in ('biomass','gas','reservoir','run_of_river')
741742
AND flag in ('commissioning', 'repowering')
743+
AND generation_subtype not in ('wind_offshore')
742744
Group BY id
743745
Order by id)
744746
AND scenario in ('NEP 2035')
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- Create MView with NUTS IDs
2+
3+
CREATE MATERIALIZED VIEW boundaries.bkg_vg250_2_lan_nuts_view AS
4+
SELECT lan.ags_0,
5+
lan.gen,
6+
lan.nuts,
7+
st_union(st_transform(lan.geom, 3035)) AS geom
8+
FROM ( SELECT vg.ags_0,
9+
vg.nuts,
10+
replace(vg.gen::text, ' (Bodensee)'::text, ''::text) AS gen,
11+
vg.geom
12+
FROM boundaries.bkg_vg250_2_lan vg) lan
13+
GROUP BY lan.ags_0, lan.gen, lan.nuts
14+
ORDER BY lan.ags_0
15+
WITH DATA;

preprocessing/sql_snippets/ego_dp_preprocessing_conv_powerplant.sql

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
Rectifies incorrect or implausible records in power plant list and adjusts it for further use
33
44
__copyright__ = "Flensburg University of Applied Sciences, Centre for Sustainable Energy Systems"
@@ -267,6 +267,49 @@ UPDATE model_draft.ego_dp_supply_conv_powerplant
267267
SET voltage_level=7
268268
WHERE capacity < 0.1 /*voltage_level =7 when capacity lower than 0.1*/;
269269

270+
271+
-- Due to discrepancies between the given NEP 2035 power plant lsit
272+
-- and the the installed Capacities of the study NEP 2015 with scenario B2035
273+
-- a correction of the capacities is done.
274+
275+
DROP TABLE IF EXISTS model_draft.ego_supply_conv_nep2035_temp CASCADE;
276+
CREATE TABLE model_draft.ego_supply_conv_nep2035_temp AS
277+
SELECT *
278+
FROM
279+
model_draft.ego_dp_supply_conv_powerplant
280+
WHERE scenario in ('NEP 2035');
281+
282+
-- create index GIST (geom)
283+
CREATE INDEX ego_supply_conv_nep2035_temp_geom_idx
284+
ON model_draft.ego_supply_conv_nep2035_temp USING gist (geom);
285+
286+
-- grant (oeuser)
287+
ALTER TABLE model_draft.ego_supply_conv_nep2035_temp OWNER TO oeuser;
288+
289+
-- Repowering units
290+
UPDATE model_draft.ego_supply_conv_nep2035_temp
291+
set capacity = capacity + round(capacity*((12700.-14477.)/12700.))
292+
Where fuel ='pumped_storage';
293+
294+
UPDATE model_draft.ego_supply_conv_nep2035_temp
295+
set capacity = capacity + round(capacity*((33500.-35390.)/33500.))
296+
Where fuel ='gas';
297+
298+
UPDATE model_draft.ego_supply_conv_nep2035_temp
299+
set capacity = capacity + round(capacity*((9100.-12240)/9100.))
300+
Where fuel ='lignite';
301+
302+
UPDATE model_draft.ego_supply_conv_nep2035_temp
303+
set capacity = capacity + round(capacity*((11000.-13860.)/11000.))
304+
Where fuel ='coal';
305+
306+
Update model_draft.ego_dp_supply_conv_powerplant A
307+
set capacity =B.capacity
308+
FROM model_draft.ego_supply_conv_nep2035_temp B
309+
WHERE A.scenario in ('NEP 2035')
310+
AND A.id = B.id;
311+
312+
270313
SELECT obj_description('model_draft.ego_dp_supply_conv_powerplant' ::regclass) ::json;
271314

272315
-- ego scenario log (version,io,schema_name,table_name,script_name,comment)

preprocessing/sql_snippets/ego_dp_preprocessing_res_powerplant.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Insert into model_draft.ego_dp_supply_res_powerplant
205205
'constantly'::text as flag,
206206
Null as nuts
207207
FROM
208-
model_draft.ego_dp_supply_res_powerplant
208+
model_draft.ego_supply_res_powerplant
209209
WHERE geom is not NULL;
210210

211211

@@ -283,11 +283,11 @@ UPDATE model_draft.ego_dp_supply_res_powerplant
283283
WHEN eeg_id LIKE '%%BALTIC%%'
284284
THEN (SELECT geom from model_draft.ego_dp_supply_res_powerplant where id = 1561137)
285285
WHEN eeg_id LIKE '%%RIFFE%%'
286-
THEN ST_SetSRID(ST_MakePoint(6.48, 53.69),4326)
286+
THEN ST_SetSRID(ST_MakePoint(6.48, 53.69),3035)
287287
WHEN eeg_id LIKE '%%ALPHAVENTUE%%'
288-
THEN ST_SetSRID(ST_MakePoint(6.598333, 54.008333),4326)
288+
THEN ST_SetSRID(ST_MakePoint(6.598333, 54.008333),3035)
289289
WHEN eeg_id LIKE '%%BAOEE%%'
290-
THEN ST_SetSRID(ST_MakePoint(5.975, 54.358333),4326)
290+
THEN ST_SetSRID(ST_MakePoint(5.975, 54.358333),3035)
291291
END)
292292
WHERE postcode = '00000' OR postcode = 'keine' or postcode = 'O04WF' AND generation_subtype = 'wind_offshore';
293293

0 commit comments

Comments
 (0)