question

Pedro M3 avatar image
0 Likes"
Pedro M3 asked Joseph Gillespie commented

how can i set a time (distribution) for the path that the taskexcuter take?

Hi,

My english is not very good, but i will try to explain. I want to set a time for each path that the task excuter takes; an example from the Node 1 to the Node 2 the time of travel of the task excuter is poisson(...). Here is the model.

test.fsm

FlexSim 18.2.3
network nodes
test.fsm (23.3 KiB)
· 1
5 |100000

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

Joseph Gillespie avatar image Joseph Gillespie commented ·

@Pedro M3

Was my answer helpful for you? Do you have any further questions we can help you with?

0 Likes 0 ·

1 Answer

Joseph Gillespie avatar image
0 Likes"
Joseph Gillespie answered

@Pedro M3

There is currently no easy way to do this in FlexSim, but here is a way to do it by changing the speed of the task executor:

I set up your model so that each time the task executor travels between Node 1 and Node 2 (either direction), the amount of time it takes depends on a poisson distribution. Any other traveling takes a normal amount of time.

First, I added two global variables: StandardMaxSpeed (The speed you had the operator traveling before), and NN1_to_NN2_Distance (the distance between Node 1 and Node2).

I set NN1_to_NN2_Distance in Process Flow using custom code:

double x1 = spatialx(model().find("NN1")).value;
double y1 = spatialy(model().find("NN1")).value;
double x2 = spatialx(model().find("NN2")).value;
double y2 = spatialy(model().find("NN2")).value;


double distance = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
NN1_to_NN2_Distance = distance;

I used these variables later to adjust the task executor's speed to make it take the desired amount of time.

Second, I created custom code to set the task executor's travel speed so that it would travel for the duration determined by the poisson distribution:

double duration = poisson(10.0, getstream(activity));
double travelspeed = NN1_to_NN2_Distance / duration;

variables(model().find("Operator1")).find("maxspeed").value = travelspeed;

Here is the code to set its speed back to normal:

variables(model().find("Operator1")).find("maxspeed").value = StandardMaxSpeed;

Finally, I put the code in process flow, changing the speed of the task executor depending on which path it travels on. Here's an example:

When the task executor arrives at Node 1, the node it is traveling to will be saved as token.Destination. Depending on the destination, the task executor will travel at normal speed or at speed adjusted by the distribution.

This was a long answer, so let me know if you have any questions!

Here is the updated model: taskexecutertimeanswer.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.