Discrete Observer Function

Simulation VI and Function

Discrete Observer Function

Owning Palette: Discrete Linear Systems Functions

Installed With: Control Design and Simulation Module

Implements a discrete-time observer for a linear state-space system model.

Details  

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 implements a current observer and corrects state estimates made at a previous time step, or whether this function implements a predictive observer and calculates the estimated states for the next time step k + 1. This option also specifies whether the observer checks the model parameters. The default is Current, w/ check. Refer to Chapter 15, Estimating Model States, of the LabVIEW Control Design User Manual for information about using current and predictive observers.
FeedthroughConfigures the function to be either a Direct or Indirect feedthrough function. Enable this control by selecting State-Space Model from the Parameters list and then selecting Terminal from the Parameter source pull-down menu. If you select Configuration Dialog Box from the Parameter source pull-down menu, LabVIEW disables this control and calculates the feedthrough behavior automatically.

You can use the Corrected State Estimate xhat(k|k) to design the Input u(k) only if you specify Indirect feedthrough.

Refer to the Details section for a description of the parameters that determine the feedthrough behavior of this function.
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.
reset?Specifies whether to restart the calculation from any initial values you provide. The default is FALSE.
sample skew (s)Specifies the length of time by which you want to delay the execution of this function. The default value is 0. The value of this parameter must satisfy the following relationship:

0 ≤ sample skew (s)Sampling Time
Initial State Estimate xhat(0|-1)Specifies the initial states from which this function begins estimating the model states. If you do not specify a value for this parameter and you select one of the w/ check instances of this function, Initial State Estimate xhat(0|–1) is a vector of zeros.
Observer GainSpecifies the estimator gain matrix this VI applies to the difference between the observed output and the estimated output, which is Output y(k)Estimated Output yhat(k). You can use the CD Pole Placement VI or the CD Ackermann VI to calculate the Observer Gain.

The Observer Gain for a current observer relates to the Observer Gain for a predictive observer through the following relationship:

Observer Gain (Current) = A–1 · Observer Gain (Predictive), where A is the state matrix of the State-Space Model.
State-Space ModelSpecifies the mathematical representation of and information about the system for which this function implements the observer.
  • Model name—Specifies the name of the state-space model.
  • Sampling Time—Specifies the sampling time of the system model and determines whether the model represents a continuous-time or discrete-time system. If the model represents a continuous-time system, Sampling Time must equal zero. If the model represents a discrete-time system, Sampling Time must be greater than zero and equal to the sampling rate, in seconds, of the discrete system. The default is –1. If you enter a value of –1, this function inherits the discrete time step you specify for the simulation diagram. Otherwise, the value of Sampling Time must be a multiple of the discrete time step you specify for the simulation diagram. This limitation applies only when you place this function inside a Simulation Loop.
  • A—Specifies the n × n state matrix of the given system.
  • B—Specifies the n × m input matrix of the given system.
  • C—Specifies the r × n output matrix of the given system.
  • D—Specifies the r × m direct transmission matrix of the given system.
    wherem is the number of inputs
    n is the number of states
    r is the number of outputs

Block Diagram Inputs

ParameterDescription
reset?Specifies whether to restart the calculation from any initial values you provide. The default is FALSE.
sample skew (s)Specifies the length of time by which you want to delay the execution of this function. The default value is 0. The value of this parameter must satisfy the following relationship:

0 ≤ sample skew (s)Sampling Time
Initial State Estimate xhat(0|-1)Specifies the initial states from which this function begins estimating the model states. If you do not specify a value for this parameter and you select one of the w/ check instances of this function, Initial State Estimate xhat(0|–1) is a vector of zeros.
Observer GainSpecifies the estimator gain matrix this VI applies to the difference between the observed output and the estimated output, which is Output y(k)Estimated Output yhat(k). You can use the CD Pole Placement VI or the CD Ackermann VI to calculate the Observer Gain.

The Observer Gain for a current observer relates to the Observer Gain for a predictive observer through the following relationship:

Observer Gain (Current) = A–1 · Observer Gain (Predictive), where A is the state matrix of the State-Space Model.
State-Space ModelSpecifies the mathematical representation of and information about the system for which this function calculates the estimated states.
Output y(k)Specifies the measurements a sensor makes on the State-Space Model. You also can use the Discrete State-Space function to simulate the behavior of a state-space model.
Input u(k)Specifies the control action this VI applies to the model.

Block Diagram Outputs

ParameterDescription
Estimated Output yhat(k)Returns the estimated output of the State-Space Model.
Predicted State Estimate xhat(k+1|k)Returns the predicted state estimates of the State-Space Model for the next time step k + 1. The length of this vector is equal to the number of model states.
Corrected State Estimate xhat(k|k)Returns the corrected state estimates at time k. The length of this vector is equal to the number of model states. This output appears only if you select Current, w/ check or Current, w/o check from the Polymorphic instance pull-down menu.
Predicted State Estimate xhat(k|k-1)Returns the estimated states of the State-Space Model estimated at the previous time step. This output appears only if you select Predictive, w/ check or Predictive, w/o check from the Polymorphic instance pull-down menu.

Discrete Observer Details

Current Observer

At each time step k, this function calculates the Corrected State Estimate xhat(k|k) using the Estimated Output yhat(k), any control action Input u(k), and the Predicted State Estimate xhat(k|k-1) calculated at the previous time step. This function also calculates the estimated states for the next time step k + 1, Predicted State Estimate xhat(k+1|k).

This VI uses the following equations to calculate the outputs.

yhat(k) = C(k) · xhat(k|k–1) + D(k) · u(k)

where C and D are the output and direct feedthrough matrices, respectively, of the State-Space Model.

xhat(k|k) = xhat(k|k–1) + Lc [y(k) – yhat(k)]

where Lc is the Observer Gain.

xhat(k+1|k) = A(k) · xhat(k|k) + B(k) · u(k)

where A and B are the state and input matrices, respectively, of the State-Space Model.

Predictive Observer

At each time step k, this function calculates the Predicted State Estimate xhat(k+1|k) using the Estimated Output yhat(k) and the Predicted State Estimate xhat(k|k–1).

The following equations define the outputs of this function:

yhat(k) = C(k) · xhat(k|k–1) + D(k) · u(k)

xhat(k+1|k) = A(k) · xhat(k|k–1) + B(k) · u(k) + Lp[y(k) – yhat(k)]

where Lp is the Observer Gain.

Feedthrough Behavior

The value you specify for the D matrix of the Stochastic State-Space Model parameter determines the feedthrough behavior of this function.

  • If the D matrix is nonzero, all input/output pairs have direct feedthrough behavior.
  • If the D matrix is zero, the following input/output pairs have indirect feedthrough behavior.
    • Input u(k)Corrected State Estimate xhat(k|k)
    • Input u(k)Predicted State Estimate xhat(k|k–1)
    The remaining input/output pairs have direct feedthrough behavior.

When you use the configuration dialog box to configure the D matrix, LabVIEW verifies that the feedthrough behavior is correct. For example, if you set the Feedthrough parameter to Indirect, and you set the D matrix to nonzero, LabVIEW changes the Feedthrough parameter to Direct.

If you specify the value of the D matrix programmatically by wiring a value to the parameter terminal, LabVIEW does not adjust the feedthrough behavior for you. You must ensure that you specify the proper feedthrough behavior for the value of the D matrix that you specify.