question

Tyler B2 avatar image
1 Like"
Tyler B2 asked Matt Long answered

Decision Point Logic

The goal is to receive 2 red packages to every 1 blue package within sink H. In sink H I have created a Count label to increment on every red and set to 0 with every blue.

At DP5 I was able to stop the red packages from flow when count ==2.

My issue then is nothing I tried could I get DP5 to release the product (when count ==0 again).

Is there a better trigger, object, or method to achieving this?

TBCA Inspection Intermediate.fsm

Thanks for your patience it's my first Sim!

FlexSim 20.1.1
flexsim 20.1.1decision points
· 14
5 |100000

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

Braydn T avatar image Braydn T commented ·

@Tyler B2

I think I am not understanding what you are looking for. I have run through the model a couple times, and after a blue box goes in the sink, 2 red boxes do, unless the first path is blocked up by red boxes and blue boxes can't get through. Could you clarify, or send a gif or the model time of the issue you are seeing?

0 Likes 0 ·
Tyler B2 avatar image Tyler B2 Braydn T commented ·

@Braydn T

My Apologies. I need DP5 to stop the item until my Count label within the sink returns to 0 or perhaps when a blue package passes DP9? I don't have the issue in this model specifically because I used this file as a save point since it 'works'.

The reason why it does not work is due to the fact I have simply delayed DP5 for 35 seconds, but what I actually need is for DP5 to hold the product until another blue package has gone through. If I only use the delay and a process with the blues is altered to finish faster then it's possible I send 2 blues.

You'll see the issue if you change the trigger in DP5 to:

On Arrival: Stop Item:
Condition: Model.find("Sink H").Count==2
Item: item

I didn't send the test file for clarity since my code was beginning to become a garbled mess.

0 Likes 0 ·
Braydn T avatar image Braydn T Tyler B2 commented ·

@Tyler B2

The easiest way to do this without changing how you have modeled so far is to send a message to DP5.

The code to resume an item is this:

Object involved = item;
    involved.up.as(Conveyor).itemData[involved].resume();

But to do this you will need to maintain a reference to the item. I would save the reference to the item as a label of DP5. You can do that in the On Arrival Trigger like this:

if (Model.find("Sink H").Count==2) {
    Object involved = item;
    current.labels.assert("item", item);
    involved.up.as(Conveyor).itemData[involved].stop();
}

that way you can access the item as the label.

I hope that helps!

0 Likes 0 ·
Show more comments
Benjamin W2 avatar image Benjamin W2 commented ·

Hi @Tyler B2, Do you still need help with this?

0 Likes 0 ·
Tyler B2 avatar image Tyler B2 Benjamin W2 commented ·

@Benjamin W2 I went around it, I'd like to know how to make it or something similar work since this type of flow will be used often, but it is not urgent. Thank you!

0 Likes 0 ·

1 Answer

Matt Long avatar image
1 Like"
Matt Long answered

@Tyler B2 There are multiple methods for achieving this. You could have the Sink send a message back to the Decision Point when the Count label hits 0, but this requires the Sink to be aware of the Decision Point and you'll also have to store a label on the Decision Point that references the stopped item.

My preferred methods is to use Process Flow. I've attached a modified version of your model with a small process flow that uses listeners to accomplish your desired result.

DP5 stops the red item when the Sink's Count label is 2 through the On Arrival trigger as before. I also have an Event-Triggered Source in Process Flow listening to the the On Arrival trigger. Each time that trigger is fired, a token is created and a label is assigned to that token that references the item at DP5. The token then checks the value of the Count label and if that value equals 2, then it moves the token through the flow otherwise it discards the token through the Sink.

The Wait for Count = 0 activity is a Wait For Event. It is listening for the Count label on the Sink to equal 0. In order to do this I did have to change the Count label from number data to tracked variable data. That allows you to add a listener to the On Change event of that label. (This can be accomplished by right clicking the Count label and select the menu Assign Data, then click Assign Tracked Variable Data). Alternatively you can listen to the Sink's On Arrival event and perform a similar check as the previous Decide, but the aforementioned method is simpler.

Once the Wait for Count = 0 receives the notification that the Count label equals 0, the token is released and the next activity Resume Item causes the red flow item to be released from DP5.

There are many ways you can use listeners in Process Flow to adjust this logic. For instance, if it was possible for a red flowitem to arrive at DP5 while another red flowitem is on the way to the Sink, you could have Process Flow keep a count of flowitems that have passed DP5 and then stop items when they arrive at DP5 without the Sink's Count label equaling 2.

Hopefully this helps.

tbca-inspection-intermediate-updated.fsm


5 |100000

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