question

Maryam H2 avatar image
0 Likes"
Maryam H2 asked Maryam H2 commented

Acquire Resources by distance from a fixed point

I'm looking for a way to change resource acquisition in my model via a sorting-based strategy. Currently, the resources are not being selected according even to the order of their names within the resource group. I was thinking if there is a fixed point within my model, like a designated queue position or a specific spot on the floor, would it be possible to acquire resources based on their distance from this fixed point?

A simple model is attached.

Thanks

orderby_contents_oncenter_object (2).fsm

FlexSim 23.2.3
acquire resourcedistanceorder byselect query
5 |100000

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

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Maryam H2 commented

You can look at the distance field for an example. By default this calculates the distance between the value/resource and the puller. You can replace the expression that gets the location of the puller with a static vector and thus compute the distance between the value and those coordinates.

1702481846511.png


1702481846511.png (92.4 KiB)
· 4
5 |100000

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

Felix Möhlmann avatar image Felix Möhlmann commented ·
I also just noticed that you put the query into the "Queue Strategy" field. This is used to determine which puller/token gets to acquire a resource if there are multiple waiting.

For deciding which of multiple resources to pull, use the "Default Query" field or the query field in the Acquire activity (which would override the default query).

0 Likes 0 ·
Maryam H2 avatar image Maryam H2 Felix Möhlmann commented ·

It worked, thanks for the answer! @Felix Möhlmann

I have two questions. First, when I adjust the Expression Field as you said, it still displays as "Straight-Line Distance From Resource to Puller" under Expression. I'm curious about why this differs from what you have in the snapshot. Second, in my resource acquisition query i use two 'ORDER BY' clauses. On occasions when these clauses seem to conflict, I'm wondering how it determines which criterion to prioritize in the sorting task?

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Maryam H2 commented ·
The markup text (line 8 in my screenshot) is what is shown in the field.

The query first sorts by the first value. Ties are broken by sorting by the second value, otherwise the second value is not used.

Something like "ORDER BY content ASC, distance ASC" will choose the resource with the lowest "content" regardless of distance. Only if two or more have the same (lowest) content the distance is also taken into account.

If you want both fields to matter in all cases, you can combine them into a single number and sort by that (for example "ORDER BY (content*2 + distance/10) ASC").

0 Likes 0 ·
Show more comments