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

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

JakeT
Not applicable
50 Views
9 Replies
Message 1 of 10

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

JakeT
Not applicable

[ FlexSim 24.0.2 ]

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


0 Likes
Accepted solutions (1)
51 Views
9 Replies
Replies (9)
Message 2 of 10

joerg_vogel_HsH
Mentor
Mentor

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#P...
You find often templates to edit fields instead of writing a source code script yourself.

0 Likes
Message 3 of 10

jason_lightfootVL7B4
Autodesk
Autodesk
Accepted solution

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'

0 Likes
Message 4 of 10

Jeanette_Fullmer
Community Manager
Community Manager

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
Message 5 of 10

JakeT
Not applicable
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
Message 6 of 10

JakeT
Not applicable
Thank you Joerg, I will review the link attached.
0 Likes
Message 7 of 10

moehlmann_fe
Explorer
Explorer

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.

Message 8 of 10

JakeT
Not applicable

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
Message 9 of 10

moehlmann_fe
Explorer
Explorer

You removed the header from the On Process Finish trigger so item is no longer a valid variable in your code.

1711129012890.png

0 Likes
Message 10 of 10

jason_lightfootVL7B4
Autodesk
Autodesk
Argh! Thanks @Felix Möhlmann .
0 Likes