Availability:
     Level 5    , 'B'

  Quick Help:
     Servo Bode Plot, B[BodeType],[InjAmp],[Fmin],[Fmax],[NumFreq],[NumSamples],[EnableTracing]

  Description:
    This command implements the Servo Bode Plot diagnostic. It is implemented as a
    single-frequency DFT with an injected sine-wave distrubance, which is either a current or
    position disturbance, depending on the selected measurement.
    
    It has the ability to perform a single frequency measurement or loop through a range of
    frequencies to create a swept-sine frequency response measurement.
    
    The measurement will be done at the current servo position.
    
    A special 'Trace Mode' is supported which will return the raw time-domain data for Signal1
    and Signal2. The data for only one frequency will be returned. If swept-sine measurement
    is done, then time-domain data will be returned for only the last frequency used.
 
  Input Parameters:

    0 - Select the Bode measurement type.
    
        Parameter 0 is used to specify the type of servo bode measuement to be done.

          Note: for the following measurements, Signal1 is the 'output', Signal2 is the 'input',
          and the transfer function is output/input = Signal1/Signal2.  The labels specified for
          Signal1, Signal2, and Injection for each of the Bode plot types are the actual variables
          being sampled from the servo firmware.
          
          0x00: OPEN_LOOP_VCM_DISTURBANCE_CURRENT - the diagnostic will be configured for an
          open-loop bode measurement, using vcm current disturbance.
             Signal1:    i16_Current2,
             Signal2:    i16_Current2Out,
             Injection:  i16_TrackingVcmDisturbanceCurrent
                                                                         
          0x01: CLOSED_LOOP_VCM_DISTURBANCE_CURRENT - the diagnostic will be configured for a
          closed-loop bode measurement, using vcm current disturbance.
             Signal1:    i16_Current2,
             Signal2:    i16_TrackingVcmDisturbanceCurrent,
             Injection:  i16_TrackingVcmDisturbanceCurrent
          
          0x02: STRUCTRUAL_VCM_DISTURBANCE_CURRENT - the diagnostic will be configured for a
          structrual bode measurement, using vcm current disturbance.
             Signal1:    i16_DemodPositionError,
             Signal2:    i16_Current2Out,
             Injection:  i16_TrackingVcmDisturbanceCurrent
          
          0x03: OPEN_LOOP_POSITION_DISTURBANCE - the diagnostic will be configured for an open-
          loop bode measurement, using position disturbance.
             Signal1:    i16_DemodPositionMeasurementIn,
             Signal2:    i16_DemodPositionMeasurementOut,
             Injection:  i16_TrackingDemodDisturbancePosition
          
          0x04: SENSITIVITY_POSITION_DISTURBANCE - the diagnostic will be configured for a
          sensitivity measurement, using position disturbance.
             Signal1:    i16_DemodPositionError,
             Signal2:    i16_TrackingDemodDisturbancePosition,
             Injection:  i16_TrackingDemodDisturbancePosition
    
          Type:    Hexadecimal value
    
          Range:   0 .. Maximum Number of Bode Types
    
          Default: 0 (Open Loop - Vcm current distrubance)
    
    1 - Specify the Injection Amplitude
    
        Parameter 1 specifies the peak amplitude of the injected sine-wave disturbance.
        For bode types using VCM current disturbance, the units will be DAC counts.  For
        bode types using pes distrubance, the units will be pes counts.
        
          Type:    Positive decimal value
    
          Range:
    
          Default: 400
    
    2 - Set the lowest frequency to be measured.
    
        Parameter 2 specifies lowest frequency in Hertz to be used for the servo bode
        measurement.
    
          Type:    Positive decimal value
    
          Range:   10 Herts to the Nyquist frequency
    
          Default: 10 Hz
    
    3 - Set the highest frequency to be measured.
    
        Parameter 3 specifies highest frequency in Hertz to be used for the servo bode
        measurement. This frequency must be greater than Parameter 2. Entering any value
        larger than the Nyquist frequency will default to the Nyquist frequency.
    
          Type:    Positive decimal value
    
          Range:   10 Herts to the Nyquist frequency
    
          Default: Nyquist frequency
    
    4 - Set the number of frequencies to use.
    
        Parameter 4 specifies number of linearly-spaced frequencies, between the
        minimum frequency (Parameter 2) and the maximum frequency (Parameter 3) to be used
        for the servo bode measurement.
    
          Type:    Positive decimal value
    
          Range:   1 .. 1024
    
          Default: 200
    
    5 - Set the number of samples to collect.
    
        Parameter 5 specifies the length of the time-domain data record to be collected
        for each of the specified frequencies.
    
          Type:    Positive decimal value
    
          Range:   1 .. 32768
    
          Default: 4096
    
    6 - Enable Tracing
    
        Parameter 7 is used to enable a trace-mode that will return the raw time-domain
        data of the last frequency to be analyzed. If Parameter 6 equals 0, then the
        trace-mode is disabled. If Parameter 6 equals 1, the the trace-mode is enabled.
    
          Type:    Hexadecimal value
    
          Range:   0 or 1
    
          Default: 0 (Trace disabled)
    
  Output Data:


    If an error occurred, the following information will be displayed.
    
          "DiagError aaaaaaaa"
    
       where
    
          aaaaaaaa is the Diagnostic Error Code
    
    If no error occurred, then the results of the servo Bode command will be displayed as
    follows.
    
          "ssssssssssssssssssssss"
    
          "Freq     Re1      Im1      Re2      Im2"
          "aaaaaa   bbbbbb   cccccc   dddddd   eeeeee"
             .
             . (repeated for all frequencies tested)
             .
          "aaaaaa   bbbbbb   cccccc   dddddd   eeeeee"
    
       where
    
          ss..ss is a string to indicate the type of Bode plot that was performed.  It may
                 be one of the following.
    
                 OPEN LOOP - CURRENT DISTURBANCE
                 CLOSED LOOP - CURRENT DISTURBANCE
                 STRUCTURAL - CURRENT DISTURBANCE
                 OPEN LOOP - POSITION DISTURBANCE
                 SENSITIVITY - POSITION DISTURBANCE
    
          aaaaaa is the measurement frequency in Hertz.
    
          bbbbbb is the real component of the frequency in Signal 1.
    
          cccccc is the imaginary component of the frequency in Signal 1.
    
          dddddd is the real component of the frequency in Signal 2.
    
          eeeeee is the imaginary component of the frequency in Signal 2.
    
       NOTE: All data is presented as floating point numbers.
    
  Examples:

    Example #1:
    The following command will measure the open loop frequency response using the
    defaults parameters.
 
       F3 5>B
 
    Example #2:
    This command will measure the open loop frequency response with a
    TrackingDemodDisturbancePosition amplitude of 100, in the range of 2000Hz
    to 3000Hz, with a linear spacing of 20Hz=(3000-2000)/50, and a time record
    of 5000 samples per frequency.
 
       F3 5>B3,100,2000,3000,50,5000
 
    Example #3:
    This example uses the default bode type and injection amplitude, starting frequency
    of 5000, ending frequency of 5010, using only 1 frequency only do 5000Hz), collect 264
    samples, and use Trace Mode. Trace mode will return the servo sector number, and the
    raw time-domian data for Signal1 and Signal2.
 
       F3 5>B,,5000,5010,1,264,1

  Revision History:

    0001.0000   Initial revision.
    0011.0000   Combined the PSG Diagnostic Error Codes (PSGDEC) and the Diagnostic External
                Test Service Error Codes (DETSEC) into a single set of Diagnostic Error Codes
                (DiagError).