A Programmable Logic Controller Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Agile and flexible manufacturing system makes it mandatory that a control program should have features such as agility, flexibility, and reusability in order to meet fast changing customer demands. Proper modelling and fast formation of the control logics using graphical and mathematical tools is one of the most peculiar ways to make the control logic more feasible for rapid product prototyping, concurrent engineering, flexible, and agile manufacturing. This assignment illustrates efficient conversion of Petri nets model into PLC (Ladder Logic Diagram) in a very convenient way using one-to-one mapping technique.


The aim of the assignment is to get familiar with Petri nets and the objective is to design a Petri net supervisor to handle the rejection area of the Industrial Control Trainer from Bytronic Associated Ltd. The logic is designed in such a way that it keeps two kinds of assembled items and rejects everything else coming on the conveyor apart from that. The combination we have chosen which goes to keep tray is PR/PP and PR/MP (plastic rings on either metal or plastic peg).



A programmable logic controller is generally referred to as a "PLC" or "programmable controller". Early machines were controlled by mechanical means using cams, gears, levers and other basic mechanical devices. As the complexity grew, so did the need for a more sophisticated control system. This system contained wired relay and switch control elements. These elements were wired as required to provide the control logic necessary for the particular type of machine operation. This was acceptable for a machine that never needed to be changed or modified, but as manufacturing techniques improved and plant changeover to new products became more desirable and necessary. The time period was the late 1960's and early 1970's and the result was the programmable logic controller, or PLC. The PLC provided an easy way to reprogram the wiring rather than actually rewiring the control system.

Fig: Allen-Bradley Micrologix 1000

In this assignment, Allen-Bradley Micrologix 1000 PLC is used to automate the Bytronic Industrial Control Trainer (ICT).


A Petri net is a graphical and mathematical modelling tool. It consists of places, transitions, and arcs that connect them. Input arcs connect places with transitions, while output arcs start at a transition and end at a place. There are other types of arcs, e.g. inhibitor arcs. Places can contain tokens; the current state of the modelled system (the marking) is given by the number (and type if the tokens are distinguishable) of tokens in each place. Transitions are active components. They model activities which can occur (the transition fires), thus changing the state of the system (the marking of the Petri net). Transitions are only allowed to fire if they are enabled, which means that all the preconditions for the activity must be fulfilled (there are enough tokens available in the input places). When the transition fires, it removes tokens from its input places and adds some at all of its output places. The number of tokens removed / added depends on the cardinality of each arc. The interactive firing of transitions in subsequent markings is called token game.

Petri nets are a promising tool for describing and studying systems that are characterized as being concurrent, asynchronous, distributed, parallel, nondeterministic, and/or stochastic. As a graphical tool, Petri nets can be used as a visual-communication aid similar to flow charts, block diagrams, and networks. In addition, tokens are used in these nets to simulate the dynamic and concurrent activities of systems. As a mathematical tool, it is possible to set up state equations, algebraic equations, and other mathematical models governing the behaviour of systems.




Directed Arc

Fig: Petri net Diagram Structure












S1 & S2


Bytronic Industrial Control Trainer

Fig: Top-view of industrial control trainer

The system is activated by pushing the start black button on the start/stop panel. The assembly area conveyor moves the complete assemblies and the unassembled pegs to the rejection area. Sensor6 a capacitive sensor detects the complete assemblies. A reflective sensor5 is attached to the sensor6 which detects the presence of item in front of capacitive sensor6. After that there is a metal detecting sensor7 which is placed on higher position according to our requirement to detect only the metal rings coming with complete assemblies. When complete assembly is not detected the sensor8 waits for the unwanted item to be detected and actuator5 pushes the unwanted item to rejection tray.

The components data table is given as:

Input Components:

Sensor No.


PLC input address


Metal detecting sensor to detect metal rings on the assemblies.



Black pushbutton used to commence the assembling.



Red pushbutton used to terminate the assembling.



Capacitive sensor, near the lower sort area which detects the presence of passing complete assemblies near the reject solenoid at the motor end of the lower conveyor.



Reflective IR sensor at the lower sort area which detects the presence of components and assemblies in front of the reject solenoid at the motor end of the lower conveyor.


Output Components:

Actuator No.


PLC output address


Lower conveyor motor that drives the lower plain belt conveyor.



Solenoid at the reject area that rejects unassembled components before the complete assembly collection tray.



We have divided our system into two major areas namely:

- Sorting Area

- Rejection Area


In the sorting area the components coming on the lower conveyor are sorted out in order to keep the required assemblies and reject rest of the items. In our application only two assemblies will be kept that are with the combination of plastic ring /plastic peg and plastic ring/metal peg and all other items goes to rejection tray. Petri net design which is shown below.

T1 P1 T2 P2 T3

(I: O/6, I: O/3) (I: O/7) (I: O/3)


(I: O/3)

T5 P3 T6

(I:O/6 ,I:O/3) I:O/3

Fig: Petri net Flow Diagram

In this Petri nets case we can only have one token at a time atone place so we have the constraint described as


L= [1 1 1] MO= [0; 0; 0]

W =

1 -1 0 -1 0 0

0 1 -1 0 0 0

0 0 0 0 1 -1

Wc= -L*W= [-1 0 1 1 -1 1]

Mc0 = 1-L*M0 = 1-[1 1 1]*[0;0;0]=1


T1 P1 T2 P2 T3 P3 T4 P4 T5

T6 P5 T7 P6 T8 P7 T9 P8 T10

Fig: Buffer logic for Petri nets

The diagram shown above is a Petri net model for the rejection area. In this section of rig the unwanted items are to be rejected which are knocked by the actuator to the scrap bin and only the required assemblies are allowed to pass go through the actuator. Only one token ruling both each place of these Petri net rows i.e. either p1 or p5 can have a token at a time and so on. The above row handles the keep items and the row below handles the rejected item. The only purpose to create these rows is to create buffer area so that only four items can accommodate in the area before the rejection.

The constraints of this Petri net logic is given by:

M1+M5 M2+M6 M3+M7 M4+M8

So we have;

L =

1 0 0 0 1 0 0 0

0 1 0 0 0 1 0 0

0 0 1 0 0 0 1 0

0 0 0 1 0 0 0 1

W =

1 -1 0 0 0 0 0 0 0 0

0 1 -1 0 0 0 0 0 0 0

0 0 1 -1 0 0 0 0 0 0

0 0 0 1 -1 0 0 0 0 0

0 0 0 0 0 1 -1 0 0 0

0 0 0 0 0 0 1 -1 0 0

0 0 0 0 0 0 0 1 -1 0

0 0 0 0 0 0 0 0 1 -1


Wc= -L*W

Wc =

-1 1 0 0 0 -1 1 0 0 0

0 -1 1 0 0 0 -1 1 0 0

0 0 -1 1 0 0 0 -1 1 0

0 0 0 -1 1 0 0 0 -1 1

When all the stages are combined to get final matrix:

Total Wc =

-1 1 0 0 0 0 0 1 -1 1 0 0 0 0

0 -1 1 0 0 0 0 -1 0 -1 1 0 0 0

0 0 -1 1 0 0 0 0 0 0 -1 1 0 0

0 0 0 -1 1 0 0 0 0 0 0 -1 1 0

0 0 0 0 -1 1 0 0 0 0 0 0 -1 1


The assignment gives a firm knowledge of Petri nets and good practical skills in order to solve any industrial automation problem. The use of Petri nets makes the problem easy to analyse and then which can be converted to ladder logic. The calculation of Moody's Method gives the verification of our solution in terms of matrices which are verified in simple way. Finally we can say that Petri net design is one the simple problem solving ways for the automation scenarios.