question

Paúl Alejandro R avatar image
0 Likes"
Paúl Alejandro R asked Joseph Gillespie converted comment to answer

Release items by quantity in combiners

release-items-time-and-qty.fsmcode.png

Hello,

In the attached model I had incorporated some lines of code to achive that combiners release items not only after a specific amount of time, but also if there are a minimun quantity of items (>=5) Those lines are higtlighted in the screencapture.

If the last arrival quantity (No. 5), in source 2, is less than 5, the combiner does not release the pallet (that is ok), but if the quantity is higher than 5 Flexsim shows an error message.

Please, somebody could help me to solve this error?

FlexSim 18.1.1
combinersrelease items by quantity
· 5
5 |100000

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

tannerp avatar image tannerp commented ·

Hi @Paúl Alejandro R,

I am not getting any error messages from your model. Could you describe the error? Your model runs until time 85.00. At time 85.00 there are 3 full pallets in Queue3 and one pallet with 2 items on Combiner1. Is this correct?

0 Likes 0 ·
Paúl Alejandro R avatar image Paúl Alejandro R tannerp commented ·

@Tanner Poulton

For example, in source 2 If you change the last qty arrival to 6 (qty >=5) , the following message appears: "time: 85.000000 exception: FlexScript exception: MODEL:/Combiner1>variables/messagetrigger". It happens when the code forces to release the last pallet.

0 Likes 0 ·
tannerp avatar image tannerp Paúl Alejandro R commented ·

@Paúl Alejandro R

I understand now how to cause the error in the model. @Jörg Vogel is right; manually releasing the items through code is throwing off the FlexSim event order and causing an error.

What is it you're trying to have the On Message trigger accomplish? Based on what I can tell, your code is designed to be like a "Max Wait Timer." Or, in other words, if the items wait in the combiner long enough, they'll be released. Does this sound right? You might consider going an alternate route, such as using a trigger in Process Flow that would move the object downstream.

0 Likes 0 ·
Show more comments
Joerg Vogel avatar image Joerg Vogel commented ·

@Paúl Alejandro R, the command releaseitem is executed on items that are ready for release but are forced to stay at an object by the command holditem or send to an unavailable port. That condition is on purpose of the mechanism how the FlexSim engine handles the discrete event simulation. At the time the processing of an item starts the FlexSim engine puts an event into the event list when this specific item is finishing processing and what the next events are in the model with this item. If you call a releaseitem on an item still in processing state, the process finish event is going to happen later, the event won't be deleted automatically. The event and other will occurs whether the item is in the processor or not when the event list interpreter comes to the events in the list later. The command releaseitem does what you want but the command isn't used properly and will mess up your event list execution. You have to tidy up the event list by yourself or you have to use other mechanisms to accomplish what you want!

0 Likes 0 ·

1 Answer

·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered

@Paúl Alejandro R, you have learnt a lot and it is time to use this with a new object: a Fixed Ressource ProcessFlow Basic Processor. You find a template to add in the ProcessFlow menu icon. Please look into the source code of the Onreceive Item. The command receiveitem has got an optional parameter to receive items from different ports. This will let you build a combiner on your own. You receive a pallet item from port 1, then you receive the amount of items to get your batch size by port 2. If the minimum batch size isn't reached in max process wait time you force to batch again in a loop. If the minimum batch size is reached under the max wait time you try to batch to the max wait minus the already gone wait time. If the initial pallet item token leaves the ProcessFlow you add the needed statistical values in a statistic collector.

Maybe you have another approach then use it!

5 |100000

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

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.