Skip to content

Commit 109cb62

Browse files
author
WolfBunke
authored
Merge pull request #241 from openego/feature/weather_id
Feature/weather_id
2 parents 5553b95 + 8a1898c commit 109cb62

3 files changed

Lines changed: 23 additions & 38 deletions

File tree

dataprocessing/sql_snippets/ego_dp_powerflow_assignment_generator.sql

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ INSERT INTO model_draft.ego_supply_pf_generator_single (scn_name, generator_id,
4646
FROM model_draft.ego_supply_conv_powerplant_sq_mview a
4747
WHERE a.fuel <> 'pumped_storage' AND a.un_id IS NOT NULL AND a.capacity IS NOT NULL; -- pumped storage units are ignored here and will be listed in storage table
4848

49-
INSERT INTO model_draft.ego_supply_pf_generator_single (scn_name, generator_id, bus, p_nom, source_name, voltage_level)
50-
SELECT 'Status Quo', un_id, otg_id, electrical_capacity/1000, generation_type, voltage_level
49+
INSERT INTO model_draft.ego_supply_pf_generator_single (scn_name, generator_id, bus, p_nom, source_name, voltage_level, w_id)
50+
SELECT 'Status Quo', un_id, otg_id, electrical_capacity/1000, generation_type, voltage_level, w_id
5151
FROM model_draft.ego_supply_res_powerplant_sq_mview a
5252
WHERE a.un_id IS NOT NULL AND a.electrical_capacity IS NOT NULL;
5353

@@ -60,8 +60,8 @@ INSERT INTO model_draft.ego_supply_pf_generator_single (scn_name, generator_id,
6060
FROM model_draft.ego_supply_conv_powerplant_nep2035_mview a
6161
WHERE a.fuel <> 'pumped_storage' AND a.un_id IS NOT NULL AND a.capacity IS NOT NULL; -- pumped storage units are ignored here and will be listed in storage table
6262

63-
INSERT INTO model_draft.ego_supply_pf_generator_single (scn_name, generator_id, bus, p_nom, source_name, voltage_level)
64-
SELECT 'NEP 2035', un_id, otg_id, electrical_capacity/1000, generation_type, voltage_level
63+
INSERT INTO model_draft.ego_supply_pf_generator_single (scn_name, generator_id, bus, p_nom, source_name, voltage_level, w_id)
64+
SELECT 'NEP 2035', un_id, otg_id, electrical_capacity/1000, generation_type, voltage_level, w_id
6565
FROM model_draft.ego_supply_res_powerplant_nep2035_mview a
6666
WHERE a.un_id IS NOT NULL AND a.electrical_capacity IS NOT NULL;
6767

@@ -74,8 +74,8 @@ INSERT INTO model_draft.ego_supply_pf_generator_single (scn_name, generator_id,
7474
FROM model_draft.ego_supply_conv_powerplant_ego100_mview a
7575
WHERE a.fuel <> 'pumped_storage' AND a.un_id IS NOT NULL AND a.capacity IS NOT NULL; -- pumped storage units are ignored here and will be listed in storage table
7676

77-
INSERT INTO model_draft.ego_supply_pf_generator_single (scn_name, generator_id, bus, p_nom, source_name, voltage_level)
78-
SELECT 'eGo 100', un_id, otg_id, electrical_capacity/1000, generation_type, voltage_level
77+
INSERT INTO model_draft.ego_supply_pf_generator_single (scn_name, generator_id, bus, p_nom, source_name, voltage_level, w_id)
78+
SELECT 'eGo 100', un_id, otg_id, electrical_capacity/1000, generation_type, voltage_level, w_id
7979
FROM model_draft.ego_supply_res_powerplant_ego100_mview a
8080
WHERE a.un_id IS NOT NULL AND a.electrical_capacity IS NOT NULL;
8181

@@ -226,36 +226,6 @@ UPDATE model_draft.ego_supply_pf_generator_single a
226226
SELECT ego_scenario_log('v0.3.0','input','climate','cosmoclmgrid','ego_dp_powerflow_assignment_generator.sql',' ');
227227

228228

229-
-- Identify climate point IDs for each renewables generator
230-
UPDATE model_draft.ego_supply_pf_generator_single a
231-
SET w_id = b.gid
232-
FROM (SELECT c.un_id, c.geom
233-
FROM model_draft.ego_supply_res_powerplant_sq_mview c) AS result,
234-
climate.cosmoclmgrid b
235-
WHERE result.geom && b.geom
236-
AND ST_Intersects(result.geom, b.geom)
237-
AND generator_id = result.un_id;
238-
239-
UPDATE model_draft.ego_supply_pf_generator_single a
240-
SET w_id = b.gid
241-
FROM (SELECT c.un_id, c.geom
242-
FROM model_draft.ego_supply_res_powerplant_nep2035_mview c) AS result,
243-
climate.cosmoclmgrid b
244-
WHERE result.geom && b.geom
245-
AND ST_Intersects(result.geom, b.geom)
246-
AND generator_id = result.un_id;
247-
248-
UPDATE model_draft.ego_supply_pf_generator_single a
249-
SET w_id = b.gid
250-
FROM (SELECT c.un_id, c.geom
251-
FROM model_draft.ego_supply_res_powerplant_ego100_mview c) AS result,
252-
climate.cosmoclmgrid b
253-
WHERE result.geom && b.geom
254-
AND ST_Intersects(result.geom, b.geom)
255-
AND generator_id = result.un_id;
256-
257-
258-
259229
-- Create aggregate IDs in pf_generator_single
260230

261231
-- Create sequence for aggregate ID

dataprocessing/sql_snippets/ego_dp_powerflow_assignment_otgid.sql

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Powerplant lists are updated with information on the otg_id of substations which the generators are assigned to.
2+
Powerplant lists are updated with information on the otg_id of substations and w_id of weather cell which the generators are assigned to.
33
44
__copyright__ = "Flensburg University of Applied Sciences, Centre for Sustainable Energy Systems"
55
__license__ = "GNU Affero General Public License Version 3 (AGPL-3.0)"
@@ -52,6 +52,19 @@ SET otg_id = (CASE WHEN ST_Within(model_draft.ego_dp_supply_res_powerplant.geom
5252
END);
5353

5454

55+
-- add weather cell id (w_id)
56+
57+
UPDATE model_draft.ego_dp_supply_res_powerplant
58+
SET w_id = NULL;
59+
60+
UPDATE model_draft.ego_dp_supply_res_powerplant a
61+
SET w_id = b.gid
62+
FROM climate.cosmoclmgrid b
63+
WHERE a.rea_geom_new && ST_TRANSFORM(b.geom,3035)
64+
AND ST_Intersects(a.rea_geom_new, ST_TRANSFORM(b.geom,3035));
65+
66+
67+
5568
/*
5669
5770

preprocessing/sql_snippets/ego_dp_preprocessing_res_powerplant.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ CREATE TABLE model_draft.ego_dp_supply_res_powerplant
5353
scenario character varying NOT NULL,
5454
flag character varying,
5555
nuts character varying,
56+
w_id bigint,
5657
CONSTRAINT ego_dp_supply_res_powerplant_pkey PRIMARY KEY (preversion,id,scenario)
5758
)
5859
WITH (
@@ -156,7 +157,8 @@ COMMENT ON TABLE model_draft.ego_dp_supply_res_powerplant IS '{
156157
{"name": "rea_geom_new", "description": "Geometry of new position", "unit": "" },
157158
{"name": "scenario", "description": "Name of scenario", "unit": "" },
158159
{"name": "flag", "description": "Flag of scenario changes of an power plant unit (repowering, decommission or commissioning).", "unit": "" },
159-
{"name": "nuts", "description": "NUTS ID).", "unit": "" } ] } ],
160+
{"name": "nuts", "description": "NUTS ID", "unit": "" },
161+
{"name": "w_id", "description": "ID of corresponding weather cell", "unit": "" } ] } ],
160162
"metadata_version": "1.3"}';
161163

162164
-- select description

0 commit comments

Comments
 (0)