question

Jay K9 avatar image
0 Likes"
Jay K9 asked Natalie White commented

How to create a button to enable or disable certain process flow?

I want to add a button in dashboard which would enable to disable certain process flow in my model. Is it possible to do that?

FlexSim 23.0.0
process flowdashboard button
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Natalie White avatar image Natalie White commented ·

Hi @Jay K9, was Jonah K's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Jonah K avatar image
0 Likes"
Jonah K answered Jason Lightfoot commented

There's a couple of different ways you can accomplish this. One way that you can do it is to create a GUI button that changes the "enabled" variable in a source activity, using this code in the OnPress node (Flow1):

treenode mysource1 = getactivity("ProcessFlow", "Source1");
int enableval = getvarnum(mysource1, "enabled");
setvarnum(mysource1, "enabled", !enableval);
function_s(mysource1, "updateIcon");
repaintall();

The downside is that this method requires that you reset the model each time you press the button.

If you want to be able to click the button during the model run, you could create a button which will redirect tokens to an alternate branch on a Decide activity using a Global Variable, with this code (Flow2):

treenode globalvar = Model.find("Tools/GlobalVariables/Variable1");
globalvar.subnodes[3].value = !globalvar.subnodes[3].value;

You can reconfigure any of these two methods to fit your needs. Here's an example model:

GUIEnableProcessFlow.fsm


· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·
Depending on the type of process flow and token source, and when you want to make the change, you might also remove an instance member from an object process flow or change the number of tokens to produce to zero either directly or via a model parameter.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.