We're new to SysML/MBSE and this type of modeling in general, but we're trying to jump right into the sysml-as-executable-model level of things. To get started, I'm porting over an existing Excel+VBA based design calculator into an activity called Design, and I'm trying to stay as-true to the existing flow and tool as possible. Since this is exploratory, we're looking to find out if moving a design tool into SysML works/makes sense/etc..
Anyway, I am having a hard time wrapping my head around how the Effects are scoped during a dynamic simulation. Consider a simple example that mimics the flow I'm setting up for the real tool:
https://imgur.com/a/t9Ijw7vhttps://imgur.com/a/DBbba3jwhere I want to calculate the hypotenuse of a right triangle. For this example, the two legs are 3 and 4 giving the hypotenuse of 5.
When I put a breakpoint down in the
ComputeC activity, the Locals window shows:
https://imgur.com/a/vdKRPDEI am confused about how all of this is scoped. It appears that my main activity invokes the anonymous Call Behavior action linked to
ComputeHypotenuse that it gives the name
Action, which takes in
a and
b and passes those through to a
ComputeHypotenuse scope. All good there.
However, inside of the
ComputeHypotenuse activity, it appears
this always dereferences to
sim. And the
CreateTemporary action, which right now has
aa = 2.0;, creates the
aa variable on the same level as
sim rather than something local to
ComputeHypotenuse. If I try something like
this.aa = 2.0; then I am changing the value of
sim.aa.
I'm also not sure why the
let PH = this.ComputeHypotenuse; in the first action of the
ComputeHypotenuse activity doesn't create a variable called
PH] in the locals window, even though it works in future actions.
How are variables scoped in activity diagram simulations? How can I create variables local to an activity without hacking something like creating a
this.locals = {} at the start of every activity to give it a working space?
In my (wrong) mental model of things, I would have expected things to be local to an activity diagram and each activity diagram had a reference to
sim. I would have expected
this to refer to the owning activity. At the very least, I thought each activity would be within its own set of braces to scope actions taken. But it seems like everything just executes in a single scope?