question

Jason Botha avatar image
3 Likes"
Jason Botha asked Jason Botha commented

Add Task Executor flow items to state graph

Hi there,

i have a model where i create a whole bunch of TaskExecuter flow items as the model starts to run, and then i use them to conduct various tasks throughout the run. Which is all controlled in ProcessFlow.

However i want to look at their utilization through the use of a dashboard widget but because the flow items are only generated as the model starts the widget throws an error because the node referencing the flow items doesn't exist on model reset (because the TaskExecuter flow items are deleted on reset).

Is there a way that i can add the TaskExecuter flow items to the graph once i have created them in the model to avoid getting the error? I add all the TaskExecuter flow items to a group when i create them if that helps.

Hope you have a good day. error-message.png

FlexSim 16.2.0
task executertask executer flowitemstate charttask executors
error-message.png (20.1 KiB)
5 |100000

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

1 Answer

·
Sam Stubbs avatar image
5 Likes"
Sam Stubbs answered Jason Botha commented

With any resource or item that's added during the runtime of the model, you also have to add those members to a chart during the runtime. Do do this, you need to access some of the functions on the chart that FlexSim uses when you add members regularly. You can use the fuction_s() function used by the developers to call these functions.

I've created a sample model, that adds these items to the chart during the runtime. This is the code that I used:

/**Custom Code*/
treenode current = param(1);
treenode activity = param(2);
treenode token = param(3);
treenode processFlow = ownerobject(activity);


treenode Operator = getlabel(token, "item"); 


treenode chart = node("Tools/Statistics/State Display", model());
treenode classobj = classobject(chart);


function_s(chart, "addMember", Operator);
function_s(classobj, "reset", chart);

I put this in a custom code activity in Process Flow, right after the item (in this case Task Executer as a Flow Item) is created.

I've attached the model below, you're welcome to use any bit of this that you need for your project.

addtochart.fsm


addtochart.fsm (17.6 KiB)
· 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 Botha avatar image Jason Botha commented ·

Thanks Sam. Your solution works perfectly!

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.