Difference between revisions of "DSPACE"

From PrattWiki
Jump to navigation Jump to search
Line 1: Line 1:
dSPACE generally refers to a microprocessing card used in the ME 125 labs.  As more dSPACE tutorials become available, this page will list them.
+
dSPACE generally refers to a microprocessing card used in the ME 125 labs.
  
 
== Templates ==
 
== Templates ==
# [http://www.duke.edu/~mrg/FILES/DACtemplate.mdl DACtemplate.mdl] - containing all eight DACH linkages, including input ports and 1/10x gains. [[Image:DACtemplate.png|thumb|DAC template]]
+
[[Image:DACtemplate.png|thumb|DAC template]]
# [http://www.duke.edu/~mrg/FILES/ADCtemplate.mdl ADCtemplate.mdl] - containing all eight ADCH linkages, including output ports, 10x gains, and a demultiplexer for the first four channels.[[Image:ADCtemplate.png|thumb|ADC template]]
+
[[Image:ADCtemplate.png|thumb|ADC template]]
 +
# [http://www.duke.edu/~mrg/FILES/DACtemplate.mdl DACtemplate.mdl] - containing all eight DACH linkages, including constants, output ports for use with ControlDesk, and 1/10x gains.  
 +
# [http://www.duke.edu/~mrg/FILES/ADCtemplate.mdl 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.
 
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, however, that the output port ''numbers'' may change as a result of conflicts with other inputs and outputs in your systemAfter saving the model, you may want to go back and re-number those ports before continuing though that is not required.
+
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 channelIf you are using any of the first four ADC channels, you may as well drag the entire assembly into your model.
  
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" blockFor 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).
+
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 systemThese 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 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 it.  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.
+
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 <code>ADC7</code> block (the rounded-rectangle to the right and below the <code>GainADC7</code> block). 
 +
 
 +
In Simulink, if you want to set the voltage for a particular DAC channel, delete the appropriate zero constant (<code>C#</code>) and make a new connection to the <code>uDAC#</code>.  The main purpose of the <code>uDAC#</code> 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 <code>uDAC#</code> block is to convert whatever value is being sent to the DAC card to a signal that the "Out" block will recognizeFor 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 (<code>T#</code>) 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.
 
<br clear=all>
 
<br clear=all>
 
== Files for Labs ==
 
# Instrumentation Lab: [[DSPACE/TakeData1|TakeData1.m]] file
 
  
 
== Accessing Values with ControlDesk ==
 
== Accessing Values with ControlDesk ==
With respect to ControlDesk, you will generally want to access the output value of the relevant ADCn gain to get the actual measurement from the channel and you will want to access the output value of the block just before the DGn gain to get the desired voltage sent to the DACHn cardFor the template itself, this will be the output of the DACn in port; if you are performing signal processing to assign a voltage value - and have thus removed the in port - you will need to use the output value from whatever block feeds into the DGn block.
+
With respect to ControlDesk, you will generally want to access the "In" value of the relevant <code>ADCn</code> or <code>DACn</code> "Out" block to get the voltage measurement or setting from the channel.   
 
 
  
  

Revision as of 18:52, 26 September 2010

dSPACE generally refers to a microprocessing card used in the ME 125 labs.

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.


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