feedback MS150 Reference Manual page 69

Modular servo workshop
Hide thumbs Also See for MS150:
Table of Contents

Advertisement

MODULAR SERVO
Reference Manual
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
x
u
flag
par
downsamp - downsampling ratio. Defines how many samples are
stop_pr
exc_src
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
sizes.NumInputs
sizes.DirFeedthrough = 0;
3-6
- time,
- state vector,
- input to the S-function block,
- 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,
- parameters for the PID controller,
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,
- flag used to stop experiment when the Simulink simulation is
terminated,
- variable which is used to select the source of the reference
position.
= 7;
= 1;
Information Flow Between
Simulink Models and the Real-Time Kernel
CHAPTER 3
33-008-2M5

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents