Skip to content

Commit c96fb1a

Browse files
committed
merge versioning
2 parents 3aada8c + 9e1cf39 commit c96fb1a

27 files changed

Lines changed: 2156 additions & 483 deletions

dataprocessing/eGo_data_processing.py

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ def data_processing():
4444
# 'ego_dp_vacuum_full.sql',
4545

4646
## INPUT DATA CHECK eGoPP
47-
'ego_dp_structure_input_verification.sql', # Check input tables and versions from eGoPP
47+
# 'ego_dp_structure_input_verification.sql', # Check input tables and versions from eGoPP
4848

4949
## SUBSTATION
50-
# 'ego_dp_substation_hvmv.sql', # Abstract HVMV Substations of the high voltage level from OSM
51-
# 'ego_dp_substation_ehv.sql', # Abstract EHV Substations of the extra high voltage level from OSM
52-
# 'ego_dp_substation_otg.sql', # Assign osmTGmod-id to HVMV and EHV substations
53-
# 'ego_dp_substation_hvmv_voronoi.sql', # HVMV Voronoi cells based on HVMV substations
54-
# 'ego_dp_substation_ehv_voronoi.sql', # EHV Voronoi cells based on EHV substations
50+
# 'ego_dp_substation_hvmv.sql', # Abstract HVMV Substations of the high voltage level from OSM
51+
# 'ego_dp_substation_ehv.sql', # Abstract EHV Substations of the extra high voltage level from OSM
52+
# 'ego_dp_substation_otg.sql', # Assign osmTGmod-id to HVMV and EHV substations
53+
# 'ego_dp_substation_hvmv_voronoi.sql', # HVMV Voronoi cells based on HVMV substations
54+
# 'ego_dp_substation_ehv_voronoi.sql', # EHV Voronoi cells based on EHV substations
5555

5656
## GRIDDISTRICT
57-
# 'ego_dp_mv_griddistrict.sql', # MV Griddistricts from municipalities and Voronoi cells
58-
# 'ego_dp_substation_id_to_generator.sql', # Assign subst_id to pp lists
57+
# 'ego_dp_mv_griddistrict.sql', # MV Griddistricts from municipalities and Voronoi cells
58+
# 'ego_dp_substation_id_to_generator.sql', # Assign subst_id to pp lists
5959

6060
## LOADAREA
6161
# 'ego_dp_loadarea_landuse.sql', # OSM landuse sector
@@ -74,42 +74,41 @@ def data_processing():
7474
# 'ego_dp_lv_substation.sql', # MVLV Substation inside Loadarea
7575
# 'ego_dp_lv_substation_voronoi.sql', # MVLV Substation Voronoi
7676
# 'ego_dp_lv_griddistrict.sql', # LV Griddistrict
77-
# 'ego_dp_lv_peakload.sql', # LV OSM areas
77+
# 'ego_dp_lv_peakload.sql', # LV OSM areas
7878
# 'ego_dp_lv_consumption_peakload.sql', # LV Consumption and Peakload
7979

8080
## REA
8181
# 'rea/ego_dp_lattice_500m.sql', # lattice (point grid) 500m
82-
# 'rea/ego_dp_lattice_50m.sql', # lattice (point grid) 50m
83-
# 'rea/ego_dp_rea_wpa_per_mvgd.sql', # wind potential area
82+
# 'rea/ego_dp_lattice_50m.sql', # lattice (point grid) 50m
83+
# 'rea/ego_dp_rea_wpa_per_mvgd.sql', # wind potential area
8484

8585
# 'rea/ego_dp_rea_lattice_per_area_500m.sql', # prepare 500m lattice
8686
# 'rea/ego_dp_rea_lattice_per_area_50m.sql', # prepare 50m lattice
87-
88-
# 'rea/ego_dp_rea_setup.sql', # setup table for allocation
89-
# 'rea/ego_dp_rea_m1.sql', # M1 biomass and solar to farmyard
90-
# 'rea/ego_dp_rea_m2.sql', # M2 windfarms
91-
# 'rea/ego_dp_rea_m3.sql', # M3 wind turbines to wpa
92-
# 'rea/ego_dp_rea_m4.sql', # M4 other and rest
87+
# 'rea/ego_dp_rea_setup.sql', # setup table for allocation
88+
# 'rea/ego_dp_rea_m1.sql', # M1 biomass and solar to farmyard
89+
# 'rea/ego_dp_rea_m2.sql', # M2 windfarms
90+
# 'rea/ego_dp_rea_m3.sql', # M3 wind turbines to wpa
91+
# 'rea/ego_dp_rea_m4.sql', # M4 other and rest
9392
# 'rea/ego_dp_rea_m5.sql', # M5 LV to LA
9493
# 'rea/ego_dp_rea_results.sql', # results and statistics
9594

9695
## POWERFLOW
9796
# 'ego_dp_powerflow_assignment_otgid.sql', # assign otg_id to pp lists
98-
# 'ego_dp_powerflow_assignment_unid.sql', # create a unified_id over all pp (res and conv)
99-
# 'ego_dp_powerflow_create_pp_mview.sql', # create mviews to display power plants per scenario
100-
# 'ego_dp_powerflow_voronoi_weatherpoint.sql', # Create voronoi cells based on weather points
101-
# 'ego_dp_powerflow_hv_setup.sql', # Set schema/tables for EHV/HV powerflow calculations up
102-
# 'ego_dp_powerflow_osmtgmod_to_pypsa.sql', # Include data from osmTGmod into EHV/HV powerflow schema
103-
# 'ego_dp_powerflow_electrical_neighbour.sql', # Create border crossing lines and buses in neighbouring countries
104-
# 'ego_dp_powerflow_grid_future_scenarios.sql', # Copy grid to future scenarios
105-
# 'ego_dp_powerflow_assignment_generator.sql', # Assign generators to corresponding substation (SQ, NEP2035, eGo100)
106-
# 'ego_dp_powerflow_assignment_load.sql', # Assign loads to their corresponding substation (SQ, NEP2035, eGo100)
107-
# 'ego_dp_powerflow_assignment_storage.sql', # Assign storages to their corresponding substation (SQ, NEP 2035, eGo 100)
108-
# 'ego_dp_powerflow_timeseries_generator.sql', # Transfer renpassG!S results into the corresponding powerflow table
97+
# 'ego_dp_powerflow_assignment_unid.sql', # create a unified_id over all pp (res and conv)
98+
# 'ego_dp_powerflow_create_pp_mview.sql', # create mviews to display power plants per scenario
99+
'ego_dp_powerflow_voronoi_weatherpoint.sql', # Create voronoi cells based on weather points
100+
'ego_dp_powerflow_hv_setup.sql', # Set schema/tables for EHV/HV powerflow calculations up
101+
'ego_dp_powerflow_osmtgmod_to_pypsa.sql', # Include data from osmTGmod into EHV/HV powerflow schema
102+
'ego_dp_powerflow_electrical_neighbour.sql', # Create border crossing lines and buses in neighbouring countries
103+
'ego_dp_powerflow_grid_future_scenarios.sql', # Copy grid to future scenarios
104+
'ego_dp_powerflow_assignment_generator.sql', # Assign generators to corresponding substation (SQ, NEP2035, eGo100)
105+
'ego_dp_powerflow_assignment_load.sql', # Assign loads to their corresponding substation (SQ, NEP2035, eGo100)
106+
'ego_dp_powerflow_assignment_storage.sql', # Assign storages to their corresponding substation (SQ, NEP 2035, eGo 100)
107+
'ego_dp_powerflow_timeseries_generator.sql', # Transfer renpassG!S results into the corresponding powerflow table
109108
'ego_dp_powerflow_griddistrict_demand.py', # Demand per MV Griddistrict
110109
'ego_dp_powerflow_timeseries_demand.sql', # Insert demand series into corresponding powerflow table (SQ, NEP2035, eGo100)
111110
'ego_dp_powerflow_lopf_data.sql', # Set marginal costs for generators and storages
112-
111+
113112

114113
## VERSIONING
115114
# 'ego_dp_versioning.sql', # Versioning

dataprocessing/sql_snippets/ego_dp_loadarea_industry_consumer.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,9 @@ CREATE TABLE model_draft.ego_demand_hv_largescaleconsumer AS
365365
(
366366
SELECT osm.gid AS polygon_id,
367367
osm.area_ha,
368-
pp.gid AS powerplant_id,
368+
pp.id AS powerplant_id,
369369
pp.voltage_level
370-
FROM model_draft.ego_supply_conv_powerplant AS pp,
370+
FROM model_draft.ego_dp_supply_conv_powerplant AS pp,
371371
openstreetmap.osm_deu_polygon_urban_sector_3_industrial_mview AS osm
372372
WHERE (pp.voltage_level='3' OR pp.voltage_level='2' OR pp.voltage_level='1')
373373
AND ST_Intersects(pp.geom, ST_transform(osm.geom,4326))

dataprocessing/sql_snippets/ego_dp_powerflow_assignment_unid.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ SELECT ego_scenario_log('v0.3.0','output','model_draft','ego_supply_generator','
4848

4949
-- Update power plant tables and add information on unified id of generators
5050

51+
UPDATE model_draft.ego_dp_supply_res_powerplant SET un_id = NULL;
52+
5153
-- Update un_id from generators_total
5254
UPDATE model_draft.ego_dp_supply_conv_powerplant a
5355
SET un_id = b.un_id

dataprocessing/sql_snippets/ego_dp_powerflow_create_pp_mview.sql

Lines changed: 8 additions & 5 deletions
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"
@@ -164,9 +164,10 @@ ALTER MATERIALIZED VIEW model_draft.ego_supply_res_powerplant_nep2035_mview
164164
OWNER TO oeuser;
165165

166166
-- MView for eGo 100
167+
167168
DROP MATERIALIZED VIEW IF EXISTS model_draft.ego_supply_res_powerplant_ego100_mview CASCADE;
168169
CREATE MATERIALIZED VIEW model_draft.ego_supply_res_powerplant_ego100_mview AS
169-
SELECT
170+
SELECT DISTINCT ON (id)
170171
sub.*
171172
FROM (
172173
SELECT DISTINCT ON (id)
@@ -183,10 +184,11 @@ CREATE MATERIALIZED VIEW model_draft.ego_supply_res_powerplant_ego100_mview AS
183184
And preversion = 'v0.3.0'
184185
AND electrical_capacity > 0
185186
AND generation_type in ('solar','wind')
187+
AND generation_subtype not in ('wind_offshore')
186188
ORDER BY id
187189
) as sub
188190
UNION
189-
SELECT
191+
SELECT DISTINCT ON (id)
190192
sub2.*
191193
FROM (
192194
SELECT DISTINCT ON (id)
@@ -207,10 +209,10 @@ CREATE MATERIALIZED VIEW model_draft.ego_supply_res_powerplant_ego100_mview AS
207209
ORDER BY id
208210
) sub2
209211
UNION
210-
SELECT
212+
SELECT DISTINCT ON (id)
211213
sub3.*
212214
FROM (
213-
SELECT DISTINCT ON (id)
215+
SELECT DISTINCT ON (id)
214216
*
215217
FROM
216218
model_draft.ego_dp_supply_res_powerplant
@@ -219,6 +221,7 @@ CREATE MATERIALIZED VIEW model_draft.ego_supply_res_powerplant_ego100_mview AS
219221
FROM model_draft.ego_dp_supply_res_powerplant
220222
Where scenario in ('NEP 2035')
221223
AND generation_type not in ('biomass','gas','reservoir','run_of_river')
224+
AND generation_subtype not in ('wind_offshore')
222225
AND flag in ('commissioning', 'repowering')
223226
Group BY id
224227
Order by id)

dataprocessing/sql_snippets/ego_dp_powerflow_electrical_neighbour.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,14 @@ __author__ = "IlkaCu"
99

1010
DROP SEQUENCE IF EXISTS model_draft.ego_grid_hv_electrical_neighbours_bus_id CASCADE;
1111
CREATE SEQUENCE model_draft.ego_grid_hv_electrical_neighbours_bus_id;
12-
ALTER SEQUENCE model_draft.ego_grid_hv_electrical_neighbours_bus_id;
1312
SELECT setval('model_draft.ego_grid_hv_electrical_neighbours_bus_id', (max(bus_id)+1)) FROM model_draft.ego_grid_pf_hv_bus;
1413

1514
DROP SEQUENCE IF EXISTS model_draft.ego_grid_hv_electrical_neighbours_line_id CASCADE;
1615
CREATE SEQUENCE model_draft.ego_grid_hv_electrical_neighbours_line_id;
17-
ALTER SEQUENCE model_draft.ego_grid_hv_electrical_neighbours_line_id;
1816
SELECT setval('model_draft.ego_grid_hv_electrical_neighbours_line_id', (max(line_id)+1)) FROM model_draft.ego_grid_pf_hv_line;
1917

2018
DROP SEQUENCE IF EXISTS model_draft.ego_grid_hv_electrical_neighbours_transformer_id CASCADE;
2119
CREATE SEQUENCE model_draft.ego_grid_hv_electrical_neighbours_transformer_id;
22-
ALTER SEQUENCE model_draft.ego_grid_hv_electrical_neighbours_transformer_id;
2320
SELECT setval('model_draft.ego_grid_hv_electrical_neighbours_transformer_id', (max(trafo_id)+1)) FROM model_draft.ego_grid_pf_hv_transformer;
2421

2522

dataprocessing/sql_snippets/ego_dp_powerflow_hv_setup.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,7 @@ GRANT ALL ON TABLE model_draft.ego_grid_pf_hv_busmap TO oeuser;
11991199
-------------------------------------------------------------------
12001200
----------------------------- Comments ----------------------------
12011201
-------------------------------------------------------------------
1202+
/*
12021203
COMMENT ON COLUMN model_draft.ego_grid_pf_hv_bus.bus_id IS 'Unit: n/a
12031204
Description: Unique name
12041205
Status: Input (required)';
@@ -1470,7 +1471,7 @@ Status: Input (optional)';
14701471
COMMENT ON COLUMN model_draft.ego_grid_pf_hv_transformer.capital_cost IS 'Unit: currency/MVA
14711472
Description: Capital cost of extending s_nom by 1 MVA.
14721473
Status: Input (optional)';
1473-
1474+
*/
14741475
-------------------------------------------------------------------
14751476
----------------------------- INDEXING ----------------------------
14761477
-------------------------------------------------------------------

dataprocessing/sql_snippets/ego_dp_powerflow_timeseries_generator.sql

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,6 @@ INSERT into model_draft.ego_grid_pf_hv_generator
244244
when source LIKE '%%uranium%%' THEN 5
245245
when source LIKE '%%biomass%%' THEN 6
246246
when source LIKE '%%hard_coal%%' THEN 8
247-
when source LIKE '%%reservoir%%' THEN 10
248-
when source LIKE '%%geothermal%%' THEN 14
249-
when source
250247
END AS source
251248
FROM calc_renpass_gis.renpass_gis_linear_transformer A join
252249
(
@@ -294,8 +291,6 @@ INSERT into model_draft.ego_grid_pf_hv_generator
294291
when source LIKE '%%uranium%%' THEN 5
295292
when source LIKE '%%biomass%%' THEN 6
296293
when source LIKE '%%hard_coal%%' THEN 8
297-
when source LIKE '%%reservoir%%' THEN 10
298-
when source LIKE '%%geothermal%%' THEN 14
299294
END AS source
300295
FROM calc_renpass_gis.renpass_gis_linear_transformer A join
301296
(
@@ -342,8 +337,6 @@ INSERT into model_draft.ego_grid_pf_hv_generator
342337
when source LIKE '%%uranium%%' THEN 5
343338
when source LIKE '%%biomass%%' THEN 6
344339
when source LIKE '%%hard_coal%%' THEN 8
345-
when source LIKE '%%reservoir%%' THEN 10
346-
when source LIKE '%%geothermal%%' THEN 14
347340
END AS source
348341
FROM calc_renpass_gis.renpass_gis_linear_transformer A join
349342
(
@@ -389,6 +382,8 @@ INSERT into model_draft.ego_grid_pf_hv_generator
389382
WHEN source LIKE '%%run_of_river%%' THEN 9
390383
WHEN source LIKE '%%solar%%' THEN 12
391384
WHEN source LIKE '%%wind%%' THEN 13
385+
when source LIKE '%%reservoir%%' THEN 10
386+
when source LIKE '%%geothermal%%' THEN 14
392387
END AS source
393388
FROM calc_renpass_gis.renpass_gis_source A join
394389
(
@@ -429,6 +424,8 @@ INSERT into model_draft.ego_grid_pf_hv_generator
429424
WHEN source LIKE '%%run_of_river%%' THEN 9
430425
WHEN source LIKE '%%solar%%' THEN 12
431426
WHEN source LIKE '%%wind%%' THEN 13
427+
when source LIKE '%%reservoir%%' THEN 10
428+
when source LIKE '%%geothermal%%' THEN 14
432429
END AS source
433430
FROM calc_renpass_gis.renpass_gis_source A join
434431
(
@@ -469,6 +466,8 @@ INSERT into model_draft.ego_grid_pf_hv_generator
469466
WHEN source LIKE '%%run_of_river%%' THEN 9
470467
WHEN source LIKE '%%solar%%' THEN 12
471468
WHEN source LIKE '%%wind%%' THEN 13
469+
when source LIKE '%%reservoir%%' THEN 10
470+
when source LIKE '%%geothermal%%' THEN 14
472471
END AS source
473472
FROM calc_renpass_gis.renpass_gis_source A join
474473
(

dataprocessing/sql_snippets/ego_dp_substation_id_to_generator.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
/*
33
Identify corresponding subst_id for all power plants according to their voltage_level and geometry.
44
__copyright__ = "Flensburg University of Applied Sciences, Centre for Sustainable Energy Systems"

0 commit comments

Comments
 (0)