Skip to content

Commit da96b43

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

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed
Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
1-
### Rules / Config Threshold
1+
## Rules / loadflow validation rules review (this file just for review purpose, do not merge )
22

3-
#### ShuntCompensator
3+
### ShuntCompensator validation
44

5-
- doc: https://powsybl.readthedocs.io/projects/powsybl-core/en/stable/grid_model/network_subnetwork.html#shunt-compensator
5+
#### Doc
6+
- core grid model: https://powsybl.readthedocs.io/projects/powsybl-core/en/stable/grid_model/network_subnetwork.html#shunt-compensator
7+
- core tool loadflow-validation: https://powsybl.readthedocs.io/projects/powsybl-core/en/stable/user/itools/loadflow-validation.html#shunts
8+
#### Notes (draft)
9+
1. Rule1: **|p| < e**
10+
- if connected, p must be undefined
11+
2. Rule2: **| q + #sections * B * v^2 | < e**
12+
- if connected, q must match expectedQ (within threshold), ( **expectedQ = #sections * B * v^2** ==> **| q + expectedQ | < e** )
13+
- if LinearModel then #sections = bPerSection else #sections = B
14+
- **bPerSection**: the susceptance per section in S
15+
- **currentSectionCount** = B (The susceptance of the shunt compensator in its current state)
16+
3. Rule3: if the shunt is disconnected, q should be undefined or 0
17+
#### Summary and actions
618

7-
* Rule1: if disconnected, q must be NaN or 0
8-
* Rule2: if connected, p must be NaN
9-
* Rule3: if connected, q must match expectedQ (within threshold)
19+
| | Documentation | Code (ShuntCompensatorsValidation) | Description | Suggestions (TODO) |
20+
|:-----------|:---------------------------------:|------------------------------------------------------------------------------------------------------------------:|----------------------------------------------------------------------------------------------:|---------------------------------:|
21+
| Condition1 | \|P\| < ε | if(!Double.isNaN(p)) return false | if shunt compensator is connected, p must be undefined | - [ ] Add to condition: `p != 0` |
22+
| Condition2 | \| q + #sections * B * v^2 \| < ε | if (ValidationUtils.areNaN(config, q, expectedQ) \| Math.abs(q - expectedQ) > config.getThreshold()) return false | if connected, q must match expectedQ (within threshold) <br/> expectedQ = #sections * B * v^2 | - |
23+
| 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` |
1024

11-
#### Generator TODO
12-
13-
- doc: https://powsybl.readthedocs.io/projects/powsybl-core/en/stable/grid_model/network_subnetwork.html#generator
25+
### Generator validation TODO
1426

27+
#### Doc
28+
- core grid model: https://powsybl.readthedocs.io/projects/powsybl-core/en/stable/grid_model/network_subnetwork.html#generator
29+
- core tool loadflow-validation:: https://powsybl.readthedocs.io/projects/powsybl-core/en/stable/user/itools/loadflow-validation.html#generators
30+
#### Notes (Draft)
1531
* Rule1: Active power (p) must match setpoint (expectedP) (within threshold)
1632
* Rule2: if voltageRegulatorOn="false" then reactive power (Q) should match to setpoint (targetQ) (within threshold)
1733
* Rule3: if voltageRegulatorOn="true"
@@ -20,4 +36,4 @@
2036
* Rule3.3: If V < targetV - threshold, generator (Qgen) must be at max reactive limit
2137
* Rule3.4: If |V-targetV| <= threshold, generator (Qgen) must be within [minQ, maxQ]
2238

23-
[//]: # (TODO)
39+
##### Actions TODO

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,24 +117,30 @@ public boolean checkShunts(String id, double p, double q, int currentSectionCoun
117117
}
118118
}
119119

120+
/**
121+
* Rule1: |p| < e : p must be undefined </br>
122+
* Rule2: | q + #sections * B * v^2 | < e : q must match expectedQ (within threshold) </br>
123+
* Rule3: if the shunt is disconnected, q should be undefined or 0 </br>
124+
*/
120125
public boolean checkShunts(String id, double p, double q, int currentSectionCount, int maximumSectionCount, double bPerSection,
121126
double v, double qMax, double nominalV, boolean connected, boolean mainComponent, ValidationConfig config,
122127
ValidationWriter shuntsWriter) {
123128
boolean validated = true;
124129

125-
if (!connected && !Double.isNaN(q) && q != 0) { // if the shunt is disconnected then either “q” is not defined or “q” is 0 => Rule1: if the shunt is disconnected, q should be NaN or 0
130+
if (!connected && !Double.isNaN(q) && q != 0) { // if the shunt is disconnected then either “q” is not defined or “q” is 0 => Rule3: if the shunt is disconnected, q should be NaN or 0
126131
LOGGER.warn("{} {}: {}: disconnected shunt Q {}", ValidationType.SHUNTS, ValidationUtils.VALIDATION_ERROR, id, q);
127132
validated = false;
128133
}
129134
// “q” = - bPerSection * currentSectionCount * v^2
130-
double expectedQ = -bPerSection * currentSectionCount * v * v; //TODO define this rule
135+
double expectedQ = -bPerSection * currentSectionCount * v * v;
131136
if (connected && ValidationUtils.isMainComponent(config, mainComponent)) {
132-
// “p” is always NaN => Rule2: if connected, p must be NaN
137+
// “p” is always NaN => Rule1: p must be NaN (|p| < e)
138+
// TODO add (or) p != 0 in this condition
133139
if (!Double.isNaN(p)) {
134140
LOGGER.warn("{} {}: {}: P={}", ValidationType.SHUNTS, ValidationUtils.VALIDATION_ERROR, id, p);
135141
validated = false;
136142
}
137-
// Rule3: if connected, q must match expectedQ (within threshold)
143+
// Rule2: q must match expectedQ (within threshold)
138144
if (ValidationUtils.areNaN(config, q, expectedQ) || Math.abs(q - expectedQ) > config.getThreshold()) {
139145
LOGGER.warn("{} {}: {}: Q {} {}", ValidationType.SHUNTS, ValidationUtils.VALIDATION_ERROR, id, q, expectedQ);
140146
validated = false;

0 commit comments

Comments
 (0)