Sie sind auf Seite 1von 10

http://www.final-yearprojects.co.cc/ http://troubleshoot4free.

com/fyp/

Summarv
The concept of an embedded programmable logic controller (PLC) as parr of a much larger suite of
dedicated control software to provide a flexible I/O interface for industrial microprocessor control
systems is considered. The use of such a system allows modification of the system operation by semi-
skilled staff without compromising the integrity of the system software. The embedded PLC can also
be used to control the overall function of a large system of dedicated software and hardware.

Many indusmal control systems are produced in relatively small numbers and often each system will
be produced to a slightly different specification. The area where the specification is most likely to
change is in the interface to other plant. Changes in the system operation are also likely to occur,
particularly near the interface to other plant. This can cause considerable time and expense in hardware
and software modifications and makes system maintenance and spares provisioning difficult.
Where the numbers are very small (e.g. 1- 10) the stand-alone programmable logic controller is o-ften
an ideal solution as program development is simple and modifications, to allow for small variations,
are easily incorporated. The relay-ladder language used is designed to enable electrical circuit
designers to be able to write programs as they would design a relay control unit. A wide variety of
proprietary interface units are available, off-the-shelf, for PLCs including plant mimic-displays via a
terminal or personal computer (PC). However the cost rapidly increases if such a sophisticated user
interface is required.
For large numbers of systems, where the functions of the controller can be precisely defined, an
embedded microprocessor based control system is often the most cost effective solution. This is
particularly the case when the user interface requires character or graphic displays and the entry of a
number of numeric settings. A certain degree of flexibility can be built-in by the use of plug-in I/o
cards (for hardware) and configuration tables for the software. However if software modifications are
frequently required to cope with changes in specification from system to system the unit cost rapidly
escalates. Maintenance and documentation of the installed systems also becomes a problem as "small"
changes to the software function can often require significant re-structuring. Skilled programmers are
required to implement software changes to large (10,OOO to 100,OOO lines of code) embedded systems;
a "small" change often requires detailed knowledge of the entire system which may have been written
by a team of programmers.
It is in this area that an embedded PLC may be used to overcome many of these problems. Without
detailed knowledge of the system software it is possible to alter the function of a system and the details
of how it interfaces with other plant. This is achieved by allowing the user to alter the program run by
a PLC task incorporated within the system software. The task may be implemented with reasonable
efficiency as an interpreter which allows the system programmer to control closely what can be done
by the PLC program. The relay ladder programming language used in PLCs is easy to understand and
can be understood by electrical technicians or similar staff because it mimics the operation of a relay
circuit. Also the language executes without branches, loops, or backward jumps ensuring that a
program executes from beginning to end in a predictable time period.
A brief description of the relay ladder language, hardware configuration, and performance of a stand-
alone PLC is now given. An example of a system using an embedded PLC is then discussed. Thib i b
used to indicate how the embedded PLC interfaces with the remainder of the system software. The
way in which the system input-output (IO)interface is partitioned between PLC and dedicated 10-
drivers is also illustrated. An outline of the operation of the PLC interpreter implemented by the author

J. F. Dawson is with the Department of Electronics at the University of York.

One place for Projects, Presentation, seminar, summer training report and lot more.
NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.
http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

is then given along with details of its performance in a typical system.


Programmable I,OPic Contro llers

Origins
Programmable logic controllers were developed as a means of replacing relay based control systems
with microprocessor controllers, without the need to re-train the elecmcal designers of such systems in
conventional programming skills. PLCs now replace relay based control systems i n most
applications. They are cheaper, smaller, more reliable and simpler to modify than relay based
systems. PLCs have now developed to a stage where they can perform more sophisticated functions
than can be achieved with relay based control systems.

The relav ladder &prmhgAnguti-g


All programmable logic controllers can be programmed in the "Relay-Ladder" language. This is a
development of the relay-ladder circuit diagram which is used for the design of relay ba.sed control
systems. The symbols used in relay ladder diagrams tend to differ from those use in electronics circuit
diagrams and are shown in Fig. 1. The timers are assumed to be of the on-delay type where the
output turns on a time after the timer is activated. The counters increment to a target count every time
the controlling contact(s) close; the counter coil activates when the terminal count is reached.
The relay ladder diagram arranges the relay coils and contacts in the form of a ladder. the sides are
formed by the relay power supply rails and the rungs are formed by the relay contacts and coils as
shown in Fig. 2 below. When SWl is closed relay MO1 latches on as one of its own contacts is in
parallel with SW1. MO1 activates timer TO1 which turns on after a 10 second delay. This activ-ates
TO2 which turns on after a 5 second delay. When TO2 turns on MO1 is turned off which in turn turns
TO1 and TO2 off. The system remains in this state until SWl is pressed again. This is shown in the
timing diagram Fig. 3.

ODeration of mode_rn.PL-C.s
Programming the PLC
Many PLCs can be programmed directly in the relay ladder diagram format via graphic programming
consoles or PC based program generation software, others require the relay ladder to be converted into
mnemonic form. The mnemonics look very much like assembly language except that no branches or
loops are allowed. The mnemonics can be considered as logical operations on a one bit accumulator.
Converted into its mnemonic form Fig. 2 would become:

; First rung of ladder


ID sw1 ; first contact is loaded in accumulator
OR MO1 ;OR MO1 for parallel contact
ANI To2 ; A N D with TO2 inverted for series N/C contact
OUT MO1 ; store result as relay MO1

;Second rung of ladder


LD MO1 ; load relay MO1 into accumulator
OUT To1 ; use result to activate timer TO1
KlOO ; 10 second delay (in l/lOths)

; Last rung
ID To1 ; load timer TO1 into accumulator
OUT To2 ; timer TO1 drives timer TO2
K50 ; 5 second delay (in Moths)
Where the load (LD) instruction represents the first contact used in any rung on the ladder. the OR
instruction represents a parallel contact and the "and inverted" (ANI) instruction represents a normally
Closed series contact. The OUT instructions indicate the relay (counter, timer, etc.) coil which is being
driven.

312

One place for Projects, Presentation, seminar, summer training report and lot more.
NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.
http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

Only a few of the basic features available on most PLCs have been presented here. Many PLCs have
additional instructions; e.g. arithmetic operations, shift registers and others depending upon
manufacturer and model.
In operation the PLC periodically steps through the mnemonics linearly from start to end with no
jumps or loops. One iteration of the program from start to end is known as a program scan.
Hardware configuration
A minimal PLC system is a self-contained unit with digital inputs and outputs (8 to 16 of each)
brought out to terminals. The central processor unit (CPU) is typically an %bit micro-controller with
EPROM firmware and battery backed R A M for program storage and development. The programming
console is connected only for development or system monitoring and may include pnnter and EPROM
programmer interfaces; once developed programs can be stored in EPROM. Extra VO modules can be
connected by an external I/O bus.
Performance
The performance of most PLCs is measured in terms of the program size, number of I/O that can be
accommodated (including counters timers and internal storage relays), and the maximum scan-time for
the program. The scan time indicates the speed of response of the PLC; depending upon the
complexity of the code it may take from one to several scan periods before a changing input affects an
output relay. A typical scan time would be of the order of 30ms. The scan time is often dependent
upon program length and the instruction mix used.
The mnemonics are often converted into machine code macros for maximum performance, with
subroutine calls to the system firmware for more complex instructions.
01 Svstem with Embedded PLC
This section describes the use of an embedded PLC in a microprocessor based industrial control
system. For reasons of commercial confidentiality a detailed description of the actual system cannot be
given at this time. However the main features of the system are presented along with the rationale for
the use of an embedded PLC and an outline of the implementation.
The key features to note are that this system, although dedicated to a single purpose, requires a great
degree of flexibility in its mode of operation. The 110 used varies a great deal from system to system
both in whether an external connection is required and the exact function performed. Also the function
of some parts of the system may vary. For instance an off-normal status indication is required, the
"normal" control settings may be different for every system.

-rview
All of the system software is written in the C programming language and run under a simple multi-
tasking executive.
The system software is outlined in Fig. 5 . It consists of a number of dedicated tasks:
a user interface task which accepts commands and displays status information about the system
via the front panel or a remote communication link;
an instrumentation task which reads and scales analogue inputs from a number of sources
storing the results in a global instrumentation table;
an alarm monitor task which compares instrumentation setting with warning and action alarm
limits;
and a physical VO driver which reads digital inputs and dnves digital outputs.
The dedicated tasks themselves are given a degree of flexibility by operating using configuration
tables, those which control interaction with the PLC (shown in Fig. 5 ) are:
the PLC interface data table which determines which front panel push-buttons operate PLC
inputs and which PLC outputs are displayed as status indicators on the front panel;
the a l a m data table determines which PLC inputs are operated when instrumentation limits are
exceeded,

3/3

One place for Projects, Presentation, seminar, summer training report and lot more.
NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.
http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

the VO translation table determines which PLC inputs and outputs are "connected" to physical
inputs and outputs; the polarity can also be determined so that the PLC always operates with
positive logic.
The PLC task controls the overall system operation. Its program is written in relay-ladder or
mnemonic form and can be easily altered by staff familiar with relay logic design or PLC
programming. It communicates with other system tasks and physical I/O only by means of input
"contacts" and "relay" outputs.

Programminpconsi.de.rat.i.o.n.s
This section outlines the way in which the system was partitioned to meet the requirement5 of the
example system and the factors considered in the initial design.
System partitioning
There is inevitably a processing overhead in using an embedded PLC rather than directly
implementing the control algorithm in a compiled language. For this reason the partitioning of system
software was important; any tasks with fixed functions were implemented as compiled code rather than
in the PLC program which is interpreted in this system.
System interface
The interface between the PLC and the rest of the system was implemented entirely through PLC
inputs and outputs during normal operation. This was intended to keep the PLC similar in every way
to a stand alone PLC. The PLC program can be tested on a stand-alone PLC or via a PC based
simulator, independently from the rest of the system.
For maintenance and diagnostic purposes PLC counter and timer settings can be altered via the user
interface.
Physical I/O interface
The PLC internally has a much larger number of inputs and outputs than the number of physical
inputs and outputs available i n the system hardware. Any PLC I/O can be "connected" to a physical
input or output or used by the the other software for control or monitoring the PLC operation. Inputs
can only be driven from one source whilst outputs can be read by more than one task. Connection to
physical U 0 is controlled by the physical I/O dnver using the l/O allocation table. The table contains
information which determines the physical I/O polarity as well as its connection to PLC inputs.
As with stand-alone PLC systems this system caters for varying numbers of U 0 by having separate
VO modules which plug into an I/O bus. Internally the PLC relay ladder program may drive outputs
which are not physically connected in a minimal system.

ODeration of the embedded PLC


This section gives an overview of the implementation of the PLC in high level language (C) and the
resulting system performance.

Internal operation
The PLC is designed to perform a single program scan periodically (i.e. every 100ms) under the
control of the multi-tasking executive. This provides a response time of a few tenths of a second
(depending on relay ladder program) to any input. This is slightly slower than a typical stand alone
PLC but is adequate for most applications. PLC inputs are updated from the physical inputs before the
start of a scan and physical outputs are updated after the end of each scan.
The PLC is implemented as an interpreter to keep the relay ladder code compact and to ensure that the
integrity of the system cannot be compromised by badly written or corrupted PLC code. If the code
was compiled using C or machine code macros to represent each instruction mnemonic execution
would be faster but other non-PLC code could be inserted which could compromise the system
integrity, also the code size would be greatly increased. Most PLC mnemonics are represented.by two
bytes: an op-code and an 1/0 address. The subroutines which perform the mnemonic function
typically take 10-15 lines of C or assembly language and would compile to tens of bytes of machine
code.

3/4

One place for Projects, Presentation, seminar, summer training report and lot more.
NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.
http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

The interpreter is written entirely i n C and Functions by using a look-up table to detemune the addre55
of the function to be called to implement the current op-code (Fig. 6).
The main body of the interpreter is very simple as shown in the loop below:
plc-end = FALSE; /* reset end of program flag */
p k p c = plc-prog; /* start at begnning of program */
while (!PIC-end) /* perform one program scan */
I
I
(*plc-ivec[ *pic-pc])(); /* Execute current PLC insuuction */
I
The plc-end flag is set by the END instruction at the end of the PLC program or if an error occurb.
The variable plc-ivec contains the pointers to the functions which perforni the instruction and plc-pc
points to the current op-code. Since some instructions use more or less than two bytes each
instruction leaves the pic-pc variable pointing to the next byte. N o parameters are passed to each
function called in order to minimise execution rime. The functions called access the plc-pc variable to
read the VO address and modify the pic-end flag directly.

Performance
Running on an 8MHz 68000 microprocessor system the PLC interpreter executes a single scan in 33
to 4Oms for a typical program of about S O lines of mnemonic code (about 70ps per instruction). with
a scan period of lOOms this occupies about 35% of total processor time. The PLC interpreter is abou
3000 lines of C-code.
Conclusions

Areas of potential application


The embedded PLC concept bridges the gap between stand alone PLC which does not have a built in
user interface or instrumentation capacity and a conventional single function microprocessor based
system. It allows the flexibility of the PLC which can be modified by electrical designers without
knowledge of computer programming.
The embedded PLC allows the advantages of both PLC and microprocessor based systems.

Main t e m
The system hardware and firmware is the same regardless of the function to be performed. The PLC
program and data tables are loaded into EEPROM and can be modified on-site using a PC. This
simplifies spares inventory compared with systems which require hardware modifications or special
fiiware.

Documentation
Although the prospect of slightly different configuration data presents a significant documentation
task, it is simpler to document changes in PLC code of around 500 lines than to document changes to
40,000 lines of source code. The example system outlined was used to replace a hard-wired control
system which often required significant hardware modifications from system to system and the
incorporation of a stand alone PLC i n some applications.

-
cost
The embedded PLC concept provides a low cost solution to industrial control systems produced in
small to medium quantities where significant variations are required from system to system whilst the
same basic functions are performed.

315

One place for Projects, Presentation, seminar, summer training report and lot more.
NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.
http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

Fig 1 Symbols used in relay ladder diagram,

W Bu
*Wrnd.,
&haul
IO
SWI p f

I I
I- - -

Fig. 4 A minimal PLC system Fig 3 Ttmmg diagram for Figure 2

n
I I

U
Fig. 5 System software outline Fig. 6 O p a t i o n o i PLC mterprcter

One place for Projects, Presentation, seminar, summer training report and lot more.
NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.
http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

Normally closed contact

Normally open contact

Relay coil

Timer coil

Counter coil
U
Relay ladder symbol Circuit Symbol

Fig. 1 Symbols used in relay ladder diagrams

1/0Bus to
Additional
I/O modules

------- 1

-
r--------
I I

I
' Opto-
isolated
inputs CPU
Relay
outputs
I
I
I

Printer Programming
Console - EPROM
Programmer

Fig. 4 A minimal PLC system

317

One place for Projects, Presentation, seminar, summer training report and lot more.
NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.
http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

t Instrumentation 4 I Instrument I

......................
......................
......................
......................

f ......................
User interface
......................
......................
\ ......................
......................
.....................
..................... I
I

10 Software task

I Configuration data

I0 Variable data
Key

Fig. 5 System software outline

3/8

One place for Projects, Presentation, seminar, summer training report and lot more.
NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.
http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

Fig. 2 A simple Relay-ladder logic circuit

MO 1 I

Fig. 3 Timing diagram for Figure 2

319

One place for Projects, Presentation, seminar, summer training report and lot more.
NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.
http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

Op-code
bogram Counter I/O Addr.
Subroutine for
I I current op-cods

PLC Program Instruction address Subroutlnes


lookup table perform instruction

Fig. 6 Operation of PLC interpreter

3/10

One place for Projects, Presentation, seminar, summer training report and lot more.
NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.

Das könnte Ihnen auch gefallen