![]() |
cacao
Release 0.1.03-dev
Compute And Control For Adaptive Optics
|
There are 3 methods for users to simulate hardware
The user runs a loop that updates the wavefront sensor image when the DM input changes. Both the DM and WFS are represented as shared memory image streams. When a new DM shape is written, the DM stream semaphores are posted by the user, triggering the WFS image computation. When the WFS image is computed, its semaphores are posted.
The AOsim simulation architecture relies on individual processes that simulate subsystems. Each process is launched by a bash script. ASCII configuration files are read by each process. Data I/O can be done with low latency using shared memory and semaphores: a process operation (for example, the wavefront sensor process computing WFS signals) is typically triggered by a semaphore contained in the shared memory wavefront stream. A low-speed file system based alternative to shared memory and semaphores is also provided.
Method 2 simulates incoming atmospheric WFs, a pyramid WFS based loop feeding a DM, a coronagraphic LOWFS and coronagraphic PSFs.
Launch the simulator with the following steps:
Create a series of atmospheric wavefronts (do this only once, this step can take several hrs):
./aohardsim/aosimmkwfser
Stop the process when a few wavefront files have been created (approximately 10 minimum). The AO code will loop through the list of files created, so a long list is preferable to reduce the frequency at which the end-of-sequence discontinuity occurs. The current wavefront file index is displayed as the process runs; in this example, the process is working on file #2:
Layer 0/ 7, Frame 99/ 100, File 0/100000000 [TIME = 0.0990 s] WRITING SCIENCE WAVEFRONT ... - Layer 0/ 7, Frame 99/ 100, File 1/100000000 [TIME = 0.1990 s] WRITING SCIENCE WAVEFRONT ... - Layer 1/ 7, Frame 42/ 100, File 2/100000000 [TIME = 0.2420 s]
Type CTRL-C
to stop the process. Note that you can relaunch the script later to build additional wavefront files.
By default, the wavefront files are stored in the work directory. You may choose to move them to another location (useful if you have multiple work directories sharing the same wavefront files). You can then create a symbolic link atmwf
to an existing atmospheric wavefront simulation directory. For example:
ln -s /data/AtmWF/wdir00/ atmwf
./aohardsim/runAOhsim
./aohardsim/runAOhsim -k
Important notes:
.conf
files in the aohardsim
directoryStream Description
wf0opd Atmospheric WF OPD
wf0amp Atmospheric WF amplitude
wf1opd Wavefront OPD after correction [um] ( = wf0opd - 2 x dm05dispmap )
dm05disp DM actuators positions
dm05dispmap DM OPD map
WFSinst Instantaneous WFS intensity
pWFSint WFS intensity frame, time averaged to WFS frame rate and sampled to WFS camera pixels
aosim_foc0_amp First focal plane (before coronagraph), amplitude
aosim_foc0_pha First focal plane (before coronagraph), phase
aosim_foc1_amp First focal plane (after coronagraph), amplitude
aosim_foc1_pha First focal plane (after coronagraph), phase
aosim_foc2_amp Post-coronagraphic focal plane, amplitude
aosim_foc2_pha Post-coronagraphic focal plane, phase
aosimmkWF
aosimmkWF
reads precomputed wavefronts and formats them for the simulation parameters (pixel scale, temporal sampling).
Parameters for aosimmkWF
are stored in configuration file:
File aosimmkWF.conf.default
:
aosimDMrun
File aosimDMrun.conf.default
:
aosimPyrWFS
File aosimPyrWFS.conf.default
:
The aolconf
script is used to configure and launch the AO control loop. It can be configured with input/output from real hardware or a simulation of real hardware.
Script Description
wf0opd Wavefront OPD prior to wavefront correction [um]
wf1opd Wavefront OPD after correction [um] ( = wf0opd - 2 x dm05dispmap )
dm05disp DM actuators positions
dm05dispmap DM OPD map
WFSinst Instantaneous WFS intensity
pWFSint WFS intensity frame, time averaged to WFS frame rate and sampled to WFS camera pixels
Close-loop simulation requires the following scripts to be launched to simulate the hardware, in the following order :
aosimDMstart
: This script creates DM channels (uses dm index 5 for simulation). Shared memory arrays dm05disp00
to dm05disp11
are created, along with the total displacement dm05disp
. Also creates the wf1opd
shared memory stream which is needed by aosimDMrun
and will be updated by runWF. wf1opd
is the master clock for the whole simulation, as it triggers DM shape computation and WFS image computation.aosimDMrun
: Simulates physical deformable mirror (DM)aosimmkWF
: Creates atmospheric wavefrontsaosimWFS
: Simulates WFSSome key script variables need to coordinated between scripts. The following WF array size should match :
WFsize
in script aosimDMstart
ARRAYSIZE
in aosimmkWF.conf
ARRAYSIZE
in aosimDMrun.conf
The main hardware loop is between aosimmkWF
and aosimWFS
: computation of a wavefront by aosimmkWF
is triggered by completion of a WFS instantaneous image computation by aosimWFS
. The configuration files are configured for this link.
The DM temporal response is assumed to be such that the distance between the current position $p$ and desired displacement $c$ values is multiplided by coefficient $a<1$ at each time step $dt$. The corresponding step response is :
$c - p((k+1) dt) = (c - p(k dt)) a$
$c - p(k dt) = (c-p0) a^k$
$p(k dt) = 1-a^k$
The corresponding time constant is
$a^{{t0}{dt}} = 0.5$
${t0}{dt} ln(a) = ln(0.5)$
$ln(a) = ln(0.5) dt/t0$
$a = 0.5^{{dt}{t0}}$
The output (corrected) wavefront is processed to compute ouput focal plane images, and optionally LOWFS image.
aosimcoroLOWFS
Computes coronagraphic image output and LOWFS image
File aosimcoroLOWFS.conf.default
:
The Linear Hardware Simulation (LHS) uses a linear response matrix to compute the WFS image from the DM state. It is significantly faster than the Physical Hardware Simulation (PHS) but does not capture non-linear effects.
LHScalib
.TEST MODE
GUIzrespMlinsim
and wfsref0linsim
selections at top of screen).lsimon
selection). The simulator reacts to changes in aol5_dmdisp (= dm04disp)