antonio6vieira Posted October 8, 2014 Share Posted October 8, 2014 Hi guys. I have a timer for each entity. I'd like to know the location (object) of each entity whenever its timer is fired. Can somebody give me some clues on how to do this? Thanks. Link to comment Share on other sites More sharing options...
MikeKk Posted October 8, 2014 Share Posted October 8, 2014 How would you want it logged? The easiest would probably to write to a csv file would be by placing a write step on the process executed by the timer's event. The second issue is what would you be logging a x, y, z coordinate, a link name? a station? There would be issues with each of them, being comprehensive may require a quite detailed log. Link to comment Share on other sites More sharing options...
antonio6vieira Posted October 9, 2014 Author Share Posted October 9, 2014 To my problem I don't care about the coordinates (x,y,z). I want to know if the entity is on a specific object of the main model (e.g. Combiner) when the timer it fired. I'm thinking the best approach would be to use a process on the ModelEntity model (triggered whenever the timer is fired) with a decide step with something like: Get(EntityPosition); Decide(EntityPosition== Model.Combiner); Till now I've tried to use the currentNode function and the location.parent on a ModelEntity process but without success... Any help? Link to comment Share on other sites More sharing options...
dsturrock Posted October 9, 2014 Share Posted October 9, 2014 I don't know your objective, but having a timer on every entity seems like an inefficient approach. How about instead having each entity added to a Storage when it enters an area of interest (like a Combiner) and remove it from that storage when it leaves that area of interest. Then at any point in time you could Search through that Storage queue and do what you like with whatever you find there (pick the first, pick the "best", remove them all, ...). Link to comment Share on other sites More sharing options...
antonio6vieira Posted October 9, 2014 Author Share Posted October 9, 2014 My objective is to have entities wait on an input node of a combiner for an event. When the event is fired, the corresponding entity to that event enters the Combiner and does something. That's why I think I need an event for each entity, because each entity is supposed to enter the combiner at different times. Yet, sometimes when the event is fired the entity isn't on the input node of the Combiner (the entity is late) and that is why I need to access (on the ModelEntity) the object where the entity is located (object of the Model). At first I had a global event and entities entered the input node one at a time, but that didn't work because there are situations on which the first entity has to wait and another has to go. I hope I have explained myself correctly :/ Link to comment Share on other sites More sharing options...
Recommended Posts