Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ INSERT INTO model_draft.ego_supply_pf_generator_single (scn_name, generator_id,
FROM model_draft.ego_supply_conv_powerplant_sq_mview a
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

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

Expand All @@ -60,8 +60,8 @@ INSERT INTO model_draft.ego_supply_pf_generator_single (scn_name, generator_id,
FROM model_draft.ego_supply_conv_powerplant_nep2035_mview a
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

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

Expand All @@ -74,8 +74,8 @@ INSERT INTO model_draft.ego_supply_pf_generator_single (scn_name, generator_id,
FROM model_draft.ego_supply_conv_powerplant_ego100_mview a
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

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

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


-- Identify climate point IDs for each renewables generator
UPDATE model_draft.ego_supply_pf_generator_single a
SET w_id = b.gid
FROM (SELECT c.un_id, c.geom
FROM model_draft.ego_supply_res_powerplant_sq_mview c) AS result,
climate.cosmoclmgrid b
WHERE result.geom && b.geom
AND ST_Intersects(result.geom, b.geom)
AND generator_id = result.un_id;

UPDATE model_draft.ego_supply_pf_generator_single a
SET w_id = b.gid
FROM (SELECT c.un_id, c.geom
FROM model_draft.ego_supply_res_powerplant_nep2035_mview c) AS result,
climate.cosmoclmgrid b
WHERE result.geom && b.geom
AND ST_Intersects(result.geom, b.geom)
AND generator_id = result.un_id;

UPDATE model_draft.ego_supply_pf_generator_single a
SET w_id = b.gid
FROM (SELECT c.un_id, c.geom
FROM model_draft.ego_supply_res_powerplant_ego100_mview c) AS result,
climate.cosmoclmgrid b
WHERE result.geom && b.geom
AND ST_Intersects(result.geom, b.geom)
AND generator_id = result.un_id;



-- Create aggregate IDs in pf_generator_single

-- Create sequence for aggregate ID
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Powerplant lists are updated with information on the otg_id of substations which the generators are assigned to.
Powerplant lists are updated with information on the otg_id of substations and w_id of weather cell which the generators are assigned to.

__copyright__ = "Flensburg University of Applied Sciences, Centre for Sustainable Energy Systems"
__license__ = "GNU Affero General Public License Version 3 (AGPL-3.0)"
Expand Down Expand Up @@ -52,6 +52,19 @@ SET otg_id = (CASE WHEN ST_Within(model_draft.ego_dp_supply_res_powerplant.geom
END);


-- add weather cell id (w_id)

UPDATE model_draft.ego_dp_supply_res_powerplant
SET w_id = NULL;

UPDATE model_draft.ego_dp_supply_res_powerplant a
SET w_id = b.gid
FROM climate.cosmoclmgrid b
WHERE a.rea_geom_new && ST_TRANSFORM(b.geom,3035)
AND ST_Intersects(a.rea_geom_new, ST_TRANSFORM(b.geom,3035));



/*


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ CREATE TABLE model_draft.ego_dp_supply_res_powerplant
scenario character varying NOT NULL,
flag character varying,
nuts character varying,
w_id bigint,
CONSTRAINT ego_dp_supply_res_powerplant_pkey PRIMARY KEY (preversion,id,scenario)
)
WITH (
Expand Down Expand Up @@ -156,7 +157,8 @@ COMMENT ON TABLE model_draft.ego_dp_supply_res_powerplant IS '{
{"name": "rea_geom_new", "description": "Geometry of new position", "unit": "" },
{"name": "scenario", "description": "Name of scenario", "unit": "" },
{"name": "flag", "description": "Flag of scenario changes of an power plant unit (repowering, decommission or commissioning).", "unit": "" },
{"name": "nuts", "description": "NUTS ID).", "unit": "" } ] } ],
{"name": "nuts", "description": "NUTS ID", "unit": "" },
{"name": "w_id", "description": "ID of corresponding weather cell", "unit": "" } ] } ],
"metadata_version": "1.3"}';

-- select description
Expand Down