Clemson Mechatronics
ECE 495 Senior Design

Home Lectures & Assignments Current Project Tutorials References Hall of Fame Past Projects

MATLAB/Simulink and xPC

xPC target tutorial xPC Setup and Analog Loopback Test
  • What software needs to be installed for xPC Target.
  • How to configure your MATLAB and Network settings for xPC
  • How to test xPC setup using the Q4 Analog Loopback.

Downloads: [xPC Setup.doc][Simulink MDL for loopback]

amp calib Amplifier Calibration
  • Amp needs to be calibrated to unity voltage gain for the entire semester.
  • Use this simulation to get an Analog Output voltage at the Q4 Terminal Board.
  • The same DC voltage should be read at the amp terminals using a multimeter.
  • Use the gain knob on the amplifier to adjust to a voltage gain of 1.

Downloads: [Simulink MDL for calibration]

Control xPC Target Application from MATLAB

This guide describes how to control a model in xPC using the MATLAB command line. The file, cmdLineDemo.m, contains a summary of relevant commands for reading signals and writing parameter values in the example model file, cmdLineDemo.mdl

Additional example code can be found in cmdlineExtras.m.

host scope data Save Host Scope Data
  • Scope data may need to be logged for documentation or analysis.
  • The Host Scope can be used to log scope data.
  • The necessary modifications to the scope and simulation settings are described.

Downloads: [MS Word tutorial]


Image Processing using Host/Target Configuration

image processing Introduction to Image Processing
  • What is image processing and where you would use it this semester.
  • Basic concepts such as thresholding, morphological operations, background subtraction..

Downloads: [Intro to Image Processing.pptx] [m-file to demonstrate image acquisition toolbox]

amp calib Implementation alternatives - MATLAB or C++?
  • Image processing can be implemented for your project using either C++ or MATLAB.
  • C++ uses an open source library called OpenCV, widely used in the industry.
  • MATLAB allows you to work within the familiar environment in which your simulations have been designed.
  • C++ requires the use of UDP, only one of two MATLAB solutions require the use of UDP.

[MS Word tutorial]
MATLAB using xPC Command Line [Example: m-file MDL]
MATLAB using S-Functions [ZIP]
C++ using OpenCV [Visual Studio 2008 ZIP][Visual Studio 2010 ZIP]


Real Time Control

image processing Introduction to Real-Time Control
  • Understanding what it means to have a real-time system.
  • What is closed and open loop control?
  • How we design and implement real-time control systems in ECE 495.

Downloads: [PPTX slides]

dc motor simulation DC Motor Simulation and Position Control
  • DC Motor position control is used extensively in this course.
  • How can DC motors be modeled and their PID control tested using a simulation?
  • How a simulated DC motor helps understand the response of a real motor without risking component damage.
  • A tutorial on understanding DC Motor specs can be found here. [Link to PDF]

Links: Simulation Instructions and MDL file

Last update: March 13 2012 by Matt Pepper
Lab Location: Riggs 12, 23, 25
Dr. T. Burg's Homepage Clemson ECE Clemson University