question

LauraV avatar image
0 Likes"
LauraV asked Jeff Nordgren commented

Queue and code

In the attached model one by one item is coming from source 1 to processor1. At the same time a lot size of 500 is going to queue2 from source 2 and then a lot of 15 from those 500 is going to processor1 to get process with one from source 1. I am aware about by assigning manually to source like arrival schedule and by performing batching from queue2 we can do this process. But I want to try this process with an custom code so that I can create a situation like in the beginning a batch of 500 reach at queue2 then a batch of 15 from those 500 should reach to processor and as 80% from those 500 left from queue2 another batch of 500 from source 2 should reach queue2. I am not interested to use combiner because that one item from queue1 and 15 from queue2 get join or not is not a matter. Just I want to perform everything with the help of code from source 2 to queue2 to processor 1.dummy-model.fsm

FlexSim 17.2.4
queue and code
dummy-model.fsm (16.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

·
Jeff Nordgren avatar image
1 Like"
Jeff Nordgren answered Jeff Nordgren commented
@LauraV

I'm not really sure why you want to use a Processor and "re-invent the wheel" of all the things that a Combiner can do, that you describe that you need, for you. It would take a lot of work to get the Processor to work like a Combiner already does to make things work right. There is nothing special that you need on the Processor or need the Processor to do (except for the Combiner functions), so why use the Processor when the Combiner is the right object for this situation?

You said you're not interested in using the Combiner because it doesn't matter if the flowitems from Queue1 get joined or not with the flowitems from Queue2. So if it doesn't matter whether or not the flowitems get joined or not, the Combiner is the obvious choice. The Processor will NOT join the flowitems so you will have an extra 15 flowitems in your model each time through a process because they are NOT joined. If joined in a Combiner, the Combiner gets rid of those extra 15 object in your model, reducing the number of flowitems (objects) in your model.

In the attached model, I made the following changes to your model.

I replaced the Processor with a Combiner. I deleted Source2. In Queue2, I added two labels. One for the restock quantity (500) and one for the batch size to go to the Combiner (15). I added the setting of those two labels in the OnReset trigger. In the OnReset trigger I also added code to send a message back to Queue2 to create the first 500 flowitems. In the OnMessage trigger is where the code is to create the flowitems. Then in the OnExit trigger, I check to see how many flowitems are left in the queue. if it has less than or equal to 20% of the original 500 flowitems, it will send a message back to itself to create another 500 flowitems. I wasn't sure if it was supposed to be 20% of 500 left in the queue or 80% left, before restocking. So you might have to change the code in the OnExit trigger in the "Condition" field at the far right from .20 to .80.

In the Combiner, on the Combiner tab of the Properties Window, I changed the combine type to Join. Then in the OnEntry trigger, I added code to set the combiner to retrieve the value in the Queue2 BatchQty label as the amount to join with the flowitem from Queue1.

That's pretty much all that I changed. If you want the restock or batch quantity to change, just change both or either of the labels on Queue2.

If you have any questions or problems, please let us know.

Thanks.

dummy-model-lv1.fsm


dummy-model-lv1.fsm (15.7 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.

Jeff Nordgren avatar image Jeff Nordgren commented ·
@LauraV

One other thing I forgot to mention, In the OnEntry trigger of the Combiner, I have code to make sure that the batch size coming in from Queue2 matches the batch size in the Queue2 BatchSize label.

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.