cfitsTK
AOloopControl.h File Reference

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

Go to the source code of this file.

Data Structures

struct  AOLOOPCONTROL_CONF
 

Functions

int_fast8_t init_AOloopControl ()
 Initialize AOloopControl command line interface. More...
 
AOloopControl - 1. INITIALIZATION, configurations

Allocate memory, import/export configurations

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

calls CPU and GPU processing

int_fast8_t AOloopControl_WFSzpupdate_loop (const char *IDzpdm_name, const char *IDzrespM_name, const char *IDwfszp_name)
 
int_fast8_t AOloopControl_WFSzeropoint_sum_update_loop (long loopnb, const char *ID_WFSzp_name, int NBzp, const char *IDwfsref0_name, const char *IDwfsref_name)
 
int_fast8_t AOloopControl_run ()
 Main loop function. More...
 
int_fast8_t ControlMatrixMultiply (float *cm_array, float *imarray, long m, long n, float *outvect)
 
int_fast8_t set_DM_modes (long loop)
 Sends modal commands to DM by matrix-vector multiplication. More...
 
int_fast8_t set_DM_modesRM (long loop)
 
int_fast8_t AOcompute (long loop, int normalize)
 Main computation function, runs once per loop iteration. More...
 
int_fast8_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)
 
int_fast8_t AOloopControl_GPUmodecoeffs2dm_filt_loop (const char *modecoeffs_name, const char *DMmodes_name, int semTrigg, const char *out_name, int GPUindex, long loop, int offloadMode)
 
long AOloopControl_sig2Modecoeff (const char *WFSim_name, const char *IDwfsref_name, const char *WFSmodes_name, const char *outname)
 
long AOloopControl_computeWFSresidualimage (long loop, char *IDalpha_name)
 
long AOloopControl_ComputeOpenLoopModes (long loop)
 
int_fast8_t AOloopControl_AutoTuneGains (long loop, const char *IDout_name, float GainCoeff, long NBsamples)
 
long AOloopControl_dm2dm_offload (const char *streamin, const char *streamout, float twait, float offcoeff, float multcoeff)
 
AOloopControl - 8. LOOP CONTROL INTERFACE

Set parameters

int_fast8_t AOloopControl_setLoopNumber (long loop)
 
int_fast8_t AOloopControl_setparam (long loop, const char *key, double value)
 
AOloopControl - 8.1. LOOP CONTROL INTERFACE - MAIN CONTROL : LOOP ON/OFF START/STOP/STEP/RESET

Set parameters

int_fast8_t AOloopControl_loopon ()
 
int_fast8_t AOloopControl_loopoff ()
 
int_fast8_t AOloopControl_loopkill ()
 
int_fast8_t AOloopControl_loopstep (long loop, long NBstep)
 
int_fast8_t AOloopControl_loopreset ()
 
AOloopControl - 8.2. LOOP CONTROL INTERFACE - DATA LOGGING
int_fast8_t AOloopControl_logon ()
 
int_fast8_t AOloopControl_logoff ()
 
AOloopControl - 8.3. LOOP CONTROL INTERFACE - PRIMARY AND FILTERED DM WRITE
int_fast8_t AOloopControl_DMprimaryWrite_on ()
 
int_fast8_t AOloopControl_DMprimaryWrite_off ()
 
int_fast8_t AOloopControl_DMfilteredWrite_on ()
 
int_fast8_t AOloopControl_DMfilteredWrite_off ()
 
AOloopControl - 8.4. LOOP CONTROL INTERFACE - INTEGRATOR AUTO TUNING
int_fast8_t AOloopControl_AUTOTUNE_LIMITS_on ()
 
int_fast8_t AOloopControl_AUTOTUNE_LIMITS_off ()
 
int_fast8_t AOloopControl_set_AUTOTUNE_LIMITS_delta (float AUTOTUNE_LIMITS_delta)
 
int_fast8_t AOloopControl_set_AUTOTUNE_LIMITS_perc (float AUTOTUNE_LIMITS_perc)
 
int_fast8_t AOloopControl_set_AUTOTUNE_LIMITS_mcoeff (float AUTOTUNE_LIMITS_mcoeff)
 
int_fast8_t AOloopControl_AUTOTUNE_GAINS_on ()
 
int_fast8_t AOloopControl_AUTOTUNE_GAINS_off ()
 
AOloopControl - 8.5. LOOP CONTROL INTERFACE - PREDICTIVE FILTER ON/OFF
int_fast8_t AOloopControl_ARPFon ()
 
int_fast8_t AOloopControl_ARPFoff ()
 
AOloopControl - 8.6. LOOP CONTROL INTERFACE - TIMING PARAMETERS
int_fast8_t AOloopControl_set_loopfrequ (float loopfrequ)
 
int_fast8_t AOloopControl_set_hardwlatency_frame (float hardwlatency_frame)
 
int_fast8_t AOloopControl_set_complatency_frame (float complatency_frame)
 
int_fast8_t AOloopControl_set_wfsmextrlatency_frame (float wfsmextrlatency_frame)
 
AOloopControl - 8.7. LOOP CONTROL INTERFACE - CONTROL LOOP PARAMETERS
int_fast8_t AOloopControl_setgain (float gain)
 
int_fast8_t AOloopControl_setARPFgain (float gain)
 
int_fast8_t AOloopControl_setWFSnormfloor (float WFSnormfloor)
 
int_fast8_t AOloopControl_setmaxlimit (float maxlimit)
 
int_fast8_t AOloopControl_setmult (float multcoeff)
 
int_fast8_t AOloopControl_setframesAve (long nbframes)
 
int_fast8_t AOloopControl_set_modeblock_gain (long loop, long blocknb, float gain, int add)
 
int_fast8_t AOloopControl_scanGainBlock (long NBblock, long NBstep, float gainStart, float gainEnd, long NBgain)
 
AOloopControl - 10. FOCAL PLANE SPECKLE MODULATION / CONTROL

custom FP AO routines

int_fast8_t AOloopControl_OptimizePSF_LO (const char *psfstream_name, const char *IDmodes_name, const char *dmstream_name, long delayframe, long NBframes)
 
int_fast8_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)
 
AOloopControl - 11. PROCESS LOG FILES

process log files

int_fast8_t AOloopControl_logprocess_modeval (const char *IDname)
 
AOloopControl - 12. OBSOLETE ?
int_fast8_t AOloopControl_setgainrange (long m0, long m1, float gainval)
 
int_fast8_t AOloopControl_setlimitrange (long m0, long m1, float limval)
 
int_fast8_t AOloopControl_setmultfrange (long m0, long m1, float multfval)
 
int_fast8_t AOloopControl_setgainblock (long mb, float gainval)
 
int_fast8_t AOloopControl_setlimitblock (long mb, float limitval)
 
int_fast8_t AOloopControl_setmultfblock (long mb, float multfval)
 
int_fast8_t AOloopControl_AutoTune ()
 

Variables

static int loadcreateshm_log = 0
 
static FILE * loadcreateshm_fplog
 

Detailed Description

Function prototypes for Adaptive Optics Control loop engine.

AO engine uses stream data structure

Author
O. Guyon
Date
26 Aug 2017
Bug:
No known bugs.

Function Documentation

int_fast8_t AOcompute ( long  loop,
int  normalize 
)

Main computation function, runs once per loop iteration.

int_fast8_t AOloopControl_ARPFoff ( )
int_fast8_t AOloopControl_ARPFon ( )
int_fast8_t AOloopControl_AutoTune ( )
int_fast8_t AOloopControl_AUTOTUNE_GAINS_off ( )
int_fast8_t AOloopControl_AUTOTUNE_GAINS_on ( )
int_fast8_t AOloopControl_AUTOTUNE_LIMITS_off ( )
int_fast8_t AOloopControl_AUTOTUNE_LIMITS_on ( )
int_fast8_t AOloopControl_AutoTuneGains ( long  loop,
const char *  IDout_name,
float  GainCoeff,
long  NBsamples 
)
int_fast8_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 
)
long AOloopControl_ComputeOpenLoopModes ( long  loop)
long AOloopControl_computeWFSresidualimage ( long  loop,
char *  IDalpha_name 
)

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
long AOloopControl_dm2dm_offload ( const char *  streamin,
const char *  streamout,
float  twait,
float  offcoeff,
float  multcoeff 
)
int_fast8_t AOloopControl_DMfilteredWrite_off ( )
int_fast8_t AOloopControl_DMfilteredWrite_on ( )
int_fast8_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 
)
int_fast8_t AOloopControl_DMprimaryWrite_off ( )
int_fast8_t AOloopControl_DMprimaryWrite_on ( )
int_fast8_t AOloopControl_GPUmodecoeffs2dm_filt_loop ( const char *  modecoeffs_name,
const char *  DMmodes_name,
int  semTrigg,
const char *  out_name,
int  GPUindex,
long  loop,
int  offloadMode 
)
int_fast8_t AOloopControl_logoff ( )
int_fast8_t AOloopControl_logon ( )
int_fast8_t AOloopControl_logprocess_modeval ( const char *  IDname)
int_fast8_t AOloopControl_loopkill ( )
int_fast8_t AOloopControl_loopoff ( )
int_fast8_t AOloopControl_loopon ( )
int_fast8_t AOloopControl_loopreset ( )
int_fast8_t AOloopControl_loopstep ( long  loop,
long  NBstep 
)
int_fast8_t AOloopControl_OptimizePSF_LO ( const char *  psfstream_name,
const char *  IDmodes_name,
const char *  dmstream_name,
long  delayframe,
long  NBframes 
)
int_fast8_t AOloopControl_run ( )

Main loop function.

Purpose

Main AO loop function

Details

STEP 1: Setting up

Load arrays

int_fast8_t AOloopControl_scanGainBlock ( long  NBblock,
long  NBstep,
float  gainStart,
float  gainEnd,
long  NBgain 
)
int_fast8_t AOloopControl_set_AUTOTUNE_LIMITS_delta ( float  AUTOTUNE_LIMITS_delta)
int_fast8_t AOloopControl_set_AUTOTUNE_LIMITS_mcoeff ( float  AUTOTUNE_LIMITS_mcoeff)
int_fast8_t AOloopControl_set_AUTOTUNE_LIMITS_perc ( float  AUTOTUNE_LIMITS_perc)
int_fast8_t AOloopControl_set_complatency_frame ( float  complatency_frame)
int_fast8_t AOloopControl_set_hardwlatency_frame ( float  hardwlatency_frame)
int_fast8_t AOloopControl_set_loopfrequ ( float  loopfrequ)
int_fast8_t AOloopControl_set_modeblock_gain ( long  loop,
long  blocknb,
float  gain,
int  add 
)
int_fast8_t AOloopControl_set_wfsmextrlatency_frame ( float  wfsmextrlatency_frame)
int_fast8_t AOloopControl_setARPFgain ( float  gain)
int_fast8_t AOloopControl_setframesAve ( long  nbframes)
int_fast8_t AOloopControl_setgain ( float  gain)
int_fast8_t AOloopControl_setgainblock ( long  mb,
float  gainval 
)
int_fast8_t AOloopControl_setgainrange ( long  m0,
long  m1,
float  gainval 
)
int_fast8_t AOloopControl_setlimitblock ( long  mb,
float  limitval 
)
int_fast8_t AOloopControl_setlimitrange ( long  m0,
long  m1,
float  limval 
)
int_fast8_t AOloopControl_setLoopNumber ( long  loop)

append process name with loop number

int_fast8_t AOloopControl_setmaxlimit ( float  maxlimit)
int_fast8_t AOloopControl_setmult ( float  multcoeff)
int_fast8_t AOloopControl_setmultfblock ( long  mb,
float  multfval 
)
int_fast8_t AOloopControl_setmultfrange ( long  m0,
long  m1,
float  multfval 
)
int_fast8_t AOloopControl_setparam ( long  loop,
const char *  key,
double  value 
)
int_fast8_t AOloopControl_setWFSnormfloor ( float  WFSnormfloor)
long AOloopControl_sig2Modecoeff ( const char *  WFSim_name,
const char *  IDwfsref_name,
const char *  WFSmodes_name,
const char *  outname 
)
int_fast8_t AOloopControl_WFSzeropoint_sum_update_loop ( long  loopnb,
const char *  ID_WFSzp_name,
int  NBzp,
const char *  IDwfsref0_name,
const char *  IDwfsref_name 
)
int_fast8_t AOloopControl_WFSzpupdate_loop ( const char *  IDzpdm_name,
const char *  IDzrespM_name,
const char *  IDwfszp_name 
)
int_fast8_t ControlMatrixMultiply ( float *  cm_array,
float *  imarray,
long  m,
long  n,
float *  outvect 
)
int_fast8_t init_AOloopControl ( )

Initialize AOloopControl command line interface.

int_fast8_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 = aoconfID_cmd_modes)

int_fast8_t set_DM_modesRM ( long  loop)

Variable Documentation

FILE* loadcreateshm_fplog
static
int loadcreateshm_log = 0
static