예제 #1
0
nneyi35s1a * ) & _rtP -> nfugx5ih43 , & _rtZCSV -> nfugx5ih43 ) ; } static
void mdlInitializeSizes ( SimStruct * S ) { ssSetChecksumVal ( S , 0 ,
2573679304U ) ; ssSetChecksumVal ( S , 1 , 1732126455U ) ; ssSetChecksumVal (
S , 2 , 2644021823U ) ; ssSetChecksumVal ( S , 3 , 2167879752U ) ; { mxArray
* slVerStructMat = NULL ; mxArray * slStrMat = mxCreateString ( "simulink" )
; char slVerChar [ 10 ] ; int status = mexCallMATLAB ( 1 , & slVerStructMat ,
1 , & slStrMat , "ver" ) ; if ( status == 0 ) { mxArray * slVerMat =
mxGetField ( slVerStructMat , 0 , "Version" ) ; if ( slVerMat == NULL ) {
status = 1 ; } else { status = mxGetString ( slVerMat , slVerChar , 10 ) ; }
} mxDestroyArray ( slStrMat ) ; mxDestroyArray ( slVerStructMat ) ; if ( (
status == 1 ) || ( strcmp ( slVerChar , "8.7" ) != 0 ) ) { return ; } }
ssSetOptions ( S , SS_OPTION_EXCEPTION_FREE_CODE ) ; if ( ssGetSizeofDWork (
S ) != sizeof ( pklu3vjy1t ) ) { ssSetErrorStatus ( S ,
"Unexpected error: Internal DWork sizes do "
"not match for accelerator mex file." ) ; } if ( ssGetSizeofGlobalBlockIO ( S
) != sizeof ( nmsgyp54ig ) ) { ssSetErrorStatus ( S ,
"Unexpected error: Internal BlockIO sizes do "
"not match for accelerator mex file." ) ; } { int ssSizeofParams ;
ssGetSizeofParams ( S , & ssSizeofParams ) ; if ( ssSizeofParams != sizeof (
bbqvqz25ov ) ) { static char msg [ 256 ] ; sprintf ( msg ,
"Unexpected error: Internal Parameters sizes do "
"not match for accelerator mex file." ) ; } } _ssSetModelRtp ( S , ( real_T *
) & aaesvjrkn2 ) ; _ssSetConstBlockIO ( S , & j0x3c3z5bk ) ; rt_InitInfAndNaN
( sizeof ( real_T ) ) ; ( ( bbqvqz25ov * ) ssGetModelRtp ( S ) ) ->
nfugx5ih43 . P_6 = rtInf ; ( ( bbqvqz25ov * ) ssGetModelRtp ( S ) ) ->
cqabclhqip4 . P_6 = rtInf ; } static void mdlInitializeSampleTimes (
예제 #2
0
파일: Kalman_Sim.c 프로젝트: nemo1992/9DOF
/* Model initialize function */
void Kalman_Sim_initialize(void)
{
  /* Registration code */
  
  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));
  
  /* initialize error status */
  rtmSetErrorStatus(Kalman_Sim_M, (NULL));
  
  /* block I/O */
  
  /* exported global signals */
  Out2 = 0.0;
  Out1[0] = 0.0F;
  Out1[1] = 0.0F;
  Out1[2] = 0.0F;
  
  /* states (dwork) */
  (void) memset((void *)&Kalman_Sim_DWork, 0,
                sizeof(D_Work_Kalman_Sim));
   
   /* external inputs */
   (void) memset(fgyro,0,
                 3*sizeof(real32_T));
    (void) memset(facc,0,
                  3*sizeof(real32_T));
     (void) memset(fmag,0,
                   3*sizeof(real32_T));
      
      /* Start for DiscretePulseGenerator: '<Root>/Pulse Generator' */
      Kalman_Sim_DWork.clockTickCounter = 0;
      
      {
        int32_T i;
        
        /* InitializeConditions for UnitDelay: '<S1>/Unit Delay' */
        for (i = 0; i < 6; i++) {
          Kalman_Sim_DWork.UnitDelay_DSTATE[i] = Kalman_Sim_P.UnitDelay_X0[i];
        }
        
        /* InitializeConditions for UnitDelay: '<S1>/Unit Delay1' */
        memcpy((void *)(&Kalman_Sim_DWork.UnitDelay1_DSTATE[0]), (void *)
               (&Kalman_Sim_P.UnitDelay1_X0[0]), 36U * sizeof(real32_T));
        
        /* InitializeConditions for UnitDelay: '<S1>/Unit Delay2' */
        for (i = 0; i < 6; i++) {
          Kalman_Sim_DWork.UnitDelay2_DSTATE[i] = Kalman_Sim_P.UnitDelay2_X0[i];
        }
        
        /* InitializeConditions for UnitDelay: '<S1>/Unit Delay3' */
        memcpy((void *)(&Kalman_Sim_DWork.UnitDelay3_DSTATE[0]), (void *)
               (&Kalman_Sim_P.UnitDelay3_X0[0]), 36U * sizeof(real32_T));
      }

}
예제 #3
0
/* Function Definitions */
void FCM_NLJD_initialize(void)
{
  int32_T i0;
  rt_InitInfAndNaN(8U);
  state_not_empty = FALSE;
  state = 1144108930U;
  for (i0 = 0; i0 < 2; i0++) {
    b_state[i0] = 362436069U + 158852560U * (uint32_T)i0;
  }

  method = 7U;
}
예제 #4
0
/* Model initialize function */
void model1_initialize(void)
{
  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));

  /* initialize real-time model */
  (void) memset((void *)model1_M, 0,
                sizeof(RT_MODEL_model1_T));
  rtmSetTFinal(model1_M, 2.0);
  model1_M->Timing.stepSize0 = 5.0E-5;

  /* Setup for data logging */
  {
    static RTWLogInfo rt_DataLoggingInfo;
    model1_M->rtwLogInfo = &rt_DataLoggingInfo;
  }

  /* Setup for data logging */
  {
    rtliSetLogXSignalInfo(model1_M->rtwLogInfo, (NULL));
    rtliSetLogXSignalPtrs(model1_M->rtwLogInfo, (NULL));
    rtliSetLogT(model1_M->rtwLogInfo, "tout");
    rtliSetLogX(model1_M->rtwLogInfo, "");
    rtliSetLogXFinal(model1_M->rtwLogInfo, "");
    rtliSetLogVarNameModifier(model1_M->rtwLogInfo, "rt_");
    rtliSetLogFormat(model1_M->rtwLogInfo, 0);
    rtliSetLogMaxRows(model1_M->rtwLogInfo, 1000);
    rtliSetLogDecimation(model1_M->rtwLogInfo, 1);
    rtliSetLogY(model1_M->rtwLogInfo, "");
    rtliSetLogYSignalInfo(model1_M->rtwLogInfo, (NULL));
    rtliSetLogYSignalPtrs(model1_M->rtwLogInfo, (NULL));
  }

  /* states (dwork) */
  (void) memset((void *)&model1_DW, 0,
                sizeof(DW_model1_T));

  /* Matfile logging */
  rt_StartDataLoggingWithStartTime(model1_M->rtwLogInfo, 0.0, rtmGetTFinal
    (model1_M), model1_M->Timing.stepSize0, (&rtmGetErrorStatus(model1_M)));

  /* Enable for Sin: '<S11>/Sine Wave A' */
  model1_DW.systemEnable = 1;

  /* Enable for Sin: '<S11>/Sine Wave B' */
  model1_DW.systemEnable_i = 1;

  /* Enable for Sin: '<S11>/Sine Wave C' */
  model1_DW.systemEnable_g = 1;
}
예제 #5
0
/* Block: extout */
void mcos_lcore_task_0100(uint32_t stacd, uintptr_t extinfo)
{  /* omit input channel bit vector */
  /* CH__VEC(IN_0100,1); */
  real_T DiscreteTimeIntegrator2_Discrete_TimeIntegrator_1;
  real_T DiscreteTimeIntegrator2_Discrete_TimeIntegrator_2;

  /* Common Initialization */
  rt_InitInfAndNaN(sizeof(real_T));

#ifdef TASK_INITIALIZE_0100_COMPLETED
  TASK_INITIALIZE_0100_COMPLETED();
#endif

  /* task loop */
  while (1) {

    /* wait input channel */
    while (1) {
      /* input: DiscreteTimeIntegrator2_Discrete_TimeIntegrator */
      if (CH_0004_0100.flag__0004_0100 == 1) {
	DiscreteTimeIntegrator2_Discrete_TimeIntegrator_1 = CH_0004_0100.DiscreteTimeIntegrator2_Discrete_TimeIntegrator_1;
	DiscreteTimeIntegrator2_Discrete_TimeIntegrator_2 = CH_0004_0100.DiscreteTimeIntegrator2_Discrete_TimeIntegrator_2;
	CH__SYNCM();
	CH_0004_0100.flag__0004_0100 = 0;
	CH__EVENT(TASK_0100, OUT_0004);
	CH__END_LOG(IN_0100);
	break;
      }

      CH__TASK_SCHED(IN_0100,NULL,1);

      CH__MEM_BARRIER();
    }

#ifdef TASK_IN_0100_COMPLETED
    TASK_IN_0100_COMPLETED();
#endif

#ifdef TASK_EXECUTE_0100_COMPLETED
    TASK_EXECUTE_0100_COMPLETED();
#endif

    /****************************************************
     *
     * You may insert some codes here for external output.
     *
     ****************************************************/
  }
}
예제 #6
0
/* Block: DiscreteTimeIntegrator2_In3 */
void mcos_lcore_task_IO0003(uint32_t stacd, uintptr_t extinfo)
{  /* omit output channel bit vector */
  /* CH__VEC(OUT_IO0003,1); */
  real_T DiscreteTimeIntegrator2_In3_1;

  /* Common Initialization */
  rt_InitInfAndNaN(sizeof(real_T));

#ifdef TASK_INITIALIZE_IO0003_COMPLETED
  TASK_INITIALIZE_IO0003_COMPLETED();
#endif

  /* task loop */
  while (1) {

    /****************************************************
     *
     * You should insert some codes here for external input.
     *
     ****************************************************/

#ifdef TASK_EXECUTE_IO0003_COMPLETED
    TASK_EXECUTE_IO0003_COMPLETED();
#endif

    /* wait output channel */
    while (1) {
      /* output: t0 */
      if (CH_IO0003_0000.flag__IO0003_0000 == 0) {
	CH_IO0003_0000.DiscreteTimeIntegrator2_In3_1 = DiscreteTimeIntegrator2_In3_1;
	CH__SYNCM();
	CH_IO0003_0000.flag__IO0003_0000 = 1;
	CH__EVENT(TASK_IO0003,IN_0000);
	CH__END_LOG(OUT_IO0003);
	break;
      }

      CH__TASK_SCHED(OUT_IO0003,NULL,1);

      CH__MEM_BARRIER();
    }

#ifdef TASK_OUT_IO0003_COMPLETED
    TASK_OUT_IO0003_COMPLETED();
#endif
  }
}
예제 #7
0
/* Model initialize function */
void calibrazione_acc_initialize(void)
{
  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));

  /* initialize error status */
  rtmSetErrorStatus(calibrazione_acc_M, (NULL));

  /* external inputs */
  (void) memset((void *)&calibrazione_acc_U, 0,
                sizeof(ExternalInputs_calibrazione_acc));

  /* external outputs */
  (void) memset((void *)&calibrazione_acc_Y, 0,
                sizeof(ExternalOutputs_calibrazione_ac));
}
예제 #8
0
/* Model initialize function */
void testArduino_send_serial_initialize(void)
{
  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));

  /* initialize real-time model */
  (void) memset((void *)testArduino_send_serial_M, 0,
                sizeof(RT_MODEL_testArduino_send_ser_T));

  /* Start for S-Function (arduinoanaloginput_sfcn): '<Root>/Analog Input' */
  MW_pinModeAnalogInput(testArduino_send_serial_P.AnalogInput_p1);

  /* Start for S-Function (arduinoanaloginput_sfcn): '<Root>/Analog Input1' */
  MW_pinModeAnalogInput(testArduino_send_serial_P.AnalogInput1_p1);

  /* Start for S-Function (arduinoanaloginput_sfcn): '<Root>/Analog Input2' */
  MW_pinModeAnalogInput(testArduino_send_serial_P.AnalogInput2_p1);
}
예제 #9
0
static void mdlStart(SimStruct *S)
{
    /* instance underlying S-Function data */
#if defined(RT_MALLOC) || defined(MATLAB_MEX_FILE)
#  if defined(MATLAB_MEX_FILE)

    /* non-finites */
    rt_InitInfAndNaN(sizeof(real_T));

#  endif

    Hammerstein_malloc(S);
    if (ssGetErrorStatus(S) != (NULL) ) {
        return;
    }

#endif

    {
        BlockIO_Hammerstein *_rtB;
        _rtB = ((BlockIO_Hammerstein *) ssGetLocalBlockIO(S));

        /* Level2 S-Function Block: '<S1>/Pwlinear1' (sfunpwlinear) */
        {
            SimStruct *rts = ssGetSFunction(S, 0);
            sfcnStart(rts);
            if (ssGetErrorStatus(rts) != (NULL))
                return;
        }

        /* Level2 S-Function Block: '<S1>/Pwlinear' (sfunpwlinear) */
        {
            SimStruct *rts = ssGetSFunction(S, 1);
            sfcnStart(rts);
            if (ssGetErrorStatus(rts) != (NULL))
                return;
        }
    }
}
예제 #10
0
파일: main_acc.c 프로젝트: latys/Mypaper
P_6 * ( ( BlockIO_main * ) _ssGetBlockIO ( S ) ) -> B_0_16_0 ; } } static
void mdlInitializeSizes ( SimStruct * S ) { ssSetChecksumVal ( S , 0 ,
3089498090U ) ; ssSetChecksumVal ( S , 1 , 49919693U ) ; ssSetChecksumVal ( S
, 2 , 412083875U ) ; ssSetChecksumVal ( S , 3 , 3370502334U ) ; { mxArray *
slVerStructMat = NULL ; mxArray * slStrMat = mxCreateString ( "simulink" ) ;
char slVerChar [ 10 ] ; int status = mexCallMATLAB ( 1 , & slVerStructMat , 1
, & slStrMat , "ver" ) ; if ( status == 0 ) { mxArray * slVerMat = mxGetField
( slVerStructMat , 0 , "Version" ) ; if ( slVerMat == NULL ) { status = 1 ; }
else { status = mxGetString ( slVerMat , slVerChar , 10 ) ; } }
mxDestroyArray ( slStrMat ) ; mxDestroyArray ( slVerStructMat ) ; if ( (
status == 1 ) || ( strcmp ( slVerChar , "8.0" ) != 0 ) ) { return ; } }
ssSetOptions ( S , SS_OPTION_EXCEPTION_FREE_CODE ) ; if ( ssGetSizeofDWork (
S ) != sizeof ( D_Work_main ) ) { ssSetErrorStatus ( S ,
"Unexpected error: Internal DWork sizes do "
"not match for accelerator mex file." ) ; } if ( ssGetSizeofGlobalBlockIO ( S
) != sizeof ( BlockIO_main ) ) { ssSetErrorStatus ( S ,
"Unexpected error: Internal BlockIO sizes do "
"not match for accelerator mex file." ) ; } { int ssSizeofParams ;
ssGetSizeofParams ( S , & ssSizeofParams ) ; if ( ssSizeofParams != sizeof (
Parameters_main ) ) { static char msg [ 256 ] ; sprintf ( msg ,
"Unexpected error: Internal Parameters sizes do "
"not match for accelerator mex file." ) ; } } _ssSetDefaultParam ( S , (
real_T * ) & main_rtDefaultParameters ) ; rt_InitInfAndNaN ( sizeof ( real_T
) ) ; } static void mdlInitializeSampleTimes ( SimStruct * S ) { } static
예제 #11
0
/* Model initialize function */
void xpcosc_initialize(boolean_T firstTime)
{
  (void)firstTime;

  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));

  /* initialize real-time model */
  (void) memset((void *)xpcosc_rtM, 0,
                sizeof(rtModel_xpcosc));

  {
    /* Setup solver object */
    rtsiSetSimTimeStepPtr(&xpcosc_rtM->solverInfo,
                          &xpcosc_rtM->Timing.simTimeStep);
    rtsiSetTPtr(&xpcosc_rtM->solverInfo, &rtmGetTPtr(xpcosc_rtM));
    rtsiSetStepSizePtr(&xpcosc_rtM->solverInfo, &xpcosc_rtM->Timing.stepSize0);
    rtsiSetdXPtr(&xpcosc_rtM->solverInfo, &xpcosc_rtM->ModelData.derivs);
    rtsiSetContStatesPtr(&xpcosc_rtM->solverInfo,
                         &xpcosc_rtM->ModelData.contStates);
    rtsiSetNumContStatesPtr(&xpcosc_rtM->solverInfo,
      &xpcosc_rtM->Sizes.numContStates);
    rtsiSetErrorStatusPtr(&xpcosc_rtM->solverInfo, (&rtmGetErrorStatus
      (xpcosc_rtM)));
    rtsiSetRTModelPtr(&xpcosc_rtM->solverInfo, xpcosc_rtM);
  }

  rtsiSetSimTimeStep(&xpcosc_rtM->solverInfo, MAJOR_TIME_STEP);
  xpcosc_rtM->ModelData.intgData.y = xpcosc_rtM->ModelData.odeY;
  xpcosc_rtM->ModelData.intgData.f[0] = xpcosc_rtM->ModelData.odeF[0];
  xpcosc_rtM->ModelData.intgData.f[1] = xpcosc_rtM->ModelData.odeF[1];
  xpcosc_rtM->ModelData.intgData.f[2] = xpcosc_rtM->ModelData.odeF[2];
  xpcosc_rtM->ModelData.intgData.f[3] = xpcosc_rtM->ModelData.odeF[3];
  xpcosc_rtM->ModelData.contStates = ((real_T *) &xpcosc_X);
  rtsiSetSolverData(&xpcosc_rtM->solverInfo, (void *)
                    &xpcosc_rtM->ModelData.intgData);
  rtsiSetSolverName(&xpcosc_rtM->solverInfo,"ode4");
  xpcosc_rtM->solverInfoPtr = (&xpcosc_rtM->solverInfo);

  /* Initialize timing info */
  {
    int_T *mdlTsMap = xpcosc_rtM->Timing.sampleTimeTaskIDArray;
    mdlTsMap[0] = 0;
    mdlTsMap[1] = 1;
    xpcosc_rtM->Timing.sampleTimeTaskIDPtr = (&mdlTsMap[0]);
    xpcosc_rtM->Timing.sampleTimes = (&xpcosc_rtM->Timing.sampleTimesArray[0]);
    xpcosc_rtM->Timing.offsetTimes = (&xpcosc_rtM->Timing.offsetTimesArray[0]);

    /* task periods */
    xpcosc_rtM->Timing.sampleTimes[0] = (0.0);
    xpcosc_rtM->Timing.sampleTimes[1] = (0.001);

    /* task offsets */
    xpcosc_rtM->Timing.offsetTimes[0] = (0.0);
    xpcosc_rtM->Timing.offsetTimes[1] = (0.0);
  }

  rtmSetTPtr(xpcosc_rtM, &xpcosc_rtM->Timing.tArray[0]);

  {
    int_T *mdlSampleHits = xpcosc_rtM->Timing.sampleHitArray;
    mdlSampleHits[0] = 1;
    mdlSampleHits[1] = 1;
    xpcosc_rtM->Timing.sampleHits = (&mdlSampleHits[0]);
  }

  rtmSetTFinal(xpcosc_rtM, 0.2);
  xpcosc_rtM->Timing.stepSize0 = 0.001;
  xpcosc_rtM->Timing.stepSize1 = 0.001;

  /* Setup for data logging */
  {
    static RTWLogInfo rt_DataLoggingInfo;
    xpcosc_rtM->rtwLogInfo = &rt_DataLoggingInfo;
  }

  /* Setup for data logging */
  {
    /*
     * Set pointers to the data and signal info each state
     */
    {
      static int_T rt_LoggedStateWidths[] = {
        1,
        1
      };

      static int_T rt_LoggedStateNumDimensions[] = {
        1,
        1
      };

      static int_T rt_LoggedStateDimensions[] = {
        1,
        1
      };

      static boolean_T rt_LoggedStateIsVarDims[] = {
        0,
        0
      };

      static BuiltInDTypeId rt_LoggedStateDataTypeIds[] = {
        SS_DOUBLE,
        SS_DOUBLE
      };

      static int_T rt_LoggedStateComplexSignals[] = {
        0,
        0
      };

      static const char_T *rt_LoggedStateLabels[] = {
        "CSTATE",
        "CSTATE"
      };

      static const char_T *rt_LoggedStateBlockNames[] = {
        "xpcosc/Integrator1",
        "xpcosc/Integrator"
      };

      static const char_T *rt_LoggedStateNames[] = {
        "",
        ""
      };

      static boolean_T rt_LoggedStateCrossMdlRef[] = {
        0,
        0
      };

      static RTWLogDataTypeConvert rt_RTWLogDataTypeConvert[] = {
        { 0, SS_DOUBLE, SS_DOUBLE, 0, 0, 0, 1.0, 0, 0.0 },

        { 0, SS_DOUBLE, SS_DOUBLE, 0, 0, 0, 1.0, 0, 0.0 }
      };

      static RTWLogSignalInfo rt_LoggedStateSignalInfo = {
        2,
        rt_LoggedStateWidths,
        rt_LoggedStateNumDimensions,
        rt_LoggedStateDimensions,
        rt_LoggedStateIsVarDims,
        (NULL),
        rt_LoggedStateDataTypeIds,
        rt_LoggedStateComplexSignals,
        (NULL),

        { rt_LoggedStateLabels },
        (NULL),
        (NULL),
        (NULL),

        { rt_LoggedStateBlockNames },

        { rt_LoggedStateNames },
        rt_LoggedStateCrossMdlRef,
        rt_RTWLogDataTypeConvert
      };

      static void * rt_LoggedStateSignalPtrs[2];
      rtliSetLogXSignalPtrs(xpcosc_rtM->rtwLogInfo, (LogSignalPtrsType)
                            rt_LoggedStateSignalPtrs);
      rtliSetLogXSignalInfo(xpcosc_rtM->rtwLogInfo, &rt_LoggedStateSignalInfo);
      rt_LoggedStateSignalPtrs[0] = (void*)&xpcosc_X.Integrator1_CSTATE;
      rt_LoggedStateSignalPtrs[1] = (void*)&xpcosc_X.Integrator_CSTATE;
    }

    rtliSetLogT(xpcosc_rtM->rtwLogInfo, "tout");
    rtliSetLogX(xpcosc_rtM->rtwLogInfo, "xout");
    rtliSetLogXFinal(xpcosc_rtM->rtwLogInfo, "");
    rtliSetSigLog(xpcosc_rtM->rtwLogInfo, "");
    rtliSetLogVarNameModifier(xpcosc_rtM->rtwLogInfo, "rt_");
    rtliSetLogFormat(xpcosc_rtM->rtwLogInfo, 0);
    rtliSetLogMaxRows(xpcosc_rtM->rtwLogInfo, 0);
    rtliSetLogDecimation(xpcosc_rtM->rtwLogInfo, 1);

    /*
     * Set pointers to the data and signal info for each output
     */
    {
      static void * rt_LoggedOutputSignalPtrs[] = {
        &xpcosc_Y.Outport[0]
      };

      rtliSetLogYSignalPtrs(xpcosc_rtM->rtwLogInfo, ((LogSignalPtrsType)
        rt_LoggedOutputSignalPtrs));
    }

    {
      static int_T rt_LoggedOutputWidths[] = {
        2
      };

      static int_T rt_LoggedOutputNumDimensions[] = {
        1
      };

      static int_T rt_LoggedOutputDimensions[] = {
        2
      };

      static boolean_T rt_LoggedOutputIsVarDims[] = {
        0
      };

      static int_T* rt_LoggedCurrentSignalDimensions[] = {
        (NULL)
      };

      static BuiltInDTypeId rt_LoggedOutputDataTypeIds[] = {
        SS_DOUBLE
      };

      static int_T rt_LoggedOutputComplexSignals[] = {
        0
      };

      static const char_T *rt_LoggedOutputLabels[] = {
        "" };

      static const char_T *rt_LoggedOutputBlockNames[] = {
        "xpcosc/Outport" };

      static RTWLogDataTypeConvert rt_RTWLogDataTypeConvert[] = {
        { 0, SS_DOUBLE, SS_DOUBLE, 0, 0, 0, 1.0, 0, 0.0 }
      };

      static RTWLogSignalInfo rt_LoggedOutputSignalInfo[] = {
        {
          1,
          rt_LoggedOutputWidths,
          rt_LoggedOutputNumDimensions,
          rt_LoggedOutputDimensions,
          rt_LoggedOutputIsVarDims,
          rt_LoggedCurrentSignalDimensions,
          rt_LoggedOutputDataTypeIds,
          rt_LoggedOutputComplexSignals,
          (NULL),

          { rt_LoggedOutputLabels },
          (NULL),
          (NULL),
          (NULL),

          { rt_LoggedOutputBlockNames },

          { (NULL) },
          (NULL),
          rt_RTWLogDataTypeConvert
        }
      };

      rtliSetLogYSignalInfo(xpcosc_rtM->rtwLogInfo, rt_LoggedOutputSignalInfo);

      /* set currSigDims field */
      rt_LoggedCurrentSignalDimensions[0] = &rt_LoggedOutputWidths[0];
    }

    rtliSetLogY(xpcosc_rtM->rtwLogInfo, "yout");
  }

  /* external mode info */
  xpcosc_rtM->Sizes.checksums[0] = (1235351435U);
  xpcosc_rtM->Sizes.checksums[1] = (4143988505U);
  xpcosc_rtM->Sizes.checksums[2] = (362576123U);
  xpcosc_rtM->Sizes.checksums[3] = (1068881914U);

  {
    static const sysRanDType rtAlwaysEnabled = SUBSYS_RAN_BC_ENABLE;
    static RTWExtModeInfo rt_ExtModeInfo;
    static const sysRanDType *systemRan[1];
    xpcosc_rtM->extModeInfo = (&rt_ExtModeInfo);
    rteiSetSubSystemActiveVectorAddresses(&rt_ExtModeInfo, systemRan);
    systemRan[0] = &rtAlwaysEnabled;
    rteiSetModelMappingInfoPtr(xpcosc_rtM->extModeInfo,
      &xpcosc_rtM->SpecialInfo.mappingInfo);
    rteiSetChecksumsPtr(xpcosc_rtM->extModeInfo, xpcosc_rtM->Sizes.checksums);
    rteiSetTPtr(xpcosc_rtM->extModeInfo, rtmGetTPtr(xpcosc_rtM));
  }

  xpcosc_rtM->solverInfoPtr = (&xpcosc_rtM->solverInfo);
  xpcosc_rtM->Timing.stepSize = (0.001);
  rtsiSetFixedStepSize(&xpcosc_rtM->solverInfo, 0.001);
  rtsiSetSolverMode(&xpcosc_rtM->solverInfo, SOLVER_MODE_SINGLETASKING);

  /* block I/O */
  xpcosc_rtM->ModelData.blockIO = ((void *) &xpcosc_B);

  {
    xpcosc_B.Integrator1 = 0.0;
    xpcosc_B.PCI6221AD = 0.0;
    xpcosc_B.RateTransition1 = 0.0;
    xpcosc_B.SignalGenerator = 0.0;
    xpcosc_B.RateTransition = 0.0;
    xpcosc_B.Gain = 0.0;
    xpcosc_B.Integrator = 0.0;
    xpcosc_B.Gain1 = 0.0;
    xpcosc_B.Gain2 = 0.0;
    xpcosc_B.Sum = 0.0;
  }

  /* parameters */
  xpcosc_rtM->ModelData.defaultParam = ((real_T *)&xpcosc_P);

  /* states (continuous) */
  {
    real_T *x = (real_T *) &xpcosc_X;
    xpcosc_rtM->ModelData.contStates = (x);
    (void) memset((void *)&xpcosc_X, 0,
                  sizeof(ContinuousStates_xpcosc));
  }

  /* states (dwork) */
  xpcosc_rtM->Work.dwork = ((void *) &xpcosc_DWork);
  (void) memset((void *)&xpcosc_DWork, 0,
                sizeof(D_Work_xpcosc));
  xpcosc_DWork.PCI6713DA_RWORK = 0.0;

  /* external outputs */
  xpcosc_rtM->ModelData.outputs = (&xpcosc_Y);
  xpcosc_Y.Outport[0] = 0.0;
  xpcosc_Y.Outport[1] = 0.0;

  /* data type transition information */
  {
    static DataTypeTransInfo dtInfo;
    (void) memset((char_T *) &dtInfo, 0,
                  sizeof(dtInfo));
    xpcosc_rtM->SpecialInfo.mappingInfo = (&dtInfo);
    xpcosc_rtM->SpecialInfo.xpcData = ((void*) &dtInfo);
    dtInfo.numDataTypes = 14;
    dtInfo.dataTypeSizes = &rtDataTypeSizes[0];
    dtInfo.dataTypeNames = &rtDataTypeNames[0];

    /* Block I/O transition table */
    dtInfo.B = &rtBTransTable;

    /* Parameters transition table */
    dtInfo.P = &rtPTransTable;
  }

  /* Initialize DataMapInfo substructure containing ModelMap for C API */
  xpcosc_InitializeDataMapInfo(xpcosc_rtM);

  /* child S-Function registration */
  {
    RTWSfcnInfo *sfcnInfo = &xpcosc_rtM->NonInlinedSFcns.sfcnInfo;
    xpcosc_rtM->sfcnInfo = (sfcnInfo);
    rtssSetErrorStatusPtr(sfcnInfo, (&rtmGetErrorStatus(xpcosc_rtM)));
    rtssSetNumRootSampTimesPtr(sfcnInfo, &xpcosc_rtM->Sizes.numSampTimes);
    xpcosc_rtM->NonInlinedSFcns.taskTimePtrs[0] = &(rtmGetTPtr(xpcosc_rtM)[0]);
    xpcosc_rtM->NonInlinedSFcns.taskTimePtrs[1] = &(rtmGetTPtr(xpcosc_rtM)[1]);
    rtssSetTPtrPtr(sfcnInfo,xpcosc_rtM->NonInlinedSFcns.taskTimePtrs);
    rtssSetTStartPtr(sfcnInfo, &rtmGetTStart(xpcosc_rtM));
    rtssSetTFinalPtr(sfcnInfo, &rtmGetTFinal(xpcosc_rtM));
    rtssSetTimeOfLastOutputPtr(sfcnInfo, &rtmGetTimeOfLastOutput(xpcosc_rtM));
    rtssSetStepSizePtr(sfcnInfo, &xpcosc_rtM->Timing.stepSize);
    rtssSetStopRequestedPtr(sfcnInfo, &rtmGetStopRequested(xpcosc_rtM));
    rtssSetDerivCacheNeedsResetPtr(sfcnInfo,
      &xpcosc_rtM->ModelData.derivCacheNeedsReset);
    rtssSetZCCacheNeedsResetPtr(sfcnInfo,
      &xpcosc_rtM->ModelData.zCCacheNeedsReset);
    rtssSetBlkStateChangePtr(sfcnInfo, &xpcosc_rtM->ModelData.blkStateChange);
    rtssSetSampleHitsPtr(sfcnInfo, &xpcosc_rtM->Timing.sampleHits);
    rtssSetPerTaskSampleHitsPtr(sfcnInfo, &xpcosc_rtM->Timing.perTaskSampleHits);
    rtssSetSimModePtr(sfcnInfo, &xpcosc_rtM->simMode);
    rtssSetSolverInfoPtr(sfcnInfo, &xpcosc_rtM->solverInfoPtr);
  }

  xpcosc_rtM->Sizes.numSFcns = (2);

  /* register each child */
  {
    (void) memset((void *)&xpcosc_rtM->NonInlinedSFcns.childSFunctions[0], 0,
                  2*sizeof(SimStruct));
    xpcosc_rtM->childSfunctions =
      (&xpcosc_rtM->NonInlinedSFcns.childSFunctionPtrs[0]);
    xpcosc_rtM->childSfunctions[0] =
      (&xpcosc_rtM->NonInlinedSFcns.childSFunctions[0]);
    xpcosc_rtM->childSfunctions[1] =
      (&xpcosc_rtM->NonInlinedSFcns.childSFunctions[1]);

    /* Level2 S-Function Block: xpcosc/<Root>/PCI-6221 AD (adnipcim) */
    {
      SimStruct *rts = xpcosc_rtM->childSfunctions[0];

      /* timing info */
      time_T *sfcnPeriod = xpcosc_rtM->NonInlinedSFcns.Sfcn0.sfcnPeriod;
      time_T *sfcnOffset = xpcosc_rtM->NonInlinedSFcns.Sfcn0.sfcnOffset;
      int_T *sfcnTsMap = xpcosc_rtM->NonInlinedSFcns.Sfcn0.sfcnTsMap;
      (void) memset((void*)sfcnPeriod, 0,
                    sizeof(time_T)*1);
      (void) memset((void*)sfcnOffset, 0,
                    sizeof(time_T)*1);
      ssSetSampleTimePtr(rts, &sfcnPeriod[0]);
      ssSetOffsetTimePtr(rts, &sfcnOffset[0]);
      ssSetSampleTimeTaskIDPtr(rts, sfcnTsMap);

      /* Set up the mdlInfo pointer */
      {
        ssSetBlkInfo2Ptr(rts, &xpcosc_rtM->NonInlinedSFcns.blkInfo2[0]);
      }

      ssSetRTWSfcnInfo(rts, xpcosc_rtM->sfcnInfo);

      /* Allocate memory of model methods 2 */
      {
        ssSetModelMethods2(rts, &xpcosc_rtM->NonInlinedSFcns.methods2[0]);
      }

      /* Allocate memory of model methods 3 */
      {
        ssSetModelMethods3(rts, &xpcosc_rtM->NonInlinedSFcns.methods3[0]);
      }

      /* Allocate memory for states auxilliary information */
      {
        ssSetStatesInfo2(rts, &xpcosc_rtM->NonInlinedSFcns.statesInfo2[0]);
      }

      /* outputs */
      {
        ssSetPortInfoForOutputs(rts,
          &xpcosc_rtM->NonInlinedSFcns.Sfcn0.outputPortInfo[0]);
        _ssSetNumOutputPorts(rts, 1);

        /* port 0 */
        {
          _ssSetOutputPortNumDimensions(rts, 0, 1);
          ssSetOutputPortWidth(rts, 0, 1);
          ssSetOutputPortSignal(rts, 0, ((real_T *) &xpcosc_B.PCI6221AD));
        }
      }

      /* path info */
      ssSetModelName(rts, "PCI-6221 AD");
      ssSetPath(rts, "xpcosc/PCI-6221 AD");
      ssSetRTModel(rts,xpcosc_rtM);
      ssSetParentSS(rts, (NULL));
      ssSetRootSS(rts, rts);
      ssSetVersion(rts, SIMSTRUCT_VERSION_LEVEL2);

      /* parameters */
      {
        mxArray **sfcnParams = (mxArray **)
          &xpcosc_rtM->NonInlinedSFcns.Sfcn0.params;
        ssSetSFcnParamsCount(rts, 7);
        ssSetSFcnParamsPtr(rts, &sfcnParams[0]);
        ssSetSFcnParam(rts, 0, (mxArray*)xpcosc_P.PCI6221AD_P1_Size);
        ssSetSFcnParam(rts, 1, (mxArray*)xpcosc_P.PCI6221AD_P2_Size);
        ssSetSFcnParam(rts, 2, (mxArray*)xpcosc_P.PCI6221AD_P3_Size);
        ssSetSFcnParam(rts, 3, (mxArray*)xpcosc_P.PCI6221AD_P4_Size);
        ssSetSFcnParam(rts, 4, (mxArray*)xpcosc_P.PCI6221AD_P5_Size);
        ssSetSFcnParam(rts, 5, (mxArray*)xpcosc_P.PCI6221AD_P6_Size);
        ssSetSFcnParam(rts, 6, (mxArray*)xpcosc_P.PCI6221AD_P7_Size);
      }

      /* work vectors */
      ssSetIWork(rts, (int_T *) &xpcosc_DWork.PCI6221AD_IWORK[0]);
      ssSetPWork(rts, (void **) &xpcosc_DWork.PCI6221AD_PWORK);

      {
        struct _ssDWorkRecord *dWorkRecord = (struct _ssDWorkRecord *)
          &xpcosc_rtM->NonInlinedSFcns.Sfcn0.dWork;
        struct _ssDWorkAuxRecord *dWorkAuxRecord = (struct _ssDWorkAuxRecord *)
          &xpcosc_rtM->NonInlinedSFcns.Sfcn0.dWorkAux;
        ssSetSFcnDWork(rts, dWorkRecord);
        ssSetSFcnDWorkAux(rts, dWorkAuxRecord);
        _ssSetNumDWork(rts, 2);

        /* IWORK */
        ssSetDWorkWidth(rts, 0, 41);
        ssSetDWorkDataType(rts, 0,SS_INTEGER);
        ssSetDWorkComplexSignal(rts, 0, 0);
        ssSetDWork(rts, 0, &xpcosc_DWork.PCI6221AD_IWORK[0]);

        /* PWORK */
        ssSetDWorkWidth(rts, 1, 1);
        ssSetDWorkDataType(rts, 1,SS_POINTER);
        ssSetDWorkComplexSignal(rts, 1, 0);
        ssSetDWork(rts, 1, &xpcosc_DWork.PCI6221AD_PWORK);
      }

      /* registration */
      adnipcim(rts);
      sfcnInitializeSizes(rts);
      sfcnInitializeSampleTimes(rts);

      /* adjust sample time */
      ssSetSampleTime(rts, 0, 0.001);
      ssSetOffsetTime(rts, 0, 0.0);
      sfcnTsMap[0] = 1;

      /* set compiled values of dynamic vector attributes */
      ssSetNumNonsampledZCs(rts, 0);

      /* Update connectivity flags for each port */
      _ssSetOutputPortConnected(rts, 0, 1);
      _ssSetOutputPortBeingMerged(rts, 0, 0);

      /* Update the BufferDstPort flags for each input port */
    }

    /* Level2 S-Function Block: xpcosc/<Root>/PCI-6713 DA (danipci671x) */
    {
      SimStruct *rts = xpcosc_rtM->childSfunctions[1];

      /* timing info */
      time_T *sfcnPeriod = xpcosc_rtM->NonInlinedSFcns.Sfcn1.sfcnPeriod;
      time_T *sfcnOffset = xpcosc_rtM->NonInlinedSFcns.Sfcn1.sfcnOffset;
      int_T *sfcnTsMap = xpcosc_rtM->NonInlinedSFcns.Sfcn1.sfcnTsMap;
      (void) memset((void*)sfcnPeriod, 0,
                    sizeof(time_T)*1);
      (void) memset((void*)sfcnOffset, 0,
                    sizeof(time_T)*1);
      ssSetSampleTimePtr(rts, &sfcnPeriod[0]);
      ssSetOffsetTimePtr(rts, &sfcnOffset[0]);
      ssSetSampleTimeTaskIDPtr(rts, sfcnTsMap);

      /* Set up the mdlInfo pointer */
      {
        ssSetBlkInfo2Ptr(rts, &xpcosc_rtM->NonInlinedSFcns.blkInfo2[1]);
      }

      ssSetRTWSfcnInfo(rts, xpcosc_rtM->sfcnInfo);

      /* Allocate memory of model methods 2 */
      {
        ssSetModelMethods2(rts, &xpcosc_rtM->NonInlinedSFcns.methods2[1]);
      }

      /* Allocate memory of model methods 3 */
      {
        ssSetModelMethods3(rts, &xpcosc_rtM->NonInlinedSFcns.methods3[1]);
      }

      /* Allocate memory for states auxilliary information */
      {
        ssSetStatesInfo2(rts, &xpcosc_rtM->NonInlinedSFcns.statesInfo2[1]);
      }

      /* inputs */
      {
        _ssSetNumInputPorts(rts, 1);
        ssSetPortInfoForInputs(rts,
          &xpcosc_rtM->NonInlinedSFcns.Sfcn1.inputPortInfo[0]);

        /* port 0 */
        {
          real_T const **sfcnUPtrs = (real_T const **)
            &xpcosc_rtM->NonInlinedSFcns.Sfcn1.UPtrs0;
          sfcnUPtrs[0] = &xpcosc_B.RateTransition;
          ssSetInputPortSignalPtrs(rts, 0, (InputPtrsType)&sfcnUPtrs[0]);
          _ssSetInputPortNumDimensions(rts, 0, 1);
          ssSetInputPortWidth(rts, 0, 1);
        }
      }

      /* path info */
      ssSetModelName(rts, "PCI-6713 DA");
      ssSetPath(rts, "xpcosc/PCI-6713 DA");
      ssSetRTModel(rts,xpcosc_rtM);
      ssSetParentSS(rts, (NULL));
      ssSetRootSS(rts, rts);
      ssSetVersion(rts, SIMSTRUCT_VERSION_LEVEL2);

      /* parameters */
      {
        mxArray **sfcnParams = (mxArray **)
          &xpcosc_rtM->NonInlinedSFcns.Sfcn1.params;
        ssSetSFcnParamsCount(rts, 6);
        ssSetSFcnParamsPtr(rts, &sfcnParams[0]);
        ssSetSFcnParam(rts, 0, (mxArray*)xpcosc_P.PCI6713DA_P1_Size);
        ssSetSFcnParam(rts, 1, (mxArray*)xpcosc_P.PCI6713DA_P2_Size);
        ssSetSFcnParam(rts, 2, (mxArray*)xpcosc_P.PCI6713DA_P3_Size);
        ssSetSFcnParam(rts, 3, (mxArray*)xpcosc_P.PCI6713DA_P4_Size);
        ssSetSFcnParam(rts, 4, (mxArray*)xpcosc_P.PCI6713DA_P5_Size);
        ssSetSFcnParam(rts, 5, (mxArray*)xpcosc_P.PCI6713DA_P6_Size);
      }

      /* work vectors */
      ssSetRWork(rts, (real_T *) &xpcosc_DWork.PCI6713DA_RWORK);
      ssSetIWork(rts, (int_T *) &xpcosc_DWork.PCI6713DA_IWORK[0]);

      {
        struct _ssDWorkRecord *dWorkRecord = (struct _ssDWorkRecord *)
          &xpcosc_rtM->NonInlinedSFcns.Sfcn1.dWork;
        struct _ssDWorkAuxRecord *dWorkAuxRecord = (struct _ssDWorkAuxRecord *)
          &xpcosc_rtM->NonInlinedSFcns.Sfcn1.dWorkAux;
        ssSetSFcnDWork(rts, dWorkRecord);
        ssSetSFcnDWorkAux(rts, dWorkAuxRecord);
        _ssSetNumDWork(rts, 2);

        /* RWORK */
        ssSetDWorkWidth(rts, 0, 1);
        ssSetDWorkDataType(rts, 0,SS_DOUBLE);
        ssSetDWorkComplexSignal(rts, 0, 0);
        ssSetDWork(rts, 0, &xpcosc_DWork.PCI6713DA_RWORK);

        /* IWORK */
        ssSetDWorkWidth(rts, 1, 2);
        ssSetDWorkDataType(rts, 1,SS_INTEGER);
        ssSetDWorkComplexSignal(rts, 1, 0);
        ssSetDWork(rts, 1, &xpcosc_DWork.PCI6713DA_IWORK[0]);
      }

      /* registration */
      danipci671x(rts);
      sfcnInitializeSizes(rts);
      sfcnInitializeSampleTimes(rts);

      /* adjust sample time */
      ssSetSampleTime(rts, 0, 0.001);
      ssSetOffsetTime(rts, 0, 0.0);
      sfcnTsMap[0] = 1;

      /* set compiled values of dynamic vector attributes */
      ssSetNumNonsampledZCs(rts, 0);

      /* Update connectivity flags for each port */
      _ssSetInputPortConnected(rts, 0, 1);

      /* Update the BufferDstPort flags for each input port */
      ssSetInputPortBufferDstPort(rts, 0, -1);
    }
  }
}
예제 #12
0
/* Model initialize function */
void HConstfolding_initialize(void)
{
  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));

  /* initialize real-time model */
  (void) memset((void *)HConstfolding_M, 0,
                sizeof(RT_MODEL_HConstfolding));

  /* Initialize timing info */
  {
    int_T *mdlTsMap = HConstfolding_M->Timing.sampleTimeTaskIDArray;
    mdlTsMap[0] = 0;
    HConstfolding_M->Timing.sampleTimeTaskIDPtr = (&mdlTsMap[0]);
    HConstfolding_M->Timing.sampleTimes =
      (&HConstfolding_M->Timing.sampleTimesArray[0]);
    HConstfolding_M->Timing.offsetTimes =
      (&HConstfolding_M->Timing.offsetTimesArray[0]);

    /* task periods */
    HConstfolding_M->Timing.sampleTimes[0] = (1.0);

    /* task offsets */
    HConstfolding_M->Timing.offsetTimes[0] = (0.0);
  }

  rtmSetTPtr(HConstfolding_M, &HConstfolding_M->Timing.tArray[0]);

  {
    int_T *mdlSampleHits = HConstfolding_M->Timing.sampleHitArray;
    mdlSampleHits[0] = 1;
    HConstfolding_M->Timing.sampleHits = (&mdlSampleHits[0]);
  }

  rtmSetTFinal(HConstfolding_M, 1.0E+8);
  HConstfolding_M->Timing.stepSize0 = 1.0;

  /* Setup for data logging */
  {
    static RTWLogInfo rt_DataLoggingInfo;
    HConstfolding_M->rtwLogInfo = &rt_DataLoggingInfo;
  }

  /* Setup for data logging */
  {
    rtliSetLogXSignalInfo(HConstfolding_M->rtwLogInfo, (NULL));
    rtliSetLogXSignalPtrs(HConstfolding_M->rtwLogInfo, (NULL));
    rtliSetLogT(HConstfolding_M->rtwLogInfo, "tout");
    rtliSetLogX(HConstfolding_M->rtwLogInfo, "");
    rtliSetLogXFinal(HConstfolding_M->rtwLogInfo, "");
    rtliSetSigLog(HConstfolding_M->rtwLogInfo, "");
    rtliSetLogVarNameModifier(HConstfolding_M->rtwLogInfo, "rt_");
    rtliSetLogFormat(HConstfolding_M->rtwLogInfo, 0);
    rtliSetLogMaxRows(HConstfolding_M->rtwLogInfo, 1000);
    rtliSetLogDecimation(HConstfolding_M->rtwLogInfo, 1);

    /*
     * Set pointers to the data and signal info for each output
     */
    {
      static void * rt_LoggedOutputSignalPtrs[] = {
        &HConstfolding_Y.Out1
      };

      rtliSetLogYSignalPtrs(HConstfolding_M->rtwLogInfo, ((LogSignalPtrsType)
        rt_LoggedOutputSignalPtrs));
    }

    {
      static int_T rt_LoggedOutputWidths[] = {
        1
      };

      static int_T rt_LoggedOutputNumDimensions[] = {
        1
      };

      static int_T rt_LoggedOutputDimensions[] = {
        1
      };

      static boolean_T rt_LoggedOutputIsVarDims[] = {
        0
      };

      static void* rt_LoggedCurrentSignalDimensions[] = {
        (NULL)
      };

      static int_T rt_LoggedCurrentSignalDimensionsSize[] = {
        4
      };

      static BuiltInDTypeId rt_LoggedOutputDataTypeIds[] = {
        SS_DOUBLE
      };

      static int_T rt_LoggedOutputComplexSignals[] = {
        0
      };

      static const char_T *rt_LoggedOutputLabels[] = {
        "" };

      static const char_T *rt_LoggedOutputBlockNames[] = {
        "HConstfolding/Out1" };

      static RTWLogDataTypeConvert rt_RTWLogDataTypeConvert[] = {
        { 0, SS_DOUBLE, SS_DOUBLE, 0, 0, 0, 1.0, 0, 0.0 }
      };

      static RTWLogSignalInfo rt_LoggedOutputSignalInfo[] = {
        {
          1,
          rt_LoggedOutputWidths,
          rt_LoggedOutputNumDimensions,
          rt_LoggedOutputDimensions,
          rt_LoggedOutputIsVarDims,
          rt_LoggedCurrentSignalDimensions,
          rt_LoggedCurrentSignalDimensionsSize,
          rt_LoggedOutputDataTypeIds,
          rt_LoggedOutputComplexSignals,
          (NULL),

          { rt_LoggedOutputLabels },
          (NULL),
          (NULL),
          (NULL),

          { rt_LoggedOutputBlockNames },

          { (NULL) },
          (NULL),
          rt_RTWLogDataTypeConvert
        }
      };

      rtliSetLogYSignalInfo(HConstfolding_M->rtwLogInfo,
                            rt_LoggedOutputSignalInfo);

      /* set currSigDims field */
      rt_LoggedCurrentSignalDimensions[0] = &rt_LoggedOutputWidths[0];
    }

    rtliSetLogY(HConstfolding_M->rtwLogInfo, "yout");
  }

  HConstfolding_M->solverInfoPtr = (&HConstfolding_M->solverInfo);
  HConstfolding_M->Timing.stepSize = (1.0);
  rtsiSetFixedStepSize(&HConstfolding_M->solverInfo, 1.0);
  rtsiSetSolverMode(&HConstfolding_M->solverInfo, SOLVER_MODE_SINGLETASKING);

  /* states (dwork) */
  (void) memset((void *)&HConstfolding_DWork, 0,
                sizeof(D_Work_HConstfolding));

  /* external outputs */
  HConstfolding_Y.Out1 = 0.0;

  /* Matfile logging */
  rt_StartDataLoggingWithStartTime(HConstfolding_M->rtwLogInfo, 0.0,
    rtmGetTFinal(HConstfolding_M), HConstfolding_M->Timing.stepSize0,
    (&rtmGetErrorStatus(HConstfolding_M)));

  /* Initialize Sizes */
  HConstfolding_M->Sizes.numContStates = (0);/* Number of continuous states */
  HConstfolding_M->Sizes.numY = (1);   /* Number of model outputs */
  HConstfolding_M->Sizes.numU = (0);   /* Number of model inputs */
  HConstfolding_M->Sizes.sysDirFeedThru = (0);/* The model is not direct feedthrough */
  HConstfolding_M->Sizes.numSampTimes = (1);/* Number of sample times */
  HConstfolding_M->Sizes.numBlocks = (14);/* Number of blocks */
  HConstfolding_M->Sizes.numBlockIO = (0);/* Number of block outputs */
  HConstfolding_M->Sizes.numBlockPrms = (10);/* Sum of parameter "widths" */

  /* InitializeConditions for UnitDelay: '<Root>/Unit Delay' */
  HConstfolding_DWork.UnitDelay_DSTATE = HConstfolding_P.UnitDelay_X0;

  /* InitializeConditions for UnitDelay: '<Root>/Unit Delay1' */
  HConstfolding_DWork.UnitDelay1_DSTATE = HConstfolding_P.UnitDelay1_X0;
}
예제 #13
0
/* Model initialize function */
void BP_MC1_initialize(boolean_T firstTime)
{
  (void)firstTime;

  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));

  /* initialize real-time model */
  (void) memset((void *)BP_MC1_M,0,
                sizeof(RT_MODEL_BP_MC1));

  /* Initialize timing info */
  {
    int_T *mdlTsMap = BP_MC1_M->Timing.sampleTimeTaskIDArray;
    mdlTsMap[0] = 0;
    BP_MC1_M->Timing.sampleTimeTaskIDPtr = (&mdlTsMap[0]);
    BP_MC1_M->Timing.sampleTimes = (&BP_MC1_M->Timing.sampleTimesArray[0]);
    BP_MC1_M->Timing.offsetTimes = (&BP_MC1_M->Timing.offsetTimesArray[0]);

    /* task periods */
    BP_MC1_M->Timing.sampleTimes[0] = (0.05);

    /* task offsets */
    BP_MC1_M->Timing.offsetTimes[0] = (0.0);
  }

  rtmSetTPtr(BP_MC1_M, &BP_MC1_M->Timing.tArray[0]);

  {
    int_T *mdlSampleHits = BP_MC1_M->Timing.sampleHitArray;
    mdlSampleHits[0] = 1;
    BP_MC1_M->Timing.sampleHits = (&mdlSampleHits[0]);
  }

  rtmSetTFinal(BP_MC1_M, -1);
  BP_MC1_M->Timing.stepSize0 = 0.05;

  /* Setup for data logging */
  {
    static RTWLogInfo rt_DataLoggingInfo;
    BP_MC1_M->rtwLogInfo = &rt_DataLoggingInfo;
  }

  /* Setup for data logging */
  {
    rtliSetLogXSignalInfo(BP_MC1_M->rtwLogInfo, (NULL));
    rtliSetLogXSignalPtrs(BP_MC1_M->rtwLogInfo, (NULL));
    rtliSetLogT(BP_MC1_M->rtwLogInfo, "");
    rtliSetLogX(BP_MC1_M->rtwLogInfo, "");
    rtliSetLogXFinal(BP_MC1_M->rtwLogInfo, "");
    rtliSetSigLog(BP_MC1_M->rtwLogInfo, "");
    rtliSetLogVarNameModifier(BP_MC1_M->rtwLogInfo, "rt_");
    rtliSetLogFormat(BP_MC1_M->rtwLogInfo, 0);
    rtliSetLogMaxRows(BP_MC1_M->rtwLogInfo, 1000);
    rtliSetLogDecimation(BP_MC1_M->rtwLogInfo, 1);
    rtliSetLogY(BP_MC1_M->rtwLogInfo, "");
    rtliSetLogYSignalInfo(BP_MC1_M->rtwLogInfo, (NULL));
    rtliSetLogYSignalPtrs(BP_MC1_M->rtwLogInfo, (NULL));
  }

  BP_MC1_M->solverInfoPtr = (&BP_MC1_M->solverInfo);
  BP_MC1_M->Timing.stepSize = (0.05);
  rtsiSetFixedStepSize(&BP_MC1_M->solverInfo, 0.05);
  rtsiSetSolverMode(&BP_MC1_M->solverInfo, SOLVER_MODE_SINGLETASKING);

  /* block I/O */
  BP_MC1_M->ModelData.blockIO = ((void *) &BP_MC1_B);
  (void) memset(((void *) &BP_MC1_B),0,
                sizeof(BlockIO_BP_MC1));

  {
    BP_MC1_B.u1 = 0.0;
    BP_MC1_B.Sign = 0.0;
    BP_MC1_B.PortVPS_X = 0.0;
    BP_MC1_B.PortVPS_X_g = 0.0;
    BP_MC1_B.u1_p = 0.0;
    BP_MC1_B.PortVSP_Y = 0.0;
    BP_MC1_B.PortVSP_Y_i = 0.0;
    BP_MC1_B.u1_g = 0.0;
    BP_MC1_B.StarboardVSP_X = 0.0;
    BP_MC1_B.u1_pj = 0.0;
    BP_MC1_B.StarboardVSP_Y = 0.0;
    BP_MC1_B.Servo1 = 0.0;
    BP_MC1_B.Servo2 = 0.0;
    BP_MC1_B.Servo3 = 0.0;
    BP_MC1_B.Servo4 = 0.0;
    BP_MC1_B.VPS_Speed_Gain = 0.0;
    BP_MC1_B.Sum = 0.0;
    BP_MC1_B.BowThrusterdirection = 0.0;
    BP_MC1_B.BT_D_Gain1 = 0.0;
    BP_MC1_B.BT_D_Gain2 = 0.0;
    BP_MC1_B.Add = 0.0;
    BP_MC1_B.BT_L_Gain1 = 0.0;
    BP_MC1_B.BT_L_Gain2 = 0.0;
    BP_MC1_B.Sum1 = 0.0;
    BP_MC1_B.Sum2 = 0.0;
    BP_MC1_B.Switch = 0.0;
    BP_MC1_B.Switch2 = 0.0;
  }

  /* parameters */
  BP_MC1_M->ModelData.defaultParam = ((real_T *) &BP_MC1_P);

  /* states (dwork) */
  BP_MC1_M->Work.dwork = ((void *) &BP_MC1_DWork);
  (void) memset((void *)&BP_MC1_DWork, 0,
                sizeof(D_Work_BP_MC1));
}
예제 #14
0
/* Model initialize function */
void Crane_initialize(boolean_T firstTime)
{
  (void)firstTime;

  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));    /* initialize real-time model */
  (void) memset((char_T *)Crane_M,0,
                sizeof(RT_MODEL_Crane));

  {
    /* Setup solver object */
    rtsiSetSimTimeStepPtr(&Crane_M->solverInfo, &Crane_M->Timing.simTimeStep);
    rtsiSetTPtr(&Crane_M->solverInfo, &rtmGetTPtr(Crane_M));
    rtsiSetStepSizePtr(&Crane_M->solverInfo, &Crane_M->Timing.stepSize0);
    rtsiSetdXPtr(&Crane_M->solverInfo, &Crane_M->ModelData.derivs);
    rtsiSetContStatesPtr(&Crane_M->solverInfo, &Crane_M->ModelData.contStates);
    rtsiSetNumContStatesPtr(&Crane_M->solverInfo, &Crane_M->Sizes.numContStates);
    rtsiSetErrorStatusPtr(&Crane_M->solverInfo, (&rtmGetErrorStatus(Crane_M)));
    rtsiSetRTModelPtr(&Crane_M->solverInfo, Crane_M);
  }

  rtsiSetSimTimeStep(&Crane_M->solverInfo, MAJOR_TIME_STEP);
  Crane_M->ModelData.intgData.f[0] = Crane_M->ModelData.odeF[0];
  Crane_M->ModelData.contStates = ((real_T *) &Crane_X);
  rtsiSetSolverData(&Crane_M->solverInfo, (void *)&Crane_M->ModelData.intgData);
  rtsiSetSolverName(&Crane_M->solverInfo,"ode1");

  /* Initialize timing info */
  {
    int_T *mdlTsMap = Crane_M->Timing.sampleTimeTaskIDArray;
    mdlTsMap[0] = 0;
    mdlTsMap[1] = 1;
    Crane_M->Timing.sampleTimeTaskIDPtr = (&mdlTsMap[0]);
    Crane_M->Timing.sampleTimes = (&Crane_M->Timing.sampleTimesArray[0]);
    Crane_M->Timing.offsetTimes = (&Crane_M->Timing.offsetTimesArray[0]);

    /* task periods */
    Crane_M->Timing.sampleTimes[0] = (0.0);
    Crane_M->Timing.sampleTimes[1] = (0.001);

    /* task offsets */
    Crane_M->Timing.offsetTimes[0] = (0.0);
    Crane_M->Timing.offsetTimes[1] = (0.0);
  }

  rtmSetTPtr(Crane_M, &Crane_M->Timing.tArray[0]);

  {
    int_T *mdlSampleHits = Crane_M->Timing.sampleHitArray;
    mdlSampleHits[0] = 1;
    mdlSampleHits[1] = 1;
    Crane_M->Timing.sampleHits = (&mdlSampleHits[0]);
  }

  rtmSetTFinal(Crane_M, -1);
  Crane_M->Timing.stepSize0 = 0.001;
  Crane_M->Timing.stepSize1 = 0.001;

  /* external mode info */
  Crane_M->Sizes.checksums[0] = (2478158774U);
  Crane_M->Sizes.checksums[1] = (3803381746U);
  Crane_M->Sizes.checksums[2] = (277883647U);
  Crane_M->Sizes.checksums[3] = (670793414U);

  {
    static const sysRanDType rtAlwaysEnabled = SUBSYS_RAN_BC_ENABLE;
    static RTWExtModeInfo rt_ExtModeInfo;
    static const sysRanDType *systemRan[1];
    Crane_M->extModeInfo = (&rt_ExtModeInfo);
    rteiSetSubSystemActiveVectorAddresses(&rt_ExtModeInfo, systemRan);
    systemRan[0] = &rtAlwaysEnabled;
    rteiSetModelMappingInfoPtr(&rt_ExtModeInfo,
      &Crane_M->SpecialInfo.mappingInfo);
    rteiSetChecksumsPtr(&rt_ExtModeInfo, Crane_M->Sizes.checksums);
    rteiSetTPtr(&rt_ExtModeInfo, rtmGetTPtr(Crane_M));
  }

  Crane_M->solverInfoPtr = (&Crane_M->solverInfo);
  Crane_M->Timing.stepSize = (0.001);
  rtsiSetFixedStepSize(&Crane_M->solverInfo, 0.001);
  rtsiSetSolverMode(&Crane_M->solverInfo, SOLVER_MODE_SINGLETASKING);

  /* block I/O */
  Crane_M->ModelData.blockIO = ((void *) &Crane_B);

  {
    int_T i;
    void *pVoidBlockIORegion;
    pVoidBlockIORegion = (void *)(&Crane_B.Block1_o1[0]);
    for (i = 0; i < 49; i++) {
      ((real_T*)pVoidBlockIORegion)[i] = 0.0;
    }
  }

  /* parameters */
  Crane_M->ModelData.defaultParam = ((real_T *) &Crane_P);

  /* states (continuous) */
  {
    real_T *x = (real_T *) &Crane_X;
    Crane_M->ModelData.contStates = (x);
    (void) memset((char_T *)x,0,
                  sizeof(ContinuousStates_Crane));
  }

  /* states (dwork) */
  Crane_M->Work.dwork = ((void *) &Crane_DWork);
  (void) memset((char_T *) &Crane_DWork,0,
                sizeof(D_Work_Crane));

  {
    int_T i;
    real_T *dwork_ptr = (real_T *) &Crane_DWork.Memory_PreviousInput[0];
    for (i = 0; i < 11; i++) {
      dwork_ptr[i] = 0.0;
    }
  }

  /* data type transition information */
  {
    static DataTypeTransInfo dtInfo;
    (void) memset((char_T *) &dtInfo,0,
                  sizeof(dtInfo));
    Crane_M->SpecialInfo.mappingInfo = (&dtInfo);
    dtInfo.numDataTypes = 15;
    dtInfo.dataTypeSizes = &rtDataTypeSizes[0];
    dtInfo.dataTypeNames = &rtDataTypeNames[0];

    /* Block I/O transition table */
    dtInfo.B = &rtBTransTable;

    /* Parameters transition table */
    dtInfo.P = &rtPTransTable;
  }
}
예제 #15
0
/* Model initialize function */
void CelpSimulink_initialize(boolean_T firstTime)
{
  (void)firstTime;

  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));

  /* initialize real-time model */
  (void) memset((char_T *)CelpSimulink_M,0,
                sizeof(RT_MODEL_CelpSimulink));

  /* Initialize timing info */
  {
    int_T *mdlTsMap = CelpSimulink_M->Timing.sampleTimeTaskIDArray;
    mdlTsMap[0] = 0;
    CelpSimulink_M->Timing.sampleTimeTaskIDPtr = (&mdlTsMap[0]);
    CelpSimulink_M->Timing.sampleTimes =
      (&CelpSimulink_M->Timing.sampleTimesArray[0]);
    CelpSimulink_M->Timing.offsetTimes =
      (&CelpSimulink_M->Timing.offsetTimesArray[0]);

    /* task periods */
    CelpSimulink_M->Timing.sampleTimes[0] = (0.01);

    /* task offsets */
    CelpSimulink_M->Timing.offsetTimes[0] = (0.0);
  }

  rtmSetTPtr(CelpSimulink_M, &CelpSimulink_M->Timing.tArray[0]);

  {
    int_T *mdlSampleHits = CelpSimulink_M->Timing.sampleHitArray;
    mdlSampleHits[0] = 1;
    CelpSimulink_M->Timing.sampleHits = (&mdlSampleHits[0]);
  }

  rtmSetTFinal(CelpSimulink_M, -1);
  CelpSimulink_M->Timing.stepSize0 = 0.01;

  /* Setup for data logging */
  {
    static RTWLogInfo rt_DataLoggingInfo;
    CelpSimulink_M->rtwLogInfo = &rt_DataLoggingInfo;
    rtliSetLogXSignalInfo(CelpSimulink_M->rtwLogInfo, NULL);
    rtliSetLogXSignalPtrs(CelpSimulink_M->rtwLogInfo, NULL);
    rtliSetLogT(CelpSimulink_M->rtwLogInfo, "tout");
    rtliSetLogX(CelpSimulink_M->rtwLogInfo, "");
    rtliSetLogXFinal(CelpSimulink_M->rtwLogInfo, "");
    rtliSetSigLog(CelpSimulink_M->rtwLogInfo, "");
    rtliSetLogVarNameModifier(CelpSimulink_M->rtwLogInfo, "rt_");
    rtliSetLogFormat(CelpSimulink_M->rtwLogInfo, 0);
    rtliSetLogMaxRows(CelpSimulink_M->rtwLogInfo, 1000);
    rtliSetLogDecimation(CelpSimulink_M->rtwLogInfo, 1);
    rtliSetLogY(CelpSimulink_M->rtwLogInfo, "");
    rtliSetLogYSignalInfo(CelpSimulink_M->rtwLogInfo, NULL);
    rtliSetLogYSignalPtrs(CelpSimulink_M->rtwLogInfo, NULL);
  }

  CelpSimulink_M->solverInfoPtr = (&CelpSimulink_M->solverInfo);
  CelpSimulink_M->Timing.stepSize = (0.01);
  rtsiSetFixedStepSize(&CelpSimulink_M->solverInfo, 0.01);
  rtsiSetSolverMode(&CelpSimulink_M->solverInfo, SOLVER_MODE_SINGLETASKING);

  /* block I/O */
  CelpSimulink_M->ModelData.blockIO = ((void *) &CelpSimulink_B);
  (void) memset(((void *) &CelpSimulink_B),0,
                sizeof(BlockIO_CelpSimulink));

  {
    int_T i;
    void *pVoidBlockIORegion;
    pVoidBlockIORegion = (void *)(&CelpSimulink_B.FromWaveFile[0]);
    for (i = 0; i < 411; i++) {
      ((real32_T*)pVoidBlockIORegion)[i] = 0.0F;
    }
  }

  /* parameters */
  CelpSimulink_M->ModelData.defaultParam = ((real_T *) &CelpSimulink_P);

  /* states (dwork) */
  CelpSimulink_M->Work.dwork = ((void *) &CelpSimulink_DWork);
  (void) memset((char_T *) &CelpSimulink_DWork,0,
                sizeof(D_Work_CelpSimulink));
  CelpSimulink_DWork.Maximum1_Valdata = 0.0;

  {
    int_T i;
    real32_T *dwork_ptr = (real32_T *)
      &CelpSimulink_DWork.PreEmphasis_FILT_STATES[0];
    for (i = 0; i < 1122; i++) {
      dwork_ptr[i] = 0.0F;
    }
  }
}
예제 #16
0
/* Function Definitions */
void FFT_test_initialize(void)
{
  rt_InitInfAndNaN(8U);
}
/* Function Definitions */
void checkInitialState_initialize(void)
{
  rt_InitInfAndNaN(8U);
}
예제 #18
0
파일: arbeitspunkt.c 프로젝트: matt-han/RCP
/* Model initialize function */
void arbeitspunkt_initialize(boolean_T firstTime)
{
  (void)firstTime;

  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));    /* initialize real-time model */
  (void) memset((char_T *)arbeitspunkt_M,0,
                sizeof(RT_MODEL_arbeitspunkt));

  {
    /* Setup solver object */
    rtsiSetSimTimeStepPtr(&arbeitspunkt_M->solverInfo,
                          &arbeitspunkt_M->Timing.simTimeStep);
    rtsiSetTPtr(&arbeitspunkt_M->solverInfo, &rtmGetTPtr(arbeitspunkt_M));
    rtsiSetStepSizePtr(&arbeitspunkt_M->solverInfo,
                       &arbeitspunkt_M->Timing.stepSize0);
    rtsiSetErrorStatusPtr(&arbeitspunkt_M->solverInfo, (&rtmGetErrorStatus
      (arbeitspunkt_M)));
    rtsiSetRTModelPtr(&arbeitspunkt_M->solverInfo, arbeitspunkt_M);
  }

  rtsiSetSimTimeStep(&arbeitspunkt_M->solverInfo, MAJOR_TIME_STEP);
  rtsiSetSolverName(&arbeitspunkt_M->solverInfo,"FixedStepDiscrete");

  /* Initialize timing info */
  {
    int_T *mdlTsMap = arbeitspunkt_M->Timing.sampleTimeTaskIDArray;
    mdlTsMap[0] = 0;
    mdlTsMap[1] = 1;
    arbeitspunkt_M->Timing.sampleTimeTaskIDPtr = (&mdlTsMap[0]);
    arbeitspunkt_M->Timing.sampleTimes =
      (&arbeitspunkt_M->Timing.sampleTimesArray[0]);
    arbeitspunkt_M->Timing.offsetTimes =
      (&arbeitspunkt_M->Timing.offsetTimesArray[0]);

    /* task periods */
    arbeitspunkt_M->Timing.sampleTimes[0] = (0.0);
    arbeitspunkt_M->Timing.sampleTimes[1] = (0.001);

    /* task offsets */
    arbeitspunkt_M->Timing.offsetTimes[0] = (0.0);
    arbeitspunkt_M->Timing.offsetTimes[1] = (0.0);
  }

  rtmSetTPtr(arbeitspunkt_M, &arbeitspunkt_M->Timing.tArray[0]);

  {
    int_T *mdlSampleHits = arbeitspunkt_M->Timing.sampleHitArray;
    mdlSampleHits[0] = 1;
    mdlSampleHits[1] = 1;
    arbeitspunkt_M->Timing.sampleHits = (&mdlSampleHits[0]);
  }

  rtmSetTFinal(arbeitspunkt_M, 10.0);
  arbeitspunkt_M->Timing.stepSize0 = 0.001;
  arbeitspunkt_M->Timing.stepSize1 = 0.001;

  /* external mode info */
  arbeitspunkt_M->Sizes.checksums[0] = (51356583U);
  arbeitspunkt_M->Sizes.checksums[1] = (1228941243U);
  arbeitspunkt_M->Sizes.checksums[2] = (1622391598U);
  arbeitspunkt_M->Sizes.checksums[3] = (3849823737U);

  {
    static const sysRanDType rtAlwaysEnabled = SUBSYS_RAN_BC_ENABLE;
    static RTWExtModeInfo rt_ExtModeInfo;
    static const sysRanDType *systemRan[1];
    arbeitspunkt_M->extModeInfo = (&rt_ExtModeInfo);
    rteiSetSubSystemActiveVectorAddresses(&rt_ExtModeInfo, systemRan);
    systemRan[0] = &rtAlwaysEnabled;
    rteiSetModelMappingInfoPtr(&rt_ExtModeInfo,
      &arbeitspunkt_M->SpecialInfo.mappingInfo);
    rteiSetChecksumsPtr(&rt_ExtModeInfo, arbeitspunkt_M->Sizes.checksums);
    rteiSetTPtr(&rt_ExtModeInfo, rtmGetTPtr(arbeitspunkt_M));
  }

  arbeitspunkt_M->solverInfoPtr = (&arbeitspunkt_M->solverInfo);
  arbeitspunkt_M->Timing.stepSize = (0.001);
  rtsiSetFixedStepSize(&arbeitspunkt_M->solverInfo, 0.001);
  rtsiSetSolverMode(&arbeitspunkt_M->solverInfo, SOLVER_MODE_SINGLETASKING);

  /* block I/O */
  arbeitspunkt_M->ModelData.blockIO = ((void *) &arbeitspunkt_B);

  {
    int_T i;
    void *pVoidBlockIORegion;
    pVoidBlockIORegion = (void *)(&arbeitspunkt_B.V_Step);
    for (i = 0; i < 3; i++) {
      ((real_T*)pVoidBlockIORegion)[i] = 0.0;
    }
  }

  /* parameters */
  arbeitspunkt_M->ModelData.defaultParam = ((real_T *) &arbeitspunkt_P);

  /* states (dwork) */
  arbeitspunkt_M->Work.dwork = ((void *) &arbeitspunkt_DWork);
  (void) memset((char_T *) &arbeitspunkt_DWork,0,
                sizeof(D_Work_arbeitspunkt));

  /* data type transition information */
  {
    static DataTypeTransInfo dtInfo;
    (void) memset((char_T *) &dtInfo,0,
                  sizeof(dtInfo));
    arbeitspunkt_M->SpecialInfo.mappingInfo = (&dtInfo);
    dtInfo.numDataTypes = 14;
    dtInfo.dataTypeSizes = &rtDataTypeSizes[0];
    dtInfo.dataTypeNames = &rtDataTypeNames[0];

    /* Block I/O transition table */
    dtInfo.B = &rtBTransTable;

    /* Parameters transition table */
    dtInfo.P = &rtPTransTable;
  }
}
예제 #19
0
static void mdlInitializeSizes(SimStruct *S)
{
  ssSetNumSFcnParams(S, 0);
  if (S->mdlInfo->genericFcn != NULL) {
    _GenericFcn fcn = S->mdlInfo->genericFcn;
    (fcn)(S, GEN_FCN_CHK_MODELREF_SOLVER_TYPE_EARLY, 2, NULL);
  }

  ssSetRTWGeneratedSFcn(S, 2);
  ssSetNumContStates(S, 0);
  ssSetNumDiscStates(S, 0);
  if (!ssSetNumInputPorts(S, 2))
    return;
  if (!ssSetInputPortVectorDimension(S, 0, 1))
    return;
  ssSetInputPortFrameData(S, 0, FRAME_NO);
  ssSetInputPortBusMode(S, 0, SL_NON_BUS_MODE)
    if (ssGetSimMode(S) != SS_SIMMODE_SIZES_CALL_ONLY)
  {
    ssSetInputPortDataType(S, 0, SS_DOUBLE);
  }

  ssSetInputPortDirectFeedThrough(S, 0, 1);
  ssSetInputPortRequiredContiguous(S, 0, 1);
  ssSetInputPortOptimOpts(S, 0, SS_NOT_REUSABLE_AND_GLOBAL);
  ssSetInputPortOverWritable(S, 0, FALSE);
  ssSetInputPortSampleTime(S, 0, 0.0);
  ssSetInputPortOffsetTime(S, 0, 0.0);
  if (!ssSetInputPortVectorDimension(S, 1, 1))
    return;
  ssSetInputPortFrameData(S, 1, FRAME_NO);
  ssSetInputPortBusMode(S, 1, SL_NON_BUS_MODE)
    if (ssGetSimMode(S) != SS_SIMMODE_SIZES_CALL_ONLY)
  {
    ssSetInputPortDataType(S, 1, SS_DOUBLE);
  }

  ssSetInputPortDirectFeedThrough(S, 1, 1);
  ssSetInputPortRequiredContiguous(S, 1, 1);
  ssSetInputPortOptimOpts(S, 1, SS_NOT_REUSABLE_AND_GLOBAL);
  ssSetInputPortOverWritable(S, 1, FALSE);
  ssSetInputPortSampleTime(S, 1, 0.0);
  ssSetInputPortOffsetTime(S, 1, 0.0);
  if (!ssSetNumOutputPorts(S, 1))
    return;
  if (!ssSetOutputPortVectorDimension(S, 0, 1))
    return;
  ssSetOutputPortFrameData(S, 0, FRAME_NO);
  ssSetOutputPortBusMode(S, 0, SL_NON_BUS_MODE)
    if (ssGetSimMode(S) != SS_SIMMODE_SIZES_CALL_ONLY)
  {
    ssSetOutputPortDataType(S, 0, SS_DOUBLE);
  }

  ssSetOutputPortSampleTime(S, 0, 0.0);
  ssSetOutputPortOffsetTime(S, 0, 0.0);
  ssSetOutputPortOkToMerge(S, 0, SS_OK_TO_MERGE);
  ssSetOutputPortOptimOpts(S, 0, SS_NOT_REUSABLE_AND_GLOBAL);
  rt_InitInfAndNaN(sizeof(real_T));

  {
    real_T minValue = rtMinusInf;
    real_T maxValue = rtInf;
    ssSetModelRefInputSignalDesignMin(S,0,&minValue);
    ssSetModelRefInputSignalDesignMax(S,0,&maxValue);
  }

  {
    real_T minValue = rtMinusInf;
    real_T maxValue = rtInf;
    ssSetModelRefInputSignalDesignMin(S,1,&minValue);
    ssSetModelRefInputSignalDesignMax(S,1,&maxValue);
  }

  {
    real_T minValue = rtMinusInf;
    real_T maxValue = rtInf;
    ssSetModelRefOutputSignalDesignMin(S,0,&minValue);
    ssSetModelRefOutputSignalDesignMax(S,0,&maxValue);
  }

  {
    static ssRTWStorageType storageClass[3] = { SS_RTW_STORAGE_AUTO,
      SS_RTW_STORAGE_AUTO, SS_RTW_STORAGE_AUTO };

    ssSetModelRefPortRTWStorageClasses(S, storageClass);
  }

  ssSetNumSampleTimes(S, PORT_BASED_SAMPLE_TIMES);
  ssSetNumRWork(S, 0);
  ssSetNumIWork(S, 0);
  ssSetNumPWork(S, 0);
  ssSetNumModes(S, 0);
  ssSetNumZeroCrossingSignals(S, 0);
  ssSetOutputPortIsNonContinuous(S, 0, 0);
  ssSetOutputPortIsFedByBlockWithModesNoZCs(S, 0, 0);
  ssSetInputPortIsNotDerivPort(S, 0, 1);
  ssSetInputPortIsNotDerivPort(S, 1, 1);
  ssSetModelReferenceSampleTimeInheritanceRule(S,
    DISALLOW_SAMPLE_TIME_INHERITANCE);
  ssSetOptimizeModelRefInitCode(S, 0);
  ssSetModelReferenceNormalModeSupport(S, MDL_START_AND_MDL_PROCESS_PARAMS_OK);
  ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE |
               SS_OPTION_DISALLOW_CONSTANT_SAMPLE_TIME |
               SS_OPTION_SUPPORTS_ALIAS_DATA_TYPES |
               SS_OPTION_WORKS_WITH_CODE_REUSE |
               SS_OPTION_CALL_TERMINATE_ON_EXIT);
  if (S->mdlInfo->genericFcn != NULL) {
    ssRegModelRefChildModel(S,1,childModels);
  }

#if SS_SFCN_FOR_SIM

  if (S->mdlInfo->genericFcn != NULL &&
      ssGetSimMode(S) != SS_SIMMODE_SIZES_CALL_ONLY) {
    mr_vdmultRM_MdlInfoRegFcn(S, "vdmultRM");
  }

#endif

  if (!ssSetNumDWork(S, 1)) {
    return;
  }

#if SS_SFCN_FOR_SIM

  {
    int mdlrefDWTypeId;
    ssRegMdlRefDWorkType(S, &mdlrefDWTypeId);
    if (mdlrefDWTypeId == INVALID_DTYPE_ID )
      return;
    if (!ssSetDataTypeSize(S, mdlrefDWTypeId, sizeof(rtMdlrefDWork_mr_vdmultRM)))
      return;
    ssSetDWorkDataType(S, 0, mdlrefDWTypeId);
    ssSetDWorkWidth(S, 0, 1);
  }

#endif

  ssSetNeedAbsoluteTime(S, 1);
}
예제 #20
0
/* Function Definitions */
void qianalg_initialize(void)
{
  rt_InitInfAndNaN(8U);
}
예제 #21
0
/* Function Definitions */
void kalmanStepRedux_initialize(void)
{
  rt_InitInfAndNaN(8U);
}
/* Function Definitions */
void find_resultant_initialize(void)
{
  rt_InitInfAndNaN(8U);
}
/* Function Definitions */
void quad_8state_kalman_initialize(void)
{
  rt_InitInfAndNaN(8U);
  quad_8state_kalman_init();
}
예제 #24
0
RT_MODEL_ALLOCATION *ALLOCATION(void)
{
  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));

  /* initialize real-time model */
  (void) memset((void *)ALLOCATION_M, 0,
                sizeof(RT_MODEL_ALLOCATION));

  /* Initialize timing info */
  {
    int_T *mdlTsMap = ALLOCATION_M->Timing.sampleTimeTaskIDArray;
    mdlTsMap[0] = 0;
    ALLOCATION_M->Timing.sampleTimeTaskIDPtr = (&mdlTsMap[0]);
    ALLOCATION_M->Timing.sampleTimes = (&ALLOCATION_M->Timing.sampleTimesArray[0]);
    ALLOCATION_M->Timing.offsetTimes = (&ALLOCATION_M->Timing.offsetTimesArray[0]);

    /* task periods */
    ALLOCATION_M->Timing.sampleTimes[0] = (0.01);

    /* task offsets */
    ALLOCATION_M->Timing.offsetTimes[0] = (0.0);
  }

  rtmSetTPtr(ALLOCATION_M, &ALLOCATION_M->Timing.tArray[0]);

  {
    int_T *mdlSampleHits = ALLOCATION_M->Timing.sampleHitArray;
    mdlSampleHits[0] = 1;
    ALLOCATION_M->Timing.sampleHits = (&mdlSampleHits[0]);
  }

  rtmSetTFinal(ALLOCATION_M, -1);
  ALLOCATION_M->Timing.stepSize0 = 0.01;
  ALLOCATION_M->solverInfoPtr = (&ALLOCATION_M->solverInfo);
  ALLOCATION_M->Timing.stepSize = (0.01);
  rtsiSetFixedStepSize(&ALLOCATION_M->solverInfo, 0.01);
  rtsiSetSolverMode(&ALLOCATION_M->solverInfo, SOLVER_MODE_SINGLETASKING);

  /* external inputs */
  ALLOCATION_M->ModelData.inputs = (((void*)&ALLOCATION_U));
  (void) memset((void *)&ALLOCATION_U, 0,
                sizeof(ExternalInputs_ALLOCATION));

  /* external outputs */
  ALLOCATION_M->ModelData.outputs = (&ALLOCATION_Y);
  (void) memset(&ALLOCATION_Y.w[0], 0,
                6U*sizeof(real32_T));

  /* Initialize Sizes */
  ALLOCATION_M->Sizes.numContStates = (0);/* Number of continuous states */
  ALLOCATION_M->Sizes.numY = (6);      /* Number of model outputs */
  ALLOCATION_M->Sizes.numU = (34);     /* Number of model inputs */
  ALLOCATION_M->Sizes.sysDirFeedThru = (1);/* The model is direct feedthrough */
  ALLOCATION_M->Sizes.numSampTimes = (1);/* Number of sample times */
  ALLOCATION_M->Sizes.numBlocks = (71);/* Number of blocks */
  ALLOCATION_M->Sizes.numBlockIO = (0);/* Number of block outputs */
  return ALLOCATION_M;
}
예제 #25
0
/* Model initialize function */
void Koordinatentransfer3_initialize(void)
{
  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));

  /* initialize real-time model */
  (void) memset((void *)Koordinatentransfer3_M, 0,
                sizeof(RT_MODEL_Koordinatentransfer3_T));
  rtmSetTFinal(Koordinatentransfer3_M, 0.1);
  Koordinatentransfer3_M->Timing.stepSize0 = 0.02;

  /* Setup for data logging */
  {
    static RTWLogInfo rt_DataLoggingInfo;
    Koordinatentransfer3_M->rtwLogInfo = &rt_DataLoggingInfo;
  }

  /* Setup for data logging */
  {
    rtliSetLogXSignalInfo(Koordinatentransfer3_M->rtwLogInfo, (NULL));
    rtliSetLogXSignalPtrs(Koordinatentransfer3_M->rtwLogInfo, (NULL));
    rtliSetLogT(Koordinatentransfer3_M->rtwLogInfo, "tout");
    rtliSetLogX(Koordinatentransfer3_M->rtwLogInfo, "");
    rtliSetLogXFinal(Koordinatentransfer3_M->rtwLogInfo, "");
    rtliSetLogVarNameModifier(Koordinatentransfer3_M->rtwLogInfo, "rt_");
    rtliSetLogFormat(Koordinatentransfer3_M->rtwLogInfo, 0);
    rtliSetLogMaxRows(Koordinatentransfer3_M->rtwLogInfo, 1000);
    rtliSetLogDecimation(Koordinatentransfer3_M->rtwLogInfo, 1);

    /*
     * Set pointers to the data and signal info for each output
     */
    {
      static void * rt_LoggedOutputSignalPtrs[] = {
        &Koordinatentransfer3_Y.a,
        &Koordinatentransfer3_Y.b,
        &Koordinatentransfer3_Y.c
      };

      rtliSetLogYSignalPtrs(Koordinatentransfer3_M->rtwLogInfo,
                            ((LogSignalPtrsType)rt_LoggedOutputSignalPtrs));
    }

    {
      static int_T rt_LoggedOutputWidths[] = {
        1,
        1,
        1
      };

      static int_T rt_LoggedOutputNumDimensions[] = {
        1,
        1,
        1
      };

      static int_T rt_LoggedOutputDimensions[] = {
        1,
        1,
        1
      };

      static boolean_T rt_LoggedOutputIsVarDims[] = {
        0,
        0,
        0
      };

      static void* rt_LoggedCurrentSignalDimensions[] = {
        (NULL),
        (NULL),
        (NULL)
      };

      static int_T rt_LoggedCurrentSignalDimensionsSize[] = {
        2,
        2,
        2
      };

      static BuiltInDTypeId rt_LoggedOutputDataTypeIds[] = {
        SS_DOUBLE,
        SS_DOUBLE,
        SS_DOUBLE
      };

      static int_T rt_LoggedOutputComplexSignals[] = {
        0,
        0,
        0
      };

      static const char_T *rt_LoggedOutputLabels[] = {
        "",
        "",
        "" };

      static const char_T *rt_LoggedOutputBlockNames[] = {
        "Koordinatentransfer3/a",
        "Koordinatentransfer3/b",
        "Koordinatentransfer3/c" };

      static RTWLogDataTypeConvert rt_RTWLogDataTypeConvert[] = {
        { 0, SS_DOUBLE, SS_DOUBLE, 0, 0, 0, 1.0, 0, 0.0 },

        { 0, SS_DOUBLE, SS_DOUBLE, 0, 0, 0, 1.0, 0, 0.0 },

        { 0, SS_DOUBLE, SS_DOUBLE, 0, 0, 0, 1.0, 0, 0.0 }
      };

      static RTWLogSignalInfo rt_LoggedOutputSignalInfo[] = {
        {
          3,
          rt_LoggedOutputWidths,
          rt_LoggedOutputNumDimensions,
          rt_LoggedOutputDimensions,
          rt_LoggedOutputIsVarDims,
          rt_LoggedCurrentSignalDimensions,
          rt_LoggedCurrentSignalDimensionsSize,
          rt_LoggedOutputDataTypeIds,
          rt_LoggedOutputComplexSignals,
          (NULL),

          { rt_LoggedOutputLabels },
          (NULL),
          (NULL),
          (NULL),

          { rt_LoggedOutputBlockNames },

          { (NULL) },
          (NULL),
          rt_RTWLogDataTypeConvert
        }
      };

      rtliSetLogYSignalInfo(Koordinatentransfer3_M->rtwLogInfo,
                            rt_LoggedOutputSignalInfo);

      /* set currSigDims field */
      rt_LoggedCurrentSignalDimensions[0] = &rt_LoggedOutputWidths[0];
      rt_LoggedCurrentSignalDimensions[1] = &rt_LoggedOutputWidths[1];
      rt_LoggedCurrentSignalDimensions[2] = &rt_LoggedOutputWidths[2];
    }

    rtliSetLogY(Koordinatentransfer3_M->rtwLogInfo, "yout");
  }

  /* external inputs */
  (void) memset((void *)&Koordinatentransfer3_U, 0,
                sizeof(ExtU_Koordinatentransfer3_T));

  /* external outputs */
  (void) memset((void *)&Koordinatentransfer3_Y, 0,
                sizeof(ExtY_Koordinatentransfer3_T));

  /* Matfile logging */
  rt_StartDataLoggingWithStartTime(Koordinatentransfer3_M->rtwLogInfo, 0.0,
    rtmGetTFinal(Koordinatentransfer3_M),
    Koordinatentransfer3_M->Timing.stepSize0, (&rtmGetErrorStatus
    (Koordinatentransfer3_M)));
}
예제 #26
0
/* Registration function */
RT_MODEL_DI_model_T *DI_model(void)
{
  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));

  /* initialize real-time model */
  (void) memset((void *)DI_model_M, 0,
                sizeof(RT_MODEL_DI_model_T));

  {
    /* Setup solver object */
    rtsiSetSimTimeStepPtr(&DI_model_M->solverInfo,
                          &DI_model_M->Timing.simTimeStep);
    rtsiSetTPtr(&DI_model_M->solverInfo, &rtmGetTPtr(DI_model_M));
    rtsiSetStepSizePtr(&DI_model_M->solverInfo, &DI_model_M->Timing.stepSize0);
    rtsiSetErrorStatusPtr(&DI_model_M->solverInfo, (&rtmGetErrorStatus
      (DI_model_M)));
    rtsiSetRTModelPtr(&DI_model_M->solverInfo, DI_model_M);
  }

  rtsiSetSimTimeStep(&DI_model_M->solverInfo, MAJOR_TIME_STEP);
  rtsiSetSolverName(&DI_model_M->solverInfo,"FixedStepDiscrete");
  DI_model_M->solverInfoPtr = (&DI_model_M->solverInfo);

  /* Initialize timing info */
  {
    int_T *mdlTsMap = DI_model_M->Timing.sampleTimeTaskIDArray;
    mdlTsMap[0] = 0;
    mdlTsMap[1] = 1;
    DI_model_M->Timing.sampleTimeTaskIDPtr = (&mdlTsMap[0]);
    DI_model_M->Timing.sampleTimes = (&DI_model_M->Timing.sampleTimesArray[0]);
    DI_model_M->Timing.offsetTimes = (&DI_model_M->Timing.offsetTimesArray[0]);

    /* task periods */
    DI_model_M->Timing.sampleTimes[0] = (0.0);
    DI_model_M->Timing.sampleTimes[1] = (0.01);

    /* task offsets */
    DI_model_M->Timing.offsetTimes[0] = (0.0);
    DI_model_M->Timing.offsetTimes[1] = (0.0);
  }

  rtmSetTPtr(DI_model_M, &DI_model_M->Timing.tArray[0]);

  {
    int_T *mdlSampleHits = DI_model_M->Timing.sampleHitArray;
    mdlSampleHits[0] = 1;
    mdlSampleHits[1] = 1;
    DI_model_M->Timing.sampleHits = (&mdlSampleHits[0]);
  }

  rtmSetTFinal(DI_model_M, 30.0);
  DI_model_M->Timing.stepSize0 = 0.01;
  DI_model_M->Timing.stepSize1 = 0.01;

  /* External mode info */
  DI_model_M->Sizes.checksums[0] = (943881189U);
  DI_model_M->Sizes.checksums[1] = (2376373844U);
  DI_model_M->Sizes.checksums[2] = (1356612486U);
  DI_model_M->Sizes.checksums[3] = (687118842U);

  {
    static const sysRanDType rtAlwaysEnabled = SUBSYS_RAN_BC_ENABLE;
    static RTWExtModeInfo rt_ExtModeInfo;
    static const sysRanDType *systemRan[1];
    DI_model_M->extModeInfo = (&rt_ExtModeInfo);
    rteiSetSubSystemActiveVectorAddresses(&rt_ExtModeInfo, systemRan);
    systemRan[0] = &rtAlwaysEnabled;
    rteiSetModelMappingInfoPtr(DI_model_M->extModeInfo,
      &DI_model_M->SpecialInfo.mappingInfo);
    rteiSetChecksumsPtr(DI_model_M->extModeInfo, DI_model_M->Sizes.checksums);
    rteiSetTPtr(DI_model_M->extModeInfo, rtmGetTPtr(DI_model_M));
  }

  DI_model_M->solverInfoPtr = (&DI_model_M->solverInfo);
  DI_model_M->Timing.stepSize = (0.01);
  rtsiSetFixedStepSize(&DI_model_M->solverInfo, 0.01);
  rtsiSetSolverMode(&DI_model_M->solverInfo, SOLVER_MODE_SINGLETASKING);

  /* data type transition information */
  {
    static DataTypeTransInfo dtInfo;
    (void) memset((char_T *) &dtInfo, 0,
                  sizeof(dtInfo));
    DI_model_M->SpecialInfo.mappingInfo = (&dtInfo);
    dtInfo.numDataTypes = 14;
    dtInfo.dataTypeSizes = &rtDataTypeSizes[0];
    dtInfo.dataTypeNames = &rtDataTypeNames[0];
  }

  /* child S-Function registration */
  {
    RTWSfcnInfo *sfcnInfo = &DI_model_M->NonInlinedSFcns.sfcnInfo;
    DI_model_M->sfcnInfo = (sfcnInfo);
    rtssSetErrorStatusPtr(sfcnInfo, (&rtmGetErrorStatus(DI_model_M)));
    rtssSetNumRootSampTimesPtr(sfcnInfo, &DI_model_M->Sizes.numSampTimes);
    DI_model_M->NonInlinedSFcns.taskTimePtrs[0] = &(rtmGetTPtr(DI_model_M)[0]);
    DI_model_M->NonInlinedSFcns.taskTimePtrs[1] = &(rtmGetTPtr(DI_model_M)[1]);
    rtssSetTPtrPtr(sfcnInfo,DI_model_M->NonInlinedSFcns.taskTimePtrs);
    rtssSetTStartPtr(sfcnInfo, &rtmGetTStart(DI_model_M));
    rtssSetTFinalPtr(sfcnInfo, &rtmGetTFinal(DI_model_M));
    rtssSetTimeOfLastOutputPtr(sfcnInfo, &rtmGetTimeOfLastOutput(DI_model_M));
    rtssSetStepSizePtr(sfcnInfo, &DI_model_M->Timing.stepSize);
    rtssSetStopRequestedPtr(sfcnInfo, &rtmGetStopRequested(DI_model_M));
    rtssSetDerivCacheNeedsResetPtr(sfcnInfo,
      &DI_model_M->ModelData.derivCacheNeedsReset);
    rtssSetZCCacheNeedsResetPtr(sfcnInfo,
      &DI_model_M->ModelData.zCCacheNeedsReset);
    rtssSetBlkStateChangePtr(sfcnInfo, &DI_model_M->ModelData.blkStateChange);
    rtssSetSampleHitsPtr(sfcnInfo, &DI_model_M->Timing.sampleHits);
    rtssSetPerTaskSampleHitsPtr(sfcnInfo, &DI_model_M->Timing.perTaskSampleHits);
    rtssSetSimModePtr(sfcnInfo, &DI_model_M->simMode);
    rtssSetSolverInfoPtr(sfcnInfo, &DI_model_M->solverInfoPtr);
  }

  DI_model_M->Sizes.numSFcns = (1);

  /* register each child */
  {
    (void) memset((void *)&DI_model_M->NonInlinedSFcns.childSFunctions[0], 0,
                  1*sizeof(SimStruct));
    DI_model_M->childSfunctions =
      (&DI_model_M->NonInlinedSFcns.childSFunctionPtrs[0]);
    DI_model_M->childSfunctions[0] =
      (&DI_model_M->NonInlinedSFcns.childSFunctions[0]);

    /* Level2 S-Function Block: DI_model/<Root>/S-Function (DI_v1) */
    {
      SimStruct *rts = DI_model_M->childSfunctions[0];

      /* timing info */
      time_T *sfcnPeriod = DI_model_M->NonInlinedSFcns.Sfcn0.sfcnPeriod;
      time_T *sfcnOffset = DI_model_M->NonInlinedSFcns.Sfcn0.sfcnOffset;
      int_T *sfcnTsMap = DI_model_M->NonInlinedSFcns.Sfcn0.sfcnTsMap;
      (void) memset((void*)sfcnPeriod, 0,
                    sizeof(time_T)*1);
      (void) memset((void*)sfcnOffset, 0,
                    sizeof(time_T)*1);
      ssSetSampleTimePtr(rts, &sfcnPeriod[0]);
      ssSetOffsetTimePtr(rts, &sfcnOffset[0]);
      ssSetSampleTimeTaskIDPtr(rts, sfcnTsMap);

      /* Set up the mdlInfo pointer */
      {
        ssSetBlkInfo2Ptr(rts, &DI_model_M->NonInlinedSFcns.blkInfo2[0]);
      }

      ssSetRTWSfcnInfo(rts, DI_model_M->sfcnInfo);

      /* Allocate memory of model methods 2 */
      {
        ssSetModelMethods2(rts, &DI_model_M->NonInlinedSFcns.methods2[0]);
      }

      /* Allocate memory of model methods 3 */
      {
        ssSetModelMethods3(rts, &DI_model_M->NonInlinedSFcns.methods3[0]);
      }

      /* Allocate memory for states auxilliary information */
      {
        ssSetStatesInfo2(rts, &DI_model_M->NonInlinedSFcns.statesInfo2[0]);
      }

      /* inputs */
      {
        _ssSetNumInputPorts(rts, 1);
        ssSetPortInfoForInputs(rts,
          &DI_model_M->NonInlinedSFcns.Sfcn0.inputPortInfo[0]);

        /* port 0 */
        {
          ssSetInputPortRequiredContiguous(rts, 0, 1);
          ssSetInputPortSignal(rts, 0, (real_T*)&DI_model_RGND);
          _ssSetInputPortNumDimensions(rts, 0, 1);
          ssSetInputPortWidth(rts, 0, 1);
        }
      }

      /* path info */
      ssSetModelName(rts, "S-Function");
      ssSetPath(rts, "DI_model/S-Function");
      ssSetRTModel(rts,DI_model_M);
      ssSetParentSS(rts, (NULL));
      ssSetRootSS(rts, rts);
      ssSetVersion(rts, SIMSTRUCT_VERSION_LEVEL2);

      /* registration */
      DI_v1(rts);
      sfcnInitializeSizes(rts);
      sfcnInitializeSampleTimes(rts);

      /* adjust sample time */
      ssSetSampleTime(rts, 0, 0.0);
      ssSetOffsetTime(rts, 0, 0.0);
      sfcnTsMap[0] = 0;

      /* set compiled values of dynamic vector attributes */
      ssSetNumNonsampledZCs(rts, 0);

      /* Update connectivity flags for each port */
      _ssSetInputPortConnected(rts, 0, 0);

      /* Update the BufferDstPort flags for each input port */
      ssSetInputPortBufferDstPort(rts, 0, -1);
    }
  }

  /* Initialize Sizes */
  DI_model_M->Sizes.numContStates = (0);/* Number of continuous states */
  DI_model_M->Sizes.numY = (0);        /* Number of model outputs */
  DI_model_M->Sizes.numU = (0);        /* Number of model inputs */
  DI_model_M->Sizes.sysDirFeedThru = (0);/* The model is not direct feedthrough */
  DI_model_M->Sizes.numSampTimes = (2);/* Number of sample times */
  DI_model_M->Sizes.numBlocks = (1);   /* Number of blocks */
  return DI_model_M;
}
/* Function Definitions */
void simulate_initialize(void)
{
  rt_InitInfAndNaN(8U);
  omp_init_nest_lock(&emlrtNestLockGlobal);
}
/* Function Definitions */
void findBoxspeed_initialize(void)
{
  rt_InitInfAndNaN(8U);
}
예제 #29
0
/*
 * Arguments    : void
 * Return Type  : void
 */
void ff_Fra_initialize(void)
{
  rt_InitInfAndNaN(8U);
}
예제 #30
0
/* Registration function */
RT_MODEL_motor_io_position_T *motor_io_position(void)
{
  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));

  /* initialize real-time model */
  (void) memset((void *)motor_io_position_M, 0,
                sizeof(RT_MODEL_motor_io_position_T));

  {
    /* Setup solver object */
    rtsiSetSimTimeStepPtr(&motor_io_position_M->solverInfo,
                          &motor_io_position_M->Timing.simTimeStep);
    rtsiSetTPtr(&motor_io_position_M->solverInfo, &rtmGetTPtr
                (motor_io_position_M));
    rtsiSetStepSizePtr(&motor_io_position_M->solverInfo,
                       &motor_io_position_M->Timing.stepSize0);
    rtsiSetdXPtr(&motor_io_position_M->solverInfo,
                 &motor_io_position_M->ModelData.derivs);
    rtsiSetContStatesPtr(&motor_io_position_M->solverInfo, (real_T **)
                         &motor_io_position_M->ModelData.contStates);
    rtsiSetNumContStatesPtr(&motor_io_position_M->solverInfo,
      &motor_io_position_M->Sizes.numContStates);
    rtsiSetErrorStatusPtr(&motor_io_position_M->solverInfo, (&rtmGetErrorStatus
      (motor_io_position_M)));
    rtsiSetRTModelPtr(&motor_io_position_M->solverInfo, motor_io_position_M);
  }

  rtsiSetSimTimeStep(&motor_io_position_M->solverInfo, MAJOR_TIME_STEP);
  motor_io_position_M->ModelData.intgData.f[0] =
    motor_io_position_M->ModelData.odeF[0];
  motor_io_position_M->ModelData.contStates = ((real_T *) &motor_io_position_X);
  rtsiSetSolverData(&motor_io_position_M->solverInfo, (void *)
                    &motor_io_position_M->ModelData.intgData);
  rtsiSetSolverName(&motor_io_position_M->solverInfo,"ode1");

  /* Initialize timing info */
  {
    int_T *mdlTsMap = motor_io_position_M->Timing.sampleTimeTaskIDArray;
    mdlTsMap[0] = 0;
    mdlTsMap[1] = 1;
    motor_io_position_M->Timing.sampleTimeTaskIDPtr = (&mdlTsMap[0]);
    motor_io_position_M->Timing.sampleTimes =
      (&motor_io_position_M->Timing.sampleTimesArray[0]);
    motor_io_position_M->Timing.offsetTimes =
      (&motor_io_position_M->Timing.offsetTimesArray[0]);

    /* task periods */
    motor_io_position_M->Timing.sampleTimes[0] = (0.0);
    motor_io_position_M->Timing.sampleTimes[1] = (0.03642463102798723);

    /* task offsets */
    motor_io_position_M->Timing.offsetTimes[0] = (0.0);
    motor_io_position_M->Timing.offsetTimes[1] = (0.0);
  }

  rtmSetTPtr(motor_io_position_M, &motor_io_position_M->Timing.tArray[0]);

  {
    int_T *mdlSampleHits = motor_io_position_M->Timing.sampleHitArray;
    mdlSampleHits[0] = 1;
    mdlSampleHits[1] = 1;
    motor_io_position_M->Timing.sampleHits = (&mdlSampleHits[0]);
  }

  rtmSetTFinal(motor_io_position_M, -1);
  motor_io_position_M->Timing.stepSize0 = 0.03642463102798723;
  motor_io_position_M->Timing.stepSize1 = 0.03642463102798723;
  motor_io_position_M->solverInfoPtr = (&motor_io_position_M->solverInfo);
  motor_io_position_M->Timing.stepSize = (0.03642463102798723);
  rtsiSetFixedStepSize(&motor_io_position_M->solverInfo, 0.03642463102798723);
  rtsiSetSolverMode(&motor_io_position_M->solverInfo, SOLVER_MODE_SINGLETASKING);

  /* block I/O */
  motor_io_position_M->ModelData.blockIO = ((void *) &motor_io_position_B);
  (void) memset(((void *) &motor_io_position_B), 0,
                sizeof(B_motor_io_position_T));

  {
    motor_io_position_B.SFunction1 = 0.0;
    motor_io_position_B.fi1_scaling = 0.0;
    motor_io_position_B.Gfbreal = 0.0;
    motor_io_position_B.SinGenerator = 0.0;
    motor_io_position_B.SquareGenerator = 0.0;
    motor_io_position_B.ref = 0.0;
    motor_io_position_B.Gffreal = 0.0;
    motor_io_position_B.Sum = 0.0;
    motor_io_position_B.Gain = 0.0;
    motor_io_position_B.Volt = 0.0;
    motor_io_position_B.pwm_skalning = 0.0;
    motor_io_position_B.Sum_f = 0.0;
    motor_io_position_B.Gff = 0.0;
    motor_io_position_B.Integrator1 = 0.0;
    motor_io_position_B.Quantizer = 0.0;
    motor_io_position_B.ZeroOrderHold = 0.0;
    motor_io_position_B.Gfb = 0.0;
    motor_io_position_B.Sum1 = 0.0;
    motor_io_position_B.Saturation = 0.0;
    motor_io_position_B.Integrator = 0.0;
    motor_io_position_B.Gain1 = 0.0;
    motor_io_position_B.Add = 0.0;
    motor_io_position_B.kR = 0.0;
    motor_io_position_B.Stickslipregion = 0.0;
    motor_io_position_B.Abs = 0.0;
    motor_io_position_B.Vicousfriction = 0.0;
    motor_io_position_B.Sign = 0.0;
    motor_io_position_B.Product = 0.0;
    motor_io_position_B.Viscousregion = 0.0;
    motor_io_position_B.Friction = 0.0;
    motor_io_position_B.Add1 = 0.0;
    motor_io_position_B.Gain2 = 0.0;
    motor_io_position_B.Add2 = 0.0;
    motor_io_position_B.Inertias1J = 0.0;
    motor_io_position_B.Switch1 = 0.0;
    motor_io_position_B.SFunction2 = 0.0;
    motor_io_position_B.w1_scaling = 0.0;
  }

  /* parameters */
  motor_io_position_M->ModelData.defaultParam = ((real_T *)&motor_io_position_P);

  /* states (continuous) */
  {
    real_T *x = (real_T *) &motor_io_position_X;
    motor_io_position_M->ModelData.contStates = (x);
    (void) memset((void *)&motor_io_position_X, 0,
                  sizeof(X_motor_io_position_T));
  }

  /* states (dwork) */
  motor_io_position_M->ModelData.dwork = ((void *) &motor_io_position_DW);
  (void) memset((void *)&motor_io_position_DW, 0,
                sizeof(DW_motor_io_position_T));
  motor_io_position_DW.Gfbreal_states[0] = 0.0;
  motor_io_position_DW.Gfbreal_states[1] = 0.0;
  motor_io_position_DW.Gffreal_states[0] = 0.0;
  motor_io_position_DW.Gffreal_states[1] = 0.0;
  motor_io_position_DW.Gff_states[0] = 0.0;
  motor_io_position_DW.Gff_states[1] = 0.0;
  motor_io_position_DW.Gfb_states[0] = 0.0;
  motor_io_position_DW.Gfb_states[1] = 0.0;
  motor_io_position_DW.Gfbreal_tmp = 0.0;
  motor_io_position_DW.Gffreal_tmp = 0.0;
  motor_io_position_DW.Gff_tmp = 0.0;
  motor_io_position_DW.Gfb_tmp = 0.0;

  {
    /* user code (registration function declaration) */
    /*Call the macro that initializes the global TRC pointers
       inside the model initialization/registration function. */
    RTI_INIT_TRC_POINTERS();
  }

  /* Initialize Sizes */
  motor_io_position_M->Sizes.numContStates = (2);/* Number of continuous states */
  motor_io_position_M->Sizes.numY = (0);/* Number of model outputs */
  motor_io_position_M->Sizes.numU = (0);/* Number of model inputs */
  motor_io_position_M->Sizes.sysDirFeedThru = (0);/* The model is not direct feedthrough */
  motor_io_position_M->Sizes.numSampTimes = (2);/* Number of sample times */
  motor_io_position_M->Sizes.numBlocks = (58);/* Number of blocks */
  motor_io_position_M->Sizes.numBlockIO = (39);/* Number of block outputs */
  motor_io_position_M->Sizes.numBlockPrms = (58);/* Sum of parameter "widths" */
  return motor_io_position_M;
}