0% found this document useful (0 votes)
49 views54 pages

Projects 2024 Real Time Factory Overview

Uploaded by

meghanaeliz56
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views54 pages

Projects 2024 Real Time Factory Overview

Uploaded by

meghanaeliz56
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

Real-Time Factory

Overview

■ 14.10.2024 ■ 1
Overview
The Manufacturing Model

The Manufacturing Model for Real-Time Data Processing (Room E13)

■ 14.10.2024 ■ 2
Overview
Schematic Overview

Manufacturer: Festo Didactic Sorting Input

Transport
Transport Transport
Outgoing Ingoing
Outgoing
Modules:
2x Input
2x Output (Sorting) Storage

2x Transportation Processing
Processing

4x Work Stations
Storage Processing

Processing

Sorting Input

■ 14.10.2024 ■ 3
Overview
Overview about usage

Usage in courses
• Modules are distributed
between groups
• Each module has to be
programmed individually
and is controlled by its own
controller

■ 14.10.2024 ■ 4
Overview

Loads
RTAI Kernel PhoenixContact
modules Modbus TCP ModbusTCP coupler
for digital/analog I/Os

Industrial PC I/O signals


Development running
PCs RTAI Linux

■ 14.10.2024 ■ 5
Overview

TCP/IP network

■ 14.10.2024 ■ 6
Overview

■ 14.10.2024 ■ 7
Overview

RTAI
Scheduler

RT Process: RT Process: RT Process: RT Process:


Ejector 1 Ejector 2 Ejector 3 Stopper

Sync Sync

Sync

Sync Sync Sync

Inter-Process
Communication
handled by RTAI OS

■ 14.10.2024 ■ 8
Overview

RTAI
Scheduler

RT Process: RT Process: RT Process: RT Process:


Ejector 1 Ejector 2 Ejector 3 Stopper

Sync Sync

Sync

Sync Sync Sync

■ 14.10.2024 ■ 9
Overview
Examples for Parallelity – Module internal

Ejectors Stopper

Slides

■ 14.10.2024 ■ 10
Overview
Examples for Parallelity – Between modules

■ 14.10.2024 ■ 11
Overview
Examples for Parallelity – Between modules

■ 14.10.2024 ■ 12
Real-time Factory
Module: Input

Magazines

In front of Behind Mag 2 1 2 3 Ejector


Mag 2

Pusher
Height Sensor

Slide

■ 14.10.2024 ■ 13
Real-time Factory
I/Os in Input Module

Inputs Bit Sensor


Outputs
0 Magazine 1 Pusher retracted Bit Digital Actuators
1 Magazine 1 Pusher extended 0 Retract Magazine 1 Pusher
2 Magazine 1 empty 1 Extend Magazine 1 Pusher
3 Magazine 2 Pusher retracted 2 Retract Magazine 2 Pusher
4 Magazine 2 Pusher extended
3 Extend Magazine 2 Pusher
5 Magazine 2 empty
4 Extend Ejector
6 Piece behind Magazine 2
5 Retract Magazine 3 Pusher
7 Magazine 3 Pusher extended
8 Magazine 3 Pusher extended
6 Extend Magazine 3 Pusher

9 Magazine 3 empty 7 Conveyor on


10 Ejector retracted
11 Ejector extended
12 Height sensor registered piece
Address Analog Actuator

13 Height sensor measured: Piece is ok 0 Height value


14 Slide full
15 Piece in front of Magazine 2

■ 14.10.2024 ■ 14
Real-time Factory
Module: Distribution Center Input (Input 2)

Magazines
Height Ejector Output
Sensor Conveyor
Main Conveyor

Seperator
Seperator (main)
(side) Slide
Side Conveyor
Magazine 4

■ 14.10.2024 ■ 15
Real-time Factory
I/Os Distribution Center Input (Input 2)

Inputs Bit Address Digital Sensor Bit Address Digital Sensor Address Analog Sensor
0 8002 Conveyor (Side) Piece at end 16 8001 Magazine 3 is retracted 0 Height value
1 8002 Conveyor (Output) Piece at end 17 8001 Magazine 3 is ejected
2 8002 Conveyor (Main) Piece at begin 18 8001 Piece in Magazine 3
3 8002 Conveyor (Main) Piece between Mag 1+2 19 8001 Ejector in right position
4 8002 Conveyor (Main) Piece between Mag 2+3 20 8001 Ejector in left position
5 8002 Conveyor (Main) Piece in front of Ejector 21 8001 Ejector in middle position
6 8002 Seperator (Main) is set 22 8001 Ejector lock is set
7 8002 Seperator (Main) Piece in front 23 8001 Slide full
8 8002 Seperator (Side) is set 24 8001 Height sensor: Piece not ok
9 8002 Seperator (Side) Piece in front 25 8001 Height sensor: Measurement
correct
10 8002 Magazine 1 is retracted
11 8002 Magazine 1 is ejected
12 8002 Piece in Magazine 1
13 8002 Magazine 2 is retracted
14 8002 Magazine 2 is ejected
15 8002 Piece in Magazine 2

■ 14.10.2024 ■ 16
Real-time Factory
I/Os Distribution Center Input (Input 2)

Outputs Bit Address Digital Actuator Bit Address Digital Actuator Address Analog Actuator
0 8012 Stop Conveyor (Main) 16 8011 Move Ejector left 0 Conveyor (Output) Speed
1 8012 Slow down Conveyor (Main) 17 8011 Activte lock in Ejector (Middle pos)

2 8012 Move Conveyor (Main) left


3 8012 Move Conveor (Main) right
4 8012 Turn Conveyor (Side) on
5 8012 Conveyor (Output) backward
6 8012 Conveyor (Output) forward
7 8012 Set Seperator (Main)
8 8012 Set Seperator (Side)
9 8012 Eject Magazine 1
10 8012 Eject Magazine 2
11 8012 Eject Magazine 3
12 8012 Retract Magazine 1
13 8012 Retract Magazine 2
14 8012 Retract Magazine 3
15 8012 Move Ejector right

■ 14.10.2024 ■ 17
Real-time Factory
Module: Processing

Checker Drill

2 3
Ejector A

Ejector B

■ 14.10.2024 ■ 18
Real-time Factory
I/Os in Processing Module

Inputs Outputs

Bit Sensor Bit Actuator

0 Piece in Postion 1 0 Turn drill on

1 Piece in Position 3 (Drill) 1 Turn turntable*

2 Piece in Position 2 (Checker) 2 Move drill up

3 Drill up 3 Move drill down

4 Drill down 4 Lock piece in drill position

5 Turntable in position 5 Extend checker

6 Checker fully extended (Piece OK) 6 Extend Ejector B


7 Extend Ejector A

*turntable only needs impulse to rotate exactly


one position

■ 14.10.2024 ■ 19
Real-time Factory
Module: Sorting

Ejectors Stopper

Slides

■ 14.10.2024 ■
20
Real-time Factory
I/Os in Sorting Module

Inputs Bit Sensor Outputs Bit Actuator


0 Piece arrived 0 Switch Conveyor on
1 Piece is metal 1 Extend Ejector 1
2 Piece is not black 2 Extend Ejector 2
3 Slide 1 full 3 Extend Ejector 3
4 Slide 2 full 4 Open Stopper
5 Slide 3 full
6 Piece reached end of conveyor
7 Ejector 1 retracted
8 Ejector 1 extended
9 Ejector 2 retracted
10 Ejector 2 extended
11 Ejector 3 retracted
12 Ejector 3 extended
13 Piece passed Ejector 1
14 Piece passed Ejector 2

■ 14.10.2024 ■ 21
Real-time Factory
Module: Storage

Directly addressable positions

B
A C

■ 14.10.2024 ■
22
Real-time Factory
I/Os in Storage Module

Inputs Outputs

Bit Sensor Bit Actuator


0 Movement in x position allowed 0-3 X coordinate**
1 Movement in x position done 4 Start movement in x direction
2 Movement in y position allowed 5-8 Y coordinate**
3 Movement in y position done 9 Start movement in y direction
4 Gripper up 10 Move gripper up
5 Gripper down 11 Move gripper down
6 Gripper open 12 Open gripper
7 Gripper closed 13 close gripper
8 Piece under gripper* 14 Allow movement
9 Safety door closed 15 Turn light on
*always senses piece one position right of the **the coordinates are mapped in 4 bits each,
gripper position allowing values between 0 and 15

■ 14.10.2024 ■
23
Real-time Factory
Storage

Bit Actuator
Dec Function 0-3 X coordinate**
0 Reference Position of the linear axis 4 Start movement in x direction
1-9 x/y coordinate 5-8 Y coordinate**
10 Conveyor A 9 Start movement in y direction
11 Conveyor B 10 Move gripper up
12 Conveyor C 11 Move gripper down
13 - 12 Open gripper
14 Single Step in positive direction 13 close gripper
Directly addressable positions
15 Single Step in negative direction 14 Allow movement
B 15 Turn light on
A C

■ 14.10.2024 ■
24
Real-time Factory
Modules: Transportation

Transport Outgoing Transport Ingoing

■ 14.10.2024 ■
25
Real-time Factory
Switches in the Transportation Modules

■ 14.10.2024 ■
26
Real-time Factory
Conveyor belts in the Transportation Modules

Sensors

Direction

Front End

■ 14.10.2024 ■
27
Real-time Factory
Transport Input

Transport Input Conveyor Register Forward Backward


Conveyor Register Piece at
front
Piece
at end

- Conveyors A 8019 0 1 A 8002 0 1


B 8019 2 3 B 8002 2 3
C 8019 4 5 C 8002 4 5
D 8019 6 7 D 8002 6 7
H 8018 4 5 H 8001 4 5

Actuators

Sensors
I 8018 6 7 I 8001 6 7
J 8018 8 9 J 8001 8 9
L 8018 14 15 L 8001 14 15
M 8021 0 1 M 8004 0 1
P 8021 10 11 P 8004 10 11
Q 8021 12 13 Q 8004 12 13
R 8021 14 15 R 8004 14 15
U 8020 8 9 U 8003 8 9
V 8020 10 11 V 8003 10 11

■ 14.10.2024 ■
28
Real-time Factory
Transport Input

Transport Input - Switches

Switch Register Pos In Piece in


Switch Register Ref. Pos 1 Pos 2 Pos 3 reached movement switch
E 8019 8 9 10 11 E 8002 8 9 10
F 8019 12 13 14 15 F 8002 12 13 14
G 8018 0 1 2 3 G 8001 0 1 2
K 8018 10 11 12 13 K 8001 10 11 12
N 8021 2 3 4 5 N 8004 2 3 4
O 8021 6 7 8 9 O 8004 6 7 8
S 8020 0 1 2 3 S 8003 0 1 2
T 8020 4 5 6 7 T 8003 4 5 6
W 8020 12 13 14 15 W 8003 12 13 14

Actuators Sensors

■ 14.10.2024 ■
29
Real-time Factory
Separators in the outgoing Transportation module (inside storage)

Actuators
Separator Set Behind
1 64
Separator 1
2 67
3 70
Separator

Sensors Separator 2
In front
Separator Piece Piece in
behind front
1 65 66 Separator 3
2 68 69
3 71 72

■ 14.10.2024 ■
30
Real-time Factory
Transport Output

Conveyor Register Piece Piece at

Transport Output
Conveyor Register Forward Backward at front end
A 8019 0 1 A 8002 0 1

- Conveyors B 8019 2 3 B 8002 2 3


D 8019 8 9 D 8002 8 9
E 8019 10 11 E 8002 10 11
G 8018 0 1 G 8001 0 1
H 8018 2 3 H 8001 2 3

Actuators

Sensors
I 8018 4 5 I 8001 4 5
K 8018 10 11 K 8001 10 11
L 8018 12 13 L 8001 12 13
N 8021 2 3 N 8004 2 3
O 8021 4 5 O 8004 4 5
P 8021 6 7 P 8004 6 7
T 8020 4 5 T 8003 4 5
U 8020 6 7 U 8003 6 7
V 8020 8 9 V 8003 8 9
W 8020 10 11 W 8003 10 11
■ 14.10.2024 ■ 31
Real-time Factory
Transport Output

Transport Output - Switches

Switch Register Pos In Piece in


Switch Register Ref. Pos 1 Pos 2 Pos 3 reached movement switch
C 8019 4 5 6 7 C 8002 4 5 6
F 8019 12 13 14 15 F 8002 12 13 14
J 8018 6 7 8 9 J 8001 6 7 8
M 8018/8021 14 15 0 1 M 8001/8004 14 15 1
Q 8021 8 9 10 11 Q 8004 8 9 10
R 8021 12 13 14 15 R 8004 12 13 14
S 8020 0 1 2 3 S 8003 0 1 2
X 8020 12 13 14 15 X 8003 12 13 14

Actuators Sensors

■ 14.10.2024 ■
32
ModbusTCP interface
Modbus Address Overview

Starting Address Starting Address


IP of Input of Output Port: 502
Registers Registers Unit Id: 1
Distribution Center Input (DZE) 192.168.200.226 8001 8011

Distribution Center Output (DZA) 192.168.200.228 8001 8009 Read: FC 03 (Read


Input (WE) 192.168.200.230 0 8003
Holding Registers)

Workstation 1 (B1) 192.168.200.231 8001 8003 Write: FC 16 (Write


Workstation 2 (B2) 192.168.200.232 8001 8003 Multiple Holding
Registers)
Workstation 3 (B3) 192.168.200.233 8001 8003

Workstation 4 (B4) 192.168.200.234 8001 8003

Transport In (TWE) 192.168.200.235 8001 8018

Transport Out (TWA) 192.168.200.236 8001 8018

Storage (LAG) 192.168.200.237 0 384

Output/Sorting (WA) 192.168.200.238 0 384

■ 14.10.2024 ■
33
ModbusTCP interface
Setup

Modbus TCP

Modbus TCP
Bus coupler

ModbusTCP
ModbusTCP
Client

Module „Input“

■ 14.10.2024 ■
34
ModbusTCP interface
ModbusTCP

ModbusTCP

• Standard for Data Exchange


• Modbus: Developed for communication between PLCs and
automation devices (Modicon, Schneider) -> field bus
• ModbusTCP: Ethernet-based variation

■ 14.10.2024 ■
35
ModbusTCP interface
ModbusTCP

ModbusTCP – Basics

• Server: Provides data (passive)


• Client: requests data (active)
• Request: message sent from client to server to request data
• Response: server response message following a request
• Coil: Single In-/Output (1 Bit)
• Register: register with multiple in- and outputs (16 Bit) Modbus
Request Server
Modbus
Client
Response

■ 14.10.2024 ■
36
ModbusTCP interface
Coils

ModbusTCP – Coils

Coil Address

0 0

1 1

2 1

...
...
9999 0

■ 14.10.2024 ■
37
ModbusTCP interface
Registers

ModbusTCP – Register
Register SIze: 16 Bit (2 Byte or 1 Word)

Register Address

8001 0 1 1 0 0 1 1 0 1 1 1 0 0 0 1 0

8002 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1

8003 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1

...
...

39999 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1

■ 14.10.2024 ■
38
ModbusTCP interface
Readable Objects

ModbusTCP – Readable Objects

Object Access Size


Coil R/W 1 Bit
Discrete Input R 1 Bit
Holding Registers R/W 16 Bits
Input Registers R 16 Bits

■ 14.10.2024 ■
39
ModbusTCP interface
Function Codes

ModbusTCP – Function Codes

• Function Codes (FC) are transmitted with every request to the server, providing
him information about what to do (e.g. read, write, access to coils, access to
registers, etc.)
• Most important FCs for us:

FC Name Description FC Name Description


01 Read Coils Read n Coils starting at address x 05 Write Single Coil Write 0 or 1 into Coil x
02 Read Discrete Read n discrete Inputs starting at 06 Write Single Write Word (16 Bit) into Holding
Inputs address x Holding Register Register x
03 Read Multiple Read n Holding Registers starting 15 Write Multiple Write n Bits in Coils starting at
Holding Registers at address x Coils address x
04 Read Input Read n Input registers starting at 16 Write Multiple Write n Words (16 Bit each) in
Registers address x Holding Register Holding Register starting at
address x
Read Write

■ 14.10.2024 ■
40
ModbusTCP interface
Connect

ModbusTCP – Step 1: Connecting

Connect Modbus Server


8001 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1
Modbus IP address: 192.168.200.231 8002 0 0 0 0 0 1 0 0 1 1 0 1 0 1 1 1
Port: 502
Client Unit Number: 1
8003 1 1 1 1 0 1 0 1 0 0 1 1 0 0 0 0
8004 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1

■ 14.10.2024 ■ 41
ModbusTCP interface
Read Request

ModbusTCP – Step 2: Request (Read)

Modbus Server
Request
8001 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1
Modbus 8002 0 0 0 0 0 1 0 0 1 1 0 1 0 1 1 1
FC: 03 - Read Multiple Holding Registers
Client Starting Address: 8001 8003 1 1 1 1 0 1 0 1 0 0 1 1 0 0 0 0
Number of Registers: 2 8004 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1

■ 14.10.2024 ■
42
ModbusTCP interface
Read Response

ModbusTCP – Step 3: Response (Read)

Modbus Server
8001 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1
Modbus 8002 0 0 0 0 0 1 0 0 1 1 0 1 0 1 1 1
Client Response 8003 1 1 1 1 0 1 0 1 0 0 1 1 0 0 0 0
8004 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1

Register content =
[0]: 0111010111010101
[1]: 0000010011010111

■ 14.10.2024 ■
43
ModbusTCP interface
Read Response

Modbus Server Phoenix Contact


ModbusTCP
8001 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 Bus coupler
Modbus 8002 0 0 0 0 0 1 0 0 1 1 0 1 0 1 1 1
Client Response 8003 1 1 1 1 0 1 0 1 0 0 1 1 0 0 0 0
8004 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1

Register values =
[0]: 0111010111010101
[1]: 0000010011010111

Module/Asset „Workstation 1“

■ 14.10.2024 ■
44
ModbusTCP interface
Write Request

ModbusTCP – Step 2: Request (Write)

Modbus Server
Request
8001 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1
Modbus 8002 0 0 0 0 0 1 0 0 1 1 0 1 0 1 1 1
FC: 16 - Write Multiple Holding Registers
Client Starting Address: 8003 8003 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Number of Registers: 2 8004 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Register Values =
[0]: 0000000000000001
[1]: 0111010111010101

■ 14.10.2024 ■
45
ModbusTCP interface
Write Response

ModbusTCP – Step 3: Response (Write)

Modbus Server
8001 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1
Modbus 8002 0 0 0 0 0 1 0 0 1 1 0 1 0 1 1 1
Client Response 8003 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
8004 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1
FC: 16 - Write Multiple Holding Registers
Starting Address: 8003
Number of Registers: 2

■ 14.10.2024 ■
46
pyModbusTCP
Overview

pyModbusTCP

• Python library for ModbusTCP communication


• https://pymodbustcp.readthedocs.io/en/latest/quickstart/inde
x.html

■ 14.10.2024 ■
47
pyModbusTCP
Connec

Connecting using pyModbusTCP

Client Lib

Client object IP address Port Unit ID

■ 14.10.2024 ■
48
pyModbusTCP
Read Request

Read request using FC03 with pyModbusTCP

Starting Number of
register registers

Return value is a list! Each element of the list contains a


register value

■ 14.10.2024 ■
49
pyModbusTCP
Test Bit

Helper function „test_bit“

Facilitates testing if a specific bit in a


register is set

Bit to be
Variable to be checked Checked (0-15)

Return Value:
True: Set (1)
False: Not Set (0)

■ 14.10.2024 ■
50
pyModbusTCP
Example Read

■ 14.10.2024 ■ 51
pyModbusTCP
Write Request

Write Request with FC16 and pyModbusTCP

List of register values


Starting to be written
register

Writing with FC16 expects a list as parameter!

■ 14.10.2024 ■
52
pyModbusTCP
Set Bit

Helper function „set_bit“

Facilitates setting a specific bit at


position x in a register

reset_bit( ) does the opposite


Variable where Bit to be
Bit should be set set (0-15?)

Return Value:
Register with bit
Set at desired position

■ 14.10.2024 ■
53
pyModbusTCP
Example Write

■ 14.10.2024 ■
54

You might also like