Skip to content

Commit

Permalink
- again some inline solver stuff
Browse files Browse the repository at this point in the history
  - propagate variables to code generation


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14502 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
lochel committed Dec 21, 2012
1 parent a75a680 commit d08107f
Show file tree
Hide file tree
Showing 9 changed files with 181 additions and 153 deletions.
13 changes: 6 additions & 7 deletions Compiler/BackEnd/BackendQSS.mo
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL).
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S
* ACCEPTANCE OF THE OSMC PUBLIC LICENSE.
*
* The OpenModelica software and the Open Source Modelica
Expand All @@ -28,16 +28,15 @@
* See the full OSMC Public License conditions for more details.
*
*/



encapsulated package BackendQSS
" file: BackendQSS.mo
package: BackendQSS
description: BackendQSS contains the datatypes used by the backend for QSS solver.
authors: florosx, fbergero
description: BackendQSS contains the datatypes used by the backend for QSS
solver.
authors: florosx, fbergero

$Id$
"
$Id$"

public import ExpressionSimplify;
public import SimCode;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/BackEnd/Initialization.mo
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ encapsulated package Initialization
description: Initialization.mo contains everything needed to set up the
BackendDAE for the initial system.

RCS: $Id: Initialization.mo 14238 2012-12-05 14:00:00Z lochel $"
RCS: $Id$"

public import Absyn;
public import BackendDAE;
Expand Down
11 changes: 6 additions & 5 deletions Compiler/BackEnd/InlineSolver.mo
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ encapsulated package InlineSolver
description: InlineSolver.mo contains everything needed to set up the
BackendDAE for the inline solver

RCS: $Id: InlineSolver.mo 14238 2012-12-05 14:00:00Z lochel $"
RCS: $Id$"

public import Absyn;
public import BackendDAE;
Expand Down Expand Up @@ -65,14 +65,15 @@ public function generateDAE "function generateDAE
This function generates a algebraic system of equations for the inline solver"
input BackendDAE.BackendDAE inDAE;
output Option<BackendDAE.BackendDAE> outDAE;
output Option<BackendDAE.Variables> outInlineVars;
algorithm
outDAE := matchcontinue(inDAE)
(outDAE, outInlineVars) := matchcontinue(inDAE)
local
BackendDAE.BackendDAE dae;

case _ equation /*do nothing */
false = Flags.isSet(Flags.INLINE_SOLVER);
then NONE();
then (NONE(), NONE());

case dae equation
true = Flags.isSet(Flags.INLINE_SOLVER);
Expand All @@ -84,12 +85,12 @@ algorithm

/* output: algebraic system */
Debug.fcall2(Flags.DUMP_INLINE_SOLVER, BackendDump.dumpBackendDAE, dae, "inlineSolver: algebraic system");
then SOME(dae);
then (SOME(dae), NONE());

else equation /* don't work */
Error.addCompilerWarning("./Compiler/BackEnd/InlineSolver.mo: function generateDAE failed");
Error.addCompilerWarning("inline solver can not be used.");
then NONE();
then (NONE(), NONE());
end matchcontinue;
end generateDAE;

Expand Down
4 changes: 2 additions & 2 deletions Compiler/BackEnd/ResidualCmp.mo
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ algorithm
// generate all residual equations
(daevars,_,allEquations,allInitEquations) = generateEquationscollectVars(elementLst,{},1,{},{});
// generate variable definitions
simvars = SimCode.SIMVARS({},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{});
varinfo = SimCode.VARINFO(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,NONE(),NONE());
simvars = SimCode.SIMVARS({},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{});
varinfo = SimCode.VARINFO(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,NONE(),NONE());

modelInfo = SimCode.MODELINFO(inClassName,fileDir,varinfo,simvars,functions,{});
extObjInfo = SimCode.EXTOBJINFO({},{});
Expand Down
4 changes: 3 additions & 1 deletion Compiler/BackEnd/SimCode.mo
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ uniontype VarInfo
Integer numRelations;
Integer numMathEventFunctions;
Integer numStateVars;
Integer numInlineVars;
Integer numAlgVars;
Integer numIntAlgVars;
Integer numBoolAlgVars;
Expand Down Expand Up @@ -204,6 +205,7 @@ uniontype SimVars
record SIMVARS
list<SimVar> stateVars;
list<SimVar> derivativeVars;
list<SimVar> inlineVars;
list<SimVar> algVars;
list<SimVar> intAlgVars;
list<SimVar> boolAlgVars;
Expand All @@ -226,7 +228,7 @@ uniontype SimVars
end SIMVARS;
end SimVars;

public constant SimVars emptySimVars = SIMVARS({}, {}, {}, {}, {}, {}, {},
public constant SimVars emptySimVars = SIMVARS({}, {}, {}, {}, {}, {}, {}, {},
{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {});

// Information about a variable in a Modelica model.
Expand Down
12 changes: 5 additions & 7 deletions Compiler/BackEnd/SimCodeMain.mo
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@ encapsulated package SimCodeMain
" file: SimCodeMain.mo
package: SimCodeMain
description: Code generation using Susan templates

RCS: $Id: SimCodeMain.mo 12794 2012-09-05 16:52:31Z perost $

The entry points to this module are the translateModel function and the
translateFunctions fuction.

"

The entry points to this module are the translateModel function and the
translateFunctions fuction.
RCS: $Id$"

// public imports
public import Absyn;
Expand Down

0 comments on commit d08107f

Please sign in to comment.