Changeset dd0c8bd4 in OpenModelica
- Timestamp:
- 2016-03-21T13:39:36+01:00 (8 years ago)
- Branches:
- Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
- Children:
- 5d60737
- Parents:
- 34e4a4c
- git-author:
- vruge <vruge@…> (03/21/16 13:39:36)
- git-committer:
- hudson <openmodelica@…> (03/21/16 13:39:36)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Compiler/BackEnd/ExpressionSolve.mo
rad1689a rdd0c8bd4 111 111 112 112 protected function solveSimpleEquationsWork 113 input BackendDAE.Equation inEqn;113 input output BackendDAE.Equation eqn; 114 114 input BackendDAE.Var var "solve eq with respect to var"; 115 115 input BackendDAE.Shared shared; 116 output BackendDAE.Equation outEqn;117 116 output Boolean solved; 118 117 … … 120 119 DAE.ComponentRef cr; 121 120 DAE.Exp e1,e2,varexp,e; 122 123 121 BackendDAE.EquationAttributes attr; 124 122 DAE.ElementSource source; 125 list<DAE.Statement> asserts = {}; 126 algorithm 127 BackendDAE.EQUATION(exp=e1, scalar=e2, source=source,attr=attr) := inEqn; 123 algorithm 124 BackendDAE.EQUATION(exp=e1, scalar=e2, source=source,attr=attr) := eqn; 125 if not (Types.isIntegerOrRealOrSubTypeOfEither(Expression.typeof(e1)) and Types.isIntegerOrRealOrSubTypeOfEither(Expression.typeof(e2))) then 126 return ; 127 end if; 128 128 BackendDAE.VAR(varName = cr) := var; 129 129 varexp := Expression.crefExp(cr); … … 133 133 end if; 134 134 135 (e1, e2) := preprocessingSolve(e1, e2, varexp, SOME(shared.functionTree), NONE(), 0); 136 135 137 try 136 (e1, e2) := preprocessingSolve(e1, e2, varexp, SOME(shared.functionTree), NONE(), 0); 137 else 138 // no number 139 end try; 140 141 try 142 (e, asserts) := solve2(e1, e2, varexp, SOME(shared.functionTree), NONE()); 143 source := DAEUtil.addSymbolicTransformationSolve(true, source, cr, e1, e2, e, asserts); 144 outEqn := BackendEquation.generateEquation(varexp, e, source, attr); 138 e := solve2(e1, e2, varexp, SOME(shared.functionTree), NONE()); 139 source := DAEUtil.addSymbolicTransformationSolve(true, source, cr, e1, e2, e, {}); 140 eqn := BackendEquation.generateEquation(varexp, e, source, attr); 145 141 solved := true; 146 142 else 147 143 //eqn is change by possible simplification inside preprocessingSolve for solve the eqn with respect to varexp 148 144 //source := DAEUtil.addSymbolicTransformationSimplify(true, source, DAE.PARTIAL_EQUATION(e1), DAE.PARTIAL_EQUATION(e2)); 149 outEqn := BackendEquation.generateEquation(e1, e2, source, attr);145 eqn := BackendEquation.generateEquation(e1, e2, source, attr); 150 146 solved := false; 151 147 end try; … … 303 299 end matchcontinue; 304 300 305 eqnForNewVars := List.appendNoCopy(eqnForNewVars, eqnForNewVars1); 306 newVarsCrefs := List.appendNoCopy(newVarsCrefs, newVarsCrefs1); 301 if isPresent(eqnForNewVars) then 302 eqnForNewVars := List.appendNoCopy(eqnForNewVars, eqnForNewVars1); 303 newVarsCrefs := List.appendNoCopy(newVarsCrefs, newVarsCrefs1); 304 end if; 307 305 308 306 end solveWork;
Note: See TracChangeset
for help on using the changeset viewer.