CONTROL THEORY 1 LABORATORY 2

22
CONTROL THEORY 1 LABORATORY 2 Introduction to: Analog Computers and the DSPACE System. Mark Schedule 33% Preparation 67% Lab Report Contents 1 INTRODUCTION 2 1.1 Objective ..................................................... 2 1.2 Hardware Description .............................................. 2 2 USING THE COMDYNA GP-6 ANALOG COMPUTER 2 2.1 Analog Computer Elements ........................................... 2 2.2 Operation of the Analog Computer ....................................... 6 2.3 Example 1 ..................................................... 6 2.4 Example 2 ..................................................... 7 3 USING THE dSPACE SYSTEM 9 3.1 Creating a dSPACE Block Diagram ...................................... 12 3.2 The ControlDesk Package ............................................ 13 3.3 Using dSPACE to find a Step Response .................................... 17 4 Laboratory Preparation 20 5 Laboratory Procedure 20 5.1 Analog Computer ................................................. 20 5.2 dSPACE ...................................................... 21 5.3 dSPACE and the Analog Computer ....................................... 21

Transcript of CONTROL THEORY 1 LABORATORY 2

Page 1: CONTROL THEORY 1 LABORATORY 2

CONTROL THEORY 1LABORATORY 2

Introduction to: Analog Computers and the DSPACE System.

Mark Schedule

33% Preparation67% Lab Report

Contents

1 INTRODUCTION 21.1 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Hardware Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 USING THE COMDYNA GP-6 ANALOG COMPUTER 22.1 Analog Computer Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22.2 Operation of the Analog Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3 Example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.4 Example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3 USING THE dSPACE SYSTEM 93.1 Creating a dSPACE Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.2 The ControlDesk Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.3 Using dSPACE to find a Step Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4 Laboratory Preparation 20

5 Laboratory Procedure 205.1 Analog Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205.2 dSPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.3 dSPACE and the Analog Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

Page 2: CONTROL THEORY 1 LABORATORY 2

1 INTRODUCTION

1.1 Objective

The objective of this laboratory is for students to become familiar with the use of the GP6 analog computer and thedSPACE system in implementing given transfer functions. This knowledge will form the basis of later laboratories inwhich these systems are used to implement controllers or simulate control systems.

1.2 Hardware Description

The hardware used in this laboratory experiment consists of the following:

• Comdyna GP-6 Analog Computer

• Signal Generator

• oscilloscope

• IBM PC running Matlab and dSPACE software. This PC also contains a dSPACE DSP board.

2 USING THE COMDYNA GP-6 ANALOG COMPUTER

One approach to implementing a given transfer function involves using various elements contained in the Comdyna GP-6analog computer.

2.1 Analog Computer Elements

(i) Integrators: The symbol for integrators together with their patch panel layout is shown below:(Note Amplifiers1–4 must be used)

2

Page 3: CONTROL THEORY 1 LABORATORY 2

SJ’

SJ

IC

.1

.1 .1 B

amplifiers

1-41

1

1

Eo

1

1Integrator

10

1

10

1

A

B

C

D

E

F

Eo

A

B

C

D

E

F

B

SW OP

E0=- (B+C+D+10E+10F)dt-A

3

Page 4: CONTROL THEORY 1 LABORATORY 2

(ii) Alternatively, if a higher gain is required then we can use the following alternative patching

SJ’

SJ

IC

.1

.1

amplifiers

1-41

1

1

Eo

1

Integrator

1

A

B

C

D

E

F

Eo

A

B

C

D

E

F

SW OP

10

10

0

100

100

E0=- (10B+10C+10D+100E+100F)dt-A

.1 B

B

4

Page 5: CONTROL THEORY 1 LABORATORY 2

(iii) The symbol for summers together with various possible patch panel layouts is shown below:

Eo

1

10

10

A

B

C

Eo=-(A+10B+10C)

SJ’

SJ

IC

.1

.1

B

.1 B

A

B

C

D

A

D

C

B Eo

E0=-(A+B+10C+10D)

Summer

amplifiers

1-41

1

1

Eo

1

1

1

10

10

Summer

amplifer 6

Eo

1

10

A

B

C

Eo

1

16

.1

.1

A

B

C

1

.1

A

B

C

5

SJ

SJ1

1

Eo

1

Eo=-(A+B+10C)

Summer

Amplifier 5

(iv) Inverters: The symbol for an inverter together with its patch panel layout is shown below:

A 1 Eo A Eo

Eo=-A

7amplifiers 7 & 8

Inverter

(v) Potentiometers: The symbol for potentiometers together with their patch panel layout is shown below:

5

Page 6: CONTROL THEORY 1 LABORATORY 2

A

Eo

A Eo

Eo = K A

0 <K < 1

Attenuator

pots 1-6

Voltage

Divider

(pots 7 & 8)

A

B

Eo

0 < K < 1

0 < K < 1

Eo = K(A-B)+B

A

Eo

B

2.2 Operation of the Analog Computer

Setting Potentiometers The first operation to be performed after wiring up the analog computer for a given simu-lation is to set the potentiometer values. This is performed as follows.

(i) Position the MODE SELECTOR switch to POT SET. (If the overload light goes on, remove the overload conditionby patching the overloaded amplifier output directly to its summing junction. Be sure to remove this patch cordafter all of the Pots are set.)

(ii) Position the Y/POT ADDRESS switch to the number of the pot to be set.

(iii) Adjust the pot knob until the desired setting is displayed.

Running the Analog Computer After the circuit has been wired up and the pots set to the correct value, theanalog computer is run with the OP mode control button pushed and the mode selector switch set to OPR.

2.3 Example 1

Implementation of a simple transfer function For a given transfer function:

G(s) =Y (s)U(s)

=2

s+ 1

we have

2U(s) = (s+ 1)Y (s)⇔ 2u(t) = y(t) + y(t)⇔ −y(t) = −2u(t) + y(t)

This equation can be implemented on the analog computer according to the following block diagram:

6

Page 7: CONTROL THEORY 1 LABORATORY 2

-1 0.2 10

1

u -0.2u y

This would be wired up on the analog computer as indicated on the patch panel diagram in Figure 1.The following pot values would be used

Potentiometer 1 2 3 4 5 6 7 8Setting 0.2

Notes:Output of Pot 5 = −2u(t)Output of Integrator 3 = y

2.4 Example 2

Implementation via Phase Variable Form Given the transfer function:

G(s) =Y (s)U(s)

=2s+ 1

s2 + 3s+ 4,

we can implement this transfer function on the analog computer using a version of the “Phase variable form” state spacerealization. First consider the transfer function

G(s) =Y (s)U(s)

=1

s2 + 3s+ 4,

Hence,

(s2 + 3s+ 4)Y (s) = U(s)⇔ y = u− 3y − 4y

This leads to the following analog computer block diagram

7

Page 8: CONTROL THEORY 1 LABORATORY 2

-+

++

--

12

34

56

78

SWO

PSW

OP

XX

YSJ

SJX

XY

SWO

PSW

OP

SJ’

SJ

IC

.1 .1

B .1 B

1 1 1

1

1 16

.1 .1

SJ

SJ’

SJ

IC

.1 .1

B .1 B

1 1 1

3

SJ’

SJ

IC

.1 .1

B .1 B

1 1 1

4

1

.1

5

SJ1 1

SJ’

SJ

IC

.1 .1

B .1 B

1 1 1

2

78

Figure 1: Patch panel layout for Example 1.

8

Page 9: CONTROL THEORY 1 LABORATORY 2

u

-y y.

0.4

0.3-0.3y

.

.

1

10

10

1

-0.4y-1

Now we use the fact thatG(s) = (2s+ 1)G(s)

Hence

Y (s) = (2s+ 1)Y (s)⇔ y = 2y + y.

Thus, the transfer function G(s) can be implemented on the analog computer via the block diagram shown in Figure 2:The patch panel layout corresponding to this block diagram is shown in Figure 3

The following pot values would be used

Potentiometer 1 2 3 4 5 6 7 8Setting 0.3 0.4 0.2

Notes:Output of Integrator 1 = −dydtOutput of Integrator 3 = yOutput of Summer 3 = y

3 USING THE dSPACE SYSTEM

The dSPACE system is high performance digital control system based on the TI TMS320C31 DSP processor. It isdirectly interfaced with MATLAB/SIMULINK running on a PC. A simulink block diagram is converted to real time Ccode, cross compiled and downloaded to the DSP board. Software is also available for controlling the DSP from the PCand plotting variables in real time in the DSP.

In this laboratory, you will familiarize yourself with some of the capabilities of the dSPACE system including theimplementation of transfer functions and the ability to provide step inputs and to plot the resulting step responses of

9

Page 10: CONTROL THEORY 1 LABORATORY 2

u

0.4

0.3-0.3y

.

1

-0.4y-1

-y.

y1

10

10

-1

0.210

1

y~

-y

-0.2y.

Figure 2: Analog Computer Block Diagram For Example 2.

10

Page 11: CONTROL THEORY 1 LABORATORY 2

-+

++

--

12

34

56

78

SWO

PSW

OP

XX

YSJ

SJX

XY

SWO

PSW

OP

1 16

.1 .1

SJ

SJ’

SJ

IC

.1 .1

B .1 B

1 1 1

3

SJ’

SJ

IC

.1 .1

B .1 B

1 1 1

4

1

.1

5

SJ1 1

78

SJ’

SJ

IC

.1 .1

B .1 B

1 1 1

1

SJ’

SJ

IC

.1 .1

B .1 B

1 1 1

2

Figure 3: Patch panel layout for Example 2.11

Page 12: CONTROL THEORY 1 LABORATORY 2

the systems under consideration. Each of the four IBM PCs in the control lab contains a dSPACE ds1102 DSP board.This board can be connected to the outside world via a connector box.

The first step in using the dSPACE system involves logging on to the PC. You should use the username “student”and the password “Eleceng1”. All of the files that you generate during the course of the laboratory should be stored inthe directory:

C:\matlabR11\work\student

3.1 Creating a dSPACE Block Diagram

We now present a case study of using the dSPACE system. The implementation of this case study is not part of thelaboratory but should give you an idea as to how to carry out the actual laboratory.

In order to use the dSPACE system, you must construct block diagrams on MATLAB/SIMULINK and run them onyour dSPACE board.

After you log onto the PC, run MATLAB as follows:

Start→ Programs→ Matlab→ Matlab 5.3

Run simulink and create a block diagram which you wish to implement on dSPACE; e.g., see below:

s

1

Integrator1s

1

Integrator

1

Gain1

1

Gain

DAC #1

DAC #2

DAC #3

DAC #4

DS1102DAC

ADC #1

ADC #2

ADC #3

ADC #4

DS1102ADC

Figure 4: A simple simulink block diagram

Note that the ADC and DAC blocks included in this block diagram are specific to dSPACE and should be obtainedfrom the dSPACE RTI1102 folder of the simulink library browser. Also, ensure that you use the correct board which isds1102.

The signal applied to a dSPACE ADC channel must be in the range -10 to 10 volts. A signal of +10 volts gives aninternal value of 1.00 within simulink. The dSPACE DAC converters give an output in the range of -10 to 10 volts. Aninternal value of 1.00 gives +10 volts on the DAC.

Compiling and Downloading First make sure the matlab default directory is correct by giving the command:

>> cd C:\matlabR11\work\student

In order to generate C code for your block diagram, go to the “Tools” menu and select RTW options (RTW standsfor Real Time Workshop). This is necessary in order to configure simulink C code generation for use with dSPACE.

12

Page 13: CONTROL THEORY 1 LABORATORY 2

• Select the Solver tab and set the “step size” to a suitable value in seconds. (Say 0.001) This determines the sampleperiod used in the real time implementation of the system.

• Choose the “Real Time Workshop” Tab and click build. This will compile the block diagram and download it tothe dSPACE board.

• From now on, if you change the block diagram and do not need to change the step size, you can compile the blockdiagram simply by going to the tools menu and choosing “RTW build”.

3.2 The ControlDesk Package

This is a powerful dSPACE software package used to interact with the program you have running on the dSPACE DSPboard. In particular, it is used to change parameters in the model and to plot variables and signals in the DSP.

The following write up gives some basic instructions on the use of the ControlDesk package. However, in order touse the package correctly you will need to use the online help. The online help package is called “dSPACE HelpDesk”.To run this package choose the windows menu items as follows:

Start→ Programs→ dSPACE Tools→ dSPACE HelpDesk

This online help system contains all the information about the ControlDesk package. In particular, if you can’t dosomething in ControlDesk, DO NOT ASK THE DEMONSTRATOR HOW TO DO IT but rather look it up in HelpDesk.

Overview ControlDesk allows you to collect the various files you need for a particular model in an “Experiment”. Anexperiment can consist of

1. Hardware specification: This specifies which board the program runs on (In our case there is only one DSP boardto worry about).

2. Instrumentation layout: In control desk, the instrumentation layout is used to display signals from the DSP andto adjust parameters in the DSP model. For each experiment, you must construct a layout to display the requiredvariables and adjust the required parameters.

3. The ControlDesk package requires a .trc file corresponding to the simulink model which is running on the DSPboard. This file is automatically generated when the simulink block diagram is compiled as above. This file isspecified for the given experiment in the Variable Manager section.

Main Window A typical ControlDesk window is shown below

13

Page 14: CONTROL THEORY 1 LABORATORY 2

Figure 5: ConrolDesk Window

As illustrated in this diagram, the main window contains a number of elements:

• Navigator. The Navigator panel provides access to the different parts of a real-time experiment. These are, theHardware View, the Experiment View and the Instrument View. The current view is controlled by the tabs at thebottom of the Navigator panel.

• Menu Bar. These menus allow for the various commands to be given to ControlDesk. The menus are dynamicand depend on the view and element selected in the Navigator.

• Tool Bars. These provide quick ways of given ControlDesk commands rather than using the menus. The toolbars can be turned on or off.

• Tool Window. This window is used for various tools controlling the experiment depending on the view chosenfrom the Navigator. Most commonly used is the variable manager which enables the selection variables from asimulink model.

• Working Area. This is the area in which a ControlDesk instrument layout is constructed and used.

• Status Bar This displays some information about the state of the ControlDesk system.

We now outline how to create a simple experiment which is based on the simulink block diagram above. The aim ofthis experiment is to display the output signals for this system using an oscilloscope type display.

• To start ControlDesk, double click on the dSPACE ControlDesk icon on the windows screen.

14

Page 15: CONTROL THEORY 1 LABORATORY 2

• Create a new experiment using the following menu commands:

File→ New Experiment

You should then specify a name for your experiment and specify the “working root” directory as

C:\matlabR11\work\student

• Click on the green Hardware tab (Ha ...). This should indicate that a program is running on your ds1102 board(by the green triangle). If not, you can drag and drop the corresponding .obj file onto the ds1102 icon to downloadthis program. Add this hardware description to your experiment by right clicking on the window with the ds1102icon and then choose “Add to Experiment”

• Click on the blue Experiment tag (E...). You should now see the hardware icon included in your experiment. Toadd the required .trc file to your experiment use the following menu commands:

File→ Open Variable File

and choose the .trc file corresponding to your simulink block diagram constructed above. This should open a newwindow with your model name and also a window listing some variables for your model. To add the .trc file toyour experiment, right click on this window and choose “Add to Experiment”. This should give you a new icon inyour experiment which includes your .trc file.

• Also, you may wish to add your simulink block diagram to the experiment. This .mdl file is not used by ControlDeskdirectly but it is useful to keep track of it.

To add this file to your experiment, give the following menu command:

File→ Import Files

Then locate the .mdl file for your block diagram. This should lead to a new “External Files” section in theNavigator panel (under Experiment) with your .mdl file included.

• To construct an instrumentation layout for your experiment, give the menu commands

File→ New

Then scroll down and select layout. This should create a blank layout window. Click on the multi-colouredInstrumentation tab (In...). You should then see a virtual instrument panel.

• In this example, we wish to create a oscilloscope type display to plot the variable “Integrator1” which is the outputof our system. We will also include a gauge which displays the model “turnaround Time”. This is useful if wewant to know how short we can make the system sample time (It must be at least greater than the turnaroundtime.).

• Click on “Data Acquisition” in the Virtual Instruments panel and then click on the plotter icon. Then move tothe Layout panel and draw a rectangle which will determine the size of your plot (It should take up about halfthe available area but can be adjusted later if desired.) A set of axes should appear on your layout panel.

• We now need to set up this plotter to plot the desired variable. First move to the Tool Window and click on ModelRoot. The variable panel should display a list of variables associated with your simulink block diagram. Clickon the variable denoted B:Integrator1 (The notation B:Integrator1 refers to the fact that we are interested in theoutput signal corresponding to the simulink block labelled Integrator1) Now drag and drop to the area just tothe left of the plotter y-axis in the Layout panel. The y-axis now should be labelled Integrator1 and a red squareappears indicating the color of the plot for this variable.

• We can adjust the parameters of the plotter by right clicking on the plotter area and then choosing the Propertiesmenu item. Then click on the axes tab. At this stage, the only thing we will adjust will be the Y-min value to-0.05 and the Y-Max value to 0.05.

15

Page 16: CONTROL THEORY 1 LABORATORY 2

• The time and triggering of the plotter can be controlled by using a capture settings instrument. Click on thecapture settings icon and then draw a suitable rectangle in the layout panel (About half of the available area.)

Double click on the settings button in the capture instrument and click on the Capture tab. In the Capturewindow, click on the right downarrow and choose the only option available “DSP - ... - Service #1”. Also, set thelength variable to 1sec. Then click OK.

In this case, our trigger variable will be the same variable that we are going to plot. Hence, again click onB:Integrator1 in the Variable panel and drag and drop it in the trigger window in the capture instrument panel(This is just below the words level and delay.)

You can then adjust the plot interval and trigger level to suitable values depending on the signal you are plotting.If the signal applied to the filter is a 1Hz sine wave with amplitude of 10V, then a suitable length is 1sec. Turnthe trigger on with AutoRepeat and leave the trigger level at 0.

• To start plotting (assuming that the signal generator has been connected to the DSP board connector panel),simply give the following menu command

Instrumentation→ Animation Mode

This should commence the interaction between your instrumentation layout and the DSP board. To stop, choosethe menu command

Instrumentation→ Edit Mode

This enables you to make further adjustments to your instrument panel.

• The controldesk program does not have a direct way of printing plots. A simple way to print plots is to use screencapture (hold down the “alt” key and press the “print screen” key). Then run the “paint” program and paste thescreen capture into the program. The required plot can then be cut out and printed.

• If you wish to save your traced data to a file so that it can be later loaded into matlab and printed, make thefollowing adjustment to the properties of the capture instrument: Under Acquisition, choose simple capture andcheck Automatic storage. Then specify a filename in which the data will be stored; e.g., output.mat. Then runthe animation again. It is best to turn off Autorepeat this time since every time a trace is plotted, it will alsooverwrite this file.

After the capture is complete, you can open this file and plot it from your matlab command window as follows:

>> load output>> plot(trace_x,trace_y),xlabel(trace_x_n),ylabel(trace_y_n)

This plot can then be printed if required. (Before printing, be sure to choose matlab print setup and set the papertype to A4. If you don’t do this, you will need to press shift continue on the printer to obtain the plot.)

• Our final step in this example will be to add a gauge to our layout which displays the program turnaround time.With the layout in edit mode, click on the virtual instrument button in the virtual instruments panel and thenclick on the Gauge icon. Then draw a suitable size rectangle in the layout panel for the gauge. A gauge shouldappear in the layout.

To get this gauge to display the turnaround time, click on the “Timer Task 1” item in the Tool Window. Thevariable panel should then display various variables associated with the program running on the DSP board. Dragand drop the “turnaroundTime” item onto the gauge instrument in the layout panel. The gauge should now belabelled turnaroundTime.

Right click on the gauge instrument and choose properties. Then click the gauge tab. Adjust the stop value to100e-6. Then click on the Tics tab and adjust the Delta to 25e-6.

Restarting the animation, this gauge should now display the turnaroundTime in micro seconds.

• This completes our layout for this experiment. The layout can be added to the experiment by right clicking on thelayout panel and then choosing “Add layout to Experiment” (This will also ask you to save your layout to diskwhich you should do). A new Instrumentation element should appear in your experiment listing which containsthe corresponding layout file.

16

Page 17: CONTROL THEORY 1 LABORATORY 2

• The final ControlDesk window should look something like the following:

Figure 6: Final ConrolDesk Window

3.3 Using dSPACE to find a Step Response

The best way to use the dSPACE system to construct a step response is to add a constant block to your simulink blockdiagram which will provide the step input. Then use the ControlDesk package to control the step and view the resultingstep response using a plotter instrument.

• To provide the step input, we do NOT use the standard simulink step block. (The step would be over before wehad time to set things up). Rather we add a “Constant” block whose value will be adjusted by ControlDesk toprovide the step input at the required time. Also, the ADC and DAC blocks can be removed. This leads to thefollowing simulink block diagram.

17

Page 18: CONTROL THEORY 1 LABORATORY 2

s

1

Integrator1s

1

Integrator

1

Gain1

1

Gain

0

Constant

Figure 7: Simulink block diagram for step response

• Compile this system as above

• Return to ControlDesk and close any old experiments. Open a new experiment and give it a suitable name. Asdescribed in the previous example, add the hardware configuration and .trc file to this experiment.

• Create a new layout (or modify the existing layout) as follows:

18

Page 19: CONTROL THEORY 1 LABORATORY 2

Figure 8: Instrument layout for step response

• In this instrument layout, the plotted signal is the output of the system “B:Integrator1”. Also, plotted on the samegraph is input to the system “B:Constant”. This is achieved by dragging both of these variables to the Y-axis ofthe plot.

The capture instrument is set as above. In this case, the trigger variable is the step input signal “B:Constant”.The time interval is 10sec and a factor of 10 down sampling is used to ensure the DSP does not run out of memorywith this long time interval. Triggering is set up as above. Also, the data can be saved to a file and loaded intomatlab as above.

A step input is achieved by using an On/Off button to control the constant block in the simulink block diagram.A suitable On/Off button can be obtained as one of the options in the RadioButton Instrument. To achieve a stepinput, the constant value parameter variable “P: Constant Value” is dragged to the On/Off button in the layout.Also, the properties of this instrument are set so that its form is as shown above and the On value is is set to thesize of the required step and the Off value is zero.

The above layout also includes two Display instruments. One displays the input variable “B: Constant” and theother displays the output variable “B: Integrator1”

To use this ControlDesk experiment, the layout should be put in animation mode and then the constant value setfrom off to on. This should trigger the data capture and produce the resulting step response.

• The above procedure can be used to plot the step response of any physical system connected to the dSPACEboard. Connect the input of the system to a DAC channel (Vout(1) in the connector box) and connect the outputof the physical system to an ADC channel (Vin(1) in the connector box).

• Construct a simulink block diagram as shown below

19

Page 20: CONTROL THEORY 1 LABORATORY 2

1

Output

DAC #1

DAC #2

DAC #3

DAC #4

DS1102DAC

ADC #1

ADC #2

ADC #3

ADC #4

DS1102ADC

0

Constant

Figure 9: Physical system step response

• Compile the system and obtain the step response using ControlDesk as above.

4 Laboratory Preparation

This preparation must be done before the laboratory session. It should be handed in with your laboratory report whichis handed in at the end of the lab and will form 33% of the total lab grade. (You should hand in your own preparationeven if your lab group decides to use the preparation of another group member in the actual lab experiments.)

1. Choose a second order transfer function with at least one zero which can be implemented in dSPACE and on theAnalog computer. You should make sure that your transfer function is stable. If you choose an unstable system,this will cause problems when you try to implement the system in the lab. If you find during your matlab/simulinksimulations that your system is unstable, you will need to came back and choose a new system.

2. Draw a block diagram to show how the transfer function could be implemented on the Analog computer. Showall the steps used between the selection of the transfer function and the creation of the block diagram. Also,photocopy the attached blank Analog Computer patch panel and draw in the wiring which would be used toimplement your transfer function.

3. Draw a block diagram to show how the transfer function would be implemented in dSPACE.

4. Devise an experiment using a sine wave input from a signal generator and the oscilloscope which will verify thatyour Analog computer model and dSPACE model are working correctly. Hint, consider the Bode plot of yourtransfer function.

5. Use Matlab/Simulink to predict the results of these experiments.

6. Use Matlab/Simulink to predict the step response of your system. In particular, to measure the percentageovershoot and rise time for your transfer function. Note that the rise time is the time taken for the step responseto go from 10% to 90% of its final value.

5 Laboratory Procedure

The results you obtain during the laboratory session should be entered into the pro-forma which is handed out duringthe lab session. This should be handed in at the end of the lab session. There should be one report for each student.

5.1 Analog Computer

1. Using the results from your preparation, build an analog computer implementation of your chosen transfer function.(Choose one transfer function from among the group.)

20

Page 21: CONTROL THEORY 1 LABORATORY 2

2. Carry out the experiment you devised during your preparation using the signal generator and oscilloscope toverify that your system is working correctly. Note, because of the low frequencies used, make sure that you useDC coupling in the oscilloscope settings. Also, you can use the cursors feature of the oscilloscope to make accuratemeasurements.

3. Compare the results with your predictions.

5.2 dSPACE

1. Build the dSPACE model of your chosen system.

2. Carry out the experiment you devised during your preparation using the signal generator and oscilloscope to verifythat your system is working correctly.

3. Compare the results with your predictions.

4. Carry out the same experiment purely in dSPACE using the simulink signal generator and ControlDesk insteadof the real signal generator and the oscilloscope.

5. Compare the results with your predictions.

6. Determine the turnaroundTime time for your system on the dSPACE board.

7. Use dSPACE to find the step response of your system. In particular, find the percentage overshoot and rise timefor your system.

8. Compare the results with your predictions.

5.3 dSPACE and the Analog Computer

1. Use dSPACE to find the step response of the Analog computer implementation of your system. In particular, findthe percentage overshoot and rise time.

2. Repeat part 2 of the Section 5.1 but this time use dSPACE rather than the oscilloscope and signal generator. (c.f.part 4 of Section 5.2.)

21

Page 22: CONTROL THEORY 1 LABORATORY 2

-+

++

--

12

34

56

78

SWO

PSW

OP

XX

YSJ

SJX

XY

SWO

PSW

OP

78

SJ’

SJ

IC

.1 .1

B .1 B

1 1 1

1

SJ’

SJ

IC

.1 .1

B .1 B

1 1 1

2

1

.1

5

SJ1 1

1 16

.1 .1

SJ

SJ’

SJ

IC

.1 .1

B .1 B

1 1 1

3

SJ’

SJ

IC

.1 .1

B .1 B

1 1 1

4

22