Jump to content
Simio Forum

Total distance travelled of all vehicles in a system

Recommended Posts

I would like to create a state variable for the total distance travelled of all the vehicles in my system.

In the results tab, for each vehicle the total "DistanceTravelled" has been given after a run.

Is it possible to sum up all these "DistanceTravelled" of all vehicles in a state variable?

(So I can eventually calculate the total fuel costs of the system)

To calculate (sum up) these distances manually takes a lot of time.

Link to post
Share on other sites

In model, define a state variable (the type should be real), i.e., StaMyVehiclesTotalDistanceTraveled. Within model, create a new process from processes tab by using "select process" named "OnRunEnding". Then, place a search step into the process.

In search step set;

1) collection type as entitypopulation. 2) entity type as vehicle1 (absolutely the name of your vehicle). 3) and search expression as Candidate.Vehicle.TotalDistanceTraveled. Also, set limit in advanced options to infinity.

Then, place an assign step after the original branch of the search step and set;

1) state variable as StaMyVehiclesTotalDistanceTraveled. 2) new value as token.returnvalue.

Link to post
Share on other sites
  • Create New...