Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE 495: Integrated System Design I CLEMSON U N I V E R S I T Y Introduction to Real- Time, Closed-loop Control.

Similar presentations


Presentation on theme: "ECE 495: Integrated System Design I CLEMSON U N I V E R S I T Y Introduction to Real- Time, Closed-loop Control."— Presentation transcript:

1 ECE 495: Integrated System Design I CLEMSON U N I V E R S I T Y Introduction to Real- Time, Closed-loop Control

2 2 ECE 495 – Integrated System Design I Outline Real-time systems – Motivation – Examples – xPC target Closed-loop Systems – Motivation Real-time, Closed-loop Systems – Apply theory from ECE409 to a physical system Implementing Real-time, Closed-loop Systems – xPC target + Quanser hardware

3 3 ECE 495 – Integrated System Design I Real-time System Computer-based execution of a program loop: Instructions or algorithm System Speed and predictability of execution times distinguish systems 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 4 ECE 495 – Integrated System Design I Classification of Real-time Systems Real-time System SoftHard Dynamic Static System must remain synchronous with the state of the environment. Degraded operation in a rarely occurring peak load can be tolerated. Timing parameters for the system are set during compilation. Timing parameters and the priority for tasks is modified at run-time.

5 5 ECE 495 – Integrated System Design I Hard Real-time System Soft Real-time System Example: Produce a sinusoid output D/A Error in output waveform Error in execution time Classification of Real-time Systems

6 6 ECE 495 – Integrated System Design I 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 7 ECE 495 – Integrated System Design I Hardware Systems in ECE 495 Amplifier Motor 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 8 ECE 495 – Integrated System Design I Which system would you use in ECE 495? Real-time System SoftHard Dynamic Static Systems Non-Real-time System Speed and predictability are both critical Response to input has to come at a precise time System timing parameters are known before execution In ECE 495, we use a Static, Hard Real-Time System

9 9 ECE 495 – Integrated System Design I How is a Real-time System formulated? More generally, to Relate Theory to Application Continuous Process Digital System Model of Continuous Process 1. Want to measure or control this process 2. Use engineering tools to model the process using continuous or fixed sample time discrete models (For example ECE409, ECE 467) 3. Formulate interaction algorithms based on the models (For example ECE409, ECE 467) 4. Execute algorithms (assume a continuous system can be approximated by a fast digital system) Design Error if execution timing doesnt match assumptions in model and algorithms - results are not predictable.

10 10 ECE 495 – Integrated System Design I Real-time System – xPC Target

11 11 ECE 495 – Integrated System Design I Real-time System – xPC Target Design a Simulink model on the host PC Program is downloaded to target for real-time execution Boot CD installs a real- time kernel on target Build the Simulink model Host and target coordinate for downloading programs Some parameters can be changed on host. This change is communicated to target. Host Target

12 12 ECE 495 – Integrated System Design I 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 13 ECE 495 – Integrated System Design I Closed-Loop Control System Closed-loop control: 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 14 ECE 495 – Integrated System Design I Closed-Loop Control System System 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. Output Feedback Desired output =Error + _ Input

15 15 ECE 495 – Integrated System Design I 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) System Output Feedback Desired output + _ Input

16 16 ECE 495 – Integrated System Design I 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 17 ECE 495 – Integrated System Design I Implementing Real-time, Closed-loop Systems System Output Feedback Desired output + _ Input Target PC OS Q4 Control Board and Terminal Board Host MATLAB with Simulink C++

18 18 ECE 495 – Integrated System Design I 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 19 ECE 495 – Integrated System Design I 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 20 ECE 495 – Integrated System Design I 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 21 ECE 495 – Integrated System Design I Implementing Real-time, Closed-loop Systems 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 Quanser Q4 card in the Target PC To terminal board

22 22 ECE 495 – Integrated System Design I Implementing Real-time, Closed-loop Systems DAC Channels Ext Interrupt and Signal Pins ADC Channels Encoder Channels Digital IO Ports From Q4 board Q4 Terminal Board

23 23 ECE 495 – Integrated System Design I 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.


Download ppt "ECE 495: Integrated System Design I CLEMSON U N I V E R S I T Y Introduction to Real- Time, Closed-loop Control."

Similar presentations


Ads by Google