LabVIEW Control Design and Simulation Module

EMI_CB_CalculateResetStates (EMI Function)

  • Updated2023-03-14
  • 1 minute(s) read

EMI_CB_CalculateResetStates (EMI Function)

Owning Class: Callbacks

Requires: Control Design and Simulation Module

Prototype

void EMI_CB_CalculateResetStates(emiRef model);

Description

Calculates the values to which to reset the states of an external model. You must define and export this function if the model has zero crossings.

Details

Examples

Inputs

Name Description
model Specifies a reference to the external model. Use this reference as an input to other EMI functions. Do not modify model directly.

Details

The LabVIEW Control Design and Simulation Module calls this function after a time step in which a zero crossing occurs. You also can use the EMI_RequestCallbackToResetStates function to specify that the Control Design and Simulation Module calls this function after the current time step even if a zero crossing has not occurred.

Use the EMI_ResetContinuousState function within the EMI_CB_CalculateResetStates function to reset continuous states.

Examples

void EMI_CB_CalculateResetStates(emiRef model) {
   const emiZeroCrossResult* zcr = EMI_GetZeroCrossingResults(model);
   const double* xc = EMI_GetContinuousStates(model);
   if (zcr[0] != EMI_ZCResult_NoCross) {
      /* reset the first continuous state to 0.0 when a zero crossing occurs for the first signal */
      EMI_ResetContinuousState(model, 0, 0.0);
   }
}

Related Topics

EMI_GetZeroCrossingResults
EMI_RequestCallbackToResetStates
EMI_ResetContinuousState

Log in to get a better experience