From c419a097cd0fc16dca6cfcf208206ccd366d20ec Mon Sep 17 00:00:00 2001 From: kabdelhak Date: Thu, 9 May 2019 14:51:27 +0200 Subject: [PATCH] [BE] Fix handling of mixed determined systems - add all variable indices to artifical functions in adjacency matrix - ticket #5170 --- Compiler/BackEnd/Initialization.mo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Compiler/BackEnd/Initialization.mo b/Compiler/BackEnd/Initialization.mo index 14dab53337..b132e1fff2 100644 --- a/Compiler/BackEnd/Initialization.mo +++ b/Compiler/BackEnd/Initialization.mo @@ -1337,7 +1337,7 @@ algorithm // modify incidence matrix for under-determined systems nAddEqs := intMax(nVars-nEqns + index, index); if debug then print("nAddEqs: " + intString(nAddEqs) + "\n"); end if; - m := fixUnderDeterminedSystem(m_, stateIndices, nEqns, nAddEqs); + m := fixUnderDeterminedSystem(m_, nEqns, nAddEqs); // modify incidence matrix for over-determined systems nAddVars := intMax(nEqns-nVars + index, index); @@ -1410,12 +1410,11 @@ end fixInitialSystem; protected function fixUnderDeterminedSystem "author: lochel" input BackendDAE.IncidenceMatrix inM; - input list inInitVarIndices; input Integer inNEqns; input Integer inNAddEqns; output BackendDAE.IncidenceMatrix outM; protected - list newEqIndices; + list newEqIndices,allVarIndices; algorithm if inNAddEqns < 0 then Error.addInternalError("function fixUnderDeterminedSystem failed due to invalid input", sourceInfo()); @@ -1426,7 +1425,8 @@ algorithm outM := arrayCreate(inNEqns+inNAddEqns, {}); outM := Array.copy(inM, outM); newEqIndices := List.intRange2(inNEqns+1, inNEqns+inNAddEqns); - outM := List.fold1(newEqIndices, squareIncidenceMatrix1, inInitVarIndices, outM); + allVarIndices := List.intRange2(1,inNEqns+inNAddEqns); + outM := List.fold1(newEqIndices, squareIncidenceMatrix1, allVarIndices, outM); else outM := arrayCopy(inM) "deep copy"; end if;