%% File: sblogexp.tlc %% Abstract: %% This block defines a set of logical expressions that are assigned to %% the output vector. The inputs to the set of equations are time, the %% input vector and an optional parameter vector. %% %% %% Initial coding by A S Bozin %% Copyright 1997-2000 The MathWorks, Inc. %% $Revision: 1.2 $ $Date: 2000/06/16 20:50:52 $ %% %implements sblogexp "C" %% Function: BlockTypeSetup =================================================== %% Abstract: %% Place include and function prototype in the model's header file %function BlockTypeSetup(block, system) void % %openfile buffer #ifndef POWDI_DEFINE extern real_T powdi(real_T x, int_T n); #define POWDI_DEFINE #endif %closefile buffer % %endfunction %% Function: BlockInstanceData ================================================ %% Abstract: %% Create persistant data for PWork vector. %function BlockInstanceData(block, system) Output /* Logical Expression Block */ %assign sfcnName = ParamSettings.FunctionName /* % Block: (%): % */ %assign info = SFcnParamSettings.logInfo %assign numParams = info[2] %if numParams > 0 %assign ptype = "real_T" %if UsingMalloc % = malloc(% * sizeof(%)); rt_VALIDATE_MEMORY(%, %); %else static % logParamsBuffer[%]; %assign voidCast = "(void *) " % = %logParamsBuffer; %endif %endif %endfunction %% Function: Start ============================================================ %% Abstract: %% Initialize parameters %function Start(block, system) Output %assign sfcnName = ParamSettings.FunctionName /* Logical Expression Block */ /* % Block: (%): % */ { %assign ptype = "real_T" %assign realCast = "(% *) " %assign info = SFcnParamSettings.logInfo %assign numParams = info[2] %assign declParams = "% *params" %assign iniParams = SFcnParamSettings.iniParams /* Retrive parameter vector */ % = %%; /* Assign parameters */ %foreach idx = numParams params[%] = %; %endforeach } %endfunction %% Function: Outputs ========================================================== %% Abstract: %% %function Outputs(block, system) Output %assign sfcnName = ParamSettings.FunctionName /* Logical Expression Block */ /* % Block: (%): % */ { %assign ptype = "real_T" %assign realCast = "(% *) " %assign info = SFcnParamSettings.logInfo %assign ninputs = info[0] %assign noutputs = info[1] %assign nparams = info[2] %assign declParams = "% *params" %assign cStatements = SFcnParamSettings.cStatements %assign nstatements = SIZE(SFcnParamSettings.cStatements, 1) /* Retrive parameter vector */ % = %%; %foreach idx = % %assign statement = "%" %assign statement = FEVAL("strrep",statement,"^",",") %foreach uidx = ninputs %assign uiToken = "@u%" %assign ui = LibBlockInputSignal(0,"","",ninputs-uidx-1) %assign statement = FEVAL("strrep",statement,uiToken,ui) %endforeach %foreach yidx = noutputs %assign yiToken = "@y%" %assign yi = LibBlockOutputSignal(0,"","",noutputs-yidx-1) %assign statement = FEVAL("strrep",statement,yiToken,yi) %endforeach %foreach pidx = nparams %assign piToken = "@p%" %assign pi = "params[%]" %assign statement = FEVAL("strrep",statement,piToken,pi) %endforeach %assign tiToken = "@t" %assign ti = "ssGetT(%)" %assign statement = FEVAL("strrep",statement,tiToken,ti) % %endforeach } %endfunction %% Outputs %% Function: Terminate ======================================================== %% Abstract: %% %function Terminate(block, system) Output %if UsingMalloc /* Logical Expressions block */ /* % Block: (%): % */ rt_FREE(%); %endif %endfunction %% [EOF] sblogexp.tlc