Skip to content

Commit

Permalink
Headerfile for fmi c interface.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7409 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Azam Zia committed Dec 15, 2010
1 parent 6281a28 commit a202e1c
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions c_runtime/fmu_model_interface.h
@@ -0,0 +1,43 @@
/******************************************************************************
*fmuTemplate.h
******************************************************************************/
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "fmiModelFunctions.h"

// macros used to define variables
#define r(vr) comp->r[vr]
#define i(vr) comp->i[vr]
#define b(vr) comp->b[vr]
#define s(vr) comp->s[vr]
#define pos(z) comp->isPositive[z]
#define copy(vr, value) setString(comp, vr, value)

#define not_modelError (modelInstantiated|modelInitialized|modelTerminated)

typedef enum {
modelInstantiated = 1<<0,
modelInitialized = 1<<1,
modelTerminated = 1<<2,
modelError = 1<<3
} ModelState;

typedef struct {
fmiReal *r;
fmiInteger *i;
fmiBoolean *b;
fmiString *s;
fmiBoolean *isPositive;
fmiReal time;
fmiString instanceName;
fmiString GUID;
fmiCallbackFunctions functions;
fmiBoolean loggingOn;
ModelState state;
} ModelInstance;

fmiStatus setString(fmiComponent comp, fmiValueReference vr, fmiString value){
return fmiSetString(comp, &vr, 1, &value);
}

0 comments on commit a202e1c

Please sign in to comment.