cacao  Release 0.1.03-dev
Compute And Control For Adaptive Optics
Image streams

Functions

int_fast8_t AOloopControl_loadconfigure_cli ()
 Load / Setup configuration. More...
 
errno_t AOloopControl_loadconfigure (long loop, int mode, int level)
 Load / Setup configuration. More...
 

AOloopControl - 1. INITIALIZATION, configurations

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

errno_t AOloopControl_InitializeMemory (int mode)
 Initialize memory - function called within C code only (no CLI call) More...
 

Detailed Description

Function Documentation

◆ AOloopControl_InitializeMemory()

errno_t AOloopControl_InitializeMemory ( int  mode)

Initialize memory - function called within C code only (no CLI call)

Purpose

Initialize memory of the loop

Arguments

Parameters
[in]modeint
  • 0 initialize memory when connecting
  • 1 connect only, do not modify/initialize

◆ AOloopControl_loadconfigure()

errno_t AOloopControl_loadconfigure ( long  loop,
int  mode,
int  level 
)

Load / Setup configuration.

Load configuation parameters from disk - AOloopControl_loadconfigure.c.

Purpose

load / setup configuration - amazingly loooong function, I am proud of you Boss !

Arguments

Parameters
[in]loopINT Loop number
[in]modeINT
  • 1 loads from ./conf/ directory to shared memory
  • 0 simply connects to shared memory
[in]levelINT
  • 2 zonal only
  • 10+ load all

Details

1. Initial setup from configuration files

  • 1.1. Initialize memory

1.2. Set names of key streams

  • dmC stream : DM control
  • dmdisp stream : total DM displacement
  • dmRM stream : response matrix
  • wfsim : WFS image
  • DMmodes : control modes
  • respM : response matrix
  • contrM : control matrix

1.3. Read loop name

  • ./conf/conf_LOOPNAME.txt -> AOconf[loop].name

1.4. Define WFS image normalization mode

  • conf/param_WFSnorm.txt -> AOconf[loop].WFSim.WFSnormalize

1.5. Read Timing info

  • ./conf/param_loopfrequ.txt -> AOconf[loop].AOtiminginfo.loopfrequ
  • ./conf/param_hardwlatency.txt -> AOconf[loop].AOtiminginfo.hardwlatency
  • AOconf[loop].AOtiminginfo.hardwlatency_frame = AOconf[loop].AOtiminginfo.hardwlatency * AOconf[loop].AOloopTimingInfo.loopfrequ
  • ./conf/param_complatency.txt -> AOconf[loop].AOtiminginfo.complatency
  • AOconf[loop].AOtiminginfo.complatency_frame = AOconf[loop].AOtiminginfo.complatency * AOconf[loop].AOloopTimingInfo.loopfrequ;
  • ./conf/param_wfsmextrlatency.txt -> AOconf[loop].AOloopTimingInfo.wfsmextrlatency

1.6. Define GPU use

  • ./conf/param_GPU0.txt > AOconf[loop].AOcompute.GPU0 (0 if missing)
  • ./conf/param_GPU1.txt > AOconf[loop].AOcompute.GPU1 (0 if missing)
  • ./conf/param_GPUall.txt -> AOconf[loop].AOcompute.GPUall
  • ./conf/param_DMprimWriteON.txt -> AOconf[loop].aorun.DMprimaryWriteON

1.7. WFS image total flux computation mode

1.8. Read CMatrix mult mode

  • ./conf/param_CMMMODE.txt -> CMMODE
    • 0 : WFS signal -> Mode coeffs -> DM act values (2 sequential matrix multiplications)
    • 1 : WFS signal -> DM act values (1 combined matrix multiplication)

1.9. Setup loop timing array

1.10. Setup RT logging

By default, LOG is enabled

2. Read/load shared memory arrays

2.1. CONNECT to existing streams

Note: these streams MUST exist

  • AOconf[loop].DMctrl.dmdispname : this image is read to notify when new dm displacement is ready
  • AOconf[loop].WFSim.WFSname : connect to WFS camera. This is where the size of the WFS is read

2.2. Read file to stream or connect to existing stream

The AOloopControl_xDloadcreate_shmim functions are used, and follows these rules:

If file already loaded, use it (we assume it's already been properly loaded)
If not, attempt to read it from shared memory
If not available in shared memory, create it in shared memory
if "fname" exists, attempt to load it into the shared memory image

Stream names are fixed:

  • aol_wfsdark
  • aol_imWFS0
  • aol_imWFS0tot
  • aol_imWFS1
  • aol_imWFS2
  • aol_wfsref0
  • aol_wfsref

2.3. Connect to DM

  • AOconf[loop].DMctrl.dmCname : DM control channel

    Here the DM size is read -> Oconf[loop].DMctrl.sizexDM, AOconf[loop].DMctrl.sizeyDM

  • AOconf[loop].DMctrl.dmRMname : DM response matrix channel

Connect to DM modes shared mem continue if not successful

3. Load DM modes (if level >= 10)

Load AOconf[loop].AOpmodecoeffs.DMmodesname
if already exists in local memory, trust it and adopt it
if not, load from ./conf/shmim.DMmodes.fits

◆ AOloopControl_loadconfigure_cli()

int_fast8_t AOloopControl_loadconfigure_cli ( )

Load / Setup configuration.

Purpose

load / setup configuration - amazingly loooong function, I am proud of you Boss !

Arguments

Parameters
[in]loopINT Loop number
[in]modeINT
  • 1 loads from ./conf/ directory to shared memory
  • 0 simply connects to shared memory
[in]levelINT
  • 2 zonal only
  • 10+ load allCLI function for AOloopControl_loadconfigure