A comprehensive elevator control system implementation in C for Linux, featuring multiple interconnected components that communicate via TCP/IP and POSIX shared memory. The system simulates a real-world elevator network with multiple cars, floor management, and safety protocols.
The system consists of five main components:
- Car (car.c): Controls individual elevator car functionality
- Controller (controller.c): Central scheduling system that manages all elevator cars
- Call Pad (call.c): Simulates floor-level call buttons
- Internal Controls (internal.c): Simulates in-car controls and maintenance functions
- Safety System (safety.c): Monitors elevator conditions and manages emergency protocols
- Multi-car elevator scheduling and coordination
- Destination dispatch system
- Individual service mode for maintenance
- Emergency protocols and safety monitoring
- Floor-to-floor movement simulation
- Door operation simulation with obstruction detection
- TCP/IP based communication between components
- POSIX shared memory for internal car state management
The project uses a Makefile for compilation. To build:
# Build all components
make all
# Build individual components
make car
make controller
make call
make internal
make safety
./car {name} {lowest_floor} {highest_floor} {delay}
name
: Elevator car identifier (e.g., A, B, C)lowest_floor
: Lowest accessible floor (e.g., B2, 1)highest_floor
: Highest accessible floor (e.g., 10)delay
: Operation timing in milliseconds
./controller
Runs on port 3000 and manages elevator scheduling
./call {source_floor} {destination_floor}
Simulates a user calling an elevator from one floor to another
./internal {car_name} {operation}
Operations:
open
: Open doorsclose
: Close doorsstop
: Emergency stopservice_on
: Enable service modeservice_off
: Disable service modeup
: Move up one floor (service mode only)down
: Move down one floor (service mode only)
./safety {car_name}
Monitors elevator safety conditions and manages emergency protocols
-
TCP/IP Communication
- Used between cars and controller
- Used between call pads and controller
- Operates on localhost:3000
- Uses length-prefixed message protocol
-
Shared Memory
- Used between car, internal controls, and safety system
- Named
/car{name}
for each car - Protected by POSIX mutex and condition variables
typedef struct {
pthread_mutex_t mutex;
pthread_cond_t cond;
char current_floor[4];
char destination_floor[4];
char status[8];
uint8_t open_button;
uint8_t close_button;
uint8_t door_obstruction;
uint8_t overload;
uint8_t emergency_stop;
uint8_t individual_service_mode;
uint8_t emergency_mode;
} car_shared_mem;
- Door obstruction detection
- Emergency stop functionality
- Overload detection
- Data consistency checking
- Service mode for maintenance
- Floor range enforcement
- Automatic door operation
- Emergency mode protocols
- Automatic door operation
- Floor-to-floor movement
- Destination dispatch
- Queue-based scheduling
- Manual door control
- Manual floor movement
- Disconnected from controller
- Maintenance access
- Restricted operation
- Manual door control only
- No floor movement
- Safety system monitoring
- Linux operating system
- GCC compiler
- POSIX-compliant system
- TCP/IP networking support
- All floor numbers are in the range B99 to 999
- Floor numbers increase going up (e.g., B2, B1, 1, 2, 3)
- Each car operates in its own shaft
- Destination dispatch system for efficient routing
- Cars can be configured for different floor ranges
- Implements industry-standard safety protocols
- MISRA C guidelines followed for safety-critical components
This project was developed as part of the Systems Engineering unit at Queensland University of Technology.