From 70ed792a63237def94f0cb845263f0f3f1b1f7e1 Mon Sep 17 00:00:00 2001 From: Torsten Sommer Date: Sun, 31 May 2020 23:06:21 +0200 Subject: [PATCH] Change dimension variables in LinearTransform to Int32 (#41) fixes #5 --- LinearTransform/FMI3.xml | 4 ++-- LinearTransform/config.h | 1 + LinearTransform/model.c | 20 ++++++++++++++------ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/LinearTransform/FMI3.xml b/LinearTransform/FMI3.xml index b313bc3d..568b4f15 100644 --- a/LinearTransform/FMI3.xml +++ b/LinearTransform/FMI3.xml @@ -13,8 +13,8 @@ - - + + diff --git a/LinearTransform/config.h b/LinearTransform/config.h index 2162985a..4b771a15 100644 --- a/LinearTransform/config.h +++ b/LinearTransform/config.h @@ -14,6 +14,7 @@ #define GET_FLOAT64 #define SET_FLOAT64 +#define GET_INT32 #define EVENT_UPDATE #define FIXED_SOLVER_STEP 1 diff --git a/LinearTransform/model.c b/LinearTransform/model.c index 4d1687ca..ffe9c3c6 100644 --- a/LinearTransform/model.c +++ b/LinearTransform/model.c @@ -31,12 +31,6 @@ Status getFloat64(ModelInstance* comp, ValueReference vr, double *value, size_t calculateValues(comp); switch (vr) { - case vr_m: - value[(*index)++] = M(m); - return OK; - case vr_n: - value[(*index)++] = M(n); - return OK; case vr_u: value[(*index)++] = M(u)[0]; value[(*index)++] = M(u)[1]; @@ -72,6 +66,20 @@ Status setFloat64(ModelInstance* comp, ValueReference vr, const double *value, s } } +Status getInt32(ModelInstance* comp, ValueReference vr, int *value, size_t *index) { + calculateValues(comp); + switch (vr) { + case vr_m: + value[(*index)++] = M(m); + return OK; + case vr_n: + value[(*index)++] = M(n); + return OK; + default: + return Error; + } +} + void eventUpdate(ModelInstance *comp) { comp->valuesOfContinuousStatesChanged = false; comp->nominalsOfContinuousStatesChanged = false;