Skip to content

Commit

Permalink
Hide previous(v) in the result file (#8209)
Browse files Browse the repository at this point in the history
* Hide previous(v) in the result file

See Wittgenstein, Tractatus

* Update testsuite
  • Loading branch information
phannebohm committed Nov 24, 2021
1 parent a1b67a1 commit 15cb394
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions OMCompiler/Compiler/BackEnd/BackendVariable.mo
Expand Up @@ -1716,6 +1716,9 @@ algorithm
cr := ComponentReference.makeCrefQual(DAE.previousNamePrefix, DAE.T_REAL_DEFAULT, {}, inVar.varName);
outVar := copyVarNewName(cr,inVar);
outVar := setVarKind(outVar,BackendDAE.JAC_DIFF_VAR());

// HACK hide previous(v) in results because it's not calculated right
outVar := setHideResult(outVar, SOME(DAE.BCONST(true)));
end createClockedState;

public function createAliasDerVar
Expand Down
4 changes: 4 additions & 0 deletions OMCompiler/Compiler/BackEnd/Initialization.mo
Expand Up @@ -2712,6 +2712,10 @@ algorithm
previousVar = BackendVariable.setBindExp(previousVar, NONE());
previousVar = BackendVariable.setVarFixed(previousVar, true);
previousVar = BackendVariable.setVarStartValueOption(previousVar, SOME(DAE.CREF(cr, ty)));

// HACK hide previous(v) in results because it's not calculated right
previousVar = BackendVariable.setHideResult(previousVar, SOME(DAE.BCONST(true)));

previousExp = Expression.crefExp(previousCR);
vars = BackendVariable.addVar(previousVar, vars);
eqns = BackendEquation.add(BackendDAE.EQUATION(previousExp, crExp, DAE.emptyElementSource, BackendDAE.EQ_ATTR_DEFAULT_INITIAL), eqns);
Expand Down
8 changes: 4 additions & 4 deletions testsuite/openmodelica/cppruntime/testArrayEquations.mos
Expand Up @@ -208,10 +208,10 @@ val(y4, 1.0);
// ========================================
// algVars (104)
// ----------------------
// index: 0: $CLKPRE.x1 (no alias) initial: x1 no arrCref index:(1) [10]
// index: 1: $CLKPRE.x2 (no alias) initial: x2 no arrCref index:(11) [10]
// index: 2: $CLKPRE.x3 (no alias) initial: x3 no arrCref index:(21) [10]
// index: 3: $CLKPRE.x4 (no alias) initial: x4 no arrCref index:(31) [10]
// index: 0: $CLKPRE.x1 (no alias) hideResult initial: x1 no arrCref index:(1) [10]
// index: 1: $CLKPRE.x2 (no alias) hideResult initial: x2 no arrCref index:(11) [10]
// index: 2: $CLKPRE.x3 (no alias) hideResult initial: x3 no arrCref index:(21) [10]
// index: 3: $CLKPRE.x4 (no alias) hideResult initial: x4 no arrCref index:(31) [10]
// index: 4: $DER.x4 (no alias) initial: no arrCref index:(41) [10]
// index: 5: u (no alias) initial: 1.0:10.0 no arrCref index:(51) [10]
// index: 6: x1 (no alias) initial: no arrCref index:(61) [10]
Expand Down

0 comments on commit 15cb394

Please sign in to comment.