%% $RCSfile: sfun_multirate.ttlc,v $ %% File : sfun_multirate.tlc generated from sfun_multirate.ttlc revsion 1.2 %% $Date: 2000/03/02 22:39:25 $ %% %% Copyright 1990-2000 The MathWorks, Inc. %% %% Abstract: %% Level-2 multiple port sfunction sfun_multirate block target file %% See simulink/src/sfun_multirate.c %implements "sfun_multirate" "Ada" %% Function: mdlOutputs ===================================================== %% Abstract: %% %% Compute the three outputs, which is the input signal decimated by the %% specified parameter. The decimation is handled by sample times. %% The decimation is only performed if the block is enabled. %% %% Note, the usage of the enable should really be protected such that %% each task has it's own enable state. In this example, the enable %% occurs immediately which may or may not be the expected behavior. %% %function Outputs(block, system) Output -- % Block: % %assign enable = LibBlockInputSignal(0, "", "", 0) %assign enabled = LibBlockIWork(0, "", "", 0) %if LibGetSFcnTIDType("InputPortIdx0") == "continuous" %% Only check the enable signal on a major time step. if (ssIsMajorTimeStep(%) and then ... %) then % := TMW_Types.Int_T(Boolean_To_Integer(% > 0.0)); end if; %else if (%) then % := TMW_Types.Int_T(Boolean_To_Integer(% > 0.0)); end if; %endif if (% > 0) then %assign signal = LibBlockInputSignal(1, "", "", 0) if (%) then %assign y = LibBlockOutputSignal(0, "", "", 0) % := %; end if; if (%) then %assign y = LibBlockOutputSignal(1, "", "", 0) % := %; end if; if (%) then %assign y = LibBlockOutputSignal(2, "", "", 0) % := %; end if; end if; %endfunction %% [EOF] sfun_multirate.tlc