Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 6 points diagram to compute Qmin/Qmax of generators in ACOPF #92

Merged
merged 56 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
b767132
Divide OpenReacRunnerTest into several TUs
p-arvy Nov 27, 2024
8da89b0
Add TUs for ACOPF indicators
p-arvy Nov 27, 2024
50548d2
Add tests on equipment bounds in optimization of OpenReac
p-arvy Dec 4, 2024
802dd1d
Improve tests on ouput indicators of OpenReac
p-arvy Dec 4, 2024
81908d8
Clean
p-arvy Dec 4, 2024
f6746be
Add resources
p-arvy Dec 4, 2024
28047a0
Merge branch 'refs/heads/main' into refactor-open-reac-tests
p-arvy Dec 4, 2024
84e5da6
Clean
p-arvy Dec 12, 2024
a54206b
Clean code adding new TUs
p-arvy Dec 12, 2024
cd043e8
Clean
p-arvy Dec 12, 2024
1f1c0dd
Merge branch 'refs/heads/main' into refactor-open-reac-tests
p-arvy Dec 12, 2024
3a3b1fd
Merge branch 'refs/heads/main' into refactor-open-reac-tests
p-arvy Dec 13, 2024
d78e93d
Clean
p-arvy Dec 30, 2024
724d6fe
Put computer and time indicators as DEBUG indicators
p-arvy Dec 17, 2024
abfc91b
Clean
p-arvy Dec 19, 2024
2afbe89
Add indicators test for OpenReac
p-arvy Dec 12, 2024
e11a2f6
Add tests for bounds
p-arvy Dec 12, 2024
6f4612b
Add TUs on Q bounds
p-arvy Dec 13, 2024
8aa0e87
Small clean
p-arvy Dec 13, 2024
1044424
Update resources
p-arvy Dec 17, 2024
7070e0e
Clean
p-arvy Dec 19, 2024
f5149f3
Clean after rebase
p-arvy Dec 30, 2024
ac830a4
Add indicators test for OpenReac
p-arvy Dec 12, 2024
d08278b
line opened on one side
p-arvy Sep 17, 2024
2bd4228
wip
p-arvy Nov 27, 2024
68edf3a
Add RTC on opened branch and associated TUs
p-arvy Nov 27, 2024
75a1d48
Fix indicators on opened branches
p-arvy Dec 16, 2024
2e2f102
Add TUs on opened branches
p-arvy Dec 16, 2024
4785e96
Add resources for branches tests
p-arvy Dec 16, 2024
da38e46
Clean
p-arvy Dec 16, 2024
cc66e6a
Small clean
p-arvy Dec 16, 2024
e01c18d
Update TUs
p-arvy Dec 18, 2024
287b62b
Clean
p-arvy Dec 19, 2024
2063122
Add doc
p-arvy Dec 19, 2024
9d951c1
Improve comment
p-arvy Dec 30, 2024
bb65393
Wip
p-arvy Dec 18, 2024
6e7a9c9
Clean
p-arvy Dec 18, 2024
1f9960c
Add comments/doc
p-arvy Dec 30, 2024
8fdccf6
Update doc
p-arvy Dec 30, 2024
db3f852
Add 6 points diagrams for generators
p-arvy Dec 18, 2024
4d14b8b
wip
p-arvy Dec 20, 2024
f4c4212
wip
p-arvy Dec 30, 2024
4023c03
Upadte TUs
p-arvy Jan 2, 2025
5be4007
wip
p-arvy Jan 2, 2025
1c0daf1
wip
p-arvy Jan 2, 2025
c6a999c
wip
p-arvy Jan 3, 2025
49fa11a
Add doc
p-arvy Jan 3, 2025
ebaeb80
Small clean
p-arvy Jan 3, 2025
ad7f77e
Add resources
p-arvy Jan 3, 2025
f995fc5
Small clean
p-arvy Jan 3, 2025
f2b0a18
Clean comments
p-arvy Jan 3, 2025
43ff404
remove useless check
p-arvy Jan 3, 2025
73363fd
Update comments
p-arvy Jan 3, 2025
a849e94
Merge branch 'main' into generators-6-points-diagram
So-Fras Jan 8, 2025
569e44f
Fix checkstyle and typo in name of file
So-Fras Jan 8, 2025
a91a0e8
Fix name of class
So-Fras Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/optimizer/acOptimalPowerflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Please note that:
even if the user designates these generators as fixed in the parameter file `param_generators_reactive.txt` (see [Configuration of the run](inputs.md#configuration-of-the-run)).
Therefore, when the optimization results are exported, **these generators are exported with a reactive power target of $0$**.
- **Neither current limits nor power limits** on branches are considered in the optimization.
- Branches with one side open are considered in optimization.

## Constraints

Expand Down
12 changes: 6 additions & 6 deletions docs/optimizer/inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ Please note that for these parameters, the AMPL code defines default values whic
In addition to the previous parameters, the user can specify which parameters will be variable or fixed in the ACOPF solving (see [AC optimal powerflow](acOptimalPowerflow.md)).
This is done using the following files:

| File | Description | Default behavior of modified values |
|---------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|
| `param_transformers.txt` | Ratio tap changers with a variable transformation ratio (real variable) | Transformation ratios are fixed |
| `param_shunt.txt` | Shunts with a continuous variable susceptance and which can be modified and/or connected (only if possible bus is defined in `ampl_network_shunts.txt`) | Shunt susceptances are fixed |
| `param_generators_reactive.txt` | Generators with a constant reactive power production. If this value is not consistent (> PQmax), the reactive power production stays variable | Coherent reactive power productions (see [P/Q unit domain](preprocessing.md#pq-unit-domain)) are variable |
| `param_buses_with_reactive_slack.txt` | Buses with attached reactive slacks if configurable parameter buses_with_reactive_slacks = "CONFIGURED" | Only buses with no reactive power production have reactive slacks attached |
| File | Description | Default behavior of modified values |
|---------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
| `param_transformers.txt` | Ratio tap changers with a variable transformation ratio (real variable). Note that ratio tap changers on branches with one side open are not optimized. | Transformation ratios are fixed |
| `param_shunt.txt` | Shunts with a continuous variable susceptance and which can be modified and/or connected (only if possible bus is defined in `ampl_network_shunts.txt`) | Shunt susceptances are fixed |
| `param_generators_reactive.txt` | Generators with a constant reactive power production. If this value is not consistent (> PQmax), the reactive power production stays variable | Coherent reactive power productions (see [P/Q unit domain](preprocessing.md#pq-unit-domain)) are variable |
| `param_buses_with_reactive_slack.txt` | Buses with attached reactive slacks if configurable parameter buses_with_reactive_slacks = "CONFIGURED" | Only buses with no reactive power production have reactive slacks attached |

All of these files share the same format: 2 columns #"num" "id".

Expand Down
62 changes: 46 additions & 16 deletions docs/optimizer/preprocessing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ Let $V_{s}^{min}$ (resp. $V_{s}^{max}$) be the low (resp. high) voltage limit of

Branches with an impedance magnitude, **calculated in per unit**, lower than the configurable threshold `Znull` (see section [Configuration of the run](inputs.md#configuration-of-the-run)) are considered as non-impedant.
These branches will have their reactance replaced by the threshold `Znull` (in p.u.), **even if the reactance specified in `ampl_network_branches.txt` is negative**.
Note that for lines considered as non-impedant and connecting two different nominal voltage levels, the conductances and susceptances are cancelled in order to avoid numerical instabilities.

## Impedance of transformers

In the calculations of the ACOPF (see [AC optimal powerflow](acOptimalPowerflow.md)), the transformers with an impedance (specified in `ampl_network_branches.txt`) considered as null (see [Zero-impedance threshold](#zero-impedance-threshold)) **are treated as lines**. Then, the transformation ratios/phase shifts are ignored, as well as the impedance specified in the tap changer table `ampl_network_tct.txt`.
In the calculations of the ACOPF (see [AC optimal powerflow](acOptimalPowerflow.md)), the impedance specified in tap changer table `ampl_network_tct.txt` is ignored for transformers with an impedance (specified in `ampl_network_branches.txt`) considered as null (see [Zero-impedance threshold](#zero-impedance-threshold)). Note that the transformer ratios and phase shiftings are considered anyway.

For phase shifters transformers considered as impedant, the reactance values from the tap changer table (in `ampl_network_tct.txt`) replace the reactance specified in `ampl_network_branches.txt`. The resistance is then calculated proportionally.
For the ratio tap changers, the impedance stays as specified in `ampl_network_branches.txt`. **Please notice there is no specified handling for cases where resistance and/or reactance is negative or if there is both a ratio tap changer and a phase shift transformer on the same branch.**
Expand All @@ -28,29 +29,58 @@ The following corrections apply successively to determine consistent domains for

To determine the consistent domain of produced active power, the bounds of the domains $P_g^{min}$ and $P_g^{max}$, as well as the target $P_g^{t}$ of generator $g$ (all specified in `ampl_network_generators.txt`) are used.

Let $P_{g}^{min,c}$ and $P_{g}^{max,c}$ be the corrected active bounds:
Let $P_{g}^{min,c}$ and $P_{g}^{max,c}$ be the corrected active bounds. Note that these bounds are used to determine the generator's reactive bounds, and they can be used in the optimization if the user specifies a value for
`coeff_alpha` different from 1 (see [Configuration of the run](inputs.md#configuration-of-the-run)).

$P_{g}^{min,c}$ and $P_{g}^{max,c}$ are computed using the following:

- By default, $P_{g}^{min,c} = \text{defaultPmin}$ and $P_{g}^{max,c} = \text{defaultPmax}$ (see [Configuration of the run](inputs.md#configuration-of-the-run))
- If $|P_g^{max}| \geq \text{PQmax}$, then $P_{g}^{max,c} = \max(\text{defaultPmax}, P_g^t)$
- If $|P_g^{min}| \geq \text{PQmax}$, then $P_{g}^{min,c} = \min(\text{defaultPmin}, P_g^t)$
- If $|P_{g}^{max,c} - P_{g}^{min,c}| \leq \text{minimalQPrange}$, then $P_{g}^{max,c} = P_{g}^{min,c} = P_{g}^t$ (active power is fixed).

To determine the consistent domain of produced reactive power, the reactive power diagram (specified in `ampl_network_generators.txt`) of generator $g$ is used: $qp_g$ (resp. $qP_g$) and $Qp_g$ ($QP_g$) when $P_{g}^{min,c}$ (resp. $P_{g}^{max,c}$) is reached.
Let $qp_g^c$ (resp. $qP_g^c$) and $Qp_g^c$ (resp. $QP_g^c$) be the bounds of the corrected reactive diagram, and $Q_{g}^{min,c}$ and $Q_{g}^{max,c}$ be the corrected reactive bounds:
To determine the consistent domain of produced reactive power, the reactive power diagram (specified in `ampl_network_generators.txt`) of generator $g$ is used: $qp_g$ (resp. $qp0_g$, $qP_g$) and $Qp_g$ (resp. $Qp0_g$, $QP_g$) when $P_{g}^{min,c}$ (resp. $0$, $P_{g}^{max,c}$) is reached.
Let $qp_g^c$ (resp. $qp0_g^c$, $qP_g^c$) and $Qp_g^c$ (resp. $Qp0_g^c$, $QP_g^c$) be the bounds of the corrected reactive diagram,
and $Q_{g}^{min,c}$ and $Q_{g}^{max,c}$ be the corrected reactive bounds, used in the optimization:

- By default, $qp_g^{c} = qP_{g}^{c} = - \text{defaultPmin} \times \text{defaultQmaxPmaxRatio}$ and $Qp_{g}^{c} = QP_{g}^{c} = \text{defaultPmax} \times \text{defaultQmaxPmaxRatio}$ (see [Configuration of the run](inputs.md#configuration-of-the-run))
- If $|qp_{g}| \geq \text{PQmax}$, then $qp_{g}^{c} = -\text{defaultQmaxPmaxRatio} \times P_{max}^{g,c}$.
Same with $qP_{g}^{c}$.
Same with $qP_{g}^{c}$, $qp0_{g}^{c}$.
- If $|Qp_{g}| \geq \text{PQmax}$, then $Qp_{g}^{c} = \text{defaultQmaxPmaxRatio} \times P_{max}^{g,c}$.
Same with $QP_{g}^{c}$.
Same with $QP_{g}^{c}$, $Qp0_{g}^{c}$.
- If $qp_{g}^{c} > Qp_{g}^{c}$, the values are swapped.
Same with $qP_{g}^{c}$ and $QP_{g}^{c}$.
- If the corrected reactive diagram is too small (the distances between the vertices of the reactive diagram are lower than $\text{minimalQPrange}$), then $qp_{g}^{c} = Qp_{g}^{c} = qP_{g}^{c} = QP_{g}^{c} = \frac{qp_{g}^{c} + Qp_{g}^{c} + qP_{g}^{c} + QP_{g}^{c}}{4}$ (reactive power is fixed).
- $Q_{g}^{min,c} = \min(qp_{g}^{c}, qP_{g}^{c})$ and $Q_{g}^{max,c} = \min(Qp_{g}^{c}, QP_{g}^{c})$

Please note that in the end, **the corrected bounds are rectangular**, not trapezoidal, and they are used only in the reactive OPF (see [AC optimal powerflow](acOptimalPowerflow.md). The trapezoidal diagram should be added shortly.
In addition, bounds $qP_{g}^0$ and $Qp_{g}^0$ are not used, as generators with zero active power will be excluded from the optimisation (see [AC optimal powerflow](acOptimalPowerflow.md#generalities)).

The general correction of the generator's reactive power diagram $g$ is illustrated in the following figure:
![Reactive diagram correction](_static/img/reactive-diagram.png){width="50%" align=center}

Same with $qP_{g}^{c}$ and $QP_{g}^{c}$, $qp0_{g}^{c}$ and $Qp0_{g}^{c}$.
- If the corrected reactive diagram is too small between $P_{g}^{min,c}$ and $P_{g}^{max,c}$ (the distances between the vertices of the reactive diagram are lower than $\text{minimalQPrange}$),
then $qp_{g}^{c} = Qp_{g}^{c} = qP_{g}^{c} = QP_{g}^{c} = \frac{qp_{g}^{c} + Qp_{g}^{c} + qP_{g}^{c} + QP_{g}^{c}}{4}$ (reactive power is fixed). The same applies if the diagram
is too small between $P_{g}^{min,c}$ and 0, or 0 and $P_{g}^{max,c}$.

Then, the corrected reactive bounds ($Q_{g}^{min,c}$ and $Q_{g}^{max,c}$) are interpolated between the points forming the hexagonal diagram.
The general case corresponds to the active target being between the active bounds ($P_{g}^{min,c}$ and $P_{g}^{max,c}$). The interpolating formula is as follows:
- $Q_{g}^{min,c} = qp_{g}^{c} + \frac{P_{g}^{t}-P_{g}^{min,c}}{P_{g}^{max,c}-P_{g}^{min,c}}(qP_{g}^{c}-qp_{g}^{c})$
- $Q_{g}^{max,c} = Qp_{g}^{c} + \frac{P_{g}^{t}-P_{g}^{min,c}}{P_{g}^{max,c}-P_{g}^{min,c}}(QP_{g}^{c}-Qp_{g}^{c})$

The formula also applies when the active target is between $0$ and $P_{g}^{min,c}$, or $0$ and $P_{g}^{max,c}$. For the last case, the interpolating formula becomes:
- $Q_{g}^{min,c} = qp0_{g}^{c} + \frac{P_{g}^{t}}{P_{g}^{max,c}}(qP_{g}^{c}-qp0_{g}^{c})$
- $Q_{g}^{max,c} = Qp0_{g}^{c} + \frac{P_{g}^{t}}{P_{g}^{max,c}}(QP_{g}^{c}-Qp0_{g}^{c})$

This is illustrated in the following figure:
![Reactive diagram between 0 and Pmax](_static/img/reactive-bounds-ptarget-between-0-pmax.PNG){width="50%" align=center}

The following corner cases are important to clarify:
- If the generator has an active power target located between $0$ and $P_{g}^{min,c}$ (e.g., during ramp up), the
interpolation is performed between the points $0$ and $P_{g}^{min,c}$, as follows:
![Reactive diagram between 0 and Pmin](_static/img/reactive-bounds-ptarget-between-0-pmin.PNG){width="50%" align=center}

- If the generator has a target greater (resp. smaller) than its upper (resp. lower) active power bound, and
this bound is greater (resp. smaller) than $0$, then the corrected reactive bounds are taken at $P_{g}^{max,c}$ (resp. $P_{g}^{min,c}$), as follows:
![Reactive diagram taken at Pmax](_static/img/reactive-bounds-ptarget-higher-than-pmax.PNG){width="50%" align=center}

- If corrected active bounds $P_{g}^{min,c}$ and $P_{g}^{max,c}$ are too close, and the target
of the generator is located between these points, then the corrected reactive bounds are taken as the midpoint of the extreme points of the diagram. The same applies
if $0$ and $P_{g}^{min,c}$ or $0$ and $P_{g}^{max,c}$ are too close, and that the target is located between.
This is illustrated below:
![Reactive diagram when active bounds are too close](_static/img/reactive-bounds-ptarget-in-active-bounds-too-close.PNG){width="50%" align=center}

Please note that in the end, the corrected bounds are used in the reactive OPF (see [AC optimal powerflow](acOptimalPowerflow.md).
In addition, note that bounds $qP_{g}^0$ and $Qp_{g}^0$ are only used to interpolate the corrected bounds $Q_{g}^{min,c}$ and $Q_{g}^{max,c}$,
as generators with zero active power are excluded from the optimisation (see [AC optimal powerflow](acOptimalPowerflow.md#generalities)).
Loading
Loading