Controllers and Control Algorithms (Revision 4.0, 3 April 2015)

Controllers and Control Algorithms
0908531 Mechatronics System Design
Controllers and Control Algorithms
(Revision 4.0, 3rd April 2015)
1. Controllers
When designing a mechatronic system, one of the most important and critical
decisions the designer has to make is the type of controller (physical controller) to
use in order to control the system. There are a number of possible options as
follows:
1. Microcontroller/microprocessor (e.g., PIC microcontroller): A microprocessor
or a microcontroller is an integrated circuit that can be programmed to carry
out a set of instructions in response to hardwired inputs and that can send out
outputs. It can carry out a large number of instructions per seconds.
A microcontroller is usually used in applications that have a large
number of products to be manufactured (e.g., washing machines, airconditioners, automotive applications). The cost of the device is low. It can
do some signal processing, but is very limited. It also has the disadvantage in
that it requires interfacing the inputs and the outputs to the real world. It is
very compact and small size and thus does not take up much space.
2. Programmable logic controller (PLC): A programmable logic controller (PLC
for short) is a electronic device that can be programmed using ladder logic and
that has a set of inputs and outputs (both analogue and digital). It
continuously runs a programme that has been stored within it and scans for
the status of inputs. It then sends out outputs to control external devices.
As opposed to microprocessors and microcontrollers, PLCs have ready
designed input and output interfaces. PLCs are also more robust that
microcontrollers and microprocessors and much easier to programme.
The PLC has a large size and thus requires more space. Its cost is
higher than microcontrollers and microprocessors and could range from $300
to thousands of US dollars. It already has good interfacing for inputs and
outputs. It has a high level of reliability. The PLC is not suitable for any signal
processing, and thus the PLC is usually only used for simple logic processing
that replaces old relay systems. The PLC is widely used in many industrial
controllers, such as those in the water industries and factories. It is easy to
program using ladder diagrams. The PLC is generally considered too slow to
be used for high speed real time systems. The ladder language used in PLCs
is easy to understand.
3. PC desktop/laptop: in certain situations, a desktop or a laptop is used as a
controller.
This is usually done in situations where extensive signal
processing and analysis are required. Special interfacing is usually carried out
by the use of interface I/O cards. The cost is usually higher than the PLC.
The advantage of the use of a desktop or a laptop is that it offers an excellent
user interface, but it is not suitable for industrial environments that have dust,
grease and liquids. It is also not suitable for applications that have a large
number of units due to the high cost and hence this is only used for one off
systems.
© Copyright held by the author 2015: Dr. Lutfi R. Al-Sharif
Page 1 of 7
Controllers and Control Algorithms
0908531 Mechatronics System Design
4. Digital Signal Processing (DSP) integrated circuits: These are powerful
microprocessors that possess advanced signal processing capabilities. Texas
instruments (TI) produces a large range of these devices some of which even
include video processors.
5. Relay controllers: This method uses relays and their contacts (normally
closed and normally open contacts that are denoted as NC and NO
respectively) to implement ‘logic’ functions. It is rarely used nowadays as it is
bulky and consumes a lot of energy and takes up a lot of space.
6. Logic gates: Logic gates could be used to implement logic decisions. These
could be implemented in electronic format, such gates (CMOS, TTL),
programmable logic devices (PLD), field programmable gate arrays (FPGA).
They could also be implemented in pneumatic format although this is now
obsolete.
The most widely used options of these are the first three. The table below shows a
general comparison of the three options:
Number of
products to
be
manufactured
Microcontroller
High
PLC
Medium
PC/laptop
Low
Signal
processing
Speed
Cost
Medium
Low
High
High
Low
Medium
Low
Medium
High
2. Control Algorithms
The other critical decision that the designer has to make is the type of control
algorithm to use. The decision requires a thorough understanding of the process to
be controlled and the required performance. There are a number of options:
1. On/off control (also known as Bang-bang control): This is the simplest method
of control. The control element that is controlling the process under control
can only have one of two states: on or off. The control system switches on
the final control element if the actual value is less than the desired value and
switches it off if the actual value is more than the desired value. This method
is very simple and reliable. But it might cause imprecise control of the
variable, but this is sometimes acceptable in certain situations (e.g., hot water
tank in a house).
2. Tracking control: In this method of control the output of the controller is only
incremented or decremented by a fixed amount. Note that a form of memory
is required in this method: it is important to remember the last output of the
controller in the last update, in order to increment it or decrement it. It is
incremented by this amount if the actual value is less than the desired value
and is decremented by this fixed amount if the actual value is more than the
desired value. This decision is repeated a number of times per second
whereby the output of the controller is updated based on the comparison
between the actual value and the desired value. This method provides better
© Copyright held by the author 2015: Dr. Lutfi R. Al-Sharif
Page 2 of 7
Controllers and Control Algorithms
0908531 Mechatronics System Design
control that the on/off control but can be very slow to respond to changes in
the input signal or disturbances in the process. The magnitude of the
increment/decrement value is a compromise between setting it too large in
order to achieve a fast response (but risking an overshoot) or setting it too low
(thus avoiding an overshoot but leading to a slow response). Making the
update frequency higher will improve the speed of response of the system.
3. Proportional control: In this mode of control the actual value of the variable to
be controlled is subtracted from the desired value. The result is multiplied by
the proportional constant (sometimes called the gain) and sent to the output of
the controller. This method ensures that the response of the controller is
increased when the error increases. Also note that this method does not have
any memory (i.e., there is no need to remember the last output of the
controller in the last update). The main disadvantage of the proportional
control is that it cannot eliminate the steady state error (it can only reduce it).
Increasing the value of the proportional constant will improve the speed of
response and reduce the steady state error (but cannot eliminate it).
However, this could lead to overshooting of the system or even oscillation in
certain cases.
4. PI, PID, PD control: Integral control can be added to the proportional control.
This is referred to as PI control. The advantage of this method is that it can
eliminate the steady state error. However, integral control can lead to the
instability of some system. The derivative control is also sometimes used in a
PID controller to prevent the system becoming unstable. PD controllers are
used in position control systems to ensure good speed of response.
5. Advanced control methods: Many other types of controllers can also be used
to deal with difficult systems. Using artificial intelligence such as neural
networks, fuzzy logic and genetic algorithms better control solutions can be
devised. Adaptive control can be used in controllers that can monitor the
system and adapt the control algorithm to suit the system. These systems are
used in special systems that are difficult to control with conventional PID
methods.
3. Type of Control: Logic control versus speed control
Each controller will consist of two parts: logic control and speed control. Logic
control involves the logic decisions that the controller will make based on the state of
the inputs and the requests from the user. Speed control, where appropriate,
involves the change of the speed of the actuator using a variable speed drive.
4. Additional Notes from the first semester 2014_2015-04-03
Types of physical controllers:
1. Microcontrollers/microprocessors.
2. Programmable Logic Controllers (PLC)
3. Personal Computers (PC)/ laptop.
4. Logic gates, Field Programmable Gate Arrays (FPGA), Programmable Logic
Devices (PLD), Programmable Logic Arrays (PLA).
5. Relay controller
© Copyright held by the author 2015: Dr. Lutfi R. Al-Sharif
Page 3 of 7
Controllers and Control Algorithms
0908531 Mechatronics System Design
6. Digital Signal Processing integrated circuits (DSP) (e.g., Texas Instruments).
Disadvantages of relay controllers:
1. Takes up too much space.
2. Consumes a lot of power.
3. Unreliable due to failure of electromechanical components.
4. Slow in processing.
Microprocessors/microcontrollers:
Advantages: Compact size, low power consumption, high speed, low cost
Disadvantages:
Vulnerable to electro-magentic noise/interference, limited i/o
(requires building), does not have complex signal processing capabilities (e.g., fourier
transform).
PLC
Advantages: easy to programme, very advanced i/o (well developed); well protected
i/o (e.g., opto-isolation); very modular (can be expanded by adding more pcb
modules, such as a high speed counter/timer, Ethernet….); suitable for industrial
environments.
Disadvantages: Relatively slow (compared to microprocessors/microcontrollers);
large size; high cost.
PC/Laptop
Advantages: can perform complex processing operations; it is fast and has an
excellent user interface; suitable for prototyping and development stages.
Disadvantages: operating system is unsuitable for real time applications (e.g., can
crash); unsuitable for industrial environments (e.g., poor IP rating); large size; high
cost; can crash due to bugs; requires I/O cards for interfacing inputs and outputs.
Digital Signal Processing integrated circuits:
Very powerful and advanced integrated circuit used when small space is available
and high levels of signal processing are necessary.
Logic Gates/FPGA/PLA/PLD
Advantages: very high speed; very compact; high reliability
Disadvantages: requires a special language for programming (VHDL).
Examples:
1. Face Recognition in an office: PC
2. A washing machine of which we want to manufacture a large number and space
is restricted: FPGA or microcontroller
3. Air conditioner large numbers to be manufactured, space is restricted: FPGA or
microcontrollers.
© Copyright held by the author 2015: Dr. Lutfi R. Al-Sharif
Page 4 of 7
Controllers and Control Algorithms
0908531 Mechatronics System Design
4. Water pumping system in a local water substation: PLC as a small is to be
manufactured, there is no need for signal processing, and it is to be installed in an
industrial environment.
5. Internal combustion engine controller: space is restricted and fast operation is
required: microcontroller/microprocessor.
Problem 1
Accurate Water Pumping System
You are required to design an accurate water pumping system.
The system will pump accurate amounts of water from a reservoir up to a tank that is
10 m higher. The system should be able to pump water at rates reaching 30 L/min.
The system should work as follows:
•
•
The user enters the amount of water he/she wants to pump in Litres on a user
interface.
The system pumps the required amount of water to the upper tank.
In your design you should show suitable diagrams and detailed design information.
Specifically you should carry out the following:
•
•
•
•
Select a suitable controller and control algorithm for the system.
What extra features should you add to the system to make it safe and
efficient?
Select a suitable pump and flow meters from the datasheet at the end of this
chapter if required.
Show how you would interface the controller to the pump and flow meters.
Problem 2
In each of the following problems explain the type of controller that you would use
and the most suitable control algorithm. Explain your choice.
a) A control system that controls a domestic water heater to a temperature of
60 °C ±5 °C.
b) A control system that accurately controls the speed of a conveyor belt and
is subject to disturbances of load on the belt.
c) A controller inside a modern air conditioning system.
d) A face recognition control system that has a camera feeding it and that will
raise an alarm when detecting a criminal.
© Copyright held by the author 2015: Dr. Lutfi R. Al-Sharif
Page 5 of 7
Controllers and Control Algorithms
0908531 Mechatronics System Design
Datasheets for Problem 1
Datasheet for paddle-wheel flow-meter
© Copyright held by the author 2015: Dr. Lutfi R. Al-Sharif
Page 6 of 7
Controllers and Control Algorithms
0908531 Mechatronics System Design
Datasheet for Problem 1
Datasheet of Pump
© Copyright held by the author 2015: Dr. Lutfi R. Al-Sharif
Page 7 of 7