Skip to content

Commit a5c5ced

Browse files
committed
SVC validation review, prepare actions
Signed-off-by: Samir Romdhani <samir.romdhani_externe@rte-france.com>
1 parent b2d959d commit a5c5ced

File tree

2 files changed

+78
-51
lines changed

2 files changed

+78
-51
lines changed

loadflow/loadflow-validation/notes/note.md

Lines changed: 55 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,22 @@
77
- [ ] Flows (Branch Data :Line, TwoWindingsTransformer, TieLine)
88
- [ ] Transformers (TWT)
99
- [ ] Transformers3W (TWT 3W)
10+
- Examples
1011

11-
### ShuntCompensator validation
12+
### ShuntCompensator validation
1213

1314
#### Doc
1415
- core grid model: https://powsybl.readthedocs.io/projects/powsybl-core/en/stable/grid_model/network_subnetwork.html#shunt-compensator
1516
- core tool loadflow-validation: https://powsybl.readthedocs.io/projects/powsybl-core/en/stable/user/itools/loadflow-validation.html#shunts
16-
#### Notes (draft)
17-
1. Rule1: **|p| < e**
17+
#### Notes
18+
- [ ] Rule1: **|p| < e**
1819
- if connected, p must be undefined or 0
19-
2. Rule2: **| q + #sections * B * v^2 | < e**
20+
- [x] Rule2: **| q + #sections * B * v^2 | < e**
2021
- if connected, q must match expectedQ (within threshold), ( **expectedQ = - #sections * B * v^2** ==> **| q + expectedQ | < e** )
2122
- if LinearModel then #sections = bPerSection else #sections = B
2223
- **bPerSection**: the susceptance per section in S
2324
- **currentSectionCount** = B (The susceptance of the shunt compensator in its current state)
24-
3. Rule3: if the shunt is disconnected, q should be undefined or 0
25+
- [ ] Rule3: if the shunt is disconnected, q should be undefined or 0
2526
#### Summary and actions
2627

2728
| | Documentation | Code (ShuntCompensatorsValidation) | Description | Suggestions (TODO) |
@@ -31,61 +32,38 @@
3132
| Condition3 | - | if (!connected && !Double.isNaN(q) && q != 0) return false | if the shunt is disconnected, q should be undefined or 0 | - `add this rule in the doc` |
3233

3334

34-
#### Examples
35-
- Doc: A section of a shunt compensator is an individual capacitor or reactor: if its reactive power (Q) is negative, it is a capacitor; if it is positive, it is a reactor.
36-
1. shunt compensator as **capacitor**
37-
- Example
38-
- bPerSection = 1 > 0
39-
- currentSectionCount = 1
40-
- Bus (v = 1)
41-
- Rule: Q = -bPerSection * currentSectionCount * terminalState.v() * terminalState.v();
42-
- SLD
43-
44-
![shunt capacitor](../notes/diagram/shunt_capacitor.svg)
45-
46-
2. shunt compensator as **reactor**
47-
- Example
48-
- bPerSection = -1 < 0
49-
- currentSectionCount = 1
50-
- Bus (v = 1)
51-
- Rule: Q = -bPerSection * currentSectionCount * terminalState.v() * terminalState.v();
52-
- SLD
53-
54-
![shunt reactor](../notes/diagram/shunt_reactor.svg)
55-
5635
### Static VAR compensator validation
5736

5837
#### Doc
5938
- core grid model: https://powsybl.readthedocs.io/projects/powsybl-core/en/stable/grid_model/network_subnetwork.html#static-var-compensator
6039
- core tool loadflow-validation: https://powsybl.readthedocs.io/projects/powsybl-core/en/stable/user/itools/loadflow-validation.html#static-var-compensators
6140

62-
#### Notes (draft)
63-
* Rule1: if connected and no **p** or **q** then **reactivePowerSetpoint** must be undefined or equal to 0
64-
* Rule2: if connected and (**p** AND **q**) are defined, Then
65-
* => (p) active power should be equal to 0 (within threshold) ! (TODO to clarify)
66-
* => if **regulationMode = REACTIVE_POWER**, Then
67-
* => (config, reactivePowerSetpoint, qMin, qMax) not defined => OK
68-
* => q must match reactivePowerSetpoint (within threshold)
69-
* => if **regulationMode = VOLTAGE** then
70-
* => (config, qMin, qMax, vControlled, voltageSetpoint) not defined => OK
71-
* => V is lower than voltageSetpoint (within threshold) AND q must match qMax (within threshold)
72-
* => V is higher than voltageSetpoint (within threshold) AND q must match Qmin (within threshold)
73-
* => V is at the controlled bus (within threshold) AND q is bounded within [Qmin=-bMax*V*V, Qmax=-bMin*V*V]
74-
* => if regulating is false then reactive power should be equal to 0
41+
#### Notes
42+
- Regulation : VOLTAGE, REACTIVE_POWER
43+
- [ ] Rule1: active power (p) (within threshold) should be equal to 0
44+
- [ ] Rule2: **reactivePowerSetpoint** must be undefined or equal to 0 if NO (**p** or **q**)
45+
- TODO (doc states that p should be equal to 0 !, if so **reactivePowerSetpoint** must be undefined or equal to 0 !)
46+
- Suggestion => check only if (q undefined or equal to 0 then **reactivePowerSetpoint** ~ 0)
47+
- [x] Rule3: **regulationMode = REACTIVE_POWER** then same condition as generator without voltage regulation
48+
- Rule3.1: => (config, reactivePowerSetpoint, qMin, qMax) not defined => OK
49+
- Rule3.2: => q must match reactivePowerSetpoint (within threshold)
50+
- [x] Rule4: **regulationMode = VOLTAGE** then same condition as generator with voltage regulation
51+
- Rule4.1: => (config, qMin, qMax, vControlled, voltageSetpoint) not defined => OK
52+
- Rule4.2: => V is lower than voltageSetpoint (within threshold) AND q must match qMax (within threshold)
53+
- Rule4.3: => V is higher than voltageSetpoint (within threshold) AND q must match Qmin (within threshold)
54+
- Rule4.4: => V is at the controlled bus (within threshold) AND q is bounded within [Qmin=-bMax*V*V, Qmax=-bMin*V*V]
55+
- [ ] Rule5: if regulating is false then reactive power (q) should be equal to 0
7556
##### Actions TODO
7657

77-
| | Documentation | Code (StaticVarCompensator) | Description | Suggestions (TODO) |
78-
|:-----------|:----------------------------------------------------------------------------------------------------:|----------------------------:|---------------------------------------------------------------------------------:|-----------------------------:|
79-
| Condition1 | - | | no **p** or **q** then **reactivePowerSetpoint** must be undefined or equal to 0 | |
80-
| Condition2 | - | | **p** AND **q** are defined, then follow regulation mode | |
81-
| Condition3 | doc state `same checks as a generator without voltage regulation` | | regulation mode is **REACTIVE_POWER** | |
82-
| Condition4 | doc state `same checks as a generator with voltage regulation with the following bounds: Qmin, Qmax` | | regulation mode is **VOLTAGE** | |
83-
| Condition4 | - | | if regulating is false then reactive power should be equal to 0 | - `add this rule in the doc` |
58+
| | Documentation | Code (StaticVarCompensator) | Description | Suggestions (TODO) |
59+
|:-----------|:------------------------------------------------------------------------------------------:|------------------------------------------:|---------------------------------------------------------------------------------:|-------------------------------------------------------------------------------------------------------------:|
60+
| Condition1 | `targetP = 0 MW` | if (Math.abs(p) > Threshold) return false | active power should be equal to 0 | ? |
61+
| Condition2 | - | `checkSVCsNaNValues` | **reactivePowerSetpoint** must be undefined or equal to 0 if NO (**p** or **q**) | - `add this rule in the doc`, - check only if (q undefined or equal to 0 then **reactivePowerSetpoint** ~ 0) |
62+
| Condition3 | `same checks as a generator without voltage regulation` | `reactivePowerRegulationModeKo` | Rule3.1, Rule3.2 | - |
63+
| Condition4 | `same checks as a generator with voltage regulation with the following bounds: Qmin, Qmax` | `voltageRegulationModeKo` | Rule4.1, Rule4.2, Rule4.3, Rule4.4 | - |
64+
| Condition5 | - | `notRegulatingKo` | if regulating is false then reactive power should be equal to 0 | - `add this rule in the doc` |
8465

8566

86-
#### Examples
87-
![svc](../notes/diagram/svc.svg)
88-
8967
### Generator validation TODO
9068

9169
#### Doc
@@ -101,3 +79,30 @@
10179
* Rule3.4: If |V-targetV| <= threshold, generator (Qgen) must be within [minQ, maxQ]
10280

10381
##### Actions TODO
82+
83+
84+
---
85+
86+
#### Examples
87+
##### ShuntCompensator validation
88+
- Doc: A section of a shunt compensator is an individual capacitor or reactor: if its reactive power (Q) is negative, it is a capacitor; if it is positive, it is a reactor.
89+
1. shunt compensator as **capacitor**
90+
- Example
91+
- bPerSection = 1 > 0
92+
- currentSectionCount = 1
93+
- Bus (v = 1)
94+
- Rule: Q = -bPerSection * currentSectionCount * terminalState.v() * terminalState.v();
95+
- SLD
96+
![shunt capacitor](../notes/diagram/shunt_capacitor.svg)
97+
98+
2. shunt compensator as **reactor**
99+
- Example
100+
- bPerSection = -1 < 0
101+
- currentSectionCount = 1
102+
- Bus (v = 1)
103+
- Rule: Q = -bPerSection * currentSectionCount * terminalState.v() * terminalState.v();
104+
- SLD
105+
![shunt reactor](../notes/diagram/shunt_reactor.svg)
106+
107+
##### Static VAR compensator validation
108+
![svc](../notes/diagram/svc.svg)

loadflow/loadflow-validation/src/main/java/com/powsybl/loadflow/validation/StaticVarCompensatorsValidation.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,23 @@ public boolean checkSVCs(String id, double p, double q, double vControlled, doub
120120
}
121121
}
122122

123+
/**
124+
*
125+
* Rule1: active power (p) (within threshold) should be equal to 0 <br/>
126+
* Rule2: **reactivePowerSetpoint** must be undefined or equal to 0 if NO (**p** or **q**)<br/>
127+
* - TODO (doc states that p should be equal to 0, if so **reactivePowerSetpoint** must be undefined or equal to 0)<br/>
128+
* - Suggestion => check only if (q undefined or equal to 0 then **reactivePowerSetpoint** must be 0)<br/><br/>
129+
* Rule3: **regulationMode = REACTIVE_POWER** then same condition as generator without voltage regulation<br/>
130+
* - Rule3.1: => (config, reactivePowerSetpoint, qMin, qMax) not defined => OK<br/>
131+
* - Rule3.2: => q must match reactivePowerSetpoint (within threshold)<br/><br/>
132+
* Rule4: **regulationMode = VOLTAGE** then same condition as generator with voltage regulation<br/>
133+
* - Rule4.1: => (config, qMin, qMax, vControlled, voltageSetpoint) not defined => OK<br/>
134+
* - Rule4.2: => V is lower than voltageSetpoint (within threshold) AND q must match qMax (within threshold)<br/>
135+
* - Rule4.3: => V is higher than voltageSetpoint (within threshold) AND q must match Qmin (within threshold)<br/>
136+
* - Rule4.4: => V is at the controlled bus (within threshold) AND q is bounded within [Qmin=-bMax*V*V, Qmax=-bMin*V*V]<br/><br/>
137+
* Rule5: if regulating is false then reactive power (q) should be equal to 0<br/>
138+
*
139+
*/
123140
public boolean checkSVCs(String id, double p, double q, double vControlled, double vController, double nominalVcontroller, double reactivePowerSetpoint, double voltageSetpoint,
124141
RegulationMode regulationMode, boolean regulating, double bMin, double bMax, boolean connected, boolean mainComponent,
125142
ValidationConfig config, ValidationWriter svcsWriter) {
@@ -130,8 +147,10 @@ public boolean checkSVCs(String id, double p, double q, double vControlled, doub
130147

131148
if (connected && ValidationUtils.isMainComponent(config, mainComponent)) {
132149
if (Double.isNaN(p) || Double.isNaN(q)) {
150+
// Rule2 : TODO
133151
validated = checkSVCsNaNValues(id, p, q, reactivePowerSetpoint);
134152
} else {
153+
// Rule1, Rule3, Rule4, Rule5
135154
validated = checkSVCsValues(id, p, q, vControlled, vController, nominalVcontroller, reactivePowerSetpoint, voltageSetpoint, regulationMode, regulating, bMin, bMax, config);
136155
}
137156
}
@@ -156,7 +175,7 @@ private static boolean checkSVCsValues(String id, double p, double q, double vCo
156175
double nominalVcontroller, double reactivePowerSetpoint, double voltageSetpoint,
157176
RegulationMode regulationMode, boolean regulating, double bMin, double bMax, ValidationConfig config) {
158177
boolean validated = true;
159-
// active power should be equal to 0
178+
// Rule1: active power should be equal to 0
160179
if (Math.abs(p) > config.getThreshold()) {
161180
LOGGER.warn("{} {}: {}: P={}", ValidationType.SVCS, ValidationUtils.VALIDATION_ERROR, id, p);
162181
validated = false;
@@ -169,6 +188,7 @@ private static boolean checkSVCsValues(String id, double p, double q, double vCo
169188
double qMin = -bMax * vAux * vAux;
170189
double qMax = -bMin * vAux * vAux;
171190

191+
//Rule3: **regulationMode = REACTIVE_POWER**
172192
if (reactivePowerRegulationModeKo(regulationMode, q, qMin, qMax, reactivePowerSetpoint, config)) {
173193
LOGGER.warn(
174194
"{} {}: {}: regulator mode={} - Q={} qMin={} qMax={} bMin={} bMax={} Vcontroller={} nominalV={} reactivePowerSetpoint={}",
@@ -177,6 +197,7 @@ private static boolean checkSVCsValues(String id, double p, double q, double vCo
177197
validated = false;
178198
}
179199

200+
// Rule4: **regulationMode = VOLTAGE**
180201
if (voltageRegulationModeKo(regulationMode, q, qMin, qMax, vControlled, voltageSetpoint, config)) {
181202
LOGGER.warn(
182203
"{} {}: {}: regulator mode={} - Q={} qMin={} qMax={} bMin={} bMax={} Vcontroller={} Vcontrolled={} targetV={}",
@@ -185,6 +206,7 @@ private static boolean checkSVCsValues(String id, double p, double q, double vCo
185206
validated = false;
186207
}
187208

209+
// Rule5: if regulating is false then reactive power (q) should be equal to 0
188210
if (notRegulatingKo(regulating, q, config)) {
189211
LOGGER.warn("{} {}: {}: regulator mode={} - Q={} ", ValidationType.SVCS, ValidationUtils.VALIDATION_ERROR,
190212
id, regulationMode, q);

0 commit comments

Comments
 (0)