From 4a327ea424396bc95a0e61d2f5e87f7a197bd14c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=96stlund?= Date: Mon, 30 Mar 2020 13:39:35 +0200 Subject: [PATCH] [NF] Flat modelica output prototype. --- OMCompiler/Compiler/Main/Main.mo | 2 +- OMCompiler/Compiler/NFFrontEnd/NFBinding.mo | 16 ++ OMCompiler/Compiler/NFFrontEnd/NFCall.mo | 87 ++++++++- OMCompiler/Compiler/NFFrontEnd/NFComponent.mo | 28 +++ .../Compiler/NFFrontEnd/NFComponentRef.mo | 66 +++++-- OMCompiler/Compiler/NFFrontEnd/NFEquation.mo | 173 ++++++++++++++++++ .../Compiler/NFFrontEnd/NFExpression.mo | 147 +++++++++++++-- OMCompiler/Compiler/NFFrontEnd/NFFlatModel.mo | 66 +++++++ OMCompiler/Compiler/NFFrontEnd/NFFunction.mo | 63 +++++++ OMCompiler/Compiler/NFFrontEnd/NFInst.mo | 10 + OMCompiler/Compiler/NFFrontEnd/NFInstNode.mo | 11 ++ OMCompiler/Compiler/NFFrontEnd/NFModifier.mo | 29 +++ OMCompiler/Compiler/NFFrontEnd/NFOperator.mo | 19 ++ .../Compiler/NFFrontEnd/NFSimplifyExp.mo | 6 + OMCompiler/Compiler/NFFrontEnd/NFStatement.mo | 143 +++++++++++++++ OMCompiler/Compiler/NFFrontEnd/NFSubscript.mo | 22 +++ OMCompiler/Compiler/NFFrontEnd/NFType.mo | 29 +++ OMCompiler/Compiler/NFFrontEnd/NFVariable.mo | 58 ++++++ OMCompiler/Compiler/Util/Flags.mo | 4 + OMCompiler/Compiler/Util/FlagsUtil.mo | 3 +- .../modelica/scodeinst/Cardinality2.mo | 6 +- .../modelica/scodeinst/Condition5.mo | 2 +- .../modelica/scodeinst/Condition6.mo | 4 +- .../flattening/modelica/scodeinst/Connect2.mo | 2 +- .../flattening/modelica/scodeinst/Connect4.mo | 8 +- .../flattening/modelica/scodeinst/Connect5.mo | 2 +- .../modelica/scodeinst/ConnectDiffOrder1.mo | 4 +- .../modelica/scodeinst/ConnectDiffOrder2.mo | 8 +- .../modelica/scodeinst/ConstantConnector3.mo | 2 +- .../modelica/scodeinst/ExtendConnector1.mo | 2 +- .../modelica/scodeinst/ForConnect1.mo | 6 +- .../modelica/scodeinst/IfConnect1.mo | 2 +- .../scodeinst/InStreamFlowThreshold.mo | 2 +- .../scodeinst/InStreamInsideOutside.mo | 2 +- .../scodeinst/InStreamNominalThreshold.mo | 2 +- .../modelica/scodeinst/InStreamPipeline.mo | 4 +- .../modelica/scodeinst/InStreamTwoOutside.mo | 2 +- .../modelica/scodeinst/OCGTests.mos | 76 ++++---- 38 files changed, 1020 insertions(+), 98 deletions(-) diff --git a/OMCompiler/Compiler/Main/Main.mo b/OMCompiler/Compiler/Main/Main.mo index 8b35e28f186..bf0934d3c0b 100644 --- a/OMCompiler/Compiler/Main/Main.mo +++ b/OMCompiler/Compiler/Main/Main.mo @@ -444,7 +444,7 @@ algorithm Print.clearBuf(); execStat("Transformations before Dump"); - s := if Config.silent() then "" else DAEDump.dumpStr(d, funcs); + s := if Config.silent() or Flags.getConfigBool(Flags.FLAT_MODELICA) then "" else DAEDump.dumpStr(d, funcs); execStat("DAEDump done"); Print.printBuf(s); if Flags.isSet(Flags.DAE_DUMP_GRAPHV) then diff --git a/OMCompiler/Compiler/NFFrontEnd/NFBinding.mo b/OMCompiler/Compiler/NFFrontEnd/NFBinding.mo index b66da2d2911..70e05a27da7 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFBinding.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFBinding.mo @@ -476,6 +476,22 @@ public end match; end toString; + function toFlatString + input Binding binding; + input String prefix = ""; + output String string; + algorithm + string := match binding + case UNBOUND() then ""; + case RAW_BINDING() then prefix + Dump.printExpStr(binding.bindingExp); + case UNTYPED_BINDING() then prefix + Expression.toFlatString(binding.bindingExp); + case TYPED_BINDING() then prefix + Expression.toFlatString(binding.bindingExp); + case FLAT_BINDING() then prefix + Expression.toFlatString(binding.bindingExp); + case CEVAL_BINDING() then prefix + Expression.toFlatString(binding.bindingExp); + case INVALID_BINDING() then toFlatString(binding.binding, prefix); + end match; + end toFlatString; + function isEqual input Binding binding1; input Binding binding2; diff --git a/OMCompiler/Compiler/NFFrontEnd/NFCall.mo b/OMCompiler/Compiler/NFFrontEnd/NFCall.mo index 93bcffaa977..7cd92d7e998 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFCall.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFCall.mo @@ -180,7 +180,6 @@ uniontype Call input SourceInfo info; output Expression callExp; algorithm - callExp := match functionArgs case Absyn.FUNCTIONARGS() then instNormalCall(functionName, functionArgs, scope, info); case Absyn.FOR_ITER_FARG() then instIteratorCall(functionName, functionArgs, scope, info); @@ -669,6 +668,57 @@ uniontype Call end match; end toString; + function toFlatString + input Call call; + output String str; + protected + String name, arg_str,c; + Expression argexp; + list iters; + algorithm + str := match call + case TYPED_CALL() + algorithm + name := AbsynUtil.pathString(Function.name(call.fn)); + arg_str := stringDelimitList(list(Expression.toFlatString(arg) for arg in call.arguments), ", "); + then + if Function.isBuiltin(call.fn) then + stringAppendList({name, "(", arg_str, ")"}) + else + stringAppendList({"'", name, "'(", arg_str, ")"}); + + case TYPED_ARRAY_CONSTRUCTOR() + algorithm + if isVectorized(call) then + // Vectorized calls contains iterators with illegal Modelica names + // (to avoid name conflicts), to make the flat output legal such + // calls are reverted to their original form here. + str := toFlatString(devectorizeCall(call)); + else + name := AbsynUtil.pathString(Function.name(NFBuiltinFuncs.ARRAY_FUNC)); + arg_str := Expression.toFlatString(call.exp); + c := stringDelimitList(list(InstNode.name(Util.tuple21(iter)) + " in " + + Expression.toFlatString(Util.tuple22(iter)) for iter in call.iters), ", "); + str := stringAppendList({"{", arg_str, " for ", c, "}"}); + end if; + then + str; + + case TYPED_REDUCTION() + algorithm + name := AbsynUtil.pathString(Function.name(call.fn)); + arg_str := Expression.toFlatString(call.exp); + c := stringDelimitList(list(InstNode.name(Util.tuple21(iter)) + " in " + + Expression.toFlatString(Util.tuple22(iter)) for iter in call.iters), ", "); + then + if Function.isBuiltin(call.fn) then + stringAppendList({name, "(", arg_str, " for ", c, ")"}) + else + stringAppendList({"'", name, "'(", arg_str, " for ", c, ")"}); + + end match; + end toFlatString; + function typedString "Like toString, but prefixes each argument with its type as a comment." input Call call; @@ -1392,6 +1442,40 @@ protected end match; end vectorizeCall; + function isVectorized + input Call call; + output Boolean vectorized; + algorithm + vectorized := match call + // A call is considered to be vectorized if the first iterator has a name + // beginning with $. + case TYPED_ARRAY_CONSTRUCTOR(exp = Expression.CALL()) + then stringGet(InstNode.name(Util.tuple21(listHead(call.iters))), 1) == 36; /* $ */ + else false; + end match; + end isVectorized; + + function devectorizeCall + "Transforms a vectorized call into a non-vectorized one. This function is + used as a helper to output valid flat Modelica, and should probably not + be used where e.g. correct types are required." + input Call call; + output Call outCall; + protected + Expression exp, iter_exp; + list> iters; + InstNode iter_node; + algorithm + TYPED_ARRAY_CONSTRUCTOR(exp = exp, iters = iters) := call; + + for i in iters loop + (iter_node, iter_exp) := i; + exp := Expression.replaceIterator(exp, iter_node, iter_exp); + end for; + + Expression.CALL(call = outCall) := exp; + end devectorizeCall; + function evaluateCallType input output Type ty; input Function fn; @@ -1532,7 +1616,6 @@ protected fail(); end match; end getSpecialReturnType; - end Call; annotation(__OpenModelica_Interface="frontend"); diff --git a/OMCompiler/Compiler/NFFrontEnd/NFComponent.mo b/OMCompiler/Compiler/NFFrontEnd/NFComponent.mo index f2680b131e5..4c9651f1412 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFComponent.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFComponent.mo @@ -155,6 +155,15 @@ uniontype Component Prefixes.unparseVariability(attr.variability, ty) + Prefixes.unparseDirection(attr.direction); end toString; + + function toFlatString + input Attributes attr; + input Type ty; + output String str; + algorithm + str := Prefixes.unparseVariability(attr.variability, ty) + + Prefixes.unparseDirection(attr.direction); + end toFlatString; end Attributes; record COMPONENT_DEF @@ -818,6 +827,25 @@ uniontype Component end match; end toString; + function toFlatString + input String name; + input Component component; + output String str; + algorithm + str := match component + local + SCode.Element def; + + case TYPED_COMPONENT() + then Attributes.toFlatString(component.attributes, component.ty) + + Type.toFlatString(component.ty) + " '" + name + "'" + + Binding.toFlatString(component.binding, " = "); + + case TYPE_ATTRIBUTE() + then name + Modifier.toFlatString(component.modifier, printName = false); + end match; + end toFlatString; + function setDimensions input list dims; input output Component component; diff --git a/OMCompiler/Compiler/NFFrontEnd/NFComponentRef.mo b/OMCompiler/Compiler/NFFrontEnd/NFComponentRef.mo index a2961152623..eceafb3e0f9 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFComponentRef.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFComponentRef.mo @@ -661,22 +661,61 @@ public input ComponentRef cref; output String str; algorithm - str := match cref - case CREF(restCref = EMPTY()) - then InstNode.name(cref.node) + Subscript.toStringList(cref.subscripts); + str := stringDelimitList(toString_impl(cref, {}), "."); + end toString; + + function toString_impl + input ComponentRef cref; + input output list strl; + algorithm + strl := match cref + local + String str; case CREF() algorithm - str := toString(cref.restCref); + str := InstNode.name(cref.node) + Subscript.toStringList(cref.subscripts); then - str + "." + InstNode.name(cref.node) + Subscript.toStringList(cref.subscripts); + toString_impl(cref.restCref, str :: strl); - case WILD() then "_"; - case STRING(restCref = EMPTY()) then cref.name; - case STRING() then toString(cref.restCref) + "." + cref.name; - else "EMPTY_CREF"; + case WILD() then "_" :: strl; + case STRING() then toString_impl(cref.restCref, cref.name :: strl); + else strl; end match; - end toString; + end toString_impl; + + function toFlatString + input ComponentRef cref; + output String str; + protected + ComponentRef cr; + list subs; + list strl = {}; + algorithm + (cr, subs) := stripSubscripts(cref); + strl := toFlatString_impl(cr, strl); + str := stringAppendList({"'", stringDelimitList(strl, "."), "'", Subscript.toFlatStringList(subs)}); + end toFlatString; + + function toFlatString_impl + input ComponentRef cref; + input output list strl; + algorithm + strl := match cref + local + String str; + + case CREF() + algorithm + str := InstNode.name(cref.node) + Subscript.toFlatStringList(cref.subscripts); + then + toFlatString_impl(cref.restCref, str :: strl); + + case WILD() then "_" :: strl; + case STRING() then toFlatString_impl(cref.restCref, cref.name :: strl); + else strl; + end match; + end toFlatString_impl; function listToString input list crs; @@ -770,11 +809,12 @@ public "Strips the subscripts from the last name in a cref, e.g. a[2].b[3] => a[2].b" input ComponentRef cref; output ComponentRef strippedCref; + output list subs; algorithm - strippedCref := match cref + (strippedCref, subs) := match cref case CREF() - then CREF(cref.node, {}, cref.ty, cref.origin, cref.restCref); - else cref; + then (CREF(cref.node, {}, cref.ty, cref.origin, cref.restCref), cref.subscripts); + else (cref, {}); end match; end stripSubscripts; diff --git a/OMCompiler/Compiler/NFFrontEnd/NFEquation.mo b/OMCompiler/Compiler/NFFrontEnd/NFEquation.mo index 6ceab25b8c8..fb3bbcbba93 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFEquation.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFEquation.mo @@ -78,6 +78,25 @@ public end match; end toStream; + function toFlatStream + input Branch branch; + input String indent; + input output IOStream.IOStream s; + algorithm + s := match branch + case BRANCH() + algorithm + s := IOStream.append(s, Expression.toFlatString(branch.condition)); + s := IOStream.append(s, " then\n"); + s := toFlatStreamList(branch.body, indent + " ", s); + then + s; + + case INVALID_BRANCH() + then toFlatStream(branch.branch, indent, s); + end match; + end toFlatStream; + function triggerErrors input Branch branch; algorithm @@ -836,6 +855,160 @@ public end for; end toStreamList; + function toFlatStream + input Equation eq; + input String indent; + input output IOStream.IOStream s; + algorithm + s := IOStream.append(s, indent); + + s := match eq + case EQUALITY() + algorithm + s := IOStream.append(s, Expression.toFlatString(eq.lhs)); + s := IOStream.append(s, " = "); + s := IOStream.append(s, Expression.toFlatString(eq.rhs)); + then + s; + + case CREF_EQUALITY() + algorithm + s := IOStream.append(s, ComponentRef.toFlatString(eq.lhs)); + s := IOStream.append(s, " = "); + s := IOStream.append(s, ComponentRef.toFlatString(eq.rhs)); + then + s; + + case ARRAY_EQUALITY() + algorithm + s := IOStream.append(s, Expression.toFlatString(eq.lhs)); + s := IOStream.append(s, " = "); + s := IOStream.append(s, Expression.toFlatString(eq.rhs)); + then + s; + + case CONNECT() + algorithm + s := IOStream.append(s, "connect("); + s := IOStream.append(s, Expression.toFlatString(eq.lhs)); + s := IOStream.append(s, " = "); + s := IOStream.append(s, Expression.toFlatString(eq.rhs)); + s := IOStream.append(s, ")"); + then + s; + + case FOR() + algorithm + s := IOStream.append(s, "for "); + s := IOStream.append(s, InstNode.name(eq.iterator)); + + if isSome(eq.range) then + s := IOStream.append(s, " in "); + s := IOStream.append(s, Expression.toFlatString(Util.getOption(eq.range))); + end if; + + s := IOStream.append(s, " loop\n"); + s := toFlatStreamList(eq.body, indent + " ", s); + s := IOStream.append(s, indent); + s := IOStream.append(s, "end for"); + then + s; + + case IF() + algorithm + s := IOStream.append(s, "if "); + s := Branch.toFlatStream(listHead(eq.branches), indent, s); + + for b in listRest(eq.branches) loop + s := IOStream.append(s, indent); + s := IOStream.append(s, "elseif "); + s := Branch.toFlatStream(b, indent, s); + end for; + + s := IOStream.append(s, indent); + s := IOStream.append(s, "end if"); + then + s; + + case WHEN() + algorithm + s := IOStream.append(s, "when "); + s := Branch.toFlatStream(listHead(eq.branches), indent, s); + + for b in listRest(eq.branches) loop + s := IOStream.append(s, indent); + s := IOStream.append(s, "elsewhen "); + s := Branch.toFlatStream(b, indent, s); + end for; + + s := IOStream.append(s, indent); + s := IOStream.append(s, "end when"); + then + s; + + case ASSERT() + algorithm + s := IOStream.append(s, "assert("); + s := IOStream.append(s, Expression.toFlatString(eq.condition)); + s := IOStream.append(s, ", "); + s := IOStream.append(s, Expression.toFlatString(eq.message)); + s := IOStream.append(s, ", "); + s := IOStream.append(s, Expression.toFlatString(eq.level)); + s := IOStream.append(s, ")"); + then + s; + + case TERMINATE() + algorithm + s := IOStream.append(s, "terminate("); + s := IOStream.append(s, Expression.toFlatString(eq.message)); + s := IOStream.append(s, ")"); + then + s; + + case REINIT() + algorithm + s := IOStream.append(s, "reinit("); + s := IOStream.append(s, Expression.toFlatString(eq.cref)); + s := IOStream.append(s, ", "); + s := IOStream.append(s, Expression.toFlatString(eq.reinitExp)); + s := IOStream.append(s, ")"); + then + s; + + case NORETCALL() + then IOStream.append(s, Expression.toFlatString(eq.exp)); + + else IOStream.append(s, "#UNKNOWN EQUATION#"); + end match; + end toFlatStream; + + function toFlatStreamList + input list eql; + input String indent; + input output IOStream.IOStream s; + protected + Boolean prev_multi_line = false, multi_line; + Boolean first = true; + algorithm + for eq in eql loop + multi_line := isMultiLine(eq); + + // Improve human parsability by separating statements that spans multiple + // lines (like if-equations) with newlines. + if first then + first := false; + elseif prev_multi_line or multi_line then + s := IOStream.append(s, "\n"); + end if; + + prev_multi_line := multi_line; + + s := toFlatStream(eq, indent, s); + s := IOStream.append(s, ";\n"); + end for; + end toFlatStreamList; + function isMultiLine input Equation eq; output Boolean singleLine; diff --git a/OMCompiler/Compiler/NFFrontEnd/NFExpression.mo b/OMCompiler/Compiler/NFFrontEnd/NFExpression.mo index fc21f254d28..1b1587b978d 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFExpression.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFExpression.mo @@ -1637,6 +1637,84 @@ public end match; end toString; + function toFlatString + input Expression exp; + output String str; + protected + Type t; + ClockKind clk; + algorithm + str := match exp + case INTEGER() then intString(exp.value); + case REAL() then realString(exp.value); + case STRING() then "\"" + exp.value + "\""; + case BOOLEAN() then boolString(exp.value); + + case ENUM_LITERAL(ty = t as Type.ENUMERATION()) + then AbsynUtil.pathString(t.typePath) + "." + exp.name; + + case CLKCONST(clk) then ClockKind.toString(clk); + + case CREF() then ComponentRef.toFlatString(exp.cref); + case TYPENAME() then Type.typenameString(Type.arrayElementType(exp.ty)); + case ARRAY() then "{" + stringDelimitList(list(toFlatString(e) for e in exp.elements), ", ") + "}"; + case MATRIX() then "[" + stringDelimitList(list(stringDelimitList(list(toFlatString(e) for e in el), ", ") for el in exp.elements), "; ") + "]"; + + case RANGE() then operandFlatString(exp.start, exp, false) + + ( + if isSome(exp.step) + then ":" + operandFlatString(Util.getOption(exp.step), exp, false) + else "" + ) + ":" + operandFlatString(exp.stop, exp, false); + + case TUPLE() then "(" + stringDelimitList(list(toFlatString(e) for e in exp.elements), ", ") + ")"; + case RECORD() then List.toString(exp.elements, toFlatString, AbsynUtil.pathString(exp.path), "(", ", ", ")", true); + case CALL() then Call.toFlatString(exp.call); + case SIZE() then "size(" + toFlatString(exp.exp) + + ( + if isSome(exp.dimIndex) + then ", " + toFlatString(Util.getOption(exp.dimIndex)) + else "" + ) + ")"; + case END() then "end"; + + case BINARY() then operandFlatString(exp.exp1, exp, true) + + Operator.symbol(exp.operator) + + operandFlatString(exp.exp2, exp, false); + + case UNARY() then Operator.symbol(exp.operator, "") + + operandFlatString(exp.exp, exp, false); + + case LBINARY() then operandFlatString(exp.exp1, exp, true) + + Operator.symbol(exp.operator) + + operandFlatString(exp.exp2, exp, false); + + case LUNARY() then Operator.symbol(exp.operator, "") + " " + + operandFlatString(exp.exp, exp, false); + + case RELATION() then operandFlatString(exp.exp1, exp, true) + + Operator.symbol(exp.operator) + + operandFlatString(exp.exp2, exp, false); + + case IF() then "if " + toFlatString(exp.condition) + " then " + toFlatString(exp.trueBranch) + " else " + toFlatString(exp.falseBranch); + + case UNBOX() then "UNBOX(" + toFlatString(exp.exp) + ")"; + case BOX() then "BOX(" + toFlatString(exp.exp) + ")"; + case CAST() then toFlatString(exp.exp); + case SUBSCRIPTED_EXP() then toFlatString(exp.exp) + Subscript.toFlatStringList(exp.subscripts); + case TUPLE_ELEMENT() then toFlatString(exp.tupleExp) + "[" + intString(exp.index) + "]"; + case RECORD_ELEMENT() then toFlatString(exp.recordExp) + "[field: " + exp.fieldName + "]"; + case MUTABLE() then toFlatString(Mutable.access(exp.exp)); + case EMPTY() then "#EMPTY#"; + case PARTIAL_FUNCTION_APPLICATION() + then "function " + ComponentRef.toFlatString(exp.fn) + "(" + stringDelimitList( + list(n + " = " + Expression.toFlatString(a) threaded for a in exp.args, n in exp.argNames), ", ") + ")"; + case BINDING_EXP() then toFlatString(exp.exp); + + else anyString(exp); + end match; + end toFlatString; + function operandString "Helper function to toString, prints an operator and adds parentheses as needed." input Expression operand; @@ -1647,9 +1725,11 @@ public Integer operand_prio, operator_prio; algorithm str := toString(operand); - operand_prio := priority(operand, lhs); - if operand_prio <> 4 then + + if operand_prio == 4 then + str := "(" + str + ")"; + else operator_prio := priority(operator, lhs); if operand_prio > operator_prio or @@ -1659,12 +1739,38 @@ public end if; end operandString; + function operandFlatString + "Helper function to toString, prints an operator and adds parentheses as needed." + input Expression operand; + input Expression operator; + input Boolean lhs; + output String str; + protected + Integer operand_prio, operator_prio; + algorithm + str := toFlatString(operand); + operand_prio := priority(operand, lhs); + + if operand_prio == 4 then + str := "(" + str + ")"; + else + operator_prio := priority(operator, lhs); + + if operand_prio > operator_prio or + not lhs and operand_prio == operator_prio and not isAssociativeExp(operand) then + str := "(" + str + ")"; + end if; + end if; + end operandFlatString; + function priority input Expression exp; input Boolean lhs; output Integer priority; algorithm priority := match exp + case INTEGER() then if exp.value < 0 then 4 else 0; + case REAL() then if exp.value < 0.0 then 4 else 0; case BINARY() then Operator.priority(exp.operator, lhs); case UNARY() then 4; case LBINARY() then Operator.priority(exp.operator, lhs); @@ -4405,19 +4511,20 @@ public end match; end isOne; - function isPositive + function isNegative input Expression exp; - output Boolean positive; - algorithm - positive := match exp - case INTEGER() then exp.value > 0; - case REAL() then exp.value > 0; - case BOOLEAN() then true; - case ENUM_LITERAL() then true; - case CAST() then isPositive(exp.exp); - case UNARY() then not isPositive(exp.exp); + output Boolean negative; + algorithm + negative := match exp + case INTEGER() then exp.value < 0; + case REAL() then exp.value < 0; + case BOOLEAN() then false; + case ENUM_LITERAL() then false; + case CAST() then isNegative(exp.exp); + case UNARY() then not isNegative(exp.exp); + else false; end match; - end isPositive; + end isNegative; function isScalarLiteral input Expression exp; @@ -4662,6 +4769,19 @@ public end match; end unbox; + function isNegated + input Expression exp; + output Boolean negated; + algorithm + negated := match exp + case INTEGER() then exp.value < 0; + case REAL() then exp.value < 0; + case CAST() then isNegated(exp.exp); + case UNARY() then true; + else false; + end match; + end isNegated; + function negate input output Expression exp; algorithm @@ -4669,6 +4789,7 @@ public case INTEGER() then INTEGER(-exp.value); case REAL() then REAL(-exp.value); case CAST() then CAST(exp.ty, negate(exp.exp)); + case UNARY() then exp.exp; else UNARY(Operator.OPERATOR(typeOf(exp), NFOperator.Op.UMINUS), exp); end match; end negate; diff --git a/OMCompiler/Compiler/NFFrontEnd/NFFlatModel.mo b/OMCompiler/Compiler/NFFrontEnd/NFFlatModel.mo index 94f24f1a3bc..eb02efa8ed2 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFFlatModel.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFFlatModel.mo @@ -97,5 +97,71 @@ public IOStream.delete(s); end toString; + function toFlatString + input FlatModel flatModel; + input Boolean printBindingTypes = false; + output String str; + protected + IOStream.IOStream s; + algorithm + s := IOStream.create(getInstanceName(), IOStream.IOStreamType.LIST()); + s := toFlatStream(flatModel, printBindingTypes, s); + str := IOStream.string(s); + end toFlatString; + + function printFlatString + input FlatModel flatModel; + input Boolean printBindingTypes = false; + protected + IOStream.IOStream s; + algorithm + s := IOStream.create(getInstanceName(), IOStream.IOStreamType.LIST()); + s := toFlatStream(flatModel, printBindingTypes, s); + IOStream.print(s, IOStream.stdOutput); + end printFlatString; + + function toFlatStream + input FlatModel flatModel; + input Boolean printBindingTypes = false; + input output IOStream.IOStream s; + output String str; + algorithm + s := IOStream.append(s, "class '" + flatModel.name + "'\n"); + + for v in flatModel.variables loop + s := Variable.toFlatStream(v, " ", printBindingTypes, s); + s := IOStream.append(s, ";\n"); + end for; + + if not listEmpty(flatModel.initialEquations) then + s := IOStream.append(s, "initial equation\n"); + s := Equation.toFlatStreamList(flatModel.initialEquations, " ", s); + end if; + + if not listEmpty(flatModel.equations) then + s := IOStream.append(s, "equation\n"); + s := Equation.toFlatStreamList(flatModel.equations, " ", s); + end if; + + for alg in flatModel.initialAlgorithms loop + if not listEmpty(alg.statements) then + s := IOStream.append(s, "initial algorithm\n"); + s := Statement.toFlatStreamList(alg.statements, " ", s); + end if; + end for; + + for alg in flatModel.algorithms loop + if not listEmpty(alg.statements) then + s := IOStream.append(s, "algorithm\n"); + s := Statement.toFlatStreamList(alg.statements, " ", s); + end if; + end for; + + s := IOStream.append(s, "end '" + flatModel.name + "';\n"); + + str := IOStream.string(s); + IOStream.delete(s); + end toFlatStream; + annotation(__OpenModelica_Interface="frontend"); end NFFlatModel; diff --git a/OMCompiler/Compiler/NFFrontEnd/NFFunction.mo b/OMCompiler/Compiler/NFFrontEnd/NFFunction.mo index 8c813d7d6f1..d50ec3910fe 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFFunction.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFFunction.mo @@ -76,6 +76,7 @@ import MetaModelica.Dangerous.listReverseInPlace; import Array; import ElementSource; import SCodeUtil; +import IOStream; public type NamedArg = tuple; @@ -674,6 +675,68 @@ uniontype Function output String str = Type.toString(InstNode.getType(param)); end paramTypeString; + function toFlatStream + input Function fn; + input output IOStream.IOStream s; + protected + String fn_name; + list fn_body; + algorithm + if isDefaultRecordConstructor(fn) then + s := IOStream.append(s, InstNode.toString(fn.node)); + else + fn_name := AbsynUtil.pathString(fn.path); + s := IOStream.append(s, "function '"); + s := IOStream.append(s, fn_name); + s := IOStream.append(s, "'\n"); + + for i in fn.inputs loop + s := IOStream.append(s, " "); + s := IOStream.append(s, InstNode.toFlatString(i)); + s := IOStream.append(s, ";\n"); + end for; + + for o in fn.outputs loop + s := IOStream.append(s, " "); + s := IOStream.append(s, InstNode.toFlatString(o)); + s := IOStream.append(s, ";\n"); + end for; + + if not listEmpty(fn.locals) then + s := IOStream.append(s, "protected\n"); + + for l in fn.locals loop + s := IOStream.append(s, " "); + s := IOStream.append(s, InstNode.toFlatString(l)); + s := IOStream.append(s, ";\n"); + end for; + end if; + + fn_body := getBody(fn); + + if not listEmpty(fn_body) then + s := IOStream.append(s, "algorithm\n"); + s := Statement.toFlatStreamList(fn_body, " ", s); + end if; + + s := IOStream.append(s, "end '"); + s := IOStream.append(s, fn_name); + s := IOStream.append(s, "';"); + end if; + end toFlatStream; + + function toFlatString + input Function fn; + output String str; + protected + IOStream.IOStream s; + algorithm + s := IOStream.create(getInstanceName(), IOStream.IOStreamType.LIST()); + s := toFlatStream(fn, s); + str := IOStream.string(s); + IOStream.delete(s); + end toFlatString; + function instance input Function fn; output InstNode node = fn.node; diff --git a/OMCompiler/Compiler/NFFrontEnd/NFInst.mo b/OMCompiler/Compiler/NFFrontEnd/NFInst.mo index 5c3e2002b62..9bf3ad9d316 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFInst.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFInst.mo @@ -175,6 +175,16 @@ algorithm // to the model. flat_model := Package.collectConstants(flat_model, funcs); + if Flags.getConfigBool(Flags.FLAT_MODELICA) then + for fn in FunctionTree.listValues(funcs) loop + print(Function.toFlatString(fn)); + print("\n\n"); + end for; + + FlatModel.printFlatString(flat_model); + print("\n"); + end if; + // Scalarize array components in the flat model. if Flags.isSet(Flags.NF_SCALARIZE) then flat_model := Scalarize.scalarize(flat_model, name); diff --git a/OMCompiler/Compiler/NFFrontEnd/NFInstNode.mo b/OMCompiler/Compiler/NFFrontEnd/NFInstNode.mo index 66211cbc635..83006a95c2a 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFInstNode.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFInstNode.mo @@ -1349,6 +1349,17 @@ uniontype InstNode end match; end toString; + function toFlatString + input InstNode node; + output String name; + algorithm + name := match node + case COMPONENT_NODE() then Component.toFlatString(node.name, Pointer.access(node.component)); + case CLASS_NODE() then SCodeDump.unparseElementStr(node.definition); + else name(node); + end match; + end toFlatString; + function isRedeclare input InstNode node; output Boolean isRedeclare; diff --git a/OMCompiler/Compiler/NFFrontEnd/NFModifier.mo b/OMCompiler/Compiler/NFFrontEnd/NFModifier.mo index 8c93e9db2f6..b01d761d3a9 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFModifier.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFModifier.mo @@ -541,6 +541,35 @@ public end match; end toString; + function toFlatString + input Modifier mod; + input Boolean printName = true; + output String string; + algorithm + string := match mod + local + list submods; + String subs_str, binding_str, binding_sep; + + case MODIFIER() + algorithm + submods := ModTable.listValues(mod.subModifiers); + if not listEmpty(submods) then + subs_str := "(" + stringDelimitList(list(toFlatString(s) for s in submods), ", ") + ")"; + binding_sep := " = "; + else + subs_str := ""; + binding_sep := if printName then " = " else "= "; + end if; + + binding_str := Binding.toFlatString(mod.binding, binding_sep); + then + if printName then mod.name + subs_str + binding_str else subs_str + binding_str; + + else ""; + end match; + end toFlatString; + protected function createSubMod input SCode.SubMod subMod; diff --git a/OMCompiler/Compiler/NFFrontEnd/NFOperator.mo b/OMCompiler/Compiler/NFFrontEnd/NFOperator.mo index e8e918dae73..0245b6abc27 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFOperator.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFOperator.mo @@ -464,5 +464,24 @@ public end match; end isElementWise; + function negate + input Operator op; + output Operator outOp; + protected + Op neg_op; + algorithm + neg_op := match op.op + case Op.ADD then Op.SUB; + case Op.SUB then Op.ADD; + case Op.ADD_EW then Op.SUB_EW; + case Op.SUB_EW then Op.ADD_EW; + case Op.ADD_SCALAR_ARRAY then Op.SUB_SCALAR_ARRAY; + case Op.SUB_SCALAR_ARRAY then Op.ADD_SCALAR_ARRAY; + case Op.ADD_ARRAY_SCALAR then Op.SUB_ARRAY_SCALAR; + end match; + + outOp := OPERATOR(op.ty, neg_op); + end negate; + annotation(__OpenModelica_Interface="frontend"); end NFOperator; diff --git a/OMCompiler/Compiler/NFFrontEnd/NFSimplifyExp.mo b/OMCompiler/Compiler/NFFrontEnd/NFSimplifyExp.mo index 8e2fb2b3e06..2d4cc199a17 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFSimplifyExp.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFSimplifyExp.mo @@ -437,6 +437,9 @@ algorithm elseif Expression.isZero(exp2) then // e + 0 = e outExp := exp1; + elseif Expression.isNegated(exp2) then + // e1 + -(e2) = e1 - e2 + outExp := Expression.BINARY(exp1, Operator.negate(op), Expression.negate(exp2)); else outExp := Expression.BINARY(exp1, op, exp2); end if; @@ -454,6 +457,9 @@ algorithm elseif Expression.isZero(exp2) then // e - 0 = e outExp := exp1; + elseif Expression.isNegated(exp2) then + // e1 - -(e2) = e1 + e2 + outExp := Expression.BINARY(exp1, Operator.negate(op), Expression.negate(exp2)); else outExp := Expression.BINARY(exp1, op, exp2); end if; diff --git a/OMCompiler/Compiler/NFFrontEnd/NFStatement.mo b/OMCompiler/Compiler/NFFrontEnd/NFStatement.mo index 11d8ef29257..fe14f302a5e 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFStatement.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFStatement.mo @@ -598,6 +598,149 @@ public end for; end toStreamList; + function toFlatStream + input Statement stmt; + input String indent; + input output IOStream.IOStream s; + protected + String str; + algorithm + s := IOStream.append(s, indent); + + s := match stmt + case ASSIGNMENT() + algorithm + s := IOStream.append(s, Expression.toFlatString(stmt.lhs)); + s := IOStream.append(s, " := "); + s := IOStream.append(s, Expression.toFlatString(stmt.rhs)); + then + s; + + case FUNCTION_ARRAY_INIT() + algorithm + s := IOStream.append(s, "array init"); + s := IOStream.append(s, stmt.name); + then + s; + + case FOR() + algorithm + s := IOStream.append(s, "for "); + s := IOStream.append(s, InstNode.name(stmt.iterator)); + + if isSome(stmt.range) then + s := IOStream.append(s, " in "); + s := IOStream.append(s, Expression.toFlatString(Util.getOption(stmt.range))); + end if; + + s := IOStream.append(s, " loop\n"); + s := toFlatStreamList(stmt.body, indent + " ", s); + s := IOStream.append(s, indent); + s := IOStream.append(s, "end for"); + then + s; + + case IF() + algorithm + str := "if "; + + for b in stmt.branches loop + s := IOStream.append(s, str); + s := IOStream.append(s, Expression.toFlatString(Util.tuple21(b))); + s := IOStream.append(s, " then\n"); + s := toFlatStreamList(Util.tuple22(b), indent + " ", s); + s := IOStream.append(s, indent); + str := "elseif "; + end for; + + s := IOStream.append(s, "end if"); + then + s; + + case WHEN() + algorithm + str := "when "; + + for b in stmt.branches loop + s := IOStream.append(s, str); + s := IOStream.append(s, Expression.toFlatString(Util.tuple21(b))); + s := IOStream.append(s, " then\n"); + s := toFlatStreamList(Util.tuple22(b), indent + " ", s); + s := IOStream.append(s, indent); + str := "elsewhen "; + end for; + + s := IOStream.append(s, "end when"); + then + s; + + case ASSERT() + algorithm + s := IOStream.append(s, "assert("); + s := IOStream.append(s, Expression.toFlatString(stmt.condition)); + s := IOStream.append(s, ", "); + s := IOStream.append(s, Expression.toFlatString(stmt.message)); + s := IOStream.append(s, ", "); + s := IOStream.append(s, Expression.toFlatString(stmt.level)); + s := IOStream.append(s, ")"); + then + s; + + case TERMINATE() + algorithm + s := IOStream.append(s, "terminate("); + s := IOStream.append(s, Expression.toFlatString(stmt.message)); + s := IOStream.append(s, ")"); + then + s; + + case NORETCALL() + then IOStream.append(s, Expression.toFlatString(stmt.exp)); + + case WHILE() + algorithm + s := IOStream.append(s, "while "); + s := IOStream.append(s, Expression.toFlatString(stmt.condition)); + s := IOStream.append(s, " then\n"); + s := toFlatStreamList(stmt.body, indent + " ", s); + s := IOStream.append(s, indent); + s := IOStream.append(s, "end while"); + then + s; + + case RETURN() then IOStream.append(s, "return"); + case RETURN() then IOStream.append(s, "break"); + else IOStream.append(s, "#UNKNOWN STATEMENT#"); + end match; + + end toFlatStream; + + function toFlatStreamList + input list stmtl; + input String indent; + input output IOStream.IOStream s; + protected + Boolean prev_multi_line = false, multi_line; + Boolean first = true; + algorithm + for stmt in stmtl loop + multi_line := isMultiLine(stmt); + + // Improve human parsability by separating statements that spans multiple + // lines (like if-statements) with newlines. + if first then + first := false; + elseif prev_multi_line or multi_line then + s := IOStream.append(s, "\n"); + end if; + + prev_multi_line := multi_line; + + s := toFlatStream(stmt, indent, s); + s := IOStream.append(s, ";\n"); + end for; + end toFlatStreamList; + function isMultiLine input Statement stmt; output Boolean multiLine; diff --git a/OMCompiler/Compiler/NFFrontEnd/NFSubscript.mo b/OMCompiler/Compiler/NFFrontEnd/NFSubscript.mo index b2236495a6d..36412e06d93 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFSubscript.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFSubscript.mo @@ -578,6 +578,28 @@ public string := List.toString(subscripts, toString, "", "[", ", ", "]", false); end toStringList; + function toFlatString + input Subscript subscript; + output String string; + algorithm + string := match subscript + case RAW_SUBSCRIPT() then Dump.printSubscriptStr(subscript.subscript); + case UNTYPED() then Expression.toFlatString(subscript.exp); + case INDEX() then Expression.toFlatString(subscript.index); + case SLICE() then Expression.toFlatString(subscript.slice); + case EXPANDED_SLICE() + then List.toString(subscript.indices, toString, "", "{", ", ", "}", false); + case WHOLE() then ":"; + end match; + end toFlatString; + + function toFlatStringList + input list subscripts; + output String string; + algorithm + string := List.toString(subscripts, toFlatString, "", "[", ",", "]", false); + end toFlatStringList; + function eval input Subscript subscript; input EvalTarget target = EvalTarget.IGNORE_ERRORS(); diff --git a/OMCompiler/Compiler/NFFrontEnd/NFType.mo b/OMCompiler/Compiler/NFFrontEnd/NFType.mo index 2d95e26ec66..1c9378d80cb 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFType.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFType.mo @@ -734,6 +734,35 @@ public end match; end toString; + function toFlatString + input Type ty; + output String str; + algorithm + str := match ty + case Type.INTEGER() then "Integer"; + case Type.REAL() then "Real"; + case Type.STRING() then "String"; + case Type.BOOLEAN() then "Boolean"; + case Type.CLOCK() then "Clock"; + case Type.ENUMERATION() then AbsynUtil.pathString(ty.typePath); + case Type.ENUMERATION_ANY() then "enumeration(:)"; + case Type.ARRAY() then toString(ty.elementType) + "[" + stringDelimitList(List.map(ty.dimensions, Dimension.toString), ", ") + "]"; + case Type.TUPLE() then "(" + stringDelimitList(List.map(ty.types, toString), ", ") + ")"; + case Type.NORETCALL() then "()"; + case Type.UNKNOWN() then "unknown()"; + case Type.COMPLEX() then InstNode.name(ty.cls); + case Type.FUNCTION() then Function.typeString(ty.fn); + case Type.METABOXED() then "#" + toFlatString(ty.ty); + case Type.POLYMORPHIC() then "<" + ty.name + ">"; + case Type.ANY() then "$ANY$"; + else + algorithm + Error.assertion(false, getInstanceName() + " got unknown type: " + anyString(ty), sourceInfo()); + then + fail(); + end match; + end toFlatString; + function typenameString input Type ty; output String str; diff --git a/OMCompiler/Compiler/NFFrontEnd/NFVariable.mo b/OMCompiler/Compiler/NFFrontEnd/NFVariable.mo index dac0afae027..70762b4f4db 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFVariable.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFVariable.mo @@ -199,5 +199,63 @@ public end if; end toStream; + function toFlatStream + input Variable var; + input String indent = ""; + input Boolean printBindingType = false; + input output IOStream.IOStream s; + protected + Boolean first; + Binding b; + algorithm + s := IOStream.append(s, indent); + + if var.visibility == Visibility.PROTECTED then + s := IOStream.append(s, "protected "); + end if; + + s := IOStream.append(s, Component.Attributes.toFlatString(var.attributes, var.ty)); + s := IOStream.append(s, Type.toFlatString(var.ty)); + s := IOStream.append(s, " "); + s := IOStream.append(s, ComponentRef.toFlatString(var.name)); + + if not listEmpty(var.typeAttributes) then + s := IOStream.append(s, "("); + + first := true; + for a in var.typeAttributes loop + if first then + first := false; + else + s := IOStream.append(s, ", "); + end if; + + b := Util.tuple22(a); + + if Binding.isEach(b) then + s := IOStream.append(s, "each "); + end if; + + s := IOStream.append(s, Util.tuple21(a)); + s := IOStream.append(s, " = "); + s := IOStream.append(s, Binding.toFlatString(b)); + end for; + + s := IOStream.append(s, ")"); + end if; + + if Binding.isBound(var.binding) then + s := IOStream.append(s, " = "); + + if printBindingType then + s := IOStream.append(s, "("); + s := IOStream.append(s, Type.toFlatString(Binding.getType(var.binding))); + s := IOStream.append(s, ") "); + end if; + + s := IOStream.append(s, Binding.toFlatString(var.binding)); + end if; + end toFlatStream; + annotation(__OpenModelica_Interface="frontend"); end NFVariable; diff --git a/OMCompiler/Compiler/Util/Flags.mo b/OMCompiler/Compiler/Util/Flags.mo index a61034024bc..38ad2c2564b 100644 --- a/OMCompiler/Compiler/Util/Flags.mo +++ b/OMCompiler/Compiler/Util/Flags.mo @@ -1342,6 +1342,10 @@ constant ConfigFlag ZEROMQ_CLIENT_ID = CONFIG_FLAG(138, "zeroMQClientID", constant ConfigFlag FMI_VERSION = CONFIG_FLAG(139, "", NONE(), INTERNAL(), STRING_FLAG(""), NONE(), Gettext.gettext("returns the FMI Version either 1.0 or 2.0.")); +constant ConfigFlag FLAT_MODELICA = CONFIG_FLAG(140, "flatModelica", + SOME("f"), EXTERNAL(), BOOL_FLAG(false), NONE(), + Gettext.gettext("Outputs experimental flat Modelica.")); + function getFlags "Loads the flags with getGlobalRoot. Assumes flags have been loaded." input Boolean initialize = true; diff --git a/OMCompiler/Compiler/Util/FlagsUtil.mo b/OMCompiler/Compiler/Util/FlagsUtil.mo index 536175eb325..0e6755eb591 100644 --- a/OMCompiler/Compiler/Util/FlagsUtil.mo +++ b/OMCompiler/Compiler/Util/FlagsUtil.mo @@ -396,7 +396,8 @@ constant list allConfigFlags = { Flags.ZEROMQ_JOB_ID, Flags.ZEROMQ_SERVER_ID, Flags.ZEROMQ_CLIENT_ID, - Flags.FMI_VERSION + Flags.FMI_VERSION, + Flags.FLAT_MODELICA }; diff --git a/testsuite/flattening/modelica/scodeinst/Cardinality2.mo b/testsuite/flattening/modelica/scodeinst/Cardinality2.mo index 0adf635883b..083760f6889 100644 --- a/testsuite/flattening/modelica/scodeinst/Cardinality2.mo +++ b/testsuite/flattening/modelica/scodeinst/Cardinality2.mo @@ -55,12 +55,12 @@ end Cardinality2; // Integer R2.n_conn; // equation // R1.p.v = R1.q.v; -// (-R1.p.i) + (-R1.q.i) = 0.0; +// (-R1.p.i) - R1.q.i = 0.0; // R2.p.v = R2.q.v; -// (-R2.p.i) + (-R2.q.i) = 0.0; +// (-R2.p.i) - R2.q.i = 0.0; // R1.p.v = p.v; // p.i = 0.0; -// R1.p.i + (-p.i) = 0.0; +// R1.p.i - p.i = 0.0; // R1.n.i = 0.0; // R1.q.i = 0.0; // R2.p.i = 0.0; diff --git a/testsuite/flattening/modelica/scodeinst/Condition5.mo b/testsuite/flattening/modelica/scodeinst/Condition5.mo index 3ba4ae08d7a..146b707c076 100644 --- a/testsuite/flattening/modelica/scodeinst/Condition5.mo +++ b/testsuite/flattening/modelica/scodeinst/Condition5.mo @@ -28,7 +28,7 @@ end Condition5; // Real c2.f; // equation // c1.e = c2.e; -// (-c1.f) + (-c2.f) = 0.0; +// (-c1.f) - c2.f = 0.0; // c1.f = 0.0; // c2.f = 0.0; // end Condition5; diff --git a/testsuite/flattening/modelica/scodeinst/Condition6.mo b/testsuite/flattening/modelica/scodeinst/Condition6.mo index f23f0336635..c2d4903047b 100644 --- a/testsuite/flattening/modelica/scodeinst/Condition6.mo +++ b/testsuite/flattening/modelica/scodeinst/Condition6.mo @@ -47,9 +47,9 @@ end Condition6; // Real c4.c2.f; // equation // c2.c1.e = c3.c1.e; -// (-c2.c1.f) + (-c3.c1.f) = 0.0; +// (-c2.c1.f) - c3.c1.f = 0.0; // c2.c2.e = c4.c2.e; -// (-c2.c2.f) + (-c4.c2.f) = 0.0; +// (-c2.c2.f) - c4.c2.f = 0.0; // c2.c1.f = 0.0; // c2.c2.f = 0.0; // c3.c1.f = 0.0; diff --git a/testsuite/flattening/modelica/scodeinst/Connect2.mo b/testsuite/flattening/modelica/scodeinst/Connect2.mo index 11692d4d667..81dcf7c9db2 100644 --- a/testsuite/flattening/modelica/scodeinst/Connect2.mo +++ b/testsuite/flattening/modelica/scodeinst/Connect2.mo @@ -23,7 +23,7 @@ end Connect2; // Real c2.f; // equation // c1.e = c2.e; -// (-c1.f) + (-c2.f) = 0.0; +// (-c1.f) - c2.f = 0.0; // c1.f = 0.0; // c2.f = 0.0; // end Connect2; diff --git a/testsuite/flattening/modelica/scodeinst/Connect4.mo b/testsuite/flattening/modelica/scodeinst/Connect4.mo index c3f6bf33298..92e91046c2b 100644 --- a/testsuite/flattening/modelica/scodeinst/Connect4.mo +++ b/testsuite/flattening/modelica/scodeinst/Connect4.mo @@ -36,12 +36,12 @@ end Connect4; // equation // c1[1].e[1] = c2[1].e[1]; // c1[1].e[2] = c2[1].e[2]; -// (-c1[1].f[1]) + (-c2[1].f[1]) = 0.0; -// (-c1[1].f[2]) + (-c2[1].f[2]) = 0.0; +// (-c1[1].f[1]) - c2[1].f[1] = 0.0; +// (-c1[1].f[2]) - c2[1].f[2] = 0.0; // c1[2].e[1] = c2[2].e[1]; // c1[2].e[2] = c2[2].e[2]; -// (-c1[2].f[1]) + (-c2[2].f[1]) = 0.0; -// (-c1[2].f[2]) + (-c2[2].f[2]) = 0.0; +// (-c1[2].f[1]) - c2[2].f[1] = 0.0; +// (-c1[2].f[2]) - c2[2].f[2] = 0.0; // c1[1].f[1] = 0.0; // c1[1].f[2] = 0.0; // c1[2].f[1] = 0.0; diff --git a/testsuite/flattening/modelica/scodeinst/Connect5.mo b/testsuite/flattening/modelica/scodeinst/Connect5.mo index 49b29d28271..1282537419e 100644 --- a/testsuite/flattening/modelica/scodeinst/Connect5.mo +++ b/testsuite/flattening/modelica/scodeinst/Connect5.mo @@ -28,7 +28,7 @@ end Connect5; // Real c2.f; // equation // a.c1.e = c2.e; -// a.c1.f + (-c2.f) = 0.0; +// a.c1.f - c2.f = 0.0; // c2.f = 0.0; // end Connect5; // endResult diff --git a/testsuite/flattening/modelica/scodeinst/ConnectDiffOrder1.mo b/testsuite/flattening/modelica/scodeinst/ConnectDiffOrder1.mo index c0cb0597bbe..13c62dd440c 100644 --- a/testsuite/flattening/modelica/scodeinst/ConnectDiffOrder1.mo +++ b/testsuite/flattening/modelica/scodeinst/ConnectDiffOrder1.mo @@ -38,8 +38,8 @@ end ConnectDiffOrder1; // equation // c1.e1 = c2.e1; // c1.e2 = c2.e2; -// (-c1.f1) + (-c2.f1) = 0.0; -// (-c1.f2) + (-c2.f2) = 0.0; +// (-c1.f1) - c2.f1 = 0.0; +// (-c1.f2) - c2.f2 = 0.0; // c1.f1 = 0.0; // c1.f2 = 0.0; // c2.f2 = 0.0; diff --git a/testsuite/flattening/modelica/scodeinst/ConnectDiffOrder2.mo b/testsuite/flattening/modelica/scodeinst/ConnectDiffOrder2.mo index cb9dd5c96f5..7d5c86d4eaf 100644 --- a/testsuite/flattening/modelica/scodeinst/ConnectDiffOrder2.mo +++ b/testsuite/flattening/modelica/scodeinst/ConnectDiffOrder2.mo @@ -56,12 +56,12 @@ end ConnectDiffOrder2; // equation // c3.c1.e1 = c4.c1.e1; // c3.c1.e2 = c4.c1.e2; -// (-c3.c1.f1) + (-c4.c1.f1) = 0.0; -// (-c3.c1.f2) + (-c4.c1.f2) = 0.0; +// (-c3.c1.f1) - c4.c1.f1 = 0.0; +// (-c3.c1.f2) - c4.c1.f2 = 0.0; // c3.c2.e1 = c4.c2.e1; // c3.c2.e2 = c4.c2.e2; -// (-c3.c2.f1) + (-c4.c2.f1) = 0.0; -// (-c3.c2.f2) + (-c4.c2.f2) = 0.0; +// (-c3.c2.f1) - c4.c2.f1 = 0.0; +// (-c3.c2.f2) - c4.c2.f2 = 0.0; // c3.c1.f1 = 0.0; // c3.c1.f2 = 0.0; // c3.c2.f2 = 0.0; diff --git a/testsuite/flattening/modelica/scodeinst/ConstantConnector3.mo b/testsuite/flattening/modelica/scodeinst/ConstantConnector3.mo index d5052326fc6..87f91c33210 100644 --- a/testsuite/flattening/modelica/scodeinst/ConstantConnector3.mo +++ b/testsuite/flattening/modelica/scodeinst/ConstantConnector3.mo @@ -27,7 +27,7 @@ end ConstantConnector3; // equation // c1.e = c2.e; // assert(abs(c1.x - c2.x) <= 0.0, "Connected constants/parameters must be equal"); -// (-c1.f) + (-c2.f) = 0.0; +// (-c1.f) - c2.f = 0.0; // c1.f = 0.0; // c2.f = 0.0; // end ConstantConnector3; diff --git a/testsuite/flattening/modelica/scodeinst/ExtendConnector1.mo b/testsuite/flattening/modelica/scodeinst/ExtendConnector1.mo index e23adc7a8bb..fd01b351a73 100644 --- a/testsuite/flattening/modelica/scodeinst/ExtendConnector1.mo +++ b/testsuite/flattening/modelica/scodeinst/ExtendConnector1.mo @@ -30,7 +30,7 @@ end ExtendConnector1; // Real c2.s; // equation // c1.e = c2.e; -// (-c1.f) + (-c2.f) = 0.0; +// (-c1.f) - c2.f = 0.0; // c1.s = c2.s; // c2.s = c1.s; // c1.f = 0.0; diff --git a/testsuite/flattening/modelica/scodeinst/ForConnect1.mo b/testsuite/flattening/modelica/scodeinst/ForConnect1.mo index 847ac360f60..cd84a77e8d6 100644 --- a/testsuite/flattening/modelica/scodeinst/ForConnect1.mo +++ b/testsuite/flattening/modelica/scodeinst/ForConnect1.mo @@ -34,11 +34,11 @@ end ForConnect1; // Real c2[3].f; // equation // c1[1].e = c2[1].e; -// (-c1[1].f) + (-c2[1].f) = 0.0; +// (-c1[1].f) - c2[1].f = 0.0; // c1[2].e = c2[2].e; -// (-c1[2].f) + (-c2[2].f) = 0.0; +// (-c1[2].f) - c2[2].f = 0.0; // c1[3].e = c2[3].e; -// (-c1[3].f) + (-c2[3].f) = 0.0; +// (-c1[3].f) - c2[3].f = 0.0; // c1[1].f = 0.0; // c1[2].f = 0.0; // c1[3].f = 0.0; diff --git a/testsuite/flattening/modelica/scodeinst/IfConnect1.mo b/testsuite/flattening/modelica/scodeinst/IfConnect1.mo index 98817770a9e..7b6ee557795 100644 --- a/testsuite/flattening/modelica/scodeinst/IfConnect1.mo +++ b/testsuite/flattening/modelica/scodeinst/IfConnect1.mo @@ -28,7 +28,7 @@ end IfConnect1; // Real c2.f; // equation // c1.e = c2.e; -// (-c1.f) + (-c2.f) = 0.0; +// (-c1.f) - c2.f = 0.0; // c1.f = 0.0; // c2.f = 0.0; // end IfConnect1; diff --git a/testsuite/flattening/modelica/scodeinst/InStreamFlowThreshold.mo b/testsuite/flattening/modelica/scodeinst/InStreamFlowThreshold.mo index e39d6b18ad3..c154a781538 100644 --- a/testsuite/flattening/modelica/scodeinst/InStreamFlowThreshold.mo +++ b/testsuite/flattening/modelica/scodeinst/InStreamFlowThreshold.mo @@ -54,7 +54,7 @@ end InStreamFlowThreshold; // equation // a.s2.r = a.s3.r; // a.s2.r = a.s1.r; -// (-a.s2.f) + (-a.s3.f) + (-a.s1.f) = 0.0; +// (-a.s2.f) - a.s3.f - a.s1.f = 0.0; // a.s1.s = ($OMC$PositiveMax(a.s3.f, 2.0) * a.s3.s + $OMC$PositiveMax(a.s2.f, 2.0) * a.s2.s) / ($OMC$PositiveMax(a.s3.f, 2.0) + $OMC$PositiveMax(a.s2.f, 2.0)) " equation generated from stream connection"; // a.s3.s = ($OMC$PositiveMax(a.s1.f, 2.0) * a.s1.s + $OMC$PositiveMax(a.s2.f, 2.0) * a.s2.s) / ($OMC$PositiveMax(a.s1.f, 2.0) + $OMC$PositiveMax(a.s2.f, 2.0)) " equation generated from stream connection"; // a.s2.s = ($OMC$PositiveMax(a.s1.f, 2.0) * a.s1.s + $OMC$PositiveMax(a.s3.f, 2.0) * a.s3.s) / ($OMC$PositiveMax(a.s1.f, 2.0) + $OMC$PositiveMax(a.s3.f, 2.0)) " equation generated from stream connection"; diff --git a/testsuite/flattening/modelica/scodeinst/InStreamInsideOutside.mo b/testsuite/flattening/modelica/scodeinst/InStreamInsideOutside.mo index 7e4358dd63b..db2325848e4 100644 --- a/testsuite/flattening/modelica/scodeinst/InStreamInsideOutside.mo +++ b/testsuite/flattening/modelica/scodeinst/InStreamInsideOutside.mo @@ -45,7 +45,7 @@ end InStreamInsideOutside; // equation // a.s.r = s.r; // a.s.s = s.s; -// a.s.f + (-s.f) = 0.0; +// a.s.f - s.f = 0.0; // s.f = 0.0; // a.instream_s = s.s; // instream_s = s.s; diff --git a/testsuite/flattening/modelica/scodeinst/InStreamNominalThreshold.mo b/testsuite/flattening/modelica/scodeinst/InStreamNominalThreshold.mo index 403cf83c1d7..4b181170ba0 100644 --- a/testsuite/flattening/modelica/scodeinst/InStreamNominalThreshold.mo +++ b/testsuite/flattening/modelica/scodeinst/InStreamNominalThreshold.mo @@ -54,7 +54,7 @@ end InStreamNominalThreshold; // equation // a.s2.r = a.s3.r; // a.s2.r = a.s1.r; -// (-a.s2.f) + (-a.s3.f) + (-a.s1.f) = 0.0; +// (-a.s2.f) - a.s3.f - a.s1.f = 0.0; // a.s1.s = ($OMC$PositiveMax(a.s3.f, 1e-07) * a.s3.s + $OMC$PositiveMax(a.s2.f, 0.0002) * a.s2.s) / ($OMC$PositiveMax(a.s3.f, 1e-07) + $OMC$PositiveMax(a.s2.f, 0.0002)) " equation generated from stream connection"; // a.s3.s = ($OMC$PositiveMax(a.s1.f, 1e-10) * a.s1.s + $OMC$PositiveMax(a.s2.f, 0.0002) * a.s2.s) / ($OMC$PositiveMax(a.s1.f, 1e-10) + $OMC$PositiveMax(a.s2.f, 0.0002)) " equation generated from stream connection"; // a.s2.s = ($OMC$PositiveMax(a.s1.f, 1e-10) * a.s1.s + $OMC$PositiveMax(a.s3.f, 1e-07) * a.s3.s) / ($OMC$PositiveMax(a.s1.f, 1e-10) + $OMC$PositiveMax(a.s3.f, 1e-07)) " equation generated from stream connection"; diff --git a/testsuite/flattening/modelica/scodeinst/InStreamPipeline.mo b/testsuite/flattening/modelica/scodeinst/InStreamPipeline.mo index dcf57266e59..8bcf4b682b1 100644 --- a/testsuite/flattening/modelica/scodeinst/InStreamPipeline.mo +++ b/testsuite/flattening/modelica/scodeinst/InStreamPipeline.mo @@ -75,11 +75,11 @@ end InStreamPipeline; // Real c.s.s; // equation // a1.s1.e = a1.s2.e; -// (-a1.s1.f) + (-a1.s2.f) = 0.0; +// (-a1.s1.f) - a1.s2.f = 0.0; // a1.s1.s = a2.s1.s; // a1.s2.s = b.s.s; // a2.s1.e = a2.s2.e; -// (-a2.s1.f) + (-a2.s2.f) = 0.0; +// (-a2.s1.f) - a2.s2.f = 0.0; // a2.s1.s = c.s.s; // a2.s2.s = a1.s2.s; // b.s.e = a1.s1.e; diff --git a/testsuite/flattening/modelica/scodeinst/InStreamTwoOutside.mo b/testsuite/flattening/modelica/scodeinst/InStreamTwoOutside.mo index 72fd449bc92..45ad03197e9 100644 --- a/testsuite/flattening/modelica/scodeinst/InStreamTwoOutside.mo +++ b/testsuite/flattening/modelica/scodeinst/InStreamTwoOutside.mo @@ -47,7 +47,7 @@ end InStreamTwoInside; // Real instream_a_s2; // equation // a.s1.r = a.s2.r; -// (-a.s1.f) + (-a.s2.f) = 0.0; +// (-a.s1.f) - a.s2.f = 0.0; // a.s1.s = a.s2.s; // a.s2.s = a.s1.s; // a.s1.f = 0.0; diff --git a/testsuite/flattening/modelica/scodeinst/OCGTests.mos b/testsuite/flattening/modelica/scodeinst/OCGTests.mos index 72cb9f12cb2..7c05cf7c4ae 100644 --- a/testsuite/flattening/modelica/scodeinst/OCGTests.mos +++ b/testsuite/flattening/modelica/scodeinst/OCGTests.mos @@ -58,55 +58,55 @@ checkModel(PowerSystems.Examples.AC3ph.Inverters.Rectifier); getErrorString(); // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Constraints.PrismaticConstraint completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Constraints.PrismaticConstraint has 2549 equation(s) and 2549 variable(s). -// 1957 of these are trivial equation(s)." +// 2011 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Constraints.RevoluteConstraint completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Constraints.RevoluteConstraint has 2355 equation(s) and 2355 variable(s). -// 1772 of these are trivial equation(s)." +// 1820 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Constraints.SphericalConstraint completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Constraints.SphericalConstraint has 2366 equation(s) and 2366 variable(s). -// 1785 of these are trivial equation(s)." +// 1833 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Constraints.UniversalConstraint completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Constraints.UniversalConstraint has 2641 equation(s) and 2641 variable(s). -// 1994 of these are trivial equation(s)." +// 2054 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.DoublePendulum completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.DoublePendulum has 1299 equation(s) and 1299 variable(s). -// 949 of these are trivial equation(s)." +// 963 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.DoublePendulumInitTip completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.DoublePendulumInitTip has 1553 equation(s) and 1553 variable(s). -// 1153 of these are trivial equation(s)." +// 1173 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.ForceAndTorque completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.ForceAndTorque has 1734 equation(s) and 1734 variable(s). -// 1263 of these are trivial equation(s)." +// 1269 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.FreeBody completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.FreeBody has 1295 equation(s) and 1295 variable(s). -// 957 of these are trivial equation(s)." +// 987 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.HeatLosses completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.HeatLosses has 1913 equation(s) and 1913 variable(s). -// 1405 of these are trivial equation(s)." +// 1429 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.InitSpringConstant completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.InitSpringConstant has 1256 equation(s) and 1256 variable(s). -// 931 of these are trivial equation(s)." +// 951 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.LineForceWithTwoMasses completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.LineForceWithTwoMasses has 2299 equation(s) and 2299 variable(s). -// 1690 of these are trivial equation(s)." +// 1702 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.Pendulum completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.Pendulum has 931 equation(s) and 931 variable(s). -// 659 of these are trivial equation(s)." +// 661 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.PendulumWithSpringDamper completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.PendulumWithSpringDamper has 1323 equation(s) and 1323 variable(s). -// 969 of these are trivial equation(s)." +// 981 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.PointGravity completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.PointGravity has 908 equation(s) and 908 variable(s). @@ -114,7 +114,7 @@ checkModel(PowerSystems.Examples.AC3ph.Inverters.Rectifier); getErrorString(); // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.PointGravityWithPointMasses completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.PointGravityWithPointMasses has 1094 equation(s) and 1094 variable(s). -// 819 of these are trivial equation(s)." +// 831 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.PointGravityWithPointMasses2 completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.PointGravityWithPointMasses2 has 2934 equation(s) and 2934 variable(s). @@ -126,104 +126,104 @@ checkModel(PowerSystems.Examples.AC3ph.Inverters.Rectifier); getErrorString(); // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.RollingWheelSetDriving completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.RollingWheelSetDriving has 2063 equation(s) and 2063 variable(s). -// 1547 of these are trivial equation(s)." +// 1569 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.RollingWheelSetPulling completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.RollingWheelSetPulling has 2155 equation(s) and 2155 variable(s). -// 1623 of these are trivial equation(s)." +// 1651 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.SpringDamperSystem completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.SpringDamperSystem has 1644 equation(s) and 1644 variable(s). -// 1227 of these are trivial equation(s)." +// 1253 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.SpringMassSystem completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.SpringMassSystem has 1450 equation(s) and 1450 variable(s). -// 1098 of these are trivial equation(s)." +// 1114 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.SpringWithMass completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.SpringWithMass has 949 equation(s) and 949 variable(s). -// 668 of these are trivial equation(s)." +// 680 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.Surfaces completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.Surfaces has 1247 equation(s) and 1247 variable(s). -// 977 of these are trivial equation(s)." +// 979 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.ThreeSprings completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.ThreeSprings has 1465 equation(s) and 1465 variable(s). -// 1089 of these are trivial equation(s)." +// 1125 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Elementary.UserDefinedGravityField completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Elementary.UserDefinedGravityField has 948 equation(s) and 948 variable(s). -// 677 of these are trivial equation(s)." +// 679 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Loops.Engine1a completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Loops.Engine1a has 2383 equation(s) and 2383 variable(s). -// 1839 of these are trivial equation(s)." +// 1877 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Loops.Engine1b completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Loops.Engine1b has 2487 equation(s) and 2487 variable(s). -// 1913 of these are trivial equation(s)." +// 1953 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Loops.Engine1b_analytic completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Loops.Engine1b_analytic has 2751 equation(s) and 2751 variable(s). -// 2081 of these are trivial equation(s)." +// 2171 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Loops.EngineV6 completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Loops.EngineV6 has 11122 equation(s) and 11122 variable(s). -// 8731 of these are trivial equation(s)." +// 9069 of these are trivial equation(s)." // "[NFFrontEnd/NFUnitCheck.mo:0:0-0:0:writable] Error: Internal error NFUnitCheck.checkUnits: unit check module failed // " // "Check of Modelica.Mechanics.MultiBody.Examples.Loops.EngineV6_analytic completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Loops.EngineV6_analytic has 9016 equation(s) and 9016 variable(s). -// 6759 of these are trivial equation(s)." +// 7224 of these are trivial equation(s)." // "[NFFrontEnd/NFUnitCheck.mo:0:0-0:0:writable] Error: Internal error NFUnitCheck.checkUnits: unit check module failed // " // "Check of Modelica.Mechanics.MultiBody.Examples.Loops.Fourbar1 completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Loops.Fourbar1 has 2055 equation(s) and 2055 variable(s). -// 1497 of these are trivial equation(s)." +// 1515 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Loops.Fourbar2 completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Loops.Fourbar2 has 2237 equation(s) and 2237 variable(s). -// 1587 of these are trivial equation(s)." +// 1601 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Loops.Fourbar_analytic completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Loops.Fourbar_analytic has 1738 equation(s) and 1738 variable(s). -// 1322 of these are trivial equation(s)." +// 1350 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Loops.PlanarLoops_analytic completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Loops.PlanarLoops_analytic has 4009 equation(s) and 4009 variable(s). -// 2870 of these are trivial equation(s)." +// 3034 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Rotational3DEffects.ActuatedDrive completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Rotational3DEffects.ActuatedDrive has 1525 equation(s) and 1525 variable(s). -// 1121 of these are trivial equation(s)." +// 1153 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Rotational3DEffects.BevelGear1D completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Rotational3DEffects.BevelGear1D has 1752 equation(s) and 1752 variable(s). -// 1270 of these are trivial equation(s)." +// 1328 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Rotational3DEffects.GearConstraint completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Rotational3DEffects.GearConstraint has 1843 equation(s) and 1843 variable(s). -// 1381 of these are trivial equation(s)." +// 1427 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Rotational3DEffects.GyroscopicEffects completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Rotational3DEffects.GyroscopicEffects has 2273 equation(s) and 2273 variable(s). -// 1745 of these are trivial equation(s)." +// 1777 of these are trivial equation(s)." // "" // "Check of Modelica.Mechanics.MultiBody.Examples.Rotational3DEffects.MovingActuatedDrive completed successfully. // Class Modelica.Mechanics.MultiBody.Examples.Rotational3DEffects.MovingActuatedDrive has 1848 equation(s) and 1848 variable(s). -// 1332 of these are trivial equation(s)." +// 1380 of these are trivial equation(s)." // "" // true // "" // "Check of Transformer.SC2 completed successfully. // Class Transformer.SC2 has 393 equation(s) and 393 variable(s). -// 177 of these are trivial equation(s)." +// 183 of these are trivial equation(s)." // "" // true // "" // "Check of PowerSystems.Examples.AC3ph.Inverters.Rectifier completed successfully. // Class PowerSystems.Examples.AC3ph.Inverters.Rectifier has 229 equation(s) and 229 variable(s). -// 109 of these are trivial equation(s)." +// 117 of these are trivial equation(s)." // "" // endResult