LAB 1 MATLAB, dSPACE and Simulink

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

Introduction to Multisim ECE 1020 Professor Ahmadi.
Getting started with Simulink An introductory tutorial ES205 Analysis and Design of Engineering Systems Rose-Hulman Institute of Technology © R. Layton.
What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially.
475 Wall Street, Princeton NJ Introduction to PSCAD © 2012 Nayak Corporation Inc. 1.
1 A Tool for System Simulation: SIMULINK Can be used for simulation of various systems: – Linear, nonlinear; Input signals can be arbitrarily generated:
Using Excel for Data Analysis in CHM 161 Monique Wilhelm.
Controls Lab Interface Improvement Project #06508Faculty Advisors: Dr. A. Mathew and Dr. D. Phillips Project Objectives This work focused on the improvement.
SIMULINK Dr. Samir Al-Amer. SIMULINK SIMULINK is a power simulation program that comes with MATLAB Used to simulate wide range of dynamical systems To.
HossamTalaat - MATLAB Course - KSU - 21/1/24 1 IEEE Student Branch - College of Engineering - KSU Getting started with Simulink By Prof. Hossam Talaat.
Arduino Week 3 Lab ECE 1020 Prof. Ahmadi. Objective Data acquisition (DAQ) is the process of measuring an electrical or physical phenomenon such as voltage,
1 QED In Vivo USB Input Output Box configuration This tutorial contains a number of instructions embedded in a great deal of explanation. Procedures that.
NI Multisim and Ultiboard
BoardMaker Ver 6 Creating Interactive Activities for the Classroom.
DEMONSTRATION FOR SIGMA DATA ACQUISITION MODULES Tempatron Ltd Data Measurements Division Darwin Close Reading RG2 0TB UK T : +44 (0) F :
1 Creating Icons for Commands When there is not an icon related to a command in your toolbars, you will see a question mark (?). No preview available …
Creating a Web Page HTML, FrontPage, Word, Composer.
TrendReader Standard 2 This generation of TrendReader Standard software utilizes the more familiar Windows format (“tree”) views of functions and file.
Digital Image Processing Lecture3: Introduction to MATLAB.
Copyright 2007, Information Builders. Slide 1 Maintain & JavaScript: Two Great Tools that Work Great Together Mark Derwin and Mark Rawls Information Builders.
Introduction to LabVIEW
1 iSee Player Tutorial Using the Forest Biomass Accumulation Model as an Example ( Tutorial Developed by: (
Controlling a 3D Vehicle with Simulink Jeff Bender ME
Introduction to Simulink Dr. Mohammed F. Alsayed.
Basic Pspice Instructions Stuart Tewksbury
High Speed Data Converter University
Mentor Tools tutorial Bold Browser Design Manager Design Architect Library Components Quicksim Creating and Compiling the VHDL Model.
Simulink ® Interface Course 13 Active-HDL Interfaces.
Renesas Technology America Inc. 1 SKP8CMINI Tutorial 2 Creating A New Project Using HEW.
Control Theory Lab 4 Modeling of Physical-SİMULİNK.
Active-HDL Interfaces Debugging C Code Course 10.
Project Deployment IT [211 CAP] How to convert your project to a full application.
ECEN/MAE 3723 – Systems I MATLAB Lecture 2. Lecture Overview What is Simulink? How to use Simulink  Getting Start with Simulink  Building a model Example.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
Graphical Analysis in Excel EGN 1006 – Introduction to Engineering.
Introduction to MATLAB for Engineers Third Edition William J. Palm III Chapter 10 Simulink PowerPoint to accompany Copyright © The McGraw-Hill Companies,
Renesas Technology America Inc. 1 M16C Seminars Lab 3 Creating Projects Using HEW4 14 March 2005 M16C Seminars Lab 3 Creating Projects Using HEW4 Last.
SIMULINK-Tutorial 1 Class ECES-304 Presented by : Shubham Bhat.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VII Introduction to SIMULINK Rajeev Madazhy
Velleman Oscilloscope: Windows 7 by Mr. David Fritz.
DC Motor Speed Modeling in Simulink
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
EE3417 – Introduction to Simulink
Modeling of Power Converters using Matlab and Simulink
Simulink Simulink is a graphical extension to MATLAB for modeling and simulation of systems. In Simulink, systems are drawn on screen as block diagrams.
INTRODUCTION TO SIMULINK by Yasmin Hanum Md Thayoob & Aidil Azwin Zainul Abidin.
The desktop (overview) Working with desktop icons The desktop is the main screen area that you see after you turn on your computer and log on to Windows.
Know your Operating System Thanks to Dina Sokol. An operating system is software (a computer program) that manages your computer.
Introduction to Matlab Module #10 Page 1 Introduction to Matlab Module #10 – Creating Graphical User Interfaces Topics 1.Overview of GUI Development using.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
Project Planning Defining the project Software specification Development stages Software testing.
Data Analysis GUI Documentation guide. Terminology GUI – Graphical User Interface Log-File – File containing data of interest which is generated by user’s.
Introduction to LabVIEW
XP New Perspectives on Creating Web Pages With Word Tutorial 1 1 Creating Web Pages With Word Tutorial 1.
STEP-1 START PROTEUS Click on START button and you will get “ Proteus 7 professional “  Install Lab Center Proteus in the PC.  After Successful installation.
Getting started with Simulink
Getting started with Simulink An introductory tutorial.
BEST Robotic, Inc. MATLAB/Simulink Team Training
WORKSHOP 1 CO-SIMULATION.
WORKSHOP 1 introduction
WORKSHOP 2 VALVETRAIN MECHANISM
WORKSHOP 2 VALVETRAIN MECHANISM
ECEN/MAE 3723 – Systems I MATLAB Lecture 2.
An Introduction to Computers and Visual Basic
Topics: Arduino Target Package
Quanser Rotary Family Experiments
Getting Started With Simulink
An Introduction to Computers and Visual Basic
Simulink Examples Ex1: Simulate the following equation Blocks needed:
Presentation transcript:

LAB 1 MATLAB, dSPACE and Simulink

Lab Objectives Familiarize yourself with the hardware used in this course; Learn how to do data acquisition using dSPACE; Learn basic MATLAB programing; To achieve these objectives, you need to Measure the angular position of the shaft by using the pot; Acquire the data using dSPACE data acquisition system; Plot your data using MATLAB;

Hardware Make sure you know Where the pot is in the Quanser box; Schematic for the Quanser Box Quanser Box of motor, gears, and potentiometer (pot) Make sure you know Where the pot is in the Quanser box; How a pot works (Measure the pot output voltage using a multimeter as you rotate the pot).

Hardware Wiring for data acquisition (measuring) NOTE: Yellow signal line connects the data to the dSPACE channel 5; Connect dSPACE box to the "ground" on the Power module; +/- 12 volt to the potentiometer

Overview of the Software We will: Build a user interface in the dSPACE environment to observe the response, and save the measured data; Use Matlab-Simulink to build the program to drive the dSPACE data acquisition card (that is, to tell dSPACE how we want to do the measurement); Transfer the data into Matlab, and use Matlab to plot the data;

What do you need to learn about the Software? How to make dSPACE and MATLAB work together; How to build the program (model) in Simulink to do the data acquisition; How to measure and save data using dSPACE environment; How to write MATLAB code to do data processing; Next, we will guide you through a step-by-step procedure!

Step 1: Open MATLAB and dSPACE Click on “ ” to open Matlab; Choose RT1104 when this box comes up; Click on “ ” to open dSPACE (IMPORTANT: Open Matlab before you open dSPACE!!)

Step 2: Choose your working directory Make a folder on a local drive (in C:\ or D:\ ) to save your data; Make sure both Matlab and dSPACE use that folder as the working directory; Matlab first:  Set the default directory to the folder you just made!

Step 2-2: Set the directory for dSPACE In dSPACE enviornment, click “File> New Experiment”; Choose whatever name you want for “Experiment name”. Direct the "Working root" to the folder you just make—same one you just set for MATLAB;

Step 3: Create Simulink Model Type “Simulink” in theMATLAB command window and the Simulink menu will appear; To start a new model, choose: File>New>model; Go down to the bottom of the Simulink Library Browser and choose: dSPACE RT1104>DS1104 Master PPC, then select DS1104ADC_C5 Drag this block into your Simlink model window. This is the analog-to-digital connection to dSPACE. From the Simulink Library Browser, select: Sinks > Scope From the "Commonly Used Blocks" or "Math Operations", choose: Gain.   Then drag this to your model.

Step 3: Create Simulink Model Once you use the cursor to connect the blocks, you should have a model that looks something like the right; Adjust the "Gain" to 10 by double clicking on it (NOTE: We need the "Gain" block because the dSpace ADC converts the measured voltage to a range of +/- 1. Since we have dSPACE set to read +/- 10 volts, we correct the returned measurement by a factor of 10. Save the model, then build the model by choose: Tools > Real-Time Workshop>Build Model (or use cntl +B!). Wait MATLAB to do the “building”, until you see the message: ### Successful completion of Real-Time Workshop build procedure for model: lab1 *** Finished RTI build procedure for model lab1

Step 4: Link the Simulink Model with dSPACE Go to the dSPACE window (Control Desk Developer window). After the "build" in MATLAB, a new tab appears at the bottom with the name of your model on it ; Choose this tab, and we'll start a new experiment "Layout“: File > New > Layout. (Your workspace should look the one on the bottom right); New tab

Step 4: Build the dSPACE layout Select: Data Acquisition > Capture Settings; Drag in "layout" to desired size; Now we connect the MATLAB variables to the graphical output. Choose: Model Root>Scope> In1 Drag "In1" onto Plotter Array area, and that will connect the measured value to the display output;

Step 4: Build the dSPACE layout Select : Data Acquisition > Capture Settings. Drag in "layout" to desired size. Choose "PPC Lab 1 Host services" and adjust the length of measurement to any desired time, 5 seconds will be good here.

Step 5: Start the measurement Start the data collection by clicking the icon shown. Try using some of the other Virtual Instruments. Choose: Virtual Instruments > Display Drag and size on layout… Model Root > Gain drag "Out1" to "display”; First, read the voltage off of the digital readout, “Gain/Out1”. (Verify at least one reading using an external voltmeter. )

Next, you need to move the potentiometer and plot both the position and velocity as a function of time. Step 5:

Step 6: Process data in MATLAB Make sure you have the file saved to your folder. DO NOT USE A NUMBER TO START YOUR “filename”! “TenDeg” is OK, but not “10deg”. Load it into the MATLAB workspace by typing the following line in MATLAB command window: load filename Convert the data into arrays by typing the following commands (As the file is saved as a structure): time=filename.X.Data; volts=filename.Y(1).Data; Convert the “volts” to degrees, using the information you collected in the first part of the lab; To obtain rate (i.e., angular velocity), you need to write a MATLAB m-file that implements the finite difference equation for the velocity:   Here is some sample code: for k=2:length(volt); dv(k)=(volt(k)-volt(k-1))/(time(k)-time(k-1)); end

Useful Matlab Commands “plot”, “label”, “legend”, “subplot”—for plotting data; “save”, “load”—for save and load data; (Read the help file from Matlab to learn how to use them, ask your TA if you have question).

Lab Report Show a graph of volts vs degree and determine the gain between the measured voltage and the angle. What units is this gain in? Show the continuous motion in a graph with position vs time, Show the velocity vs time in a graph. Be sure to choose some point in time on the position graph, find the slope at that point and compare it with the corresponding velocity on the velocity graph. This is to validate your measurements. Discuss: Do the speeds that you see on your graph correlate with the speed that you moved the gears? If you find that your measurements read 0.0001 deg/sec or 100,000 deg/sec, your measurements are probably wrong. Use the guidelines in "Report Writing for Fun and Profit", found on the class website, to write up this report.