You can get the visualisation to work correctly by moving the model around a bit. I have referred to Slide 40 of Into to the SysML v2 Language-Textual Notation slides from the official SysML v2 GitHub when refactoring the model.
These are the main changes I did:
Moved the add1 and add2 action definitions out of the ordering section syntax.
Added then joinNode after those action definitions (the node can be called whatever, not necessarily joinNode).
In the ordering section, change from then join; to just join joinNode;.
You can find the model under the screenshot (I put it in an expandable section to avoid clutter). I hope this helps!
private import ScalarValues::*;
action def Add {
in attribute x : Integer;
out attribute r : Integer;
}
action def Sum {
in attribute a : Integer;
in attribute b : Integer;
out attribute total : Integer;
}
action def ProcessDataParallel {
in attribute data1 : Integer;
in attribute data2 : Integer;
out attribute result : Integer;
attribute add1Result : Integer;
attribute add2Result : Integer;
// Moved this action definition out of the ordering section
action add1 : Add {
in attribute redefines x = data1;
out attribute redefines r = add1Result;
}
then joinNode;
// Moved this action definition out of the ordering section
action add2 : Add {
in attribute redefines x = data2;
out attribute redefines r = add2Result;
}
then joinNode;
// Ordering section
first start;
then fork;
then add1;
then add2;
join joinNode; // Created a "joinNode" and removed "then" from "then join;"
then action sum : Sum {
// You could move out the `sum` action definition as well, but this works too
in attribute redefines a = add1Result;
in attribute redefines b = add2Result;
}
flow add1.r to sum.a;
flow add2.r to sum.b;
flow data1 to add1.x;
flow data2 to add2.x;
flow sum.total to result;
}
}
The solution you proposed (the fact to define action outside the Ordering part, and to have a joinNOde after each action definition) is something expected or shall be considered a temporary workaround?
Since this way is the only one I can find described among the official SysML v2 specification documents, I would assume that this is how it is expected to be used in the long term.