question

Jake avatar image
0 Likes"
Jake asked Jason Lightfoot commented

Batch item only leaves queue after previous item has finished the next task.

Hello,

I'm fairly new to this programme so this may be an easy fix.

For context I'm trying to simulate a section of a cable factory.

The first queue after the source represents a storage carousel where the intention is to stack 2 items (lengths of cable). For this reason I selected LIFO so the top cable will be removed first. However I need the queue to fully empty after it has 2 items stacked (I selected "flush contents between batches" to no avail). I also need the bottom item to wait until the top item has been fully processed by the processor - because in reality the bottom item (length of cable) cannot move until the top item (length of cable) has been fully removed from the storage carousel ie the time taken by the processor (VCV).

I hope this makes sense and someone is able to give assistance.

TIA, Jake

Cable factory.fsm


FlexSim 24.0.2
queue batching
cable-factory.fsm (41.8 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.

Joerg Vogel avatar image Joerg Vogel commented ·

A hint first: one machine holds 2 items. You are better of by 2 machines are holding 1 item each. Merge statistic in calculated tables later.

This tool called FlexSim is event driven by triggers in objects or by activities in process flow.

you can control entry and exit of objects by methods of Flexscript Class API of objects. Suitable methods are close or open input or output.
https://docs.flexsim.com/en/24.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Tree/Object.html#Property-input
You find often templates to edit fields instead of writing a source code script yourself.

0 Likes 0 ·
Jake avatar image Jake Joerg Vogel commented ·
Thank you Joerg, I will review the link attached.
0 Likes 0 ·
Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Jake , was Jason Lightfoot's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jason Lightfoot commented

Here one approach (there are many).

First I would make all the objects with the same behavior instances of the same template just so that you only have to alter the logic on the template and not on each instance.

makeinstancesoftemplate.gif

Then add to the queue template a process finish trigger that adds the item label 'hold' set to 1 on the item below (current.first) and adds a label 'itemBelow' to the top object (current.last) with the value item.first;

Change the sendtoport to return -1 if the label hold is 1. (item.hold?==1) and zero (any port) otherwise:

1710769308254.png

Then on the VCV template object add the 'end collecting'* trigger that sets 'hold' to zero on the item below releases it.

if (item.itemBelow?) {
    item.itemBelow.hold=0;
    releaseitem(item.itemBelow);
}

I've attached the model for moderators to review in case you get stuck and they need something to which they can refer.

*edited was previously and incorrectly 'process finish'


· 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.

Jake avatar image Jake commented ·
Thank you Jason for the detailed response. I am trying to work through the steps of your answer. I have not figured out how to add the process finish trigger on both the queue and the VCV process. Is this something you could maybe expand on?

I couldn't find your attached model to review. I was hoping to reverse engineer it to save me asking potentially stupid questions! :)

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Jake commented ·

Jason probably wanted to say "On End Collecting" trigger for the queue, as queues do not have a Process Finish trigger.

1711093583540.png

And I just realized that I capitalized the label names in the screenshot whereas Jason did not. Make sure that the label names match everywhere they are used as they are case sensitive.

1 Like 1 ·
1711093583540.png (24.9 KiB)
Jake avatar image Jake Felix Möhlmann commented ·

Thanks for the comment Felix.


I have added your suggestions into the programme but the simulation is still not running properly. The main issues are:

1. VCV 3 is no longer being engaged at all

2. The 700T queues are not accepting more than 1 item causing the source to become blocked.

3. The 700T queues also enter a state of what appears to be constant releasing - which is causing the source to become blocked.

The aim is for the 700T queue to build up batches of 2 items, and then LIFO each item should supply the VCV (processor). the bottom item should not exit the queue until the top item has finished the VCV processor.


If anyone has any suggestion I would be extremely grateful.

I've made sure that all labels are worded the same. I'm getting these comments from the system console but unsure how to analyse and debug them.


Label property Type retrieved on /Queue1/Woman. Label does not exist. at MODEL:/Queue1>variables/sendtoport

Property itemBelow not available for Variant with value NULL. Must by a treenode type Variant. at MODEL:/VCV1>variables/processfinishtrigger


cable-factory (1).fsm

0 Likes 0 ·
cable-factory-1.fsm (46.8 KiB)
Show more comments
Show more comments

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.