Simulating an Automatic Guided Vehicle (AGV) with Handshake Communication Protocol Using TwinCAT PLC Programming
This repository contains a simulation project for an Automatic Guided Vehicle (AGV), developed within the TwinCAT environment as part of a master's course assignment University West. The assignment involves developing a Human-Machine Interface (HMI) that controls the operation of the AGV by following the specified handshake protocol between the PLC and the AGV. In this project, AGVSimulator.TcVIS
visualization, AGV.TcPOU
Function Block, and Process.TcPOU
were provided by the university. The designed Virtual AGV includes the following functionalities:
- Target Selection and Start: The target location is selected from a drop-down menu on the HMI (PosA, PosB, PosC, PosD, and HOME), and movement is initiated by pressing the Start button. During AGV movement, the target selection is locked and the Start button is disabled to prevent changes or reinitiations.
- Indicator Lamps: The Ready Lamp lights up when the AGV is ready for its next movement, the Stop Lamp lights up when the AGV is stopped, and the Moving Lamp blinks during AGV movement.
- Position Display: The AGV's current position is shown on the HMI while it is stationary at a target location, whereas the display is invisible when the AGV is moving.
- Stop and Reset Functionality: The AGV's movement can be stopped by pressing the Stop button on the HMI. To resume operation after a stop, the Reset button must be pressed, which will return the AGV to its HOME position.
AGV | HMI |
---|---|
The AGV movement is enabled by a specific handshake protocol between the PLC and the AGV, as shown in the following diagram:
- Order Sending: The PLC sets the target position and raises the PLC strobe signal to send an order to the AGV.
- Order Received: The AGV reads the order and acknowledges receipt by raising the AGV strobe signal and setting the answer to 0.
- Send Ready Signal: The PLC lowers the PLC strobe signal, indicating that it is ready for the AGV to proceed.
- AGV Movement Initiation: The AGV lowers the AGV strobe signal (acknowledge strobe) and starts moving to the target position.
- Answer Ready: Once the AGV reaches the target position, it raises the AGV strobe signal again and sets the answer to indicate its current position.
- Answer Received: The PLC acknowledges receipt of the answer by raising the PLC strobe signal and setting the order to 0.
- Order Completion: The AGV completes the handshake by lowering the AGV strobe signal (answer end) and waits for the next order.
-
Download and Install: TwinCAT 3 download | eXtended Automation Engineering (XAE)
-
Clone the repository:
git clone https://github.com/Dalageo/TwinCAT-VirtualAGV.git
-
Navigate to the cloned directory and execute the
TwinCAT Virtual AGV.sln
solution file. -
Navigate to TwinCAT directory and execute Start.bat:
C:/TwinCAT/3.1/Runtimes/UmRT_Default/Start.bat
-
Change the Target System in TwinCAT to UmRT_Default.
-
Visualization Image Pool Setup:
- In the Solution Explorer of
TwinCAT Virtual AGV.sln
, navigate to PLCStudent's VISUs and click on theDisplay.TcIPO
Image Pool. - Set the correct file path for the image ID by navigating to the cloned directory: TwinCAT-VirtualAGV/Image Pool/Display.png.
- In the Solution Explorer of
-
Activate Configuration.
-
Login and Start both 'PLCSim' and 'PLCStudent'.
This project was part of a master course assignment at University West, which provided the AGVSimulator.TcVIS
visualization, AGV.TcPOU Function Block
, and Process.TcPOU
. Special thanks to the professors at University West who contributed to its development.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. It was chosen to prevent commercial use and to promote free access and open collaboration, ensuring any adaptations remain freely available to everyone.
@software{Dalageorgos_TwinCAT-VirtualAGV_2024,
author = {Dalageorgos, Konstantinos},
license = {CC-BY-NC-SA-4.0},
month = jun,
title = {{TwinCAT-VirtualAGV}},
url = {https://github.com/Dalageo/TwinCAT-VirtualAGV},
version = {1.0.0},
year = {2024}
}