cacao  Release 0.1.03-dev
Compute And Control For Adaptive Optics
AOloopControl.h File Reference

Function prototypes for Adaptive Optics Control loop engine. More...

Include dependency graph for AOloopControl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  RTstreamLOG
 
struct  AOLOOPCONTROL_CONF
 
struct  AOloopControl_var
 

Macros

#define _AOLOOPCONTROL_H
 
#define MAX_NUMBER_TIMER   100
 
#define MAX_NUMBER_RTLOGSTREAM   20
 
#define RTSLOGindex_wfsim   0
 
#define RTSLOGindex_imWFS0   1
 
#define RTSLOGindex_imWFS1   2
 
#define RTSLOGindex_imWFS2   3
 
#define RTSLOGindex_modeval   4
 
#define RTSLOGindex_modeval_dm   5
 
#define RTSLOGindex_modeval_dm_corr   6
 
#define RTSLOGindex_modeval_dm_now   7
 
#define RTSLOGindex_modeval_dm_now_filt   8
 
#define RTSLOGindex_modevalPF   9
 
#define RTSLOGindex_modevalPFsync   10
 
#define RTSLOGindex_modevalPFres   11
 
#define RTSLOGindex_modeval_ol   12
 
#define RTSLOGindex_dmC   13
 
#define RTSLOGindex_dmdisp   14
 

Functions

void __attribute__ ((constructor)) libinit_AOloopControl()
 
int AOloopControl_bogusfunc ()
 
int AOloopControl_aorun_GUI (long loop, double frequ)
 
float AOloopControl_readParam_float (char *paramname, float defaultValue, FILE *fplog)
 Read parameter value - float, char or int - AOloopControl_read_param.c. More...
 
int AOloopControl_readParam_int (char *paramname, int defaultValue, FILE *fplog)
 read parameters int More...
 
char * AOloopControl_readParam_string (char *paramname, char *defaultValue, FILE *fplog)
 read parameters string More...
 
AOloopControl - 1. INITIALIZATION, configurations

Allocate memory, import/export configurations AOloopControl_loadconfigure.c - AOloopControl_initmem.c

errno_t AOloopControl_loadconfigure (long loop, int mode, int level)
 Load configuation parameters from disk - AOloopControl_loadconfigure.c. More...
 
errno_t AOloopControl_InitializeMemory (int mode)
 Initialize memory - function called within C code only (no CLI call) More...
 
AOloopControl - 2. REAL TIME COMPUTING ROUTINES - AOloopControl.c, AOloopControl_wfs.c

calls CPU and GPU processing

errno_t AOloopControl_WFSzpupdate_loop (const char *IDzpdm_name, const char *IDzrespM_name, const char *IDwfszp_name)
 WFS zero point update. More...
 
errno_t AOloopControl_WFSzeropoint_sum_update_loop (long loopnb, const char *ID_WFSzp_name, int NBzp, const char *IDwfsref0_name, const char *IDwfsref_name)
 WFS sum zero point update. More...
 
int AOloopControl_aorun_RUN (char *fpsname)
 Main loop function. More...
 
int AOloopControl_aorun_FPCONF (char *fpsname, uint32_t CMDmode)
 
errno_t AOloopControl_aorun ()
 
errno_t ControlMatrixMultiply (float *cm_array, float *imarray, long m, long n, float *outvect)
 CPU based matrix-vector multiplication - when no GPU. More...
 
errno_t set_DM_modes (long loop)
 Sends modal commands to DM by matrix-vector multiplication. More...
 
errno_t set_DM_modesRM (long loop)
 Response Matrix DM-WFS. More...
 
errno_t AOcompute (long loop, int normalize)
 Main computation function, runs once per loop iteration. More...
 
errno_t AOloopControl_CompModes_loop (const char *ID_CM_name, const char *ID_WFSref_name, const char *ID_WFSim_name, const char *ID_WFSimtot_name, const char *ID_coeff_name)
 Main computation function, runs once per loop iteration. More...
 
errno_t AOloopControl_GPUmodecoeffs2dm_filt_loop (const int GPUMATMULTCONFindex, const char *modecoeffs_name, const char *DMmodes_name, int semTrigg, const char *out_name, int GPUindex, long loop, int offloadMode)
 Matrix multiplication on GPU to transfom modes coefficients into DM shape. More...
 
long AOloopControl_sig2Modecoeff (const char *WFSim_name, const char *IDwfsref_name, const char *WFSmodes_name, const char *outname)
 CPU matrix multiplication to transfom WFS signal into modes coefficients. More...
 
long AOloopControl_computeWFSresidualimage (long loop, char *IDalpha_name)
 Compute WFS residual image. More...
 
imageID __attribute__ ((hot)) AOloopControl_ProcessModeCoefficients(long loop)
 Compute modes in open loop. More...
 
errno_t AOloopControl_AutoTuneGains (long loop, const char *IDout_name, float GainCoeff, long NBsamples)
 Auto tune gains of the closed loop. More...
 
long AOloopControl_dm2dm_offload (const char *streamin, const char *streamout, float twait, float offcoeff, float multcoeff)
 Mixes streamin into streamout, in order to make streamout converge to streamin. More...
 
AOloopControl - 3. LOOP CONTROL INTERFACE - AOloopControl_loop_ctr.c

Set parameters

errno_t AOloopControl_setLoopNumber (long loop)
 Set loop number. Ex : for the Pyramid WFS, loop number = 0. More...
 
errno_t AOloopControl_setparam (long loop, const char *key, double value)
 Set one function for many parameters. More...
 
AOloopControl - 3.1. LOOP CONTROL INTERFACE - MAIN CONTROL : LOOP ON/OFF START/STOP/STEP/RESET

Set parameters - AOloopControl_loop_onoff.c

errno_t AOloopControl_loopon ()
 Close AO loop : AO on. More...
 
errno_t AOloopControl_loopoff ()
 Open AO loop : AO off. More...
 
errno_t AOloopControl_loopWFScompon ()
 Close AO loop : AO on. More...
 
errno_t AOloopControl_loopWFScompoff ()
 Open AO loop : AO off. More...
 
errno_t AOloopControl_loopkill ()
 Kill AO loop : finish the process of the run. More...
 
errno_t AOloopControl_loopstep (long loop, long NBstep)
 Close loop for finite number of steps. More...
 
errno_t AOloopControl_loopreset ()
 Reset the AO loop. More...
 
AOloopControl - 3.2. LOOP CONTROL INTERFACE - DATA LOGGING
errno_t AOloopControl_logon ()
 Log on the AO interface. More...
 
errno_t AOloopControl_logoff ()
 Log off AO interface. More...
 
AOloopControl - 3.3. LOOP CONTROL INTERFACE - PRIMARY AND FILTERED DM WRITE - AOloopControl_dmwrite.c
errno_t AOloopControl_DMprimaryWrite_on ()
 Writing on DM, unfiltered actuators (primary) : on. More...
 
errno_t AOloopControl_DMprimaryWrite_off ()
 Writing on DM, unfiltered actuators (primary) : off. More...
 
errno_t AOloopControl_DMfilteredWrite_on ()
 Writing on DM, after filtering : on. More...
 
errno_t AOloopControl_DMfilteredWrite_off ()
 Writing on DM, after filtering : off. More...
 
AOloopControl - 3.4. LOOP CONTROL INTERFACE - INTEGRATOR AUTO TUNING - AOloopControl_autotune.c
errno_t AOloopControl_AUTOTUNE_LIMITS_on ()
 Set limit auto tune : on. More...
 
errno_t AOloopControl_AUTOTUNE_LIMITS_off ()
 Set limit auto tune : off. More...
 
errno_t AOloopControl_set_AUTOTUNE_LIMITS_delta (float AUTOTUNE_LIMITS_delta)
 Options auto tune limit The limit is fixed at the beginning. When the fraction of mode values higher than the current limit times mcoeff is larger than perc (percentile); then the limit increases by delta. Otherwise, it decreases by delta. More...
 
errno_t AOloopControl_set_AUTOTUNE_LIMITS_perc (float AUTOTUNE_LIMITS_perc)
 
errno_t AOloopControl_set_AUTOTUNE_LIMITS_mcoeff (float AUTOTUNE_LIMITS_mcoeff)
 
errno_t AOloopControl_AUTOTUNE_GAINS_on ()
 Set gain auto tune : on. More...
 
errno_t AOloopControl_AUTOTUNE_GAINS_off ()
 Set gain auto tune : off. More...
 
AOloopControl - 3.5. LOOP CONTROL INTERFACE - PREDICTIVE FILTER ON/OFF AOloopControl_arpf_onoff.c
errno_t AOloopControl_ARPFon ()
 ARPF = auto regressive predictive filter: on. More...
 
errno_t AOloopControl_ARPFoff ()
 ARPF = auto regressive predictive filter: off. More...
 
AOloopControl - 3.6. LOOP CONTROL INTERFACE - TIMING PARAMETERS - AOloopControl_time_param.c
errno_t AOloopControl_set_loopfrequ (float loopfrequ)
 Set AO loop frequency. More...
 
errno_t AOloopControl_set_hardwlatency_frame (float hardwlatency_frame)
 Set hardware latency in unity of frame. More...
 
errno_t AOloopControl_set_complatency_frame (float complatency_frame)
 Set computation latency of primary DM write in unity of frame. More...
 
errno_t AOloopControl_set_wfsmextrlatency_frame (float wfsmextrlatency_frame)
 Set computation latency of filtered DM write mode time between the moment where the WF arrives at the WFS, and when it's written in the DM. More...
 
AOloopControl - 3.7. LOOP CONTROL INTERFACE - CONTROL LOOP PARAMETERS - AOloopControl_loop_param.c
errno_t AOloopControl_setRTLOG_ON ()
 
errno_t AOloopControl_setRTLOG_OFF ()
 
errno_t AOloopControl_setgain (float gain)
 Set gain of the loop. More...
 
errno_t AOloopControl_setARPFgain (float gain)
 Set ARPF gain (auto regressive predictive filter) Ex : a gain of 0.5 will correct 50% of the predicted WF. More...
 
errno_t AOloopControl_setARPFgainAutoMin (float val)
 Set ARPF. More...
 
errno_t AOloopControl_setARPFgainAutoMax (float val)
 Set ARPF. More...
 
errno_t AOloopControl_setWFSnormfloor (float WFSnormfloor)
 Coefficient attenuates AO correction in low loght level. More...
 
errno_t AOloopControl_setmaxlimit (float maxlimit)
 Set the limit maximum. More...
 
errno_t AOloopControl_setmult (float multcoeff)
 Multiplying coefficient, close to 1, in order to avoid divergence. More...
 
errno_t AOloopControl_setframesAve (long nbframes)
 Set an average of frames. More...
 
errno_t AOloopControl_set_modeblock_gain (long loop, long blocknb, float gain, int add)
 Set gain of block of modes. More...
 
errno_t AOloopControl_scanGainBlock (long NBblock, long NBstep, float gainStart, float gainEnd, long NBgain)
 Scan block gains. More...
 
AOloopControl - 4. FOCAL PLANE SPECKLE MODULATION / CONTROL - AOloopControl_fpspeckle_mod.c

custom FP AO routines

errno_t AOloopControl_OptimizePSF_LO (const char *psfstream_name, const char *IDmodes_name, const char *dmstream_name, long delayframe, long NBframes)
 Optimize PSF low order. More...
 
errno_t AOloopControl_DMmodulateAB (const char *IDprobeA_name, const char *IDprobeB_name, const char *IDdmstream_name, const char *IDrespmat_name, const char *IDwfsrefstream_name, double delay, long NBprobes)
 Experimental dm modulation. More...
 
AOloopControl - 5. PROCESS LOG FILES - AOloopControl_process_files.c

process log files

errno_t AOloopControl_logprocess_modeval (const char *IDname)
 Log the process of the mode evaluation. More...
 
errno_t AOloopControl_TweakRM (char *ZRMinname, char *DMinCname, char *WFSinCname, char *DMmaskname, char *WFSmaskname, char *RMoutname)
 tweak zonal response matrix in accordance to WFS response to modes More...
 
AOloopControl - 6. REAL-TIME LOGGING - AOloopControl_RTstreamLOG.c

Log real-time streams

errno_t AOloopControl_RTstreamLOG_init (int loop)
 
errno_t AOloopControl_RTstreamLOG_setup (long loop, long rtlindex, char *streamname)
 
void AOloopControl_RTstreamLOG_update (long loop, long rtlindex, struct timespec tnow)
 
int AOloopControl_RTstreamLOG_printstatus (int loop)
 
int AOloopControl_RTstreamLOG_GUI (int loop)
 
int AOloopControl_RTstreamLOG_saveloop (int loop, char *dirname)
 
int AOloopControl_RTstreamLOG_set_saveON (int loop, int rtlindex)
 
int AOloopControl_RTstreamLOG_set_saveOFF (int loop, int rtlindex)
 
int AOloopControl_RTstreamLOG_set_ON (int loop, int rtlindex)
 
int AOloopControl_RTstreamLOG_set_OFF (int loop, int rtlindex)
 
AOloopControl - 7. OBSOLETE ?
errno_t AOloopControl_setgainrange (long m0, long m1, float gainval)
 
errno_t AOloopControl_setlimitrange (long m0, long m1, float limval)
 
errno_t AOloopControl_setmultfrange (long m0, long m1, float multfval)
 
errno_t AOloopControl_setgainblock (long mb, float gainval)
 
errno_t AOloopControl_setlimitblock (long mb, float limitval)
 
errno_t AOloopControl_setmultfblock (long mb, float multfval)
 
errno_t AOloopControl_AutoTune ()
 

Detailed Description

Function prototypes for Adaptive Optics Control loop engine.

AO engine uses stream data structure

Macro Definition Documentation

◆ _AOLOOPCONTROL_H

#define _AOLOOPCONTROL_H

◆ MAX_NUMBER_RTLOGSTREAM

#define MAX_NUMBER_RTLOGSTREAM   20

◆ MAX_NUMBER_TIMER

#define MAX_NUMBER_TIMER   100

◆ RTSLOGindex_dmC

#define RTSLOGindex_dmC   13

◆ RTSLOGindex_dmdisp

#define RTSLOGindex_dmdisp   14

◆ RTSLOGindex_imWFS0

#define RTSLOGindex_imWFS0   1

◆ RTSLOGindex_imWFS1

#define RTSLOGindex_imWFS1   2

◆ RTSLOGindex_imWFS2

#define RTSLOGindex_imWFS2   3

◆ RTSLOGindex_modeval

#define RTSLOGindex_modeval   4

◆ RTSLOGindex_modeval_dm

#define RTSLOGindex_modeval_dm   5

◆ RTSLOGindex_modeval_dm_corr

#define RTSLOGindex_modeval_dm_corr   6

◆ RTSLOGindex_modeval_dm_now

#define RTSLOGindex_modeval_dm_now   7

◆ RTSLOGindex_modeval_dm_now_filt

#define RTSLOGindex_modeval_dm_now_filt   8

◆ RTSLOGindex_modeval_ol

#define RTSLOGindex_modeval_ol   12

◆ RTSLOGindex_modevalPF

#define RTSLOGindex_modevalPF   9

◆ RTSLOGindex_modevalPFres

#define RTSLOGindex_modevalPFres   11

◆ RTSLOGindex_modevalPFsync

#define RTSLOGindex_modevalPFsync   10

◆ RTSLOGindex_wfsim

#define RTSLOGindex_wfsim   0

Function Documentation

◆ __attribute__() [1/2]

void __attribute__ ( (constructor)  )

◆ __attribute__() [2/2]

imageID __attribute__ ( (hot)  )

Compute modes in open loop.

Purpose

Main computation routine.
AOcompute() is called inside the aorun loop.
AOcompute main steps are:

  • Read WFS image (call to Read_cam_frame())
  • Process WFS frame
  • Multiply by control matrix

Arguments

Parameters
[in]paramnamelong number of the loop
[in]paramnameint normalize

Purpose

Main AO loop function

Overview

Runs the AO loop
Calls AOcompute(), which computes the correction to the applied.
Then, the correction is applied by calling set_DM_modes() if modal correction, or by direct write to the DM otherwise.

Details

Compute modes in open loop.

Purpose

Reads WFS image and performs some basic processing

Outputs are : imWFS0, which is dark-subtracted imWFS1, which is dark-subtracted and normalized, but not reference-subtracted.

supports ring buffer puts image from camera buffer aoloopcontrol_var.aoconfID_wfsim into aoloopcontrol_var.aoconfID_imWFS1 (supplied by user)

RM = 1 if response matrix

if normalize == 1, image is normalized by dividing by (total + AOconf[loop].WFSim.WFSnormfloor)*AOconf[loop].WFSim.WFSsize if PixelStreamMode = 1, read on semaphore 1, return slice index

logs a shared memory stream onto disk uses semlog semaphore

uses data cube buffer to store frames if an image name logdata exists (should ideally be in shared mem), then this will be included in the timing txt file

STEP 1: Setting up

Load arrays

create the 2 buffers

measure time

measure time

cases: index>zsize-1 buffer full timeout==1 && index>0 : partial

save image

◆ AOcompute()

errno_t AOcompute ( long  loop,
int  normalize 
)

Main computation function, runs once per loop iteration.

◆ AOloopControl_aorun()

errno_t AOloopControl_aorun ( )

◆ AOloopControl_aorun_FPCONF()

int AOloopControl_aorun_FPCONF ( char *  fpsname,
uint32_t  CMDmode 
)

◆ AOloopControl_aorun_GUI()

int AOloopControl_aorun_GUI ( long  loop,
double  frequ 
)

◆ AOloopControl_aorun_RUN()

int AOloopControl_aorun_RUN ( char *  fpsname)

Main loop function.

◆ AOloopControl_ARPFoff()

errno_t AOloopControl_ARPFoff ( )

ARPF = auto regressive predictive filter: off.

◆ AOloopControl_ARPFon()

errno_t AOloopControl_ARPFon ( )

ARPF = auto regressive predictive filter: on.

◆ AOloopControl_AutoTune()

errno_t AOloopControl_AutoTune ( )

◆ AOloopControl_AUTOTUNE_GAINS_off()

errno_t AOloopControl_AUTOTUNE_GAINS_off ( )

Set gain auto tune : off.

◆ AOloopControl_AUTOTUNE_GAINS_on()

errno_t AOloopControl_AUTOTUNE_GAINS_on ( )

Set gain auto tune : on.

◆ AOloopControl_AUTOTUNE_LIMITS_off()

errno_t AOloopControl_AUTOTUNE_LIMITS_off ( )

Set limit auto tune : off.

◆ AOloopControl_AUTOTUNE_LIMITS_on()

errno_t AOloopControl_AUTOTUNE_LIMITS_on ( )

Set limit auto tune : on.

◆ AOloopControl_AutoTuneGains()

errno_t AOloopControl_AutoTuneGains ( long  loop,
const char *  IDout_name,
float  GainCoeff,
long  NBsamples 
)

Auto tune gains of the closed loop.

◆ AOloopControl_bogusfunc()

int AOloopControl_bogusfunc ( )

◆ AOloopControl_CompModes_loop()

errno_t AOloopControl_CompModes_loop ( const char *  ID_CM_name,
const char *  ID_WFSref_name,
const char *  ID_WFSim_name,
const char *  ID_WFSimtot_name,
const char *  ID_coeff_name 
)

Main computation function, runs once per loop iteration.

◆ AOloopControl_computeWFSresidualimage()

long AOloopControl_computeWFSresidualimage ( long  loop,
char *  IDalpha_name 
)

Compute WFS residual image.

Purpose

Computes average of residual in WFS

Arguments

Parameters
[in]loopINT loop number
[in]alphaFLOAT averaging coefficient

Output files

  • aol_wfsres_ave
  • aol_wfsres_ave
  • aol_wfsresm
  • aol_wfsresm_ave
  • aol_wfsres_rms

◆ AOloopControl_dm2dm_offload()

long AOloopControl_dm2dm_offload ( const char *  streamin,
const char *  streamout,
float  twait,
float  offcoeff,
float  multcoeff 
)

Mixes streamin into streamout, in order to make streamout converge to streamin.

◆ AOloopControl_DMfilteredWrite_off()

errno_t AOloopControl_DMfilteredWrite_off ( )

Writing on DM, after filtering : off.

◆ AOloopControl_DMfilteredWrite_on()

errno_t AOloopControl_DMfilteredWrite_on ( )

Writing on DM, after filtering : on.

◆ AOloopControl_DMmodulateAB()

errno_t AOloopControl_DMmodulateAB ( const char *  IDprobeA_name,
const char *  IDprobeB_name,
const char *  IDdmstream_name,
const char *  IDrespmat_name,
const char *  IDwfsrefstream_name,
double  delay,
long  NBprobes 
)

Experimental dm modulation.

◆ AOloopControl_DMprimaryWrite_off()

errno_t AOloopControl_DMprimaryWrite_off ( )

Writing on DM, unfiltered actuators (primary) : off.

◆ AOloopControl_DMprimaryWrite_on()

errno_t AOloopControl_DMprimaryWrite_on ( )

Writing on DM, unfiltered actuators (primary) : on.

◆ AOloopControl_GPUmodecoeffs2dm_filt_loop()

errno_t AOloopControl_GPUmodecoeffs2dm_filt_loop ( const int  GPUMATMULTCONFindex,
const char *  modecoeffs_name,
const char *  DMmodes_name,
int  semTrigg,
const char *  out_name,
int  GPUindex,
long  loop,
int  offloadMode 
)

Matrix multiplication on GPU to transfom modes coefficients into DM shape.

Purpose

Compute DM map from mode values. This is a separate process

If offloadMode = 1, apply correction to aol::_dmC

◆ AOloopControl_logoff()

errno_t AOloopControl_logoff ( )

Log off AO interface.

◆ AOloopControl_logon()

errno_t AOloopControl_logon ( )

Log on the AO interface.

◆ AOloopControl_logprocess_modeval()

errno_t AOloopControl_logprocess_modeval ( const char *  IDname)

Log the process of the mode evaluation.

◆ AOloopControl_loopkill()

errno_t AOloopControl_loopkill ( )

Kill AO loop : finish the process of the run.

◆ AOloopControl_loopoff()

errno_t AOloopControl_loopoff ( )

Open AO loop : AO off.

◆ AOloopControl_loopon()

errno_t AOloopControl_loopon ( )

Close AO loop : AO on.

◆ AOloopControl_loopreset()

errno_t AOloopControl_loopreset ( )

Reset the AO loop.

◆ AOloopControl_loopstep()

errno_t AOloopControl_loopstep ( long  loop,
long  NBstep 
)

Close loop for finite number of steps.

◆ AOloopControl_loopWFScompoff()

errno_t AOloopControl_loopWFScompoff ( )

Open AO loop : AO off.

◆ AOloopControl_loopWFScompon()

errno_t AOloopControl_loopWFScompon ( )

Close AO loop : AO on.

◆ AOloopControl_OptimizePSF_LO()

errno_t AOloopControl_OptimizePSF_LO ( const char *  psfstream_name,
const char *  IDmodes_name,
const char *  dmstream_name,
long  delayframe,
long  NBframes 
)

Optimize PSF low order.

◆ AOloopControl_readParam_float()

float AOloopControl_readParam_float ( char *  paramname,
float  defaultValue,
FILE *  fplog 
)

Read parameter value - float, char or int - AOloopControl_read_param.c.

read parameters float

Read parameter value - float, char or int - AOloopControl_read_param.c.

Purpose

Read parameter value (float) from file

Arguments

Parameters
[in]paramnameCHAR* parameter name
[in]defaultValueFLOAT default value if file conf/param_paramname.txt not found
[in]fplogFILE* log file. If NULL, do not log

◆ AOloopControl_readParam_int()

int AOloopControl_readParam_int ( char *  paramname,
int  defaultValue,
FILE *  fplog 
)

read parameters int

Purpose

Read parameter value (int) from file

Arguments

Parameters
[in]paramnameCHAR* parameter name
[in]defaultValueINT default value if file conf/param_paramname.txt not found
[in]fplogFILE* log file. If NULL, do not log

◆ AOloopControl_readParam_string()

char* AOloopControl_readParam_string ( char *  paramname,
char *  defaultValue,
FILE *  fplog 
)

read parameters string

Purpose

Read parameter value (char*) from file

Arguments

Parameters
[in]paramnameCHAR* parameter name
[in]defaultValueCHAR* default value if file conf/param_paramname.txt not found
[in]fplogFILE* log file. If NULL, do not log

◆ AOloopControl_RTstreamLOG_GUI()

int AOloopControl_RTstreamLOG_GUI ( int  loop)

◆ AOloopControl_RTstreamLOG_init()

errno_t AOloopControl_RTstreamLOG_init ( int  loop)

◆ AOloopControl_RTstreamLOG_printstatus()

int AOloopControl_RTstreamLOG_printstatus ( int  loop)

◆ AOloopControl_RTstreamLOG_saveloop()

int AOloopControl_RTstreamLOG_saveloop ( int  loop,
char *  dirname 
)

Purpose

Monitors multiple real-time AO loop buffers and saves them to disk

Arguments

Loop index and save directory on disk

Use

This function runs in a dedicated in a dedicated tmux session.
It is controlled by a ncurses-based GUI.

Details

Each real-time process maintains, for each streams, small alternating buffers where data is written at high speed. Timing/indexing buffers are also written.

This function monitors the small buffers. When a small buffer is ready/filled, it is included in a larger buffer which can be saved to disk.

The routine is designed to only occupy two threads: one to monitor, one to save

Takes timing data from the processes that create the data to achieve high performance timing

Initialization

Intialize :

  • time conversion information
  • AOloopControl memory
  • save thread message array
  • processinfo

◆ AOloopControl_RTstreamLOG_set_OFF()

int AOloopControl_RTstreamLOG_set_OFF ( int  loop,
int  rtlindex 
)

◆ AOloopControl_RTstreamLOG_set_ON()

int AOloopControl_RTstreamLOG_set_ON ( int  loop,
int  rtlindex 
)

◆ AOloopControl_RTstreamLOG_set_saveOFF()

int AOloopControl_RTstreamLOG_set_saveOFF ( int  loop,
int  rtlindex 
)

◆ AOloopControl_RTstreamLOG_set_saveON()

int AOloopControl_RTstreamLOG_set_saveON ( int  loop,
int  rtlindex 
)

◆ AOloopControl_RTstreamLOG_setup()

errno_t AOloopControl_RTstreamLOG_setup ( long  loop,
long  rtlindex,
char *  streamname 
)

PURPOSE

Setup RT stream for logging

Creates required buffers

◆ AOloopControl_RTstreamLOG_update()

void AOloopControl_RTstreamLOG_update ( long  loop,
long  rtlindex,
struct timespec  tnow 
)

Purpose

Write single entry in log buffer

This function is called by the process writing to the stream to minimize IPC need and reduce logging latency

◆ AOloopControl_scanGainBlock()

errno_t AOloopControl_scanGainBlock ( long  NBblock,
long  NBstep,
float  gainStart,
float  gainEnd,
long  NBgain 
)

Scan block gains.

◆ AOloopControl_set_AUTOTUNE_LIMITS_delta()

errno_t AOloopControl_set_AUTOTUNE_LIMITS_delta ( float  AUTOTUNE_LIMITS_delta)

Options auto tune limit The limit is fixed at the beginning. When the fraction of mode values higher than the current limit times mcoeff is larger than perc (percentile); then the limit increases by delta. Otherwise, it decreases by delta.

◆ AOloopControl_set_AUTOTUNE_LIMITS_mcoeff()

errno_t AOloopControl_set_AUTOTUNE_LIMITS_mcoeff ( float  AUTOTUNE_LIMITS_mcoeff)

◆ AOloopControl_set_AUTOTUNE_LIMITS_perc()

errno_t AOloopControl_set_AUTOTUNE_LIMITS_perc ( float  AUTOTUNE_LIMITS_perc)

◆ AOloopControl_set_complatency_frame()

errno_t AOloopControl_set_complatency_frame ( float  complatency_frame)

Set computation latency of primary DM write in unity of frame.

◆ AOloopControl_set_hardwlatency_frame()

errno_t AOloopControl_set_hardwlatency_frame ( float  hardwlatency_frame)

Set hardware latency in unity of frame.

◆ AOloopControl_set_loopfrequ()

errno_t AOloopControl_set_loopfrequ ( float  loopfrequ)

Set AO loop frequency.

◆ AOloopControl_set_modeblock_gain()

errno_t AOloopControl_set_modeblock_gain ( long  loop,
long  blocknb,
float  gain,
int  add 
)

Set gain of block of modes.

◆ AOloopControl_set_wfsmextrlatency_frame()

errno_t AOloopControl_set_wfsmextrlatency_frame ( float  wfsmextrlatency_frame)

Set computation latency of filtered DM write mode time between the moment where the WF arrives at the WFS, and when it's written in the DM.

◆ AOloopControl_setARPFgain()

errno_t AOloopControl_setARPFgain ( float  gain)

Set ARPF gain (auto regressive predictive filter) Ex : a gain of 0.5 will correct 50% of the predicted WF.

◆ AOloopControl_setARPFgainAutoMax()

errno_t AOloopControl_setARPFgainAutoMax ( float  val)

Set ARPF.

◆ AOloopControl_setARPFgainAutoMin()

errno_t AOloopControl_setARPFgainAutoMin ( float  val)

Set ARPF.

◆ AOloopControl_setframesAve()

errno_t AOloopControl_setframesAve ( long  nbframes)

Set an average of frames.

◆ AOloopControl_setgain()

errno_t AOloopControl_setgain ( float  gain)

Set gain of the loop.

◆ AOloopControl_setgainblock()

errno_t AOloopControl_setgainblock ( long  mb,
float  gainval 
)

◆ AOloopControl_setgainrange()

errno_t AOloopControl_setgainrange ( long  m0,
long  m1,
float  gainval 
)

◆ AOloopControl_setlimitblock()

errno_t AOloopControl_setlimitblock ( long  mb,
float  limitval 
)

◆ AOloopControl_setlimitrange()

errno_t AOloopControl_setlimitrange ( long  m0,
long  m1,
float  limval 
)

◆ AOloopControl_setLoopNumber()

errno_t AOloopControl_setLoopNumber ( long  loop)

Set loop number. Ex : for the Pyramid WFS, loop number = 0.

append process name with loop number

◆ AOloopControl_setmaxlimit()

errno_t AOloopControl_setmaxlimit ( float  maxlimit)

Set the limit maximum.

◆ AOloopControl_setmult()

errno_t AOloopControl_setmult ( float  multcoeff)

Multiplying coefficient, close to 1, in order to avoid divergence.

◆ AOloopControl_setmultfblock()

errno_t AOloopControl_setmultfblock ( long  mb,
float  multfval 
)

◆ AOloopControl_setmultfrange()

errno_t AOloopControl_setmultfrange ( long  m0,
long  m1,
float  multfval 
)

◆ AOloopControl_setparam()

errno_t AOloopControl_setparam ( long  loop,
const char *  key,
double  value 
)

Set one function for many parameters.

◆ AOloopControl_setRTLOG_OFF()

errno_t AOloopControl_setRTLOG_OFF ( )

◆ AOloopControl_setRTLOG_ON()

errno_t AOloopControl_setRTLOG_ON ( )

◆ AOloopControl_setWFSnormfloor()

errno_t AOloopControl_setWFSnormfloor ( float  WFSnormfloor)

Coefficient attenuates AO correction in low loght level.

◆ AOloopControl_sig2Modecoeff()

long AOloopControl_sig2Modecoeff ( const char *  WFSim_name,
const char *  IDwfsref_name,
const char *  WFSmodes_name,
const char *  outname 
)

CPU matrix multiplication to transfom WFS signal into modes coefficients.

◆ AOloopControl_TweakRM()

errno_t AOloopControl_TweakRM ( char *  ZRMinname,
char *  DMinCname,
char *  WFSinCname,
char *  DMmaskname,
char *  WFSmaskname,
char *  RMoutname 
)

tweak zonal response matrix in accordance to WFS response to modes

◆ AOloopControl_WFSzeropoint_sum_update_loop()

errno_t AOloopControl_WFSzeropoint_sum_update_loop ( long  loopnb,
const char *  ID_WFSzp_name,
int  NBzp,
const char *  IDwfsref0_name,
const char *  IDwfsref_name 
)

WFS sum zero point update.

◆ AOloopControl_WFSzpupdate_loop()

errno_t AOloopControl_WFSzpupdate_loop ( const char *  IDzpdm_name,
const char *  IDzrespM_name,
const char *  IDwfszp_name 
)

WFS zero point update.

◆ ControlMatrixMultiply()

errno_t ControlMatrixMultiply ( float *  cm_array,
float *  imarray,
long  m,
long  n,
float *  outvect 
)

CPU based matrix-vector multiplication - when no GPU.

◆ set_DM_modes()

errno_t set_DM_modes ( long  loop)

Sends modal commands to DM by matrix-vector multiplication.

Purpose

Send modal commands to DM.
Converts mode coefficient to DM map by matrix-vector multiplication
Runs in CPU or GPU.

Takes mode values from aol_DMmode_cmd (ID = aoloopcontrol_var.aoconfID_cmd_modes)

Arguments

Parameters
[in]paramnamelong number of the loop

◆ set_DM_modesRM()

errno_t set_DM_modesRM ( long  loop)

Response Matrix DM-WFS.

Purpose

Set deformable mirror modes related to the response matrix

Takes mode values from ????????,

Arguments

Parameters
[in]paramnamelong number of the loop