In my project, I am using a statechart inside a population of agents named 'vehicle'. There are 5 vehicles. All vehicles have same speed. There is one more agent named 'sender'. Now what happens in my project is, that sender sends different messages to different vehicles. i.e. messages are m1,m2,m3,m4,m5 which are sent to vehicles having id v1,v2,v3,v4,v5. Messages are sent from sender, each time when a cyclic event triggers in the sender.
Lets take an example, when the event triggers in sender, it sends a message m1 to v1. The statechart receives the message m1 and uses it till the finishpoint of statechart. Similarly after a certain interval message m2 is sent to v2 and so on. Each message received is assigned to a variable named 'messageVal' in vehicle agent. Click here to view statechart. Currently it is working fine.
Here is the problem that occurs when I assign different speeds to vehicles.
The statechart for vehicle v1 when is still processing in the middle, while the event in the sender triggers again and sends another message m2 to vehicle v2. In this way, the variable value of 'messageVal' variable for vehicle v1, which should have been m1, becomes m2 now. and so on. Hence, the Results i receive for each vehicle, at the end, are incorrect.
Here is a sample Result:
vehicle=v1, message=m2
vehicle=v2, message=m2
I don't have any problem with the logic behind the event. All I need to know is, that does anyone know any method to allow multiple vehicles that have different speeds, to use statechart simultaneously without the values of ‘messageVal’ variable being altered till statechart's finishpoint?
If there is any confusion in understanding my question, I can further elaborate it. Thankyou.