Space markup element Parking Lot allows you to draw a parking lot at the side of a road.
Parking lot can be parallel (cars are parked in one line), perpendicular, or diagonal. The type of parking lot is set in the Type option of the element.
You can currently draw a parking lot with a single row only. To draw a parking lot with two rows you should draw another road with a parking lot beside it.
You should use CarMoveTo block to model car movement to the parking lot. To model the presence of a car on a parking lot for a certain period of time, the CarMoveTo block should be followed by the Delay block from the Process Modeling Library. As parking lots may accept a number of cars at the same time, you should check the Maximum capacity option in the parameters of the Delay block.
Demo model: Parking Lot Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).To draw a parking lot
- Drag the Parking Lot element from the Space Markup section of the Road Traffic Library palette to the agent
diagram.
A parking lot can be drawn only if the road has been previously drawn.When moving the mouse over the agent diagram, you will see that all other elements but the roads are temporarily hidden.
- Place the mouse cursor beside the road just where you want to place the parking lot. You will see that the parking lot connects to the road. Move your mouse to properly locate the element (the parking lot will adjust its shape to the road’s shape) and release the mouse button when done. The element will be put onto the specified place.
- Switch to the Properties view and set the Type of the parking lot: Parallel, Perpendicular or Diagonal.
- You can change the size of the parking lot by dragging a square handle located on the element’s end with the mouse (the handle is shown when the parking lot is selected). If you do it this way, the parking lot will automatically increase or decrease the number of parking spaces (you can also specify the quantity in the Number of parking spaces property).
- The length of a parking space can be modified in the Length of parking space property. Apart from the length, the width is defined in the Lane width property of the road network (and applies to all road network elements: roads, intersections, etc.).
- You can now specify this parking lot as a destination in the CarMoveTo block simulating car movement to the parking lot.
To adjust position of a parking lot
- Click on the parking lot you need to edit.
-
Drag the parking lot to the desired position on the current road.
You cannot drag the parking lot to another road.Alternatively, you can move it by modifying the Offset from road start parameter in the element’s properties, which will define the exact position of the element.
- General
-
Name — The name of this parking lot. The name is used to identify and access the element from code and Road Traffic Library blocks' properties.
Ignore — If selected, the parking lot is excluded from the model.
Visible on upper agent — If selected, the parking lot is also visible on the upper agent where this agent lives.
Lock — If selected, the parking lot is locked. Locked shapes do not react to mouse clicks — it is impossible to select them in the graphical editor until you unlock them.
Visible — Here you specify whether the shape is visible on animation at model runtime, or not. Using the control, choose yes or no.
Type — Here you can define the parking lot layout scheme. There are three alternative options:
- Parallel — the parking spaces will be put in line with the road.
- Perpendicular — cars will be parked side to side, perpendicular to road.
- Diagonal — parking spaces are arranged at an acute angle to the road. Cars will be parked side to side.
Angle, ° — [Visible and applies only if the Type is Diagonal] The angle at which parking spaces are located to the road, in degrees. You can choose one of the suggested values (30°, 45°, or 60°), or type any other value that lies in the [1, 90] range.
Number of parking spaces — Defines the quantity of parking spaces (one slot per car). The default quantity is 5 spaces.
Length of parking space — Defines the length of the parking space in the length units that you choose from the drop-down list to the right of this field. The default length of the parking space is 6 meters.
Forced exit on timeout — If selected, the car is guaranteed to exit the parking lot within the specified timeout. To exit the parking lot, the car requires enough space on the adjusting road lane. If the car fails to exit the parking lot during the specified time due to intense car flow, on timeout expiry it will suspend the car flow on the adjusting road lane, and exit the parking lot.
Timeout — [Visible and applies if the Forced exit on timeout option is enabled] The timeout for the car trying to exit the parking lot. The car is guaranteed to exit the parking lot within the specified timeout. If the car fails to exit the parking lot during the specified time, on timeout expiry it will suspend the car flow on the adjusting road lane, and exit the parking lot.
- Position and size
-
Offset from road start — The distance from the starting point of the road to the starting point of the parking lot, in pixels.
- Advanced
-
Show in — Here you can choose whether you want the shape to be shown both in 2D and 3D animation, or in 2D only, or in 3D only.
Show name — If selected, the element’s name is displayed on the graphical diagram.
- Parking spaces
-
Function Description int nSpaces() Returns the total number of spaces in this parking lot. int nFree() Returns the number of free parking spaces in this parking lot. int randomFreeSpaceIndex() Returns the index of randomly chosen free parking space. int[] getFreeSpaceIndexes() Returns an array of indexes of free parking spaces (0-based). int getParkingSpaceIndex(Agent car) Returns the index of the parking space where the given car is located (numbering starts with 0). Throws exception if there is no specified car in the parking lot.
car — the car located in the parking lot.void setNSpaces(int parkingSpacesCount) Sets number of parking spaces in parking lot with parkingSpacesCount defining the number of parking spaces in the parking lot.
parkingSpacesCount — number of parking spaces in the parking lot. - Cars
-
Function Description int nCars() Returns the number of cars located on this parking lot. Agent getCarOnSpace(int spaceIndex) Returns car located in the parking space with the given index, or null if this space is free.
spaceIndex — Index of parking space.List<Agent> getCars() Returns ordered list of cars located on this parking lot. The first car in the list is the nearest one to the exit point from parking lot (is the first one to exit the parking lot). - Force exit on timeout
-
In all the actions, the local variable agent refers either to the material item, if the lift belongs to a conveyor network, or a transporter, if the lift is a part of a network.
Function Description boolean isForceLeaving() Returns true if the guaranteed exit mode is switched on for the parking lot. In this mode, the car is guaranteed to exit the parking lot within the specified timeout. To exit the parking lot, the car requires enough space on the adjusting road lane. If the car fails to exit the parking lot during the specified time due to intense car flow, after the timeout it will suspend the car flow on the adjusting road lane, and exit the parking lot. void setForceLeavingEnabled(boolean forceLeavingEnabled) Enables/disables the forced exit on timeout for the parking lot.
forceLeavingEnabled — if true, forced exit on timeout is enabled, if false — notdouble getForceLeavingTimeout() Returns the timeout within which the car is guaranteed to exit the parking lot, in model time units. Note that even if the forced exit mode is switched off, the function will return the current timeout value, but it will not be applied. double getForceLeavingTimeout(TimeUnits units) Returns the timeout within which the car is guaranteed to exit the parking lot, in specified time units. Note that even if the forced exit mode is switched off, the function will return the current timeout value, but it will not be applied.
units — a constant defining the time units.void setForceLeavingTimeout(double timeout) Sets the timeout within which the car is guaranteed to exit the parking lot, in model time units.
timeout — the new forced exit timeout, in model time unitsvoid setForceLeavingTimeout(double timeout, TimeUnits units) Sets the timeout within which the car is guaranteed to exit the parking lot, in specified time units.
timeout — the new forced exit timeout, in the given time units
units — constant defining the time units - Parking type
-
Function Description ParkingLotType getParkingType() Returns the type of the parking lot: parallel, perpendicular, or diagonal.
Valid values:
PARKING_LOT_PARALLEL
PARKING_LOT_PERPENDICULAR
PARKING_LOT_DIAGONALvoid setParkingType(ParkingLotType parkingType) Sets type of the parking lot: parallel, perpendicular, or diagonal, depending on the function’s argument value.
parkingType — Defines the type of the parking lot
Valid values:
PARKING_LOT_PARALLEL
PARKING_LOT_PERPENDICULAR
PARKING_LOT_DIAGONAL - Parking space dimensions
-
Function Description double getParkingSpaceLength() Returns the length of parking space, measured in pixels. double getParkingSpaceLength(LengthUnits units) Returns the length of parking space, measured in the given length units. For example, getParkingSpaceLength(METER) returns the length of parking space measured in meters.
units — length unit constantdouble getParkingSpaceWidth() Returns the width of parking space, measured in pixels. double getParkingSpaceWidth(LengthUnits units) Returns the width of parking space, measured in the given length units. For example, getParkingSpaceWidth(FOOT) returns the width of parking space measured in feet.
units — length unit constantvoid setParkingSpaceLength(double parkingSpaceLengthInPixels) Sets the length of parking space measured in pixels.
parkingSpaceLengthInPixels — The length of parking space, measured in pixels.void setParkingSpaceLength(double parkingSpaceLength, LengthUnits units) Sets the length of parking space measured in the given length units.
parkingSpaceLength — The length of parking space, measured in the given length units.
units — length unit constantvoid setParkingSpaceWidth(double parkingSpaceWidthInPixels) Sets the width of parking space measured in pixels.
parkingSpaceWidthInPixels — The width of parking space, measured in pixels.void setParkingSpaceWidth(double parkingSpaceWidth, LengthUnits units) Sets the width of parking space measured in the given length units.
parkingSpaceWidth — The width of parking space, measured in the given length units.
units — length unit constant - Diagonal parking
-
Function Description int getDiagonalParkingAngle() Returns the angle at which the diagonal parking lot is located to the road, in degrees. void setDiagonalParkingAngle(int diagonalParkingAngle) Sets the angle at which the diagonal parking lot is located to the road, in degrees.
diagonalParkingAngle — the angle, the value should be in the range [30..89] - Visibility
-
Function Description void setVisible(boolean v) Sets the visibility of the parking lot.
v — visibility of the parking lot. If true, parking lot is visible, if false — not visible.boolean isVisible() Returns the visibility of the parking lot. If it returns true, the parking lot is visible, if false — not visible. - Location
-
Function Description double getOffset() Returns distance (in pixels) from the road start to the start of the parking lot. double getOffset(LengthUnits units) Returns distance (in the given units) from the road start to the start of the parking lot.
units — length unit constantboolean isOnForwardSide() Returns true if the parking lot is adjacent to the forward lane, false if it is adjacent to the backward lane. Road getRoad() Returns the road this parking lot is adjacent to. RoadNetwork getRoadNetwork() Returns the road network this parking lot belongs to. - Level
-
Function Description Level getLevel() Returns the level, where this parking lot is located. - Removal
-
Function Description void remove() Removes the parking lot from the presentation. If the parking lot is not a part of presentation, the function does nothing. Note, that removal from the presentation does not necessarily mean removing from the model logic, since logical networks and routes may have been created before the removal and survive it.
-
How can we improve this article?
-