Space markup element Parking Lot element allows you to draw a parking lot at the side of a road.
Parking lot can be parallel (cars are parked in one line) or perpendicular. 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
To draw a
parking lot
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 two alternative options:
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.
Offset from road start
– The distance from the starting point of the road to the starting point of the parking lot, in pixels.
Show name – If selected, the element's name is displayed on the graphical diagram.
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 array of indexes of free parking spaces (0-based).
void setNSpaces(int parkingSpacesCount) - Sets number of parking spaces in parking lot with parkingSpacesCount defining the number of parking spaces in the parking lot.Parameter: parkingSpacesCount - Number of parking spaces in the parking lot
int nCars() - Returns 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.
Parameter: 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).
ParkingLotType getParkingType() - Returns the type of the parking lot. If it returns PARKING_LOT_PARALLEL, the parking lot is parallel, if the function returns PARKING_LOT_PERPENDICULAR the parking lot is perpendicular.
void setParkingType(ParkingLotType parkingType) - Sets type of the parking lot: parallel or perpendicular, depending on the function's argument value.
Parameter: parkingType - Defines the type of the parking lot: pass PARKING_LOT_PARALLEL value to make it parallel, or PARKING_LOT_PERPENDICULAR to make it perpendicular
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.Parameter: units - length unit constant
double 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.
Parameter: units - length unit constant
void setParkingSpaceLength(double parkingSpaceLengthInPixels) - Sets the length of parking space measured in pixels.Parameter: 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.
Parameters:void setParkingSpaceWidth(double parkingSpaceWidthInPixels) - Sets the width of parking space measured in pixels.
parkingSpaceLength - The length of parking space, measured in the given length units
units - length unit constant
Parameter: 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.
Parameters:
parkingSpaceWidth - The width of parking space, measured in the given length units
units - length unit constant
void setVisible(boolean v) -
Sets the visibility of the parking lot.
Parameter: 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.
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.Parameter : units - length unit constant
boolean 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 road the parking lot is adjacent to.
RoadNetwork getRoadNetwork() - Returns road network the parking lot belongs to.
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.