# CD All Margins VI

LabVIEW 2012 Control Design and Simulation Module Help

Edition Date: June 2012

Part Number: 371894G-01

»View Product Info

Owning Palette: Frequency Response VIs

Requires: Control Design and Simulation Module

Calculates all the gain and phase margins, which result from the frequency response crossing at 0 decibels (magnitude) and –180 degrees (phase). You can use the CD All Margins VI only with single-input single-output (SISO) systems. Wire data to the State-Space Model and Frequency Range inputs determine the polymorphic instance to use or manually select the instance.

This VI converts the state-space and zero-pole-gain models into transfer function models before calculating their margins.

Use the pull-down menu to select an instance of this VI.

 Select an instance CD All Margins (State-Space)CD All Margins (Transfer Function)CD All Margins (Zero-Pole-Gain)CD All Margins (Frequency Response Data)

## CD All Margins (State-Space)

State-Space Model contains a mathematical representation of and information about the system for which this VI determines gain and phase margins.
Frequency Range contains the frequency information of the model.
Initial frequency is the minimum frequency this VI uses in calculating the frequency response and producing the plots. The default is –1.
Final frequency is the maximum frequency this VI uses in calculating the frequency response and producing the plots. The default is –1.
Minimum number of points is the minimum number of points this VI uses in calculating the frequency response and producing the plots. The default is 100 points.
Frequency Unit specifies the units of frequency, either in Hertz or radians/seconds, to use in calculating the frequency response and producing the plots.

Magnitude Scale specifies how to scale the magnitude of the frequency response.

 0 linear (default)—Does not convert the magnitude of the frequency response to decibels. 1 db—Converts the magnitude of the frequency response to decibels.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
Gain Margins returns information about the gain margins.
 G.M. Frequency lists all the frequencies at which the system phase crosses –180 degrees. The ith element of this array corresponds to the ith gain margin value in the Gain Margins array. Gain Margins lists all the gain margins of the system.
Phase Margins returns information about the phase margins.
 P.M. Frequency lists all the frequencies at which the system magnitude crosses 0 decibels. The ith element of this array corresponds to the ith phase margin value in the Phase Margins array. Phase Margins lists all the phase margins of the system.
Frequency Response Data returns the data before this VI parameterizes it. To access the frequency response data, use the CD Get Frequency Response Data VI.
 Frequency is a 1D-array of frequency values (in radians/seconds) at which this VI calculates the magnitude and phase. Magnitude is a 1D-array. For continuous-time systems H(s), the ith element of the array is defined by the following equation: For discrete-time systems, with sampling time T seconds, the ith element of the array is defined by the following equation: Phase is a 1D-array. For continuous-time systems, the ith element is defined as: For discrete-time systems, with sampling time T seconds, the ith element is defined as:
error out contains error information. This output provides standard error out functionality.
Delay Margins returns information about the delay margins.
 D.M. Frequency specifies at which frequencies the system phase crosses –180 degrees or a multiple of –180. The ith element of this array corresponds to the ith gain margin value in the Gain Margins array. Delay Margins lists the amounts of delay, in seconds, that would make the system unstable in a closed loop.

## CD All Margins (Transfer Function)

Transfer Function Model contains a mathematical representation of and information about the system for which this VI determines gain and phase margins.
Frequency Range contains the frequency information of the model.
Initial frequency is the minimum frequency this VI uses in calculating the frequency response and producing the plots. The default is –1.
Final frequency is the maximum frequency this VI uses in calculating the frequency response and producing the plots. The default is –1.
Minimum number of points is the minimum number of points this VI uses in calculating the frequency response and producing the plots. The default is 100 points.
Frequency Unit specifies the units of frequency, either in Hertz or radians/seconds, to use in calculating the frequency response and producing the plots.

Magnitude Scale specifies how to scale the magnitude of the frequency response.

 0 linear (default)—Does not convert the magnitude of the frequency response to decibels. 1 db—Converts the magnitude of the frequency response to decibels.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
Gain Margins returns information about the gain margins.
 G.M. Frequency lists all the frequencies at which the system phase crosses –180 degrees. The ith element of this array corresponds to the ith gain margin value in the Gain Margins array. Gain Margins lists all the gain margins of the system.
Phase Margins returns information about the phase margins.
 P.M. Frequency lists all the frequencies at which the system magnitude crosses 0 decibels. The ith element of this array corresponds to the ith phase margin value in the Phase Margins array. Phase Margins lists all the phase margins of the system.
Frequency Response Data returns the data before this VI parameterizes it. To access the frequency response data, use the CD Get Frequency Response Data VI.
 Frequency is a 1D-array of frequency values (in radians/seconds) at which this VI calculates the magnitude and phase. Magnitude is a 1D-array. For continuous-time systems H(s), the ith element of the array is defined by the following equation: For discrete-time systems, with sampling time T seconds, the ith element of the array is defined by the following equation: Phase is a 1D-array. For continuous-time systems, the ith element is defined as: For discrete-time systems, with sampling time T seconds, the ith element is defined as:
error out contains error information. This output provides standard error out functionality.
Delay Margins returns information about the delay margins.
 D.M. Frequency specifies at which frequencies the system phase crosses –180 degrees or a multiple of –180. The ith element of this array corresponds to the ith gain margin value in the Gain Margins array. Delay Margins lists the amounts of delay, in seconds, that would make the system unstable in a closed loop.

## CD All Margins (Zero-Pole-Gain)

Zero-Pole-Gain Model contains a mathematical representation of and information about the system for which this VI determines gain and phase margins.
Frequency Range contains the frequency information of the model.
Initial frequency is the minimum frequency this VI uses in calculating the frequency response and producing the plots. The default is –1.
Final frequency is the maximum frequency this VI uses in calculating the frequency response and producing the plots. The default is –1.
Minimum number of points is the minimum number of points this VI uses in calculating the frequency response and producing the plots. The default is 100 points.
Frequency Unit specifies the units of frequency, either in Hertz or radians/seconds, to use in calculating the frequency response and producing the plots.

Magnitude Scale specifies how to scale the magnitude of the frequency response.

 0 linear (default)—Does not convert the magnitude of the frequency response to decibels. 1 db—Converts the magnitude of the frequency response to decibels.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
Gain Margins returns information about the gain margins.
 G.M. Frequency lists all the frequencies at which the system phase crosses –180 degrees. The ith element of this array corresponds to the ith gain margin value in the Gain Margins array. Gain Margins lists all the gain margins of the system.
Phase Margins returns information about the phase margins.
 P.M. Frequency lists all the frequencies at which the system magnitude crosses 0 decibels. The ith element of this array corresponds to the ith phase margin value in the Phase Margins array. Phase Margins lists all the phase margins of the system.
Frequency Response Data returns the data before this VI parameterizes it. To access the frequency response data, use the CD Get Frequency Response Data VI.
 Frequency is a 1D-array of frequency values (in radians/seconds) at which this VI calculates the magnitude and phase. Magnitude is a 1D-array. For continuous-time systems H(s), the ith element of the array is defined by the following equation: For discrete-time systems, with sampling time T seconds, the ith element of the array is defined by the following equation: Phase is a 1D-array. For continuous-time systems, the ith element is defined as: For discrete-time systems, with sampling time T seconds, the ith element is defined as:
error out contains error information. This output provides standard error out functionality.
Delay Margins returns information about the delay margins.
 D.M. Frequency specifies at which frequencies the system phase crosses –180 degrees or a multiple of –180. The ith element of this array corresponds to the ith gain margin value in the Gain Margins array. Delay Margins lists the amounts of delay, in seconds, that would make the system unstable in a closed loop.

## CD All Margins (Frequency Response Data)

Frequency Response specifies the frequency response for which this VI calculates the margins.
 Magnitude specifies the magnitude component of the frequency response. The Magnitude Scale parameter defines the units of the Magnitude array. Phase specifies the phase component, in degrees, of the frequency response.
Frequency Vector specifies information about the frequencies this VI uses to excite the model.
Frequency specifies the frequencies this VI uses to excite the model.
Frequency Unit specifies the unit of measurement of the Frequency array.

 0 Hz—Specifies that the frequency is measured in hertz. 1 rad/s (default)—Specifies that the frequency is measured in radians per second.
Magnitude Scale specifies how to scale the magnitude of the frequency response.

 0 linear (default)—Does not convert the magnitude of the frequency response to decibels. 1 db—Converts the magnitude of the frequency response to decibels.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
Gain Margins returns information about the gain margins.
 G.M. Frequency lists all the frequencies at which the system phase crosses –180 degrees. The ith element of this array corresponds to the ith gain margin value in the Gain Margins array. Gain Margins lists all the gain margins of the system.
Phase Margins returns information about the phase margins.
 P.M. Frequency lists all the frequencies at which the system magnitude crosses 0 decibels. The ith element of this array corresponds to the ith phase margin value in the Phase Margins array. Phase Margins lists all the phase margins of the system.
Frequency Response Data returns the data before this VI parameterizes it. To access the frequency response data, use the CD Get Frequency Response Data VI.
 Frequency is a 1D-array of frequency values (in radians/seconds) at which this VI calculates the magnitude and phase. Magnitude is a 1D-array. For continuous-time systems H(s), the ith element of the array is defined by the following equation: For discrete-time systems, with sampling time T seconds, the ith element of the array is defined by the following equation: Phase is a 1D-array. For continuous-time systems, the ith element is defined as: For discrete-time systems, with sampling time T seconds, the ith element is defined as:
error out contains error information. This output provides standard error out functionality.
Delay Margins returns information about the delay margins.
 D.M. Frequency specifies at which frequencies the system phase crosses –180 degrees or a multiple of –180. The ith element of this array corresponds to the ith gain margin value in the Gain Margins array. Delay Margins lists the amounts of delay, in seconds, that would make the system unstable in a closed loop.

## CD All Margins Details

This VI supports delays. Refer to the LabVIEW Control Design User Manual for more information about delays.

## Example

Refer to the CDEx Bode Analysis VI in the labview\examples\Control and Simulation\Control Design\Frequency Analysis directory for an example of using the CD All Margins VI.