API Reference ElevatorProject v0.1.0

Modules

Communicates with the elevator hardware. Delivered as a part of the course TTK4145: Real-time programming.

Finite state machine responible for running one elevator, implemented using the behaviour GenStateMachine. The state machine has the states idle, moving and door_open, and keeps track of the current floor, moving direction, obstructed sensor state and door timer.

Finite state machine responible for running one elevator, implemented using the behaviour GenStateMachine. The state machine has the states idle, moving and door_open, and keeps track of the current floor, moving direction, obstructed sensor state and door timer.

Monitors the state of the floor sensor, and signals ElevatorOperator if the elevator arrives at a floor.

Broadcasts own node name, so that the node can be discovered by other nodes.

Evaluates if the elevator must request a backup, by checking if the node newly connected to the cluster.

Listens for messages from other nodes, and attempts to connect to the cluster upon reception.

Monitors the state of the obstruction switch, and signals ElevatorOperator if the state changes.

Defines the order struct.

Assigns orders to the best suited elevator.

Calculates the cost for the elevator to take a given order, based on the current state of the elevator.

Used to monitor the state of one order button, and signals OrderAssigner if the button is pressed. One poller is started for each button in OrderButtonPoller.Supervisor.

Distributes assigned and completed orders to all elevators in the node cluster. Can also request backup from other elevators in the node cluster, and update Orders accordingly. Upon reception of assigned orders the orders are added to Orders, ElevatorOperator is singalled to take the orders if it is the assigned elevator, watchdog timers are started for hall calls, and order button lights are set. Upon reception of completed orders the orders are removed from Orders, watchdog timers are stopped for hall calls, and order button lights are cleared.

Maintains a set of uniqe orders. Orders with equal button type and floor but different owners are counted as different orders, to be able to keep track of the cab calls of multiple elevators.

If a watchdog timer is started for an order and not stopped before the timeout, the corresponding order gets reinjected into the system by calling OrderAssigner.assign_order/1. Keeps track of all active timers through a map from button type and floor to the timer reference.