Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Callback API (ESI Category)

LabVIEW 2012 Control Design and Simulation Module Help

Edition Date: June 2012

Part Number: 371894G-01

»View Product Info

Requires: Control Design and Simulation Module

Use members of the Callback API category to transfer information about the solver between the LabVIEW Control Design and Simulation Module and the external solver. The Control Design and Simulation Module calls these functions to configure and run simulations that use external ODE solvers. The solver must export all of these functions. The SIM_Error.h file in the labview\CCodeGen\Simulation directory defines the errors that the Callback API functions return.

Function Description
EvaluateError Calculates the error of the current step and evaluates whether the error satisfies the relative tolerance and absolute tolerance values for the simulation.
Finalize Performs any tasks you want to complete after the simulation finishes. For example, during the execution of this function, you can release any memory you allocated during the Initialize function.
Information Defines the name for the external solver. When called, the Information function returns the name of the external ODE solver and determines whether the solver has a fixed or variable step size. The solver name can be no greater than SIM_MAX_SOLVER_NAME_LENGTH characters in length. SIM_MAX_SOLVER_NAME_LENGTH is defined in the SIM_Solver.h file located in the labview\CCodeGen\Simulation directory. The solver name appears in the ODE Solver pull-down menu in the Configure Simulation Parameters dialog box.
InterpolateStates Locates zero crossings by interpolating the state values between the beginning and end of the latest step.
Initialize Performs any tasks you want to complete before the simulation begins. For example, during this function you can allocate any memory the solver requires and store a pointer to the memory using the SIM_SolverSetData function. You can retrieve the pointer during the execution of other functions using the SIM_SolverGetData function. LabVIEW calls the Initialize function once per simulation and before calling all other functions except the Information function.
MethodOrder Returns the current order of the ODE solver.
Restart Restarts the ODE solver immediately after a discontinuity occurs in a continuous signal. Use this function for multi-step solvers that require an update to stored information after a discontinuity.
UpdateStates Returns the state and time values to use at the next evaluation of the derivatives of the ordinary differential equation (ODE). Call the SetIsMajorStep function within the UpdateStates function to specify whether the evaluation is at a major or minor step.


 Was this document helpful?  submit
  Helpful Not Helpful