question

JIANYUAN, HALLEY L avatar image
0 Likes"
JIANYUAN, HALLEY L asked Matthew Gillespie commented

What is the best process flow model to resolve this issue?

Hello all,

I am trying to create a model that has 2 queries using process flow. The idea is that when global table value is above 1 (value is keyed in at the start), the item will be sent to processor 1/2 (depending on the value). Else, it would wait in queue 1 until the wait times exceeds 300 seconds, at which, the item will be sent to sink 3.

Which method of approach would be the best to create such a logic? I have tried writing some codes but it didn't seem to work. On a side note, if there are more than 2 processors, is there a way to identify which processor to go to without creating too many "decide" process?

model-6.fsm

FlexSim 20.0.0
process flow
model-6.fsm (34.4 KiB)
· 2
5 |100000

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

Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

If the global table value is 0, does the item always wait 300 seconds and then go to the sink? Or can the item go to a processor if one becomes available during the 300 seconds?

0 Likes 0 ·
JIANYUAN, HALLEY L avatar image JIANYUAN, HALLEY L commented ·

@Matthew Gillespie

The item can go to a processor if it becomes available during the 300 seconds. Not sure if it is possible, but can it be done on a first come first serve basis?

0 Likes 0 ·
Regan Blackett avatar image
2 Likes"
Regan Blackett answered Matthew Gillespie commented

I took an attempt at what I think you are looking for in the attached model. I had to make some changes to a couple of things vs. the way you had it set up.

First I moved all the List interaction to Process flow rather than using Global Lists.I also removed your Port Connections from Queue1 to the Processors and will handle moving Flowitems using the List behavior. I assumed that any Flowitems with Type 1 Goes to Processor 1 and Type 2 to Processor 2. I also changed your Global Table value datatype from a simple number to a Tracked Variable.I’ll explain why below.

Based on your description of the desired behavior, it sounds like Flowitems on the List will wait for a Puller basically forever unless the Global Table value is 0 or less, at which point the 300 seconds wait time kicks in. Normally, you could use the Max Wait Timer property on the Push to List activity to start the clock before things get moved to the Sink. However, since your wait timer doesn’t kick in until the Table value hits zero, I don’t think it will quite that easy.

So in my model I set up a simple Process Flow set of activities that functionally allows the Tokens that represent Processors to act as pullers from the List, and Tokens that represent the Flowitems to be pushed. Both sets of Tokens have a Type Label for the Query and the Entries have an age-field so you can know how long they have been on the List.

Then I set up another puller that will look for Flowitems that have been waiting for 300 seconds or more, but only if the Global table value is 0 or less. To know the value of the Global Table value, I use a Wait for Event activity that listens for the Global Table value to “decrease to or through” 0 and to Fire if “initial value meets rule”. This event is only available if the cell data type is a Tracked Variable.

When the Global table value reaches 0, the puller can pull from the List Where age >= 300. To make this work the way you want I also set a Backorder property of the list to reevaluate all list values on push, so that when the puller becomes a back order it can re-query everything on the list whenever something new is pushed.

I hope this is what you were looking for, let us know if this isn’t quite it.

early-release-on-table-value-reached.fsm


· 13
5 |100000

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

JIANYUAN, HALLEY L avatar image JIANYUAN, HALLEY L commented ·

@Regan Blackett

The model is brilliant and it can work! Thanks for your help!!!

Haha, it will do. I'm more worried about my ability to get it working in the actual model. But the logic is simple and clear, it would be more of an error on my part if there's an issue.

Btw, would the statistics collectors: AgePlot be involved in any of the process flow activities? I don't think I saw it being referenced when I was reviewing the code.

1 Like 1 ·
Regan Blackett avatar image Regan Blackett ♦ JIANYUAN, HALLEY L commented ·

The Stats collector was jsut for me, to see what the Ages of Flowitems were even after they left the list. Verification was all.

0 Likes 0 ·
JIANYUAN, HALLEY L avatar image JIANYUAN, HALLEY L Regan Blackett ♦ commented ·

@Regan Blackett

Thanks for the clarification!

However, as I'm trying to replicate the model in a test run, but there seems to be some issue with the pulling of the items to the processors. Could you help to take a look? I've listed the items in the various groups but it didn't seem to work.

Also, is it necessary to include "Wait for Event: Content of Processors Less Than 100"? It seems kind of redundant as the number of contents in the processor is not the limiting factor.

Lastly, there is a serious issue with the model suggested as the model only allows for one run. What I mean by this is if the value in global table hits zero, even if I stop the model running and increases the value in the global table, the items in the queue no longer gets pulled by the processors. Do you know what might be causing this? Could it be due to the tracked variable option?

test-13.fsm

26646-early-release-on-table-value-reached-5.fsm

0 Likes 0 ·
Show more comments
JIANYUAN, HALLEY L avatar image JIANYUAN, HALLEY L commented ·

Hello @Regan Blackett,

Wow, this has got to be the most complex one I've seen. I believe that this could work for the model but it seems that it doesn't follow the value presented in global table?

From the Early Release Monitoring part, there's a part that writes decrease to or through value (ie 0) in the event triggered source. However, even when the global table value hits 0, it doesn't seems to register and items are still being sent to the processors. Also, I am unable to edit the values in the global table even when I've stopped running the program. This is important as I would need to determine where to transport the "vehicles" (value in global table) to another queue "station" that needs it more (this can be done manually by looking at excel sheet so it wouldn't be in the model itself).

May I know if ItemList1 is being involved in the process flow activities? I didn't seem to notice it in the codes and wondered if I missed anything.

0 Likes 0 ·
Regan Blackett avatar image Regan Blackett ♦ JIANYUAN, HALLEY L commented ·

The Global Lists don't do anything. It's all in the local process flow list. You can safely delete the ItemList and the FRList.

I gave the tracked variable an initial value of 5. When you click on the cell use the "Edit" button to change the value. Tracked Variables are special this way.

Items are still going to the processors because their ages haven't hit 300+ yet. You don't want all boxes to go to the sink if any one item has an age of 300+ right?

Watch the input statistic to the sink; or open the table for the the Statistics Collector in the model and it will show you the times and ages of items that are sent to the sink.

0 Likes 0 ·
JIANYUAN, HALLEY L avatar image JIANYUAN, HALLEY L Regan Blackett ♦ commented ·

But from the List: Available Processor, it is referencing the FR list.

Oh, I see, how would I go about adding the tracked variables to the global lists? Does it work if I have more than one row?

Really sorry, I didn't get paragraph 3. If there is not enough "vehicles" (value in original global table), people (items) can't move to their destination, so they will wait in queue. When queue time gets long (ie >300s) they will fall out of queue and find other modes of transport (via sink 3). Therefore, items can't go to processors as there isn't any vehicle needed to move to the destination.

Oh, I missed the max content in the processors, it should not be the bottleneck of the model, it is not limited in the model and could go up to a 100 if it matters.

0 Likes 0 ·
Show more comments
Braydn T avatar image
1 Like"
Braydn T answered JIANYUAN, HALLEY L commented

@JIANYUAN, HALLEY L

When an item enters Queue1 it adds the item to a list and when it leaves Queue1 it decrements the counter. The counter only increments when an item goes into the sink. How would the counter ever go over 1? what does the counter represent?

You can do a timeout on a pull from list. If you do an event triggered source on entry to the queue, and then try and pull from the list, you can have a timeout that will assign a label if it is unable to pull in that time. Perhaps you could use the list to represent what you are doing with the counter, instead of representing items. You could have a decide after the pull from list that would check and see if the timeout label has a certain value, and if it does, send it to the sink. Otherwise, you could send it to the processors.

As far as selecting a different processor, you can assign that destination in a label and send the item to the destination in that label. You would just have to have some other process flow block higher up in your flow that assigned a destination label.

Please let us know what the counter represents and what you are trying to achieve, so we can help you better.

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

JIANYUAN, HALLEY L avatar image JIANYUAN, HALLEY L commented ·

@Braydn T

Hello! The idea is that the number would be keyed into the system using an excel sheet, so it couldn't be "seen" within the model itself but would be keyed in before running. The counter in global table represents a "vehicle" the person is able to take and the items are actually "people" arriving at the station. Therefore, each queue "station" will have a certain number of vehicles and as people move to the station they will receive their vehicle and could move to their destination.

I've decided to make "sink2" incrementing counter at global table to simulate how it will be like if other stations' vehicle arrives at the this station.The different sources is to test and ensure that the model could would work with various sources coming in and moving to the different destination.

For the timeout process, may I know how is it different from the one I'm doing previously? From the link below, I've tried having 2 item pulls which didn't work as one item pull is constantly "hogging" the items within the process itself and I can't measure ageInQueue to pull to the sink. The reason I thought of not sending it back to the list is because "vehicles" could arrive and the people could move so it constantly needs to be tested to see if the vehicles did arrive. I tried changing it in this model but it doesn't seem to work as well since I seem to make it constantly pulled and pushed out of the global list and am unable to obtain the time in queue.

https://answers.flexsim.com/questions/81044/what-is-the-best-process-flow-model-to-resolve-thi.html

For selecting a different processor, may I know if it will works if it could travel over 2 or more processors to arrive to its destination? Or could I use port to case on the processor to make life easier?

This whole model is trying to replicate a system where people would receive a vehicle to allow it to move and if waiting time gets long they would leave. It is designed to obtain information about how many consumer would it be able to serve, waiting times and length of total process timing (including waiting times).

I would also need to "key in" number of vehicles during different time of the day (within the global table as a counter) to simulate if one station has too many consumer to serve and other stations has to provide the vehicle for this station.

Sorry for the long read and hope you can understand what I'm trying to achieve.

0 Likes 0 ·
Braydn T avatar image Braydn T JIANYUAN, HALLEY L commented ·

OK, I think I would still use a list to represent the vehicles, that way you can take advantage of the timeout. I would have a process flow that runs on model start that fills the list with the number populated in the global table. Then when a person arrives in the queue, an event triggered source fires and tries to pull from the list. If it hits 300, it times out, you send it through the decide to move the item through the sink. If it successfully pulls, it goes down the other leg of the decide to be moved through the processors.

If you know the path an item is going to take from the beginning, you can have them assigned in labels at the beginning, for example token.destination1, token.destination2, etc. If its dynamic, you can assign those in a custom code block at run time.

0 Likes 0 ·
JIANYUAN, HALLEY L avatar image JIANYUAN, HALLEY L Braydn T commented ·

I've got a few question with this model, if I need to edit the number of vehicles throughout the day, I am able to do so using the list?

From my understanding of the design, the number in one list represents the vehicle, as a person arrives it pulls the vehicle from list and moves. However, the people arriving will be in another list that pulls once it hits 300 s. Why would I use decide to move item to the sink since when it pulls after 300s, it should go directly to the sink?

As for the paths, I've actually set an "On Creation" trigger that labels each token, how should I refer to them in the process flow ? Like this: item.label.destination.value == 1 and item.label.destination.value == 2 to represent the port?

0 Likes 0 ·