EMI_ResetContinuousState (EMI Function)
- Updated2023-03-14
- 1 minute(s) read
EMI_ResetContinuousState (EMI Function)
Owning Class: Continuous States
Requires: Control Design and Simulation Module
Prototype
void EMI_ResetContinuousState(emiRef model, unsigned int index, double value);
Description
Resets a continuous state of an external model. You can use the EMI_GetInitialContinuousStates within the EMI_CB_InitializeModel function to initialize the continuous states before simulating the model. During the simulation, do not modify the continuous states directly. Instead, use the EMI_ResetContinuousState function within the EMI_CB_CalculateResetStates function to reset the values of the continuous states.
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. |
| index | Specifies the index of the continuous state you want to reset. |
| value | Specifies the value to which you want to reset the continuous state corresponding to the index you specify. |
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);
}
}