PowerGrids icon indicating copy to clipboard operation
PowerGrids copied to clipboard

IEEE14bus failures in Dymola but not OpenModelica

Open eitreb opened this issue 2 months ago • 5 comments

I'm trying to run all the examples of the develop branch on Dymola. Other than the two already known issues #40 and #85, I'm experiencing almost identical failures at initialization for all the cases (except the power flow) of IEEE14bus, which instead run fine on OpenModelica.

I'm receiving the same translation warning for all malfunctioning models:

Some variables are iteration variables of the initialization problem:
but they are not given any explicit start values. Zero will be used.

Iteration variables:
GEN1.AVR.limiterWithLag.u
GEN2.AVR.limiterWithLag.u
GEN3.AVR.limiterWithLag.u
GEN6.AVR.limiterWithLag.u
GEN8.AVR.limiterWithLag.u

And the same simulation error (I'm showing it only for one case but the only difference is the model name):

Log-file of program ./dymosim
(generated: Wed Oct 01 10:48:54 2025)

dymosim started
... "PowerGrids.Examples.IEEE14bus.IEEE14busStaticNetworkEPF" simulating
... "dsin.txt" loading (dymosim input file)

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[6]
  For debugging information enable
  Simulation/Setup/Debug/Nonlinear solver diagnostics/Detailed logging of failed nonlinear solutions.
Trying to solve non-linear system using global homotopy-method.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[7]
Trying to solve non-linear system using global homotopy-method.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[7]
Error: Integrator failed to start model.

... Error message from dymosim

ERROR: The simulation of PowerGrids.Examples.IEEE14bus.IEEE14busStaticNetworkEPF FAILED

This is, as I said, very similar to what Dymola shows with PowerGrids.Examples.Tutorial.GridOperation.Controlled.ControlledGridWithReferenceCalculationSat (#40)

Some variables are iteration variables of the initialization problem:
but they are not given any explicit start values. Zero will be used.

Iteration variables:
AVR.addIng.y
TGOV.gainDivR.y
Log-file of program ./dymosim
(generated: Wed Oct 01 11:15:53 2025)

dymosim started
... "PowerGrids.Examples.Tutorial.GridOperation.Controlled.ControlledGridWithReferenceCalculationSat" simulating
... "dsin.txt" loading (dymosim input file)

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[7]
  For debugging information enable
  Simulation/Setup/Debug/Nonlinear solver diagnostics/Detailed logging of failed nonlinear solutions.
Trying to solve non-linear system using global homotopy-method.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[7]
Error: reducing step size for homotopy.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[7]
Error: reducing step size for homotopy.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[7]
Error: reducing step size for homotopy.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[7]
Error: reducing step size for homotopy.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[7]
Error: reducing step size for homotopy.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[7]
Error: reducing step size for homotopy.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[7]
Error: reducing step size for homotopy.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[7]
Error: reducing step size for homotopy.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[7]
Error: reducing step size for homotopy.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[7]
Error: reducing step size for homotopy.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[7]
Error: adaptive homotopy method got stuck after starting. Can set scripting flag Advanced.DebugHomotopy=true; simulate again, and open continuation.csv to investigate
Error: Integrator failed to start model.

... Error message from dymosim

ERROR: The simulation of PowerGrids.Examples.Tutorial.GridOperation.Controlled.ControlledGridWithReferenceCalculationSat FAILED

and PowerGrids.Examples.Tutorial.IslandOperation.TwoGeneratorsLocalInitialization (#85),

Some variables are iteration variables of the initialization problem:
but they are not given any explicit start values. Zero will be used.

Iteration variables:
GEN1.AVR.addIng.y
GEN1.TGOV.gainDivR.y
GEN2.AVR.addIng.y
GEN2.TGOV.gainDivR.y
Log-file of program ./dymosim
(generated: Wed Oct 01 11:18:24 2025)

dymosim started
... "PowerGrids.Examples.Tutorial.IslandOperation.TwoGeneratorsLocalInitialization" simulating
... "dsin.txt" loading (dymosim input file)

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[3]
  For debugging information enable
  Simulation/Setup/Debug/Nonlinear solver diagnostics/Detailed logging of failed nonlinear solutions.
Trying to solve non-linear system using global homotopy-method.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: initialization.nonlinear[3]
Error: Integrator failed to start model.

... Error message from dymosim

ERROR: The simulation of PowerGrids.Examples.Tutorial.IslandOperation.TwoGeneratorsLocalInitialization FAILED

so I suppose the issues are related, but I don't understand the different behaviour between the two environments.

I'm aware that moving models from one tool to another may result in failures, but since Dymola solvers are generally very robust, and Dymola is so widely used, having all PowerGrids models running not only in OM but also in Dymola would significantly enhance its usability.

eitreb avatar Oct 02 '25 16:10 eitreb

@eitreb, you may also ask the question to your Dymola representative.

Also, make sure that Dymola is using homotopy to solve the initialization equations.

casella avatar Oct 02 '25 22:10 casella

Dymola is using homotopy to solve the initialisation equations, as in the error log it states Trying to solve non-linear system using global homotopy-method.

Even though I'm aware that this is a Dymola issue, the warning and error logs are similar to the ones of the cases not working on OpenModelica either (#40, #85). I think that this can give some more insight on those two issues, there may be some correlation and solving the issues with those two examples could solve the ones with Dymola too and vice versa.

eitreb avatar Oct 06 '25 13:10 eitreb

I would add to https://github.com/PowerGrids/PowerGrids/issues/178#issuecomment-3371571135 that since Dymola's solvers are usually very robust, this lack of convergence maybe is a hint of some inherent weakness of the code.

ceraolo avatar Oct 06 '25 13:10 ceraolo

I'll have time to work on this starting Oct 20.

casella avatar Oct 06 '25 17:10 casella

One very important point.

The initialization strategy for PowerGrids is based on the analysis reported in https://arxiv.org/abs/1911.12433, theorems 2 and 3: linear variables don't need an initial guess at all, while nonlinear ones need one, and they should all get one based on the power flow values PStart, QStart, VStart, VPhaseStart computed at ports. If tearing is not applied, this works well, provided that sparse solvers are used.

If tearing is applied, it is important that nonlinear variables with appropriatedly set start attributes are used as iteration variables. It may happen that tearing leads to some linear iteration variables (without a properly set start value, as explained above), which is then used to compute some nonlinear variable in the torn section, which will get bogus values. In this case, the convergence of Newton's algorithm is likely to fail.

In OpenModelica, this issue is currently tackled by disabling tearing over a certain system size, so that the large implicit system corresponding to the whole network equations is solved without tearing. Ticket OpenModelica/OpenModelica#10711 discusses how to avoid this problem in a more systematic way, but it hasn't been followed up yet due to lack of resources.

I'm not sure what Dymola does, you can check in the dsmodel.mof file if there are linear iteration variables and torn nonlinear equations, this would explain the solver failure. In that case, we should discuss with the development team at Dassault how to avoid this problem.

casella avatar Oct 06 '25 17:10 casella