# Patent

## Title
Automatic generation of PID parameters for a scanning probe microscope

## Abstract

Linear PID controllers have a transfer function that resembles the frequency response of a notch filter. The PID parameters, KP, KI, and KD (proportional, integral, and derivative gains, respectively) can be extracted from the parameters of a linear notch filter. The linearized modes of scanning probe microscope (SPM) actuators have frequency responses that resemble those of simple second order resonance. Reasonable feedback control can be achieved by an inverse dynamics model of the resonance. A properly parameterized notch filter can cancel the dynamics of a resonance to give good closed-loop response.

## Background
BACKGROUND
A proportional-integral-derivative controller (PID controller) is a control loop feedback mechanism commonly used in industrial control systems, e.g. a Scanning Probe Microscope (SPM). A PID controller attempts to correct the error between a measured process variable and a desired setpoint by calculating and then outputting a corrective action that can adjust the process accordingly.
FIG. 1 shows a block diagram of a scanning probe microscope. The input to the PID controller is the error signal from the surface sensor, and the controller output is used to move an actuator, e.g. Z actuator, that ultimately controls the relationship between the probe and surface.
The input to the PID controller is the error signal and the output of the controller is the voltage or current used to drive the actuator. The responsiveness of the controller is set with the coefficients KP, KI, and KD as shown below:




  
    
      
        u
        =
        
          
            
              K
              P
            
            ⁢
            e
          
          +
          
            
              
                K
                I
              
              
                T
                I
              
            
            ⁢
            
              ∫
              
                e
                ⁢
                
                  d
                  t
                
              
            
          
          +
          
            
              K
              D
            
            ⁢
            
              T
              D
            
            ⁢
            
              
                d
                e
              
              
                d
                t
              
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        1
      
    
  




TI represents the integration time and TD represents the differentiation time, e.g. the amount of time that the integral and the differentiation take place over. It is common, but certainly not necessary to set these to a common value, T. Alternately, their values can be included in the calculation of KI and KD, respectively.

The PID controller calculation involves three separate components; the Proportional component, the Integral component and Derivative component. The proportional component determines the reaction to the current error, the integral component determines the reaction based on the current and all previous errors and the derivative component determines the reaction based on the rate by which the error is changing. The weighted sum of the three components is output as a corrective action to a control element.
By adjusting constants in the PID controller algorithm, the PID can provide individualized control specific to process requirements including error responsiveness, overshoot of setpoint and system oscillation. 
SUMMARY
Linear PID controllers have a transfer function that can be set to resemble the frequency response of a notch filter. For these settings they have high gain at low frequency (due to the integrator), high gain at high frequency (due to the differentiator, and a minimum in between. Practical implementations of a PID use filtering to roll off the gain at very high frequencies.
The PID parameters, KP, KI, and KD (proportional, integral, and derivative gains, respectively) can be extracted from the parameters of a linear notch filter.
The main linearized mode of scanning probe microscope (SPM) actuators have frequency responses that can be modeled as a simple second order resonance.
Reasonable feedback control can be achieved by using an inverse dynamics model of the resonance. A properly parameterized notch filter can adjust the dynamics of a resonance to give good closed-loop response. This enables control at closed-loop bandwidths beyond the frequency of the main linearized mode of the SPM actuator.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 illustrates a block diagram for a scanning probe force microscope system (PRIOR ART).
FIG. 2 shows a block diagram according to the invention.
FIG. 3 illustrates a process flow chart according to the invention.
FIG. 4 illustrates a process flow chart for continuous-time model generation.
FIGS. 5A and 5B illustrate an actuator response from a 3-wire measurement.
FIG. 6 illustrates a block diagram corresponding to continuous model generation.
FIGS. 7A and 7B illustrate a closed loop frequency response from r1 to y.
FIGS. 8A and 8B illustrate the open loop frequency response from r1 to y extracted from a closed loop measurement.
FIGS. 9A and 9B illustrate the frequency response measurement from e to uC of a compensator.
FIGS. 10A and 10B illustrate the actuator frequency response function extracted from a closed loop measurement. 
FIGS. 11A and 11B illustrate a curve fit model for a second order system.
FIG. 12 illustrates a process flow chart for discrete model generation.
FIGS. 13A and 13B illustrate the frequency response beyond the main resonant frequency.
FIGS. 14A and 14B illustrate the projected closed loop frequency response.
FIG. 15 illustrates a block diagram corresponding to discrete model generation.
FIG. 16 is a block diagram of a parameter estimator in discrete time.
FIG. 17 is a block diagram of parameter estimator in discrete time where the signals into the parameter estimator are filtered to emphasize selected frequency ranges.



DETAILED DESCRIPTION
FIG. 1 is a block diagram of one type of scanning probe force microscope (SPM) system, e.g. a scanning sample design, where the sample is moved and the cantilever base is kept stationary. Other designs may move the cantilever in addition to or in place of moving the sample. There are three axes of motion for a typical SPM system. Any one of these may have a feedback loop controlling it. In FIG. 1, the X and Y axes are open loop and the Z axis is closed-loop. Furthermore, all three axes are moved by a 3 degree of freedom piezo actuator. It is important to know that other actuation methods are possible, such as having a MEMS actuator in the Z direction and having closed-loop control on the X and/or Y axes.
While the invention will be described with respect to Z axis control, the concepts can be easily extended to any of the axes of motion of a SPM.
FIG. 2 illustrates a block diagram according to the invention. A scanning probe microscope 10 is controlled by a controller block 12. A controller design block 14 adjusts the operation of the controller block 12.
Within the controller block 12, a summer 20 receives a reference signal and a tip deflection signal. The output of the summer 20 is received by a PID controller 22 which generates a controller output signal. The PID controller 22 further receives an  input from the controller design block 14. Filtering may be added to mitigate the effects of system dynamics, e.g. higher frequency resonances of the cantilever.
The controller block 12 receives a reference signal from the microscope 10 and design parameters from the controller design block 14. The controller forms an error signal and uses a PID design to generate a controller output that is used to control the microscope 10.
The controller design block 14 includes a notch filter model 16 and a system identifier 18. The system identifier 18 receives signals from the controller block 12 and the microscope 10. The output of the system identifier 18 are parameters corresponding to the actuator resonance. These parameters are used to design a notch filter by the notch filter model 16. The notch filter model 16 generates a set of PID parameters that are transmitted to the controller block 12.
FIG. 3 illustrates a process flow chart according to the invention. In step 102, a model for the scanning probe microscope dynamics is generated. In step 104, filter parameters that shape selected dynamics of the model are chosen. In step 106, a notch filter is generated using the filter parameters. In step 108, the notch filter is encoded as PID parameters. In step 110, the PID parameters are implemented in a PID controller to control the scanning probe microscope.
For step 106, one method would be to select the gain of the notch filter so that the overall magnitude of controller response is at a desired value for a given frequency. Alternatively, the gain of the notch filter can be selected so that the open loop magnitude of the combined controller and actuator response is unity at a desired frequency.
The model for the scanning probe microscope dynamics may be a continuous-time, a sampled-data, or a discrete-time model. These models can often be well represented as a filter, although they represent physical devices. The controller models can also be represented as filters. The term filter can be used to represent a model of a physical system, a controller, or an implementation of a controller model. In a continuous-time model, the signals are continuously fed into the filter elements, which in turn continuously process them. Such filters are commonly generated using analog circuitry. In a discrete-time model, the signals are measured at discrete  sample points and converted to digital signals through the use of mixed signal circuits such as an analog to digital converter (ADC). The processing of these signals is also done using digital circuitry, such as a microprocessor, a digital signal processor (DSP), or a field programmable gate array (FPGA). Some of the processed signals may then be sent back to the physical system via digital to analog converters (DACs). A sampled data model is more general than a discrete-time model in that it may include systems where one or more of the signals are sampled, but the processing may be done using analog circuitry. These definitions are well known to those skilled in the art. For the purposes of this disclosure, the models to be discussed will be either continuous-time models or discrete-time models. However, it will be clear to those skilled in the art that the invention can be applied to more general systems such as sampled-data systems or hybrid systems where the physical system contains continuous time and discrete time components.
It is well known to those skilled in the art that controllers may be designed using continuous-time models and implemented discretely using so-called discrete equivalents. Alternately, controllers may be implemented directly in analog form, or they may be designed using discrete-time methods from discrete-time models of the system in question.
The continuous-time model may be generated in a multitude of ways, two of which can be seen from FIG. 4. In step 112A, the model is generated by measuring an open-loop frequency response measurement of the scanning probe microscope. Alternatively, in step 112B, the model is generated by measuring a closed-loop frequency response of the scanning probe microscope. In step 114, a corresponding actuator response of the scanning probe microscope dynamics is extracted. In step 115, the actuator model is extracted.
For a closed-loop measurement, the actuator response may be measured using a 3-wire measurement (illustratively shown in FIGS. 5A and 5B). In a 3-wire measurement, a signal is injected into the loop at a convenient location, e.g. r in FIG. 6, and signals from the controller output and actuator, e.g. uc and y in FIG. 6 are measured. If y is not available, it can be reconstructed from e if we know the value of r. Alternately, the closed-loop response of the system (illustratively shown  in FIGS. 7A and 7B) can be measured, e.g. 2-wire measurement from r1 to y in FIG. 6, and this can be unwrapped to reveal the open-loop response (illustratively shown in FIGS. 8A and 8B). A frequency response measurement of the compensator (illustratively shown in FIGS. 9A and 9B), e.g. from e to uC in FIG. 6, can be divided out to reveal the actuator frequency response function (illustratively shown in FIGS. 10A and 10B).
The frequency response functions may be computed in several ways. The system can be stimulated with white or colored noise or with a chirped sine signal. From any of these, the frequency responses can be calculated using DFT or FFT based methods. Alternately, the system may be stimulated using a method known as swept-sine or sine-dwell. A sinusoidal signal at a single frequency is injected into the system for an extended time. Once the system has reached steady state, various system outputs are measured. These measured outputs are mixed with a related sinusoidal signal, e.g. input signal, using both in-phase (0 degrees phase) and quadrature (+/−90 degrees phase) signals. These signals are then integrated to yield demodulated signals from which the complex response at the input frequency is obtained (and from which the magnitude and phase can be extracted). By doing this at a desired set of frequencies, a frequency response function (FRF) can be extracted. FRFs generated using swept sine methods typically have better signal to noise ratios (SNR) than FFT based FRFs.
After the frequency response function (FRF) is generated for the frequencies of interest, a parametric model of the actuator is generated. This can be done using curve fitting. A general curve fit model may be used. Alternately, restricting the order of the curve fit model to a second order system may be used when since the actuator's linear response is second order. The models may be obtained from the full FRF or from the magnitude response alone. This is illustratively shown in FIGS. 11A and 11B.
The discrete-time model can be generated as shown in FIG. 12. In step 116, the response model with physical parameters is discretized. In step 118, the system response is measured. In step 120, the measurements are fit to the discrete time model from step 116. This results in a set of values for the physical parameters from step 116, which are used in step 122 to generate the notch filter and the PID controller  parameters. Steps 118 and 120 may be accomplished in the time or frequency domain.
The notch filter and PID parameters can be directly generated from either the continuous-time or discrete-time model. The filter parameters correspond to a notch filter with a gain K, center frequency ω0 and quality factor QC. The resulting PID controller enables the system to be controlled at frequencies beyond the main resonant frequency (shown in FIGS. 13A and 13B). The projected closed-loop frequency response function is shown in FIGS. 14A and 14B.
The resulting PID controller may be implemented using either analog or digital circuitry.
Next, while generating the model for the inventive concept will be illustrated for a continuous-time model (as in FIG. 6) and for a discrete-time model (as FIG. 15) for PID parameter generation, it will be apparent to one skilled in the art that the methods may be combined.
Continuous-time Model Using Frequency Response
The SPM model is generated (step 102) by measuring the frequency response function of the SPM and extracting the frequency response function of the actuator. The frequency response function of the actuator is fit to a second order transfer function model. Next, the gain, resonant frequency, and quality factor (K, w0, Q) of the resonance from the second order fit are derived. This is done by matching terms, e.g.




  
    
      
        
          
            
              
                H
                ⁡
                
                  (
                  s
                  )
                
              
              =
              
              ⁢
              
                1
                
                  
                    
                      A
                      o
                    
                    ⁢
                    
                      s
                      2
                    
                  
                  +
                  
                    
                      A
                      1
                    
                    ⁢
                    s
                  
                  +
                  
                    A
                    2
                  
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  1
                  
                    A
                    0
                  
                
                
                  
                    s
                    2
                  
                  +
                  
                    
                      
                        A
                        1
                      
                      
                        A
                        0
                      
                    
                    ⁢
                    s
                  
                  +
                  
                    
                      A
                      2
                    
                    
                      A
                      0
                    
                  
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  
                    K
                    A
                  
                  ⁢
                  
                    ω
                    n
                    2
                  
                
                
                  
                    s
                    2
                  
                  +
                  
                    
                      
                        ω
                        n
                      
                      
                        Q
                        A
                      
                    
                    ⁢
                    s
                  
                  +
                  
                    ω
                    n
                    2
                  
                
              
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        2
      
    
  




where the three transfer functions have terms that can be extracted from a curve fit or a direct on-line adaptation. The third term is in terms of resonant parameters. 





  
    
      
        
          
            ω
            n
          
          =
          
            
              
                A
                2
              
              
                A
                0
              
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            Q
            A
          
          =
          
            
              1
              
                A
                1
              
            
            ⁢
            
              
                
                  A
                  0
                
                ⁢
                
                  A
                  2
                
              
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            K
            A
          
          =
          
            1
            
              A
              2
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        3
      
    
  




Next, as in steps 104 and 106, an inverse filter based on (KA, ωn, QA), e.g. a notch filter with a gain at K, center frequency ω0 and quality factor αQC. Typically QC, is equal to αQA, where 0<α≦1. Often ω0 is close to or equal to ωn. By picking the center frequency of the notch equal to the center frequency of the resonance, the notch dip is positioned at the maximum value of the resonance. α=1 corresponds to complete cancellation of the resonance (for an idealized notch filter with no poles) where 0<α<1 allows the notch to be broader and not be so sensitive to small changes in ω0. The analog actuator model may be optionally discretized to yield a digital transfer function model, e.g. P1(z), P2(z), or P3(z).
Next, as in step 108, the linear notch filter is mapped into the PID gains: KP, KI, and KD. An idealized PID (without derivative filtering) is described as:




  
    
      
        
          
            
              
                C
                ⁡
                
                  (
                  s
                  )
                
              
              =
              
              ⁢
              
                
                  U
                  ⁡
                  
                    (
                    s
                    )
                  
                
                
                  E
                  ⁡
                  
                    (
                    s
                    )
                  
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  K
                  P
                
                +
                
                  
                    K
                    I
                  
                  Ts
                
                +
                
                  
                    K
                    D
                  
                  ⁢
                  Ts
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  
                    
                      K
                      D
                    
                    ⁢
                    T
                  
                  s
                
                ⁡
                
                  [
                  
                    
                      s
                      2
                    
                    +
                    
                      
                        
                          K
                          P
                        
                        
                          K
                          D
                        
                      
                      ⁢
                      
                        s
                        T
                      
                    
                    +
                    
                      
                        K
                        I
                      
                      
                        
                          K
                          D
                        
                        ⁢
                        
                          T
                          2
                        
                      
                    
                  
                  ]
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  K
                  
                    
                      ω
                      0
                      2
                    
                    ⁢
                    s
                  
                
                ⁡
                
                  [
                  
                    
                      s
                      2
                    
                    +
                    
                      
                        
                          ω
                          0
                        
                        
                          Q
                          C
                        
                      
                      ⁢
                      s
                    
                    +
                    
                      ω
                      0
                      2
                    
                  
                  ]
                
              
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        4
      
    
  




In this equation, for simplification T=TI=TD although similar results can be obtained without this simplification.

From the above,





  
    
      
        
          
            K
            D
          
          =
          
            K
            
              
                ω
                0
                2
              
              ⁢
              T
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            K
            I
          
          =
          KT
        
        ⁢
        
          

        
        ⁢
        
          
            K
            P
          
          =
          
            K
            
              
                ω
                0
              
              ⁢
              
                Q
                C
              
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        5
      
    
  




A PID with a first order derivative filter is described as: 




  
    
      
        
          
            
              
                
                  C
                  ⁡
                  
                    (
                    s
                    )
                  
                
                =
                
                ⁢
                
                  
                    U
                    ⁡
                    
                      (
                      s
                      )
                    
                  
                  
                    E
                    ⁡
                    
                      (
                      s
                      )
                    
                  
                
              
            
          
          
            
              
                =
                
                ⁢
                
                  
                    K
                    P
                  
                  +
                  
                    
                      K
                      I
                    
                    Ts
                  
                  +
                  
                    
                      K
                      D
                    
                    ⁢
                    
                      Ts
                      
                        Ts
                        +
                        
                          a
                          1
                        
                      
                    
                  
                
              
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            
              
                
                  C
                  ⁡
                  
                    (
                    s
                    )
                  
                
                =
                
                ⁢
                
                  
                    
                      (
                      
                        
                          K
                          P
                        
                        +
                        
                          K
                          D
                        
                      
                      )
                    
                    ⁡
                    
                      [
                      
                        
                          s
                          2
                        
                        +
                        
                          
                            
                              
                                
                                  K
                                  P
                                
                                ⁢
                                
                                  a
                                  1
                                
                              
                              +
                              
                                K
                                I
                              
                            
                            
                              (
                              
                                
                                  K
                                  P
                                
                                +
                                
                                  K
                                  D
                                
                              
                              )
                            
                          
                          ⁢
                          
                            s
                            T
                          
                        
                        +
                        
                          
                            
                              K
                              I
                            
                            ⁢
                            
                              a
                              1
                            
                          
                          
                            
                              (
                              
                                
                                  K
                                  P
                                
                                +
                                
                                  K
                                  D
                                
                              
                              )
                            
                            ⁢
                            
                              T
                              2
                            
                          
                        
                      
                      ]
                    
                  
                  
                    s
                    ⁡
                    
                      (
                      
                        s
                        +
                        
                          
                            a
                            1
                          
                          T
                        
                      
                      )
                    
                  
                
              
            
          
          
            
              
                =
                
                ⁢
                
                  
                    K
                    ⁡
                    
                      [
                      
                        
                          s
                          2
                        
                        +
                        
                          
                            
                              ω
                              0
                            
                            
                              Q
                              C
                            
                          
                          ⁢
                          s
                        
                        +
                        
                          ω
                          0
                          2
                        
                      
                      ]
                    
                  
                  
                    
                      ω
                      0
                      2
                    
                    ⁢
                    
                      s
                      ⁡
                      
                        (
                        
                          s
                          +
                          
                            
                              a
                              1
                            
                            T
                          
                        
                        )
                      
                    
                  
                
              
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        6
      
    
  




Those skilled in the art will recognize that higher order filtering can be used, either on the derivative term alone or on the entire controller.

From the above,





  
    
      
        
          
            
              K
              P
            
            +
            
              K
              D
            
          
          =
          
            K
            
              ω
              0
              2
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            K
            I
          
          =
          
            
              KT
              2
            
            
              a
              1
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            K
            P
          
          =
          
            
              
                KT
                2
              
              
                a
                1
              
            
            ⁢
            
              (
              
                
                  1
                  
                    
                      Q
                      C
                    
                    ⁢
                    
                      ω
                      0
                    
                    ⁢
                    T
                  
                
                -
                
                  1
                  
                    a
                    1
                  
                
              
              )
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        7
      
    
  




Next, as in step 110, the PID gains are mapped into a practical implementation. Practical PID loops consider the effects of high frequency noise on the signals and thus include additional filtering of high frequency signals. The design considerations include integrator wind-up for which anti-windup methods are known to those skilled in the art.
Discrete Model
In one discrete model embodiment, as in step 110, the digital frequency response of the system is measured. As in step 112, the digital frequency response of the motor is extracted. As in step 114, the model parameters are fit to yield a digital transfer function model of the motor, e.g. P1(z), P2(z), or P3(z).
In another discrete model embodiment (step 102), the response may be characterized as




  
    
      
        
          P
          ⁡
          
            (
            s
            )
          
        
        =
        
          
            
              
                
                  K
                  A
                
                ⁢
                
                  ω
                  o
                  2
                
              
              
                
                  s
                  2
                
                +
                
                  2
                  ⁢
                  
                    ζ
                    A
                  
                  ⁢
                  
                    ω
                    o
                  
                  ⁢
                  s
                
                +
                
                  ω
                  o
                  2
                
              
            
            ⁢
            
              
            
            ⁢
            where
            ⁢
            
              
            
            ⁢
            
              ζ
              A
            
          
          =
          
            1
            
              2
              ⁢
              
                Q
                A
              
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        8
      
    
  




The poles of the filter are at 

s=ωo(−ζA±√{square root over (ζA2−1)})  Eq. 9

    If ζA<1 then the poles are a complex pair. If ζA=−1 then, the poles are real and identical. If ζA>1, then the poles are real and distinct. For a resonant structure ζA<1. For ζA<1, s=ωo(−ζA±j√{square root over (1−ζA2)}), where j is √{square root over (−1)}. For pole zero mapping, the poles at sp are mapped to zp=esPτ. Finite zeroes at sz are mapped to zz=eszτ. Zeroes at s=∞ are mapped to z∞=−1. The gain of the digital model is chosen to match the gain of the analog model at a critical frequency. Often, this is the DC gain, but it could be the resonant frequency.


Using pole zero mapping




  
    
      
        
          
            P
            1
          
          ⁡
          
            (
            z
            )
          
        
        =
        
          
            
              K
              1
            
            ⁢
            
              
                
                  ω
                  o
                  2
                
                ⁡
                
                  (
                  
                    z
                    +
                    1
                  
                  )
                
              
              2
            
          
          
            
              z
              2
            
            -
            
              2
              ⁢
              
                
                  e
                  
                    
                      -
                      
                        ω
                        o
                      
                    
                    ⁢
                    
                      T
                      s
                    
                    ⁢
                    
                      ζ
                      A
                    
                  
                
                ⁡
                
                  (
                  
                    cos
                    ⁡
                    
                      (
                      
                        
                          ω
                          o
                        
                        ⁢
                        
                          T
                          s
                        
                        ⁢
                        
                          
                            1
                            -
                            
                              ζ
                              A
                              2
                            
                          
                        
                      
                      )
                    
                  
                  )
                
              
              ⁢
              z
            
            +
            
              e
              
                
                  -
                  2
                
                ⁢
                
                  ζ
                  A
                
                ⁢
                
                  ω
                  o
                
                ⁢
                
                  T
                  s
                
              
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        10
      
    
  




Alternately, one zero may be positioned at z=−∞ and one at z=−1,





  
    
      
        
          
            P
            2
          
          ⁡
          
            (
            z
            )
          
        
        =
        
          
            
              K
              2
            
            ⁢
            
              
                ω
                o
                2
              
              ⁡
              
                (
                
                  z
                  +
                  1
                
                )
              
            
          
          
            
              z
              2
            
            -
            
              2
              ⁢
              
                
                  e
                  
                    
                      -
                      
                        ω
                        o
                      
                    
                    ⁢
                    
                      T
                      s
                    
                    ⁢
                    
                      ζ
                      A
                    
                  
                
                ⁡
                
                  (
                  
                    cos
                    ⁡
                    
                      (
                      
                        
                          ω
                          o
                        
                        ⁢
                        
                          T
                          s
                        
                        ⁢
                        
                          
                            1
                            -
                            
                              ζ
                              A
                              2
                            
                          
                        
                      
                      )
                    
                  
                  )
                
              
              ⁢
              z
            
            +
            
              e
              
                
                  -
                  2
                
                ⁢
                
                  ζ
                  A
                
                ⁢
                
                  ω
                  o
                
                ⁢
                
                  T
                  s
                
              
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        11
      
    
  




The DC gain of the analog model may be matched by P(0)=K, by setting





  
    
      
        
          
            
              
                
              
              ⁢
              
                
                  K
                  A
                
                =
                
                ⁢
                
                  
                    P
                    1
                  
                  ⁡
                  
                    (
                    1
                    )
                  
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  
                    K
                    1
                  
                  ⁢
                  
                    
                      
                        ω
                        o
                        2
                      
                      ⁡
                      
                        (
                        2
                        )
                      
                    
                    2
                  
                
                
                  1
                  -
                  
                    2
                    ⁢
                    
                      
                        e
                        
                          
                            -
                            
                              ω
                              o
                            
                          
                          ⁢
                          T
                          ⁢
                          
                            
                          
                          ⁢
                          
                            ζ
                            A
                          
                        
                      
                      ⁡
                      
                        (
                        
                          cos
                          ⁡
                          
                            (
                            
                              
                                ω
                                o
                              
                              ⁢
                              
                                T
                                s
                              
                              ⁢
                              
                                
                                  1
                                  -
                                  
                                    ζ
                                    A
                                    2
                                  
                                
                              
                            
                            )
                          
                        
                        )
                      
                    
                  
                  +
                  
                    e
                    
                      
                        -
                        2
                      
                      ⁢
                      
                        ζ
                        A
                      
                      ⁢
                      
                        ω
                        o
                      
                      ⁢
                      
                        T
                        s
                      
                    
                  
                
              
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        12
      
    
  
  
    
      
        
          
            
              
                
              
              ⁢
              
                
                  K
                  A
                
                =
                
                ⁢
                
                  
                    P
                    2
                  
                  ⁡
                  
                    (
                    1
                    )
                  
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  
                    K
                    2
                  
                  ⁢
                  
                    
                      ω
                      o
                      2
                    
                    ⁡
                    
                      (
                      2
                      )
                    
                  
                
                
                  1
                  -
                  
                    2
                    ⁢
                    
                      
                        e
                        
                          
                            -
                            
                              ω
                              o
                            
                          
                          ⁢
                          
                            T
                            s
                          
                          ⁢
                          
                            ζ
                            A
                          
                        
                      
                      ⁡
                      
                        (
                        
                          cos
                          ⁡
                          
                            (
                            
                              
                                ω
                                o
                              
                              ⁢
                              
                                T
                                s
                              
                              ⁢
                              
                                
                                  1
                                  -
                                  
                                    ζ
                                    A
                                    2
                                  
                                
                              
                            
                            )
                          
                        
                        )
                      
                    
                  
                  +
                  
                    e
                    
                      
                        -
                        2
                      
                      ⁢
                      
                        ζ
                        o
                      
                      ⁢
                      
                        ω
                        A
                      
                      ⁢
                      
                        T
                        s
                      
                    
                  
                
              
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        13
      
    
  
  
    
      
        
          
            
              
                So
                ⁢
                
                  
                
                ⁢
                
                  K
                  1
                
              
              =
              
              ⁢
              
                
                  K
                  A
                
                (
                
                  
                    1
                    -
                    
                      2
                      ⁢
                      
                        
                          e
                          
                            
                              -
                              
                                ω
                                o
                              
                            
                            ⁢
                            
                              T
                              s
                            
                            ⁢
                            
                              ζ
                              A
                            
                          
                        
                        ⁡
                        
                          (
                          
                            cos
                            ⁡
                            
                              (
                              
                                
                                  ω
                                  o
                                
                                ⁢
                                
                                  T
                                  s
                                
                                ⁢
                                
                                  
                                    1
                                    -
                                    
                                      ζ
                                      A
                                      2
                                    
                                  
                                
                              
                              )
                            
                          
                          )
                        
                      
                      ⁢
                      z
                    
                    +
                    
                      e
                      
                        
                          -
                          2
                        
                        ⁢
                        
                          ζ
                          A
                        
                        ⁢
                        
                          ω
                          o
                        
                        ⁢
                        
                          T
                          s
                        
                      
                    
                  
                  
                    4
                    ⁢
                    
                      ω
                      o
                      2
                    
                  
                
                )
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  K
                  2
                
                2
              
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        14
      
    
  




Another embodiment to match the measured response is to allow some other zero in the discrete model. 





  
    
      
        
          
            
              P
              3
            
            ⁡
            
              (
              z
              )
            
          
          =
          
            
              
                K
                3
              
              ⁢
              
                
                  ω
                  o
                  2
                
                ⁡
                
                  (
                  
                    z
                    +
                    1
                  
                  )
                
              
              ⁢
              
                (
                
                  z
                  -
                  b
                
                )
              
            
            
              
                z
                2
              
              -
              
                2
                ⁢
                
                  
                    e
                    
                      
                        -
                        
                          ω
                          o
                        
                      
                      ⁢
                      
                        T
                        s
                      
                      ⁢
                      
                        ζ
                        A
                      
                    
                  
                  ⁡
                  
                    (
                    
                      cos
                      ⁡
                      
                        (
                        
                          
                            ω
                            o
                          
                          ⁢
                          
                            T
                            s
                          
                          ⁢
                          
                            
                              1
                              -
                              
                                ζ
                                A
                                2
                              
                            
                          
                        
                        )
                      
                    
                    )
                  
                
                ⁢
                z
              
              +
              
                e
                
                  
                    -
                    2
                  
                  ⁢
                  
                    ζ
                    A
                  
                  ⁢
                  
                    ω
                    o
                  
                  ⁢
                  
                    T
                    s
                  
                
              
            
          
        
        ,
        
          

        
        ⁢
        
          
        
        ⁢
        
          
            where
            ⁢
            
              
            
            -
            1
          
          <
          b
          <
          1
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        15
      
    
  
  
    
      
        
          
            
              
                
                  P
                  3
                
                ⁡
                
                  (
                  1
                  )
                
              
              =
              
              ⁢
              
                
                  K
                  A
                
                ⇒
                
                  K
                  3
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  K
                  A
                
                (
                
                  
                    1
                    -
                    
                      2
                      ⁢
                      
                        
                          e
                          
                            
                              -
                              
                                ω
                                o
                              
                            
                            ⁢
                            
                              T
                              s
                            
                            ⁢
                            
                              ζ
                              A
                            
                          
                        
                        ⁡
                        
                          (
                          
                            cos
                            ⁡
                            
                              (
                              
                                
                                  ω
                                  o
                                
                                ⁢
                                
                                  T
                                  s
                                
                                ⁢
                                
                                  
                                    1
                                    -
                                    
                                      ζ
                                      A
                                      2
                                    
                                  
                                
                              
                              )
                            
                          
                          )
                        
                      
                    
                    +
                    
                      e
                      
                        
                          -
                          2
                        
                        ⁢
                        
                          ζ
                          A
                        
                        ⁢
                        
                          ω
                          o
                        
                        ⁢
                        
                          T
                          s
                        
                      
                    
                  
                  
                    2
                    ⁢
                    
                      (
                      
                        1
                        -
                        b
                      
                      )
                    
                  
                
                )
              
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        16
      
    
  




The motor response can be measured in one of several ways. Other variations include measuring the analog frequency response of the system, extracting the analog frequency response of the motor.

In another discrete model embodiment, as in step 110, the samples of the inputs and outputs of the motor are measured in discrete time, e.g. {u(k), u(k−1), . . . , u(k−n)}, where {y(0), y(1), . . . , y(k−n)} are related by




  
    
      
        
          
            Y
            ⁡
            
              (
              z
              )
            
          
          
            U
            ⁡
            
              (
              z
              )
            
          
        
        =
        
          
            e
            
              -
              jΔτ
            
          
          ⁢
          
            
              
                b
                o
              
              +
              
                
                  b
                  1
                
                ⁢
                
                  z
                  
                    -
                    1
                  
                
              
              +
              
                
                  b
                  2
                
                ⁢
                
                  z
                  
                    -
                    2
                  
                
              
            
            
              1
              +
              
                
                  a
                  1
                
                ⁢
                
                  z
                  
                    -
                    1
                  
                
              
              +
              
                
                  a
                  2
                
                ⁢
                
                  z
                  
                    -
                    2
                  
                
              
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        17
      
    
  




where Δτ is time delay.

Those skilled in the art will also recognize that there are many design methodologies that can generate the response of a notch filter. These methods include—but are not limited to—state-space methods and optimization methods such as H2 and H∞ design.
In another illustrative example, the model is generated using Discrete-Time, Time Domain Identification of SPM Dynamics. The discrete time filter parameters are generated from time response measurements by running a second order model of the actuator in parallel with the measured system. The inputs and the output of the system and the model can be compared. The model adjusted to minimize some cost criterion of the error, e.g. on-line adaptation.
Digital filters can be represented as transfer functions in the z transform operator, z:




  
    
      
        
          
            Y
            ⁡
            
              (
              z
              )
            
          
          
            U
            ⁡
            
              (
              z
              )
            
          
        
        =
        
          
            
              
                b
                0
              
              ⁢
              
                z
                n
              
            
            +
            
              
                b
                1
              
              ⁢
              
                z
                
                  n
                  -
                  1
                
              
            
            +
            
              
                b
                2
              
              ⁢
              
                z
                
                  n
                  -
                  2
                
              
            
            +
            ...
            +
            
              b
              n
            
          
          
            
              z
              n
            
            +
            
              
                a
                1
              
              ⁢
              
                z
                
                  n
                  -
                  1
                
              
            
            +
            
              
                a
                2
              
              ⁢
              
                z
                
                  n
                  -
                  2
                
              
            
            +
            ...
            +
            
              a
              n
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        18
      
    
  




or equivalently in the unit delay operator, z−1: 





  
    
      
        
          
            Y
            ⁡
            
              (
              z
              )
            
          
          
            U
            ⁡
            
              (
              z
              )
            
          
        
        =
        
          
            
              b
              0
            
            +
            
              
                b
                1
              
              ⁢
              
                z
                
                  -
                  1
                
              
            
            +
            
              
                b
                2
              
              ⁢
              
                z
                
                  -
                  2
                
              
            
            +
            ...
            +
            
              
                b
                n
              
              ⁢
              
                z
                
                  -
                  n
                
              
            
          
          
            1
            +
            
              
                a
                1
              
              ⁢
              
                z
                
                  -
                  1
                
              
            
            +
            
              
                a
                2
              
              ⁢
              
                z
                
                  -
                  2
                
              
            
            +
            ...
            +
            
              
                a
                n
              
              ⁢
              
                z
                
                  -
                  n
                
              
            
          
        
      
    
    
      
        
          Eq
          .
          
            
          
          ⁢
          1
        
        ⁢
        9
      
    
  




It is worth noting that the transfer functions in Equations 18 and 19 are not unique. One could easily multiply the numerator and denominator by the same numbers to yield equivalent transfer functions. However, this representation has an advantage in that the coefficient of the output term. y(k), in the equations below is 1.

This gets implemented in a filter as:

y(k)=−a1y(k−1)−a2y(k−2)− . . . −any(k−n)+b0u(k)+b1u(k−1)+ . . . +bnu(k−n)  Eq. 20

Alternately, we can use a direct form filter which reduces storage requirements. (There was an extra figure for this if you want to use it.)

d(k)=−a1d(k−1)−a2d(k−2)− . . . −and(k−n)+u(k)  Eq. 21

y(k)=b0d(k)+b1d(k−1)+ . . . +bnd(k−n)

When digital filters are implemented in an adaptive scheme, the Z transform is no longer applicable as the coefficients are varying. However, the unit delay operator is still valid. To avoid confusion, it is common for those skilled in the area to replace the unit delay operator z−1 with the equivalent unit delay operator, q−1. Since the latter is not associated with the Z transform (which is not valid when the coefficients are varying) confusion is avoided.

If the system model is unknown then an estimate can be generated using:

ŷ(k)=−â1y(k−1)−â2y(k−2)− . . . −âny(k−n)+{circumflex over (b)}0u(k)+{circumflex over (b)}1u(k−1)+ . . . +{circumflex over (b)}nu(k−n)  Eq. 21

For simplicity, the noise free case will be discussed here, but those skilled in the art will recognize that equivalent results are available when the system has noise.

If one compares the measured output to the output of the system model one gets: 

ε(k)=y(k)−ŷ(k)  Eq. 23

ε(k)=y(k)−[â1y(k−1)−â2y(k−2)− . . . −âny(k−n)+{circumflex over (b)}0u(k)+{circumflex over (b)}1u(k−1)+ . . . +{circumflex over (b)}nu(k−n)]  Eq, 22

This can be rewritten as:

ε(k)=y(k)−φT(k){circumflex over (θ)}(k)  Eq. 25

Where

φT(k)=[−y(k−1),−y(k−2), . . . , −y(k−n).,u(k),u(k−1), . . . , u(k−n)] and

{circumflex over (θ)}T(k)=[â1,â2, . . . , ân, {circumflex over (b)}0, {circumflex over (b)}1, . . . , {circumflex over (b)}n)].

The parameters in {circumflex over (θ)}T(k)=[â1, â2, . . . , ân, {circumflex over (b)}0, {circumflex over (b)}1, . . . +{circumflex over (b)}n)] can be adjusted through a variety of schemes with the goal of having them converge to the true model of the system, {circumflex over (θ)}T(k)=[â1, â2, . . . , ân, {circumflex over (b)}0, {circumflex over (b)}1, . . . +{circumflex over (b)}n)]. Commonly used algorithms well known to those skilled in the art include methods that minimize the mean squared error, e2(k), such as Least Mean Squares (LMS), Recursive Least Squares (RLS), or algorithms that are modifications of these (such as Filtered-X LMS).

In FIG. 15, a discrete-time model of the system is shown. In FIG. 16, the pieces of the block diagram that need to be replicated for doing system identification are shown. What is important to note, is that the identification block diagram of FIG. 16 is fed by all the available inputs and outputs of the system. If the system is run in closed-loop, then the estimation algorithm is fed the closed-loop quantities. If it is run in open loop, then the estimation algorithm is fed the open loop quantities.
Depending upon the system configuration, different input and output signals will be available. However, the goal of the estimation algorithm is to match {circumflex over (P)} to P, or equivalently {circumflex over (θ)} to θ. It will be known to those skilled in the art, that the signals entering the parameter estimator may be filtered, as shown in FIG. 17, so as to emphasize certain frequencies and de-emphasize others.
We can use information about the SPM actuator to simplify this procedure. For example, in one embodiment the identification is run while the system is in open-loop, with r1(k) and uC(k) are both 0. Thus, the signals to be measured are u(k) and  e(k) (or their filtered versions), from which y(k) can be derived. In this case the system and the model are both stimulated with u(k)=r2 (k) and the model output is compared to the measured output. In another embodiment, the system is run in closed-loop and the dynamics may be stimulated from a variety of signals such as r1(k) or r2(k).
For generating the discrete-time model of the main dynamics of a SPM actuator, we can restrict our model to be a second order discrete-time model. That is, the n would be 2 in Equations 18-22 and 24. Thus Equations 19 and 20 become




  
    
      
        
          
            Y
            ⁡
            
              (
              z
              )
            
          
          
            U
            ⁡
            
              (
              z
              )
            
          
        
        =
        
          
            
              b
              0
            
            +
            
              
                b
                1
              
              ⁢
              
                z
                
                  -
                  1
                
              
            
            +
            
              
                b
                2
              
              ⁢
              
                z
                
                  -
                  2
                
              
            
          
          
            1
            +
            
              
                a
                1
              
              ⁢
              
                z
                
                  -
                  1
                
              
            
            +
            
              
                a
                2
              
              ⁢
              
                z
                
                  -
                  2
                
              
            
          
        
      
    
    
      
        Eq
        .
        
          
        
        ⁢
        23
      
    
  




and

y(k)=−a1y(k−1)−a2y(k−2)+b0u(k)+b1u(k−1)+b2u(k−2)  Eq. 24

respectively.

Furthermore as r1(k) enters into the calculation for both y(k) and ŷ(k), e(k) and ê(k) can be used in the generation of ε2 (k).

Next, the parameters are matched to the Discrete-Time Resonance Model. With the second order discrete-time model identified, the parameters in Equation 210 can be matched against the discrete resonances, P1(z), P2(z), or P3(z). PID parameters can then be matched to the extracted parameters, ω0, ζA, and KA as described earlier.

## Claims

1. A method for controlling a scanning probe microscope, the method comprising:
generating a scanning probe microscope model according to associated dynamics of the scanning probe microscope;
selecting filter parameters that shape selected dynamics of the scanning probe microscope model;
generating a notch filter using the filter parameters;
encoding the notch filter as PID parameters; and
implementing the PID parameters in a PID controller to control the scanning probe microscope.

2. A method for controlling a scanning probe microscope as in claim 1, where the scanning probe microscope model is a continuous-time model.

3. A method for controlling a scanning probe microscope as in claim 1, where the scanning probe microscope model is a sampled-data model.

4. A method as in claim 1, further comprising, generating the scanning probe microscope model by:
measuring open loop frequency response measurement of the scanning probe microscope; and
extracting an open loop actuator model of the scanning probe microscope dynamics.

5. A method as in claim 1, generating a model comprising:
measuring a closed loop frequency response of the scanning probe microscope; and
extracting an open loop actuator model of the scanning probe microscope dynamics.

6. A method as in claim 2, wherein the notch filter and PID parameters are generated directly from the continuous-time model.

7. A method as in claim 2, comprising:
discretizing the identified continuous time model to form a digital model; and
generating the notch filter and PID parameters from the digital model.

8. A method as in claim 1, wherein the resultant PID controller is implemented using analog circuitry.

9. A method as in claim 1 wherein the resultant PID controller is implemented using digital logic.

10. A method as in claim 1, wherein the filter parameters correspond to a notch filter with a gain, resonant frequency, and quality factor derived from the dynamics of the model.

11. A method as in claim 1, wherein:
one of the filter parameters is gain; and
the gain is selected such that magnitude of a response of the PID controller is at a desired valued for a given frequency.

12. A method as in claim 1, wherein:
one of the filter parameters is gain; and
the gain is selected such that an open loop magnitude of a combined PID controller and scanning probe microscope model is unity at a desired frequency.

13. A method as for controlling a scanning probe microscope including a cantilever and an actuator, the method comprising: automatically generating PID parameters that include a proportional gain, an integral gain, and a derivative gain, wherein automatically generating the PID parameters includes,
measuring a closed loop system response during operation with a nominal controller;
deriving an open loop system response from the measured closed loop system response;
removing an effect of the nominal controller from the derived open loop system response to yield a response of the actuator of the scanning probe microscope;
performing a curve fit on a selected portion of the response of the actuator to obtain a transfer function; and
generating resonance parameters from the transfer function, and using the generated resonance parameters to design a PID controller; and applying the PID parameters to operate the actuator beyond a resonant frequency of the actuator.

14. An instrument comprising:
a scanning probe microscope including a cantilever and an actuator;
a proportional-integral-derivative (PID) parameter generator that:
generates a scanning probe microscope model according to associated dynamics of the scanning probe microscope; 
selects filter parameters that shape selected dynamics of the scanning probe microscope model;
generates a notch filter using the filter parameters; and
encodes the notch filter as PID parameters; and

a PID controller that receives the PID parameters and controls the scanning probe microscope.

15. An instrument as in claim 14, wherein the PID parameter generator that generates a scanning probe microscope model comprises a PID parameter generator that generates a continuous-time model.

16. An instrument as in claim 14, wherein the PID parameter generator that generates a scanning probe microscope model comprises a PID parameter generator that generates a sampled-data model.

17. An instrument as in claim 14, wherein the PID parameter generator that generates a scanning probe microscope model comprises a PID parameter generator that:
measures an open bop frequency response of the scanning probe microscope; and
extracts an open loop physical system model of the scanning probe microscope dynamics.

18. An instrument as in claim 14, wherein the PID parameter that generates a scanning probe microscope model comprises a PID parameter that:
measures a closed loop frequency response of the scanning probe microscope; and 
extracts an open loop physical system model of the scanning probe microscope dynamics.