User`s guide

6 Program Architecture
6-20
The general content of the rapid prototyping style of code for C is shown in the
following figure.
Figure 6-3: Content of Model.c for the Rapid Prototyping Code Style
/*
* Version, Model options, TLC options,
* and code generation information are placed here.
*/
<includes>
void MdlStart(void)
{
/*
* State initialization code.
* Model start-up code - one time initialization code.
* Execute any block enable methods.
* Initialize output of any blocks with constant sample times.
*/
}
void MdlOutputs(int_T tid)
{
/* Compute: y = f0(t,xc,xd,u) for each block as needed. */
}
void MdlUpdate(int_T tid)
{
/* Compute: xd+1 = fu(t,xd,u) for each block as needed. */
}
void MdlDerivatives(void)
{
/* Compute: dxc = fd(t,xc,u) for each block as needed. */
}
void MdlTerminate(void)
{
/* Perform shutdown code for any blocks that
have a termination action */
}
/* Model registration */
#include "model.reg"