RTMDblocks library

From Lehigh RTMD Wiki

Jump to: navigation, search

Image:Rtmdlibrary.jpg

To load the RTMD Library, run RTMDblocks at a Matlab command prompt. These blocks are used with Simulink and xPC. Note: C:\RTMDMatlab needs to be added to the Matlab path.

There are 4 sections:

Contents

Controller Blocks

  • Float -> Fixed: Converts a floating point number to the IEEE fixed point representation used by the Servotest DSP
  • Fixed -> Float: Converts a IEEE fixed point representation from the Servotest DSP to a floating point number
  • Float 1/1 Fixed: Same as the Float -> Fixed except provides a scaling factor
  • Fixed 1 Float: Same as Fixed -> Float except provides a scaling factor

DAQ Blocks

  • Counts -> EU: Converts a 16 bit signed integer to Engineering Units. The mask provides the parameters
  • Counts -> Counts: Converts a 16 bit signed integer to counts

xPC Blocks

  • File Scope: Stores inputs as a binary file on the xPC

SCRAMNet Blocks

  • init: Initializes the SCRAMNet
  • read: Reads a value from SCRAMNet. A partition struct parameter must be created in Matlab
  • write: Writes a value to SCRAMNet. A partition struct parameter must be created in Matlab

When using the read and write SCRAMNet blocks, a Matlab script must be created for setting parameters. The following is an example of setting up a partition struct for address 0x0.

node.Interface.NodeID = '4';
node = completenodestruct([],'scramnet');
p0.Address='0x0';
completepartitionstruct(p0,'scramnet');