EMI_CB_CheckStepAcceptance (EMI Function)
- Updated2023-03-14
- 1 minute(s) read
EMI_CB_CheckStepAcceptance (EMI Function)
Owning Class: Callbacks
Requires: Control Design and Simulation Module
Prototype
void EMI_CB_CheckStepAcceptance(emiRef model);
Description
Checks whether the current step is acceptable for the simulation. If a step is considered unacceptable, you can use the EMI_CanRejectStep function to determine whether the ordinary differential equation (ODE) solver can reject the current time step. A variable step-size ODE solver can reject a time step if the current step size is greater than the minimum step size. Fixed step-size ODE solvers cannot reject time steps. If you cannot reject the current time step or if you use a fixed step-size ODE solver, you can use the EMI_RequestCallbackToResetStates function to reset states when a step is unacceptable.
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
You can use this function to implement a custom algorithm for detecting zero crossings.
Examples
/* pseudo code of a custom algorithm for detecting zero crossings */
void EMI_CB_CheckStepAcceptance(emiRef model) {
if (condition_exists_for_rejection) {
if (EMI_CanRejectStep(model)) {
EMI_RejectStep(model, new_step_size);
}
else {
EMI_RequestCallbackToResetStates(model);
}
}
}
Related Topics
EMI_CanRejectStep
EMI_RejectStep
EMI_RequestCallbackToResetStates