Skip to content

Commit 9cf8afb

Browse files
authored
Merge pull request #762 from leovsch/main
Implementation of feature 720 asym_line
2 parents 9577d53 + d900aa4 commit 9cf8afb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1974
-7
lines changed

code_generation/data/attribute_classes/input.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,51 @@
127127
}
128128
]
129129
},
130+
{
131+
"name": "AsymLineInput",
132+
"base": "BranchInput",
133+
"attributes": [
134+
{
135+
"data_type": "double",
136+
"names": [
137+
"r_aa",
138+
"r_ba",
139+
"r_bb",
140+
"r_ca",
141+
"r_cb",
142+
"r_cc",
143+
"r_na",
144+
"r_nb",
145+
"r_nc",
146+
"r_nn",
147+
"x_aa",
148+
"x_ba",
149+
"x_bb",
150+
"x_ca",
151+
"x_cb",
152+
"x_cc",
153+
"x_na",
154+
"x_nb",
155+
"x_nc",
156+
"x_nn",
157+
"c_aa",
158+
"c_ba",
159+
"c_bb",
160+
"c_ca",
161+
"c_cb",
162+
"c_cc",
163+
"c0",
164+
"c1"
165+
],
166+
"description": "Lower triangle matrix values for R, X and C matrices"
167+
},
168+
{
169+
"data_type": "double",
170+
"names": "i_n",
171+
"description": "rated current"
172+
}
173+
]
174+
},
130175
{
131176
"name": "GenericBranchInput",
132177
"base": "BranchInput",

code_generation/data/dataset_class_maps/dataset_definitions.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
"names": ["line"],
1313
"class_name": "LineInput"
1414
},
15+
{
16+
"names": ["asym_line"],
17+
"class_name": "AsymLineInput"
18+
},
1519
{
1620
"names": ["link"],
1721
"class_name": "LinkInput"
@@ -71,7 +75,7 @@
7175
"class_name": "NodeOutput"
7276
},
7377
{
74-
"names": ["line", "link", "transformer", "generic_branch"],
78+
"names": ["line", "link", "transformer", "generic_branch", "asym_line"],
7579
"class_name": "BranchOutput"
7680
},
7781
{
@@ -116,6 +120,10 @@
116120
"names": ["line"],
117121
"class_name": "BranchUpdate"
118122
},
123+
{
124+
"names": ["asym_line"],
125+
"class_name": "BranchUpdate"
126+
},
119127
{
120128
"names": ["link"],
121129
"class_name": "BranchUpdate"
@@ -171,7 +179,7 @@
171179
"class_name": "NodeShortCircuitOutput"
172180
},
173181
{
174-
"names": ["line", "link", "transformer"],
182+
"names": ["line", "link", "transformer", "asym_line"],
175183
"class_name": "BranchShortCircuitOutput"
176184
},
177185
{

docs/user_manual/components.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,133 @@ $$
276276
\end{eqnarray}
277277
$$
278278

279+
### Asym Line
280+
281+
* type name: `asym_line`
282+
283+
`asym_line` is a {hoverxreftooltip}`user_manual/components:branch` with specified resistance and reactance per phase. A cable can be modelled as `line` or `asym_line`. An `asym_line` can only connect two nodes with the same rated voltage. If `i_n` is not provided, `loading` of line will be a `nan` value. The `asym_line` denotes a 3 or 4 phase line with phases `a`, `b`, `c` and optionally `n` for neutral.
284+
285+
#### Input
286+
287+
The provided values will be converted to a matrix representing the line's properties per phase in the following form:
288+
289+
$$
290+
\begin{bmatrix}
291+
\text{aa} & \text{ba} & \text{ca} & \text{na}\\
292+
\text{ba} & \text{bb} & \text{cb} & \text{nb}\\
293+
\text{ca} & \text{cb} & \text{cc} & \text{nc}\\
294+
\text{na} & \text{nb} & \text{nc} & \text{nn}
295+
\end{bmatrix}
296+
$$
297+
298+
This representation holds for all values `r_aa` ... `r_nn`, `x_aa` ... `x_nn` and `c_aa` ... `c_cc`. If the neutral values are not provided, the last row and column from the above matrix are omitted.
299+
300+
| name | data type | unit | description | required | update | valid values |
301+
| ------ | --------- | ---------- | --------------------------------- | ---------------------------- | :------: | :--------------------------------: |
302+
| `r_aa` | `double` | ohm (Ω) | Series serial resistance aa | ✔ | ❌ | `> 0` |
303+
| `r_ba` | `double` | ohm (Ω) | Series serial resistance ba | ✔ | ❌ | `> 0` |
304+
| `r_bb` | `double` | ohm (Ω) | Series serial resistance bb | ✔ | ❌ | `> 0` |
305+
| `r_ca` | `double` | ohm (Ω) | Series serial resistance ca | ✔ | ❌ | `> 0` |
306+
| `r_cb` | `double` | ohm (Ω) | Series serial resistance cb | ✔ | ❌ | `> 0` |
307+
| `r_cc` | `double` | ohm (Ω) | Series serial resistance cc | ✔ | ❌ | `> 0` |
308+
| `r_na` | `double` | ohm (Ω) | Series serial resistance na | ✨ for a neutral phase | ❌ | `> 0` |
309+
| `r_nb` | `double` | ohm (Ω) | Series serial resistance nb | ✨ for a neutral phase | ❌ | `> 0` |
310+
| `r_nc` | `double` | ohm (Ω) | Series serial resistance nc | ✨ for a neutral phase | ❌ | `> 0` |
311+
| `r_nn` | `double` | ohm (Ω) | Series serial resistance nn | ✨ for a neutral phase | ❌ | `> 0` |
312+
| `x_aa` | `double` | ohm (Ω) | Series serial reactance aa | ✔ | ❌ | `> 0` |
313+
| `x_ba` | `double` | ohm (Ω) | Series serial reactance ba | ✔ | ❌ | `> 0` |
314+
| `x_bb` | `double` | ohm (Ω) | Series serial reactance bb | ✔ | ❌ | `> 0` |
315+
| `x_ca` | `double` | ohm (Ω) | Series serial reactance ca | ✔ | ❌ | `> 0` |
316+
| `x_cb` | `double` | ohm (Ω) | Series serial reactance cb | ✔ | ❌ | `> 0` |
317+
| `x_cc` | `double` | ohm (Ω) | Series serial reactance cc | ✔ | ❌ | `> 0` |
318+
| `x_na` | `double` | ohm (Ω) | Series serial reactance na | ✨ for a neutral phase | ❌ | `> 0` |
319+
| `x_nb` | `double` | ohm (Ω) | Series serial reactance nb | ✨ for a neutral phase | ❌ | `> 0` |
320+
| `x_nc` | `double` | ohm (Ω) | Series serial reactance nc | ✨ for a neutral phase | ❌ | `> 0` |
321+
| `x_nn` | `double` | ohm (Ω) | Series serial reactance nn | ✨ for a neutral phase | ❌ | `> 0` |
322+
| `c_aa` | `double` | farad (F) | Shunt nodal capacitance matrix aa | ✨ for a full c matrix | ❌ | `> 0` |
323+
| `c_ba` | `double` | farad (F) | Shunt nodal capacitance matrix ba | ✨ for a full c matrix | ❌ | `> 0` |
324+
| `c_bb` | `double` | farad (F) | Shunt nodal capacitance matrix bb | ✨ for a full c matrix | ❌ | `> 0` |
325+
| `c_ca` | `double` | farad (F) | Shunt nodal capacitance matrix ca | ✨ for a full c matrix | ❌ | `> 0` |
326+
| `c_cb` | `double` | farad (F) | Shunt nodal capacitance matrix cb | ✨ for a full c matrix | ❌ | `> 0` |
327+
| `c_cc` | `double` | farad (F) | Shunt nodal capacitance matrix cc | ✨ for a full c matrix | ❌ | `> 0` |
328+
| `c0` | `double` | farad (F) | zero-sequence shunt capacitance | ✨ without a c matrix | ❌ | `> 0` |
329+
| `c1` | `double` | farad (F) | Series shunt capacitance | ✨ without a c matrix | ❌ | `> 0` |
330+
331+
For the r and x matrices providing values for the neutral phase is optional. To clarify which input values are required, please consult the tables below:
332+
333+
| r_aa ... r_cc | r_na | r_nb | r_nc | r_nn | result | Validation Error |
334+
| --------------- | -------- | -------- | -------- | -------- | -------- | ------------------------- |
335+
| ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
336+
| ✔ | ✔ | ✔ | ✔ | ❌ | ❌ | MultiFieldValidationError |
337+
| ✔ | ✔ | ✔ | ✔ | ❌ | ❌ | MultiFieldValidationError |
338+
| ✔ | ✔ | ✔ | ❌ | ❌ | ❌ | MultiFieldValidationError |
339+
| ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | MultiFieldValidationError |
340+
| ✔ | ❌ | ❌ | ❌ | ❌ | ✔ | |
341+
| ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | MultiFieldValidationError |
342+
343+
| x_aa ... x_cc | x_na | x_nb | x_nc | x_nn | result | Validation Error |
344+
| --------------- | -------- | -------- | -------- | -------- | -------- | ------------------------- |
345+
| ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
346+
| ✔ | ✔ | ✔ | ✔ | ❌ | ❌ | MultiFieldValidationError |
347+
| ✔ | ✔ | ✔ | ✔ | ❌ | ❌ | MultiFieldValidationError |
348+
| ✔ | ✔ | ✔ | ❌ | ❌ | ❌ | MultiFieldValidationError |
349+
| ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | MultiFieldValidationError |
350+
| ✔ | ❌ | ❌ | ❌ | ❌ | ✔ | |
351+
| ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | MultiFieldValidationError |
352+
353+
For the c-matrix values there are two options. Either provide all the required c-matrix values i.e. `c_aa` ... `c_cc` or provide `c0`, `c1`. Whenver both sets are supplied the powerflow calculations will use `c0`, `c1`.
354+
The table below provides guidance in providing valid input.
355+
356+
| c_aa ... c_cc | c0 | c1 | result | Validation Error |
357+
| ------------- | -------- | -------- | -------- | ------------------------- |
358+
| ✔ | ✔ | ✔ | ✔ | |
359+
| ✔ | ✔ | ❌ | ✔ | |
360+
| ✔ | ❌ | ❌ | ✔ | |
361+
| ❌ | ✔ | ❌ | ❌ | MultiFieldValidationError |
362+
| ❌ | ✔ | ✔ | ✔ | |
363+
364+
#### Electric Model
365+
366+
The cable properties are described using matrices where the $Z_{\text{series}}$ matrix is computed as:
367+
368+
$$
369+
Z_{\text{series}} = R + \mathrm{j} * X
370+
$$
371+
372+
Where $R$ and $X$ denote the resistance and reactance matrices build from the input respectively.
373+
374+
Whenever the neutral phase is provided in the $Z_{\text{series}}$, the $Z_{\text{series}}$ matrix will first be reduced to a 3 phase matrix $Z_{\text{reduced}}$ with a kron reduction as follows:
375+
376+
$$
377+
Z_{\text{aa}} = \begin{bmatrix}
378+
Z_{\text{0,0}} & Z_{\text{1,0}} & Z_{\text{2,0}}\\
379+
Z_{\text{1,0}} & Z_{\text{1,1}} & Z_{\text{2,1}}\\
380+
Z_{\text{2,0}} & Z_{\text{2,1}} & Z_{\text{2,2}}
381+
\end{bmatrix}
382+
$$
383+
$$
384+
Z_{\text{ab}} = \begin{bmatrix}
385+
Z_{\text{0,3}} \\
386+
Z_{\text{1,3}} \\
387+
Z_{\text{2,3}}
388+
\end{bmatrix}
389+
$$
390+
$$
391+
Z_{\text{ba}} = \begin{bmatrix}
392+
Z_{\text{3,0}} \\
393+
Z_{\text{3,1}} \\
394+
Z_{\text{3,2}}
395+
\end{bmatrix}
396+
$$
397+
$$
398+
Z_{\text{bb}}^{-1} = \frac{1}{Z_{\text{3,3}}}
399+
$$
400+
$$
401+
Z_{\text{reduced}} = Z_{\text{aa}} - Z_{\text{ba}} \otimes Z_{\text{ab}} \cdot Z_{\text{bb}}^{-1}
402+
$$
403+
404+
Where $Z_{\text{i,j}}$ denotes the row and column of the $Z_{\text{series}}$ matrix.
405+
279406
## Branch3
280407

281408
* type name: `branch3`

power_grid_model_c/power_grid_model/include/power_grid_model/all_components.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "common/component_list.hpp"
1010
// component include
1111
#include "component/appliance.hpp"
12+
#include "component/asym_line.hpp"
1213
#include "component/current_sensor.hpp"
1314
#include "component/fault.hpp"
1415
#include "component/generic_branch.hpp"
@@ -28,7 +29,7 @@
2829
namespace power_grid_model {
2930

3031
using AllComponents =
31-
ComponentList<Node, Line, Link, GenericBranch, Transformer, ThreeWindingTransformer, Shunt, Source, SymGenerator,
32-
AsymGenerator, SymLoad, AsymLoad, SymPowerSensor, AsymPowerSensor, SymVoltageSensor,
32+
ComponentList<Node, Line, AsymLine, Link, GenericBranch, Transformer, ThreeWindingTransformer, Shunt, Source,
33+
SymGenerator, AsymGenerator, SymLoad, AsymLoad, SymPowerSensor, AsymPowerSensor, SymVoltageSensor,
3334
AsymVoltageSensor, SymCurrentSensor, AsymCurrentSensor, Fault, TransformerTapRegulator>;
3435
} // namespace power_grid_model

power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/input.hpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,51 @@ struct LineInput {
9898
operator BranchInput const&() const { return reinterpret_cast<BranchInput const&>(*this); }
9999
};
100100

101+
struct AsymLineInput {
102+
ID id{na_IntID}; // ID of the object
103+
ID from_node{na_IntID}; // node IDs to which this branch is connected at both sides
104+
ID to_node{na_IntID}; // node IDs to which this branch is connected at both sides
105+
IntS from_status{na_IntS}; // whether the branch is connected at each side
106+
IntS to_status{na_IntS}; // whether the branch is connected at each side
107+
double r_aa{nan}; // Lower triangle matrix values for R, X and C matrices
108+
double r_ba{nan}; // Lower triangle matrix values for R, X and C matrices
109+
double r_bb{nan}; // Lower triangle matrix values for R, X and C matrices
110+
double r_ca{nan}; // Lower triangle matrix values for R, X and C matrices
111+
double r_cb{nan}; // Lower triangle matrix values for R, X and C matrices
112+
double r_cc{nan}; // Lower triangle matrix values for R, X and C matrices
113+
double r_na{nan}; // Lower triangle matrix values for R, X and C matrices
114+
double r_nb{nan}; // Lower triangle matrix values for R, X and C matrices
115+
double r_nc{nan}; // Lower triangle matrix values for R, X and C matrices
116+
double r_nn{nan}; // Lower triangle matrix values for R, X and C matrices
117+
double x_aa{nan}; // Lower triangle matrix values for R, X and C matrices
118+
double x_ba{nan}; // Lower triangle matrix values for R, X and C matrices
119+
double x_bb{nan}; // Lower triangle matrix values for R, X and C matrices
120+
double x_ca{nan}; // Lower triangle matrix values for R, X and C matrices
121+
double x_cb{nan}; // Lower triangle matrix values for R, X and C matrices
122+
double x_cc{nan}; // Lower triangle matrix values for R, X and C matrices
123+
double x_na{nan}; // Lower triangle matrix values for R, X and C matrices
124+
double x_nb{nan}; // Lower triangle matrix values for R, X and C matrices
125+
double x_nc{nan}; // Lower triangle matrix values for R, X and C matrices
126+
double x_nn{nan}; // Lower triangle matrix values for R, X and C matrices
127+
double c_aa{nan}; // Lower triangle matrix values for R, X and C matrices
128+
double c_ba{nan}; // Lower triangle matrix values for R, X and C matrices
129+
double c_bb{nan}; // Lower triangle matrix values for R, X and C matrices
130+
double c_ca{nan}; // Lower triangle matrix values for R, X and C matrices
131+
double c_cb{nan}; // Lower triangle matrix values for R, X and C matrices
132+
double c_cc{nan}; // Lower triangle matrix values for R, X and C matrices
133+
double c0{nan}; // Lower triangle matrix values for R, X and C matrices
134+
double c1{nan}; // Lower triangle matrix values for R, X and C matrices
135+
double i_n{nan}; // rated current
136+
137+
// implicit conversions to BaseInput
138+
operator BaseInput&() { return reinterpret_cast<BaseInput&>(*this); }
139+
operator BaseInput const&() const { return reinterpret_cast<BaseInput const&>(*this); }
140+
141+
// implicit conversions to BranchInput
142+
operator BranchInput&() { return reinterpret_cast<BranchInput&>(*this); }
143+
operator BranchInput const&() const { return reinterpret_cast<BranchInput const&>(*this); }
144+
};
145+
101146
struct GenericBranchInput {
102147
ID id{na_IntID}; // ID of the object
103148
ID from_node{na_IntID}; // node IDs to which this branch is connected at both sides

0 commit comments

Comments
 (0)