0

I am trying to model a steam network with system dynamics.
There is one stock A that has a flow into stock B.
I've implemented a statechart that has the following states "FillLevelMin", "FillLevelOk" and "FillLevelMax". When the statechart enters a certain state, I want it to influence the size of the flow. By now, I've used set_Parameter(number). That works great if I want to set the flow to a constant amount e.g. 1000.

However, I'd like to set the flow to a dynamic variable whenever the state is "FillLevelMax". Right now, the flow is taking on the value of the dynamic value when the state is being entered and stays like that. However I'd like the flow to update it's value according to the dynamic variable as long as the state chart is in the state "FillLevelMax".

Any idea whether that is possible?

Dave2e
  • 22,192
  • 18
  • 42
  • 50
Josie
  • 7
  • 4

1 Answers1

0

Yes, there is an elegant way called "internal transitions". Set your state up as below: enter image description here

Make sure the transition is 100% inside the state and set the timeout to an agreeable value (fairly frequently for your case, but remember that the more often you re-evaluate this, the slower your model gets). Set it to the least frequent repititon that is still acceptable.

In the action code, you can update your flow value.

PS: note that no matter how often you update, this is still a discrete method, not continuous like system-dynamics itself!

Benjamin
  • 10,603
  • 3
  • 16
  • 28