Skip to content

Commit

Permalink
Treat sample with clock constructor in array equations as well
Browse files Browse the repository at this point in the history
model Example
  parameter Integer n = 10;
  input Real[n] u;
  Real[n] u_sampled = sample(u, Clock(period));
end Example;

Belonging to [master]:
  - OpenModelica/OMCompiler#2699
  • Loading branch information
rfranke authored and OpenModelica-Hudson committed Oct 6, 2018
1 parent ec7f741 commit 976a996
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Compiler/BackEnd/SynchronousFeatures.mo
Expand Up @@ -1372,6 +1372,7 @@ algorithm
DAE.ElementSource source;
list<BackendDAE.Equation> newEqs;
list<BackendDAE.Var> newVars;
list<Integer> dimSize;
case(BackendDAE.EQUATION(e1, e2, source, attr=BackendDAE.EQUATION_ATTRIBUTES(kind=BackendDAE.DYNAMIC_EQUATION())),(vars, suffixIdx0, newEqs, newVars))
algorithm
(e1,(newEqs, newVars, suffixIdx)) := Expression.traverseExpTopDown(e1, replaceSampledClocks2, (newEqs, newVars, suffixIdx0));
Expand All @@ -1382,6 +1383,16 @@ algorithm
attr := BackendDAE.EQ_ATTR_DEFAULT_DYNAMIC;
end if;
then (BackendDAE.EQUATION(e1,e2,source,attr),(vars, suffixIdx, newEqs, newVars));
case(BackendDAE.ARRAY_EQUATION(dimSize, e1, e2, source, attr=BackendDAE.EQUATION_ATTRIBUTES(kind=BackendDAE.DYNAMIC_EQUATION())),(vars, suffixIdx0, newEqs, newVars))
algorithm
(e1,(newEqs, newVars, suffixIdx)) := Expression.traverseExpTopDown(e1, replaceSampledClocks2, (newEqs, newVars, suffixIdx0));
(e2,(newEqs, newVars, suffixIdx)) := Expression.traverseExpTopDown(e2, replaceSampledClocks2, (newEqs, newVars, suffixIdx));
if intEq(suffixIdx - suffixIdx0, 1) then
attr := BackendEquation.defaultClockedEqAttr(suffixIdx0);
else
attr := BackendDAE.EQ_ATTR_DEFAULT_DYNAMIC;
end if;
then (BackendDAE.ARRAY_EQUATION(dimSize, e1, e2, source, attr), (vars, suffixIdx, newEqs, newVars));
else
algorithm
then (eqIn,tplIn);
Expand Down

0 comments on commit 976a996

Please sign in to comment.