Skip to content

Commit 494cda3

Browse files
committed
Merge branch 'update-pylovo-generation' into 'develop'
Update environment and confiig handling in pylovo-generation See merge request need/NEED-infdb!132
2 parents 4d5c22e + c5c010f commit 494cda3

11 files changed

Lines changed: 189 additions & 201 deletions

File tree

.gitmodules

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[submodule "tools/pylovo-generation/src/pylovo"]
22
path = tools/pylovo-generation/src/pylovo
33
url = https://github.com/tum-ens/pylovo.git
4-
branch = feature/flexible-configs
54
[submodule "services/infdb-qwc"]
65
path = services/infdb-qwc
76
url = https://github.com/tum-ens/infDB-qwc.git
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""
2+
Template module for .
3+
4+
This module provides an empty file to add your own code and functions
5+
"""
6+
7+
8+
def example_function(variable):
9+
"""
10+
Example function that returns the input variable.
11+
"""
12+
13+
# add your code here
14+
15+
return variable

tools/infdb-basedata-buildings/src/example.py

Whitespace-only changes.

tools/infdb-basedata-ways/src/demo.py

Lines changed: 0 additions & 112 deletions
This file was deleted.

tools/pylovo-generation/compose.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ services:
44
build:
55
context: .
66
dockerfile: Dockerfile
7-
stdin_open: true # Enable stdin for interactive input
8-
tty: true # Allocate a pseudo-TTY
97
env_file:
10-
- ../../.env # Use root .env file with database credentials
11-
- pylovo.env
8+
- ../../.env # root env (DB creds, etc.)
9+
- env_pylovo_generation.env
1210
volumes:
1311
- ./configs:/app/configs
14-
- ./src/pylovo:/app/mnt/pylovo
15-
- ../../configs:/app/mnt/configs-infdb #:ro # for root *.yml configs
16-
- ../../src/infdb_package:/app/mnt/infdb_package #
12+
- ./src/pylovo:/app/src/pylovo
13+
- ../../src/infdb_package:/app/mnt/infdb_package
1714
extra_hosts:
1815
- "host.docker.internal:host-gateway"
16+
depends_on:
17+
infdb-basedata-buildings:
18+
condition: service_completed_successfully
19+
infdb-basedata-ways:
20+
condition: service_completed_successfully
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# =============================================================================
2+
# Version CONFIGURATION
3+
# =============================================================================
4+
VERSION_ID: "1" # Change version if you changed any grid parameters or queries (e.g. transformer query)
5+
VERSION_COMMENT: default # State here which parameters, queries are used to compute the grids with current VERSION_ID
6+
7+
# =============================================================================
8+
# EXECUTION CONFIGURATION
9+
# =============================================================================
10+
PARALLEL: True # Toggles whether the grid generation uses multiple workers in parallel
11+
N_JOBS_PERCENT: 30 # Percentage of CPU cores to use for parallel grid generation
12+
ANALYZE_GRIDS: True # Toggles analysis after grid generation (basic parameters, trafo analysis, cable counting)
13+
LOG_LEVEL: INFO #DEBUG, INFO, ERROR - Logging configurations
14+
SAVE_GRID_FOLDER: False # Toggles whether the grid json files will be saved in a folder or just in the db
15+
RESULT_DIR: results # Directory for storing analysis results and outputs
16+
17+
# =============================================================================
18+
# GRID GENERATION CONFIGURATION
19+
# =============================================================================
20+
ELECTRICAL_BACKEND: pandapower # Electrical backend configuration - Options: 'pandapower', 'opendss'
21+
### Electrical load calculation parameters
22+
PEAK_LOAD_HOUSEHOLD: 17.425 # default: 14.5kW, around 15% of buildings have 30 kW with electric hot water supply
23+
SIM_FACTOR: {Residential: 0.07, Public: 0.6, Commercial: 0.5} # Simultaneous load factor - formula: simultaneous_load(n) = peak_load * (sim_factor + (1 - sim_factor) * (n ** (-3 / 4)))
24+
DEFAULT_POWER_FACTOR: 0.95 # cos(phi) for residential loads
25+
26+
### Consumer categories for load calculation
27+
CONSUMER_CATEGORIES:
28+
- {consumer_category_id: 1, definition: Commercial, peak_load: null, yearly_consumption: null, peak_load_per_m2: 79.00, yearly_consumption_per_m2: 245.70, sim_factor: 0.50}
29+
- {consumer_category_id: 2, definition: Public, peak_load: null, yearly_consumption: null, peak_load_per_m2: 29.00, yearly_consumption_per_m2: 155.70, sim_factor: 0.60}
30+
- {consumer_category_id: 3, definition: SFH, peak_load: PEAK_LOAD_HOUSEHOLD, yearly_consumption: 0.00, peak_load_per_m2: null, yearly_consumption_per_m2: null, sim_factor: 0.07}
31+
- {consumer_category_id: 4, definition: MFH, peak_load: PEAK_LOAD_HOUSEHOLD, yearly_consumption: 0.00, peak_load_per_m2: null, yearly_consumption_per_m2: null, sim_factor: 0.07}
32+
- {consumer_category_id: 5, definition: TH, peak_load: PEAK_LOAD_HOUSEHOLD, yearly_consumption: 0.00, peak_load_per_m2: null, yearly_consumption_per_m2: null, sim_factor: 0.07}
33+
- {consumer_category_id: 6, definition: AB, peak_load: PEAK_LOAD_HOUSEHOLD, yearly_consumption: 0.00, peak_load_per_m2: null, yearly_consumption_per_m2: null, sim_factor: 0.07}
34+
35+
### Equipment data
36+
TRANSFORMERS:
37+
- {name: Tr_250, s_max_kva: 250, cost_eur: 5000, typ: Transformer}
38+
- {name: Tr_400, s_max_kva: 400, cost_eur: 8000, typ: Transformer}
39+
- {name: Tr_630, s_max_kva: 630, cost_eur: 12000, typ: Transformer}
40+
- {name: Tr_800, s_max_kva: 800, cost_eur: 16000, typ: Transformer}
41+
42+
FEEDER_CABLES:
43+
- {name: NAYY_4_120, max_i_a: 242, r_mohm_per_km: 225, x_mohm_per_km: 80, z_mohm_per_km: 239, cost_eur: 19, typ: Cable}
44+
- {name: NAYY_4_150, max_i_a: 270, r_mohm_per_km: 208, x_mohm_per_km: 80, z_mohm_per_km: 223, cost_eur: 24, typ: Cable}
45+
- {name: NAYY_4_185, max_i_a: 313, r_mohm_per_km: 164, x_mohm_per_km: 80, z_mohm_per_km: 181, cost_eur: 33, typ: Cable}
46+
- {name: NAYY_4_240, max_i_a: 357, r_mohm_per_km: 127, x_mohm_per_km: 80, z_mohm_per_km: 150, cost_eur: 45, typ: Cable}
47+
# - {name: NA2XS(F)2Y_1x240RM_12_20kV_ir_240, max_i_a: 456, r_mohm_per_km: 144, x_mohm_per_km: 182, z_mohm_per_km: 236, cost_eur: 45, typ: Cable}
48+
# - {name: NA2XS(F)2Y_1x150RM_12_20kV_ir_150, max_i_a: 353, r_mohm_per_km: 227, x_mohm_per_km: 195, z_mohm_per_km: 299, cost_eur: 35, typ: Cable}
49+
# - {name: NAYY_4_95, max_i_a: 215, r_mohm_per_km: 320, x_mohm_per_km: 82, z_mohm_per_km: 330, cost_eur: 21, typ: Cable}
50+
# - {name: NYY_4_95, max_i_a: 280, r_mohm_per_km: 193, x_mohm_per_km: 82, z_mohm_per_km: 210, cost_eur: 37, typ: Cable}
51+
# - {name: NFA2X_4_95, max_i_a: 245, r_mohm_per_km: 320, x_mohm_per_km: 0, z_mohm_per_km: 320, cost_eur: 10, typ: Cable}
52+
# - {name: NFA2X_4_70, max_i_a: 205, r_mohm_per_km: 443, x_mohm_per_km: 0, z_mohm_per_km: 443, cost_eur: 8, typ: Cable}
53+
# - {name: NFA2X_4_50, max_i_a: 165, r_mohm_per_km: 641, x_mohm_per_km: 0, z_mohm_per_km: 641, cost_eur: 7, typ: Cable}
54+
55+
CONSUMER_CONNECTION_CABLES:
56+
- {name: NYY_4_35, max_i_a: 159, r_mohm_per_km: 524, x_mohm_per_km: 85, z_mohm_per_km: 531, cost_eur: 16, typ: Cable}
57+
- {name: NAYY_4_50, max_i_a: 142, r_mohm_per_km: 642, x_mohm_per_km: 83, z_mohm_per_km: 647, cost_eur: 11, typ: Cable}
58+
- {name: NYY_4_70, max_i_a: 232, r_mohm_per_km: 268, x_mohm_per_km: 82, z_mohm_per_km: 280, cost_eur: 28, typ: Cable}
59+
# - {name: NYY_4_16, max_i_a: 103, r_mohm_per_km: 1150, x_mohm_per_km: 90, z_mohm_per_km: 1153, cost_eur: 7, typ: Cable}
60+
61+
### CABLE DIMENSIONING PARAMETERS
62+
VN: 400 # Nominal voltage in the low voltage grid
63+
V_BAND_LOW: 0.95 # Lower voltage band defines a 5% feeder voltage-drop budget.
64+
V_BAND_HIGH: 1.05
65+
# Voltage drop limit for all consumer service-drop connections (percentage of nominal voltage per km).
66+
VOLTAGE_DROP_LOAD_PERCENT_PER_KM: 5
67+
68+
# Commercial/Public buildings above this peak load are assumed to use a dedicated MV-side connection
69+
MV_DIRECT_CONNECTION_LOAD_THRESHOLD_KW: 100
70+
71+
# Minimum routed distance from transformer to an existing upstream split point before a later branch may reuse
72+
# that point instead of starting as a separate transformer feeder. Switch the feature off by setting a very high value.
73+
MIN_SHARED_PREFIX_LENGTH_M: 50
74+
75+
76+
# =============================================================================
77+
# TRANSFORMER PLACEMENT PARAMETERS
78+
# =============================================================================
79+
# Settlement_types thresholds
80+
RURAL_MAX_HOUSEHOLDS: 1.3 # Maximum average number of households per building for rural settlements
81+
URBAN_MIN_HOUSEHOLDS: 3.2 # Minimum average number of households per building for urban settlements
82+
RURAL_MIN_BUILDING_DISTANCE: 55 # Minimum average distance between buildings for rural settlements
83+
URBAN_MAX_BUILDING_DISTANCE: 20 # Maximum average distance between buildings for urban settlements
84+
85+
### Transformer mapping: Settlement Type (1=low/rural,2=medium/semi-urban,3=high/urban) -> Allowed Transformer Capacities (s_max_kva)
86+
TRANSFORMER_MAPPING:
87+
1: [250, 400, 630]
88+
2: [400, 630]
89+
3: [400, 630, 800]
90+
91+
### Clustering
92+
# Transformer placement parameters
93+
MAX_BROWNFIELD_TRAFO_DISTANCE: 750 # Maximum assignment distance to an existing brownfield transformer
94+
MAX_GREENFIELD_TRAFO_DISTANCE: 900 # Maximum distance from a greenfield transformer to any cluster connection point
95+
# Larger components are divided by k-means clustering in roughly LARGE_COMPONENT_DIVIDER sizes
96+
LARGE_COMPONENT_LOWER_BOUND: 2500 # Threshold for number of buildings in a component to apply k-means clustering
97+
LARGE_COMPONENT_DIVIDER: 1250 # Divider to derive the target number of clusters for k-means clustering
98+
# Seed for the initialization of the k-means clustering for transformer placement - keeping the same ensures deterministic behavior
99+
K_MEANS_SEED: 3329829316 # Has to be an integer between 0 and 4294967295
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# infdb-package compatible database connection vars (passed through from root .env)
2+
SERVICES_POSTGRES_HOST="${SERVICES_POSTGRES_HOST}"
3+
SERVICES_POSTGRES_DB="${SERVICES_POSTGRES_DB}"
4+
SERVICES_POSTGRES_USER="${SERVICES_POSTGRES_USER}"
5+
SERVICES_POSTGRES_PASSWORD="${SERVICES_POSTGRES_PASSWORD}"
6+
SERVICES_POSTGRES_EXPOSED_PORT="${SERVICES_POSTGRES_EXPOSED_PORT}"
7+
SERVICES_POSTGRES_EPSG="${SERVICES_POSTGRES_EPSG}"
8+
# pylovo submodule connection vars (mapped from SERVICES_POSTGRES_*)
9+
HOST="${SERVICES_POSTGRES_HOST}"
10+
DBNAME="${SERVICES_POSTGRES_DB}"
11+
DBUSER="${SERVICES_POSTGRES_USER}"
12+
PASSWORD="${SERVICES_POSTGRES_PASSWORD}"
13+
PORT="${SERVICES_POSTGRES_EXPOSED_PORT}"
14+
USE_INFDB="True"
15+
PYLOVO_CONFIG_DIR=/app/configs # override pylovo configs from infdb repo without touching the submodule
16+
UV_LINK_MODE=copy # for development only, because of mount
17+
AGS="${AGS}"

0 commit comments

Comments
 (0)