Skip to content

Commit

Permalink
[FMI] fix sorting of the directional derivatives
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - OpenModelica/OMCompiler#1993
  • Loading branch information
Willi Braun authored and OpenModelica-Hudson committed Nov 7, 2017
1 parent 28e9498 commit 425073c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Compiler/SimCode/SimCodeUtil.mo
Expand Up @@ -4722,6 +4722,7 @@ algorithm
systvars = BackendVariable.listVar1(allVars);
((otherColumnVars, _)) = BackendVariable.traverseBackendDAEVars(systvars, traversingdlowvarToSimvar, ({}, emptyVars));
otherColumnVars = List.map1(otherColumnVars, setSimVarKind, BackendDAE.JAC_DIFF_VAR());
otherColumnVars = List.map1(otherColumnVars, setSimVarMatrixName, SOME(name));
otherColumnVars = rewriteIndex(otherColumnVars, 0);

//sort variable for index
Expand Down Expand Up @@ -12749,7 +12750,7 @@ protected
Option<BackendDAE.SymbolicJacobian> optcontPartDer;
BackendDAE.SparsePattern spPattern;
BackendDAE.SparseColoring spColors;
BackendDAE.Jacobian contPartDer;
BackendDAE.SymbolicJacobians contPartDer;
SimCode.JacobianMatrix contSimJac;
Option<SimCode.JacobianMatrix> contPartSimDer;
list<SimCodeVar.SimVar> tempvars;
Expand Down Expand Up @@ -12782,8 +12783,8 @@ algorithm
(derivatives, outputs) := List.split(derivatives, inModelInfo.varInfo.numStateVars);

if not checkForEmptyBDAE(optcontPartDer) then
contPartDer := BackendDAE.GENERIC_JACOBIAN(optcontPartDer,spPattern,spColors);
(SOME(contSimJac), uniqueEqIndex, _) := createSymbolicSimulationJacobian(contPartDer, uniqueEqIndex, {});
contPartDer := {(optcontPartDer,spPattern,spColors)};
({contSimJac}, uniqueEqIndex) := createSymbolicJacobianssSimCode(contPartDer, crefSimVarHT, uniqueEqIndex, {"FMIDer"}, {});
// collect algebraic loops and symjacs for FMIDer
({contSimJac}, outModelInfo, symJacs) := addAlgebraicLoopsModelInfoSymJacs({contSimJac}, inModelInfo);
contPartSimDer := SOME(contSimJac);
Expand Down

0 comments on commit 425073c

Please sign in to comment.