lab0 - Lab 0 Assigned: Session 2 Due: Session 4 in class...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Lab 0 Assigned: Session 2 Due: Session 4 in class Reading: Simulink manual or text 2.737 Mechatronics The purpose of this lab is to give you a quick snapshot of how the course will work and to get you familiar with the lab hardware and software. A second purpose is to get you ready for Lab 1 which will be handed out next week. Please start this lab immediately so that you can have it done in time. We expect that you can complete this work in about 3 hours of lab time, with an hour or two of prep time. 1 Introduction Today! The staff will be in the lab today, from 2­5 pm to handle the distribution of lab kits and user accounts, and to help you get started on Lab 0. Do not all come to the lab at 2 pm as we will not be able to handle the overload. Before coming to the lab, take the form you received in lecture to the cashier’s office in order to pay for the lab supplies. You will need to bring the cashier’s receipt with you in order to pick up a lab kit. You will need a lab kit to do some sections of this assignment and for all of the remainder of the labs in the course. Staff will also be in the lab on a day before and after Session 4, from 2­5 pm to help you with any lab­related questions. Lab kits The lab kits consist of a set of consumables (resistors, capacitors, IC’s, wire, etc.) in a plastic box, and a set of returnables (lab kit, tools, cables, meter, and meter leads). The consumables are yours to keep. The returnables must be promptly returned to us at the end of the semester. The kits cost $500 to replace, and you will be billed for this amount if they are not returned promptly at the end of the semester. If the kits are returned late you will be billed a $25 late fee. We expect to have lockers for the kits in the lab shortly. Until then, you will need to take the kits with you when you leave the lab. You are responsible for the kits; if they are lost/stolen you will be charged for the replacement cost. 2 Assigned work for Lab 0 The work of this lab is broken into the three numbered assignments below. 1: Lab equipment The purpose of this section is to familiarize you with the lab oscilloscop e and function generator. Connect the function generator to one of the scope channels and observe the waveform output by the function generator. Play around with differ­ ent waveforms ­ sinusoidal, triangular and square waves; frequencies; amplitudes and offsets. Familiarize yourself with the controls on both the function generator and the oscilloscop e. You can refer to a copy of the scope manual left in the lab to help you use the various features of the scope. Please keep this manual in the lab so that others have access to it. No report is required for this section, but we will assume you are familiar with the scope in future labs; please ask any questions you may have about its operation. Analog filter simulation A first­order analog filter with unity DC gain is given by H (s) = 1 . τ s + 1 This has a unit step resp onse of y (t) = 1 − e−t/τ ; t ≥ 0, 1 where y (t) is the filter output. In the next section of the lab we ask you to simulate such a filter as driven by a square wave in Simulink. We then ask you to go into the lab and implement this filter on the real­time DSP hardware. 2: Simulink implementation Note: This portion of the assignment can be done on any computer which has Simulink installed, such as an Athena machine, the lab computers, your home machine, etc. A student version of Matlab/Simulink is available for purchase at the Coop. Build a Simulink block diagram which implements the first­order analog filter given above, as driven by a signal generator, with the time constant τ set to 1 msec. Your block diagram will look like 1 tau.s+1 Signal Generator Transfer Fcn Scope In order to make it easy to change the time constant, enter τ as a variable name in the transfer function block. Then you can set τ at the Matlab command line and this change will be reflected in a simulation, even when running. Look at the output on a Simulink scope window. With the signal generator set to produce a square wave at an appropriate frequency, you can generate the step response for this filter. Save step resp onses for several values of τ , overlay these on one plot in the Matlab workspace and print this out on any convenient printer. Include a printout of your Simulink diagram and the resulting step responses in your lab report. If you are unfamiliar with Simulink, take a look at the online manuals available on Athena or on the lab computers to see an example of building and simulating a block diagram in this environment. Alternately, you can look at the optional text on Simulink listed in the course information sheet (and our web page). It is important that you are comfortable in the Matlab/Simulink environment, since we will be using this to implement all the real­time algorithms on the course lab hardware. 3: Filter implementation on dSPACE board In this section, we ask you to implement the filter on the real­time DSP board. To do this, you will use the Tektronix signal generator for the source and the Tektronix oscilloscop e as the display. The filter is implemented on the DSP through the Real Time Workshop (RTW) in Simulink. The connection is shown below: The signal generator is read through A/D channel 1, the signal is filtered in digital form by the DSP and then output to analog form on D/A channel 1. The oscilloscop e is used to display the analog output. You need to make the physical connections on the protoboard (as labeled on the green interface card), and the DSP processing connections in the block diagrams. The A/D and D/A icons in the diagram above provide the conceptual connection between these two systems. 2 The physical connections are shown below. Note that since the BNC shell is tied to ground on the connected signal generator and scope, it is tied to the AGND pin on the DSP connector. Be sure not to reverse the polarity of this connection, as you may damage the DSP card electronics. If you have any questions about this, ask one of the teaching staff before making the connections. Within the Simulation Parameters dialog in Simulink you will need to specify the in­ tegration routine and fixed­step sample time. Choose Euler (the simplest and fastest) and a sample time of 0.0001 sec. Set the signal generator to produce square waves, with a ±5 volt peak amplitude. Make a sketch of any interesting features of the waveforms that you observe on the scope. Is the filter accurately simulated? How does the output differ from an ideal analog filter? What does the waveform look like if the time base is expanded to 1 msec/div? 0.1 msec/div? Why? What evidence do you see for the discrete­time operation of the DSP? What happens if you increase the sample time? 3 Lab report The report requirements for this lab are minimal. You only need to turn in what is requested in the three sections listed above. The main point of this exercise is to get you into the lab and running the hardware as soon as possible so that you are ready for Lab 1 when it is assigned next week. 4 Supporting information Please see the accompanying handout for details of how to log onto the computers, how to start up the real­time workshop under Simulink, etc. 3 ...
View Full Document

This note was uploaded on 02/24/2012 for the course MECHANICAL 2.737 taught by Professor Davidtrumper during the Spring '99 term at MIT.

Ask a homework question - tutors are online