Skip to content

About

Software-in-the-loop Python conveyor controller with fault handling, emergency-stop logic, automated testing, CSV logging and state visualisation.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Software-in-the-Loop Conveyor Controller

A Python-based software-in-the-loop simulation of an industrial conveyor controller. The project models conveyor operating states, safety interlocks, fault handling and emergency-stop behaviour without requiring physical hardware.

The controller is verified using automated tests, a controlled operating sequence, CSV event logging and a graphical state timeline.

Project objectives

  • Model an industrial conveyor as a finite-state controller.
  • Implement normal start and stop behaviour.
  • Simulate conveyor faults and emergency-stop events.
  • Prevent unsafe restarts while a fault or emergency stop is active.
  • Require a valid reset before operation can resume.
  • Verify controller behaviour using automated tests.
  • Record and visualise the complete simulation sequence.

Controller states

State Description Motor
IDLE System is ready but not operating Off
RUNNING Conveyor is operating normally On
STOPPED Conveyor has been stopped normally Off
FAULT A simulated equipment fault is active Off
E_STOP The emergency stop is active Off

Safety behaviour

The controller applies the following safety rules:

  • A fault immediately stops the motor.
  • An emergency stop immediately stops the motor.
  • Start commands are rejected during FAULT and E_STOP.
  • A reset is accepted only while a fault or emergency stop is active.
  • After a successful reset, the controller returns to IDLE.
  • Every accepted and rejected command is recorded in an event log.

Simulation sequence

The software runs a controlled sequence containing:

  1. System initialisation.
  2. Normal conveyor start.
  3. Fault activation.
  4. Rejected restart during the fault.
  5. Fault reset and successful restart.
  6. Emergency-stop activation.
  7. Rejected restart during the emergency stop.
  8. Emergency-stop reset and successful restart.
  9. Normal conveyor stop.

Simulation results

Conveyor simulation timeline

The upper graph shows the controller state throughout the simulation. Circles represent accepted commands, while cross markers identify rejected restart attempts during unsafe conditions.

The lower graph confirms that the motor is on only while the controller is in the RUNNING state. Both fault and emergency-stop events immediately switch the motor off.

The full sequence is also exported to:

results/simulation_log.csv

Project structure

python-conveyor-controller/
├── conveyor/
│   ├── __init__.py
│   └── controller.py
├── results/
│   ├── conveyor_simulation_timeline.png
│   └── simulation_log.csv
├── tests/
│   └── test_controller.py
├── plot_results.py
├── simulation.py
├── requirements.txt
├── .gitignore
└── README.md

Automated verification

The project contains ten automated tests covering normal operation, fault handling, emergency-stop behaviour, resets and rejected unsafe commands.

Run the tests from the project folder:

python -m pytest -v

Current result:

10 passed

Installation

Python 3.13 or a compatible recent Python version is required.

python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt

Running the project

Run the simulation:

python simulation.py

Generate the results graph:

python plot_results.py

Run the automated tests:

python -m pytest -v

Skills demonstrated

  • Python programming and object-oriented design
  • Finite-state control logic
  • Industrial safety interlocks
  • Software-in-the-loop simulation
  • Fault and emergency-stop handling
  • Automated verification using pytest
  • CSV event logging
  • Engineering data visualisation
  • Technical documentation

Limitations and future work

This is a software-only model and does not currently communicate with physical motors, sensors or a PLC. Future work could include sensor timing, object tracking, additional fault conditions, a graphical control panel and hardware or PLC integration.

A detailed technical report will be added in a future repository update.

Author

Zeyad Eldokmak
BEng (Hons) Electronic Engineering
GitHub: zeyadeldokmak

About

Software-in-the-loop Python conveyor controller with fault handling, emergency-stop logic, automated testing, CSV logging and state visualisation.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages