Acquire Nearest Shared Resource

Acquire Nearest Shared Resource

stan.e.davis
Advocate Advocate
7 Views
4 Replies
Message 1 of 5

Acquire Nearest Shared Resource

stan.e.davis
Advocate
Advocate

[ FlexSim 16.2.0 ]

I am trying to develop a method where resources are acquired in a Process Flow based upon the shared resource's physical distance from the token's referenced flowitem. I see the 'distance' expression field in the shared resources advanced properties. However, since the Puller is the token, it's distance is meaningless to the 3d model. I have been unsuccessful in trying to figure out how to pass a reference to the Puller's item which is in the 3D model and have the 'distance' field calculated on that. I would subsequently incorporate a query sorted by distance ascending.

In the attached model for illustration, I have 3 "A" processors and 3 "B" processors with 1 token in the process flow. After performing "Process B", the token needs to acquire an "A" processor to perform the "Process A-2" subflow. The nearest "A" processor is ProcessorA_1. However, ProcessorA_2 is acquired since it is next on the 'round robin' list.

Thank you

acquire-nearest-processor-in-development.fsm

Accepted solutions (1)
8 Views
4 Replies
Replies (4)
Message 2 of 5

matt_long
Not applicable
Accepted solution

If you need more flexibility, you can always use the List which allows you to change the puller.

To fix your current model, all you need to do is change the way it's calculating the distance value. Instead of doing it based upon the puller, calculate the distance based upon a label on the puller. In the Expression field on the Resource:

treenode value = param(1);
treenode puller = param(2);
treenode entry = param(3);
double pushTime = param(4);


if (!objectexists(puller))
	return -1;

//Use the item instead of the token
puller = getlabel(puller, "item");

updatelocations(puller);
updatelocations(up(value));

....
Message 3 of 5

david_besson
Not applicable

Here's your model adapted to illustrate Matt Long's answer:

3807-acquire-nearest-processor-in-development-a1.fsm

Message 4 of 5

stan.e.davis
Advocate
Advocate

Thanks for the List example.

0 Likes
Message 5 of 5

stan.e.davis
Advocate
Advocate

Yes, that is what I was trying to do. However, I had gone the 'Puller.item' route that didn't work. Thanks

0 Likes