int64
int64

Reputation: 91

Access paramters of Anylogic agent population created from db

OK... let me retry the question.

I'll just walk through the steps I (wrongly) assumed would work.

  1. Create a data table in excel with passenger info (id, flight_time, type, class, qty...), note that the table is sorted by id... not flight_time.
  2. Import this database into anylogic.
  3. Create a population of agents (Passenger/Passengers) from the data table (one/row).
  4. Create a schedule that addresses the Start Column as flight_time and Value column as qty (for this job I'm only sending one passenger at a time therefore qty = 1 for each row).
  5. Set the pedSource to arrive according to schedule and to use the Passenger Agent as the New pedestrian.
  6. So here is where I'm losing it. When I run this model the new Passengers do not have any parameters associated from the data table. The pedestrian id is some weird number (say 3000 or so). I can click on the Passengers icon during run time and scroll through the created agents (all of the parameter data is there and correctly assigned), but I'm not sure how to associate the new Agents in the run-time model with the population of Passengers agents.
  7. Am I missing a step here? I was thinking that if I import a population of agents from a data table and then have each show up at a particular time in the model that I could then do some calculations with regard to each such as ped.exitTime = time() - ped.flightTime - ped.bufferTime.

I'm just not understanding why the table data is not available for use during run-time through ped? Is there another mapping step that must be performed to push the data to the ped agnets?

I'm at an impasse at this point. I hope this question is described more clearly and your feedback is appreciated.

Upvotes: 0

Views: 461

Answers (1)

Benjamin
Benjamin

Reputation: 12795

Several things are wrong here.

  1. You do not create agents in a pop first and then try to reuse them in a PedSource. The latter creates agents itself.
  2. You don't seem to create pedestrians but just agents
  3. you are not mapping the data to parameters

Quick guide to help:

  1. create custom agent type "MyPed" . Make sure its "use in flowchart" property is set to "Pedestrian"
  2. add 1 param into "MyPed" for each dbase table column
  3. set your PedSource to "calls of inject()" function for its arrivals
  4. delete your schedule, you cannot get the data you need
  5. USe a DynamicEvent. Include 1 parameter argument for each dbase column. On Startup of main, loop across all dbase entries and create a dynamic event with the current row-data.
  6. in the action of the DynEvent, call myPedSource.inject(1) and then manually fill that ped with the data from the arguments

This is not straightforward, especially the DynEvent stuff. So do more research in the AL help to understand these and how they work, check example models...

Upvotes: 0

Related Questions