Skip to content

Commit d727032

Browse files
Merge pull request #900 from scud-soptim/generic_branch_examples
Generic branch examples
2 parents 6d8caab + 32ca789 commit d727032

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

docs/examples/Generic Branch Example.ipynb

+13-18
Original file line numberDiff line numberDiff line change
@@ -175,24 +175,24 @@
175175
"\"\"\"\n",
176176
"\n",
177177
"\n",
178-
"# Spannungsebenen des Transformators\n",
178+
"# Voltage levels of the transformer\n",
179179
"u_rated = {\"HV\": 200e3, \"MV\": 150e3, \"LV\": 30.2e3, \"AUX\": 200e3, \"Station1\": 150e3, \"Source\": 200e3}\n",
180180
"\n",
181-
"# Eingespeiste Leistung (200 kV) auf der 380 kV Seite\n",
181+
"# Injected power (200 kV) on the 380 kV side\n",
182182
"source_voltage = u_rated[\"Source\"] # 200 kV\n",
183183
"source_power = 1e40 # hohe Kurzschlussleistung -> v_pu = 1.0\n",
184184
"\n",
185-
"# Lasten\n",
185+
"# Loads\n",
186186
"load_MV = {\"P\": 30e6, \"Q\": 5e6}\n",
187187
"load_LV = {\"P\": 1.5e6, \"Q\": 0.15e6} # Eigenbedarf\n",
188188
"\n",
189-
"# Zuweisung der Knotennummern\n",
189+
"# Assignment of node numbers\n",
190190
"nodes = {\"HV\": 1, \"MV\": 2, \"LV\": 3, \"AUX\": 4, \"Station1\": 11, \"Source\": 14}\n",
191191
"non = len(nodes) # number of nodes\n",
192192
"# tap-changer\n",
193193
"v_tap = 6.0e3\n",
194194
"\n",
195-
"# Generiere Knoten\n",
195+
"# generated nodes\n",
196196
"node_data = initialize_array(DatasetType.input, ComponentType.node, non)\n",
197197
"node_data[\"id\"] = list(nodes.values())\n",
198198
"node_data[\"u_rated\"] = list(u_rated.values())\n",
@@ -202,15 +202,15 @@
202202
"\n",
203203
"# node_data[\"u_rated\"] = [u_rated['HV'], u_rated['MV'], u_rated['LV'], u_rated['AUX'],u_rated['Station1'] ]\n",
204204
"\n",
205-
"# Quelle auf der 380kV-Seite (Slack)\n",
205+
"# Slack\n",
206206
"source_data = initialize_array(DatasetType.input, ComponentType.source, 1)\n",
207207
"source_data[\"id\"] = [5]\n",
208208
"source_data[\"node\"] = [nodes[\"Source\"]]\n",
209209
"source_data[\"status\"] = [1]\n",
210210
"source_data[\"u_ref\"] = [1.0]\n",
211211
"source_data[\"sk\"] = [source_power]\n",
212212
"\n",
213-
"# Last auf der 110kV-Seite\n",
213+
"# Loads 110kV\n",
214214
"load_data = initialize_array(DatasetType.input, ComponentType.sym_load, 2)\n",
215215
"load_data[\"id\"] = [6, 7]\n",
216216
"load_data[\"type\"] = [LoadGenType.const_power, LoadGenType.const_power]\n",
@@ -222,10 +222,10 @@
222222
"node_name = [\"HV\", \"MV\", \"LV\", \"AUX\", \"Station1\", \"Source\"]\n",
223223
"branch_name = [\"BHV\", \"BMV\", \"BLV\", \"BLine2\", \"BLine1\"]\n",
224224
"\n",
225-
"# Generic Branch für jeden der zwei Wickler\n",
225+
"\n",
226226
"branch_data = initialize_array(DatasetType.input, ComponentType.generic_branch, 5)\n",
227227
"\n",
228-
"# Verbindungen der zwei Wickler\n",
228+
"\n",
229229
"branch_data[\"id\"] = [8, 9, 10, 12, 13]\n",
230230
"branch_data[\"from_node\"] = [nodes[\"HV\"], nodes[\"AUX\"], nodes[\"AUX\"], nodes[\"MV\"], nodes[\"Source\"]]\n",
231231
"branch_data[\"to_node\"] = [nodes[\"AUX\"], nodes[\"MV\"], nodes[\"LV\"], nodes[\"Station1\"], nodes[\"HV\"]]\n",
@@ -241,18 +241,17 @@
241241
"branch_data[\"theta\"] = [0.0, 0.0, 0.0, 0.0, 0.0]\n",
242242
"branch_data[\"sn\"] = [450e6, 450e6, 100e6, 100e6, 450e6]\n",
243243
"\n",
244-
"# Input-Daten sammeln\n",
245244
"input_data = {\n",
246245
" ComponentType.node: node_data,\n",
247246
" ComponentType.source: source_data,\n",
248247
" ComponentType.sym_load: load_data,\n",
249248
" ComponentType.generic_branch: branch_data,\n",
250249
"}\n",
251250
"\n",
252-
"# Überprüfung der Eingabedaten\n",
251+
"\n",
253252
"assert_valid_input_data(input_data=input_data, calculation_type=CalculationType.power_flow)\n",
254253
"\n",
255-
"# Power-Flow Modell erstellen und Berechnungen durchführen\n",
254+
"\n",
256255
"model = PowerGridModel(input_data)\n",
257256
"output_data = model.calculate_power_flow(\n",
258257
" symmetric=True, error_tolerance=1e-8, max_iterations=20, calculation_method=CalculationMethod.newton_raphson\n",
@@ -370,11 +369,10 @@
370369
" genb_out = output_data[ComponentType.generic_branch]\n",
371370
" df = pd.DataFrame(genb_out)\n",
372371
"\n",
373-
" # Summiere die aktive und reaktive Leistung über alle Branches hinweg\n",
372+
" # Sum up the active and reactive performance across all branches\n",
374373
" P_total = e6(df[\"p_from\"].sum()) + e6(df[\"p_to\"].sum())\n",
375374
" Q_total = e6(df[\"q_from\"].sum()) + e6(df[\"q_to\"].sum())\n",
376375
"\n",
377-
" # Ausgabe der Gesamtsummen\n",
378376
" print(\"\\nTotal Power for all Branches\")\n",
379377
" print(\"----------------------------\")\n",
380378
" print(f\"Total Active Power (P_total): {P_total:.2f} MW\")\n",
@@ -394,8 +392,6 @@
394392
"print_load_input(input_data)\n",
395393
"print_source_input(input_data)\n",
396394
"\n",
397-
"\n",
398-
"# Ausgabe der Spannungen und Ströme\n",
399395
"print(\"========================================\")\n",
400396
"print(\" Output Data\")\n",
401397
"print(\"========================================\")\n",
@@ -754,11 +750,10 @@
754750
" genb_out = output_data[ComponentType.generic_branch]\n",
755751
" df = pd.DataFrame(genb_out)\n",
756752
"\n",
757-
" # Summiere die aktive und reaktive Leistung über alle Branches hinweg\n",
753+
" # Sum up the active and reactive performance across all branches\n",
758754
" P_total = e6(df[\"p_from\"].sum()) + e6(df[\"p_to\"].sum())\n",
759755
" Q_total = e6(df[\"q_from\"].sum()) + e6(df[\"q_to\"].sum())\n",
760756
"\n",
761-
" # Ausgabe der Gesamtsummen\n",
762757
" print(\"\\nTotal Power for all Branches\")\n",
763758
" print(\"----------------------------\")\n",
764759
" print(f\"Total Active Power (P_total): {P_total:.2f} MW\")\n",

docs/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ examples/Validation Examples.ipynb
9393
examples/Make Test Dataset.ipynb
9494
examples/Asymmetric Calculation Example.ipynb
9595
examples/Transformer Examples.ipynb
96+
examples/Generic Branch Example.ipynb
9697
```
9798

9899
```{toctree}

0 commit comments

Comments
 (0)