
CHAPTER 3
MODULAR SERVO Information Flow Between
Reference Manual
Simulink Models and the Real-Time Kernel
3-6
33-008-2M5
The stop_pract variable is used to stop experiment after the Simulink simulation is
terminated. This function reads history of the experiment and transfers samples to the
output of S-function block (1 point for every Downsampling ratio points).
function [sys, x0, str, ts ] = sfunc( t, x, u, flag, T0, par, downsamp, stop_pract, exc_src )
The function has the following parameters:
t
- time,
x
- state vector,
u
- input to the S-function block,
flag
- the value passed to the S-function by SIMULINK to distinguish
different actions. The arguments t, x, u and flag are set and
passed to the S-function by SIMULINK automatically,
par
- parameters for the PID controller,
downsamp - downsampling ratio. Defines how many samples are
transferred to the output of the S-function block. For instance, if
downsamp is equal to 10 only 1 sample of every 10 samples is
transferred from the Real-Time Kernel to the output of the
S-function block,
stop_pr
- flag used to stop experiment when the Simulink simulation is
terminated,
exc_src
- variable which is used to select the source of the reference
position.
Global variables are used to store the history of the experiment and auxiliary
variable for downsampling.
% Global variables
global history pos_in_history
switch flag
case 0, % Initialization
Set the number of continuous states, number of discrete states, number of
outputs and number of inputs (0 continuous states, 1 discrete state, 7 outputs, 1
input, 0 discontinuous roots, 0 direct feedthrough - without algebraic loops)
sizes.NumContStates = 0;
sizes.NumDiscStates = 1;
sizes.NumOutputs = 7;
sizes.NumInputs = 1;
sizes.DirFeedthrough = 0;
Summary of Contents for MS150
Page 1: ...MS150 Modular Servo Workshop Reference Manual 33 008 2M5 ...
Page 3: ...Notes ...
Page 7: ...MODULAR SERVO Reference Manual Contents TOC 2 33 008 2M5 Notes ...
Page 10: ...CHAPTER 1 MODULAR SERVO Reference Manual Introduction 33 008 2M5 1 3 ...
Page 24: ...CHAPTER 2 MODULAR SERVO Reference Manual Description of the Toolbox Functions 33 008 2M5 2 13 ...
Page 77: ...CHAPTER 4 MODULAR SERVO Reference Manual Quick Reference Table 4 4 33 008 2M5 Notes ...