question

Rajiv C avatar image
0 Likes"
Rajiv C asked Rajiv C commented

Count Item Type on a Pallet

ProcessTimeBy ItemTypeCount.fsm

I want to count item types on a pallet & then dynamically change the processing time of pallet in the processor by multiplying one of the item type count on that pallet with a fixed time value for example if item type 1 have a quantity of 6 on the pallet then I want the processing time in the processor to be 3second x 6 count = 12 seconds.


FlexSim 20.0.0
flexsim 20.0.0w
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

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Rajiv C commented

You could use a loop to count each type in the processtime trigger:

  1. int numType1=0; //we'll increment this
  2. for (int n=item.subnodes.length;n>0;n--) //loop for all the items.
  3. numType1+=item.subnodes[n].Type==1; //increment by true (1) or false(0)
  4. return numType1*3; //assume model time units are second;


A more flexible and generic way is to set up a processing time array on the processor for the types - shown here with 3 seconds for type1 and then 1 second for type2 (could also be zero):

Then in the processtime trigger use SQL to get a table of types and their quantities:

  1. /**Pallet of Type Based Process Times from label array */
  2.  
  3. Table result =Table.query("SELECT Type,count(*) FROM $1 GROUP BY Type",item); // create the table with type and quantity
  4. double ptime=0;
  5. for (int n=result.numRows;n>0;n--) {
  6.     ptime+=result[n][2]*current.typeProcTimes[result[n][1]]; //increment the process time by the quantity and the time for the type
  7. }
  8. return ptime;


This way you can edit the array with times for each type.

Model attached.

processtimeby-itemtypecount_jl.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.