-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Hi,
I have an issue that has me absolutely stumped, any help is appreciated. I have a model, which simulates perfectly in OMEdit, using the default simulation setup (no overrides!), but refuses to simulate when accessing it through OMPython. I think I have managed to locate the issue, but can't solve it.
When simulating in OMEdit, at time=0, the non-linear system is successfully solved by using the mixed solver, as per the log:
SOLVING NON-LINEAR SYSTEM USING MIXED SOLVER (Newton/Homotopy solver)
Attempting to simulate the same model via OMPython fails, because kinsol is used, which is unable to solve the initialisation problem. Note, I use absolutely no simulation overrides, so really attempting to replicate the exact same simulation. Log output:
LOG_STDOUT | info | Using sparse solver kinsol for nonlinear system 0 (413),
| | | | because density of 0.09 remains under threshold of 0.10.
LOG_NLS | info | | KINSOL: Using linear solver method klu
...
LOG_ASSERT | debug | Solving non-linear system 413 failed at time=0.
I have attempted to force OMPython to use the mixed non-linear solver:
mod=ModelicaSystem("path/to/my/lib/package.mo","model.path")
mod.simulate(simflags='-nls=mixed')
and to lower the density threshold, to force the usage of a different non linear solver:
mod.simulate(simflags='-nlssMaxDensity=0.05')
Both did not change anything, kinsol still ends up being used and the simulation fails. Does anyone know why this is the case? Or why is the solving behaviour so different? I would expect an API to have the same defaults as the program it is trying to access?
Any ideas for a workaround are much appreciated!
Cheers
OpenModelica v1.22.1
OMPython 3.4.0
Python 3.11.7
Spyder IDE 5.4.3
Win 10