Download User`s Manual - Electrical Engineering and Computer Science
Transcript
} else {
*trans = SS_FALSE;
}
}
return NO_ERROR;
Note that the state/chart combination which evaluate to negative boundary function
should also be considered invalid states. In our simple illustrative example, however, we do
not explicitly check for these cases in the chart validation.
4.3.9 The Auxiliary Functions
The data to be recorded is computed by the auxiliary functions. For our SLIP example, we
record the time together with the position and velocity of the body. Note that the number
of auxiliary functions is dened in the model initialization function and must be consistent
with the number of variables lled in by the auxiliary function component.
int slip_AuxFunc(double *f, double x[], double p[], int chart)
{
f[0] = x[TIME];
f[1] = x[0];
f[2] = x[1];
f[3] = x[2];
f[4] = x[3];
}
return NO_ERROR;
4.3.10 Chart Validation
The simple SLIP model has only one potential mode of failure: The hopper toppling over
and the body hitting the ground. In any one of the charts, if y < 0 at any point on the
trajectory, the state-chart combination becomes invalid. The following implementation of
the chart validation function ensures proper detection of this failure mode.
int slip_ValidateChart(int* in_chart, double x[], double p[], int chart)
{
*in_chart = SS_TRUE;
if (x[1] < 0) { /* The body is underground */
SS_Message("Error: Body toppled over\n");
*in_chart = SS_FALSE;
}
31