InterpolateStates (ESI Function)
- Updated2023-03-14
- 1 minute(s) read
InterpolateStates (ESI Function)
Owning Class: Callback API
Requires: Control Design and Simulation Module
Prototype
SIM_Error InterpolateStates(SIM_Solver *solver, double *theta);
Description
Assists in the location of zero crossings by interpolating the state values between the beginning and end of the latest step that contains one or more zero crossings. You must supply this function for all variable step-size solvers.
After the root finder calls this function, it evaluates the block diagram for the zero-crossing functions that are part of the following Simulation functions: External Model, Integrator, all Nonlinear Systems functions, including: Backlash, Dead Zone, Detect Zero Crossing, Friction, Quantizer, Rate Limiter, Relay, Saturation, and Switch.
Inputs
| Name | Description |
|---|---|
| solver | Specifies a reference to the external ODE solver. Use this reference as an input to other ESI functions. Use the solver directly in the SIM_SolverGetNumContinuousStates ESI function to gain access to the values the InterpolateStates function must modify. If the solver handles implicit systems, InterpolateStates should also use the following functions, located in the SIM_Solver.h header file in the labview\CCodeGen\Simulation directory: SIM_SolverGetNumImplicitVars with the data pointer implicit_variables and SIM_SolverGetNumImplicitStates with the data pointer implicit_states. |
| theta | Specifies the time in the step at which to find zero crossings. If theta is 0, this function sets the states to the value of the states at the beginning of the integration step. If theta is 1, this function sets the states to the value of the states at the end of the integration step. If theta is a value between 0 and 1, this function interpolates the value of the states. |
Return Value
Returns the error condition for this function.