AnyLogic
Expand
Font size

Bridge

Bridge

A simple space markup element that is a part of a complex element Overhead crane.

You can select the bridge in the properties of the SeizeCrane block or the MoveByCrane block to move an agent (material item) to the specified destination.

Properties

General

Name — Name of the bridge. It is used to identify and access the bridge from code and Material Handling Library blocks.

Appearance

Bridge color — The fill color of the bridge. Choose No color, if you do not want the bridge area to be filled.

Position and size

Bridge parking position — Defines the position where the bridge will return after it has been released.

Trolley position — Defines the position where the trolley will return after the bridge has been released.

Functions

You can change the properties of the bridge and control its movement dynamically during the model execution with the help of the following API.

Working state
Function Description
void fail() Models the bridge's failure. The bridge stops working.
void repair() Models the bridge's repair. The bridge returns to working state.
boolean isFailed() Checks whether the bridge is currently broken. If the function returns true, the bridge is broken. If the function returns false, the bridge is in working state.
boolean isReady() Checks whether the bridge is ready to work. If the function returns true, the bridge is in working state. If the function returns false, the bridge is broken.
Priority
Function Description
double getPriority() Returns the priority of the agent that has seized the bridge.
Statistics and utilization
Function Description
double getUtilization() Returns the bridge's utilization: the fraction of time the bridge was operating. The returned value lies in the range [0...1].
int numberOfAgentsHandled() Returns total number of agents that have been handled by the bridge.
OverheadCraneBridgeState getState() Returns the bridge's current state.

Possible values:
IDLE — The bridge doesn't have any tasks and it's not seized by any agent.

WAITING — The bridge is seized by the agent, but this agent is currently moving through any blocks that are not SeizeCrane, MoveByCrane, or ReleaseCrane blocks. Also includes cases where the bridge in manual mode remains at target, executes a programmed delay command, or has finished the program and waits for the next command.

LOADING — The bridge is being loaded with the agent inside the MoveByCrane block.

UNLOADING — The bridge is being unloaded inside the MoveByCrane block.

MOVING_UNLOADED — The bridge is moving without an agent, except moving to the parking position after being released. This state covers moving the bridge without an agent in manual mode and moving to the agent including cases where the bridge has to give way to other bridges with higher priority in process.

MOVING_LOADED — The bridge is carrying an agent including cases where the bridge has to give way to other bridges with higher priority. The state where the bridge has agent animation attached to it also counts.

MOVING_HOME — The bridge is moving to the parking position in automatic mode.

FAILED — The bridge is in the state on failure after the call of fail() function and before the call of repair() function.
double timeInState(OverheadCraneBridgeState state) Returns total time in model time units spent by the bridge in the given state.

state — state of the bridge. Possible values:
IDLE — The bridge doesn't have any tasks and it's not seized by any agent.

WAITING — The bridge is seized by the agent, but this agent is currently moving through any blocks that are not SeizeCrane, MoveByCrane, or ReleaseCrane blocks. Also includes cases where the bridge in manual mode remains at target, executes a programmed delay command, or has finished the program and waits for the next command.

LOADING — The bridge is being loaded with the agent inside the MoveByCrane block.

UNLOADING — The bridge is being unloaded inside the MoveByCrane block.

MOVING_UNLOADED — The bridge is moving without an agent, except moving to the parking position after being released. This state covers moving the bridge without an agent in manual mode and moving to the agent including cases where the bridge has to give way to other bridges with higher priority in process.

MOVING_LOADED — The bridge is carrying an agent including cases where the bridge has to give way to other bridges with higher priority. The state where the bridge has agent animation attached to it also counts.

MOVING_HOME — The bridge is moving to the parking position in automatic mode.

FAILED — The bridge is in the state on failure after the call of fail() function and before the call of repair() function.
double timeInState(OverheadCraneBridgeState state, TimeUnits units) Returns total time in specified time units spent by the bridge in the given state.

state — state of the bridge. Possible values:
IDLE — The bridge doesn't have any tasks and it's not seized by any agent.

WAITING — The bridge is seized by the agent, but this agent is currently moving through any blocks that are not SeizeCrane, MoveByCrane, or ReleaseCrane blocks. Also includes cases where the bridge in manual mode remains at target, executes a programmed delay command, or has finished the program and waits for the next command.

LOADING — The bridge is being loaded with the agent inside the MoveByCrane block.

UNLOADING — The bridge is being unloaded inside the MoveByCrane block.

MOVING_UNLOADED — The bridge is moving without an agent, except moving to the parking position after being released. This state covers moving the bridge without an agent in manual mode and moving to the agent including cases where the bridge has to give way to other bridges with higher priority in process.

MOVING_LOADED — The bridge is carrying an agent including cases where the bridge has to give way to other bridges with higher priority. The state where the bridge has agent animation attached to it also counts.

MOVING_HOME — The bridge is moving to the parking position in automatic mode.

FAILED — The bridge is in the state on failure after the call of fail() function and before the call of repair() function.

units — a constant that defines the time units
double totalTravellingTime() Returns total time in model time units that the bridge spent moving, including situations where the bridge had to give way to another bridge in order to avoid a collision.
double totalTravellingTime(TimeUnits units) Returns total time in specified time units that the bridge spent moving, including situations where the bridge had to give way to another bridge in order to avoid a collision.

units — a constant that defines the time units
double averageCycleTime() Returns average time in model time units between the moment when the bridge starts its movement towards the agent until the moment when the bridge reaches its parking station or is seized by another agent. This statistics does not include the bridge's movement in manual mode.
double averageCycleTime(TimeUnits units) Returns average time in specified time units between the moment when the bridge starts its movement towards the agent until the moment when the bridge reaches its parking station or is seized by another agent. This statistics does not include the bridge's movement in manual mode.

units — a constant that defines the time units
double totalTimeInConflict() Returns total time in model time units spent by the bridge giving way to other bridges or not moving in order to avoid collisions.
double totalTimeInConflict(TimeUnits units) Returns total time in specified time units spent by the bridge giving way to other bridges or not moving in order to avoid collisions.

units — a constant that defines the time units
double totalTravelledDistance() Returns total distance in meters traveled by the bridge for any reason.
double totalTravelledDistance(LengthUnits units) Returns total distance in specified length units traveled by the bridge for any reason.

units — a constant that defines the length units
double totalTransportationDistance() Returns total distance in meters traveled by the bridge while carrying an agent. This includes movement in manual mode and situations where the bridge had to give way to another bridge.
double totalTransportationDistance(LengthUnits units) Returns total distance in specified length units traveled by the bridge while carrying an agent. This includes movement in manual mode and situations where the bridge had to give way to another bridge.

units — a constant that defines the length units
double totalDistanceInConflict() Returns total distance in meters traveled by the bridge in any state while giving way to another bridge to avoid collision.
double totalDistanceInConflict(LengthUnits units) Returns total distance in specified length units traveled by the bridge in any state while giving way to another bridge to avoid a collision.

units — a constant that defines the length units
void resetStats() Resets all statistics of the bridge.
Crane
Function Description
OverheadCrane getCrane() Returns the crane to which this bridge belongs.
void setCrane(OverheadCrane crane) Sets the crane to which this bridge belongs.

crane — crane to which the bridge belongs
int getIndex() Returns the index of the bridge. The index is assigned when the crane is initialized and depends on the initial bridge's position: the bridge that is located the closest to the starting point of the crane's rails has index 0. The bridge's index cannot be changed.
Movement program
Function Description
void moveByProgram(CraneProgram program) Commands the bridge to move according to the specified program.

program — a user-defined program, that describes the movement of the bridge and its components
The call of this function must not coincide with movement of the bridge defined via the SeizeCrane block or the MoveByCrane block. Otherwise, an error will occur.

CraneProgram getProgram() Returns an editable copy of the bridge's current program. Any changes made to this copy do not influence the current program.
Movement
Function Description
void moveTo(Point absolutePoint, double safeHeight, boolean remainsAtTarget) Commands the bridge to move to the specified point absolutePoint with its hook at the specified safe height safeHeight and defines the bridge’s behavior after arriving at the target point: the bridge can either stay there until it receives the next movement command, or it can return to its parking position.

absolutePoint — an object of the Point type that describes the destination where the bridge must arrive
safeHeight — safe height of the hook movement that is calculated from the bridge’s Z coordinate. It can be negative or even infinity. If the bridge has an agent attached, the agent's height is considered automatically.
remainsAtTarget — pass true here to make the bridge remain at the destination point until it receives the next movement command. During this period the bridge's priority becomes the highest possible and none of the other bridges can push it from this position. Alternatively, to make the bridge return to its parking position, pass false.
The call of this function must not coincide with movement of the bridge defined via the SeizeCrane block or the MoveByCrane block. Otherwise, an error will occur.

Point getTargetPoint() Returns the destination point where the bridge moves.
List<OverheadCraneBridge> getBridgesOnRouteTo(Point absolutePoint) Returns a list of bridges that are currently located between this bridge and its destination point.

absolutePoint — an object of type Point that describes the bridge's destination point
BridgeDirection getDirection() Returns the current direction of the bridge movement.

Possible values:
FORWARD — the bridge moves forward, i.e. the offset from the starting point of the crane's rails to the bridge increases
BACKWARD — the bridge moves backward, i.e. the offset from the starting point of the crane's rails to the bridge decreases
NONE — the bridge is immobile
double getDistanceTo(Point absolutePoint, LengthUnits units) Returns the distance from the bridge to the specified point in the specified length units. The movements of the trolley and the hooks are not included.

absolutePoint — an object of type Point that describes the given point
units — a constant that defines the length units
double getDistanceToTarget(LengthUnits units) Returns the distance from the bridge to the current destination point in the given length units. The movements of the trolley and the hooks are not included.

units — a constant that defines the length units
boolean canArriveAt(Point hookDestination) Returns true, if the bridge can physically reach the specified point taking into account other bridges it may have to move on its way. Otherwise, returns false.

hookDestination — an object of type Point that defines the absolute destination point in pixels
Agents (material items) and their animation
Function Description
Agent getAgent() Returns an agent (material item) that has seized the bridge.
List<Agent> getAgentsInQueue() Returns a list of agents (material items) that are currently in the queue to this bridge. The agents are arranged in the list according to their priorities: the agent with the highest priority is at the top of the list and has index 0.
void attachAgentAnimation(Agent agent) Attaches the position of the agent (material item) to the hook's coordinates so that during the model run their animations matched. The agent's dimensions are taken into account. The coordinates of the hook must be inside these dimensions (height, width, and length).

agent — agent (material item) that has seized this bridge
void detachAgentAnimation() Detaches the agent's animation from the hook's animation if they have been attached before via the call of attachAgentAnimation(Agent agent) function.
Bridge's position and components
Function Description
Position getBridgePosition() Returns the bridge's coordinates.
Position getTrolleyPosition() Returns the trolley's coordinates.
Position getHookPosition() Returns the hook's coordinates.
double getInitialBridgeOffset(LengthUnits units) Returns the initial position of the bridge in the specified length units.

units — a constant that defines the length units
void setInitialBridgeOffset(double bridgePosition, LengthUnits units) Sets the initial bridge position in the specified length units.

bridgePosition — an offset from the starting point of the crane's rails to the bridge's initial position
units — a constant that defines the length measuring units
double getInitialTrolleyOffset(LengthUnits units) Returns the initial position of the trolley in the specified length units.

units — a constant that defines the length units
void setInitialTrolleyOffset(double trolleyPosition, LengthUnits units) Sets the initial trolley position in the specified length units.

bridgePosition — an offset from the bridge upper rail to the trolley's initial position
units — a constant that defines the length units
double getInitialHookOffset(LengthUnits units) Returns the initial hook position in the specified length units.

units — a constant that defines the length units
void setInitialHookOffset(double hookPosition, LengthUnits units) Specifies the initial height of the hook in the specified length units.

hookPosition — an offset from the bridge's Z coordinate to the hook’s initial position
units — a constant that defines the length units
double getCurrentBridgeOffset(LengthUnits units) Returns the offset of the bridge from the starting point of the crane's rails to its current position.

units — a constant that defines the length units
double getCurrentTrolleyOffset(LengthUnits units) Returns the offset of the trolley from the crane's top rail to its current position.

units — a constant that defines the length units
double getCurrentHookOffset(LengthUnits units) Returns the offset of the hook from the bridge's Z coordinate to its current position.

units — a constant that defines the length units
Color
Function Description
Color getBridgeColor() Returns the bridge's color.
void setBridgeColor(Color bridgeColor) Sets the bridge's new color.

bridgeColor — bridge's new color.
Visibility
Function Description
boolean isVisible() Checks whether the bridge is visible on the presentation during the model run.
If the function returns true it means the bridge is visible; if false — the bridge is invisible.
void setVisible(boolean v) Sets the bridge's visibility.

v — visibility. If v is true, the bridge will be visible; if false — invisible.
Removal
Function Description
void remove() Removes the bridge from the presentation. If the bridge is not a part of presentation, the function does nothing. Note, that removal from the presentation doesn't necessarily mean removal from the model's logic, since the logical networks and routes could have been specified before the element's removal and aren't affected.
How can we improve this article?