![]() |
|||||||||||||||||||||||||||||||||
|
Build a Simulink Block DiagramSimulink Block DiagramThe first step in using the xPC system is to develop the code through the use of Simulink and the xPC Library of I/O blocks. The Simulink Block Library on the xPC Host machine (Spastic) includes the xPC library which has special blocks to interface with a variety of I/O boards.
The completed block diagram, shown below, performs the control law: 8*(Desired Position - Actual Position - Initial Position) The Sum, Gain and Constant blocks are standard Simulink blocks. From the DSP Blockset, a Sample & Hold and 2 delayed Switches are used to store the initial position. Link to model file: Proportional Position Controller The I/O block parameters are shown in the figures below. TIP: Pay particular attention to the sample time and the range values. The sample time should match the desired sampling frequency. In this case, it is set to 1 kHz. The PCIM-DAS 1602/16 has been set up to run 8 differential channels, whereas the block default sets it to 16 single-ended channels.!
The next step is to set the Simulation Parameters, which can be accessed through the Simulation menu or Ctrl-E.
Now, you can build and load code to Renshaw.
2005-08-11 Heidi Giesbrecht
|