I am having two agents, agentA(evStations) (initial location and numbers are loaded from a database), and an AgentB(eVs) (initially empty and the number of agents is specified by the user).
At the model start up, I want to place AgentsB at the locations of AgentA (exact latitude and longitude). How can I do that? Knowing that the number of AgentB is much larger than AgnetA.
What i have tried(based on an existing anylogic example), on the main> Agent actions> On startup
for(EV ev: eVs){
ev.set_lat(
selectFrom(evstations)
.where(evstations.id.eq(ev.getIndex()))
.firstResult(evstations.latitude)
);
ev.set_lon(
selectFrom(evstations)
.where(evstations.id.eq(ev.getIndex()))
.firstResult(evstations.logtitude)
);
ev.setLocation(ev.lat, ev.lon);
}
[enter image description here][1]
i am not sure how to do it correctly, I think this only works if both agents are having the same size. Please advise?
thanks