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

Trimming a Subsystem Programmatically (Control Design and Simulation Module)

LabVIEW 2009 Control Design and Simulation Module Help

Edition Date: June 2009

Part Number: 371894D-01

»View Product Info
Download Help (Windows Only)

Use the SIM Trim VI to trim a continuous simulation subsystem. By default, this VI trims a subsystem to a steady state in which all state derivatives are zero. By default, this VI does not specify any conditions and includes all inputs and states in the search. You can use the SIM Query Subsystem VI and the SIM Set Parameter Value VI to change the behavior of SIM Trim VI in the following ways:

  • Trim a subsystem to a transient state—Specify a non-zero Value for one or more state derivatives. You also must set the Parameter Type of these state derivatives to Fixed.
  • Specify one or more state, input, and/or output conditions—Specify a Value for one or more states, inputs, and/or outputs. You also must set the Parameter Type of these states, inputs, and/or outputs to Fixed.
  • Change the initial search location—Specify a Value for one or more states, inputs, and/or outputs. The values of these parameters form the location at which the SIM Trim VI begins the search. You also must set the Parameter Type of these states, inputs, and/or outputs to Variable.
  • Exclude a state and/or input from the search—Specify a Value for each input and/or state that you want to exclude. You also must set the Parameter Type of these states and/or inputs to Static.

For example, consider a car model car.vi that contains car position as a state. The car model has a cruise-control system that must set the position of the accelerator to maintain forward movement at a specified velocity. You can specify the velocity of the car using the derivative of car position. The following figure shows a LabVIEW block diagram that trims the car model using a specified velocity of 60 miles per hour.

The example in the previous figure executes the following steps:

  1. Obtains the value of the State Derivatives parameter of the car model using the SIM Query Subsystem VI. The State Derivatives parameter contains car position, which is equivalent to the velocity of the car.
  2. Wires the State Derivatives parameter to the Parameters In input of the SIM Set Parameter Value VI. This VI sets the Value of car position to 60. The Parameter Type of car position is Fixed, which indicates this parameter is a condition that the SIM Trim VI must satisfy. This VI must return values of states and inputs that keep the velocity of the car at 60 mph.
  3. Wires the modified State Derivatives parameter to the State Derivatives input of the SIM Trim VI. This VI returns the Trimmed Inputs and Trimmed States parameters that the cruise-control system must use to maintain a velocity of 60 mph. This VI also returns the Trimmed Outputs and Trimmed State Derivatives parameters that the car model returns when the cruise-control system uses the values of the Trimmed States and Trimmed Inputs parameters.
Note  If the SIM Trim VI cannot satisfy all specified conditions, this VI returns the closest values to the specified conditions.

 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit