From b14ae5bb73ad727f59c1c544a30fd244c5314c4b Mon Sep 17 00:00:00 2001 From: Torsten Sommer Date: Fri, 7 Jun 2024 14:14:20 +0200 Subject: [PATCH] Allow setting variable "x" in StateSpace model in Continuous Time and Event Mode fixes #508 --- StateSpace/model.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/StateSpace/model.c b/StateSpace/model.c index 0e7e3cf4..8d6c8f88 100644 --- a/StateSpace/model.c +++ b/StateSpace/model.c @@ -196,6 +196,16 @@ Status setFloat64(ModelInstance* comp, ValueReference vr, const double values[], M(u)[i] = values[(*index)++]; } break; + case vr_x: + if (comp->state != ContinuousTimeMode && comp->state != EventMode) { + logError(comp, "Variable \"x\" can only be set in Continuous Time Mode and Event Mode.", vr); + return Error; + } + ASSERT_NVALUES((size_t)M(n)); + for (size_t i = 0; i < M(n); i++) { + M(x)[i] = values[(*index)++]; + } + break; default: logError(comp, "Set Float64 is not allowed for value reference %u.", vr); return Error;