Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Improved treatment of vectorized models #2733

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions Compiler/BackEnd/BackendDAEUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -7810,9 +7810,9 @@ algorithm

if Flags.getConfigBool(Flags.DEFAULT_OPT_MODULES_ORDERING) then
// handle special flags, which enable modules

enabledModules := deprecatedDebugFlag(Flags.SORT_EQNS_AND_VARS, enabledModules, "sortEqnsVars", "preOptModules+");
enabledModules := deprecatedDebugFlag(Flags.ADD_DER_ALIASES, enabledModules, "introduceDerAlias", "preOptModules+");

if Config.acceptOptimicaGrammar() or Flags.getConfigBool(Flags.GENERATE_DYN_OPTIMIZATION_PROBLEM) then
enabledModules := "inputDerivativesForDynOpt"::enabledModules;
enabledModules := "createDynamicOptimization"::enabledModules;
Expand All @@ -7821,16 +7821,20 @@ algorithm
// handle special flags, which disable modules
disabledModules := deprecatedDebugFlag(Flags.NO_PARTITIONING, disabledModules, "clockPartitioning", "preOptModules-");
disabledModules := deprecatedDebugFlag(Flags.DISABLE_COMSUBEXP, disabledModules, "comSubExp", "preOptModules-");

if Flags.getConfigString(Flags.REMOVE_SIMPLE_EQUATIONS) == "causal" or
Flags.getConfigString(Flags.REMOVE_SIMPLE_EQUATIONS) == "none" then
disabledModules := "removeSimpleEquations"::disabledModules;
end if;


if not Flags.isSet(Flags.EVALUATE_CONST_FUNCTIONS) then
disabledModules := "evalFunc"::disabledModules;
Error.addCompilerWarning("Deprecated debug flag --d=evalConstFuncs=false detected. Use --preOptModules-=evalFunc instead.");
end if;

if not Flags.isSet(Flags.NF_SCALARIZE) then
disabledModules := "inlineArrayEqn"::disabledModules;
end if;
end if;

if not Flags.getConfigBool(Flags.DEFAULT_OPT_MODULES_ORDERING) and not listEmpty(enabledModules) then
Expand Down Expand Up @@ -7935,6 +7939,10 @@ algorithm
if Config.getTearingMethod() == "noTearing" then
disabledModules := "tearingSystem"::disabledModules;
end if;

if not Flags.isSet(Flags.NF_SCALARIZE) then
disabledModules := "inlineArrayEqn"::disabledModules;
end if;
end if;

if not Flags.getConfigBool(Flags.DEFAULT_OPT_MODULES_ORDERING) and not listEmpty(enabledModules) then
Expand Down
8 changes: 5 additions & 3 deletions Compiler/BackEnd/ExpressionSolve.mo
Original file line number Diff line number Diff line change
Expand Up @@ -584,13 +584,15 @@ algorithm
// -f(a) = b => f(a) = -b
case DAE.UNARY(op as DAE.UMINUS(), fa)
guard expHasCref(fa, inExp3) and not expHasCref(inExp2, inExp3)
then(fa, DAE.UNARY(op, inExp2), true);
equation
b = Expression.negate(inExp2);
then (fa, b, true);

case DAE.UNARY(op as DAE.UMINUS_ARR(), fa)
guard expHasCref(fa, inExp3) and not expHasCref(inExp2, inExp3)
equation
b = DAE.UNARY(op, inExp2);
then(fa, b, true);
b = Expression.negate(inExp2);
then (fa, b, true);

// b/f(a) = rhs => f(a) = b/rhs solve for a
case DAE.BINARY(b,DAE.DIV(_),fa)
Expand Down