5
$\begingroup$

Bug introduced in 11.3 and fixed in 12.1


I am a bit surprised that I am not getting a boolean output for the following simple Modelica model:

model = ImportString[
    "block Or
        input Boolean u1;
        input Boolean u2;
        output Boolean y;
     equation
        y = (u1 or u2);
     end Or;"
   ,
   "Mo"
];

sim = SystemModelSimulate[ model, {"y"}, {0,1},
    Association[
        "Inputs" -> {
            "u1" -> Function[ t, True ],
            "u2" -> Function[ t, False ]
        }
    ]
];

First @ sim[{"y"}]

Function[ t, 1., Listable ]

So, what is returned is the real output (e.g. Boole[y]). Is this a bug?

$\endgroup$
2
  • 3
    $\begingroup$ I (as a developer working on system modeling in Wolfram Language) consider it at least an unfortunate behavior. I have reported it in our issue tracker internally. $\endgroup$
    – Malte Lenz
    Jun 10, 2019 at 7:42
  • 1
    $\begingroup$ @Malte Great to hear. It indeed makes wiritng VerificationTest in a test notebook (a great feature btw) a bit more opaque. $\endgroup$
    – gwr
    Jun 10, 2019 at 10:38

1 Answer 1

1
$\begingroup$

As Malte Lenz and now officially Wolfram Support have confirmed, this is a bug.

Note, that not only will Boolean outputs be given numerically by SystemModelSimulate, but Boolean inputs also have to be given as 1 or 0 instead of True or False.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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