Implementation in a submodel
Saturation with no discontinuity handling
Saturation The first piece of code does not handle discontinuity. It simply affects the correct value to the output y, depending on the current value of x.
Copy
void saturation_(int *n, double *y, double *x, double rp[2])
{
double xmax, xmin;
xmax = rp[0];
xmin = rp[1];
if (*x > xmax) /* Limited to higher value. */
{
*y = xmax;
}
else if (*x < xmin) /* Limited to lower value. */
{
*y = xmin;
}
else /* Unlimited. */
{
*y = *x;
}
}
Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.TB121_Discontinuity_Handling/xid1849189 · retrieved 2026-07-17