%% $RCSfile: sfun_multirate.ttlc,v $ %% File : sfun_multirate.tlc generated from sfun_multirate.ttlc revsion 1.1 %% $Date: 1998/10/22 20:14:43 $ %% %% Copyright (c) 1994-1998 by The MathWorks, Inc. All Rights Reserved. %% %% Abstract: %% Level-2 multiple port sfunction sfun_multirate block target file %% See simulink/src/sfun_multirate.c %implements "sfun_multirate" "C" %% 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) { int_T *enabled = &%; %if LibGetSFcnTIDType("InputPortIdx0") == "continuous" %% Only check the enable signal on a major time step. if (ssIsMajorTimeStep(%) && ... %) { *enabled = (% > 0.0); } %else if (%) { *enabled = (% > 0.0); } %endif if (*enabled) { %assign signal = LibBlockInputSignal(1, "", "", 0) if (%) { %assign y = LibBlockOutputSignal(0, "", "", 0) % = %; } if (%) { %assign y = LibBlockOutputSignal(1, "", "", 0) % = %; } if (%) { %assign y = LibBlockOutputSignal(2, "", "", 0) % = %; } } } %endfunction %% [EOF] sfun_multirate.tlc