I have found a small bug in the CPF function. Suppose the base case power
flow converges but the very first corrector step fails. Then the following

1. cpf loop sets *cont_steps = 0 *and terminates with break
2. callback function is called with *k=0 *and thus executes initialization
instead of final callback loop
3. *cpf_results *is now missing the field *V *(and all other fields which
are supposed to be set in final callback loop)
4. missing *cpf_results.V *causes error on line 610 in runcpf:
    n = size(cpf_results.V, 2);

So the reason for this error is that the first parameter taken by the
callback functions has two different functions. It is both
1. An indicator what stage the cpf is in, i.e. initialization stage,
continuation stage, or final stage
2. A counter for the number of iterations which has been run
So the possibility of being in the final stage (because the corrector did
not converge) in the very first iteration creates problems.

I have attached an example where this happens. It is a modified version of

Elis Nycander

Attachment: example.mat
Description: Binary data

Attachment: mwe.m
Description: application/vnd.wolfram.mathematica.package

Reply via email to