static void mdlStart_c2_DYNctl_ver4_etud_nonlineaire(SimStruct *S)
{
  SFc2_DYNctl_ver4_etud_nonlineaireInstanceStruct *chartInstance;
  ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)utMalloc(sizeof
    (ChartRunTimeInfo));
  chartInstance = (SFc2_DYNctl_ver4_etud_nonlineaireInstanceStruct *)utMalloc
    (sizeof(SFc2_DYNctl_ver4_etud_nonlineaireInstanceStruct));
  memset(chartInstance, 0, sizeof
         (SFc2_DYNctl_ver4_etud_nonlineaireInstanceStruct));
  if (chartInstance==NULL) {
    sf_mex_error_message("Could not allocate memory for chart instance.");
  }

  chartInstance->chartInfo.chartInstance = chartInstance;
  chartInstance->chartInfo.isEMLChart = 1;
  chartInstance->chartInfo.chartInitialized = 0;
  chartInstance->chartInfo.sFunctionGateway =
    sf_opaque_gateway_c2_DYNctl_ver4_etud_nonlineaire;
  chartInstance->chartInfo.initializeChart =
    sf_opaque_initialize_c2_DYNctl_ver4_etud_nonlineaire;
  chartInstance->chartInfo.terminateChart =
    sf_opaque_terminate_c2_DYNctl_ver4_etud_nonlineaire;
  chartInstance->chartInfo.enableChart =
    sf_opaque_enable_c2_DYNctl_ver4_etud_nonlineaire;
  chartInstance->chartInfo.disableChart =
    sf_opaque_disable_c2_DYNctl_ver4_etud_nonlineaire;
  chartInstance->chartInfo.getSimState =
    sf_opaque_get_sim_state_c2_DYNctl_ver4_etud_nonlineaire;
  chartInstance->chartInfo.setSimState =
    sf_opaque_set_sim_state_c2_DYNctl_ver4_etud_nonlineaire;
  chartInstance->chartInfo.getSimStateInfo =
    sf_get_sim_state_info_c2_DYNctl_ver4_etud_nonlineaire;
  chartInstance->chartInfo.zeroCrossings = NULL;
  chartInstance->chartInfo.outputs = NULL;
  chartInstance->chartInfo.derivatives = NULL;
  chartInstance->chartInfo.mdlRTW = mdlRTW_c2_DYNctl_ver4_etud_nonlineaire;
  chartInstance->chartInfo.mdlStart = mdlStart_c2_DYNctl_ver4_etud_nonlineaire;
  chartInstance->chartInfo.mdlSetWorkWidths =
    mdlSetWorkWidths_c2_DYNctl_ver4_etud_nonlineaire;
  chartInstance->chartInfo.extModeExec = NULL;
  chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
  chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
  chartInstance->chartInfo.storeCurrentConfiguration = NULL;
  chartInstance->chartInfo.callAtomicSubchartUserFcn = NULL;
  chartInstance->chartInfo.callAtomicSubchartAutoFcn = NULL;
  chartInstance->chartInfo.debugInstance = sfGlobalDebugInstanceStruct;
  chartInstance->S = S;
  crtInfo->checksum = SF_RUNTIME_INFO_CHECKSUM;
  crtInfo->instanceInfo = (&(chartInstance->chartInfo));
  crtInfo->isJITEnabled = false;
  crtInfo->compiledInfo = NULL;
  ssSetUserData(S,(void *)(crtInfo));  /* register the chart instance with simstruct */
  init_dsm_address_info(chartInstance);
  init_simulink_io_address(chartInstance);
  if (!sim_mode_is_rtw_gen(S)) {
  }

  sf_opaque_init_subchart_simstructs(chartInstance->chartInfo.chartInstance);
  chart_debug_initialization(S,1);
}
Beispiel #2
0
/** Function: rtwCAPI_UpdateFullPaths =========================================*
 *
 */
const char_T* rtwCAPI_UpdateFullPaths(rtwCAPI_ModelMappingInfo* mmi,
                                      const char_T* path,
                                      boolean_T isCalledFromTopModel)
{
    int_T         i;
    int_T         nCMMI;
    size_t        pathLen;
    char_T*       mmiPath;
    size_t        mmiPathLen;
    char_T*       relMMIPath;
    size_t        relMMIPathLen;

    if (mmi == NULL) return NULL;

    utAssert(path != NULL);
    utAssert( rtwCAPI_GetFullPath(mmi) == NULL );

    pathLen = strlen(path)+1;

    if (isCalledFromTopModel) {
        /* If called from top model - FullPath is same as path */
        mmiPath = (char_T*)utMalloc(pathLen*sizeof(char_T));
        (void)memcpy(mmiPath, path, pathLen*sizeof(char_T));
    }
    else {        
        relMMIPath = rtwCAPI_EncodePath(rtwCAPI_GetPath(mmi));
        if ( (relMMIPath== NULL) && (rtwCAPI_GetPath(mmi) != NULL)) {
            return rtwCAPI_mallocError;
        }
        relMMIPathLen = relMMIPath ? (strlen(relMMIPath) + 1) : 0;
        
        mmiPathLen = pathLen + relMMIPathLen;
        
        mmiPath = (char_T*)utMalloc(mmiPathLen*sizeof(char_T));
        if (mmiPath == NULL) return rtwCAPI_mallocError;
        (void)memcpy(mmiPath, path, pathLen*sizeof(char_T));
        utAssert(mmiPath[pathLen-1] == '\0');
        
        if (relMMIPath) {
            /* mmiPath = path + | + relMMIPath + '\0' */
            mmiPath[pathLen-1] = '|';
            (void)memcpy(&(mmiPath[pathLen]),
                         relMMIPath, relMMIPathLen*sizeof(char_T));
            utAssert(mmiPath[mmiPathLen-1] == '\0');
            utFree(relMMIPath);
        }
    }
    rtwCAPI_SetFullPath(*mmi, mmiPath);

    nCMMI = rtwCAPI_GetChildMMIArrayLen(mmi);
    for (i = 0; i < nCMMI; ++i) {
        rtwCAPI_ModelMappingInfo* cMMI = rtwCAPI_GetChildMMI(mmi,i);
        const char_T* errstr = rtwCAPI_UpdateFullPaths(cMMI, mmiPath, 0);
        if (errstr != NULL) return errstr;
    }
    return NULL;

} /* rtwCAPI_UpdateFullPaths */
static void mdlStart_c13_ARP_02_RPSs_Bdr_GK_BIS5(SimStruct *S)
{
  SFc13_ARP_02_RPSs_Bdr_GK_BIS5InstanceStruct *chartInstance;
  ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)utMalloc(sizeof
    (ChartRunTimeInfo));
  chartInstance = (SFc13_ARP_02_RPSs_Bdr_GK_BIS5InstanceStruct *)utMalloc(sizeof
    (SFc13_ARP_02_RPSs_Bdr_GK_BIS5InstanceStruct));
  memset(chartInstance, 0, sizeof(SFc13_ARP_02_RPSs_Bdr_GK_BIS5InstanceStruct));
  if (chartInstance==NULL) {
    sf_mex_error_message("Could not allocate memory for chart instance.");
  }

  chartInstance->chartInfo.chartInstance = chartInstance;
  chartInstance->chartInfo.isEMLChart = 1;
  chartInstance->chartInfo.chartInitialized = 0;
  chartInstance->chartInfo.sFunctionGateway =
    sf_opaque_gateway_c13_ARP_02_RPSs_Bdr_GK_BIS5;
  chartInstance->chartInfo.initializeChart =
    sf_opaque_initialize_c13_ARP_02_RPSs_Bdr_GK_BIS5;
  chartInstance->chartInfo.terminateChart =
    sf_opaque_terminate_c13_ARP_02_RPSs_Bdr_GK_BIS5;
  chartInstance->chartInfo.enableChart =
    sf_opaque_enable_c13_ARP_02_RPSs_Bdr_GK_BIS5;
  chartInstance->chartInfo.disableChart =
    sf_opaque_disable_c13_ARP_02_RPSs_Bdr_GK_BIS5;
  chartInstance->chartInfo.getSimState =
    sf_opaque_get_sim_state_c13_ARP_02_RPSs_Bdr_GK_BIS5;
  chartInstance->chartInfo.setSimState =
    sf_opaque_set_sim_state_c13_ARP_02_RPSs_Bdr_GK_BIS5;
  chartInstance->chartInfo.getSimStateInfo =
    sf_get_sim_state_info_c13_ARP_02_RPSs_Bdr_GK_BIS5;
  chartInstance->chartInfo.zeroCrossings = NULL;
  chartInstance->chartInfo.outputs = NULL;
  chartInstance->chartInfo.derivatives = NULL;
  chartInstance->chartInfo.mdlRTW = mdlRTW_c13_ARP_02_RPSs_Bdr_GK_BIS5;
  chartInstance->chartInfo.mdlStart = mdlStart_c13_ARP_02_RPSs_Bdr_GK_BIS5;
  chartInstance->chartInfo.mdlSetWorkWidths =
    mdlSetWorkWidths_c13_ARP_02_RPSs_Bdr_GK_BIS5;
  chartInstance->chartInfo.extModeExec = NULL;
  chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
  chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
  chartInstance->chartInfo.storeCurrentConfiguration = NULL;
  chartInstance->chartInfo.debugInstance = sfGlobalDebugInstanceStruct;
  chartInstance->S = S;
  crtInfo->instanceInfo = (&(chartInstance->chartInfo));
  crtInfo->isJITEnabled = false;
  ssSetUserData(S,(void *)(crtInfo));  /* register the chart instance with simstruct */
  init_dsm_address_info(chartInstance);
  if (!sim_mode_is_rtw_gen(S)) {
  }

  sf_opaque_init_subchart_simstructs(chartInstance->chartInfo.chartInstance);
  chart_debug_initialization(S,1);
}
Beispiel #4
0
/** Function: rtwCAPI_EncodePath ===============================================
 *  Abatract:
 *     Escape all '|' characters in bpath. For examples 'aaa|b' will become
 *     'aaa~|b'. The caller is responsible for freeing the returned string
 *
 *
 * NOTE: returned string can be NULL in two cases:
 *     (1) string passed in was NULL
 *     (2) a memory allocation error occurred
 * In the second case, the caller need to report the error
 */
char* rtwCAPI_EncodePath(const char* path)
{
    char* encodedPath     = NULL;
    size_t pathLen        = (path==NULL) ? 0:strlen(path) + 1;
    size_t encodedPathLen = pathLen;
    unsigned i;
    unsigned j = 0;

    if (path == NULL) return NULL;

    for (i = 0; i < pathLen; ++i) {
        if (path[i] == '|' || path[i] == '~') ++encodedPathLen;
    }

    encodedPath = (char_T*)utMalloc(encodedPathLen*sizeof(char_T));
    if (encodedPath == NULL) return encodedPath;

    for (i = 0; i < pathLen; ++i) {
        char ch = path[i];
        if (ch == '~' || ch == '|') encodedPath[j++] = '~';
        encodedPath[j++] = ch;
    }
    utAssert(j == encodedPathLen);
    utAssert(encodedPath[j-1] == '\0');

    return encodedPath;

} /* rtwCAPI_EncodePath */
Beispiel #5
0
/** Function: rtwCAPI_GetFullStateBlockPath ===================================
 *
 */
char* rtwCAPI_GetFullStateBlockPath(const char* stateBlockPath,
                                           const char* mmiPath,
                                           size_t      mmiPathLen,
                                           boolean_T   crossingModel)
{
    char_T* blockPath          = NULL;
    char_T* fullStateBlockPath = NULL;
    size_t     fullStateBlockPathLen;

    if (stateBlockPath == NULL) goto EXIT_POINT;

    /* fullStateBlockPath = mmiPath + | + blockPath + '\0' */
    /* If crossing a model boundary encode, otherwise do not */

    if (crossingModel) {
        blockPath = rtwCAPI_EncodePath(stateBlockPath);
        if (blockPath == NULL) goto EXIT_POINT;
    } else {
        size_t len = strlen(stateBlockPath)+1;
        blockPath = (char*)utMalloc(len*sizeof(char));
        if (blockPath == NULL) goto EXIT_POINT;
        (void)strcpy(blockPath,stateBlockPath);
    }
    utAssert(blockPath != NULL);
    fullStateBlockPathLen = ( (mmiPath==NULL) ?
                              strlen(blockPath) + 1 :
                              mmiPathLen + strlen(blockPath) + 2 );
    fullStateBlockPath    = (char*)utMalloc(fullStateBlockPathLen*sizeof(char));
    if (fullStateBlockPath == NULL) goto EXIT_POINT;

    if (mmiPath != NULL) {
        (void)strcpy(fullStateBlockPath, mmiPath);
        fullStateBlockPath[mmiPathLen]   = '|';
        fullStateBlockPath[mmiPathLen+1] =  '\0';
        (void)strcat(fullStateBlockPath, blockPath);
    } else {
        (void)strcpy(fullStateBlockPath, blockPath);
        fullStateBlockPath[fullStateBlockPathLen-1] =  '\0';
    }
    utAssert(fullStateBlockPath[fullStateBlockPathLen-1] == '\0');

  EXIT_POINT:
    utFree(blockPath);
    return fullStateBlockPath; /* caller is responsible for free */
}
Beispiel #6
0
static void mdlStart_c4_MON_sl_after_replacement3(SimStruct *S)
{
  SFc4_MON_sl_after_replacement3InstanceStruct *chartInstance;
  chartInstance = (SFc4_MON_sl_after_replacement3InstanceStruct *)utMalloc
    (sizeof(SFc4_MON_sl_after_replacement3InstanceStruct));
  if (chartInstance==NULL) {
    sf_mex_error_message("Could not allocate memory for chart instance.");
  }

  memset(chartInstance, 0, sizeof(SFc4_MON_sl_after_replacement3InstanceStruct));
  chartInstance->chartInfo.chartInstance = chartInstance;
  chartInstance->chartInfo.isEMLChart = 0;
  chartInstance->chartInfo.chartInitialized = 0;
  chartInstance->chartInfo.sFunctionGateway =
    sf_opaque_gateway_c4_MON_sl_after_replacement3;
  chartInstance->chartInfo.initializeChart =
    sf_opaque_initialize_c4_MON_sl_after_replacement3;
  chartInstance->chartInfo.terminateChart =
    sf_opaque_terminate_c4_MON_sl_after_replacement3;
  chartInstance->chartInfo.enableChart =
    sf_opaque_enable_c4_MON_sl_after_replacement3;
  chartInstance->chartInfo.disableChart =
    sf_opaque_disable_c4_MON_sl_after_replacement3;
  chartInstance->chartInfo.getSimState =
    sf_opaque_get_sim_state_c4_MON_sl_after_replacement3;
  chartInstance->chartInfo.setSimState =
    sf_opaque_set_sim_state_c4_MON_sl_after_replacement3;
  chartInstance->chartInfo.getSimStateInfo =
    sf_get_sim_state_info_c4_MON_sl_after_replacement3;
  chartInstance->chartInfo.zeroCrossings = NULL;
  chartInstance->chartInfo.outputs = NULL;
  chartInstance->chartInfo.derivatives = NULL;
  chartInstance->chartInfo.mdlRTW = mdlRTW_c4_MON_sl_after_replacement3;
  chartInstance->chartInfo.mdlStart = mdlStart_c4_MON_sl_after_replacement3;
  chartInstance->chartInfo.mdlSetWorkWidths =
    mdlSetWorkWidths_c4_MON_sl_after_replacement3;
  chartInstance->chartInfo.callGetHoverDataForMsg =
    sf_opaque_get_hover_data_for_msg;
  chartInstance->chartInfo.extModeExec = NULL;
  chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
  chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
  chartInstance->chartInfo.storeCurrentConfiguration = NULL;
  chartInstance->chartInfo.callAtomicSubchartUserFcn = NULL;
  chartInstance->chartInfo.callAtomicSubchartAutoFcn = NULL;
  chartInstance->chartInfo.debugInstance = sfGlobalDebugInstanceStruct;
  chartInstance->S = S;
  sf_init_ChartRunTimeInfo(S, &(chartInstance->chartInfo), false, 0);
  init_dsm_address_info(chartInstance);
  init_simulink_io_address(chartInstance);
  if (!sim_mode_is_rtw_gen(S)) {
  }

  chart_debug_initialization(S,1);
  mdl_start_c4_MON_sl_after_replacement3(chartInstance);
}
static void mdlStart_c2_MigrationOWBG_Proto4_1DLinear2DNonLinear(SimStruct *S)
{
  SFc2_MigrationOWBG_Proto4_1DLinear2DNonLinearInstanceStruct *chartInstance;
  chartInstance = (SFc2_MigrationOWBG_Proto4_1DLinear2DNonLinearInstanceStruct *)
    utMalloc(sizeof(SFc2_MigrationOWBG_Proto4_1DLinear2DNonLinearInstanceStruct));
  memset(chartInstance, 0, sizeof
         (SFc2_MigrationOWBG_Proto4_1DLinear2DNonLinearInstanceStruct));
  if (chartInstance==NULL) {
    sf_mex_error_message("Could not allocate memory for chart instance.");
  }

  chartInstance->chartInfo.chartInstance = chartInstance;
  chartInstance->chartInfo.isEMLChart = 1;
  chartInstance->chartInfo.chartInitialized = 0;
  chartInstance->chartInfo.sFunctionGateway =
    sf_opaque_gateway_c2_MigrationOWBG_Proto4_1DLinear2DNonLinear;
  chartInstance->chartInfo.initializeChart =
    sf_opaque_initialize_c2_MigrationOWBG_Proto4_1DLinear2DNonLinear;
  chartInstance->chartInfo.terminateChart =
    sf_opaque_terminate_c2_MigrationOWBG_Proto4_1DLinear2DNonLinear;
  chartInstance->chartInfo.enableChart =
    sf_opaque_enable_c2_MigrationOWBG_Proto4_1DLinear2DNonLinear;
  chartInstance->chartInfo.disableChart =
    sf_opaque_disable_c2_MigrationOWBG_Proto4_1DLinear2DNonLinear;
  chartInstance->chartInfo.getSimState =
    sf_opaque_get_sim_state_c2_MigrationOWBG_Proto4_1DLinear2DNonLinear;
  chartInstance->chartInfo.setSimState =
    sf_opaque_set_sim_state_c2_MigrationOWBG_Proto4_1DLinear2DNonLinear;
  chartInstance->chartInfo.getSimStateInfo =
    sf_get_sim_state_info_c2_MigrationOWBG_Proto4_1DLinear2DNonLinear;
  chartInstance->chartInfo.zeroCrossings = NULL;
  chartInstance->chartInfo.outputs = NULL;
  chartInstance->chartInfo.derivatives = NULL;
  chartInstance->chartInfo.mdlRTW =
    mdlRTW_c2_MigrationOWBG_Proto4_1DLinear2DNonLinear;
  chartInstance->chartInfo.mdlStart =
    mdlStart_c2_MigrationOWBG_Proto4_1DLinear2DNonLinear;
  chartInstance->chartInfo.mdlSetWorkWidths =
    mdlSetWorkWidths_c2_MigrationOWBG_Proto4_1DLinear2DNonLinear;
  chartInstance->chartInfo.extModeExec = NULL;
  chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
  chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
  chartInstance->chartInfo.storeCurrentConfiguration = NULL;
  chartInstance->S = S;
  ssSetUserData(S,(void *)(&(chartInstance->chartInfo)));/* register the chart instance with simstruct */
  init_dsm_address_info(chartInstance);
  if (!sim_mode_is_rtw_gen(S)) {
  }

  sf_opaque_init_subchart_simstructs(chartInstance->chartInfo.chartInstance);
  chart_debug_initialization(S,1);
}
Beispiel #8
0
boolean_T Deadbeat_CUK_acc_rt_TDelayUpdateTailOrGrowBuf ( int_T * bufSzPtr ,
int_T * tailPtr , int_T * headPtr , int_T * lastPtr , real_T tMinusDelay ,
real_T * * tBufPtr , real_T * * uBufPtr , real_T * * xBufPtr , boolean_T
isfixedbuf , boolean_T istransportdelay , int_T * maxNewBufSzPtr ) { int_T
testIdx ; int_T tail = * tailPtr ; int_T bufSz = * bufSzPtr ; real_T * tBuf =
* tBufPtr ; real_T * xBuf = ( NULL ) ; int_T numBuffer = 2 ; if (
istransportdelay ) { numBuffer = 3 ; xBuf = * xBufPtr ; } testIdx = ( tail <
( bufSz - 1 ) ) ? ( tail + 1 ) : 0 ; if ( ( tMinusDelay <= tBuf [ testIdx ] )
&& ! isfixedbuf ) { int_T j ; real_T * tempT ; real_T * tempU ; real_T *
tempX = ( NULL ) ; real_T * uBuf = * uBufPtr ; int_T newBufSz = bufSz + 1024
; if ( newBufSz > * maxNewBufSzPtr ) { * maxNewBufSzPtr = newBufSz ; } tempU
= ( real_T * ) utMalloc ( numBuffer * newBufSz * sizeof ( real_T ) ) ; if (
tempU == ( NULL ) ) { return ( false ) ; } tempT = tempU + newBufSz ; if (
istransportdelay ) tempX = tempT + newBufSz ; for ( j = tail ; j < bufSz ; j
++ ) { tempT [ j - tail ] = tBuf [ j ] ; tempU [ j - tail ] = uBuf [ j ] ; if
( istransportdelay ) tempX [ j - tail ] = xBuf [ j ] ; } for ( j = 0 ; j <
tail ; j ++ ) { tempT [ j + bufSz - tail ] = tBuf [ j ] ; tempU [ j + bufSz -
tail ] = uBuf [ j ] ; if ( istransportdelay ) tempX [ j + bufSz - tail ] =
xBuf [ j ] ; } if ( * lastPtr > tail ) { * lastPtr -= tail ; } else { *
lastPtr += ( bufSz - tail ) ; } * tailPtr = 0 ; * headPtr = bufSz ; utFree (
uBuf ) ; * bufSzPtr = newBufSz ; * tBufPtr = tempT ; * uBufPtr = tempU ; if (
istransportdelay ) * xBufPtr = tempX ; } else { * tailPtr = testIdx ; }
return ( true ) ; } real_T Deadbeat_CUK_acc_rt_TDelayInterpolate ( real_T
Beispiel #9
0
/** Function: rtwCAPI_GetSigLogRecordInfo ======================================
 *
 */
const char_T* rtwCAPI_GetSigLogRecordInfo(const rtwCAPI_ModelMappingInfo* mmi,
                                          const char_T**    sigBlockName,
                                          const char_T**    sigLabel,
                                          int_T*            sigWidth,
                                          int_T*            sigDataType,
                                          int_T*            logDataType,
                                          int_T*            sigComplexity,
                                          void**            sigDataAddr,
                                          boolean_T*        sigCrossMdlRef,
                                          int_T*            sigIdx,
                                          boolean_T         crossingModel,
                                          boolean_T         rtwLogging)
{
    int_T               i;
    int_T               nCMMI;
    int_T               nSignals;
    const char_T*       mmiPath;
    size_t              mmiPathLen;
    const rtwCAPI_Signals*  signals;
    const rtwCAPI_DimensionMap* dimMap;
    const uint_T*       dimArray;
    const rtwCAPI_DataTypeMap*  dataTypeMap;
    void**              dataAddrMap;
    const char_T*       errstr = NULL;
    uint8_T             isPointer = 0;
    char*               blockPath = NULL;

    if (mmi == NULL) goto EXIT_POINT;

    nCMMI = rtwCAPI_GetChildMMIArrayLen(mmi);
    for (i = 0; i < nCMMI; ++i) {
        rtwCAPI_ModelMappingInfo* cMMI = rtwCAPI_GetChildMMI(mmi,i);

        errstr = rtwCAPI_GetSigLogRecordInfo(cMMI,
                                             sigBlockName,
                                             sigLabel,
                                             sigWidth,
                                             sigDataType,
                                             logDataType,
                                             sigComplexity,
                                             sigDataAddr,
                                             sigCrossMdlRef,
                                             sigIdx,
                                             true,
                                             rtwLogging);
        if (errstr != NULL) goto EXIT_POINT;
    }

    nSignals = rtwCAPI_GetNumSignals(mmi);
    if (nSignals < 1) goto EXIT_POINT;

    mmiPath     = rtwCAPI_GetFullPath(mmi);
    mmiPathLen  = (mmiPath==NULL)? 0 : strlen(mmiPath);
    signals     = rtwCAPI_GetSignals(mmi);
    dimMap      = rtwCAPI_GetDimensionMap(mmi);
    dimArray    = rtwCAPI_GetDimensionArray(mmi);
    dataTypeMap = rtwCAPI_GetDataTypeMap(mmi);
    dataAddrMap = rtwCAPI_GetDataAddressMap(mmi);

    for (i = 0; i < nSignals; ++i) {
        uint_T mapIdx;
        size_t sigPathLen;
        char*  sigPath;

        /* For RTW logging, skip states that cannot be logged to MAT-File. */
        if ((rtwLogging) &&
            (rtwCAPI_CanLogSignalToMATFile(dataTypeMap, signals, i) == false)) continue;

        /* sigBlockPath = mmiPath + | + BlockPath + '\0' */
        /* If crossing a model boundary encode, otherwise do not */

        if (crossingModel) {
            blockPath = rtwCAPI_EncodePath(rtwCAPI_GetSignalBlockPath(signals, i));
            if ( (blockPath == NULL) &&
                 (rtwCAPI_GetSignalBlockPath(signals, i) != NULL)) {
                errstr = rtwCAPI_mallocError;
                goto EXIT_POINT;
            }
        } else {
            const char* constBlockPath = rtwCAPI_GetSignalBlockPath(signals, i);
            blockPath = (char*)utMalloc((strlen(constBlockPath)+1)*sizeof(char));
            (void)strcpy(blockPath, constBlockPath);
        }
        utAssert(blockPath != NULL);
        sigPathLen = ( (mmiPath==NULL) ?
                                   strlen(blockPath) + 1 :
                                   mmiPathLen + strlen(blockPath) + 2 );
        sigPath    = (char*)utMalloc(sigPathLen*sizeof(char));
        if (sigPath == NULL) {
            errstr = rtwCAPI_mallocError;
            goto EXIT_POINT;
        }
        if (mmiPath != NULL) {
            (void)strcpy(sigPath, mmiPath);
            sigPath[mmiPathLen]   = '|';
            sigPath[mmiPathLen+1] =  '\0';
            (void)strcat(sigPath, blockPath);
        } else {
            (void)strcpy(sigPath, blockPath);
            sigPath[sigPathLen-1] =  '\0';
        }
       /* need to free for every iteration of the loop, but also have
        * the free below EXIT_POINT in case of error */
        utFree(blockPath);
        blockPath = NULL;
        utAssert(sigPath[sigPathLen-1] == '\0');
        sigBlockName[*sigIdx] = sigPath; /* caller is responsible for free */

        /* Label */
        sigLabel[*sigIdx] = rtwCAPI_GetSignalName(signals, i);

        /* Width */
        mapIdx = rtwCAPI_GetSignalDimensionIdx(signals, i);
        utAssert( rtwCAPI_GetNumDims(dimMap,mapIdx) == 2 );
        mapIdx = rtwCAPI_GetDimArrayIndex(dimMap, mapIdx);
        sigWidth[*sigIdx] = dimArray[mapIdx] * dimArray[mapIdx+1];

        /* DataType and logDataType */
        mapIdx = rtwCAPI_GetSignalDataTypeIdx(signals, i);
        sigDataType[*sigIdx] = rtwCAPI_GetDataTypeSLId(dataTypeMap, mapIdx);
        /* this mimics code in simulink.dll:mapSigDataTypeToLogDataType */
        if ( SS_DOUBLE ||
             SS_SINGLE ||
             SS_INT8   ||
             SS_UINT8  ||
             SS_INT16  ||
             SS_UINT16 ||
             SS_INT32  ||
             SS_UINT32 ||
             SS_BOOLEAN ) {
            logDataType[*sigIdx] = sigDataType[*sigIdx];
        } else {
            logDataType[*sigIdx] = SS_DOUBLE;
        }

        /* Complexity */
        sigComplexity[*sigIdx] = rtwCAPI_GetDataIsComplex(dataTypeMap, mapIdx);

        /* Data Access - Pointer or Direct*/
        isPointer = ((uint8_T)rtwCAPI_GetDataIsPointer(dataTypeMap, mapIdx));

        /* Address */
        mapIdx = rtwCAPI_GetSignalAddrIdx(signals, i);

        rtwCAPI_GetSigAddrFromMap(isPointer, sigComplexity, sigDataType,
                                  sigDataAddr, sigIdx, mapIdx, dataAddrMap);

        /* CrossingModelBoundary */
        sigCrossMdlRef[*sigIdx] = crossingModel;

        ++(*sigIdx);
    }

  EXIT_POINT:
    utFree(blockPath);
    return(errstr);

} /* rtwCAPI_GetSigLogRecordInfo */