-------------------------------------------------------------------------------- -- -- -- File : sfuntmpl_ads.txt $Revision: 1.1 $ -- Abstract: -- Template Spec for an Ada S-Function. -- -- Author : Murali Yeddanapudi, 26-Jul-1999 -- -- Copyright (c) 1990-1999 The MathWorks, Inc. All Rights Reserved. -- -- -------------------------------------------------------------------------------- -- The Simulink API for Ada S-Function. The Spec and the body are in: -- -- matlabroot/simulink/ada/interface/simulink.ads -- matlabroot/simulink/ada/interface/simulink.adb -- with Simulink; use Simulink; package SFunTmpl is -- The S_FUNCTION_NAME has to be defined as a constant string. It is -- advisible to keep the name of the package and the S_FUNCTION_NAME -- the same, however this is not a requirement. S_FUNCTION_NAME will -- be the name of the MEX file built by the 'mex -ada' command. -- S_FUNCTION_NAME : constant String := "sfuntmpl"; -- Procedure: mdlCheckParameters -------------------------------------------- -- Abstract:: -- In this optional procedure you can: -- 1) Validate the block parameters, which are specified by the user -- using the S-Funcitons dialog box and passed to this S-Function -- by Simulink. -- -- ??? -- procedure mdlCheckParameters(S : in SimStruct); pragma Export(C, mdlCheckParameters, "mdlCheckParameters"); -- Procedure: mdlProcessParameters ------------------------------------------ -- Abstract:: -- ??? -- procedure mdlProcessParameters(S : in SimStruct); pragma Export(C, mdlProcessParameters, "mdlProcessParameters"); -- Procedure: mdlInitializeSizes -------------------------------------------- -- Abstract:: -- Every S-Function is *required* to have this procedure. In this procedure -- you should: -- 1) Setup up all the block's charecteristics such as number of inputs, -- outputs, work vectors, states, port attributes etc. -- -- You may defer the setting of some of the iput/output port, continuous -- state and work vector attributes until the mdlSetWorkWidths procedure. -- This is useful if, for example, you need to know the input port width -- in order to determine the number of continuous states. -- procedure mdlInitializeSizes(S : in SimStruct); pragma Export(C, mdlInitializeSizes, "mdlInitializeSizes"); -- Procedure: mdlSetWorkWidths ---------------------------------------------- -- Abstract:: -- This optional procedure, mdlSetWorkWidths, is called by Simulink after -- port data types and port dimensions and block sample times of all the -- blocks in the model have been determined. If your S-Function has any -- continuous states and/or work vectors whos attributes (eg., size, data -- type etc.) depend on the block input/output port attributes and/or its -- sample time. -- procedure mdlSetWorkWidths(S : in SimStruct); pragma Export(C, mdlSetWorkWidths, "mdlSetWorkWidths"); -- Procedure: mdlStart ------------------------------------------------------ -- Abstract:: -- ??? -- procedure mdlStart(S : in SimStruct); pragma Export(C, mdlStart, "mdlStart"); -- Procedure: mdlOutputs ---------------------------------------------------- -- Abstract:: -- ??? -- procedure mdlOutputs(S : in SimStruct; TID : in Integer); pragma Export(C, mdlOutputs, "mdlOutputs"); -- Procedure: mdlUpdate ----------------------------------------------------- -- Abstract:: -- ??? -- procedure mdlUpdate(S : in SimStruct; TID : in Integer); pragma Export(C, mdlUpdate, "mdlUpdate"); -- Procedure: mdlDerivatives ------------------------------------------------ -- Abstract:: -- ??? -- procedure mdlDerivatives(S : in SimStruct); pragma Export(C, mdlDerivatives, "mdlDerivatives"); -- Procedure: mdlTerminate -------------------------------------------------- -- Abstract:: -- ??? -- procedure mdlTerminate(S : in SimStruct); pragma Export(C, mdlTerminate, "mdlTerminate"); end SfunTmpl; -- eof: sfuntmpl_ads.txt