Detect Zero Crossing Function

Simulation VI and Function

Detect Zero Crossing Function

Owning Palette: Nonlinear Systems Functions

Installed With: Control Design and Simulation Module

Detects a zero crossing according to the trigger type you specify. A zero crossing occurs when the input signal you specify crosses the x-axis.

This function detects a zero crossing for both fixed and variable step-size ordinary differential equation (ODE) solvers. For variable step-size solvers, this function also forces the ODE solver to evaluate the simulation and update the simulation output when the signal crosses zero. If this function detects a zero crossing in the direction the trigger type parameter specifies, this function resets the ODE solver.

Details  Example

Dialog Box Options
Block Diagram Inputs
Block Diagram Outputs
 Place on the block diagram  Find on the Functions palette

Dialog Box Options

ParameterDescription
Polymorphic instanceSpecifies whether this function is Scalar or Vector. The default value is Scalar.
ParametersLists all the parameters associated with this function. Select a parameter from this list to configure the parameter. When you select a parameter, the parameter and its associated Parameter source control appear in the Parameter Information section of the configuration dialog box.
PreviewDisplays a graphical preview, if available, of the function output or configuration.
Parameter InformationContains the parameters you can configure for this function. You must select a parameter from the Parameters list to make that parameter and its associated Parameter source control visible in the Parameter Information section of the configuration dialog box.
Parameter sourceSpecifies whether you configure this parameter using the Configuration Dialog Box or a Terminal on the simulation diagram. The default value is Configuration Dialog Box. If you select Terminal, LabVIEW displays an input for that parameter on the simulation diagram, and you can wire values to that input to configure this function programmatically. If you select Configuration Dialog Box, LabVIEW removes that input from the simulation diagram. You then must set the value for this parameter inside the configuration dialog box.
trigger typeSpecifies when this function resets the ODE solver. You can choose from the following options:
  • rising—The ODE solver resets when the input crosses zero with a positive slope.
  • falling—The ODE solver resets when the input crosses through zero with a negative slope.
  • either—The ODE solver resets when the input crosses zero with either a positive or negative slope.
  • none—(Default) The ODE solver does not reset.
offsetSpecifies the value around which this function detects a crossing. This function detects a crossing if the following equation is true:

sgn(u(t–1)–offset(t)) ≠ sgn(u(t)–offset(t))

Block Diagram Inputs

ParameterDescription
trigger typeSpecifies when this function resets the ODE solver. You can choose from the following options:
  • rising—The ODE solver resets when the input crosses zero with a positive slope.
  • falling—The ODE solver resets when the input crosses through zero with a negative slope.
  • either—The ODE solver resets when the input crosses zero with either a positive or negative slope.
  • none—(Default) The ODE solver does not reset.
inputSpecifies the signal to which you want to apply the function.
offsetSpecifies the value around which this function detects a crossing. This function detects a crossing if the following equation is true:

sgn(u(t–1)–offset(t)) ≠ sgn(u(t)–offset(t))

Block Diagram Outputs

ParameterDescription
crossed?Returns TRUE if the input signal crossed zero in the direction that the trigger type parameter specifies, depending on the type of ODE solver. For fixed step-size ODE solvers, crossed? returns TRUE if the input signal crossed zero during the last time step. For variable step-size ODE solvers, crossed? returns TRUE when the input signal reaches zero. crossed? returns FALSE in all other situations.

If crossed? is TRUE, the ODE solver resets.

Detect Zero Crossing Details

Feedthrough Behavior

All input/output pairs of this function have direct feedthrough behavior.

Example

Refer to the SimEx detect zero crossing VI in the labview\examples\Control and Simulation\Simulation\Nonlinear directory for an example of using the Detect Zero Crossing VI.

 Open example  Browse related examples