Skip to content

Commit

Permalink
Added support to the adevs code generator for mixed nonlinear systems.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@9387 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
smiz committed Jun 30, 2011
1 parent 23ac647 commit baaec60
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Compiler/susan_codegen/SimCode/SimCodeAdevs.tpl
Expand Up @@ -231,8 +231,13 @@ case SIMCODE(modelInfo = MODELINFO(varInfo = vi as VARINFO(__))) then

#ifdef extraPolate
#undef extraPolate
#endif
#define extraPolate(v) v
#endif

#ifdef check_discrete_values
#undef check_discrete_values
#define check_discrete_values(size,numValues) found_solution = 1
#endif

#define time timeValue
#define localData this
Expand Down Expand Up @@ -287,6 +292,7 @@ end simulationCppFile;
template declareExtraResiduals(list<SimEqSystem> allEquations)
::=
(allEquations |> eqn => (match eqn
case eq as SES_MIXED(__) then declareExtraResiduals(listFill(eq.cont,1))
case eq as SES_NONLINEAR(__) then
<<
void residualFunc<%index%>_cpp(int *n, double* xloc, double* res, int* iflag);
Expand All @@ -299,7 +305,7 @@ template makeExtraResiduals(list<SimEqSystem> allEquations, String name)
"Generates functions in simulation file."
::=
(allEquations |> eqn => (match eqn
case eq as SES_MIXED(__) then functionExtraResiduals(listFill(eq.cont,1))
case eq as SES_MIXED(__) then makeExtraResiduals(listFill(eq.cont,1),name)
case eq as SES_NONLINEAR(__) then
let &varDecls = buffer "" /*BUFD*/
let algs = (eq.eqs |> eq2 as SES_ALGORITHM(__) =>
Expand Down

0 comments on commit baaec60

Please sign in to comment.