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

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.

Related

Anylogic: Is it possible to move Transporters based on travel time, rather than distance and speed?

I would like to use transporters in my model in various places (tugboats, forklifts, reach stackers, trucks, etc.). However, my model paths and animation can't be drawn to scale, detailed explanation in brackets below.
Is there a way I can move the transporter from one node to another based on travel time (similar to what a movable resource can do), rather than speed and distance?
The "Move By Transporter" block does not seem to allow this and I have not been able to find a solution online. Thank you for your help.
(Explanation on why I can't draw to scale: firstly, some destination locations (storage areas, etc.) are not known yet and will just be represented by a travel delay to get there, secondly, different areas of the model will be drawn to different scales, i.e. some network paths will represent a multiple kilometers and some network paths will only represent a few hundred meters, etc.)
You can draw the paths to suit your animation and then simply set the speed of the transporter that gets seized to a speed so that the duration of the movement matches what you need it to be, and when the transporter gets released set the speed back to normal

How to simulate a pickup process happening in the parking lot in AnyLogic?

I am modeling a warehouse yard where trucks arrive, get loaded/offloaded and leave the site. The complexity arises when modeling the drop trailers. Those vehicles consist of two parts: tractor and trailer. Tractor and trailer enter the yard as one entity and move to the parking lot. There, the tractor drops the trailer (turquoise colored rectangles in the picture below) and then then leaves the yard. After some time another tractor (pink colored in the picture below) comes to pick up one of those trailers. When there is no free space in the parking lot, model throws an error, because I use carMoveTo block to send it to the parkingLot. Therefore it requires additional space to move the tractor. How can I avoid this issue? In fact, I do not want that pink tractor to seize a free parking lot, but to pick up one of those trailers. I tried suppressing the error by using "on the way not found" option in the carMoveTo block, but I need to get a close-to-reality animation of the yard.
I would not advise mixing the road traffic library blocks with the Process Modelling Library (PML) Blocks, unless you really need to.
You can get near-perfect animation by making use of a network-type model and just the PML blocks. You will start by replacing your Car Move To block with just a MoveTo block
You can check the WholeSale Warehouse example in AnyLogic.
There they make use of a network diagram and PML blocks to simulation all the relative parking movements of trucks and trailers.
You can do something similar by creating the correct network and node points that indicate how a truck must move when it is parking a trailer and when it is picking up a trailer.
If this solution is not scalable and you cant draw lines, you can always simply just specify the X,Y, Z coordinates.
You might then need multiple MoveTo blocks for the entire movement or you can create some sort of loop where you give a truck a list of locations to move to, the truck will go through the loop and simply execute moving to the next location in the list, until it is done and then continue with the flow chart

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 ;)

Can I make agents go to random attractors using process-modelling library

I can make agents go to "n" number of attractors in an area using the pedestrian library but when I try making agents go to the attractors in a rectangular node area drawn using the process modelling library, I can only make the agents go to one of the "n" numbers of attractors I have drawn. So I want to know is there a way to do the same thing using process modelling library.
Current blocks:
In a moveTo block property, you should specify Attractor as your destination, and not node. And then either put exact static attractor (you should have 'n' moveTo blocki in this case) or better define some logic to determine next attractor dynamically: for example add all your attractors to collection and then specify "randomFrom(collectionName)" as a dynamic value of attractor. In a latter case 1 moveTo block will be enough but you might need to create a loop (with a help of selectOutput object) which will process movement n times.

Creating pedestrians at random after every simulation in a given area

I would like to know if it is possible to create a random distribution of pedestrians at a given area each time I begin my simulation?
enter image description here
Create a Collection named allLocations of type AreaNode that contains all of your possible initialisation areas:
Use a process flow like the following with a PedSource:
Set the Area property in the PedSource to the following:
allLocations.get(uniform_discr(0, allLocations.size()-1))
This code randomly assigns one of the areas in the list to each agent as a start. You can modify this to fit your needs, with other distributions for example.
You can now see how Agents pop up randomly at the different locations:
The example model can be run and downloaded here.