Thanks for catching this. Would you mind creating a bug report with these 
details the GitHub issue tracker <>?



> On Aug 8, 2017, at 9:06 AM, Elis Nycander <> wrote:
> Hi,
> 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 
> happens
> 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 
> case4gs. 
> Regards,
> Elis Nycander
> <example.mat><mwe.m>

Reply via email to