A support case with the identification [CASE:4272760] was created.

I am having some difficulties to provide vector inputs for a Modelica model using Mathematica. To demonstrate this I am using a simple block that will pass a real vector of length 3 unchenaged to its output of the same dimension:

model = ImportString[
    "block VectorPassThrough
         input Real[3] u;
         output Real[3] y;
         y = u;
     end VectorPassThrough;"


Modelica Code

Now I would like to simulate this simple block and provide a vector input:

sim = SystemModelSimulate[ model, {"y"}, {0, 1}, Association[
   "Inputs" -> {
     "u" -> Function[ t, {1., 2., 3.}]

Will throw the error SystemModelSimulate::val :

The variables {u} were not recognized, or the types do not match the model.

Using a time Series also will not help:

sim = SystemModelSimulate[ model, {"y"}, {0, 1}, 
        "Inputs" -> {
            "u" -> TimeSeries[ { {1, 2, 3}, {1, 2, 3} }, { {0, 1} }]

In what format shall vector (and matrix) inputs be given for SystemModelSimulate?


I have received answer from Technical Support at WRI:

At present we cannot feed vectors as lists; instead we have to use array variables such as u[1], u[2] and so on.


The developers are currently working on implementing the feature for feeding vectors as lists.

Since arrays/vectors can also be indexed using enumerations (e.g. "myEnumeration.first", "myEnumeration.second", ... ), having to address individual arguments in this way will be very cumbersome. Expanding the functionality of SystemModelSimulate would be very welcome.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.