I have a requirement to build a model to work on a processor using only single float data types.
I have achieved most of this through using data replacement in the RTW options:
ReducedDouble_T = Simulink.AliasType;ReducedDouble_T.HeaderFile = 'AtSourceLib.h';
In AtSourceLib.h:
typedef float ReducedDouble_T;
However, this causes problems when using RTW solvers:
static void rt_ertODEUpdateContinuousStates(RTWSolverInfo *si ) {time_T t = rtsiGetT(si);time_T tnew = rtsiGetSolverStopTime(si);time_T h = rtsiGetStepSize(si);ReducedDouble_T *x = rtsiGetContStates(si); // This is a real_T pointerODE3_IntgData *id = (ODE3_IntgData *)rtsiGetSolverData(si);ReducedDouble_T *y = id->y;ReducedDouble_T *f0 = id->f[0];ReducedDouble_T *f1 = id->f[1];ReducedDouble_T *f2 = id->f[2];ReducedDouble_T hB[3];int_T i;int_T nXc = 1;rtsiSetSimTimeStep(si,MINOR_TIME_STEP);/* Save the state values at time t in y, we'll use x as ynew. */(void) memcpy(y,x, nXc*sizeof(ReducedDouble_T)); // Only copying half the data
Best Answer