Download presentation
Presentation is loading. Please wait.
1
ECE 495: Integrated System Design I
CLEMSON U N I V E R S I T Y ECE 495: Integrated System Design I Introduction to Real-Time, Closed-loop Control
2
Outline Real-time systems Motivation Examples xPC target Closed-loop Systems Real-time, Closed-loop Systems Apply theory from ECE409 to a physical system Implementing Real-time, Closed-loop Systems xPC target + Quanser hardware
3
Real-time System Computer-based execution of a program loop:
Speed and predictability of execution times distinguish systems Instructions or algorithm System Real-time system: the correctness of the system behavior depends not only on the logical results of the computations, but also on the physical instant at which these results are produced.
4
Classification of Real-time Systems
System must remain synchronous with the state of the environment. Degraded operation in a rarely occurring peak load can be tolerated. Soft Hard Dynamic Static Timing parameters and the priority for tasks is modified at run-time. Timing parameters for the system are set during compilation.
5
Classification of Real-time Systems
Example: Produce a sinusoid output Hard Real-time System D/A Error in output waveform Soft Real-time System D/A Error in execution time
6
Examples of Real-time Systems
QUARC from Quanser Soft Real-time System using PC with Windows QUARC from Quanser Hard Real-time System using QNX
7
Hardware Systems in ECE 495
Motor Amplifier If you were controlling the position of the motor, you would want the motor to stop at a certain shaft angle. But you would also want to stop at the right time to prevent overshooting and potentially damaging components!
8
Which system would you use in ECE 495?
Systems Speed and predictability are both critical Non-Real-time System Real-time System Response to input has to come at a precise time Soft Hard System timing parameters are known before execution Dynamic Static In ECE 495, we use a Static, Hard Real-Time System
9
How is a Real-time System formulated?
More generally, to Relate Theory to Application Digital System 4. Execute algorithms (assume a continuous system can be approximated by a “fast” digital system) Continuous Process 1. Want to measure or control this process Error if execution timing doesn’t match assumptions in model and algorithms - results are not predictable. Design 3. Formulate interaction algorithms based on the models (For example ECE409, ECE 467) 2. Use engineering tools to model the process using continuous or fixed sample time discrete models (For example ECE409, ECE 467) Model of Continuous Process
10
Real-time System – xPC Target
11
Real-time System – xPC Target
Host Target Design a Simulink model on the host PC Boot CD installs a real-time kernel on target Build the Simulink model Host and target coordinate for downloading programs Program is downloaded to target for real-time execution Some parameters can be changed on host. This change is communicated to target.
12
Closed-Loop Control System
Open-loop control: Input designed to move the system to a desired state based on current conditions and model of the system. Example: Fill a water tank to a specified level based on flow-rate and time. If some of the water evaporates during filling then the level will be wrong If flow rate is not exactly as expected then the level will be wrong. Inaccurate time will lead to the wrong level Desired level Actual level
13
Closed-Loop Control System
Input changes as the error, difference between the desired output and the measured output, changes. Example – fill a tank to a specified level based on measuring the tank level and turning flow “on” or “off” to reach the desired level. Anything that prevents the tank from being filled to the desired level will be compensated. Desired level = Actual level
14
Closed-Loop Control System
Desired output Input =Error Output + System _ Feedback Open-loop control: Input designed to move the system to a desired state without knowing if it achieves the state Closed-loop control: Input= changes as the error based on output until a desired state is reached.
15
Real-time Closed-loop Control
What is Real-time Control ? Any change in the feedback produces change in the input to the system within the guaranteed response time. (Hard Real Time Control) Desired output Input Output + System _ Feedback
16
Real-time Closed-loop Control
Typical response times and the applications which need them … Seconds : Temperature, pressure, and flow control; aircraft control Milliseconds (control with < 1 kHz): Productions lines, motor control, robot control Microseconds : High speed test stands, fast digital controllers, control with 5 kHz – 500 kHz
17
Implementing Real-time, Closed-loop Systems
Host MATLAB with Simulink C++ Desired output System Input Output + _ Target PC OS Q4 Control Board and Terminal Board Feedback
18
The utility of MATLAB Simulink
MATLAB/Simulink are used to prototype, simulate and visualize performance of systems. Math model of system MATLAB Simulink Model Visualization: Plots, Scopes, etc.
19
Why MATLAB/SIMULINK over C++?
MATLAB is a huge collection of C/C++ libraries for system prototyping and hardware interfacing. No need to reinvent the wheel! Would you rather spend weeks writing device drivers and libraries for the Q4 than test your system in a few hours? Prototyping ideas is easy and fast. Visualization of data is easy.
20
Using C/C++ Code in MATLAB
MATLAB allows the use of user defined C/C++ executables (MEX files) to augment functionality. Computationally expensive tasks can be carried out using C and data can be sent to MATLAB. E.g. Camera interfacing for image processing. Specific manipulation of data can be programmed into a user defined function (called the S-function) in Simulink. S-functions are C-code snippets embedded in the Simulink environment.
21
Implementing Real-time, Closed-loop Systems
Quanser Q4 card in the Target PC To terminal board 4 x 14 bit Analog Inputs 4 x 12 bit D/A Outputs 4 Quadrature Encoder Inputs 16 Programmable Digital IO Channels 2 x 32 bit dedicated Counter/ Timers 2 External Interrupt sources 32 bit, 33MHz PCI Bus Interface
22
Implementing Real-time, Closed-loop Systems
Q4 Terminal Board From Q4 board DAC Channels ADC Channels Ext Interrupt and Signal Pins Encoder Channels Digital IO Ports
23
A final thought … The Q4 cards being used for data acquisition and control are very useful… and very expensive. Read the manuals for voltage limitations and proper use.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.