Main Content

ssGetElapseTimeCounter

Get the integer value of the elapse time counter associated with the S-function

Since R2023b

Syntax

void ssGetElapseTimeCounter(SimStruct *S, void *elapseTimeCounter)

Arguments

S

SimStruct that represents an S-Function block.

elapseTimeCounter

The location of variable where the integer value of the elapse time counter is to be stored

Description

Use to get the integer value of elapse time counter associated with the S-function. ssGetElapseTimeCounter writes the value of elapse time counter to the location specified by the variable elapseTimeCounter. The data type of the counter value can be obtained using ssGetElapseCounterDtype function. If the counter size is 64 bits, the value is returned as an array of two 32-bit words, with the low-order word stored at the lower address.

Languages

C, C++

Examples

The following code snippet of the mdlOutputs callback for an s-function accesses the value of the elapse time counter according to its data type.

int    y_dtype;
ssGetElapseTimeCounterDtype(S, &y_dtype);

 switch(y_dtype) {
  case SS_DOUBLE_UINT32: 
      {
          uint32_T dataPtr[2];
          ssGetElapseTimeCounter(S, dataPtr);
      } 
      break;
  case SS_UINT32:
      {
         uint32_T dataPtr[1]; 
         ssGetElapseTimeCounter(S, dataPtr);
     }
      break;
  case SS_UINT16:
     {
          uint16_T dataPtr[1]; 
          ssGetElapseTimeCounter(S, dataPtr);
     }
      break;
  case SS_UINT8:
     {
         uint8_T dataPtr[1];
         ssGetElapseTimeCounter(S, dataPtr);
    }
     break;
  case SS_DOUBLE:
      {
         real_T dataPtr[1]; 
         ssGetElapseTimeCounter(S, dataPtr);
     }
      break;
  default:
    ssSetErrorStatus(S, "Invalid data type for elaspe time
        counter");
    break;
}
           
    
    
}

Version History

Introduced in R2023b