0
votes

I am trying to calculate the traveled distance of a resource agent throughout the network when accomplishing its tasks.

I tried the functions distanceTo, but they return the Euclidean distance and not the distance traveled through the paths.

I also looked the distance recorded by the model logs in the agen_movement_stats_log and agent_movement_raw_log, but they are erroneously calculated, it takes just a speed*time calculation to realize that the log doesn’t calculates the correct distance traveled. The log calculates just the movements of the resource agent when it doesn’t has an agent attached to it, so in an attempt to get the total distance traveled, I looked for the distance traveled by the agent that was being moved by the resource, but this distance is calculated based on the agent’s speed and not the resource speed regardless of the fact that the agent moves at the resource speed accordingly to its configuration and run time evidence.

Is there any easy way to calculate the total distance traveled by the resource regardless of if it has an agent attached or not?

Thank you.

Only two movements are recorded in the log for the resource: agent_movement_raw_log

The agent being moved gets recorded in the log with its own speed instead of the resource speed (Pala is the attached agent and Extensible is the resource agent):

agen_movement_stats_log

Do the logs have a bug?

1

1 Answers

0
votes

The most flexible and safest way to calculate distances travelled for anything is using system dynamics with a flow and a stock (drawback is that your model becomes a bit slower but you can set up a high time step in your model configuration). The flow is equal to the speed and it will accumulate the distance travelled in the stock.

Your only task in that case is to have the flow fit the speed, meaning that you have to change the value of the flow every time the resource moves or stops moving.

If you have accelerations in your resource you can add another acceleration flow that accumulates speed, and the speed stock connects to the flow I talked about before.

There are other ways, but for detailed stuff, using this is not a bad idea... use constant flow in order to make processing faster as well.