question

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

How to replicate this model suggeted?

Hello all,

I am having troubles trying to replicate a model that was suggested to me by Regan Blackett in this link and was wondering if anyone could help.

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

From the thread I was able to obtain a model that works like this.

test-13.fsm

Matthew Gillespie then pointed out that I should let the processor pull items of the correct type. I've tried to change the request number in the "yes" side of the decide function to item.Type instead as the value is not important and it should pull all the items in the list but it didn't seem to work.

Also, to ensure the model works correctly, he has also kindly suggested to include the dashboard control widget but while I was able to get the dynamic text and ok button on the dashboard, I can't seem to find the method to write scripts within the code and am unable to find a similar function in the manual. For this model, can I use this for multiple entries in the global table?

treenode edit = getdashboardcontrol("NumVehicles");
int num = getviewtext(edit).toNum();
Table("GlobalTable1")[1][1] = num;
Table("GlobalTable1")[2][1] = num;
... so on and so forth

Could it work this way? Or would I have to write multiple scripts for each row in the global table?

Thanks for reading and hope you could help me with these issues.

FlexSim 20.0.0
process flow pull from listdashboard control widget
test-13.fsm (54.2 KiB)
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
1 Like"
Matthew Gillespie answered Matthew Gillespie commented

You don't want to change the Request Number. That's how many things you want to pull off the list. You still just want to pull 1 thing so leave the request and require number at 1. What you need to change is the Query. Regan's model uses a query to pull only items of a certain type. If you want to pull any type just delete the query. Here's a version of your model with those changes:

test13-working.fsm

For the dashboard controls you put that script in the OnApply field of the Apply button. You can use just one button to update multiple rows of the table if that's what you want. The above model is set up to update both rows 1 and 2 when you hit apply. If you wanted to update rows individually you'd need to split them out into separate buttons. Here's and example with 2 different buttons with one for the first row and another for the second.

test13-working2.fsm


test13-working.fsm (52.9 KiB)
test13-working2.fsm (53.0 KiB)
· 7
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 ·

@Matthew Gillespie

Got it, good to know. Do you know how come the value doesn't ends at 0? I've made adjustments to the model using the one suggested here. But value in the 2nd row just doesn't ends at 0.

26768-test13-working2.fsm

I've been getting this error message:

time: 3264.000000 exception: Error: Invalid triggering event, event rank 1, at wait for event activity "Wait for Event" in "ProcessFlow"

Also, I did not manage to find an Apply button or the OnApply field in the system. From the manual they seemed to lead me to GUI building but it doesn't looks the same as the one you've shown. Or is this a revision of the OK button?

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ JIANYUAN, HALLEY L commented ·

It looks like you just typed a path into the Object field of the second Wait for Event activity. You need to click the sampler and then sample the table cell you want. Here's your model without the error message.

test13-working2-fixed.fsm

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Matthew Gillespie ♦♦ commented ·

You need to use the Model Input widgets in a Dashboard. The Apply button is just a Button widget that I dragged out and rename "Apply". Here's a gif of how I made that edit field work in the dashboard:

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

@JIANYUAN, HALLEY L

This is a little unrelated, but I think you should consider going about this model in a different way.

Resources are perfectly suited for this kind of behavior you are looking for. In this example model, you can input a number of available resources into the global table. Then the process flow uses the max wait timer feature of the first acquire resource to see if it can get one of them in the required time. If it can, it goes to the processor. If not, it goes to the timeout queue.

I think this would be a much easier way to do what you want. For example, if the token needs to acquire two from the resource, you can just set that to the label value of the item that represents how many it needs to pull, and this still allows you to read in the number from an excel sheet.

Here is the example model.

jian.fsm


jian.fsm (38.8 KiB)
· 7
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 I am not quite sure if it answered the few problems that I ran into when trying other ways to simulate the model.

1. During the decide process, processor's max content is not the bottleneck but the value in global table.

2. A problem I ran into was that when global table value hits 0, it would return false and the model could not continue to pull to the processors even after I have to "intervene" by adding value due to expected demand- as others are made to transport the "vehicles" to the station as values in global table.

3. How would the model look like when there are more than one processors to pull the items?

4. From my understanding of the codes, it seems like the process flow sets the value on the item itself, how would this be affected in the codes since item.Type of different values pulls to different processors?

5. Also, depending on the values, using values from the actual2 model. Items with value 7 and 4 would travel from processor1to7, but value 4 would then transfer to processor 7to4 while value 7 would settle in sink7. How would it work in this model? Would I have to specify each processor the items would flow through?

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

@JIANYUAN, HALLEY L

I will try to answer your questions here:

1.The value in the global table in my model is only used to assign the number of resources available in process flow. The number of resources available could still be the bottleneck, but in this example with a short process time it is not. If you turned up the processing time, it would be.

2. You would no longer run into this problem with resources because that is their intended use.

3. It would look similar to whats there, with a chunk of process flow code similar to that one or smaller for the parts of the process.

4. This would not be an issue, process flow can read those labels and decide where to go.

5. No, you would simply assign the destination in a label on the token like you already have, and then tell process flow to move it to its label destination.

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

@Braydn T

Could you elaborate on question 2 further? The reason I mentioned this is because if global table value drops below 1, the processors should not pull at all.

To be able to do this, I would need to write a "decide" logic that pushes item to the acquire token portion of the process flow and it would be conditional decide where table("name")[1][1] >= 1. But where would the items go if the answer is false?

Would I connect to the sink where they wait till 300s? But these items would still move if the value was "changed" to be larger than 1 and at the sink with wait times, it could not be sent out any longer. If I were to loop it, where it ends up at the "decide" logic once more, often times the ageInQueue would not be triggered and wait times would exceed 300s since the items are pulled out of the list, or would this be where using resource would be preferred since it would address this issue?

0 Likes 0 ·
Show more comments