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

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

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

Why does the agent not go to the right attractor?

i have a fork-lifter who takes the item from the truck and stock it in the rectangular node.
The problem is that i want that the fork-lifter stock the agent according to the attractors. Instead, the operator goes in the same point every time. Why?(i did the same with another flowchart and same blocks and there is no problem, maybe a network problem?).
YOu have to manually tell it to which attractor it should go. Attractors are not actual physical spaces (that become "full" if something is stored there). They are just spaces to separate things visually.
In your process blocks, you probably did not specify the attractors correctly or did not define to move to a random attractor. But even in the latter case, you could have things being stored in the same attractor.
Two options:
Either, turn your attractors into actual agents with rectangular nodes, that you setup to be "empty/full" with state charts (faster but harder to design)
Or use the material handling library with its storage system setup, doing this for your (but this is computationally slower)

Strange behaviour in Road Traffic Library

I am noticing some "strange" behaviour in the Road Traffic Library. In my model, I seize and release resources based on the position of a vehicle on the road network. The reason for this is not the issue here but in the model execution, some vehicles seemed to miss the seize step. To try and understand what was happening, I created a very simple model with a simple T-junction. Injecting a car on the vertical leg and moving it straight to the stopline at the intersection and specifying that it must stop before the line before proceeding to the next block which moves the vehicle on the horizontal, works as expected. However, if I put another stopline on the vertical road before the junction and add a carMoveTo block to first move the car to this stopline (but setting it to pass through) and then moving it to the stopline at the junction (set to stop before) the behaviour becomes inconsistent. The outer lane on a 2 lane road works as expected, but on the inner lane, the car overshoots the stopline at the junction and ends up in the intersection even before completing the block.
Can anyone explain why AnyLogic is doing this and how I can ensure that the car stop as specified?
EDIT
I have created a demonstration model in the public AnyLogic cloud at
Road Traffic Demo
Also see below screenshot for an illustration
Without the pass-through stopline the vehicle completes the block in column 2 at zero speed (stop at intersection). With the mass-through the vehicle complete the block in column 2 (carMoveTo1) at speed ~30kph (does not stop at the intersection) - I update the value of the variable "speed" on exit from the relevant block in column 2 using the car.getSpeed(KPH) method.
It seems my question was poorly formulated and what I thought was a self-explanatory example wasn't. However, I think Benjamin actually answered it in his first comment. It seems AnyLogic calculates the vehicle physics one block at a time thus it allows the car to accelerate up to its preferred speed at the pass-through StopLine and then only in the next block determines that it needs to stop at the next line and therefore needs to decelerate. If the pass-through line is too close to the stop line then the car cannot decelerate fast enough and "overshoots" the stop line. I have tested this in the example model by moving the pass-through line further away from the stop line and when far enough away, the car stops as expected with or without the pass-through block.

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.

Falling Sand simulation

I'm trying to re-create a 'falling sand' simulation, similar to those various web toys that are out there doing the same thing - and I'm failing pretty hard. I'm not really sure where to begin. I'm trying to use cellular automata to model the behavior of the sand particles, but I'm having trouble figuring out how to make the direction in which I update the 'world' not matter...
For example, one of the particle types I'd like to have is Plant. When Plant comes in contact with Water, Plant turns that Water particle into another Plant particle. The problem here though is that if I'm updating the game world from top to bottom and left to right, then a Plant particle placed in the middle of a sea of Water particles will immediately cause all of the Water particles to the right and below that new Plant particle to turn into Plants. This is not the behavior I am expecting. =(
One straightforward solution is to not do each iteration in-place. Instead, every time you update the world, create a copy of it... then look at the original, but update the copy. That way the order of updating does not matter any more, because you are completely disregarding your updates while you're looking for particles.
Don't program it in a sequential way (looping over all particles) but use real simulation programming techniques in which every particle is treated as an individual object/agent that obeys the laws of physics and that can act (run) asynchronously and respond to "events" (interactions with other particles).
If making every sand particle a separate object is too fine-grained, then divide the world into small blocks of let's say 1000 particles and simlute the behavior of these blocks instead.