Skip to content

Commit

Permalink
Try expanding non param variables as well. (#8019)
Browse files Browse the repository at this point in the history
* Try expanding non param variables as well.

* Try SES_ARRAY_CALL_ASSIGN for all ARRAY_EQUATION

  - Let's see if anything breaks.
  • Loading branch information
mahge committed Nov 11, 2021
1 parent 6469763 commit 1250a38
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions OMCompiler/Compiler/SimCode/SimCodeUtil.mo
Expand Up @@ -2246,9 +2246,11 @@ algorithm
Boolean b;

// array equation that may result from -d=-nfScalarize and is assumed solved
case BackendDAE.ARRAY_EQUATION(left = DAE.CREF(componentRef = cr), right = e2, source = source, attr = eqAttr)
case BackendDAE.ARRAY_EQUATION(left = DAE.CREF(componentRef = cr), right = e2, source = source, attr = eqAttr) algorithm
varexp := Expression.crefExp(cr);
simEqSys := SimCode.SES_ARRAY_CALL_ASSIGN(iuniqueEqIndex, varexp, e2, source, eqAttr);
then
({SimCode.SES_SIMPLE_ASSIGN(iuniqueEqIndex, cr, e2, source, eqAttr)}, iuniqueEqIndex + 1, itempvars);
({simEqSys}, iuniqueEqIndex + 1, itempvars);

// for equation that may result from -d=-nfScalarize
case BackendDAE.FOR_EQUATION(iter = varexp, start = start, stop = cond, source = source, attr = eqAttr)
Expand Down Expand Up @@ -8177,7 +8179,7 @@ protected
BackendDAE.Var scalarVar;
algorithm
// if it is an array parameter split it up. Do not do it for Cpp runtime, they can handle array parameters
if BackendVariable.isParam(dlowVar) and Types.isArray(dlowVar.varType) and not (Config.simCodeTarget() == "Cpp" ) then
if Types.isArray(dlowVar.varType) and not (Config.simCodeTarget() == "Cpp" ) then
scalar_crefs := ComponentReference.expandCref(dlowVar.varName, false);
for cref in scalar_crefs loop
// extract the sim var
Expand Down

0 comments on commit 1250a38

Please sign in to comment.