AnyLogic: How to calculate pedestrian traveled distance? - anylogic

Is there any specific way (except writing functions myself) to calculate traveled distance of a ped object in pedestrian library, something like getDistanceDriven() method in Road Traffic Library?

there is only one way I can think of beyond coding it yourself: use the "Log model execution" functionality. Just click on the database on the project view and tick the box:
.
Then run your model and it will record the distance travelled for each agent in the dbase view "agent_movement_stats_log". Note that you can turn off any of the other logs you don't need...

Related

Make agent face other agent upon MoveTo arrival?

I have a warehouse model where "Picker" agents move along the Y-axis to reach the front of a "picking slot" agent.
I would like to make it so that upon arrival in front of the picking slot, the Picker agents face the picking slot.
I am aware of the "Set rotation upon arrival" feature of the MoveTo blocks, but I am having trouble making sense out of it. What sort of value should I input here?
Is it possible to dynamically define the rotation according the the agents' relative location to each other? If so, how should I go about it? Some of the slots are on the left of the picker, and others on the right.
Thank you.
Please have a look at the Wholesale Warehouse example in the sample models (help section of AnyLogic). There they use agent.agent_image.setRotation(-PI) and then turn it into initial position with agent_image.setRotation(0) You can use this dynamically and with if conditions in your blocks.

track agent movement in anylogic

I am running a pedestrian simulation in Anylogic and want greater granularity in the agent position information that I get at the end of my model. Currently, I have it set up to show a heat map of traffic density, but I would like to trace the actual position of each agent through its time in the model, like a line or trail.
model visualization at the end of a simulation
[1]: https://i.stack.imgur.com/RwCVo.png
Add a cyclic event into your Pedestrian agent type (you cannot use the default pedestrians but must create your own agent type).
Then, every second (or whatever resolution you need), write the pedestrian coordinates (getX and getY) into a dbase table along with its index.
Then, you can do any post-processing that you need.
PS: typically, this is not really necessary, so make sure you really need this ;)

Netlogo simulation how to add gas-station?

I have a smart city simulation project using Netlogo and I need to add a "Turtle Shapes" gas station in the tools but I dont know how can I put it in the street be cause I want the cars that I have in simulation to pass throw and take gasoline my question is how can I add the gas station and calculate the total consomation of gasoline by cars and thanks.
The next image shows the simulation but without gas-station!!
Wow really cool project! Basically you can see the gas station as a particular kind of patch, then if a car touch this patch his energy goes up to maximum. The answer now is: how the car knows where is the gas station? You can do something like that: everyone that pass near the gas station leave a scent of knowledge of where the gas station is and if for example a car is half empty fuel then it starts follow the scent where is more strong and arrives at the gas station. I do this for my ant colony in order to make return them to the nest from every point of the map and it works just fine. Here's my project on github, I just upload it for you

How to make pedestrians appear at AreaNode with attractors from a pedSource

I am working on an evacuation project for a floor and would like to create a distribution of pedestrians from the pedSource block. These pedestrians will already appear in an area when I run the simulation. I want to obtain a fixed number of pedestrians in one area while the rest is distributed to other areas.
I have made a collection of areas that pedestrians will appear using allLocations (area, area1, area2 and OfficeArea). The event is triggered by an event and using a delay block. The max amount of pedestrians at the given floor is 100
Image of block flowchart
Image of floor layout plan
This is the code I tried where pedestrians would appear in the areas:
allLocations.get(uniform_discr(0, allLocations.size()-1))
I expect a fixed 10 number of pedestrians in the office area and positioned where I set the attractors, but the actual result shows more than 10 number of pedestrians and do not appear at the set attractor.
Image of actual result
Setting an attractor as a target for pedestrians is according to the documentation only working for the blocks pedWait and pedGoTo (I could actually only get it to work with pedWait, not with pedGoTo). Therefore you cannot initialize agents directly onto attractors using the initial location or the jumpTo() function.
You have several options as a workaround:
Extract the x,y coordinates of the attractor, and use the type point(x,y) to define the initial location or the location for the jumpTo()
Instead of using (graphical) attractors consider just defining points by code directly
Use very small individual areas instead of one large area with attractors
Use a pedWait block in your process flow and let your pedestrians 'walk' to their initial positions. Give the model a short time until everybody is on the desired location before starting your evacuation. You can also run the model in super fast mode during this initial phase, so that it will barely be visible.

Netlogo - agent travels along the link

I am modelling another project concerning the warehouse operations. In this particular instance, I have to visualize the warehouse layout of the storage space. I plan to define a number of links as routes where the agents (forklift truck) can travel along with in the warehouse.
For each link, there is a distance associated with. It’s not the link length as the distance but a distance attributes user defined. If I set a forklift truck driving speed, how do I reflect it accurately in the model with the use of command like fd (or forward) and jump. How do I specify the unit of measure in jump or fd in association with the distance defined in the link to ensure the forklift truck is moving in a correct distance per tick given the speed and distance.
A simple demo would be highly appreciated! Great thanks!