z-logo
open-access-imgOpen Access
Real-time Control Implementation of Simple Mechatronic Devices Using MATLAB/Simulink/RTW Platform
Author(s) -
Abhijit Nagchaudhuri
Publication year - 2020
Publication title -
2011 asee annual conference and exposition proceedings
Language(s) - English
Resource type - Conference proceedings
DOI - 10.18260/1-2--18409
Subject(s) - mechatronics , computer science , compiler , matlab , pid controller , control engineering , visual programming language , software , simple (philosophy) , control system , instrumentation (computer programming) , simulation , computer hardware , programming language , artificial intelligence , engineering , electrical engineering , temperature control , philosophy , epistemology
In this paper digital control solutions for speed control of direct current (DC) motor and level control of dual water tank system are described using conventional control algorithms such as (PID ( Proportional + Integral + Derivative) and PI ( Proportional + Integral)), as well as intelligent control algorithms based on fuzzy logic. The control algorithms are developed in the Simulink graphical programming environment. Using Real-time Workshop (RTW) build tools an optimized “C” language code is generated and compiled for real-time execution on the devices using a Visual C/C++ compiler, seamlessly. Appropriate software tools have also been utilized to allow remote activation of the systems. This capability allows realistic CAD (Computer Aided Design) drawings that accurately represent the physical systems on the remote terminals to exhibit appropriate motion corresponding to the actual movement of the physical system in the laboratory. The set-up is used for experiential learning and research efforts involving engineering and computer science majors at the university, as well as for demonstration purposes for the introductory Control Systems (ENGE 382) and Instrumentation (ENGE 380) courses offered by the author for engineering majors. 1.0 INTRODUCTION Mechatronics [1-3] embodies the synergy of mechanical design, electronics, control, softcomputing and information technology. In this paper various aspects of the field of “Mechatronics” is explored using simple laboratory devices – (a) Direct Current (DC) servo-motor and, (b) Dual water tank system, with appropriate electronic interfaces for sensing and control. Particular emphasis is paid towards (i) digital control using both conventional and intelligent control algorithms for speed control of the DC servo-motor and level-control of dual water tank system, and (ii) remote activation and observation of these devices over the internet. These devices have been installed in the University of Maryland Eastern Shore Mechatronics and Automation Laboratory(UMESMAL). Other equipment in the laboratory includes LEGO Mindstorms Robotics Invention System/NXT, CONTROL LAB from LEGO-DACTA, MIT HandyBoard and Handy Cricket for outreach activities to middle and high school students and/or freshman design projects; a four degree of freedom industrial SCARA robot, a computer vision system that can work with the SCARA robot for flexible automation tasks, as well as independent inspection and other applied image analysis tasks; digital control platforms for demonstration of vibration and control, inverted pendulum, and dual water tank system; various Computer Aided Engineering (CAE) software tools including, ProEngineer, Working Model 2D, basic MATLAB and associated toolboxes for Statistics, Image Analysis, Neural Networks and Fuzzy Logic. Interested readers are encouraged to peruse reference 4 for an elaborate description of the laboratory. 2. REAL-TIME CONTROL PLATFORMS Photograph [1] and Photograph [2] show digital servo-motor based platforms installed in the laboratory being utilized for control experiments for a compliant rotary link to demonstrate active damping, and a rotary inverted pendulum system to demonstrate control application to stabilize an open-loop unstable system. The DC servo-motor which forms the base of these devices is used to demonstrate the speed control experiments reported in this paper. Photograph 1:Vibration Control Platform Photograph 2 : Rotary Inverted Pendulum. Photograph [3] shows the “Dual Water Tank” system. The system consists of two small watertanks one on top of the other and a water reservoir at the bottom of the lower tank. Each tank has an outlet valve which can be opened or closed to various orifice diameters. Water flows from the top tank into the bottom tank. Both tanks have calibration marks on them for visual determination of the water level in the tanks. Each tank is also provided with a pressure sensor at the base which can be appropriately calibrated to determine the level of the water in each tank for feedback control purposes. The input to the system is via a water pump which feeds water to the top tank. The flow rate is controlled by speed of a direct current motor that drives the pump using input from a digital computer running an appropriate feedback control algorithm for various water level control tasks. Photograph 3. Dual Water Tank System 3. REAL-TIME CONTROL SOFTWARE TOOLS The control algorithms are developed in Simulink, a visual programming environment provided by Mathworks, which are interpreted and compiled via Real Time Windows Target, Real Time Workshop and a Visual C++ compiler. Digital control solutions involving (i) PI (Proportional + Integral) and PID (Proportional + Integral + Derivative) for control tasks such as keeping the water in the upper water tank at a constant level or varying water level in the upper water tank using a square wave or sinusoidal wave around a set level, (ii) optimal control of active vibration damping of the compliant joint system, and (iii) stabilizing a rotary pendulum vertically using optimal feedback using proportional and derivative gains have been implemented. Feedback gains have been adjusted to achieve desired response for all cases. These efforts and student demonstrations have been performed with the hardware set-up and basic framework of the Simulink code provided by Quanser Consulting Co: (QCC), the equipment vendor. In this paper (i) PID and fuzzy control for speed control of a DC servomotor and (ii) PI and fuzzy control for water level control in the upper tank of the dual water tank system developed on the QCC platforms are elaborated. The demonstration of fuzzy control solutions developed inhouse, and the remote activation capability, to undergraduate students in courses related to instrumentation and control provide an enriching exposure to promote interest in the high tech field. 4. PID AND FUZZY CONTROL OF DC MOTOR Figure 1 shows the Simulink code for the PID control algorithm implemented to realize the speed control of a DC Servo-motor. Fig. 1. Simulink code for PID control of DC motor Simulink is an excellent visual/graphical programming tool for control algorithm development. It can use constant blocks, software comparators, gain blocks, scopes, pre-defined mathematical operations block, and variety of other pre-defined blocks on simulated or real-time signals to generate appropriate control outputs to software displays, or to real hardware subsequent to digital to analog conversion. In Figure 1, the desired speed (RPM) is inputted into the constant block shown in the upper left hand corner. The two gain blocks that follow are for (i) changing the desired speed by multiplying by an appropriate factor and (ii) to convert the desired speed from R.P.M to radians/sec. The block that follows performs integration of the signal to generate the position information in radians. This signal is sent to a comparator block as well as tapped off to a scope for display. The second input to the comparator block comes from the optical encoder attached to the motor. The signal from the encoder is high pass filtered appropriately to generate the actual velocity signal. With the desired and actual position and velocity signals it is possible to generate the appropriate error signals to produce the analog output signal corresponding to the voltage or current using PI, PD or PID algorithms. These signals then may be applied to the DC motor following digital to analog conversion. Fig. 2. Simulink code for fuzzy control of DC motor In Figure 2 the position and velocity errors are obtained in a similar fashion and fed to a “Fuzzy Logic Controller(FLC)” block as shown. TABLE 1: Fuzzy Tuning Rules Fig. 3. & Fig. 4. (i) Fuzzy Inference System and (ii) Output Membership functions. Table 1 provides the fuzzy tuning rules for the Mamdani type direct fuzzy controller used for the speed control of the DC servo-motor. Figures [3] and [4] give a schematic overview of the Mamdani type fuzzy controller 5,6 developed using MATLAB‟s Fuzzy Logic Toolbox(FLT) for the servo-motor speed control. The FLT provides five graphical user interfaces (GUI) tools for building, editing, and observing fuzzy inference systems(FIS): (i)FIS editor (Fig 3),(ii) the Membership Function Editor that is used for both the input space and output space ( Fig 4), (iii) the Rule Editor(Fig 5), (iv) the Surface Viewer(Fig 6) and (vii) the Rule Viewer ( Fig 7). The figures show the two fuzzified input membership functions representing the error and change in error, the fuzzy inference engine, and the fuzzy output membership function corresponding to actuator signal or motor torque. The error and change in error has been fuzzified into three overlapping levels N-negative, Zzero and P-Positive. The output has more granularity and has seven levels but the two extremities are never reached. The nine rules as indicated in Figure 5 corresponding to Table 1 perform adequately. Figure 6 represents the mapping between the inputs (error and change in error) and the output torque using the fuzzy inference engine (rules). Fig. 5. & Fig. 6. (i) Fuzzy Rules and (ii) Fuzzy Input Output Map E/CE N Z P

The content you want is available to Zendy users.

Already have an account? Click here to sign in.
Having issues? You can contact us here
Accelerating Research

Address

John Eccles House
Robert Robinson Avenue,
Oxford Science Park, Oxford
OX4 4GP, United Kingdom