How can I automatically stop a divergent simulation?
Category:
Dynamic Simulation
Answer
PowerFactory offers with the simulation scan also the possibility to observe the solver. This allows the user to define a parameter simulation scan which can stop the simulation in case of high number of divergence messages. This can also be used together with the System Parameter Identification to give non-convergent solutions an infinite penalty.
The following steps are required for this:
- Activate in the command "Calculation of Initial Conditions" the Simulation Scan on the corresponding page.
- Create a new Variable Scan Module via the button "Edit Simulation Scan"
- Select under Scan location --> User defined --> the used result object (ElmRes). The result object is stored by default in the active study case under the name "All calculations.ElmRes".
- Enter as variable either:
- "b:warnA" for cases where PowerFactory cannot find the solution for the continuous equations of models. The simulation results might be wrong.
- "b:warnB" for cases where the simulation had some major convergence problems or time step issues. The simulation results may still be correct in many cases.
- "b:warnC" for cases where the simulation had some minor convergence problems. The simulation results may be correct in most cases.
- Enter under "Settings:
- Maximum limit: The maximum number of warnings you accept before the simulation will stop.
- Minimum limit: -1 (the warnX will only count up, starting from 0).
- Action: Stop Simulation, enable "Stop with error" if the simulation run should get an infinite high penalty.
Hint: You can also add a variable selection (IntMon) for the result object (ElmRes). The warnX values - beside of others - can be done selected from the "Basic Data" page, under the variable set "Calculation Parameter". This way the values can be plottet to get a better feeling for the amount of counted warnings.