Skip to content

Tech Note Modal Control

oguyon edited this page Feb 6, 2023 · 20 revisions

Modal Control


1. Overview

What is modal control ?

In modal control, the AO loop computation is split in 3 sequential steps:

  • WFS modal extraction: WFS mode coefficients are computed (input: WFS signal, output: WFS mode coefficients)
  • modal filtering: is applied (input: WFS mode coeffiticents, output: DM mode coefficients)
  • DM modal expansion: DM mode coefficients are applied to DM (input: DM mode coefficients, output: DM control shape)

For example, if the WFS signal is a 2D image of 100x100 pixel, the DM is a 2D array of actuators of 50x50 actuators, and the modal control operates on 200 modes, the following compuations will be performed:

  • WFS modal extraction: Matrix-Vector-Multiply (MVM):
    • WFS modes matrix CMmodesWFS (100x100)x200
    • Input WFS signal vector WFSim 100x100
    • Output WFS mode values: modevalWFS 200
    • Computation : CMmodesWFS x WFSim -> modevalWFS
  • modal filtering: For each mode, run a leaky integrator:
    • Input WFS mode values modevalWFS: 200
    • Output WFS mode values modevalDM: 200
    • Computation: modevalDM(t) = (modevalDM(t-1) - gain x modevalWFS(t)) x (1-leak)
  • DM modal expansion:
    • DM modes matrix CMmodesDM: (50x50)x200
    • Input WFS mode values modevalDM: 200
    • Output DM control map dmC: 50x50
    • Computation: modevalDM x CMmodesDM -> dmC

More advanced control schemes (predictive control etc..) may be included in the modal filtering.

Why modal control ?

Modal control allows for independent control of individual modes. With an integrator controller, loop gain, leak and limit (min/max value) can be set independently for each mode according to input disturbance amplitude, temporal speed, and measurement noise level.

The choice of the control mode is critical (see below) to take full advantage of modal control.

Modal control also provide a low-dimension space that captures almost all of the relevant information, allowing for easier inspection of loop behavior and more efficient (lower computation load) implementation of advanced features such as:

  • Real-time pseudo-open loop telemetry: Summing the DM control and WFS residual in modal space provides a modal representation of the input disturbance. This is particularly useful for predictive control, or more generally to estimate how a different control law than the one currently running would perform. For example, the loop performance can be computed as a function of loop gain without actually changing the gain.
  • Temporal analysis of each mode, by inspection of PSDs
  • Predictive control on a mode-by-mode basis
  • Predictive control across all modes (taking into account correlations between modes across the temporal domain)
  • Self-test: add a disturbance to a mode, and check that the loop reacts to this specific mode only

See modal filtering source code where several of these features are implemented.

Modal AO loop diagnostic example: self responde matrix (selfRM)

The selfRM encodes the modal response of the loop to modal excitation.

selfRM video

Description:

Modal self response matrix acquired by cacao Harwdware details:

  • DM: 2000-actuator MEMS
  • WFS: Pyramid WFS, 120x120 pixel (EMCCD)
  • Loop speed 2 kHz
  • Modal control, 939 control modes
  • Loop gain = 0.4 (all modes)
  • Leak = 2% (all modes)

Self-RM shows the modal response to modal excitation. X axis: WFS mode index (mode seen) Y axis: DM mode index (mode poked) Z axis: time step since DM mode poked in unit of WFS frame pixel value shows mode amplitude

The selfRM should ideally show a diagonal (identity matrix) appear after a few frames of latency. If mode m is poked, only mode m should be seen by the WFS. Off-diagonal elements show crosstalk between modes.

The video shows consecutive slices of the selfRM. The expected diagonal appears at slice ~4 and quickly grows in amplitude to ~0.85. It then fades as the AO loop corrects the injected disturbance. The diagonal then becomes negative due to correction overshoot, as is expected from running with loop gain of 0.4 and a ~2 frame latency.

How to choose the control modes ?

There are several relevant (and often competing) factors:

  • DM actuators. All control modes should be within the DM actuation space.
  • WFS sensitivity. Control modes should avoid the WFS null space, and prioritize modes that provide the strongest signal.
  • Input amplitude: Modes with the strongest amplitude in the input disturbance should be prioritized
  • Orthogonality: Control modes should be orthogonal .. in WFS space and in DM space as much as possible
  • Statistical independence: Control modes should be statiscically independent in the input disturbance

Not all constraints can be simultaneously met.

Modal control implies a prioritized order of modes, with the lowest index modes being the "dominant" ones, which will be driven with the highest gain.

2. Control Modes Representation

The control modes are represented in both DM and WFS space :

  • CMmodesWFS is a 3D data cube where each slice is the mode in WFS space
  • CMmodesDM is a 3D data cube where each slice is the corresponding DM displacement map

Since CMmodesWFS is used to decompose the input WFS signal in modal coefficients, it should be an orthogonal basis (dot product between different slices is zero), such that the WFS signal can be multiplied by CMmodesWFS to yield the WFS mode values modevalWFS.

CMmodesDM is used to expand the DM mode values (modevalDM) into a DM shape, which does not require CMmodesDM to be an orthonormal basis.

3. Linear Response (Response Matrix)

The AO system response matrix captures the linear relationship between DM perturbations and WFS signal. In cacao, this is stored as a pair of 3D data cubes:

  • RMmodesDM are the DM patterns for which the system response is measured
  • RMmodesWFS are the corresponding WFS linear responses

For example the first two slices of the RMmodesDM cube may be tip and tilt on the DM, and the first two slices of RMmodesWFS are then the WFS linear response to tip and tilt respectively. This representation allows for a wide range of calibration to be stored, including zonal (RMmodesDM slices are then single pixel actuations), Fourier (RMmodesDM slices are sine waves on the DM), or Zernike.

4. Computing Control Modes from Linear Response: the System Modes

Principle

The control modes can be computed by principal component analysis (PCA) of the WFS responses as follows:

  • Perform PCA on RMmodesWFS, which identifies the main components of the WFS response for the set of DM actuations (RMmodesDM). The result of this decomposition is CMmodesWFS, which by construction is an orthonormal basis that can be used to decompose the WFS signal into mode values by MVM.
  • In the above step, store the linear transformation used to go grom RModesWFS to CMmodesWFS, and apply the same tranformation to RMmodesDM to compute CMmodesDM. This ensures that CMmodesDM is the DM-space representation of the control modes.

The calibration process may then consist of the following steps:

  1. Choose a set of poke modes RMmodesDM for the linear calibration
  2. Measure the corresponding linear response RMmodesWFS by physically actuating the AO system DM and recording the corresponding WFS changes
  3. Perform PCA using SVD to compute CMmodesWFS and CMmodesDM as described above

This calibration scheme will identify, among the linear space probed by the pokes sent to the DM (RMmodesDM), the DM patterns creating the strongest WFS response. This is performed by the PCA which idenfies and sorts these modes according to WFS response.

If the RMmodesDM covers all possible DM actuations (by choosing a zonal or Hadamard poke scheme), this approach will yield the system modes: the DM patterns producing the strongest possible WFS signals.

cacao Implementation

Run the following commands from the loop rootdir:

# Create DM poke modes
#
cacao-mkDMpokemodes

# Measure Hadamard mode response matrix
# perform 100 iterations
# wait for output (-w)
# 
cacao-aorun-030-acqlinResp -n 100 -w HpokeC
#
# Output : 
# conf/RMmodesDM/RMmodesDM.fits
# conf/RMmodeWFS/RMmodesWFS.fits

# Compute CM by PCA/SVD
#
cacao-aorun-039-compstrCM
# 
# Output:
# conf/CMmodesDM/CMmodesDM.fits
# conf/CMmodesWFS/CMmodesWFS.fits

Source code:

5. Using Synthetic Response Matrix

Principle

The system mode approach makes no assumption about the input disturbances. With some knowledge of input disturbance, a more optimal control scheme can be implemented :

  • There is little value in controlling modes that are not present in the input
  • Control authority should be maximized on modes known to exhibit strong variations in the input

Ideally, the RMmodesDM pokes should be representative of the disturbances experienced in closed loop. In ground-based adpative optics, for example, temporabl variance is strongest for low-order modes, and tip-tilt may be especially strong due to telescope vibrations. This can be achieved by transforming the measured response matrix (RMmodesDM and RMmodesWFS) into a synthetic response matrix that is more representative of expected disturbances.

The corresponding calibration process then follows these steps:

  1. Choose a COMPLETE set of poke modes RMmodesDM for the linear calibration that explores the full space of possible DM actuations. This can be a zonal or Hadamard basis.
  2. Measure the corresponding linear response RMmodesWFS by physically actuating the AO system DM and recording the corresponding WFS changes.
  3. If needed, transform RMmodesDM and RMmodesWFS to a zonal basis for convenience, such that it is easy to compute the response to arbitrary DM modes.
  4. Choose a basis of DM modes representative of expected disturbances. A particularly convenient basis will be a Fourier basis where the mode amplitude varies as a function of spatial frequency. Strong-values tip and tilt modes can be added to the set to ensure proper control of these modes. This is the synthetic set RMmodesDM-synthetic, from which the corresponding simulated WFS response RMmodesWFS-synthetic is computed.
  5. Perform the SVD-based PCA on the syntheric RM to yield the control modes CMmodesDM and CMmodesWFS.

cacao Implementation

Run the following commands from the loop rootdir:

cacao-mkDMpokemodes

cacao-aorun-030-acqlinResp -n 100 -w HpokeC

# Decode Hadamard RM to zonal basis
#
cacao-aorun-031-RMHdecode

# Compute zonal masks to handle edge effects
#
cacao-aorun-032-RMmkmask

# Make synthetic RM
# Maximum cycle per aperture = 20
#
cacao-aorun-033-RM-mksynthetic -c 20

cacao-aorun-039-compstrCM

6. Data-driven Synthetic RM and CM

The optimal synthetic RM is derived from WFS telemetry during closed loop. Ideally, the AO system periodically recomputes its control modes from WFS residuals.

This requires the same complete measured response matrix as described in the previous section (steps 1-3). A mapping from WFS to DM space is also required :

  1. Compute a pseudo-inverse psinvRM of the response matrix, which allows for WFS signals to be converted to DM space

The steps followed during closed loop are then :

  1. Record a large set of WFS signals, to be adopted as the RMmodesWFS
  2. Perform a PCA of RMmodesWFS to compute CMmodesWFS
  3. Multiply CMmodesWFS by psinvRM to compute CMmodesDM

Note that steps 4 and 7 are needed here because the starting point is in WFS space, unlike the system modes and synthetic RM approaches described in sections 4 and 5.

Clone this wiki locally