Mr.Meeseeks Posted December 28, 2018 Share Posted December 28, 2018 Heya, I am experiencing some difficulties, with something that I would like to model. In short I would like to model the following: One road going from A to B by using a source and a Sink. Only trucks (entities) will be on this road, and they will be able to notice which truck is the most nearby. The truck is looking for another nearby ruck to group up with, and will try to form a couple, "Truck Platooning". Until one of them decides to make a turn to a different destination (passes a node, and decides to move to a different sink). During this time the following truck will safe fuel and thus costs. At the moment I am quite stuck with the following. I would like to make use of the find step and vectors. But there are not that many examples around on how to properly use them. I would like to let the entities update their location.x every second in the vector. Meanwhile the entities will use the findstep to find the nearest entitiy, and select this entity to 'catch-up' with. How do I make a list of these entities, and keep updating their location? Link to comment Share on other sites More sharing options...
CWatson Posted December 28, 2018 Share Posted December 28, 2018 You could use a vector to store the entity locations - you'd have to first give each entity a unique entry into the vector - thus the first entity into the system would use vector[1], etc.. This would only be a reasonable option if the number of entities (trucks) are fixed at a max reasonable number (10, 100, etc.) so the vector could be sized. Efficiency-wise, you may wish to update the entity locations at nodes, as opposed to every x seconds. If you update every x time units, you would need to first use the Search step to search the entities, getting a token for each entity. The vectors can be updated using the entity index into the vector (perhaps store as modelentity.priority if not using priority for any other reason). ModelEntity.Location.X can be used to access the entity location. There is a SimBit titled FindAMinimumState value which describes how to use the Find step with a vector variable. Another option would be to use an output table (depending on your Simio license version) to store/update information on the entity/location. If you have a base model that you have problems running and can share here, please do. Otherwise, send a base model to support@simio.com. Link to comment Share on other sites More sharing options...
Recommended Posts