how to toggle (on/off) 'enable' of the inter-arrival source Activity?

how to toggle (on/off) 'enable' of the inter-arrival source Activity?

support5CRPZ
Advocate Advocate
6 Views
4 Replies
Message 1 of 5

how to toggle (on/off) 'enable' of the inter-arrival source Activity?

support5CRPZ
Advocate
Advocate

[ FlexSim 22.0.1 ]

2022-02-25-174413.pngMy customer want to know how to control 'enable' of the inter-arrival source activity to On/Off.

Is there a way to control the Enable field to 'check' or 'uncheck' using custom code activity?

0 Likes
Accepted solutions (1)
7 Views
4 Replies
Replies (4)
Message 2 of 5

moehlmann_fe
Observer
Observer
Accepted solution
activity.as(Object).setVariable("enabled", value);
// OR
setvarnum(activity, "enabled", value);

These can set the source to be enabled (value == 1) or not (value == 0). To immediately update the icon, add

function_s(activity, "updateIcon");

The necessary code can be auto-generated by choosing a process flow source as reference for a parameter in the Parameters table.

Since you are asking about doing this is a custom code activity I presume your customer wants to switch the source on/off while the model is running? In that case a different solution would be required, since the "enabled" setting only takes effect on a reset.

A simple decide activity controlled by a global variable or process flow label that sends created tokens directly to a sink can achieve this. (You could of course also have the decide look at the "enabled" variable that is changed in the above code but that seems unnecessarily complicated).

1645782495590.png1645782564289.png

Message 3 of 5

support5CRPZ
Advocate
Advocate

My customer wants to switch the source 'Enabled' on/off while the model is running as you presume. He wants to do it dynamically using parameter or global variables .


0 Likes
Message 4 of 5

jason_lightfootVL7B4
Autodesk
Autodesk
Then the condition in the decide activity would just refer to that global variable which is either 1 or 0.
0 Likes
Message 5 of 5

ryan_c10
Not applicable

Hi @David Seo, was Felix Möhlmann'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 unaccept and comment back to reopen your question.

0 Likes