Hello Igor, First, by default, runopf() does not consider the VG column of the gen matrix, but rather optimizes the generator voltage setpoint, keeping it between the VMIN and VMAX for the corresponding bus. So changing VG in the input will have no effect. You can set the opf.use_vg option to 1 to have runopf() automatically set the VMIN and VMAX equal to VG before solving, if that’s what you want.
Let me restate what I think you are asking, to make sure I understand the
question. You solve the OPF, then modify a voltage and solve the power flow,
resulting in a lower cost, which implies the new solution should not be
feasible for the OPF. That is, it must violate some constraint and you are
asking how to find the violated constraint … correct?
It turns out there is a (work-in-progress) function included in the extras
sub-directory that can do this for you. It’s called checklimits(). In your
case, it turns out it is the branch flow limits that are violated.
It also turns out that re-running the OPF with a decreased voltage at your
generator of interest (via the bus's VMAX), results in a higher cost, not lower.
See attached script, which generates the following output ...
>> test_igor
original_opf_cost =
576.8923
original_opf_VM27 =
1.0690
perturbed_VG_opf_cost =
576.8923
perturbed_VG_opf_VM27 =
1.0690
perturbed_VG_pf_cost =
576.6610
perturbed_VG_pf_VM27 =
1.0440
Branch Flow Emergency Rating Violations
branch from to flow limit violation % violation
-------- -------- -------- ---------- ---------- ---------- ----------
10 6 8 32.5 32.0 0.54 1.7
29 21 22 32.1 32.0 0.12 0.4
Branch Flow Short Term Rating Violations
branch from to flow limit violation % violation
-------- -------- -------- ---------- ---------- ---------- ----------
10 6 8 32.5 32.0 0.54 1.7
29 21 22 32.1 32.0 0.12 0.4
Branch Flow Normal Rating Violations
branch from to flow limit violation % violation
-------- -------- -------- ---------- ---------- ---------- ----------
10 6 8 32.5 32.0 0.54 1.7
29 21 22 32.1 32.0 0.12 0.4
Generator Active Limit Violations
No Pmin Violations
No Pmax Violations
Generator Reactive Limit Violations
No Qmin Violations
No Qmax Violations
Bus Voltage Limit Violations
No Vmin Violations
No Vmax Violations
perturbed_VMAX_opf_cost =
578.1257
perturbed_VMAX_opf_VM27 =
1.0440
Hope this helps,
Ray
On Sep 20, 2023, at 7:45 AM, Ігор Ткач <[email protected]> wrote:
Dear all,
Question. how do I find the constraint. which removes my cost calculation when
calculating the runopf cost?
For case30, I study the dependence of cost when adjusting the voltage of
generators.
For example, I change the voltage of the 4th generator:
cost=function('VM') == cost=function(mpc10.gen(4,6))
The skript runopf is closed and this dependency cannot be seen.
Test network case30 has an optimal value runopf() of f= 576.8923
My first calculation.
My changes to the input data - pasted the results :
mpc10.gen(:,6)=resopf.gen(:,6) - 'VM'
mpc10.gen(4,6)=resopf.gen(4,6)-0.025 - new ' VM' 4-th gen
rez10=runopf(mpc10)
f=576.8923 - the cost hasn't changed since we went down to the minimum.
O'Key, runopf found a minimum calculated with the constraints.
Next I'll show that in my example cost smaller cost=576.661 -
I'm assuming that my initial conditions went out of bounds and were discarded
I am assuming that my initial conditions (-0.025 p.u.) give the best cost
576.661 , but go beyond the some constraints. My cost was rejected by runopf.
I need to make sure of this
Dear all,
My calculation.
I calculated runopf.
I took the results runopf for PG and VG to new_mpc and calculated the
runpf(new_mpc).
After the runpf calculation, all datasets matched with runopf , in particular
the cost.
Сosts runpf are runopf the same 576.8923. My runpf option works correctly.
Then I slightly reduce the voltage on the 4-th generator "-0.025 p.u. " and
calculate the cost by runpf.
I got less, better cost f=576.661
I emphasize, the active power of generators 2-6 and the voltage on the buses
of generators 1-6 are the same for runpf and runopf, there is only an addition
of 0.01 voltage on generator 4.
I emphasize that for the case of the test runopf and my runpf, the calculation
results in the active power of generators 2-6 and the voltage on the buses of
generators 1-6 are the same, there is only an addition of -0.025 voltage on
generator 4.( see line 42 in the attached script. )
I have checked that the voltages on all nodes are within the constrains range.
I've attached a program to tesе.
Question. how do I find the constraint. which removes my cost calculation when
calculating the runopf cost?
Igor.
<zzz_ttest_cost_runpf06.m>
test_igor.m
Description: test_igor.m
