I'm building a pedestrian model using Anylogic. I have set my agents move in several groups between S2/S3/S4 and S1 (the movement direction is indicated by the blue two-way arrow in the figure). Background picture for problem statement
I have build a cyclic event and type these code in "action" to collect their track data:
t = time(); //get time
for(Agent p: level.getPeds()){
x = p.getX(); //position x
y = p.getY(); //Position y
id = p.getId(); //get pedestrian id
collectionTime.add(t); //add data
collectionID.add(id);
collectionX.add(x);
collectionY.add(y);
Timeid.add(t,id);
XY.add(x,y);
}
I also add these code in "Main-Agent type_Agent actions_On destroy" to write data into excel file:
TrackCollection.writeDataSet(Timeid,1,1,1); //TrackCollection is the name of excel file
TrackCollection.writeDataSet(XY,1,1,3);
But in this way I can only collect all the trajectories together in the model. How can I collect the tracks of these different groups separately? Or how to collect tracks from different PedSources?