Deadlock situation and missed products

15
Sometimes, deadlocks in PC supported automation systems can be a real headache if it designed poorly. When a deadlock occurs, system stops by making it impossible to free up without intervention. 1 2 3 Boxes move this way Assume that we have a conveyor carrying boxes, and scanning each boxes barcode and store it in computer database. We should have an ordinary PC – PLC handshake system

description

A poor system design may cause to stop your assembly line or miss your products without recording their id to the database. This slide shows how may it happen. Visit http://indanotes.blogspot.com for tips and tricks in PC supported industrial automation systems.

Transcript of Deadlock situation and missed products

Page 1: Deadlock situation and missed products

Sometimes, deadlocks in PC supported automation systems can be a real headache if it designed poorly.

When a deadlock occurs, system stops by making it impossible to free up without intervention.

1 2 3

Boxes move this way

Assume that we have a conveyor carrying boxes, and scanning each boxes barcode and store it in computer database.

We should have an ordinary PC – PLC handshake system

Page 2: Deadlock situation and missed products

Network delays or PC unstability may cause delays in this handshake.

Following legend is intended to visualise PC – PLC handshake, only two signals are included. Barcode data is omitted.

1 2 3

Way Data ValuePLC to PC Data Save Request False

PC to PLC Data Saved False

Initially, Box 1 is not on the station yet, and is ready for receiving a box data

Page 3: Deadlock situation and missed products

Let's see a normal operation. When Box 1 comes to the station, PLC gets the product presence information from sensor and transfers it to the PC by setting 'Data Save Request' flag to 'True'

1 2 3

Way Data ValuePLC to PC Data Save Request True

PC to PLC Data Saved False

Page 4: Deadlock situation and missed products

When PC gets boxes information, it updates a database table and informs PLC by setting 'Data Saved' flag to 'True' when completed.

1 2 3

Way Data ValuePLC to PC Data Save Request True

PC to PLC Data Saved True

Page 5: Deadlock situation and missed products

Then PLC sends the Box 1, and clears its 'Data Save Request'

1 2 3

Way Data ValuePLC to PC Data Save Request False

PC to PLC Data Saved True

Page 6: Deadlock situation and missed products

And PC clears its 'Data Saved' flag.

1 2 3

Way Data ValuePLC to PC Data Save Request False

PC to PLC Data Saved False

Page 7: Deadlock situation and missed products

This is a complete cycle without any problem. In normal conditions, this cycle is repeated by many times between PC and PLC

2 3

Way Data ValuePLC to PC Data Save Request True

PC to PLC Data Saved False

Page 8: Deadlock situation and missed products

However, PC is not stable as PLC, sometimes it can be late to give an answer to PLC.

In this case, PLC will not send the box until it gets a response from PC.

2 3

Way Data ValuePLC to PC Data Save Request True

PC to PLC Data Saved False

4

Page 9: Deadlock situation and missed products

Normally it is not a big problem, may be less than a second of waiting may occur.

2 3

Way Data ValuePLC to PC Data Save Request True

PC to PLC Data Saved True

4

Page 10: Deadlock situation and missed products

But what may happen if PC have a temporary hang at this moment? PLC resets its 'Data Save Request' but PC could not find a chance to see it yet.

2 3

Way Data ValuePLC to PC Data Save Request False

PC to PLC Data Saved True

4

Page 11: Deadlock situation and missed products

But what may happen if PC have a temporary hang at this moment? PLC resets its 'Data Save Request' but PC could not find a chance to see it yet.

And unfortunately, Box 3 come to the station.

3

Way Data ValuePLC to PC Data Save Request True

PC to PLC Data Saved True

4 5

Page 12: Deadlock situation and missed products

Before hanging, PC set the 'Data Saved' flag for Box 2 and did not realised that Box 3 is on the station. PC is assuming that Box 2 never leaved the station

3

Way Data ValuePLC to PC Data Save Request True

PC to PLC Data Saved True

4 5

2

Page 13: Deadlock situation and missed products

Now there are two possibilities according to the poorness of design:

Possibility 1: Deadlock. PC and PLC mutually waits each other to reset their flag.

3

Way Data ValuePLC to PC Data Save Request True

PC to PLC Data Saved True

4 5

2

Page 14: Deadlock situation and missed products

Now there are two possibilities according to the poorness of design:

Possibility 2: Miss the Box 3 without recording its data into database

3

Way Data ValuePLC to PC Data Save Request False

PC to PLC Data Saved False

4 5

Bye bye Box 2 !

Page 15: Deadlock situation and missed products

'State analysis' of a system is important. A poor design may cause unwanted results.

In next post, we will do a state analysis for the single station with a single task.

http://indanotes.blogspot.com