Application Frequency Response Functions

The Application Frequency Response API lets you trigger frequency responses in Automation1 Studio and do stability analysis on frequency responses that you collect. These AeroScript functions run on the Automation1-iSMC (the Automation1 Intelligent Software-Based Machine Controller). But they are handled through a connected Automation1-MDK (the Automation1 Machine & Motion Development Kit) Studio application. Thus, you must connect Automation1 Studio to the controller before you use these functions.

Tip: By default, Automation1 Studio and Automation1 MachineApps try to register for Application Message and Application Frequency Response callbacks. The first application that registers will get the callbacks. The next application that tries to register will get an error. You can change the default behavior of Automation1 Studio in Settings. You can change the default behavior of a MachineApp in the MachineApps workspace in Automation1 Studio.

Frequency Response

Automation1 Studio has a Frequency Response utility that you can use to analyze the characteristics of the servo loop and its mechanical system.

For information about how frequency responses are measured, see the Frequency Response Module documentation on the Axes Category page.

While Automation1 Studio gives you an interface where you can easily measure frequency responses, the AppFrequencyResponse* functions let you measure multiple responses in succession. Then you can save them as frequency response files to make a streamlined workflow. The API supplies functions that you can use to run each of the supported loop input types:

  • MultisinePlus loop input type - Use the AppFrequencyResponseTriggerMultisinePlus() function.
  • Sinusoid loop input type - Use the AppFrequencyResponseTriggerSinusoid() function.
  • White Noise loop input type - Use the AppFrequencyResponseTriggerWhiteNoise() function.
  • Multisine loop input type - Use the AppFrequencyResponseTriggerMultisine() function.

Each Frequency Response must run on a different, physical axis.

There are a number of configurations that you can do to change the behavior of the transmissions. Use the $mdkFilePath argument to specify the location and name of the output file on the client MDK machine. Relative paths are supported and are relative to the Automation1 folder in your Documents folder. To save to an absolute path outside of the MDK folder, toggle the Allow Saving to and Reading from Absolute Paths setting to On in the Frequency Response settings in Automation1 Studio. Network and controller paths are not supported. Use the $frequencyResponseFileType argument to specify the type of file to save. Supported file types include Automation1 Frequency Response, CSV, and JSON.

Application Frequency Response Function Overloads

function AppFrequencyResponseTriggerMultisinePlus($axis as axis, $mdkFilePath as string, $startFrequency as real, $endFrequency as real, $numPoints as integer, $maxCurrentPercentage as real, $measurementType as TuningMeasurementType, $travelDistance as real, $travelVelocity as real)

Triggers a MultisinePlus frequency response transmission on the specified axis.

Arguments

$axis  The axis on which to trigger the response.

$mdkFilePath  The file name and relative path that specifies where the frequency response data will be saved in the MDK documents folder.

$startFrequency  The starting frequency of the transmission, in Hz.

$endFrequency  The ending frequency of the transmission, in Hz.

$numPoints  The number of frequency points to include in the disturbance.

$maxCurrentPercentage  Percentage of maximum current to be transmitted to the axis in the range (0, 100].

$measurementType  The underlying control loop used to perform the frequency response.

$travelDistance  The distance to move during the frequency response. Specify a value of 0.0 for this argument and $travelVelocity to disable motion.

$travelVelocity  The velocity to move with during the frequency response. Specify a value of 0.0 for this argument and $travelDistance to disable motion.

function AppFrequencyResponseTriggerMultisinePlus($axis as axis, $mdkFilePath as string, $startFrequency as real, $endFrequency as real, $numPoints as integer, $maxCurrentPercentage as real, $measurementType as TuningMeasurementType, $travelDistance as real, $travelVelocity as real, $frequencyResponseFileType as FrequencyResponseFileType)

Triggers a MultisinePlus frequency response transmission on the specified axis.

Arguments

$axis  The axis on which to trigger the response.

$mdkFilePath  The file name and relative path that specifies where the frequency response data will be saved in the MDK documents folder.

$startFrequency  The starting frequency of the transmission, in Hz.

$endFrequency  The ending frequency of the transmission, in Hz.

$numPoints  The number of frequency points to include in the disturbance.

$maxCurrentPercentage  Percentage of maximum current to be transmitted to the axis in the range (0, 100].

$measurementType  The underlying control loop used to perform the frequency response.

$travelDistance  The distance to move during the frequency response. Specify a value of 0.0 for this argument and $travelVelocity to disable motion.

$travelVelocity  The velocity to move with during the frequency response. Specify a value of 0.0 for this argument and $travelDistance to disable motion.

$frequencyResponseFileType  The format of the frequency response file that will be saved.

function AppFrequencyResponseTriggerSinusoid($axis as axis, $mdkFilePath as string, $startFrequency as real, $endFrequency as real, $numDivisions as integer, $amplitude as real, $measurementType as TuningMeasurementType, $travelDistance as real, $travelVelocity as real)

Triggers a Sinusoidal frequency response transmission on the specified axis.

Arguments

$axis  The axis on which to trigger the response.

$mdkFilePath  The file name and relative path that specifies where the frequency response data will be saved in the MDK documents folder.

$startFrequency  The starting frequency of the transmission, in Hz.

$endFrequency  The ending frequency of the transmission, in Hz.

$numDivisions  The number of divisions within the frequency range.

$amplitude  The amplitude of the sinusoidal wave.

$measurementType  The underlying control loop used to perform the frequency response.

$travelDistance  The distance to move during the frequency response. Specify a value of 0.0 for this argument and $travelVelocity to disable motion.

$travelVelocity  The velocity to move with during the frequency response. Specify a value of 0.0 for this argument and $travelDistance to disable motion.

function AppFrequencyResponseTriggerSinusoid($axis as axis, $mdkFilePath as string, $startFrequency as real, $endFrequency as real, $numDivisions as integer, $amplitude as real, $measurementType as TuningMeasurementType, $travelDistance as real, $travelVelocity as real, $frequencyResponseFileType as FrequencyResponseFileType)

Triggers a Sinusoidal frequency response transmission on the specified axis.

Arguments

$axis  The axis on which to trigger the response.

$mdkFilePath  The file name and relative path that specifies where the frequency response data will be saved in the MDK documents folder.

$startFrequency  The starting frequency of the transmission, in Hz.

$endFrequency  The ending frequency of the transmission, in Hz.

$numDivisions  The number of divisions within the frequency range.

$amplitude  The amplitude of the sinusoidal wave.

$measurementType  The underlying control loop used to perform the frequency response.

$travelDistance  The distance to move during the frequency response. Specify a value of 0.0 for this argument and $travelVelocity to disable motion.

$travelVelocity  The velocity to move with during the frequency response. Specify a value of 0.0 for this argument and $travelDistance to disable motion.

$frequencyResponseFileType  The format of the frequency response file that will be saved.

function AppFrequencyResponseTriggerWhiteNoise($axis as axis, $mdkFilePath as string, $startFrequency as real, $endFrequency as real, $numAverages as integer, $maxCurrentPercentage as real, $measurementType as TuningMeasurementType, $travelDistance as real, $travelVelocity as real)

Triggers a WhiteNoise frequency response transmission on the specified axis.

Arguments

$axis  The axis on which to trigger the response.

$mdkFilePath  The file name and relative path that specifies where the frequency response data will be saved in the MDK documents folder.

$startFrequency  The starting frequency of the transmission, in Hz.

$endFrequency  The ending frequency of the transmission, in Hz.

$numAverages  The number of white noise averages.

$maxCurrentPercentage  Percentage of maximum current to be transmitted to the axis in the range (0, 100].

$measurementType  The underlying control loop used to perform the frequency response.

$travelDistance  The distance to move during the frequency response. Specify a value of 0.0 for this argument and $travelVelocity to disable motion.

$travelVelocity  The velocity to move with during the frequency response. Specify a value of 0.0 for this argument and $travelDistance to disable motion.

function AppFrequencyResponseTriggerWhiteNoise($axis as axis, $mdkFilePath as string, $startFrequency as real, $endFrequency as real, $numAverages as integer, $maxCurrentPercentage as real, $measurementType as TuningMeasurementType, $travelDistance as real, $travelVelocity as real, $frequencyResponseFileType as FrequencyResponseFileType)

Triggers a WhiteNoise frequency response transmission on the specified axis.

Arguments

$axis  The axis on which to trigger the response.

$mdkFilePath  The file name and relative path that specifies where the frequency response data will be saved in the MDK documents folder.

$startFrequency  The starting frequency of the transmission, in Hz.

$endFrequency  The ending frequency of the transmission, in Hz.

$numAverages  The number of white noise averages.

$maxCurrentPercentage  Percentage of maximum current to be transmitted to the axis in the range (0, 100].

$measurementType  The underlying control loop used to perform the frequency response.

$travelDistance  The distance to move during the frequency response. Specify a value of 0.0 for this argument and $travelVelocity to disable motion.

$travelVelocity  The velocity to move with during the frequency response. Specify a value of 0.0 for this argument and $travelDistance to disable motion.

$frequencyResponseFileType  The format of the frequency response file that will be saved.

function AppFrequencyResponseTriggerMultisine($axis as axis, $mdkFilePath as string, $startFrequency as real, $endFrequency as real, $numPeriods as integer, $maxCurrentPercentage as real, $measurementType as TuningMeasurementType, $travelDistance as real, $travelVelocity as real)

Triggers a Multisine frequency response transmission on the specified axis.

Arguments

$axis  The axis on which to trigger the response.

$mdkFilePath  The file name and relative path that specifies where the frequency response data will be saved in the MDK documents folder.

$startFrequency  The starting frequency of the transmission, in Hz.

$endFrequency  The ending frequency of the transmission, in Hz.

$numPeriods  The number of sinusoid periods. Must be a power of 2.

$maxCurrentPercentage  Percentage of maximum current to be transmitted to the axis in the range (0, 100].

$measurementType  The underlying control loop used to perform the frequency response.

$travelDistance  The distance to move during the frequency response. Specify a value of 0.0 for this argument and $travelVelocity to disable motion.

$travelVelocity  The velocity to move with during the frequency response. Specify a value of 0.0 for this argument and $travelDistance to disable motion.

function AppFrequencyResponseTriggerMultisine($axis as axis, $mdkFilePath as string, $startFrequency as real, $endFrequency as real, $numPeriods as integer, $maxCurrentPercentage as real, $measurementType as TuningMeasurementType, $travelDistance as real, $travelVelocity as real, $frequencyResponseFileType as FrequencyResponseFileType)

Triggers a Multisine frequency response transmission on the specified axis.

Arguments

$axis  The axis on which to trigger the response.

$mdkFilePath  The file name and relative path that specifies where the frequency response data will be saved in the MDK documents folder.

$startFrequency  The starting frequency of the transmission, in Hz.

$endFrequency  The ending frequency of the transmission, in Hz.

$numPeriods  The number of sinusoid periods. Must be a power of 2.

$maxCurrentPercentage  Percentage of maximum current to be transmitted to the axis in the range (0, 100].

$measurementType  The underlying control loop used to perform the frequency response.

$travelDistance  The distance to move during the frequency response. Specify a value of 0.0 for this argument and $travelVelocity to disable motion.

$travelVelocity  The velocity to move with during the frequency response. Specify a value of 0.0 for this argument and $travelDistance to disable motion.

$frequencyResponseFileType  The format of the frequency response file that will be saved.

Stability Analysis

Use the AppFrequencyResponsePerformStabilityAnalysis() function to do a stability analysis on a frequency response file. A stability analysis calculates stability metrics of a frequency response, which include the phase margin, magnitude crossover frequency, gain margin, phase crossover frequency, sensitivity peak, and sensitivity peak frequency. The calculated stability analysis metrics are returned by the $phaseMargin, $magnitudeCrossoverFrequency, $gainMargin, $phaseCrossoverFrequency, $sensitivityPeak, and $sensitivityPeakFrequency arguments.

Use the $mdkFilePath argument to specify the frequency response file on the client MDK machine on which to do a stability analysis. Relative paths are supported and are relative to the Automation1 folder in your Documents folder. To save to an absolute path outside of the MDK folder, toggle the Allow Saving to and Reading from Absolute Paths setting to On in the Frequency Response settings in Automation1 Studio. Network and controller paths are not supported.

function AppFrequencyResponsePerformStabilityAnalysis($mdkFilePath as string, ref $phaseMargin as real, ref $magnitudeCrossoverFrequency as real, ref $gainMargin as real, ref $phaseCrossoverFrequency as real, ref $sensitivityPeak as real, ref $sensitivityPeakFrequency as real)

Does a stability analysis on a saved frequency response file and returns the stability metrics.

Arguments

$mdkFilePath  The file name and relative path that specifies where the frequency response data will be read from the MDK documents folder.

ref $phaseMargin  The difference between the measured phase and -180 degrees at the $magnitudeCrossoverFrequency, in degrees.

ref $magnitudeCrossoverFrequency  The frequency at which the magnitude of the frequency response crosses over 0 dB, in Hz. The reported $phaseMargin is at this frequency.

ref $gainMargin  The gain above or below the 0 dB line at the $phaseCrossoverFrequency, in dB.

ref $phaseCrossoverFrequency  The frequency at which the phase of the frequency response crosses over -180 degrees, in Hz. The reported $gainMargin is at this frequency.

ref $sensitivityPeak  The maximum amplitude of the measured sensitivity function, in dB.

ref $sensitivityPeakFrequency  The frequency at which the reported $sensitivityPeak occurs, in Hz.

Related Topics 

Axes Category