AnyLogic
Expand
Font size

Class OverheadCraneBridge

All Implemented Interfaces:
AggregatableAnimationElement, HasLevel, LevelElement, LevelMarkup, com.anylogic.engine.markup.material_handling.IMaterialFallible, SVGElement, Serializable

public class OverheadCraneBridge
extends Crane<Agent>
implements com.anylogic.engine.markup.material_handling.IMaterialFallible
See Also:
Serialized Form

Constructor Summary

ConstructorDescription
OverheadCraneBridge() 
OverheadCraneBridge(double bridgeLocation, double trolleyLocation, Color bridgeColor) 

Method Summary

Modifier and TypeMethodDescription
voidattachAgentAnimation(Agent agent)
Attaches agent's position to the hook coordinates.
doubleaverageCycleTime()
Returns average agent operation time in model time units.
doubleaverageCycleTime(TimeUnits units)
Returns average agent operation time in specified time units.
booleancanArriveAt(Point hookDestination)
Returns true if the hook can reach specified point.
booleancontains(double px, double py)
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e.
voiddetachAgentAnimation()
Detaches the agent that was previously attached to hook.
voidfail()
Sets the bridge to failed state
PositiongetAbsoluteHookPosition()
Returns the current absolute hook position as an instance of Position in pixels.
AgentgetAgent()
Returns the agent that have seized the bridge.
List<Agent>getAgentsInQueue()
Returns list of agents that represents bridge's own queue.
ColorgetBridgeColor()
Returns the color of the bridge
PositiongetBridgePosition()
Returns coordinates of bridge's center.
List<OverheadCraneBridge>getBridgesOnRouteTo(Point absolutePoint)
Returns list of bridges that are currently located between the bridge and destination point.
OverheadCranegetCrane()
Returns the crane the bridge belongs to.
doublegetCraneHeight() 
doublegetCraneHeight(LengthUnits units) 
doublegetCurrentBridgeOffset(LengthUnits units)
Returns current bridge offset in specified units (from left to right for crane with zero rotation).
doublegetCurrentHookOffset(LengthUnits units)
Returns current hook height in specified units.
doublegetCurrentTrolleyOffset(LengthUnits units)
Returns current trolley offset in specified units (from top to bottom for crane with zero rotation).
BridgeDirectiongetDirection()
Returns current direction of the bridge.
doublegetDistanceTo(Point absolutePoint, LengthUnits units)
Returns bridge's distance to specified point.
doublegetDistanceToTarget(LengthUnits units)
Returns bridge's distance to current target.
PositiongetHookPosition()
Returns hook's coordinates.
intgetIndex()
Returns bridge index.
doublegetInitialBridgeOffset(LengthUnits units)
Returns the initial offset of the bridge in the specified length units.
doublegetInitialHookOffset(LengthUnits units)
Returns the initial offset of the bridge's hook in the specified length units.
PointgetInitialHookPoint()
Returns the initial hook point in pixels, calculated according to the crane's dimensions and converted to pixels with crane's space.
PointgetInitialHookPoint(LengthUnits units)
Returns the initial hook point in the specified length units.
PointgetInitialHookPoint(Function<Double,Double> meterToPx) 
doublegetInitialTrolleyOffset(LengthUnits units)
Returns the initial offset of the bridge's trolley in the specified length units.
doublegetPriority()
Returns current bridge's movement priority.
CraneProgramgetProgram()
Returns clone of current bridge program.
OverheadCraneBridgeStategetState()
Returns the bridge's current state.
doublegetStatisticsStartTime() 
PointgetTargetPoint()
Returns bridge's target point.
PositiongetTrolleyPosition()
Returns coordinates of trolley's center.
doublegetUtilization()
Returns the bridge utilization: the fraction of time the crane was operating.
doublegetX()
Returns the X coordinate of this crane
PointgetXYZ()
Returns the point location of this element
doublegetY()
Returns the Y coordinate of this crane
doublegetZ()
Returns Z-coordinate of this crane relative to crane's level
booleanisFailed()
Returns true if the bridge is failed and false otherwise.
booleanisReady()
Returns true if bridge is ready to operate, i.e.
voidmoveByProgram(CraneProgram program)
Orders the bridge to move by program.
voidmoveTo(Point absolutePoint, double safeHeight, boolean remainsAtTarget)
Orders the bridge to move to specified point.
intnumberOfAgentsHandled()
Returns total number of agents that have been handled by the bridge.
intnumberOfConflicts() 
voidonFailed()
Calls the bridge's onFailed() callback code
voidonLoading(Agent agent) 
voidonRepaired()
Calls the bridge's onRepaired() callback code
voidonUnloading(Agent agent) 
voidrepair()
Repairs the bridge from failed state
voidresetStats()
Resets the crane utilization statistics.
voidsetBridgeColor(Color bridgeColor)
Sets the specified color of the bridge
voidsetInitialBridgeOffset(double bridgeOffset, LengthUnits units)
Sets the initial bridge position in the specified length units.
voidsetInitialHookOffset(double hookOffset, LengthUnits units)
Sets the initial hook height in the specified length units.
voidsetInitialTrolleyOffset(double trolleyOffset, LengthUnits units)
Sets the initial trolley position in the specified length units.
voidsetX(double x)
Sets the X coordinate of this crane
voidsetXYZ(Point point)
Places the crane into the argument point location
voidsetY(double y)
Sets the Y coordinate of this crane
voidsetZ(double z)
Sets the Z coordinate of this crane
doubletimeInState(OverheadCraneBridgeState state)
Returns total time in model time units spent by the bridge in the given state.
doubletimeInState(OverheadCraneBridgeState state, TimeUnits units)
Returns total time in specified time units spent by the bridge in the given state.
doubletotalDistanceInConflict()
Returns total distance in meters traveled by the bridge in any state while giving way to another bridge.
doubletotalDistanceInConflict(LengthUnits units)
Returns total distance in specified length units traveled by the bridge in any state while giving way to another bridge.
doubletotalTimeInConflicts()
Returns total time in model time units spent by the bridge giving way to other bridges or not moving to avoid collisions.
doubletotalTimeInConflicts(TimeUnits units)
Returns total time in specified time units spent by the bridge giving way to other bridges or not moving to avoid collisions.
doubletotalTransportationDistance()
Returns total distance in meters traveled by the bridge in MOVING_LOADED state.
doubletotalTransportationDistance(LengthUnits units)
Returns total distance in specified length units traveled by the bridge in MOVING_LOADED state.
doubletotalTravelledDistance()
Returns total distance in meters traveled by the bridge including movement in manual mode and situations where the bridge had to give way to another bridge.
doubletotalTravelledDistance(LengthUnits units)
Returns total distance in specified length units traveled by the bridge including movement in manual mode and situations where the bridge had to give way to another bridge.
doubletotalTravellingTime()
Returns total time in model time units that the bridge spent moving for any reason.
doubletotalTravellingTime(TimeUnits units)
Returns total time in specified time units that the bridge spent moving for any reason.

Methods inherited from class com.anylogic.engine.markup.Crane

notifyDirtyState

Methods inherited from class com.anylogic.engine.markup.AbstractLevelMarkup

getDrawMode, getLevel, setLevel

Methods inherited from class com.anylogic.engine.markup.MarkupShape

error, getFullName, getOutsideLevelZ, getPresentable, getSpace, initialize, isClickHandled, isPublic, onClick, remove, setDrawMode, setOwner

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement

initializeInternal, onAggregatorVisibilityChanged, postInitialize

Constructor Details

OverheadCraneBridge

public OverheadCraneBridge()

OverheadCraneBridge

@AnyLogicInternalCodegenAPI
public OverheadCraneBridge(double bridgeLocation,
 double trolleyLocation,
 Color bridgeColor)

Method Details

setBridgeColor

public void setBridgeColor(Color bridgeColor)
Sets the specified color of the bridge
Parameters:
bridgeColor - - specified color of the bridge

getBridgeColor

public Color getBridgeColor()
Returns the color of the bridge
Returns:
color of the bridge

moveTo

public void moveTo(Point absolutePoint,
 double safeHeight,
 boolean remainsAtTarget)
Orders the bridge to move to specified point. Note: this method should not conflict with bridge movement induced by blocks: SeizeCrane, MoveByCrane. Otherwise an exception will occur.
Parameters:
absolutePoint - - the point to move to. Should be accessible by bridge and consider neighbor bridges (see canArriveAt(Point)).
safeHeight - - safe height in meters from crane's Z coordinate. May be negative or even -infinity. If bridge has attached agent, agent's height will be considered automatically.
remainsAtTarget - - set true if you want the bridge to remain it's position while it awaits further commands. Use false if you want the bridge to become idle on target reach. Idle bridges may be pushed by another bridges.

moveByProgram

public void moveByProgram(CraneProgram program)
Orders the bridge to move by program. Note: this method should not conflict with bridge movement induced by blocks: SeizeCrane, MoveByCrane. Otherwise an exception will occur.
Parameters:
program - - program to move crane by. Cannot be null.

getProgram

public CraneProgram getProgram()
Returns clone of current bridge program. The program may be modified. The modifications will not affect the bridge's current program. Returned program may be used for any bridge.
Returns:
clone of bridge's current program

getCrane

public OverheadCrane getCrane()
Returns the crane the bridge belongs to.
Returns:

getBridgesOnRouteTo

public List<OverheadCraneBridge> getBridgesOnRouteTo(Point absolutePoint)
Returns list of bridges that are currently located between the bridge and destination point.
Parameters:
absolutePoint - - destination point. Should be accessible by the bridge. Otherwise an exception will occur.
Returns:
list of bridges that are currently located between the bridge and destination point.

getDirection

public BridgeDirection getDirection()
Returns current direction of the bridge.

Possible values are:

  • FORWARD - bridge is moving forward: offset increases (from left to right for crane with zero rotation)
  • BACKWARD - bridge is moving forward: offset decreases (from right to left for crane with zero rotation)
  • NONE - bridge is still at the moment
Returns:
current direction of the bridge.

getDistanceTo

public double getDistanceTo(Point absolutePoint,
 LengthUnits units)
Returns bridge's distance to specified point. Ignores trolley and hook movement.
Parameters:
absolutePoint - - point in pixels
units - - units to measure distance
Returns:
bridge's distance to specified point.

getDistanceToTarget

public double getDistanceToTarget(LengthUnits units)
Returns bridge's distance to current target. Ignores trolley and hook movement. The same result may be achieved via getDistanceTo(Point, LengthUnits) with getTargetPoint() as destination point.
Parameters:
absolutePoint - - point in pixels
units - - units to measure distance
Returns:
bridge's distance to specified point.

getAgentsInQueue

public List<Agent> getAgentsInQueue()
Returns list of agents that represents bridge's own queue. The list is ordered by priority (from high to low). List is modifiable but changes will not affect real queue.
Returns:
list of agents that represents bridge's own queue.

getCurrentBridgeOffset

public double getCurrentBridgeOffset(LengthUnits units)
Returns current bridge offset in specified units (from left to right for crane with zero rotation).
Parameters:
units - - length units
Returns:
current bridge offset in specified units (from left to right for crane with zero rotation).

getCurrentTrolleyOffset

public double getCurrentTrolleyOffset(LengthUnits units)
Returns current trolley offset in specified units (from top to bottom for crane with zero rotation).
Parameters:
units - - length units
Returns:
current bridge offset in specified units (from top to bottom for crane with zero rotation).

getCurrentHookOffset

public double getCurrentHookOffset(LengthUnits units)
Returns current hook height in specified units.
Parameters:
units - - length units
Returns:
Returns current hook height in specified units.

getState

public OverheadCraneBridgeState getState()
Returns the bridge's current state.

Possible values are:

  • IDLE - the bridge has no tasks, may move to give way another bridge or stay still
  • WAITING - the bridge stays unmovable awaiting further tasks
  • LOADING - the bridge stays unmovable during agent loading in MoveByCrane block
  • UNLOADING - the bridge stays unmovable during agent unloading in MoveByCrane block
  • MOVING_UNLOADED - the bridge moves without any attached agent except movement to its parking position
  • MOVING_LOADED - the bridge moves with attached agent
  • MOVING_HOME - the bridge moves to its parking position
  • FAILED - the bridge stays unmovable awaiting of repairment
Returns:
the bridge's current state.

numberOfAgentsHandled

public int numberOfAgentsHandled()
Returns total number of agents that have been handled by the bridge.
Returns:
total number of agents that have been handled by the bridge.

numberOfConflicts

@AnyLogicInternalAPI
public int numberOfConflicts()

getUtilization

public double getUtilization()
Returns the bridge utilization: the fraction of time the crane was operating. The returned crane utilization value lies in the range [0..1].
Specified by:
getUtilization in class Crane<Agent>

totalTravelledDistance

public double totalTravelledDistance(LengthUnits units)
Returns total distance in specified length units traveled by the bridge including movement in manual mode and situations where the bridge had to give way to another bridge.
Parameters:
units - - length units
Returns:
total distance in specified length units traveled by the bridge including movement in manual mode and situations where the bridge had to give way to another bridge.

totalTravelledDistance

public double totalTravelledDistance()
Returns total distance in meters traveled by the bridge including movement in manual mode and situations where the bridge had to give way to another bridge.
Returns:
total distance in meters traveled by the bridge including movement in manual mode and situations where the bridge had to give way to another bridge.

totalTransportationDistance

public double totalTransportationDistance()
Returns total distance in meters traveled by the bridge in MOVING_LOADED state.
Returns:
total distance in meters traveled by the bridge in MOVING_LOADED state.

totalTransportationDistance

public double totalTransportationDistance(LengthUnits units)
Returns total distance in specified length units traveled by the bridge in MOVING_LOADED state.
Parameters:
units - - length units
Returns:
total distance in specified length units traveled by the bridge in MOVING_LOADED state.

totalDistanceInConflict

public double totalDistanceInConflict()
Returns total distance in meters traveled by the bridge in any state while giving way to another bridge.
Returns:
total distance in meters traveled by the bridge in any state while giving way to another bridge.

totalDistanceInConflict

public double totalDistanceInConflict(LengthUnits units)
Returns total distance in specified length units traveled by the bridge in any state while giving way to another bridge.
Parameters:
units - - length units
Returns:
total distance in specified length units traveled by the bridge in any state while giving way to another bridge.

totalTravellingTime

public double totalTravellingTime(TimeUnits units)
Returns total time in specified time units that the bridge spent moving for any reason.
Parameters:
units - - time units
Returns:
total time in specified time units that the bridge spent moving for any reason.

totalTravellingTime

public double totalTravellingTime()
Returns total time in model time units that the bridge spent moving for any reason.
Returns:
total time in model time units that the bridge spent moving for any reason.

averageCycleTime

public double averageCycleTime(TimeUnits units)
Returns average agent operation time in specified time units. This statistics does not include the bridge's movement in manual mode.
Parameters:
units - - time units
Returns:
average agent operation time in specified time units.

averageCycleTime

public double averageCycleTime()
Returns average agent operation time in model time units. This statistics does not include the bridge's movement in manual mode.
Returns:
average agent operation time in model time units.

timeInState

public double timeInState(OverheadCraneBridgeState state,
 TimeUnits units)
Returns total time in specified time units spent by the bridge in the given state.
Parameters:
state - - one of OverheadCraneBridgeState
units - - time units
Returns:
total time in specified time units spent by the bridge in the given state.

timeInState

public double timeInState(OverheadCraneBridgeState state)
Returns total time in model time units spent by the bridge in the given state.
Parameters:
state - - one of OverheadCraneBridgeState
Returns:
total time in model time units spent by the bridge in the given state.

totalTimeInConflicts

public double totalTimeInConflicts(TimeUnits units)
Returns total time in specified time units spent by the bridge giving way to other bridges or not moving to avoid collisions.
Parameters:
units - - time units
Returns:
total time in specified time units spent by the bridge giving way to other bridges or not moving to avoid collisions.

totalTimeInConflicts

public double totalTimeInConflicts()
Returns total time in model time units spent by the bridge giving way to other bridges or not moving to avoid collisions.
Returns:
total time in model time units spent by the bridge giving way to other bridges or not moving to avoid collisions.

getAgent

public Agent getAgent()
Returns the agent that have seized the bridge.
Returns:
the agent that have seized the bridge.

getPriority

public double getPriority()
Returns current bridge's movement priority. Note current state is principal to say what bridge will push another.
Returns:
current bridge's movement priority.

attachAgentAnimation

public void attachAgentAnimation(Agent agent)
Attaches agent's position to the hook coordinates. Note: the method considers agent's height. The hook should be located in agent's dimensions (width, length, height). Otherwise an exception will occur. Only one agent may be attached to hook. See detachAgentAnimation().
Parameters:
agent - - the agent to attach to hook.

detachAgentAnimation

public void detachAgentAnimation()
Detaches the agent that was previously attached to hook. See attachAgentAnimation(Agent).

getHookPosition

public Position getHookPosition()
Returns hook's coordinates.
Returns:
hook's coordinates.

getBridgePosition

public Position getBridgePosition()
Returns coordinates of bridge's center.
Returns:
coordinates of bridge's center.

getTrolleyPosition

public Position getTrolleyPosition()
Returns coordinates of trolley's center.
Returns:
coordinates of trolley's center.

canArriveAt

public boolean canArriveAt(Point hookDestination)
Returns true if the hook can reach specified point. And false otherwise.
Parameters:
hookDestination - - absolute point in pixels.
Returns:
true if the hook can reach specified point. And false otherwise.

getIndex

public int getIndex()
Returns bridge index. Note: The index is setted on MarkupShape.initialize() call based on bridge's position. The index cannot be changed afterwards.
Returns:
bridge index.

getInitialHookPoint

@AnyLogicInternalAPI
public Point getInitialHookPoint(LengthUnits units)
Description copied from class: Crane
Returns the initial hook point in the specified length units.
Specified by:
getInitialHookPoint in class Crane<Agent>
Parameters:
units - - a constant defining the length units
Returns:
initial hook point in the specified LengthUnits

getInitialHookPoint

@AnyLogicInternalAPI
public Point getInitialHookPoint()
Description copied from class: Crane
Returns the initial hook point in pixels, calculated according to the crane's dimensions and converted to pixels with crane's space.
Specified by:
getInitialHookPoint in class Crane<Agent>
Returns:
initial hook point in pixels

getInitialHookPoint

@AnyLogicInternalAPI
public Point getInitialHookPoint(Function<Double,Double> meterToPx)

getInitialTrolleyOffset

public double getInitialTrolleyOffset(LengthUnits units)
Returns the initial offset of the bridge's trolley in the specified length units.
Parameters:
units - - a constant defining the length units
Returns:
the initial offset of the bridge's trolley in the specified length units.

getInitialHookOffset

public double getInitialHookOffset(LengthUnits units)
Returns the initial offset of the bridge's hook in the specified length units.
Parameters:
units - - a constant defining the length units
Returns:
the initial offset of the bridge's hook in the specified length units.

getInitialBridgeOffset

public double getInitialBridgeOffset(LengthUnits units)
Returns the initial offset of the bridge in the specified length units.
Parameters:
units - - a constant defining the length units
Returns:
the initial offset of the bridge in the specified length units.

setInitialTrolleyOffset

public void setInitialTrolleyOffset(double trolleyOffset,
 LengthUnits units)
Sets the initial trolley position in the specified length units.
Parameters:
trolleyOffset - - the new position of the bridge's trolley
units - - a constant defining the length units

setInitialHookOffset

public void setInitialHookOffset(double hookOffset,
 LengthUnits units)
Sets the initial hook height in the specified length units.
Parameters:
hookOffset - - the new height of the bridge's hook
units - - a constant defining the length units

setInitialBridgeOffset

public void setInitialBridgeOffset(double bridgeOffset,
 LengthUnits units)
Sets the initial bridge position in the specified length units.
Parameters:
bridgeOffset - - the new position of the bridge
units - - a constant defining the length units

fail

public void fail()
Sets the bridge to failed state
Specified by:
fail in interface com.anylogic.engine.markup.material_handling.IMaterialFallible
Specified by:
fail in class Crane<Agent>

repair

public void repair()
Repairs the bridge from failed state
Specified by:
repair in interface com.anylogic.engine.markup.material_handling.IMaterialFallible
Specified by:
repair in class Crane<Agent>

onFailed

@AnyLogicInternalAPI
public void onFailed()
Calls the bridge's onFailed() callback code
Specified by:
onFailed in interface com.anylogic.engine.markup.material_handling.IMaterialFallible
Specified by:
onFailed in class Crane<Agent>

onRepaired

@AnyLogicInternalAPI
public void onRepaired()
Calls the bridge's onRepaired() callback code
Specified by:
onRepaired in interface com.anylogic.engine.markup.material_handling.IMaterialFallible
Specified by:
onRepaired in class Crane<Agent>

isFailed

public boolean isFailed()
Returns true if the bridge is failed and false otherwise.
Specified by:
isFailed in interface com.anylogic.engine.markup.material_handling.IMaterialFallible
Specified by:
isFailed in class Crane<Agent>
Returns:
true if the bridge is failed and false otherwise

isReady

public boolean isReady()
Returns true if bridge is ready to operate, i.e. idle and not failed.
Specified by:
isReady in class Crane<Agent>
Returns:
true if bridge is ready to operate, i.e. idle and not failed

resetStats

public void resetStats()
Resets the crane utilization statistics.
Specified by:
resetStats in class Crane<Agent>

onLoading

@AnyLogicInternalAPI
public void onLoading(Agent agent)
Specified by:
onLoading in class Crane<Agent>

onUnloading

@AnyLogicInternalAPI
public void onUnloading(Agent agent)
Specified by:
onUnloading in class Crane<Agent>

getAbsoluteHookPosition

@AnyLogicInternalAPI
public Position getAbsoluteHookPosition()
Returns the current absolute hook position as an instance of Position in pixels. Also updates animation. Position.rotation contains the rotation of crane.
Specified by:
getAbsoluteHookPosition in class Crane<Agent>
Returns:
current absolute hook point in pixels with the rotation angle as Position.rotation

getCraneHeight

@AnyLogicInternalAPI
public double getCraneHeight()
Specified by:
getCraneHeight in class Crane<Agent>

getCraneHeight

@AnyLogicInternalAPI
public double getCraneHeight(LengthUnits units)
Specified by:
getCraneHeight in class Crane<Agent>

getTargetPoint

public Point getTargetPoint()
Returns bridge's target point. NB: if bridge has no tasks, current hook position will be returned.
Returns:
bridge's target point.

getStatisticsStartTime

@AnyLogicInternalAPI
public double getStatisticsStartTime()
Specified by:
getStatisticsStartTime in class Crane<Agent>

contains

public boolean contains(double px,
 double py)
Description copied from class: MarkupShape
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e. in the same system with the coordinates of this shape, x and y)
Specified by:
contains in class MarkupShape
Parameters:
px - the x coordinate relative to this shape's container
py - the y coordinate relative to this shape's container
Returns:
true if the shape contains the point with the given coordinates

setXYZ

public void setXYZ(Point point)
Description copied from class: Crane
Places the crane into the argument point location
Overrides:
setXYZ in class Crane<Agent>
Parameters:
point - the location that the crane should be placed into

setX

public void setX(double x)
Description copied from class: Crane
Sets the X coordinate of this crane
Overrides:
setX in class Crane<Agent>
Parameters:
x - the X coordinate of this crane

setY

public void setY(double y)
Description copied from class: Crane
Sets the Y coordinate of this crane
Overrides:
setY in class Crane<Agent>
Parameters:
y - the Y coordinate of this crane

setZ

public void setZ(double z)
Description copied from class: Crane
Sets the Z coordinate of this crane
Overrides:
setZ in class Crane<Agent>
Parameters:
z - the Z coordinate of this crane

getXYZ

public Point getXYZ()
Description copied from class: Crane
Returns the point location of this element
Overrides:
getXYZ in class Crane<Agent>
Returns:
the Point object with coordinates of the node

getX

public double getX()
Description copied from class: Crane
Returns the X coordinate of this crane
Overrides:
getX in class Crane<Agent>
Returns:
the X coordinate of this crane

getY

public double getY()
Description copied from class: Crane
Returns the Y coordinate of this crane
Overrides:
getY in class Crane<Agent>
Returns:
the Y coordinate of this crane

getZ

public double getZ()
Description copied from class: Crane
Returns Z-coordinate of this crane relative to crane's level
Overrides:
getZ in class Crane<Agent>