Skip to content

Commit

Permalink
[BE] update nonlinear system handling (#8948)
Browse files Browse the repository at this point in the history
* [BE] update nonlinear system handling

 - before: residuals that cannot be created were skipped and were just left out in nonlinear systems
 - now: the function fails to create residuals
 - todo: repair all cases in which we cannot create residuals

* Update testsuite

Co-authored-by: Philip Hannebohm <phannebohm@fh-bielefeld.de>
  • Loading branch information
kabdelhak and phannebohm committed May 17, 2022
1 parent 9aa66d0 commit d101571
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 8 additions & 4 deletions OMCompiler/Compiler/BackEnd/BackendEquation.mo
Expand Up @@ -1636,7 +1636,7 @@ public function traverseEquationToScalarResidualForm
output BackendDAE.Equation outEq;
output tuple<DAE.FunctionTree, list<BackendDAE.Equation>> outEqs;
algorithm
(outEq,outEqs) := matchcontinue(inEq,inEqs)
(outEq,outEqs) := match(inEq,inEqs)
local
list<BackendDAE.Equation> eqns,reqn;
BackendDAE.Equation eqn;
Expand All @@ -1648,8 +1648,12 @@ algorithm
eqns = listAppend(reqn,eqns);
then (eqn, (funcs, eqns));

else (inEq,inEqs);
end matchcontinue;
else
equation
true = Flags.isSet(Flags.FAILTRACE);
Error.addInternalError(getInstanceName() + " failed", sourceInfo());
then fail();
end match;
end traverseEquationToScalarResidualForm;

public function convertResidualsIntoSolvedEquations
Expand Down Expand Up @@ -1688,7 +1692,7 @@ algorithm
else
equation
true = Flags.isSet(Flags.FAILTRACE);
Error.addInternalError("function convertResidualsIntoSolvedEquations failed", sourceInfo());
Error.addInternalError(getInstanceName() + " failed", sourceInfo());
then fail();
end match;
end for;
Expand Down
2 changes: 0 additions & 2 deletions testsuite/openmodelica/dataReconciliation/TSP_Pipe3.mos
Expand Up @@ -2251,8 +2251,6 @@ getErrorString();
// resultFile = "",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'NewDataReconciliationSimpleTests.TSP_Pipe3', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-reconcile -sx=./NewDataReconciliationSimpleTests/resources/DataReconciliationSimpleTests.TSP_Pipe3_Inputs.csv -eps=0.0023 -lv=LOG_JAC'",
// messages = "Simulation execution failed for model: NewDataReconciliationSimpleTests.TSP_Pipe3
// stdout | warning | Sparsity pattern for non-linear system 0 is not regular. This indicates that something went wrong during sparsity pattern generation. Removing sparsity pattern and disabling NLS scaling.
// stdout | warning | Sparsity pattern for non-linear system 2 is not regular. This indicates that something went wrong during sparsity pattern generation. Removing sparsity pattern and disabling NLS scaling.
// assert | debug | Solving non-linear system 66 failed at time=0.
// | | | | For more information please use -lv LOG_NLS.
// assert | info | simulation terminated by an assertion at initialization
Expand Down

0 comments on commit d101571

Please sign in to comment.