DSPACE

From PrattWiki
Jump to: navigation, search

dSPACE generally refers to a microprocessing card used in the Controls labs for ECE 382 and ME 344.

Starting Up

For the dSPACE cards to work properly, the DAQ amplifier (small black box with a power switch and a few ribbon cables connected to the back) must be on before the computer is turned on. If the DAQ amplifier is turned on, the dSPACE connection board should have a multitude of bright red lights on. If the lights are only dim, turn the amplifier box off and make sure the connection for the power cable for the amplifier is tight.

After starting Control Desk 3.7, to see if there's any hope of your program loading properly, you will need to look at the board properties. From Control Desk, go to Platform->Properties. If the Loaded application shows a string of ÿ then you need to turn the amplifier box off, shut down the PC, turn the amplifier box on, count to ten, and restart the PC. You should do this before starting to work on the board.

Templates

DAC template
ADC template
  1. DACtemplate.mdl - containing all eight DACH linkages, including constants, output ports for use with ControlDesk, and 1/10x gains.
  2. ADCtemplate.mdl - containing all eight ADCH linkages, including terminators, output ports for use with ControlDesk, 10x gains, and a demultiplexer for the first four channels.

Currently there are two useful templates for the dSPACE cards with Simulink. To download, right-click the link to the file name and download it to your computer. Pictures of the .mdl files are shown at right.

To use the templates, simply download them, open them in Simulink, and drag-and-drop the relevant channels into your model. Note that for every channel, there is an "Out" block with an appropriate label - be sure to copy the entire chain of blocks for a particular channel. If you are using any of the first four ADC channels, you may as well drag the entire assembly into your model.

Note, however, that the output port numbers - the value inside the rounded rectangle - may change as a result of conflicts with other inputs and outputs in your system. These numbers do not actually have an impact on how ControlDesk gets information from your system so you do not need to "fix" these. ControlDesk only cares about the name of the block - the text shown below the block itself.

In each case, if you want ControlDesk to determine the value being set to the DAC channels or being measured from the ADC channels, you should use "In1" value of the appropriately named "Out" block. For example, to determine the voltage being measured on ADCH7, you would want to look at the "In1" value of the ADC7 block (the rounded-rectangle to the right and below the GainADC7 block).

In Simulink, if you want to set the voltage for a particular DAC channel, delete the appropriate zero constant (C#) and make a new connection to the uDAC#. The main purpose of the uDAC# block is to provide a single point of contact for the input value to a DAC channel - the signal will be split between the gain block (needed to reduce the value of the signal by a factor of 10 since dSpace has a built-in gain of 10) and the "Out" block which will be used in dSpace. The other purpose of the uDAC# block is to convert whatever value is being sent to the DAC card to a signal that the "Out" block will recognize. For example, constants directly connected to "Out" blocks will not generate signals that ControlDesk can read, but constants connected through unity gain blocks do.

If you want to send the ADC output values to another part of the diagram, simply delete the appropriate terminator (T#) block and make a new connection to it or just make sure to make a connection from the wire coming out of the appropriate gain block.

Accessing Values with ControlDesk

With respect to ControlDesk, you will generally want to access the "In" value of the relevant ADCn or DACn "Out" block to get the voltage measurement or setting from the channel.

Additional Information

Troubleshooting

  • ControlDesk must be open before running rtwbuild, or else you will not get an SDF tab in ControlDesk.
  • If you use rtwbuild and are told a program is already running, go to ControlDesk. Change into editing mode and then push the stop button. Go back to MATLAB and try again. If that does not work, you may need to turn off both the DAQ power supply and the computer. Turn the DAQ power supply back on first, then the computer.

Questions

Post your questions by editing the discussion page of this article. Edit the page, then scroll to the bottom and add a question by putting in the characters *{{Q}}, followed by your question and finally your signature (with four tildes, i.e. ~~~~). Using the {{Q}} will automatically put the page in the category of pages with questions - other editors hoping to help out can then go to that category page to see where the questions are. See the page for Template:Q for details and examples.

External Links

References