EMI_RejectStep (EMI Function)
- Updated2023-03-14
- 1 minute(s) read
EMI_RejectStep (EMI Function)
Owning Class: Zero Crossings
Requires: Control Design and Simulation Module
Prototype
void EMI_RejectStep(emiRef model, double newStepsize);
Description
Rejects the current time step, if possible, and proposes a new step size. A variable step-size ordinary differential equation (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. You can call this function only within the EMI_CB_CheckStepAcceptance function.
Use the EMI_CanRejectStep function to check whether the ODE solver can reject the current time step.
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. |
| newStepsize | Proposes a new step size to use if this function rejects the current time step. |
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_CB_CheckStepAcceptance
EMI_RequestCallbackToResetStates