MagicDraw/Cameo v19SP3+SysPhS-1.1: Does not cleanly export INLINE Modelica 'if/then/else' statements (a.k.a. "switching" form)

This page identifies a possible issue, inconsistency, concern, error, or bug!
One of the ways Webel IT Australia helps promote tools, technologies, and languages is by donating a lot of time identifying, tracking, and reporting potential issues, in order to help vendors and developers improve the tools and technologies. In some cases, we also offer workarounds and advice for users. All issues tracked on our public site are offered most constructively and with sincerest gratitude to the tool vendors and technology developers.
DISCLAIMER: Vendors do not officially endorse issue analysis by Webel IT Australia.
Icon class
icon_class
far fa-sticky-note
icon_class_computed
far fa-sticky-note
Note kind
Policy level
Specification keywords
UML keywords
Modelica keywords
Keywords

MagicDraw/Cameo could not handle export of the following guard expressions from the Modelica by Example Decay2 example:


der(x) = if x>=0 then -sqrt(x) else 0;
The export result was:

  der(x)=null0null-sqrt(x)nullnull;

It turns out, however, that MagicDraw/Cameo can export the following fine (just not the inline form):


if x>=0 then
  der(x)=-sqrt(x);
else
  der(x)=0;
end if;

The OpenModelica docs use the following terminology:

If clause:

parameter Boolean linear=true;
    parameter Boolean quadratic=false;
    Real x, y;
  equation
    if linear then
      y = x + 1;
    elseif quadratic then
      y = x^2 + x + 1;
    else
      y = Modelica.Math.sin(x) + 1;
    end if;
If expression:

Integer i;
  Integer sign_of_i=if i<0 then -1 else if i==0 then 0 else 1;

The SysPhS-1.1 spec seems to refer to these forms as if-equation and if-statement (see p.9 under 8 Language for Mathematical Expressions):
The SysPhS expression grammar includes a subset of Modelica’s grammar, as follows:
  • All terminal symbols
  • The following non-terminal symbols: equation, statement, if-equation, if-statement, for-statement, for-indices, for-index, while-statement, expression, simple-expression, logical-expression, logical-term, logical-factor, relation, relational-operator, arithmetic-expression, add-operator, term, mul-operator, factor, primary, name, component-reference, function-call-args, function-arguments, function-arguments-non- first, named-arguments, named-argument, function-argument, output-expression-list, expression-list, array-subscripts, subscript
This page contains content quoted, copied, or adapted, from the following Object Management Group specification for educational purposes: SysPhS-1.1. The OMG retains the original © copyright.
Relates to
Related notes
Related notes (backlinks)
Related snippets (extracts)
Visit also
Visit also (backlinks)
External links