Skip to content

Commit

Permalink
Update to Adevs code generator for new simulation runtime
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@11856 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
smiz committed May 7, 2012
1 parent 8e78c88 commit 9a20172
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions Compiler/susan_codegen/SimCode/CodegenAdevs.tpl
Expand Up @@ -244,49 +244,12 @@ match simCode
case SIMCODE(modelInfo = MODELINFO(varInfo = vi as VARINFO(__))) then
<<
#include "<%lastIdentOfPath(modelInfo.name)%>.h"
#include "modelica.h"
#include "adevs_modelica_runtime.h"
using namespace adevs;

#ifdef extraPolate
#undef extraPolate
#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

// This is used by the residual functions
static <%lastIdentOfPath(modelInfo.name)%>* active_model;

// undefine initial() (orig. defn. in omc's simulation_runtime.h)
#ifdef initial
#undef initial
#endif
// Less, Greater, etc are positive if true, negative if false
#define Adevs_Less(exp1,exp2) ((exp2)-(exp1))
#define Adevs_Greater(exp1,exp2) ((exp1)-(exp2))
#define Adevs_LessEq(exp1,exp2) ((exp2)-(exp1))
#define Adevs_GreaterEq(exp1,exp2) ((exp1)-(exp2))
// True to false transitions occur at zero,
// False to true transitions at positive epsilon
#define ADEVS_ZEROCROSSING(index,expr) z[index] = expr-(!zc[index])*epsilon
#define ADEVS_RELATIONTOZC(var,exp1,exp2,index,OpSym) \
if (0 <= index) { \
if (zc[index] == -1) zc[index]=((exp1) OpSym (exp2)); \
var=zc[index]; \
} else var=((exp1) OpSym (exp2))
#define ADEVS_SAVEZEROCROSS(var,exp1,exp2,index,OpSym) \
if (0 <= index) { \
if (zc[index] == -1) zc[index]=((exp1) OpSym (exp2)); \
var=zc[index]; \
} else var=((exp1) OpSym (exp2))

<%makeExtraFunctionsAndRecords(simCode)%>

<%makeBoundParams(simCode)%>
Expand Down

0 comments on commit 9a20172

Please sign in to comment.