Make agent face other agent upon MoveTo arrival? - anylogic

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.

Related

Looking for a way to analyse transporter traffic on shopfloor (Density Map) in AnyLogic

I built up a shopfloor where material flow is realized by Transporters (AGV / AMR) with free space navigation. I am looking for a possibility to observe traffic at certain spots (e.g. work stations, storage areas) or even on the whole shopfloor so I can compare different scenarios of the material flow and supply strategy of the working station with a view on the traffic. I tried out the Density Map but since it observes the whole layout which is quite big the values get too low for the scale quite fast so it isn't performing the way I want it to. Is there a way so set up like a "area density map" so I can just observe a defined rectangle or another functionality which could help me here?
Happy about all ideas! :-)
You can use normal Rectangular Node elements and trigger "on enter" code to count drive-throughs or similar, as below.
Just make sure to set the capacity to infinity so normal traffic flow is not interrupted :)

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

How can I control individual pedestrian type agents behavior using statechart in anylogic?

I am trying to do a pedestrian modeling where individual pedestrian agent behavior needs to be controlled. Can I do that using the pedestrian agent's statechart?
Update: Sorry that my initial question wasn't clear enough
main
jaywalker (agent)statechart
runtime screenshot
jaywalker agent from padsource
In the first picture (main) I have a simple pedestrian model where jaywalker (pedestrian agent) moves through 2 road crossing. Initially all the jaywalker agents are in "walking" state & colored yellow (pic: 2), but whenever some agents are near another agent (near means within the triangular shown in jaywalker agent representation), they send the message "HI" to them & socialize. If someone is socialized, then they move from "walker" state to "socializing" state (and turn red) & send messages to others who are within his triangular range("field of vision" triangle). The first 11 socializing is done directly by a message from main (on model startup) & 11 jaywalker agents are receiving it & moving to "socializing" state. The problem is in my graph it's showing the first 11 socializing but during model runtime the agent's color is not changing. Secondly, after those 11 socializing, agents aren't socializing or sending any message to others who are within his triangle.
So, I am confused about how I can make my agents move from one statechart to another while modeling the movement behavior using the pedestrian library. Am I missing any step to connect the pedestrian library & agent statechart?
It looks like you did not tell PedSource to create your custom ped agents of type "JayWalker". Try this:
Delete your population, not needed
Make sure your JayWalker agent type is defined as pedestrians in its properties:
In your PedSource, make sure it creates "JayWalker" agents as below. (You should select JayWalker where my screen selects "MyPed")
Optionally, you can make the PedSource add the created "MyPed" agents to a custom population, but likely not necessary for you.
PS: Please understand that PedSource is creating agents, do not use your population for that. Read some more about PedSource and populations and do some tutorials to understand these basic concepts better :-)

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.

How to define the size (dimension) of an agent on a conveyor

I am quite new with Anylogic.
I am trying to model a simple conveyor system.
I would like my conveyor to accumulate until the conveyed objects touch each other.
I have set the "gap" parameter of the conveyor to zero, but the objects accumulate with a pitch of (apparently) one meter ?
Am I missing something ?
Please have a look to the model:
https://cloud.anylogic.com/model/3af9fc14-8677-4171-9191-52614703bef6?mode=SETTINGS
If you have a custom agent, you can set it to type Material Item (1). You can then set the dimensions at the class level (2), and AnyLogic gives you this nice visual aid to see how big your item is (3). This visual is nice, because then you can draw your shapes for animation purposes to match the size.
This approach would be for components that do not change in size, like pallets or consistent parts in a manufacturing environment. For material items that have varying sizes, like boxes in a DC, I would probably use the source solution Ben suggested.
You can set the size of your agents in several places. Best one for you is likely in the Sourceblock when you create your object agents. Tick the "change dimension" tickbox as below:
In your conveyor, you can override/adjust the length again if you like: