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 @@ -30,6 +30,7 @@ CREATE TABLE model_draft.ego_supply_pf_generator_single (
efficiency double precision,
w_id bigint,
aggr_id bigint,
power_class bigint,
source_name character varying,
voltage_level smallint,
CONSTRAINT generator_single_data_pkey PRIMARY KEY (scn_name, generator_id),
Expand Down Expand Up @@ -225,6 +226,16 @@ UPDATE model_draft.ego_supply_pf_generator_single a
-- ego scenario log (version,io,schema_name,table_name,script_name,comment)
SELECT ego_scenario_log('v0.3.0','input','climate','cosmoclmgrid','ego_dp_powerflow_assignment_generator.sql',' ');

UPDATE model_draft.ego_supply_pf_generator_single a
SET power_class = b.power_class_id
FROM model_draft.ego_power_class b
WHERE a.p_nom >= b.lower_limit
AND a.p_nom < b.upper_limit
AND a.source IN (SELECT source_id from model_draft.ego_grid_pf_hv_source WHERE name IN('wind_onshore'));

UPDATE model_draft.ego_supply_pf_generator_single a
SET power_class = 0
WHERE source IN (SELECT source_id from model_draft.ego_grid_pf_hv_source WHERE name IN('wind_offshore', 'solar'));

-- Create aggregate IDs in pf_generator_single

Expand All @@ -243,15 +254,17 @@ UPDATE model_draft.ego_supply_pf_generator_single a
FROM (SELECT b.bus,
b.w_id,
b.source,
b.power_class,
b.scn_name,
nextval('model_draft.ego_supply_pf_generator_single_aggr_id') as aggr_id
FROM model_draft.ego_supply_pf_generator_single b
WHERE p_nom < 50 AND source IN
(SELECT source_id from model_draft.ego_grid_pf_hv_source WHERE name IN('wind_onshore', 'wind_offshore', 'solar'))
GROUP BY b.bus, b.w_id, b.source, b.scn_name) AS result
GROUP BY b.bus, b.w_id, b.source, b.power_class, b.scn_name) AS result
WHERE a.bus = result.bus
AND a.w_id = result.w_id
AND a.source = result.source
AND a.power_class = result.power_class
AND a.scn_name = result.scn_name;

-- source <> (wind and solar) and p_nom < 50 MW
Expand Down Expand Up @@ -282,7 +295,7 @@ DELETE FROM model_draft.ego_supply_pf_generator_single WHERE p_nom IS NULL OR p_

DELETE FROM model_draft.ego_grid_pf_hv_generator WHERE scn_name IN ('Status Quo', 'NEP 2035', 'eGo 100');

-- source = (wind and solar) and p_nom < 50 MW
-- source = wind_onshore and p_nom < 50 MW
INSERT INTO model_draft.ego_grid_pf_hv_generator (
scn_name,
generator_id,
Expand Down Expand Up @@ -313,7 +326,7 @@ INSERT INTO model_draft.ego_grid_pf_hv_generator (
AND a.aggr_id IS NOT NULL
AND source IN
(SELECT source_id from model_draft.ego_grid_pf_hv_source WHERE name IN('wind_onshore', 'wind_offshore', 'solar'))
GROUP BY a. scn_name, a.aggr_id, a.bus, a.w_id, a.source;
GROUP BY a. scn_name, a.aggr_id, a.bus, a.w_id, a.power_class, a.source;

-- source <> (wind and solar) and p_nom < 50 MW
INSERT INTO model_draft.ego_grid_pf_hv_generator (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ FROM
(SELECT
aggr_id AS generator_id,
w_id,
power_class,
source
FROM
model_draft.ego_supply_pf_generator_single
WHERE source IN (12, 13, 17)
AND scn_name = 'Status Quo'
GROUP BY aggr_id, w_id, source) AS gen,
GROUP BY aggr_id, w_id, power_class, source) AS gen,
(SELECT
w_id,
power_class,
CASE
WHEN source LIKE '%%solar%%' THEN 12
WHEN source LIKE '%%wind_onshore%%' THEN 13
Expand All @@ -90,7 +92,8 @@ FROM
feedin
FROM model_draft.ego_renewable_feedin) AS feedin
WHERE gen.source = feedin.source
AND gen.w_id = feedin.w_id;
AND gen.w_id = feedin.w_id
AND gen.power_class = feedin.power_class;


--
Expand Down Expand Up @@ -179,14 +182,16 @@ FROM
(SELECT
aggr_id AS generator_id,
w_id,
power_class,
source
FROM
model_draft.ego_supply_pf_generator_single
WHERE source IN (12, 13, 17)
AND scn_name = 'NEP 2035'
GROUP BY aggr_id, w_id, source) AS gen,
GROUP BY aggr_id, w_id, power_class, source) AS gen,
(SELECT
w_id,
power_class,
CASE
WHEN source LIKE '%%solar%%' THEN 12
WHEN source LIKE '%%wind_onshore%%' THEN 13
Expand All @@ -195,7 +200,8 @@ FROM
feedin
FROM model_draft.ego_renewable_feedin) AS feedin
WHERE gen.source = feedin.source
AND gen.w_id = feedin.w_id;
AND gen.w_id = feedin.w_id
AND gen.power_class = feedin.power_class;

-- construct array per aggr_id according to source timeseries
INSERT into model_draft.ego_grid_pf_hv_generator_pq_set (scn_name, generator_id, temp_id, p_set)
Expand Down Expand Up @@ -280,14 +286,16 @@ FROM
(SELECT
aggr_id AS generator_id,
w_id,
power_class,
source
FROM
model_draft.ego_supply_pf_generator_single
WHERE source IN (12, 13, 17)
AND scn_name = 'eGo 100'
GROUP BY aggr_id, w_id, source) AS gen,
GROUP BY aggr_id, w_id, power_class, source) AS gen,
(SELECT
w_id,
power_class,
CASE
WHEN source LIKE '%%solar%%' THEN 12
WHEN source LIKE '%%wind_onshore%%' THEN 13
Expand All @@ -296,7 +304,8 @@ FROM
feedin
FROM model_draft.ego_renewable_feedin) AS feedin
WHERE gen.source = feedin.source
AND gen.w_id = feedin.w_id;
AND gen.w_id = feedin.w_id
AND gen.power_class = feedin.power_class;

-- construct array per aggr_id according to source timeseries
INSERT into model_draft.ego_grid_pf_hv_generator_pq_set (scn_name, generator_id, temp_id, p_set)
Expand Down Expand Up @@ -662,6 +671,7 @@ FROM
feedin.feedin
FROM
model_draft.ego_renewable_feedin AS feedin
WHERE power_class IN (0, 4)
) AS B,
(SELECT
generators.generator_id,
Expand Down Expand Up @@ -762,6 +772,7 @@ FROM
feedin.feedin
FROM
model_draft.ego_renewable_feedin AS feedin
WHERE power_class IN (0, 4)
) AS B,
(SELECT
generators.generator_id,
Expand Down Expand Up @@ -862,6 +873,7 @@ FROM
feedin.feedin
FROM
model_draft.ego_renewable_feedin AS feedin
WHERE power_class IN (0, 4)
) AS B,
(SELECT
generators.generator_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class Typified(Base):
Base.prepare()

# simplify class names
Datatype, Projection, Spatial, Timeseries, Year, Point =\
Datatype, Projection, Spatial, Timeseries, Year, Point=\
Base.classes.datatype, Base.classes.projection, Base.classes.spatial,\
Base.classes.timeseries, Base.classes.year,\
Base.classes.ego_weather_measurement_point
Expand Down
Loading