From 3f57eed2bdbf68e705438181026c2e31d3b756fc Mon Sep 17 00:00:00 2001 From: Lennart Ochel Date: Tue, 16 Sep 2014 12:35:37 +0000 Subject: [PATCH] - Change some back end data types for base-/sub-clock partitions - Change some names (e.g., INFERREDCLOCK to INFERRED_CLOCK) to match common code style - Update expected output git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@22322 f25d12d1-65f4-0310-ae8a-bbce733d8d8e --- Compiler/BackEnd/BackendDAE.mo | 116 +++++++++++----------- Compiler/BackEnd/BackendDAECreate.mo | 14 +-- Compiler/BackEnd/BackendDAEOptimize.mo | 20 ++-- Compiler/BackEnd/BackendDAETransform.mo | 6 +- Compiler/BackEnd/BackendDAEUtil.mo | 18 ++-- Compiler/BackEnd/BackendDump.mo | 24 ++--- Compiler/BackEnd/BackendEquation.mo | 54 +++++----- Compiler/BackEnd/BackendQSS.mo | 4 +- Compiler/BackEnd/BackendVarTransform.mo | 8 +- Compiler/BackEnd/BackendVariable.mo | 10 +- Compiler/BackEnd/BinaryTree.mo | 14 +-- Compiler/BackEnd/BinaryTreeInt.mo | 14 +-- Compiler/BackEnd/DAEQuery.mo | 2 +- Compiler/BackEnd/Differentiate.mo | 16 +-- Compiler/BackEnd/IndexReduction.mo | 6 +- Compiler/BackEnd/Initialization.mo | 40 ++++---- Compiler/BackEnd/InlineArrayEquations.mo | 6 +- Compiler/BackEnd/Matching.mo | 8 +- Compiler/BackEnd/RemoveSimpleEquations.mo | 6 +- Compiler/BackEnd/SimCode.mo | 12 +-- Compiler/BackEnd/SimCodeUtil.mo | 4 +- Compiler/BackEnd/SynchronousFeatures.mo | 4 +- Compiler/BackEnd/Uncertainties.mo | 40 ++++---- Compiler/FrontEnd/DAE.mo | 19 ++-- Compiler/FrontEnd/ExpressionDump.mo | 10 +- Compiler/FrontEnd/Static.mo | 4 +- Compiler/FrontEnd/Values.mo | 1 - Compiler/Template/ExpressionDumpTV.mo | 19 ++-- Compiler/Template/ExpressionDumpTpl.tpl | 10 +- 29 files changed, 249 insertions(+), 260 deletions(-) diff --git a/Compiler/BackEnd/BackendDAE.mo b/Compiler/BackEnd/BackendDAE.mo index 36bc0923f65..813386b21fc 100644 --- a/Compiler/BackEnd/BackendDAE.mo +++ b/Compiler/BackEnd/BackendDAE.mo @@ -32,7 +32,7 @@ encapsulated package BackendDAE " file: BackendDAE.mo package: BackendDAE - description: BackendDAE contains the data-types used by the backend. + description: BackendDAE contains the data-types used by the back end. RCS: $Id$ " @@ -69,8 +69,8 @@ type EqSystems = list; public uniontype EqSystem "An independent system of equations (and their corresponding variables)" record EQSYSTEM - Variables orderedVars "ordered Variables, only states and alg. vars" ; - EquationArray orderedEqs "ordered Equations" ; + Variables orderedVars "ordered Variables, only states and alg. vars"; + EquationArray orderedEqs "ordered Equations"; Option m; Option mT; Matching matching; @@ -82,23 +82,27 @@ end EqSystem; public uniontype BaseClockPartitionKind record UNKNOWN_PARTITION end UNKNOWN_PARTITION; - record CLOCKED_PARTITION end CLOCKED_PARTITION; + record CLOCKED_PARTITION + DAE.ClockKind clockKind; + // array subClockPartitions; + end CLOCKED_PARTITION; record CONTINUOUS_TIME_PARTITION end CONTINUOUS_TIME_PARTITION; record UNSPECIFIED_PARTITION "treated as CONTINUOUS_TIME_PARTITION" end UNSPECIFIED_PARTITION; end BaseClockPartitionKind; public -uniontype SubClockPartitionKind - record UNKNOWN_SUB_PARTITION end UNKNOWN_SUB_PARTITION; - record SUB_PARTITION - Integer index; - end SUB_PARTITION; -end SubClockPartitionKind; +uniontype SubClockPartition + record SubClockPartition + Integer factor "subSample/superSample"; + //Integer counter "shiftSample/backSample"; + //Integer resolution "shiftSample/backSample"; + end SubClockPartition; +end SubClockPartition; public uniontype Shared "Data shared for all equation-systems" record SHARED - Variables knownVars "Known variables, i.e. constants and parameters" ; + Variables knownVars "Known variables, i.e. constants and parameters"; Variables externalObjects "External object variables"; Variables aliasVars "Data originating from removed simple equations needed to build variables' lookup table (in C output). @@ -107,14 +111,14 @@ uniontype Shared "Data shared for all equation-systems" buffer and results caching, etc., is avoided, but in C-code output all the data about variables' names, comments, units, etc. is preserved as well as pinter to their values (trajectories)."; - EquationArray initialEqs "Initial equations" ; - EquationArray removedEqs "these are equations that cannot solve for a variable. for example assertions, external function calls, algorithm sections without effect" ; + EquationArray initialEqs "Initial equations"; + EquationArray removedEqs "these are equations that cannot solve for a variable. for example assertions, external function calls, algorithm sections without effect"; list< .DAE.Constraint> constraints "constraints (Optimica extension)"; list< .DAE.ClassAttributes> classAttrs "class attributes (Optimica extension)"; Env.Cache cache; Env.Env env; .DAE.FunctionTree functionTree "functions for Backend"; - EventInfo eventInfo "eventInfo" ; + EventInfo eventInfo "eventInfo"; ExternalObjectClasses extObjClasses "classes of external objects, contains constructor & destructor"; BackendDAEType backendDAEType "indicate for what the BackendDAE is used"; SymbolicJacobians symjacs "Symbolic Jacobians"; @@ -166,8 +170,8 @@ public uniontype VariableArray "array of Equations are expandable, to amortize the cost of adding equations in a more efficient manner" record VARIABLE_ARRAY - Integer numberOfElements "no. elements" ; - Integer arrSize "array size" ; + Integer numberOfElements "no. elements"; + Integer arrSize "array size"; array> varOptArr; end VARIABLE_ARRAY; end VariableArray; @@ -176,8 +180,8 @@ public uniontype EquationArray record EQUATION_ARRAY Integer size "size of the Equations in scalar form"; - Integer numberOfElement "no. elements" ; - Integer arrSize "array size" ; + Integer numberOfElement "no. elements"; + Integer arrSize "array size"; array> equOptArr; end EQUATION_ARRAY; end EquationArray; @@ -185,17 +189,17 @@ end EquationArray; public uniontype Var "variables" record VAR - .DAE.ComponentRef varName "variable name" ; - VarKind varKind "Kind of variable" ; - .DAE.VarDirection varDirection "input, output or bidirectional" ; + .DAE.ComponentRef varName "variable name"; + VarKind varKind "Kind of variable"; + .DAE.VarDirection varDirection "input, output or bidirectional"; .DAE.VarParallelism varParallelism "parallelism of the variable. parglobal, parlocal or non-parallel"; - Type varType "built-in type or enumeration" ; - Option< .DAE.Exp> bindExp "Binding expression e.g. for parameters" ; - Option bindValue "binding value for parameters" ; - .DAE.InstDims arryDim "array dimensions of non-expanded var" ; - .DAE.ElementSource source "origin of variable" ; - Option< .DAE.VariableAttributes> values "values on built-in attributes" ; - Option comment "this contains the comment and annotation from Absyn" ; + Type varType "built-in type or enumeration"; + Option< .DAE.Exp> bindExp "Binding expression e.g. for parameters"; + Option bindValue "binding value for parameters"; + .DAE.InstDims arryDim "array dimensions of non-expanded var"; + .DAE.ElementSource source "origin of variable"; + Option< .DAE.VariableAttributes> values "values on built-in attributes"; + Option comment "this contains the comment and annotation from Absyn"; .DAE.ConnectorType connectorType "flow, stream, unspecified or not connector."; end VAR; end Var; @@ -231,13 +235,13 @@ public uniontype EquationAttributes record EQUATION_ATTRIBUTES Boolean differentiated "true if the equation was differentiated, and should not differentiated again to avoid equal equations"; EquationKind kind; - SubClockPartitionKind subPartitionKind; + Integer subPartitionIndex; end EQUATION_ATTRIBUTES; end EquationAttributes; -public constant EquationAttributes EQ_ATTR_DEFAULT_DYNAMIC = EQUATION_ATTRIBUTES(false, DYNAMIC_EQUATION(), UNKNOWN_SUB_PARTITION()); -public constant EquationAttributes EQ_ATTR_DEFAULT_INITIAL = EQUATION_ATTRIBUTES(false, INITIAL_EQUATION(), UNKNOWN_SUB_PARTITION()); -public constant EquationAttributes EQ_ATTR_DEFAULT_UNKNOWN = EQUATION_ATTRIBUTES(false, UNKNOWN_EQUATION_KIND(), UNKNOWN_SUB_PARTITION()); +public constant EquationAttributes EQ_ATTR_DEFAULT_DYNAMIC = EQUATION_ATTRIBUTES(false, DYNAMIC_EQUATION(), 0); +public constant EquationAttributes EQ_ATTR_DEFAULT_INITIAL = EQUATION_ATTRIBUTES(false, INITIAL_EQUATION(), 0); +public constant EquationAttributes EQ_ATTR_DEFAULT_UNKNOWN = EQUATION_ATTRIBUTES(false, UNKNOWN_EQUATION_KIND(), 0); public uniontype Equation @@ -249,9 +253,9 @@ uniontype Equation end EQUATION; record ARRAY_EQUATION - list dimSize "dimension sizes" ; - .DAE.Exp left "lhs" ; - .DAE.Exp right "rhs" ; + list dimSize "dimension sizes"; + .DAE.Exp left "lhs"; + .DAE.Exp right "rhs"; .DAE.ElementSource source "origin of equation"; EquationAttributes attr; end ARRAY_EQUATION; @@ -264,13 +268,13 @@ uniontype Equation end SOLVED_EQUATION; record RESIDUAL_EQUATION - .DAE.Exp exp "not present from FrontEnd" ; + .DAE.Exp exp "not present from FrontEnd"; .DAE.ElementSource source "origin of equation"; EquationAttributes attr; end RESIDUAL_EQUATION; record ALGORITHM - Integer size "size of equation" ; + Integer size "size of equation"; .DAE.Algorithm alg; .DAE.ElementSource source "origin of algorithm"; .DAE.Expand expand "this algorithm was translated from an equation. we should not expand array crefs!"; @@ -285,9 +289,9 @@ uniontype Equation end WHEN_EQUATION; record COMPLEX_EQUATION "complex equations: recordX = function call(x, y, ..);" - Integer size "size of equation" ; - .DAE.Exp left "lhs" ; - .DAE.Exp right "rhs" ; + Integer size "size of equation"; + .DAE.Exp left "lhs"; + .DAE.Exp right "rhs"; .DAE.ElementSource source "origin of equation"; EquationAttributes attr; end COMPLEX_EQUATION; @@ -304,9 +308,9 @@ end Equation; public uniontype WhenEquation record WHEN_EQ "equation when condition then left = right; [elsewhenPart] end when;" - .DAE.Exp condition "the when-condition" ; - .DAE.ComponentRef left "left hand side of equation" ; - .DAE.Exp right "right hand side of equation" ; + .DAE.Exp condition "the when-condition"; + .DAE.ComponentRef left "left hand side of equation"; + .DAE.Exp right "right hand side of equation"; Option elsewhenPart "elsewhen equation with the same cref on the left hand side."; end WHEN_EQ; end WhenEquation; @@ -372,7 +376,7 @@ uniontype StateOrder end StateOrder; public -type StrongComponents = list "Order of the equations the have to be solved" ; +type StrongComponents = list "Order of the equations the have to be solved"; public uniontype StrongComponent @@ -455,8 +459,8 @@ end StateSet; public uniontype EventInfo record EVENT_INFO - list timeEvents "stores all information regarding time events" ; - list whenClauseLst "list of when clauses. The WhenEquation data type refer to this list by position" ; + list timeEvents "stores all information regarding time events"; + list whenClauseLst "list of when clauses. The WhenEquation data type refer to this list by position"; list zeroCrossingLst "list of zero crossing conditions"; // TODO: sampleLst and relationsLst could be removed if cpp runtime is prepared to handle zero crossing conditions list sampleLst "list of sample as before, used by cpp runtime"; @@ -469,8 +473,8 @@ end EventInfo; public uniontype WhenOperator record REINIT "Reinit Statement" - .DAE.ComponentRef stateVar "State variable to reinit" ; - .DAE.Exp value "Value after reinit" ; + .DAE.ComponentRef stateVar "State variable to reinit"; + .DAE.Exp value "Value after reinit"; .DAE.ElementSource source "origin of equation"; end REINIT; @@ -497,9 +501,9 @@ end WhenOperator; public uniontype WhenClause record WHEN_CLAUSE - .DAE.Exp condition "the when-condition" ; - list reinitStmtLst "list of reinit statements associated to the when clause." ; - Option elseClause "index of elsewhen clause" ; + .DAE.Exp condition "the when-condition"; + list reinitStmtLst "list of reinit statements associated to the when clause."; + Option elseClause "index of elsewhen clause"; // HL only needs to know if it is an elsewhen the equations take care of which clauses are related. @@ -511,9 +515,9 @@ end WhenClause; public uniontype ZeroCrossing record ZERO_CROSSING - .DAE.Exp relation_ "function" ; - list occurEquLst "list of equations where the function occurs" ; - list occurWhenLst "list of when clauses where the function occurs" ; + .DAE.Exp relation_ "function"; + list occurEquLst "list of equations where the function occurs"; + list occurWhenLst "list of when clauses where the function occurs"; end ZERO_CROSSING; end ZeroCrossing; @@ -526,7 +530,7 @@ uniontype TimeEvent end COMPLEX_TIME_EVENT; record SAMPLE_TIME_EVENT "e.g. sample(1, 1)" - Integer index "unique sample index" ; + Integer index "unique sample index"; .DAE.Exp startExp; .DAE.Exp intervalExp; end SAMPLE_TIME_EVENT; @@ -543,7 +547,7 @@ public type IncidenceMatrixElement = list; public -type IncidenceMatrix = array "array>" ; +type IncidenceMatrix = array "array>"; public type IncidenceMatrixT = IncidenceMatrix diff --git a/Compiler/BackEnd/BackendDAECreate.mo b/Compiler/BackEnd/BackendDAECreate.mo index 294e4343108..2e901382b6b 100644 --- a/Compiler/BackEnd/BackendDAECreate.mo +++ b/Compiler/BackEnd/BackendDAECreate.mo @@ -591,7 +591,7 @@ algorithm vars = BackendVariable.addVar(backendVar1, inVars); e1 = Expression.crefExp(cr); then - (vars, inKnVars, inExVars, BackendDAE.EQUATION(e1, e2, source, BackendDAE.EQUATION_ATTRIBUTES(false, BackendDAE.BINDING_EQUATION(), BackendDAE.UNKNOWN_SUB_PARTITION()))::inEqnsLst, iInlineHT); + (vars, inKnVars, inExVars, BackendDAE.EQUATION(e1, e2, source, BackendDAE.EQUATION_ATTRIBUTES(false, BackendDAE.BINDING_EQUATION(), 0))::inEqnsLst, iInlineHT); // variables: states and algebraic variables with NO binding equation case (DAE.VAR(binding=NONE()), _, _, _, _, _, _) @@ -614,7 +614,7 @@ algorithm // known variables: parameters and constants case (DAE.VAR(componentRef = _), _, _, _, _, _, _) equation - (backendVar1, inlineHT,assrtEqs) = lowerKnownVar(inElement, functionTree, iInlineHT) "in previous rule, lower_var failed." ; + (backendVar1, inlineHT,assrtEqs) = lowerKnownVar(inElement, functionTree, iInlineHT) "in previous rule, lower_var failed."; knvars = BackendVariable.addVar(backendVar1, inKnVars); eqLst = listAppend(inEqnsLst,assrtEqs); then @@ -1656,7 +1656,7 @@ algorithm true = DAEUtil.expTypeComplex(tp); size = Expression.sizeOf(tp); then - BackendDAE.COMPLEX_EQUATION(size, inExp1, inExp2, source, BackendDAE.EQUATION_ATTRIBUTES(false, inEqKind, BackendDAE.UNKNOWN_SUB_PARTITION()))::inEqns; + BackendDAE.COMPLEX_EQUATION(size, inExp1, inExp2, source, BackendDAE.EQUATION_ATTRIBUTES(false, inEqKind, 0))::inEqns; // array types to array equations case (_, _, _, _, _, _) @@ -1674,7 +1674,7 @@ algorithm true = Types.isTuple(tp); size = Expression.sizeOf(tp); then - BackendDAE.COMPLEX_EQUATION(size, inExp1, inExp2, source, BackendDAE.EQUATION_ATTRIBUTES(false, inEqKind, BackendDAE.UNKNOWN_SUB_PARTITION()))::inEqns; + BackendDAE.COMPLEX_EQUATION(size, inExp1, inExp2, source, BackendDAE.EQUATION_ATTRIBUTES(false, inEqKind, 0))::inEqns; // other types case (_, _, _, _, _, _) @@ -1686,7 +1686,7 @@ algorithm false = b1 or b2 or b3; //Error.assertionOrAddSourceMessage(not b1, Error.INTERNAL_ERROR, {str}, Absyn.dummyInfo); then - BackendDAE.EQUATION(inExp1, inExp2, source, BackendDAE.EQUATION_ATTRIBUTES(false, inEqKind, BackendDAE.UNKNOWN_SUB_PARTITION()))::inEqns; + BackendDAE.EQUATION(inExp1, inExp2, source, BackendDAE.EQUATION_ATTRIBUTES(false, inEqKind, 0))::inEqns; else equation // show only on failtrace! @@ -1722,7 +1722,7 @@ algorithm case (_, _, _, _, _, _) equation ds = Expression.dimensionsSizes(dims); - then BackendDAE.ARRAY_EQUATION(ds, e1, e2, source, BackendDAE.EQUATION_ATTRIBUTES(false, inEqKind, BackendDAE.UNKNOWN_SUB_PARTITION()))::iAcc; + then BackendDAE.ARRAY_EQUATION(ds, e1, e2, source, BackendDAE.EQUATION_ATTRIBUTES(false, inEqKind, 0))::iAcc; end matchcontinue; end lowerArrayEqn; @@ -1740,7 +1740,7 @@ algorithm list e1lst, e2lst; case ({}, {}, _, _, _) then iAcc; case (e1::e1lst, e2::e2lst, _, _, _) - then generateEquations(e1lst, e2lst, source, inEqKind, BackendDAE.EQUATION(e1, e2, source, BackendDAE.EQUATION_ATTRIBUTES(false, inEqKind, BackendDAE.UNKNOWN_SUB_PARTITION()))::iAcc); + then generateEquations(e1lst, e2lst, source, inEqKind, BackendDAE.EQUATION(e1, e2, source, BackendDAE.EQUATION_ATTRIBUTES(false, inEqKind, 0))::iAcc); end match; end generateEquations; diff --git a/Compiler/BackEnd/BackendDAEOptimize.mo b/Compiler/BackEnd/BackendDAEOptimize.mo index c75157661cb..c2bbc3c8871 100644 --- a/Compiler/BackEnd/BackendDAEOptimize.mo +++ b/Compiler/BackEnd/BackendDAEOptimize.mo @@ -496,7 +496,7 @@ algorithm // inputs not constant and parameter(fixed=false) are constant but evaluated after konstant variables are evaluted case (e as DAE.CREF(cr,_), (_,vars,knvars,b1,b2)) equation - (vlst,_::_)= BackendVariable.getVar(cr, knvars) "input variables stored in known variables are input on top level" ; + (vlst,_::_)= BackendVariable.getVar(cr, knvars) "input variables stored in known variables are input on top level"; false = List.mapAllValueBool(vlst,toplevelInputOrUnfixed,false); then (e,false,(true,vars,knvars,b1,b2)); case (e as DAE.CALL(path = Absyn.IDENT(name = "sample"), expLst = {_,_,_}), (_,vars,knvars,b1,b2)) then (e,false,(true,vars,knvars,b1,b2)); @@ -5602,8 +5602,8 @@ algorithm end makeEquationToResidualExp; protected function makeEquationsFromResiduals - input list inExp1 "conds" ; - input list> inExpLst2 "tbs" ; + input list inExp1 "conds"; + input list> inExpLst2 "tbs"; input list inExpLst3; input DAE.ElementSource inSource "the origin of the element"; input BackendDAE.EquationAttributes inEqAttr; @@ -6121,8 +6121,8 @@ algorithm (osyst,osharedChanged) := matchcontinue(isyst,sharedChanged) local - BackendDAE.Variables orderedVars "ordered Variables, only states and alg. vars" ; - BackendDAE.EquationArray orderedEqs "ordered Equations" ; + BackendDAE.Variables orderedVars "ordered Variables, only states and alg. vars"; + BackendDAE.EquationArray orderedEqs "ordered Equations"; Option m; Option mT; BackendDAE.Matching matching; @@ -6788,7 +6788,7 @@ algorithm list array; DAE.Type ty; - Boolean scalar "scalar for codegen" ; + Boolean scalar "scalar for codegen"; HashTableExpToIndex.HashTable ht; @@ -6981,7 +6981,7 @@ algorithm list array; DAE.Type ty; - Boolean scalar "scalar for codegen" ; + Boolean scalar "scalar for codegen"; // we do not replace initial() case (condition as DAE.CALL(path = Absyn.IDENT(name = "initial")), _, index) @@ -7252,11 +7252,11 @@ algorithm BackendDAE.Var var1; case(_, _, _) equation - true = BackendVariable.isVarDiscrete(var) "do not change discrete vars to states, because they have no derivative" ; + true = BackendVariable.isVarDiscrete(var) "do not change discrete vars to states, because they have no derivative"; then (inVars, DAE.RCONST(0.0)); case(_, _, _) equation - false = BackendVariable.isVarDiscrete(var) "do not change discrete vars to states, because they have no derivative" ; + false = BackendVariable.isVarDiscrete(var) "do not change discrete vars to states, because they have no derivative"; false = BackendVariable.isStateVar(var); var1 = BackendVariable.setVarKind(var, BackendDAE.STATE(1,NONE())); vars = BackendVariable.addVar(var1, inVars); @@ -7289,7 +7289,7 @@ algorithm case(_, {}, true) then inVars; case(_, var::newStates, _) equation - false = BackendVariable.isVarDiscrete(var) "do not change discrete vars to states, because they have no derivative" ; + false = BackendVariable.isVarDiscrete(var) "do not change discrete vars to states, because they have no derivative"; false = BackendVariable.isStateVar(var); var = BackendVariable.setVarKind(var, BackendDAE.STATE(1,NONE())); vars = BackendVariable.addVar(var, inVars); diff --git a/Compiler/BackEnd/BackendDAETransform.mo b/Compiler/BackEnd/BackendDAETransform.mo index fcdc8aabf97..97ecce34bdb 100644 --- a/Compiler/BackEnd/BackendDAETransform.mo +++ b/Compiler/BackEnd/BackendDAETransform.mo @@ -1209,9 +1209,9 @@ algorithm String eqnstr; case (_,_,_) equation - var = a2[eqn] "Got the variable that is solved in the equation" ; - reachable = Debug.bcallret2(intGt(var,0),arrayGet,mt,var,{}) "Got the equations of that variable" ; - reachable_1 = BackendDAEUtil.removeNegative(reachable) "in which other equations is this variable present ?" ; + var = a2[eqn] "Got the variable that is solved in the equation"; + reachable = Debug.bcallret2(intGt(var,0),arrayGet,mt,var,{}) "Got the equations of that variable"; + reachable_1 = BackendDAEUtil.removeNegative(reachable) "in which other equations is this variable present ?"; then List.removeOnTrue(eqn, intEq, reachable_1); else diff --git a/Compiler/BackEnd/BackendDAEUtil.mo b/Compiler/BackEnd/BackendDAEUtil.mo index e743f45d213..4521caf364d 100644 --- a/Compiler/BackEnd/BackendDAEUtil.mo +++ b/Compiler/BackEnd/BackendDAEUtil.mo @@ -1098,8 +1098,8 @@ end calculateVarSizes; public function numberOfZeroCrossings "author: lochel" input BackendDAE.BackendDAE inBackendDAE; - output Integer outNumZeroCrossings "number of ordinary zerocrossings" ; - output Integer outNumTimeEvents "number of zerocrossings that are time events" ; + output Integer outNumZeroCrossings "number of ordinary zerocrossings"; + output Integer outNumTimeEvents "number of zerocrossings that are time events"; output Integer outNumRelations; output Integer outNumMathEventFunctions; protected @@ -2009,7 +2009,7 @@ algorithm array> m,mt; case (BackendDAE.EQSYSTEM(matching=BackendDAE.MATCHING(ass1,_,comps))) equation - size = arrayLength(ass1) "equation_size(e) => size &" ; + size = arrayLength(ass1) "equation_size(e) => size &"; arr = arrayCreate(size, 0); arr_1 = markStateEquations(syst, arr, ass1); (blt_states,blt_no_states) = splitBlocks(comps, arr_1); @@ -2044,14 +2044,14 @@ algorithm case (comp::comps,arr) equation (eqns,_) = BackendDAETransform.getEquationAndSolvedVarIndxes(comp); - true = blockIsDynamic(eqns, arr) "block is dynamic, belong in dynamic section" ; + true = blockIsDynamic(eqns, arr) "block is dynamic, belong in dynamic section"; (states,output_) = splitBlocks(comps, arr); then ((comp::states),output_); case (comp::comps,arr) equation - (states,output_) = splitBlocks(comps, arr) "block is not dynamic, belong in output section" ; + (states,output_) = splitBlocks(comps, arr) "block is not dynamic, belong in output section"; then (states,(comp::output_)); else @@ -6447,7 +6447,7 @@ algorithm case (BackendDAE.EQUATION(exp = e1,scalar=e2,source=source),_,_,_,_,_,_,_,_) equation var_indxs = fvarsInEqn(m, eqn_indx); - var_indxs_1 = List.unionOnTrue(var_indxs, {}, intEq) "Remove duplicates and get in correct order: ascending index" ; + var_indxs_1 = List.unionOnTrue(var_indxs, {}, intEq) "Remove duplicates and get in correct order: ascending index"; var_indxs_1 = List.sort(var_indxs_1,intGt); (eqns, shared) = calculateJacobianRow2(Expression.expSub(e1,e2), vars, scalar_eqn_indx, var_indxs_1,differentiateIfExp,iShared,source,iAcc); then @@ -6457,7 +6457,7 @@ algorithm case (BackendDAE.RESIDUAL_EQUATION(exp=e,source=source),_,_,_,_,_,_,_,_) equation var_indxs = fvarsInEqn(m, eqn_indx); - var_indxs_1 = List.unionOnTrue(var_indxs, {}, intEq) "Remove duplicates and get in correct order: ascending index" ; + var_indxs_1 = List.unionOnTrue(var_indxs, {}, intEq) "Remove duplicates and get in correct order: ascending index"; var_indxs_1 = List.sort(var_indxs_1,intGt); (eqns, shared) = calculateJacobianRow2(e, vars, scalar_eqn_indx, var_indxs_1,differentiateIfExp,iShared,source,iAcc); then @@ -6468,7 +6468,7 @@ algorithm equation e1 = Expression.crefExp(cr); var_indxs = fvarsInEqn(m, eqn_indx); - var_indxs_1 = List.unionOnTrue(var_indxs, {}, intEq) "Remove duplicates and get in correct order: ascending index" ; + var_indxs_1 = List.unionOnTrue(var_indxs, {}, intEq) "Remove duplicates and get in correct order: ascending index"; var_indxs_1 = List.sort(var_indxs_1,intGt); (eqns, shared) = calculateJacobianRow2(Expression.expSub(e1,e2), vars, scalar_eqn_indx, var_indxs_1,differentiateIfExp,iShared,source,iAcc); then @@ -6884,7 +6884,7 @@ end rhsConstant2; // // case (e,_) // equation -// {} = Expression.extractCrefsFromExp(e) "Special case for expressions with no variables" ; +// {} = Expression.extractCrefsFromExp(e) "Special case for expressions with no variables"; // then // true; // case (e,vars) diff --git a/Compiler/BackEnd/BackendDump.mo b/Compiler/BackEnd/BackendDump.mo index 60ea5a0c3c8..71877476b35 100644 --- a/Compiler/BackEnd/BackendDump.mo +++ b/Compiler/BackEnd/BackendDump.mo @@ -2738,7 +2738,6 @@ algorithm end optDistributionString; protected function optUncertainty -"funcion optUncertainty" input Option uncertainty; output String outString; algorithm @@ -2751,7 +2750,6 @@ algorithm end optUncertainty; protected function optStateSelectionString -" function optStateSelectionString " input Option ss; output String outString; algorithm @@ -2770,7 +2768,7 @@ protected function partitionKindString output String outString; algorithm outString := match(inPartitionKind) - case BackendDAE.CLOCKED_PARTITION() then "clocked"; + case BackendDAE.CLOCKED_PARTITION(clockKind=_) then "clocked"; case BackendDAE.CONTINUOUS_TIME_PARTITION() then "continuous time"; case BackendDAE.UNSPECIFIED_PARTITION() then "unspecified"; case BackendDAE.UNKNOWN_PARTITION() then "unknown"; @@ -2785,27 +2783,21 @@ protected function equationAttrString output String outString; protected BackendDAE.EquationKind kind; - BackendDAE.SubClockPartitionKind subPartitionKind; + Integer subPartitionIndex; algorithm - BackendDAE.EQUATION_ATTRIBUTES(kind=kind, subPartitionKind=subPartitionKind) := inEqAttr; + BackendDAE.EQUATION_ATTRIBUTES(kind=kind, subPartitionIndex=subPartitionIndex) := inEqAttr; outString := "[" +& equationKindString(kind); - outString := Util.if_(Flags.isSet(Flags.DUMP_SYNCHRONOUS), outString +& ", sub-partition index: " +& subPartitionString(subPartitionKind), outString); + outString := Util.if_(Flags.isSet(Flags.DUMP_SYNCHRONOUS), outString +& ", sub-partition index: " +& subPartitionString(subPartitionIndex), outString); outString := outString +& "]"; end equationAttrString; protected function subPartitionString - input BackendDAE.SubClockPartitionKind inSubPartitionKind; + input Integer inSubPartitionIndex; output String outString; algorithm - outString := match inSubPartitionKind - local - Integer index; - - case BackendDAE.SUB_PARTITION(index=index) then intString(index); - case BackendDAE.UNKNOWN_SUB_PARTITION() then "unknown"; - else equation - Error.addInternalError("./Compiler/BackEnd/BackendDump.mo: function subPartitionString failed"); - then fail(); + outString := match inSubPartitionIndex + case 0 then "unknown"; + else intString(inSubPartitionIndex); end match; end subPartitionString; diff --git a/Compiler/BackEnd/BackendEquation.mo b/Compiler/BackEnd/BackendEquation.mo index 81b29e68408..6cea70b7ac5 100644 --- a/Compiler/BackEnd/BackendEquation.mo +++ b/Compiler/BackEnd/BackendEquation.mo @@ -83,8 +83,8 @@ end listEquation; protected function listEquation1 input list inEquationList; - input Integer inPos "initially call this with 1" ; - input Integer inSize "initially call this with 0" ; + input Integer inPos "initially call this with 1"; + input Integer inSize "initially call this with 0"; input array> inEquOptArr; output Integer outSize; output array> outEquOptArr; @@ -1080,7 +1080,7 @@ algorithm end mergeEquationArray; protected function findFirstUnusedEquOptEntry - input Integer inPos "initially call this with 1" ; + input Integer inPos "initially call this with 1"; input Integer inSize; input array> inEquOptArr; output Integer outIndex; @@ -1089,7 +1089,7 @@ algorithm end findFirstUnusedEquOptEntry; protected function findFirstUnusedEquOptEntryWork - input Integer inPos "initially call this with 1" ; + input Integer inPos "initially call this with 1"; input Integer inSize; input Option thisValue; input array> inEquOptArr; @@ -1118,7 +1118,7 @@ algorithm Real rsize, rexpandsize; case (e, BackendDAE.EQUATION_ARRAY(size=size, numberOfElement=numberOfElement, arrSize=arrSize, equOptArr=equOptArr)) equation - (numberOfElement < arrSize) = true "Have space to add array elt." ; + (numberOfElement < arrSize) = true "Have space to add array elt."; n_1 = numberOfElement + 1; index = findFirstUnusedEquOptEntry(1, arrSize, equOptArr); arr_1 = arrayUpdate(equOptArr, index, SOME(e)); @@ -1213,7 +1213,7 @@ public function setAtIndex "author: lochel Sets the n-th array element of an EquationArray. Please note: one-based indexing" input BackendDAE.EquationArray inEquationArray; - input Integer inPos "one-based indexing" ; + input Integer inPos "one-based indexing"; input BackendDAE.Equation inEquation; output BackendDAE.EquationArray outEquationArray; protected @@ -1228,7 +1228,7 @@ end setAtIndex; public function getEqns "author: Frenkel TUD 2011-05 returns the equations given by the list of indexes" - input list inIndices "one-based indexing" ; + input list inIndices "one-based indexing"; input BackendDAE.EquationArray inEquationArray; output list outEqns; algorithm @@ -1239,7 +1239,7 @@ public function equationNth1 "author: PA Return the n-th equation from the expandable equation array indexed from 1..N." input BackendDAE.EquationArray inEquationArray; - input Integer inPos "one-based indexing" ; + input Integer inPos "one-based indexing"; output BackendDAE.Equation outEquation; algorithm outEquation := matchcontinue (inEquationArray, inPos) @@ -1632,7 +1632,7 @@ end equationInfo; public function markedEquationSource input BackendDAE.EqSystem syst; - input Integer inPos "one-based indexing" ; + input Integer inPos "one-based indexing"; output DAE.ElementSource outSource; protected BackendDAE.EquationArray eqns; @@ -1830,18 +1830,18 @@ public function generateEQUATION "author: Frenkel TUD 2010-05" input BackendDAE.EquationKind inEqKind; output BackendDAE.Equation outEqn; algorithm - outEqn := BackendDAE.EQUATION(iLhs, iRhs, Source, BackendDAE.EQUATION_ATTRIBUTES(false, inEqKind, BackendDAE.UNKNOWN_SUB_PARTITION())); + outEqn := BackendDAE.EQUATION(iLhs, iRhs, Source, BackendDAE.EQUATION_ATTRIBUTES(false, inEqKind, 0)); end generateEQUATION; public function setSubPartition "author: lochel" input BackendDAE.Equation inEqn; - input BackendDAE.SubClockPartitionKind inSubClockPartitionKind; + input Integer inSubClockPartitionIndex; output BackendDAE.Equation outEqn; protected BackendDAE.EquationAttributes attr; algorithm attr := getEquationAttributes(inEqn); - attr := setSubClockPartitionKind(attr, inSubClockPartitionKind); + attr := setSubClockPartitionIndex(attr, inSubClockPartitionIndex); outEqn := setEquationAttributes(inEqn, attr); end setSubPartition; @@ -1868,25 +1868,17 @@ algorithm end match; end getEquationAttributes; -public function setSubClockPartitionKind +public function setSubClockPartitionIndex input BackendDAE.EquationAttributes inAttr; - input BackendDAE.SubClockPartitionKind inSubClockPartitionKind; + input Integer inSubClockPartitionIndex; output BackendDAE.EquationAttributes outAttr; protected Boolean differentiated; BackendDAE.EquationKind kind; algorithm BackendDAE.EQUATION_ATTRIBUTES(differentiated=differentiated, kind=kind) := inAttr; - outAttr := BackendDAE.EQUATION_ATTRIBUTES(differentiated, kind, inSubClockPartitionKind); -public uniontype EquationAttributes - - record EQUATION_ATTRIBUTES - Boolean differentiated "true if the equation was differentiated, and should not differentiated again to avoid equal equations"; - EquationKind kind; - SubClockPartitionKind subPartitionKind; - end EQUATION_ATTRIBUTES; -end EquationAttributes; -end setSubClockPartitionKind; + outAttr := BackendDAE.EQUATION_ATTRIBUTES(differentiated, kind, inSubClockPartitionIndex); +end setSubClockPartitionIndex; public function setEquationAttributes input BackendDAE.Equation inEqn; @@ -1950,7 +1942,7 @@ algorithm DAE.Exp rhs; case (_, SOME(rhs), _, _) - then {BackendDAE.SOLVED_EQUATION(inLhs, rhs, inSource, BackendDAE.EQUATION_ATTRIBUTES(false, inEqKind, BackendDAE.UNKNOWN_SUB_PARTITION()))}; + then {BackendDAE.SOLVED_EQUATION(inLhs, rhs, inSource, BackendDAE.EQUATION_ATTRIBUTES(false, inEqKind, 0))}; else {}; end match; @@ -2128,7 +2120,7 @@ public function aliasEquation "author Frenkel TUD 2011-04 Returns the two sides of an alias equation as expressions and cref. If the equation is not simple, this function will fail." input BackendDAE.Equation inEqn; - output list> outTpls "(cr1, cr2, cr1=e2, cr2=e1, true if negated alias)" ; + output list> outTpls "(cr1, cr2, cr1=e2, cr2=e1, true if negated alias)"; algorithm outTpls := match (inEqn) local @@ -2157,8 +2149,8 @@ protected function aliasEquation1 "author Frenkel TUD 2011-04 helper for aliasEquation" input DAE.Exp lhs; input DAE.Exp rhs; - input list> inTpls "(cr1, cr2, cr1=e2, cr2=e1, true if negated alias)" ; - output list> outTpls "(cr1, cr2, cr1=e2, cr2=e1, true if negated alias)" ; + input list> inTpls "(cr1, cr2, cr1=e2, cr2=e1, true if negated alias)"; + output list> outTpls "(cr1, cr2, cr1=e2, cr2=e1, true if negated alias)"; algorithm outTpls := match (lhs, rhs, inTpls) local @@ -2646,10 +2638,10 @@ protected function markDifferentiated2 output BackendDAE.EquationAttributes outAttr; protected BackendDAE.EquationKind kind; - BackendDAE.SubClockPartitionKind subPartitionKind; + Integer subPartitionIndex; algorithm - BackendDAE.EQUATION_ATTRIBUTES(kind=kind, subPartitionKind=subPartitionKind) := inAttr; - outAttr := BackendDAE.EQUATION_ATTRIBUTES(true, kind, subPartitionKind); + BackendDAE.EQUATION_ATTRIBUTES(kind=kind, subPartitionIndex=subPartitionIndex) := inAttr; + outAttr := BackendDAE.EQUATION_ATTRIBUTES(true, kind, subPartitionIndex); end markDifferentiated2; public function isDifferentiated diff --git a/Compiler/BackEnd/BackendQSS.mo b/Compiler/BackEnd/BackendQSS.mo index c1ba2882bf3..50163e98e0e 100644 --- a/Compiler/BackEnd/BackendQSS.mo +++ b/Compiler/BackEnd/BackendQSS.mo @@ -514,7 +514,7 @@ algorithm local Integer h; DAE.Exp exp,e1; - DAE.Exp scalar "scalar" ; + DAE.Exp scalar "scalar"; String s; Integer p; case (_,{h},_,_,_,_,true,_,_) @@ -967,7 +967,7 @@ end getEquationsWithDiscont; function getEquations input BackendDAE.EquationArray eqsdae; - input list indx "zero-based indexing" ; + input list indx "zero-based indexing"; output list outEquationLst; algorithm outEquationLst := match (eqsdae,indx) diff --git a/Compiler/BackEnd/BackendVarTransform.mo b/Compiler/BackEnd/BackendVarTransform.mo index d2f7c129962..a804e830326 100644 --- a/Compiler/BackEnd/BackendVarTransform.mo +++ b/Compiler/BackEnd/BackendVarTransform.mo @@ -239,7 +239,7 @@ algorithm // Once match is available as a complement to matchcontinue, this case could be useful again. //case ((repl as REPLACEMENTS(ht,invHt)),src,dst) /* source dest */ // equation - // olddst = BaseHashTable.get(src, ht) "if rule a->b exists, fail" ; + // olddst = BaseHashTable.get(src, ht) "if rule a->b exists, fail"; // then // fail(); @@ -288,7 +288,7 @@ algorithm Option derConst; case ((REPLACEMENTS(hashTable=ht)),src,_) /* source dest */ equation - _ = BaseHashTable.get(src,ht) "if rule a->b exists, fail" ; + _ = BaseHashTable.get(src,ht) "if rule a->b exists, fail"; then fail(); case ((REPLACEMENTS(ht,invHt,eht,iv,derConst)),src,dst) @@ -398,13 +398,13 @@ algorithm list srcs; case (_,_,_) equation - failure(_ = BaseHashTable.get(dst,invHt)) "No previous elt for dst -> src" ; + failure(_ = BaseHashTable.get(dst,invHt)) "No previous elt for dst -> src"; invHt_1 = BaseHashTable.add((dst, {src}),invHt); then invHt_1; case (_,_,_) equation - srcs = BaseHashTable.get(dst,invHt) "previous elt for dst -> src, append.." ; + srcs = BaseHashTable.get(dst,invHt) "previous elt for dst -> src, append.."; srcs = src::srcs; invHt_1 = BaseHashTable.add((dst, srcs),invHt); then diff --git a/Compiler/BackEnd/BackendVariable.mo b/Compiler/BackEnd/BackendVariable.mo index c2ad0b64e11..fb1dd21c2b2 100644 --- a/Compiler/BackEnd/BackendVariable.mo +++ b/Compiler/BackEnd/BackendVariable.mo @@ -93,7 +93,7 @@ algorithm DAE.ComponentRef cr1,cr2; case (BackendDAE.VAR(varName = cr1),BackendDAE.VAR(varName = cr2)) equation - res = ComponentReference.crefEqualNoStringCompare(cr1, cr2) "A BackendDAE.Var is identified by its component reference" ; + res = ComponentReference.crefEqualNoStringCompare(cr1, cr2) "A BackendDAE.Var is identified by its component reference"; then res; end match; @@ -2458,14 +2458,14 @@ algorithm Real rsize,rexpandsize; case (BackendDAE.VARIABLE_ARRAY(numberOfElements = n,arrSize = size,varOptArr = arr),v) equation - (n < size) = true "Have space to add array elt." ; + (n < size) = true "Have space to add array elt."; n_1 = n + 1; arr_1 = arrayUpdate(arr, n_1, SOME(v)); then BackendDAE.VARIABLE_ARRAY(n_1,size,arr_1); case (BackendDAE.VARIABLE_ARRAY(numberOfElements = n,arrSize = size,varOptArr = arr),v) equation - (n < size) = false "Do NOT have space to add array elt. Expand with factor 1.4" ; + (n < size) = false "Do NOT have space to add array elt. Expand with factor 1.4"; rsize = intReal(size); rexpandsize = rsize*. 0.4; expandsize = realInt(rexpandsize); @@ -2867,7 +2867,7 @@ algorithm true; case (cr,_,knvars) equation - ((BackendDAE.VAR(varDirection = DAE.INPUT()) :: _),_) = getVar(cr, knvars) "input variables stored in known variables are input on top level" ; + ((BackendDAE.VAR(varDirection = DAE.INPUT()) :: _),_) = getVar(cr, knvars) "input variables stored in known variables are input on top level"; then true; case (_,_,_) then false; @@ -3646,7 +3646,7 @@ algorithm DAE.ComponentRef cr1; case (_,_) equation - (v,indx) = getVar2(cr, inVariables) "if scalar found, return it" ; + (v,indx) = getVar2(cr, inVariables) "if scalar found, return it"; then ({v},{indx}); case (_,_) /* check if array or record */ diff --git a/Compiler/BackEnd/BinaryTree.mo b/Compiler/BackEnd/BinaryTree.mo index caba0d0748d..f2e28775f55 100644 --- a/Compiler/BackEnd/BinaryTree.mo +++ b/Compiler/BackEnd/BinaryTree.mo @@ -61,9 +61,9 @@ public uniontype BinTree "Generic Binary tree implementation - Binary Tree" record TREENODE - Option value "Value" ; - Option leftSubTree "left subtree" ; - Option rightSubTree "right subtree" ; + Option value "Value"; + Option leftSubTree "left subtree"; + Option rightSubTree "right subtree"; end TREENODE; end BinTree; @@ -72,10 +72,10 @@ public uniontype TreeValue "Each node in the binary tree can have a value associated with it. - Tree Value" record TREEVALUE - Key key "Key" ; + Key key "Key"; String str; Integer hash; - Value value "Value" ; + Value value "Value"; end TREEVALUE; end TreeValue; @@ -84,9 +84,9 @@ public type Key = .DAE.ComponentRef "A key is a Component Reference"; public -type Value = Integer "- Value" ; +type Value = Integer "- Value"; -public constant BinTree emptyBinTree=TREENODE(NONE(),NONE(),NONE()) " Empty binary tree " ; +public constant BinTree emptyBinTree=TREENODE(NONE(),NONE(),NONE()) " Empty binary tree "; /************************** implementation diff --git a/Compiler/BackEnd/BinaryTreeInt.mo b/Compiler/BackEnd/BinaryTreeInt.mo index 3ecdbd1d463..d7d53fd02e9 100644 --- a/Compiler/BackEnd/BinaryTreeInt.mo +++ b/Compiler/BackEnd/BinaryTreeInt.mo @@ -54,9 +54,9 @@ public uniontype BinTree "Generic Binary tree implementation - Binary Tree" record TREENODE - Option value "Value" ; - Option leftSubTree "left subtree" ; - Option rightSubTree "right subtree" ; + Option value "Value"; + Option leftSubTree "left subtree"; + Option rightSubTree "right subtree"; end TREENODE; end BinTree; @@ -65,8 +65,8 @@ public uniontype TreeValue "Each node in the binary tree can have a value associated with it. - Tree Value" record TREEVALUE - Key key "Key" ; - Value value "Value" ; + Key key "Key"; + Value value "Value"; end TREEVALUE; end TreeValue; @@ -75,9 +75,9 @@ public type Key = Integer "A key is a Integer"; public -type Value = Integer "- Value" ; +type Value = Integer "- Value"; -public constant BinTree emptyBinTree=TREENODE(NONE(),NONE(),NONE()) " Empty binary tree " ; +public constant BinTree emptyBinTree=TREENODE(NONE(),NONE(),NONE()) " Empty binary tree "; /************************** implementation diff --git a/Compiler/BackEnd/DAEQuery.mo b/Compiler/BackEnd/DAEQuery.mo index fd7e3f8c3c7..e9ad6761ba3 100644 --- a/Compiler/BackEnd/DAEQuery.mo +++ b/Compiler/BackEnd/DAEQuery.mo @@ -647,7 +647,7 @@ algorithm ((BackendDAE.VAR(varKind = BackendDAE.STATE(index=_)) :: _),p) = BackendVariable.getVar(cr, vars) "If variable x is a state, der(x) is a variable in incidence matrix, x is inserted as negative value, since it is needed by debugging and index - reduction using dummy derivatives" ; + reduction using dummy derivatives"; p_1 = List.map1r(p, intSub, 0); pStr = List.map(p_1, intString); then diff --git a/Compiler/BackEnd/Differentiate.mo b/Compiler/BackEnd/Differentiate.mo index 3aa8fe43da8..8b7d757eb9c 100644 --- a/Compiler/BackEnd/Differentiate.mo +++ b/Compiler/BackEnd/Differentiate.mo @@ -425,7 +425,7 @@ algorithm op2 = DAE.OP_DIFFERENTIATE(inDiffwrtCref, e2, e2_1); source = List.foldr({op1, op2}, DAEUtil.addSymbolicTransformation, source); then - (BackendDAE.EQUATION(e1_1, e2_1, source, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, BackendDAE.UNKNOWN_SUB_PARTITION())), funcs); + (BackendDAE.EQUATION(e1_1, e2_1, source, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, 0)), funcs); // solved equations case (BackendDAE.SOLVED_EQUATION(componentRef=cref, exp=e2, source=source, attr=BackendDAE.EQUATION_ATTRIBUTES(kind=eqKind)), _, _, _, _) @@ -442,7 +442,7 @@ algorithm op2 = DAE.OP_DIFFERENTIATE(inDiffwrtCref, e2, e2_1); source = List.foldr({op1, op2}, DAEUtil.addSymbolicTransformation, source); then - (BackendDAE.EQUATION(e1_1, e2_1, source, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, BackendDAE.UNKNOWN_SUB_PARTITION())), funcs); + (BackendDAE.EQUATION(e1_1, e2_1, source, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, 0)), funcs); // RESIDUAL_EQUATION case (BackendDAE.RESIDUAL_EQUATION(exp=e1, source=source, attr=BackendDAE.EQUATION_ATTRIBUTES(kind=eqKind)), _, _, _, _) @@ -455,7 +455,7 @@ algorithm source = List.foldr({op1}, DAEUtil.addSymbolicTransformation, source); then - (BackendDAE.RESIDUAL_EQUATION(e1_1, source, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, BackendDAE.UNKNOWN_SUB_PARTITION())), funcs); + (BackendDAE.RESIDUAL_EQUATION(e1_1, source, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, 0)), funcs); // complex equations case (BackendDAE.COMPLEX_EQUATION(size=size, left=e1, right=e2, source=source, attr=BackendDAE.EQUATION_ATTRIBUTES(kind=eqKind)), _, _, _, _) @@ -470,7 +470,7 @@ algorithm op2 = DAE.OP_DIFFERENTIATE(inDiffwrtCref, e2, e2_1); source = List.foldr({op1, op2}, DAEUtil.addSymbolicTransformation, source); then - (BackendDAE.COMPLEX_EQUATION(size, e1_1, e2_1, source, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, BackendDAE.UNKNOWN_SUB_PARTITION())), funcs); + (BackendDAE.COMPLEX_EQUATION(size, e1_1, e2_1, source, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, 0)), funcs); // Array Equations case (BackendDAE.ARRAY_EQUATION(dimSize=dimSize, left=e1, right=e2, source=source, attr=BackendDAE.EQUATION_ATTRIBUTES(kind=eqKind)), _, _, _, _) @@ -485,7 +485,7 @@ algorithm op2 = DAE.OP_DIFFERENTIATE(inDiffwrtCref, e2, e2_1); source = List.foldr({op1, op2}, DAEUtil.addSymbolicTransformation, source); then - (BackendDAE.ARRAY_EQUATION(dimSize, e1_1, e2_1, source, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, BackendDAE.UNKNOWN_SUB_PARTITION())), funcs); + (BackendDAE.ARRAY_EQUATION(dimSize, e1_1, e2_1, source, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, 0)), funcs); // differentiate algorithm case (BackendDAE.ALGORITHM(size=size, alg=DAE.ALGORITHM_STMTS(statementLst=statementLst), source=source, expand=expand, attr=BackendDAE.EQUATION_ATTRIBUTES(kind=eqKind)), _, _, _, _) @@ -498,7 +498,7 @@ algorithm //op1 = DAE.OP_DIFFERENTIATE(inDiffwrtCref, e1, e2); //source = DAEUtil.addSymbolicTransformation(source, op1); then - (BackendDAE.ALGORITHM(size, alg, source, expand, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, BackendDAE.UNKNOWN_SUB_PARTITION())), funcs); + (BackendDAE.ALGORITHM(size, alg, source, expand, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, 0)), funcs); // if-equations case (BackendDAE.IF_EQUATION(conditions=expExpLst, eqnstrue=eqnslst, eqnsfalse=eqns, source=source, attr=BackendDAE.EQUATION_ATTRIBUTES(kind=eqKind)), _, _, _, _) @@ -506,13 +506,13 @@ algorithm (eqnslst, funcs) = differentiateEquationsLst(eqnslst, inDiffwrtCref, inInputData, inDiffType, {}, inFunctionTree); (eqns, funcs) = differentiateEquations(eqns, inDiffwrtCref, inInputData, inDiffType, {}, funcs); then - (BackendDAE.IF_EQUATION(expExpLst, eqnslst, eqns, source, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, BackendDAE.UNKNOWN_SUB_PARTITION())), funcs); + (BackendDAE.IF_EQUATION(expExpLst, eqnslst, eqns, source, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, 0)), funcs); case (BackendDAE.WHEN_EQUATION(size=size, whenEquation=whenEqn, source=source, attr=BackendDAE.EQUATION_ATTRIBUTES(kind=eqKind)), _, _, _, _) equation (whenEqn, funcs) = differentiateWhenEquations(whenEqn, inDiffwrtCref, inInputData, inDiffType, inFunctionTree); then - (BackendDAE.WHEN_EQUATION(size, whenEqn, source, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, BackendDAE.UNKNOWN_SUB_PARTITION())), funcs); + (BackendDAE.WHEN_EQUATION(size, whenEqn, source, BackendDAE.EQUATION_ATTRIBUTES(false, eqKind, 0)), funcs); else equation diff --git a/Compiler/BackEnd/IndexReduction.mo b/Compiler/BackEnd/IndexReduction.mo index e4f5cbef3fa..25ce551191d 100644 --- a/Compiler/BackEnd/IndexReduction.mo +++ b/Compiler/BackEnd/IndexReduction.mo @@ -4894,7 +4894,7 @@ algorithm */ case ((DAE.CALL(path = Absyn.IDENT(name = "der"),expLst = {DAE.CALL(path = Absyn.IDENT(name = "der"),expLst = {DAE.CREF(componentRef = cr)})}),(vars,eqns,so,ilst,eindx,mapIncRowEqn,mt))) equation - ((BackendDAE.VAR(cr,BackendDAE.STATE(_,dcr),a,prl,b,_,_,lstDims,source,_,comment,ct) :: {}),i::_) = BackendVariable.getVar(cr, vars) "der(der(s)) s is state => der_der_s" ; + ((BackendDAE.VAR(cr,BackendDAE.STATE(_,dcr),a,prl,b,_,_,lstDims,source,_,comment,ct) :: {}),i::_) = BackendVariable.getVar(cr, vars) "der(der(s)) s is state => der_der_s"; // do not use the normal derivative prefix for the name //dummyder = ComponentReference.crefPrefixDer(cr); dummyder = ComponentReference.makeCrefQual("$_DER",DAE.T_REAL_DEFAULT,{},cr); @@ -4906,13 +4906,13 @@ algorithm case ((e as DAE.CALL(path = Absyn.IDENT(name = "der"),expLst = {DAE.CREF(componentRef = cr)}),(vars,eqns,so,changedVars,eindx,mapIncRowEqn,mt))) equation - (varlst as _::_,ilst) = BackendVariable.getVar(cr, vars) "der(v) v is alg var => der_v" ; + (varlst as _::_,ilst) = BackendVariable.getVar(cr, vars) "der(v) v is alg var => der_v"; (vars_1,changedVars) = changeDerVariablestoStates1(varlst,ilst,vars,changedVars); then ((e, (vars_1,eqns,so,changedVars,eindx,mapIncRowEqn,mt))); case ((e as DAE.CALL(path = Absyn.IDENT(name = "der"),expLst = {DAE.CREF(componentRef = cr)}),(vars,eqns,so,ilst,eindx,mapIncRowEqn,mt))) equation - (_::_,_::_) = BackendVariable.getVar(cr, vars) "der(v) v is alg var => der_v" ; + (_::_,_::_) = BackendVariable.getVar(cr, vars) "der(v) v is alg var => der_v"; print("wrong Variable in der: \n"); BackendDump.debugExpStr((e,"\n")); then diff --git a/Compiler/BackEnd/Initialization.mo b/Compiler/BackEnd/Initialization.mo index 3feeb1fd34c..913d1413811 100644 --- a/Compiler/BackEnd/Initialization.mo +++ b/Compiler/BackEnd/Initialization.mo @@ -1190,7 +1190,7 @@ protected function fixInitialSystem "author: lochel input BackendDAE.EquationArray inEqns; input BackendDAE.Variables inInitVars; input BackendDAE.Shared inShared; - input Integer inIndex "index of the system (0 is regular)" ; + input Integer inIndex "index of the system (0 is regular)"; output BackendDAE.EquationArray outEqns; output list outDumpVars; output list outRemovedEqns; @@ -1199,8 +1199,8 @@ protected list stateIndices, range, unassigned, initEqsIndices, redundantEqns; list initVarList; array vec1, vec2; - BackendDAE.IncidenceMatrix m "incidence matrix of modified system" ; - BackendDAE.IncidenceMatrix m_ "incidence matrix of original system (TODO: fix this one)" ; + BackendDAE.IncidenceMatrix m "incidence matrix of modified system"; + BackendDAE.IncidenceMatrix m_ "incidence matrix of original system (TODO: fix this one)"; BackendDAE.EqSystem syst; DAE.FunctionTree funcs; BackendDAE.AdjacencyMatrixEnhanced me; @@ -1232,7 +1232,7 @@ algorithm nAddEqs := intMax(nVars-nEqns + inIndex, inIndex); //print("nAddEqs: " +& intString(nAddEqs) +& "\n"); m_ := fixUnderDeterminedSystem(m_, stateIndices, nEqns, nAddEqs); - SOME(m) := BackendDAEUtil.copyIncidenceMatrix(SOME(m_)) "deep copy" ; + SOME(m) := BackendDAEUtil.copyIncidenceMatrix(SOME(m_)) "deep copy"; // modify incidence matrix for over-determined systems nAddVars := intMax(nEqns-nVars + inIndex, inIndex); @@ -1301,7 +1301,7 @@ algorithm //then fail(); case (_, _, _, _) equation - true = (inNAddEqns > 0) "just to be careful" ; + true = (inNAddEqns > 0) "just to be careful"; m = arrayCreate(inNEqns+inNAddEqns, {}); m = Util.arrayCopy(inM, m); newEqIndices = List.intRange2(inNEqns+1, inNEqns+inNAddEqns); @@ -1339,7 +1339,7 @@ algorithm //then fail(); case (_, _, _, _) equation - true = (inNAddVars > 0) "just to be careful" ; + true = (inNAddVars > 0) "just to be careful"; newVarIndices = List.intRange2(inNVars+1, inNVars+inNAddVars); m = List.fold1(inInitEqnIndices, squareIncidenceMatrix2, newVarIndices, inM); then m; @@ -1360,7 +1360,7 @@ protected function addStartValueEquations "author: lochel" input BackendDAE.EquationArray inEqns; input list inDumpVars; output BackendDAE.EquationArray outEqns; - output list outDumpVars "this are the variables that get fixed (not the same as inVarLst!)" ; + output list outDumpVars "this are the variables that get fixed (not the same as inVarLst!)"; algorithm (outEqns, outDumpVars) := matchcontinue(inVarLst, inEqns, inDumpVars) local @@ -1432,8 +1432,8 @@ protected function consistencyCheck " - The first list contains all consistent initial conditions. - The second list contains all inconsistent initial conditions. - The third list contains all initial conditions that couldn't be checked." - input list inRedundantEqns "these are the indices of the redundant equations" ; - input BackendDAE.EquationArray inEqns "this are all equations of the given system" ; + input list inRedundantEqns "these are the indices of the redundant equations"; + input BackendDAE.EquationArray inEqns "this are all equations of the given system"; input BackendDAE.Variables inVars; input BackendDAE.Shared inShared; input Integer nAddVars; @@ -1442,9 +1442,9 @@ protected function consistencyCheck " input array vecVarToEqs; input array vecEqsToVar; input array mapIncRowEqn; - output list outConsistentEquations "These equations are consistent and can be removed from the initialization problem without any issue." ; - output list outInconsistentEquations "If this list is not empty then the initialization problem is inconsistent and has no solution." ; - output list outUncheckedEquations "These equations need to be checked numerically." ; + output list outConsistentEquations "These equations are consistent and can be removed from the initialization problem without any issue."; + output list outInconsistentEquations "If this list is not empty then the initialization problem is inconsistent and has no solution."; + output list outUncheckedEquations "These equations need to be checked numerically."; algorithm (outConsistentEquations, outInconsistentEquations, outUncheckedEquations) := matchcontinue(inRedundantEqns, inEqns, inVars, inShared, nAddVars, inM, me, vecVarToEqs, vecEqsToVar, mapIncRowEqn) local @@ -1549,9 +1549,9 @@ algorithm end isVarExplicitSolvable; protected function splitStrongComponents "author: mwenzler" - input list> inComps "list of strong components" ; - output list outListComps "all components of size 1" ; - output list outLoopListComps "all components of size > 1" ; + input list> inComps "list of strong components"; + output list outListComps "all components of size 1"; + output list outLoopListComps "all components of size > 1"; algorithm (outListComps, outLoopListComps) := match(inComps) local @@ -1596,8 +1596,8 @@ protected function compsMarker "author: mwenzler" input array inVecVarToEq; input BackendDAE.IncidenceMatrix inM; input list inFlatComps; - input list inLoopListComps "not used yet" ; - output list outMarkedEqns "contains all the indices of the equations that need to be considered" ; + input list inLoopListComps "not used yet"; + output list outMarkedEqns "contains all the indices of the equations that need to be considered"; protected list varList; list markedEqns; @@ -1691,8 +1691,8 @@ protected function setupVarReplacements input list inMarkedEqns; input BackendDAE.EquationArray inEqns; input BackendDAE.Variables inVars; - input array inVecEqToVar "matching" ; - input BackendVarTransform.VariableReplacements inRepls "initially call this with empty replacements" ; + input array inVecEqToVar "matching"; + input BackendVarTransform.VariableReplacements inRepls "initially call this with empty replacements"; input array inMapIncRowEqn; input BackendDAE.AdjacencyMatrixEnhanced inME; output BackendVarTransform.VariableReplacements outRepls; @@ -1749,7 +1749,7 @@ protected function applyVarReplacements "author: lochel protected BackendDAE.Equation eqn; algorithm - outEqnList := BackendEquation.copyEquationArray(inEqnList) "avoid side-effects" ; + outEqnList := BackendEquation.copyEquationArray(inEqnList) "avoid side-effects"; eqn := BackendEquation.equationNth1(outEqnList, inEqnIndex); ({eqn}, _) := BackendVarTransform.replaceEquations({eqn}, inVarRepls, NONE()); outEqnList := BackendEquation.setAtIndex(outEqnList, inEqnIndex, eqn); diff --git a/Compiler/BackEnd/InlineArrayEquations.mo b/Compiler/BackEnd/InlineArrayEquations.mo index fa2bb004caa..00fc6978580 100644 --- a/Compiler/BackEnd/InlineArrayEquations.mo +++ b/Compiler/BackEnd/InlineArrayEquations.mo @@ -224,7 +224,7 @@ algorithm true = DAEUtil.expTypeComplex(tp); size = Expression.sizeOf(tp); source = DAEUtil.addSymbolicTransformation(inSource, DAE.OP_SCALARIZE(eqExp, i, DAE.EQUALITY_EXPS(inExp1, inExp2))); - then ((i+1, BackendDAE.COMPLEX_EQUATION(size, inExp1, inExp2, source, BackendDAE.EQUATION_ATTRIBUTES(inDiffed, inEqKind, BackendDAE.UNKNOWN_SUB_PARTITION()))::eqns)); + then ((i+1, BackendDAE.COMPLEX_EQUATION(size, inExp1, inExp2, source, BackendDAE.EQUATION_ATTRIBUTES(inDiffed, inEqKind, 0))::eqns)); // array types to array equations case (_, _, _, _, _, _, (i, eqns)) equation @@ -233,7 +233,7 @@ algorithm dims = Expression.arrayDimension(tp); ds = Expression.dimensionsSizes(dims); source = DAEUtil.addSymbolicTransformation(inSource, DAE.OP_SCALARIZE(eqExp, i, DAE.EQUALITY_EXPS(inExp1, inExp2))); - then ((i+1, BackendDAE.ARRAY_EQUATION(ds, inExp1, inExp2, source, BackendDAE.EQUATION_ATTRIBUTES(inDiffed, inEqKind, BackendDAE.UNKNOWN_SUB_PARTITION()))::eqns)); + then ((i+1, BackendDAE.ARRAY_EQUATION(ds, inExp1, inExp2, source, BackendDAE.EQUATION_ATTRIBUTES(inDiffed, inEqKind, 0))::eqns)); // other types case (_, _, _, _, _, _, (i, eqns)) equation @@ -242,7 +242,7 @@ algorithm b2 = DAEUtil.expTypeArray(tp); false = b1 or b2; source = DAEUtil.addSymbolicTransformation(inSource, DAE.OP_SCALARIZE(eqExp, i, DAE.EQUALITY_EXPS(inExp1, inExp2))); - then ((i+1, BackendDAE.EQUATION(inExp1, inExp2, source, BackendDAE.EQUATION_ATTRIBUTES(inDiffed, inEqKind, BackendDAE.UNKNOWN_SUB_PARTITION()))::eqns)); + then ((i+1, BackendDAE.EQUATION(inExp1, inExp2, source, BackendDAE.EQUATION_ATTRIBUTES(inDiffed, inEqKind, 0))::eqns)); else equation // show only on failtrace! diff --git a/Compiler/BackEnd/Matching.mo b/Compiler/BackEnd/Matching.mo index f0faf363b44..ad07ddff415 100644 --- a/Compiler/BackEnd/Matching.mo +++ b/Compiler/BackEnd/Matching.mo @@ -181,7 +181,7 @@ algorithm case (syst as BackendDAE.EQSYSTEM(m=SOME(m),mT=SOME(mt)),_,_,_,_,_,_,_,_,_,_,_) equation i_1 = i + 1; - (ass1_1,ass2_1) = pathFound(m, mt, i, i,emark, vmark, ass1, ass2) "eMark(i)=vMark(i)=false" ; + (ass1_1,ass2_1) = pathFound(m, mt, i, i,emark, vmark, ass1, ass2) "eMark(i)=vMark(i)=false"; (ass1_2,ass2_2,syst,shared,arg) = DFSLH2(syst, ishared, nv, nf, i_1, emark, vmark, ass1_1, ass2_1, match_opts, sssHandler, inArg); then (ass1_2,ass2_2,syst,shared,arg); @@ -199,7 +199,7 @@ algorithm then becomes: der_u1 = der(u2). In the dummy derivative method this equation is added and the original equation u1=u2 is kept. This is not the case for the original pantilides algorithm, where - the original equation is removed from the system." ; + the original equation is removed from the system."; eqns = BackendEquation.getEqnsFromEqSystem(syst); nf_1 = BackendDAEUtil.equationSize(eqns) "and try again, restarting. This could be optimized later. It should not be necessary to restart the matching, according to Bernard Bachmann. Instead one @@ -209,7 +209,7 @@ algorithm not restarting. 2004-12-29 PA. This was a bug, assignment lists needed to be expanded with the size of the system in order to work. SO: Matching is not needed to be restarted from - scratch." ; + scratch."; nv_1 = BackendVariable.varsSize(BackendVariable.daeVars(syst)); ass1_2 = assignmentsArrayExpand(ass1_1, nv_1,arrayLength(ass1_1),-1); ass2_2 = assignmentsArrayExpand(ass2_1, nf_1,arrayLength(ass2_1),-1); @@ -6138,7 +6138,7 @@ end randSortSystem; protected function randSortSystem1 input Integer index; - input Integer offset "obsolete" ; + input Integer offset "obsolete"; input array randarr; input Type_a oldTypeA; input Type_a newTypeA; diff --git a/Compiler/BackEnd/RemoveSimpleEquations.mo b/Compiler/BackEnd/RemoveSimpleEquations.mo index 9acf99b9239..316199c825b 100644 --- a/Compiler/BackEnd/RemoveSimpleEquations.mo +++ b/Compiler/BackEnd/RemoveSimpleEquations.mo @@ -130,7 +130,7 @@ protected type VarSetAttributes = list>, tuple, Option> - > "fixed, list, nominal, (min, max)" ; + > "fixed, list, nominal, (min, max)"; protected constant VarSetAttributes EMPTYVARSETATTRIBUTES = (false, (-1, {}), {}, (NONE(), NONE())); @@ -1383,7 +1383,7 @@ algorithm then (inExp, false, (true, vars, knvars, b1, b2, ilst)); case (DAE.CREF(cr, _), (_, vars, knvars, b1, b2, ilst)) equation - (varlst, _::_)= BackendVariable.getVar(cr, knvars) "input variables stored in known variables are input on top level" ; + (varlst, _::_)= BackendVariable.getVar(cr, knvars) "input variables stored in known variables are input on top level"; false = List.mapAllValueBool(varlst, toplevelInputOrUnfixed, false); then (inExp, false, (true, vars, knvars, b1, b2, ilst)); @@ -1394,7 +1394,7 @@ algorithm // case for finding simple equation in jacobians // there are all known variables mark as input and they are all time-depending case (DAE.CREF(cr, _), (_, vars, knvars, true, b2, ilst)) equation - (var::_, _::_)= BackendVariable.getVar(cr, knvars) "input variables stored in known variables are input on top level" ; + (var::_, _::_)= BackendVariable.getVar(cr, knvars) "input variables stored in known variables are input on top level"; DAE.INPUT() = BackendVariable.getVarDirection(var); then (inExp, false, (true, vars, knvars, true, b2, ilst)); diff --git a/Compiler/BackEnd/SimCode.mo b/Compiler/BackEnd/SimCode.mo index b70a99c0c8e..a255b9f4f7c 100644 --- a/Compiler/BackEnd/SimCode.mo +++ b/Compiler/BackEnd/SimCode.mo @@ -621,18 +621,18 @@ type Value = SimVar; public uniontype HashTableCrefToSimVar record HASHTABLE - array>> hashTable " hashtable to translate Key to array indx" ; - ValueArray valueArr "Array of values" ; - Integer bucketSize "bucket size" ; - Integer numberOfEntries "number of entries in hashtable" ; + array>> hashTable " hashtable to translate Key to array indx"; + ValueArray valueArr "Array of values"; + Integer bucketSize "bucket size"; + Integer numberOfEntries "number of entries in hashtable"; end HASHTABLE; end HashTableCrefToSimVar; uniontype ValueArray "array of values are expandable, to amortize the cost of adding elements in a more efficient manner" record VALUE_ARRAY - Integer numberOfElements "number of elements in hashtable" ; - Integer arrSize "size of crefArray" ; + Integer numberOfElements "number of elements in hashtable"; + Integer arrSize "size of crefArray"; array>> valueArray "array of values"; end VALUE_ARRAY; end ValueArray; diff --git a/Compiler/BackEnd/SimCodeUtil.mo b/Compiler/BackEnd/SimCodeUtil.mo index cd05c88a59a..6cb8ad8952e 100644 --- a/Compiler/BackEnd/SimCodeUtil.mo +++ b/Compiler/BackEnd/SimCodeUtil.mo @@ -10531,7 +10531,7 @@ algorithm Real rsize, rexpandsize; case (SimCode.VALUE_ARRAY(numberOfElements = n, arrSize = size, valueArray = arr), _) equation - (n < size) = true "Have space to add array elt." ; + (n < size) = true "Have space to add array elt."; n_1 = n + 1; arr_1 = arrayUpdate(arr, n + 1, SOME(entry)); then @@ -10539,7 +10539,7 @@ algorithm case (SimCode.VALUE_ARRAY(numberOfElements = n, arrSize = size, valueArray = arr), _) equation - (n < size) = false "Do NOT have splace to add array elt. Expand with factor 1.4" ; + (n < size) = false "Do NOT have splace to add array elt. Expand with factor 1.4"; rsize = intReal(size); rexpandsize = rsize *. 0.4; expandsize = realInt(rexpandsize); diff --git a/Compiler/BackEnd/SynchronousFeatures.mo b/Compiler/BackEnd/SynchronousFeatures.mo index ea6e3fe92d3..54c6934e7e9 100644 --- a/Compiler/BackEnd/SynchronousFeatures.mo +++ b/Compiler/BackEnd/SynchronousFeatures.mo @@ -451,7 +451,7 @@ algorithm then {}; case (eq::eqs, index::indices) equation - eq = BackendEquation.setSubPartition(eq, BackendDAE.SUB_PARTITION(index)); + eq = BackendEquation.setSubPartition(eq, index); eqs = setSubClockPartition(eqs, indices); then eq::eqs; end match; @@ -609,7 +609,7 @@ protected function getPartitionKind algorithm outPartitionKind := match(inContinuousTimeVars, inClockedVars) case ({}, {}) then BackendDAE.UNSPECIFIED_PARTITION(); - case ({}, _) then BackendDAE.CLOCKED_PARTITION(); + case ({}, _) then BackendDAE.CLOCKED_PARTITION(DAE.INFERRED_CLOCK()); case (_, {}) then BackendDAE.CONTINUOUS_TIME_PARTITION(); case (_, _) then BackendDAE.UNKNOWN_PARTITION(); end match; diff --git a/Compiler/BackEnd/Uncertainties.mo b/Compiler/BackEnd/Uncertainties.mo index f6f1ce4e6ee..62fef657edb 100644 --- a/Compiler/BackEnd/Uncertainties.mo +++ b/Compiler/BackEnd/Uncertainties.mo @@ -428,7 +428,7 @@ out:=matchcontinue(equations,allEqs,variables,knownVariables,mapIncRowEqn) equation true = intEq(eqn,0); r = getEquationStringOrNothing(eqn_t,allEqs,variables,knownVariables,mapIncRowEqn); - s = "\"-\"" ; + s = "\"-\""; then s::r; case(eqn::eqn_t,_,_,_,_) equation @@ -1965,7 +1965,7 @@ algorithm // Next equation. case ((e :: eqns),_,_,_,_,_,_,_,_,false) equation - (eqns_1,seqns_1,mvars_1,repl_1) = eliminateVariablesDAE2(eqns, eqnIndex + 1, vars, knvars, mvars, repl, inDoubles, m, elimVarIndexList, false) "Not a simple variable, check rest" ; + (eqns_1,seqns_1,mvars_1,repl_1) = eliminateVariablesDAE2(eqns, eqnIndex + 1, vars, knvars, mvars, repl, inDoubles, m, elimVarIndexList, false) "Not a simple variable, check rest"; then ((e :: eqns_1),seqns_1,mvars_1,repl_1); end matchcontinue; @@ -2025,23 +2025,23 @@ algorithm list systList; BackendDAE.Shared shared; - BackendDAE.Variables orderedVars "ordered Variables, only states and alg. vars" ; - BackendDAE.EquationArray orderedEqs "ordered Equations" ; + BackendDAE.Variables orderedVars "ordered Variables, only states and alg. vars"; + BackendDAE.EquationArray orderedEqs "ordered Equations"; Option m; Option mT; BackendDAE.Matching matching; - BackendDAE.Variables knownVars "Known variables, i.e. constants and parameters" ; + BackendDAE.Variables knownVars "Known variables, i.e. constants and parameters"; BackendDAE.Variables externalObjects "External object variables"; BackendDAE.Variables aliasVars "mappings of alias-variables to real-variables"; // added asodja 2010-03-03 - BackendDAE.EquationArray initialEqs "Initial equations" ; - BackendDAE.EquationArray removedEqs "these are equations that cannot solve for a variable. for example assertions, external function calls, algorithm sections without effect" ; + BackendDAE.EquationArray initialEqs "Initial equations"; + BackendDAE.EquationArray removedEqs "these are equations that cannot solve for a variable. for example assertions, external function calls, algorithm sections without effect"; list constrs; list clsAttrs; Env.Cache cache; Env.Env env; DAE.FunctionTree funcs; - BackendDAE.EventInfo eventInfo "eventInfo" ; + BackendDAE.EventInfo eventInfo "eventInfo"; BackendDAE.ExternalObjectClasses extObjClasses "classes of external objects, contains constructor & destructor"; BackendDAE.BackendDAEType backendDAEType "indicate for what the BackendDAE is used"; BackendDAE.SymbolicJacobians symjacs; @@ -2089,23 +2089,23 @@ algorithm list systList; BackendDAE.Shared shared; - BackendDAE.Variables orderedVars "ordered Variables, only states and alg. vars" ; - BackendDAE.EquationArray orderedEqs "ordered Equations" ; + BackendDAE.Variables orderedVars "ordered Variables, only states and alg. vars"; + BackendDAE.EquationArray orderedEqs "ordered Equations"; Option m; Option mT; BackendDAE.Matching matching; - BackendDAE.Variables knownVars "Known variables, i.e. constants and parameters" ; + BackendDAE.Variables knownVars "Known variables, i.e. constants and parameters"; BackendDAE.Variables externalObjects "External object variables"; BackendDAE.Variables aliasVars "mappings of alias-variables to real-variables"; // added asodja 2010-03-03 - BackendDAE.EquationArray initialEqs "Initial equations" ; - BackendDAE.EquationArray removedEqs "these are equations that cannot solve for a variable. for example assertions, external function calls, algorithm sections without effect" ; + BackendDAE.EquationArray initialEqs "Initial equations"; + BackendDAE.EquationArray removedEqs "these are equations that cannot solve for a variable. for example assertions, external function calls, algorithm sections without effect"; list constrs; list clsAttrs; Env.Cache cache; Env.Env env; DAE.FunctionTree funcs; - BackendDAE.EventInfo eventInfo "eventInfo" ; + BackendDAE.EventInfo eventInfo "eventInfo"; BackendDAE.ExternalObjectClasses extObjClasses "classes of external objects, contains constructor & destructor"; BackendDAE.BackendDAEType backendDAEType "indicate for what the BackendDAE is used"; BackendDAE.SymbolicJacobians symjacs; @@ -2312,13 +2312,13 @@ algorithm case ({},knvars,_) then ({},knvars); case (((v as BackendDAE.VAR(varName = cr)) :: vs),knvars,mvars) equation - _ = BaseHashTable.get(cr,mvars) "alg var moved to known vars" ; + _ = BaseHashTable.get(cr,mvars) "alg var moved to known vars"; (vs_1,knvars_1) = moveVariables2(vs, knvars, mvars); then (vs_1,(v :: knvars_1)); case (((v as BackendDAE.VAR(varName = cr)) :: vs),knvars,mvars) equation - failure(_ = BaseHashTable.get(cr,mvars)) "alg var not moved to known vars" ; + failure(_ = BaseHashTable.get(cr,mvars)) "alg var not moved to known vars"; (vs_1,knvars_1) = moveVariables2(vs, knvars, mvars); then ((v :: vs_1),knvars_1); @@ -2338,17 +2338,17 @@ algorithm BackendDAE.Shared shared; - BackendDAE.Variables knownVars "Known variables, i.e. constants and parameters" ; + BackendDAE.Variables knownVars "Known variables, i.e. constants and parameters"; BackendDAE.Variables externalObjects "External object variables"; BackendDAE.Variables aliasVars "mappings of alias-variables to real-variables"; // added asodja 2010-03-03 - BackendDAE.EquationArray initialEqs "Initial equations" ; - BackendDAE.EquationArray removedEqs "these are equations that cannot solve for a variable. for example assertions, external function calls, algorithm sections without effect" ; + BackendDAE.EquationArray initialEqs "Initial equations"; + BackendDAE.EquationArray removedEqs "these are equations that cannot solve for a variable. for example assertions, external function calls, algorithm sections without effect"; list constrs; list clsAttrs; Env.Cache cache; Env.Env env; DAE.FunctionTree funcs; - BackendDAE.EventInfo eventInfo "eventInfo" ; + BackendDAE.EventInfo eventInfo "eventInfo"; BackendDAE.ExternalObjectClasses extObjClasses "classes of external objects, contains constructor & destructor"; BackendDAE.BackendDAEType backendDAEType "indicate for what the BackendDAE is used"; BackendDAE.SymbolicJacobians symjacs; diff --git a/Compiler/FrontEnd/DAE.mo b/Compiler/FrontEnd/DAE.mo index 4108fda9158..8718ce03f20 100644 --- a/Compiler/FrontEnd/DAE.mo +++ b/Compiler/FrontEnd/DAE.mo @@ -1185,26 +1185,27 @@ end Mod; // BTH public uniontype ClockKind - record INFERREDCLOCK end INFERREDCLOCK; + record INFERRED_CLOCK + end INFERRED_CLOCK; - record INTEGERCLOCK + record INTEGER_CLOCK Exp intervalCounter; Integer resolution; - end INTEGERCLOCK; + end INTEGER_CLOCK; - record REALCLOCK + record REAL_CLOCK Exp interval; - end REALCLOCK; + end REAL_CLOCK; - record BOOLEANCLOCK + record BOOLEAN_CLOCK Exp condition; Real startInterval; - end BOOLEANCLOCK; + end BOOLEAN_CLOCK; - record SOLVERCLOCK + record SOLVER_CLOCK ClockKind c; String solverMethod; - end SOLVERCLOCK; + end SOLVER_CLOCK; end ClockKind; /* -- End Types.mo -- */ diff --git a/Compiler/FrontEnd/ExpressionDump.mo b/Compiler/FrontEnd/ExpressionDump.mo index b7b7512eb33..e9f347c6f4e 100644 --- a/Compiler/FrontEnd/ExpressionDump.mo +++ b/Compiler/FrontEnd/ExpressionDump.mo @@ -1786,19 +1786,19 @@ algorithm String solverMethod; DAE.ClockKind c; - case DAE.INFERREDCLOCK() + case DAE.INFERRED_CLOCK() then "Clock()"; - case DAE.INTEGERCLOCK(intervalCounter=intervalCounter, resolution=resolution) + case DAE.INTEGER_CLOCK(intervalCounter=intervalCounter, resolution=resolution) then "Clock(" +& dumpExpStr(intervalCounter,0) +& ", " +& intString(resolution) +& ")"; - case DAE.REALCLOCK(interval=interval) + case DAE.REAL_CLOCK(interval=interval) then "Clock(" +& dumpExpStr(interval,0) +& ")"; - case DAE.BOOLEANCLOCK(condition=condition, startInterval=startInterval) + case DAE.BOOLEAN_CLOCK(condition=condition, startInterval=startInterval) then "Clock(" +& dumpExpStr(condition,0) +& ", " +& realString(startInterval) +& ")"; - case DAE.SOLVERCLOCK(c=c, solverMethod=solverMethod) + case DAE.SOLVER_CLOCK(c=c, solverMethod=solverMethod) then "Clock(" +& clockKindString(c) +& ", " +& solverMethod +& ")"; end match; end clockKindString; diff --git a/Compiler/FrontEnd/Static.mo b/Compiler/FrontEnd/Static.mo index 53cbb8d23c0..fbe0cc0fac3 100644 --- a/Compiler/FrontEnd/Static.mo +++ b/Compiler/FrontEnd/Static.mo @@ -4937,7 +4937,7 @@ algorithm ty = DAE.T_FUNCTION( {DAE.FUNCARG("u",ty1,variability,DAE.NON_PARALLEL(),NONE()), - DAE.FUNCARG("c",ty2,DAE.C_VAR(),DAE.NON_PARALLEL(),SOME(DAE.CLKCONST(DAE.INFERREDCLOCK())))}, + DAE.FUNCARG("c",ty2,DAE.C_VAR(),DAE.NON_PARALLEL(),SOME(DAE.CLKCONST(DAE.INFERRED_CLOCK())))}, ty1, DAE.FUNCTION_ATTRIBUTES_BUILTIN_IMPURE, DAE.emptyTypeSource); @@ -4954,7 +4954,7 @@ algorithm ty = DAE.T_FUNCTION( {DAE.FUNCARG("u",ty1,variability,DAE.NON_PARALLEL(),NONE()), - DAE.FUNCARG("c",DAE.T_CLOCK_DEFAULT,DAE.C_VAR(),DAE.NON_PARALLEL(),SOME(DAE.CLKCONST(DAE.INFERREDCLOCK())))}, + DAE.FUNCARG("c",DAE.T_CLOCK_DEFAULT,DAE.C_VAR(),DAE.NON_PARALLEL(),SOME(DAE.CLKCONST(DAE.INFERRED_CLOCK())))}, ty1, DAE.FUNCTION_ATTRIBUTES_BUILTIN_IMPURE, DAE.emptyTypeSource); diff --git a/Compiler/FrontEnd/Values.mo b/Compiler/FrontEnd/Values.mo index 47e06c6ee5a..deb37d335fc 100644 --- a/Compiler/FrontEnd/Values.mo +++ b/Compiler/FrontEnd/Values.mo @@ -128,7 +128,6 @@ uniontype Value Value ty "the DAE.Type translated to Value using defaults"; String tyStr "the type of the variable"; end EMPTY; - end Value; public uniontype IntRealOp diff --git a/Compiler/Template/ExpressionDumpTV.mo b/Compiler/Template/ExpressionDumpTV.mo index 69f0aacdc4f..a981d14ce39 100644 --- a/Compiler/Template/ExpressionDumpTV.mo +++ b/Compiler/Template/ExpressionDumpTV.mo @@ -197,26 +197,27 @@ package DAE end Dimension; uniontype ClockKind - record INFERREDCLOCK end INFERREDCLOCK; + record INFERRED_CLOCK + end INFERRED_CLOCK; - record INTEGERCLOCK + record INTEGER_CLOCK Exp intervalCounter; Integer resolution; - end INTEGERCLOCK; + end INTEGER_CLOCK; - record REALCLOCK + record REAL_CLOCK Exp interval; - end REALCLOCK; + end REAL_CLOCK; - record BOOLEANCLOCK + record BOOLEAN_CLOCK Exp condition; Real startInterval; - end BOOLEANCLOCK; + end BOOLEAN_CLOCK; - record SOLVERCLOCK + record SOLVER_CLOCK ClockKind c; String solverMethod; - end SOLVERCLOCK; + end SOLVER_CLOCK; end ClockKind; uniontype Exp diff --git a/Compiler/Template/ExpressionDumpTpl.tpl b/Compiler/Template/ExpressionDumpTpl.tpl index 7caa295bb3b..cded54701cb 100644 --- a/Compiler/Template/ExpressionDumpTpl.tpl +++ b/Compiler/Template/ExpressionDumpTpl.tpl @@ -172,17 +172,17 @@ end dumpExpListCrefs; template dumpClockKind(DAE.ClockKind clk, String stringDelimiter) ::= match clk - case INFERREDCLOCK(__) then "Clock()" - case INTEGERCLOCK(__) then + case INFERRED_CLOCK(__) then "Clock()" + case INTEGER_CLOCK(__) then let ic_str = dumpExp(intervalCounter, stringDelimiter) 'Clock(<%ic_str%>, <%resolution%>)' - case REALCLOCK(__) then + case REAL_CLOCK(__) then let interval_str = dumpExp(interval, stringDelimiter) 'Clock(<%interval_str%>)' - case BOOLEANCLOCK(__) then + case BOOLEAN_CLOCK(__) then let condition_str = dumpExp(condition, stringDelimiter) 'Clock(<%condition_str%>, <%startInterval%>)' - case SOLVERCLOCK(__) then + case SOLVER_CLOCK(__) then let clk_str = dumpClockKind(c, stringDelimiter) 'Clock(<%clk_str%>, <%solverMethod%>)' end dumpClockKind;