question

Martin B3 avatar image
0 Likes"
Martin B3 asked Martin B3 commented

How to Compare and add up Queues content?

Hello,

I´m trying to figure out, how to compare and add up the current content of same ItemType`s in different Queues.

Situation:

A source creates items according to an arrival schedule (additional labels: ItemType, batchsize).

The items run with a defined batchsize into a Queue.

Afterwards, a processor produces good parts and rejects of the same ItemType.

Good parts leave the processor into the “Queue2”, whereas rejects go directly in a “RejectQueue”.

In booth Queues, the items should stay as long as the predetermined batchsize will be produced or the laytime is defined.

  • -closeoutput for ItemTypes in booth Queues
  • -After finishing batchsize of an ItemType, the number of the current items in the Queue and in the RejectQueue should be add up.
  • current batchsize = good parts + reject parts
  • -Following this, the predetermined batchsize shall be compared with the current batchsize.
  • Current batchsize = predetermined batchsize
  • -openoutput if the condition is true
  • else, wait until the batchsize is produced

Please can someone help me out?

Thank you!

FlexSim 17.1.1
content queuereject
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
2 Likes"
Jeff Nordgren answered Martin B3 commented

@Martin B3

It would be helpful to be able to look at your model or a sample model of the part of your model that you need help with. That said, here is code that would loop through two queues and add up a total for a given itemtype.


code.png (26.1 KiB)
· 3
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 ·

@Martin B3

Attached is your model with the changes that I've made.

In your Send To Port logic in Processor1, I did not understand at all. It tells you that it should add up to 100%. I'm not really sure what you are trying to accomplish here but the two entries you have do not add up to 100%. So I changed that code to be a constant 80/20% split. If that isn't right, you may have to change that code. But, I also changed the GoodParts and Rejects global tables to count the number of flowitems in each table. For example, in GoodParts, row 2 would show the total number of good parts of itemtype 2. The same goes for the Rejects table. Again, wasn't sure how you were trying to use these tables so I changed them. I also added a global table called BatchSize with the batch size for each itemtype. That makes it easier to compare itemtypes in the User Command "CheckBatch".

The CheckBatch command is called each time a flowitem enters either of the two queues. It adds up the total for the incoming flowitem's itemtype. If the batch qty has been reach, it calls another User Command called "ReleaseItemType", which will release those itemtypes from both queues.

Take a look at the attached model and see if it is doing what you were wanting it to do. Please let me know if you have any problems or questions.

Thanks.

27062017-jn1.fsm

2 Likes 2 ·
27062017-jn1.fsm (26.1 KiB)
Martin B3 avatar image Martin B3 commented ·

@Jeff Nordgren

Thanks for your help.

I attached a sample model of a part of my model I’m working with. The batchsize of one itemtype should be counted in the queues after processor1. (close queues output, count content)

If the counted number of items matches with the predetermined batchsize of the source for a specific itemtype, the items should leave the queue. Whereas incoming items of another itemtype should be stay in the queue till the condition mentioned above will be fulfilled.

Queue1 and Queue6 are bumpers, which portray the stay time of a batch before processing.27062017.fsm

0 Likes 0 ·
27062017.fsm (19.9 KiB)
Martin B3 avatar image Martin B3 commented ·

@Jeff Nordgren

Thanks a lot, the model is doing what i want quite well.

0 Likes 0 ·