X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.fmil.core%2Fnative%2FFMUSimulator%2Finclude%2Ffmi1_cs.h;h=d3e6229a1e7ddc5029b42674a936d0425c648c7d;hb=4282c2e792b39be912e3db8226c342867c2dc065;hp=65072e1f41f311a1c750eba72259ffcd292fca01;hpb=411f77604de585b8b00e76ce39dab96e530193e5;p=simantics%2Ffmil.git diff --git a/org.simantics.fmil.core/native/FMUSimulator/include/fmi1_cs.h b/org.simantics.fmil.core/native/FMUSimulator/include/fmi1_cs.h index 65072e1..d3e6229 100644 --- a/org.simantics.fmil.core/native/FMUSimulator/include/fmi1_cs.h +++ b/org.simantics.fmil.core/native/FMUSimulator/include/fmi1_cs.h @@ -1,55 +1,89 @@ -#ifndef __FMI1_CS_H__ -#define __FMI1_CS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - char *name; - char *description; - char *declaredType; - long vr; - // 0 = real - // 1 = integer - // 2 = boolean - // 3 = string - // 4 = enumeration - int type; - // 0 = constant - // 1 = parameter - // 2 = discrete - // 3 = continuous - // 4 = unknown - int variability; - // 0 = input - // 1 = output - // 2 = internal - // 3 = none - // 4 = unknown - int causality; -} FMIL_Variable; - -typedef struct { - char *name; - char *description; - char *quantity; - char *unit; -} FMIL_DeclaredType; - -__declspec(dllexport) void* FMI1_CS_LOAD(const char *zipFilePath, const char *unzipFolder); -__declspec(dllexport) int FMI1_CS_UNLOAD(void* fmu); -__declspec(dllexport) FMIL_Variable *FMI1_CS_GET_VARIABLES(void* fmu, int *count); -__declspec(dllexport) FMIL_DeclaredType *FMI1_CS_GET_DECLARED_TYPES(void* fmu, int *count); -__declspec(dllexport) int FMI1_CS_INSTANTIATE(void* fmu); -__declspec(dllexport) int FMI1_CS_INITIALIZE(void* fmu); -__declspec(dllexport) int FMI1_CS_STEP(void* fmu, double masterTime, double stepSize); -__declspec(dllexport) double FMI1_CS_SET_REAL(void* fmu, int vr, double value); -__declspec(dllexport) int FMI1_CS_GET_REALS(void* fmu, int *vrs, double *values, int count); -__declspec(dllexport) double FMI1_CS_GET_REAL(void* fmu, int vr); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file +#ifndef __FMI1_CS_H__ +#define __FMI1_CS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + const char *name; + const char *description; + const char *declaredType; + long vr; + // 0 = real + // 1 = integer + // 2 = boolean + // 3 = string + // 4 = enumeration + int type; + // 0 = constant + // 1 = parameter + // 2 = discrete + // 3 = continuous + // 4 = unknown + int variability; + // 0 = input + // 1 = output + // 2 = internal + // 3 = none + // 4 = unknown + int causality; +} FMIL_Variable; + +typedef struct { + const char *name; + const char *description; + const char *quantity; + const char *unit; +} FMIL_DeclaredType; + +int FMI_CS_LOAD(const char *zipFilePath, const char *unzipFolder, void **fmuPointer, int *fmuVersion, const char **error); + +int FMI1_CS_UNLOAD(void* fmu, const char **error); +FMIL_Variable *FMI1_CS_GET_VARIABLES(void* fmu, int *count, const char **error); +FMIL_DeclaredType *FMI1_CS_GET_DECLARED_TYPES(void* fmu, int *count, const char **error); +int FMI1_CS_INSTANTIATE(void* fmu, const char *instanceName, const char **error); +int FMI1_CS_INITIALIZE(void* fmu, const char **error); +int FMI1_CS_STEP(void* fmu, double masterTime, double stepSize, const char **error); + +int FMI1_CS_SET_REAL(void *fmu, int valueId, double value, const char **error); +int FMI1_CS_SET_INTEGER(void *fmu, int valueId, int value, const char **error); +int FMI1_CS_SET_BOOLEAN(void *fmu, int valueId, int value, const char **error); +int FMI1_CS_SET_STRING(void *fmu, int valueId, const char *value, const char **error); + +double FMI1_CS_GET_REAL(void *fmu, int valueReference, const char **error); +int FMI1_CS_GET_INTEGER(void *fmu, int valueReference, const char **error); +int FMI1_CS_GET_BOOLEAN(void *fmu, int valueReference, const char **error); +const char *FMI1_CS_GET_STRING(void *fmu, int valueReference, const char **error); + +int FMI1_CS_GET_REALS(void *fmu, int *valueReferences, double *result, int count, const char **error); +int FMI1_CS_GET_INTEGERS(void *fmu, int *valueReferences, int *result, int count, const char **error); +int FMI1_CS_GET_BOOLEANS(void *fmu, int *valueReferences, char *result, int count, const char **error); +int FMI1_CS_GET_STRINGS(void *fmu, int *valueReferences, const char **result, int count, const char **error); + +int FMI2_CS_UNLOAD(void* fmu, const char **error); +FMIL_Variable *FMI2_CS_GET_VARIABLES(void* fmu, int *count, const char **error); +FMIL_DeclaredType *FMI2_CS_GET_DECLARED_TYPES(void* fmu, int *count, const char **error); +int FMI2_CS_INSTANTIATE(void* fmu, const char *instanceName, const char **error); +int FMI2_CS_INITIALIZE(void* fmu, const char **error); +int FMI2_CS_STEP(void* fmu, double masterTime, double stepSize, const char **error); +int FMI2_CS_SET_REAL(void *fmu, int valueId, double value, const char **error); +int FMI2_CS_SET_INTEGER(void *fmu, int valueId, int value, const char **error); +int FMI2_CS_SET_BOOLEAN(void *fmu, int valueId, int value, const char **error); +int FMI2_CS_SET_STRING(void *fmu, int valueId, const char *value, const char **error); + +double FMI2_CS_GET_REAL(void *fmu, int valueReference, const char **error); +int FMI2_CS_GET_INTEGER(void *fmu, int valueReference, const char **error); +int FMI2_CS_GET_BOOLEAN(void *fmu, int valueReference, const char **error); +const char *FMI2_CS_GET_STRING(void *fmu, int valueReference, const char **error); + +int FMI2_CS_GET_REALS(void *fmu, int *valueReferences, double *result, int count, const char **error); +int FMI2_CS_GET_INTEGERS(void *fmu, int *valueReferences, int *result, int count, const char **error); +int FMI2_CS_GET_BOOLEANS(void *fmu, int *valueReferences, int *result, int count, const char **error); +int FMI2_CS_GET_STRINGS(void *fmu, int *valueReferences, const char **result, int count, const char **error); + +#ifdef __cplusplus +} +#endif + +#endif // __FMI1_CS_H__