![](bg2.png)
signal, without any feedback from outputs. The
systems that utilize feedback are called closed-loop
control systems. The feedback is used to make
decision about changes to the control signal that
drives the plant (in the case of our example, the
antenna). It is well known that the deliberate use of
feedback can be used to stabilize an otherwise
unstable system, to reduce errors due to input
disturbance and to reduce the sensitivity of the
system performance to changes in parameter values
caused by temperature, aging of hardware, etc. Hence,
most control systems are of the closed-loop type.
Many different control algorithms have historically
been used in control systems, but Proportional-
Integral-Derivative (PID) control (Kuo, 1982) is the
most common control algorithm used in industry and
has been universally accepted in industrial control.
The popularity of PID controllers can be attributed
partly to their robust performance in a wide range of
operating conditions and partly to their functional
simplicity, which allows engineers to configure them
in a simple, straightforward manner. With the
ubiquity of microcontroller technology, PID
controllers are typically implemented by the
embedded software in a microcontroller.
As PID controllers are used in most control
systems, it is important to ensure the reliability of
PID software. Software testing is the primary way in
which the reliability of software is assessed and
improved, and, therefore, effective testing of PID
software is the critical step for a reliable control
system. Testing PID software is a challenging task.
Unlike simple control algorithms, the PID controller
is capable of manipulating the process inputs based
on the history and rate of change of the error signal.
This gives a more accurate and stable control method
but complicates the testing process. As the output can
vary because of the history and the rate of change of
the error signal, it is very difficult to check the
correctness of PID implementation from its outputs.
This is known as the oracle problem in software
testing. Recently, the technique of metamorphic
testing has been proposed for testing software
without the need of an oracle (Chan, Chen, Lu, Tse &
Yao (2006); Chen, Cheung & Yu (1998); Chen, Tse
& Zhou (2002); Zhou, Huang, Tse, Yang, Huang &
Chen (2004)). This technique identifies some
necessary properties of the application domain as
metamorphic relations (MRs), that (as discussed in
Section 2) express relationships between multiple
executions, with different inputs, of the software
under test. In metamorphic testing, testers check the
MRs among multiple executions of the program
being tested – if the MRs do not hold, this indicates a
software fault.
In this paper, we study the application of
metamorphic testing to alleviate the oracle problem
of testing PID controller software. We present a case
study on the testing of the PID controller software
embedded in an ATMEL ATmega128
microcontroller. The PID controller software was
implemented in C based on the free sample code
provided by ATMEL Corporation (Atmel
Corporation, 2006). To verify the effectiveness of
using metamorphic testing in the embedded software
for control engineering, we conducted our
experiments in the control of antenna azimuth
position. Instead of building the actual antenna
azimuth position control system, we simulated the
system in the embedded platform using Z-transform.
This approach eliminates the measurement error in
the mechanical position measurement and avoids
hardware faults interfering with the testing of the PID
controller software.
The rest of the paper is organized as follows. In
Section 2 we briefly present the technique of
metamorphic testing. Section 3 presents the basic
design of the PID controller. In Section 4, we identify
four MRs for PID controllers. We then apply the
technique of metamorphic testing to test the software
of a PID controller. Section 5 briefly analyzes
threats to validity. Section 6 concludes our paper by
considering the implications of the work and
identifying opportunities for future research.
Detailed justification of the MRs are provided in the
Appendix.
Figure 2: Feedback control system.
2 METAMORPHIC TESTING
Metamorphic testing (Chen, Cheung & Yiu, 1998) is
a property-based approach to software testing. It does
not check the correctness of individual outputs.
Instead, it checks metamorphic relations among
multiple executions of the target program. A
metamorphic relation (MR) is an expected relation,
which is identified from the necessary properties of
application domain, over a set of distinct input data
PECCS 2011 - International Conference on Pervasive and Embedded Computing and Communication Systems
388