question

iceagesimulator avatar image
0 Likes"
iceagesimulator asked Matthew Gillespie commented

Process Time Using SubFlow, referencing value from table

I have a model where boxes are assigned a label called Type, then combined onto a pallet. The first processor is using a SubFlow for the processing time, however the times are hard coded into the labels and do not change. I want the second processor to vary the times, based on what label value of Type is on the box, which is on the pallet. There are three tasks for each processor in the SubFlows that make up the total processor time. For the second SubFlow, the task times need to be set by looking up a value in a Global Table "Timing", where the column is the Type of the box, and the row is the task number.

How can I go about using the SubFlow to set the total processing time of the processor, by looking up task times from a global table based on the label value of the box on the pallet of said processor?

QuestionProcessingTimeSubFlow.fsm


FlexSim 23.1.1
subflowprocessing time
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

Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered Matthew Gillespie commented

The keyword item isn't defined in the sub flow, you need to get a reference to the box yourself. In this case, current in the subflow refers to the processor that executes the subflow. So you can get a reference to the box inside the pallet inside the processor using

current.first.first

Here's a version of your model where I get the Type label value off the box and put it on a Type label on the token in the subflow. Then I can just use token.Type from then on in the subflow.

1685726799674.png

questionprocessingtimesubflow_1.fsm


· 2
5 |100000

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

iceagesimulator avatar image iceagesimulator commented ·

Thank you, this approach worked on a processor. However, I now expanded this methodology to see if it will work with a Station on a Conveyor. When the pallet stops at a Station on the Conveyor, I am getting an error that suggests the property "first" cannot be accessed.


Note: I am using the same exact subflow for the Station on the Conveyor as was setup on Processor 2.

examplescreenshot.jpg

questionprocessingtimesubflow-2.fsm

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ iceagesimulator commented ·

In a Processor, the item is placed inside it so you can refer to it with current.first. Unfortunately, items are not placed inside decision points. To reference the item you'd have to use it's activeItem property. So when assigning the type label you'd have to use some code like this:

Object pallet;
if (isclasstype(current, "Conveyor::DecisionPoint"))
    pallet = current.as(Conveyor.DecisionPoint).activeItem;
else
    pallet = current.first;    
return pallet.first.Type;

questionprocessingtimesubflow-2_1.fsm

At this point, it begs the question of is executing a subflow to return the process time very helpful? It seems like it would be easier to use a different method like just putting the code in the Process Time field directly or using an Event-triggered source to listen to an item arriving at a processor/decision point. Both of these methods will automatically give you a reference to the arriving item.

1 Like 1 ·