Asee peer logo

A Systematic Approach for Development and Simulation of Digital Control Algorithms using SIMULINK

Download Paper |


2013 ASEE Annual Conference & Exposition


Atlanta, Georgia

Publication Date

June 23, 2013

Start Date

June 23, 2013

End Date

June 26, 2013



Conference Session

Laboratory Experiences in Signal Processing and Controls

Tagged Division

Division Experimentation & Lab-Oriented Studies

Page Count


Page Numbers

23.119.1 - 23.119.12

Permanent URL

Download Count


Request a correction

Paper Authors


Matthew G Feemster U.S. Naval Academy

visit author page

Matthew Feemster received his Ph.D in Electrical Engineering from Clemson University in 2000. From 2000 to 2002, he was the lead Controls Engineer at WaveCrest Laboratories based in Dulles, VA. In 2002, he accepted a position at the U.S. Naval Academy where he is currently an Associate Professor. His current research interests include nonlinear/adaptive control techniques applied to marine applications.

visit author page

Download Paper |


A Systematic Approach for Development and Simulation of Digital Control Algorithms using SIMULINK I. ABSTRACTWith much of the department’s faculty research aligned with autonomous aerial, ground, marine, or underwatervehicles, students tend to emulate these areas by proposing related capstone projects (see Figure 1 for samplestudent driven projects). Figure 1: Student autonomous (a) aerial (b) ground (c) marine vehicleSince these vehicle related projects are developed for outdoor operation, the utilization of a micro-processor for lowlevel control algorithm implementation is frequent. In direct response to the numerous vehicle driven projects, acustom, inertial measurement unit (IMU) has been developed by our Technical Support Division based around theRabbit single board computer (SBC) (see Figure 2). Rabbit SBC 3-axis gyro/accelerometers Magnetic compass GPS receiver underneath board Figure 2: (a) WSE IMU (b) IMU integrated in autonomous surface vesselWith the development of the above IMU board, measurement of the vehicle state (position, heading, and associatedvelocities) is greatly simplified. As a result, students need only to focus on the calculation of the proper actuatorcommands to control/steer the vehicle within a C like software environment (Dynamic C). However from review offinal capstone reports and attendance of presentations, students expressed having major difficulties whenimplementing even simple PID based control algorithms. This difficulty in C based implementation seems surprisingin light that all students are required to take a two hour lab based course dedicated to the design and implementationof control algorithms on the Rabbit single board computer. Specifically this course targets the design of classicalcompensators KGc s  for a typical DC motor with implementation of the algorithm on the Rabbit SBC. Theconversion of the continuous time compensator to the corresponding digital compensator KGc z  is accomplishedvia Tustin’s Transformation (utilizing the c2d command in MATLAB). From the structure of KGc z  , studentssubsequently developed the corresponding difference equations that can now be transferred to the Rabbit SBC forimplementation. The major oversight here is that students did not simulate their difference control equations toverify that the conversion from KGc z  to equations was performed properly. If the control experiments did notperform as expected as compared to the continuous time simulation, students were unsure 1) if there are hardwareproblems (bad connections, improper sensor calibration, etc) or if 2) their control algorithm was not developedcorrectly to difference equations.In response to this observation, this paper will present a sequence within the MATLAB/SIMULINK softwareenvironment (outlined in Figure 3) to provide students with assurance that the structure of their control algorithm iscorrect. Specifically, the recent ability to utilize embedded function blocks (as opposed to previous S-functions)within the SIMULINK modeling environment has facilitated an easy method for verifying digital control algorithms.In addition, these embedded functions allow for simplified execution of non-linear models; therefore, ourundergraduate students can now also better predict experimental performance by simulating against the higherfidelity nonlinear models (as opposed to limiting themselves to linear transfer functions or linear state spacemodels). This paper will also present the translation of the MATLAB difference equations in to the Dynamic Cenvironment for select plants such as the fluid system shown in Figure 4. A student questionnaire will also beadministered this semester to gauge opinion of the process. Responses from this questionnaire will be discussed. The student must illustrate that KGc s  1 KGc Gp ea theta meets all performance specificationsConstant Continuous time Linear model simulated against the linear plant model compensator G p s  before simulating against the nonlinear model contained in the KGc Ea theta embedded MATLAB function. ea theta fcn Continuous time Nonliner model compensator (Embedded MATLAB function) KGcz Gp ea1 theta1 Digital compensator Linear model Once the student is certain that their continuous time controller is effective, they then simulate their corresponding digital controller KGc z  against the KGcz Ea theta linear and nonlinear model. ea theta fcn Digital compensator Nonliner model (Embedded MATLAB function) Pulse Generator theta ea Gp ea2 theta_2 Difference equations Linear model Utilizing the rising edge triggered subsystem block to emulate an interrupt driven service routine, students can now simulate their difference equations against Pulse Generator1 the linear and nonlinear model at a theta ea Ea theta specified sample time. ea2 theta_2 fcn Difference equations Nonliner model (Embedded MATLAB function)1 Figure 3: SIMULINK simulation process to promote confidence in control algorithmFigure 4: Rabbit SBC controlling fluid tank system

ASEE holds the copyright on this document. It may be read by the public free of charge. Authors may archive their work on personal websites or in institutional repositories with the following citation: © 2013 American Society for Engineering Education. Other scholars may excerpt or quote from these materials with the same citation. When excerpting or quoting from Conference Proceedings, authors should, in addition to noting the ASEE copyright, list all the original authors and their institutions and name the host city of the conference. - Last updated April 1, 2015