LabVIEW Control Design and Simulation Module

Linearizing a Subsystem Programmatically (Control Design and Simulation Module)

  • Updated2023-03-14
  • 4 minute(s) read

You can linearize a subsystem using the SIM Linearize VI. By default, this VI includes all subsystem states, inputs, and outputs in the linear time-invariant (LTI) model. You can exclude inputs and outputs from the LTI model using the SIM Query Subsystem VI and the SIM Set Parameter Value VI. You also use these VIs to change the value of an input or state.

First, wire a path or reference to a subsystem to the Path input of the SIM Query Subsystem VI. This VI returns the States, Inputs, and Outputs of the subsystem. Second, wire the States, Inputs, or Outputs parameter to the Parameters In input of the SIM Set Parameter Value VI. You must use one SIM Set Parameter Value VI for each parameter on which you want to operate. Use the this VI to change the LTI model in the following ways:

  • Exclude an input or output from the LTI model—Set the Parameter Type of that input or output to Static. Because you cannot exclude a state from the LTI model, changing the Parameter Type of a state to Static does not change the LTI model.
  • Include an input or output in the LTI model—Set the Parameter Type of that input or output to Variable.
  • Change the value of an input or state that is included in the LTI model—Change the Value of that input or state. Because subsystem inputs and states influence the output, directly changing the Value of an output does not change the LTI model.
Note  The default Parameter Type of each state, input, and output is Variable.

Finally, wire the modified States, Inputs, or Outputs parameter to the appropriate input of the SIM Linearize VI. You also must wire a path or reference to the subsystem to this VI. The resulting State-Space Model includes all the subsystem states and any inputs and outputs you set to Variable. The State-Space Model does not include any inputs and outputs you set to Static.

For example, consider a subsystem that is a nonlinear model of a car, car.vi. If you want to approximate the behavior of this model when the engine speed of the car is 50 miles per hour, linearize the model using a value of 50 mph for the engine speed parameter. Also consider any parameters you want exclude from the LTI model. For example, you generally do not need to account for gravitational acceleration in an LTI model because gravitational acceleration is a constant. The following block diagram linearizes a car model using these specifications.

The example in the previous block diagram executes the following steps:

  1. Obtains the value of the Inputs parameter of the car model using the SIM Query Subsystem VI. The Inputs parameter contains subsystem inputs such as engine speed and gravitational acceleration.
  2. Wires the Inputs parameter to the Parameters In input of the SIM Set Parameter Value VI. This VI sets the Value of engine speed to 50 and sets the Parameter Type to Variable.
  3. Wires the modified Inputs parameter to the Parameters In input of another SIM Set Parameter Value VI. This VI sets the Parameter Type of gravitational acceleration to Static. Because this example does not specify a Value for gravitational acceleration, the SIM Set Parameter Value VI does not change the value of gravitational acceleration. Therefore, the LTI model uses the default value of gravitational acceleration that the SIM Query Subsystem VI returned.
  4. Wires the modified Inputs parameter to the Inputs input of the SIM Linearize VI. This VI returns an LTI model, State-Space Model, that approximates the behavior of the car model when the engine speed is 50 mph.
Note  You can specify the subsystem to linearize using a Path or Reference to the subsystem. Using a path to a subsystem causes the subsystem to load into memory every time a VI accesses the subsystem. Using a reference to a subsystem ensures that the subsystem loads into memory only once.

To obtain the parameter names or parameter values for a subsystem, use the SIM Get Parameter Names VI or the SIM Get Parameter Value VI, respectively.

Log in to get a better experience