26 #ifndef _AOLOOPCONTROL_H 27 #define _AOLOOPCONTROL_H 72 #define MAX_NUMBER_TIMER 100 91 #define MAX_NUMBER_RTLOGSTREAM 20 93 #define RTSLOGindex_wfsim 0 94 #define RTSLOGindex_imWFS0 1 95 #define RTSLOGindex_imWFS1 2 96 #define RTSLOGindex_imWFS2 3 97 #define RTSLOGindex_modeval 4 98 #define RTSLOGindex_modeval_dm 5 99 #define RTSLOGindex_modeval_dm_corr 6 100 #define RTSLOGindex_modeval_dm_now 7 101 #define RTSLOGindex_modeval_dm_now_filt 8 102 #define RTSLOGindex_modevalPF 9 103 #define RTSLOGindex_modevalPFsync 10 104 #define RTSLOGindex_modevalPFres 11 105 #define RTSLOGindex_modeval_ol 12 106 #define RTSLOGindex_dmC 13 107 #define RTSLOGindex_dmdisp 14 167 char timestring[100];
168 char timestring0[100];
283 int initcontrMcact_GPU[100];
428 long aoconfID_contrMcact[100];
549 const char *IDzpdm_name,
550 const char *IDzrespM_name,
551 const char *IDwfszp_name
558 const char *ID_WFSzp_name,
560 const char *IDwfsref0_name,
561 const char *IDwfsref_name
586 const char *ID_WFSref_name,
const char *ID_WFSim_name,
587 const char *ID_WFSimtot_name,
const char *ID_coeff_name);
591 const char *modecoeffs_name,
const char *DMmodes_name,
int semTrigg,
592 const char *out_name,
int GPUindex,
long loop,
int offloadMode);
596 const char *IDwfsref_name,
const char *WFSmodes_name,
const char *outname);
608 float GainCoeff,
long NBsamples);
612 float twait,
float offcoeff,
float multcoeff);
780 float gainEnd,
long NBgain);
793 const char *IDmodes_name,
const char *dmstream_name,
long delayframe,
798 const char *IDprobeB_name,
const char *IDdmstream_name,
799 const char *IDrespmat_name,
const char *IDwfsrefstream_name,
double delay,
errno_t AOloopControl_set_AUTOTUNE_LIMITS_mcoeff(float AUTOTUNE_LIMITS_mcoeff)
Definition: AOloopControl_autotune.c:117
errno_t AOloopControl_logoff()
Log off AO interface.
Definition: AOloopControl_ProcessModeCoefficients.h:9
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 ...
Definition: AOloopControl_autotune.c:93
long IDsrc
Definition: AOloopControl.h:154
int AOloopControl_RTstreamLOG_set_saveOFF(int loop, int rtlindex)
Definition: AOloopControl_RTstreamLOG.c:876
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...
Definition: AOloopControl_time_param.c:75
errno_t ControlMatrixMultiply(float *cm_array, float *imarray, long m, long n, float *outvect)
CPU based matrix-vector multiplication - when no GPU.
Definition: AOloopControl_wfs.c:359
errno_t AOloopControl_setLoopNumber(long loop)
Set loop number. Ex : for the Pyramid WFS, loop number = 0.
Definition: AOloopControl_loop_ctr.c:35
long aoconfID_MULTF_modes
Definition: AOloopControl.h:412
int memcpToggle
Definition: AOloopControl.h:143
errno_t AOloopControl_InitializeMemory(int mode)
Initialize memory - function called within C code only (no CLI call)
Definition: AOloopControl_initmem.c:56
float GPU_beta
Definition: AOloopControl.h:288
long aoconfID_dmmask
Definition: AOloopControl.h:417
long aoconfID_multfb
Definition: AOloopControl.h:406
long aoconfID_meas_modes
Definition: AOloopControl.h:393
Definition: AOloopControl.h:267
int PIXSTREAM_NBSLICES
Definition: AOloopControl.h:300
AOLOOPCONF_AutoTune AOAutoTune
Definition: AOloopControl.h:242
errno_t AOloopControl_AUTOTUNE_GAINS_on()
Set gain auto tune : on.
Definition: AOloopControl_autotune.c:128
size_t memsize
Definition: AOloopControl.h:160
int_fast8_t init_CMc_local
Definition: AOloopControl.h:296
long aoconfID_AVE_modes
Definition: AOloopControl.h:395
long frameindex
Definition: AOloopControl.h:139
errno_t AOloopControl_loopstep(long loop, long NBstep)
Close loop for finite number of steps.
Definition: AOloopControl_loop_onoff.c:121
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.
long aoconfID_imWFS0tot
Definition: AOloopControl.h:373
long IDbuffinfo
Definition: AOloopControl.h:149
errno_t AOloopControl_logon()
Log on the AO interface.
Definition: AOloopControl_autotune.h:8
errno_t set_DM_modesRM(long loop)
Response Matrix DM-WFS.
Definition: AOloopControl_dm.c:176
errno_t AOloopControl_loadconfigure(long loop, int mode, int level)
Load configuation parameters from disk - AOloopControl_loadconfigure.c.
Definition: AOloopControl_loadconfigure.c:69
float AOloopControl_readParam_float(char *paramname, float defaultValue, FILE *fplog)
Read parameter value - float, char or int - AOloopControl_read_param.c.
Definition: AOloopControl_read_param.c:61
Definition: AOloopControl.h:207
errno_t AOloopControl_setgainrange(long m0, long m1, float gainval)
Definition: AOloopControl.c:2338
AOloopTimingInfo AOtiminginfo
Definition: AOloopControl.h:226
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.
Definition: AOloopControl_dm.c:219
int AOloopControl_readParam_int(char *paramname, int defaultValue, FILE *fplog)
read parameters int
Definition: AOloopControl_read_param.c:126
long aoconfID_contrM
Definition: AOloopControl.h:422
long aoconfID_dmRM
Definition: AOloopControl.h:363
long aoconfID_looptiming
Definition: AOloopControl.h:435
errno_t AOcompute(long loop, int normalize)
Main computation function, runs once per loop iteration.
int save
Definition: AOloopControl.h:142
long aoconfID_RMS_modes
Definition: AOloopControl.h:394
int AOloopControl_RTstreamLOG_saveloop(int loop, char *dirname)
Definition: AOloopControl_RTstreamLOG.c:955
long aoconfID_imWFSlinlimit
Definition: AOloopControl.h:380
long aoconfID_DMmodes
Definition: AOloopControl.h:386
int AOloopControl_RTstreamLOG_printstatus(int loop)
Definition: AOloopControl_RTstreamLOG.c:424
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.
Definition: AOloopControl_fpspeckle_mod.c:119
long IDbuffinfo0
Definition: AOloopControl.h:150
int INIT
Definition: AOloopControl.h:135
errno_t AOloopControl_AUTOTUNE_GAINS_off()
Set gain auto tune : off.
Definition: AOloopControl_autotune.c:140
long aoconfID_wfsdark
Definition: AOloopControl.h:369
Definition: AOloopControl_aorun.h:60
int ON
Definition: AOloopControl.h:136
float normfloorcoeff
Definition: AOloopControl.h:458
long aoconfID_dmC
Definition: AOloopControl.h:362
int ENABLE
Definition: AOloopControl.h:134
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.
Definition: AOloopControl_dm.c:439
long aoconfIDlogdata
Definition: AOloopControl.h:447
AOLOOPCONF_ProcessModeCoefficients AOpmodecoeffs
Definition: AOloopControl.h:238
errno_t AOloopControl_RTstreamLOG_init(int loop)
Definition: AOloopControl_RTstreamLOG.c:49
uint32_t SIZE
Definition: AOloopControl.h:137
int buffindex
Definition: AOloopControl.h:138
Definition: AOloopControl.h:130
errno_t AOloopControl_set_hardwlatency_frame(float hardwlatency_frame)
Set hardware latency in unity of frame.
Definition: AOloopControl_time_param.c:46
errno_t AOloopControl_setWFSnormfloor(float WFSnormfloor)
Coefficient attenuates AO correction in low loght level.
Definition: AOloopControl_loop_param.c:97
char * destptr0
Definition: AOloopControl.h:157
errno_t AOloopControl_setmultfrange(long m0, long m1, float multfval)
Definition: AOloopControl.c:2418
errno_t AOloopControl_aorun()
errno_t set_DM_modes(long loop)
Sends modal commands to DM by matrix-vector multiplication.
Definition: AOloopControl_dm.c:95
errno_t AOloopControl_loopoff()
Open AO loop : AO off.
Definition: AOloopControl_loop_onoff.c:59
errno_t AOloopControl_ARPFon()
ARPF = auto regressive predictive filter: on.
Definition: AOloopControl_arpf_onoff.c:33
errno_t AOloopControl_setARPFgainAutoMax(float val)
Set ARPF.
Definition: AOloopControl_loop_param.c:81
long aoconfID_wfsmask
Definition: AOloopControl.h:416
long RTLOGsize
Definition: AOloopControl.h:247
char * AOloopControl_readParam_string(char *paramname, char *defaultValue, FILE *fplog)
read parameters string
Definition: AOloopControl_read_param.c:191
int active
Definition: AOloopControl.h:132
errno_t AOloopControl_ARPFoff()
ARPF = auto regressive predictive filter: off.
Definition: AOloopControl_arpf_onoff.c:45
errno_t AOloopControl_set_AUTOTUNE_LIMITS_perc(float AUTOTUNE_LIMITS_perc)
Definition: AOloopControl_autotune.c:106
long imageID
Definition: CLIcore.h:54
int AOloopControl_RTstreamLOG_set_saveON(int loop, int rtlindex)
Definition: AOloopControl_RTstreamLOG.c:859
long aoconfID_wfsref0
Definition: AOloopControl.h:382
errno_t AOloopControl_loopWFScompoff()
Open AO loop : AO off.
Definition: AOloopControl_loop_onoff.c:94
int_fast8_t init_RM_local
Definition: AOloopControl.h:293
int NBcubeSaved
Definition: AOloopControl.h:161
errno_t AOloopControl_setRTLOG_OFF()
errno_t AOloopControl_logprocess_modeval(const char *IDname)
Log the process of the mode evaluation.
Definition: AOloopControl_process_files.c:36
Definition: AOloopControl_AOcompute.h:6
errno_t AOloopControl_setframesAve(long nbframes)
Set an average of frames.
int AOloopControl_aorun_FPCONF(char *fpsname, uint32_t CMDmode)
Definition: AOloopControl_aorun.c:214
errno_t AOloopControl_AUTOTUNE_LIMITS_on()
Set limit auto tune : on.
Definition: AOloopControl_autotune.c:31
int * WFS_active_map
Definition: AOloopControl.h:453
long aoconfID_limitb
Definition: AOloopControl.h:407
errno_t AOloopControl_loopWFScompon()
Close AO loop : AO on.
Definition: AOloopControl_loop_onoff.c:73
long AOcontrolNBtimers
Definition: AOloopControl.h:445
long aoconfID_cmd_modesRM
Definition: AOloopControl.h:414
long aoconfID_wfsref
Definition: AOloopControl.h:383
int * GPUset1
Definition: AOloopControl.h:468
Definition: AOloopControl_dm.h:6
float GPU_alpha
Definition: AOloopControl.h:287
int * DM_active_map
Definition: AOloopControl.h:454
long aoconfID_meas_act
Definition: AOloopControl.h:427
long LOOPNUMBER
Definition: AOloopControl.h:275
int tActive
Definition: AOloopControl.h:170
static struct timespec tnow
Definition: AOloopControl_AOcompute.c:51
errno_t AOloopControl_WFSzpupdate_loop(const char *IDzpdm_name, const char *IDzrespM_name, const char *IDwfszp_name)
WFS zero point update.
Definition: AOloopControl_wfs.c:85
int AOloopControl_RTstreamLOG_GUI(int loop)
Definition: AOloopControl_RTstreamLOG.c:541
errno_t AOloopControl_set_loopfrequ(float loopfrequ)
Set AO loop frequency.
Definition: AOloopControl_time_param.c:32
uint8_t WFSatype
Definition: AOloopControl.h:350
errno_t AOloopControl_setgain(float gain)
Set gain of the loop.
Definition: AOloopControl_loop_param.c:40
errno_t AOloopControl_setmultfblock(long mb, float multfval)
Definition: AOloopControl.c:2522
long AOloopControl_computeWFSresidualimage(long loop, char *IDalpha_name)
Compute WFS residual image.
Definition: AOloopControl_wfs.c:404
long IDbuffinfo1
Definition: AOloopControl.h:151
errno_t AOloopControl_setlimitrange(long m0, long m1, float limval)
Definition: AOloopControl.c:2378
#define MAX_NUMBER_RTLOGSTREAM
Definition: AOloopControl.h:91
int AOloopControl_RTstreamLOG_set_ON(int loop, int rtlindex)
Definition: AOloopControl_RTstreamLOG.c:890
int PIXSTREAM_SLICE
Definition: AOloopControl.h:301
errno_t AOloopControl_DMfilteredWrite_off()
Writing on DM, after filtering : off.
Definition: AOloopControl_dmwrite.c:71
errno_t AOloopControl_RTstreamLOG_setup(long loop, long rtlindex, char *streamname)
Definition: AOloopControl_RTstreamLOG.c:173
errno_t AOloopControl_loopon()
Close AO loop : AO on.
Definition: AOloopControl_loop_onoff.c:38
int COMPUTE_PIXELSTREAMING
Definition: AOloopControl.h:299
errno_t AOloopControl_DMprimaryWrite_off()
Writing on DM, unfiltered actuators (primary) : off.
Definition: AOloopControl_dmwrite.c:47
int * GPUset0
Definition: AOloopControl.h:467
Definition: AOloopControl_aorun.h:10
errno_t AOloopControl_setparam(long loop, const char *key, double value)
Set one function for many parameters.
errno_t AOloopControl_scanGainBlock(long NBblock, long NBstep, float gainStart, float gainEnd, long NBgain)
Scan block gains.
Definition: AOloopControl_loop_param.c:309
long aoconfID_imWFS1
Definition: AOloopControl.h:375
long aoconfID_gainb
Definition: AOloopControl.h:405
int AOloopControl_aorun_GUI(long loop, double frequ)
Definition: AOloopControl_aorun.c:127
long aoconfID_meas_act_active
Definition: AOloopControl.h:455
long aoconfID_DMmode_GAIN
Definition: AOloopControl.h:410
errno_t AOloopControl_AUTOTUNE_LIMITS_off()
Set limit auto tune : off.
Definition: AOloopControl_autotune.c:44
char * destptr1
Definition: AOloopControl.h:158
errno_t AOloopControl_DMprimaryWrite_on()
Writing on DM, unfiltered actuators (primary) : on.
Definition: AOloopControl_dmwrite.c:35
long aoconfID_wfsim
Definition: AOloopControl.h:349
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.
long IDbuff0
Definition: AOloopControl.h:146
int AOloopControl_bogusfunc()
Definition: AOloopControl.c:1531
errno_t AOloopControl_loopkill()
Kill AO loop : finish the process of the run.
Definition: AOloopControl_loop_onoff.c:109
errno_t AOloopControl_setRTLOG_ON()
errno_t AOloopControl_setgainblock(long mb, float gainval)
Definition: AOloopControl.c:2457
errno_t AOloopControl_DMfilteredWrite_on()
Writing on DM, after filtering : on.
Definition: AOloopControl_dmwrite.c:59
long aoconfID_contrMc
Definition: AOloopControl.h:426
int NBFileBuffer
Definition: AOloopControl.h:165
long aoconfID_imWFS0
Definition: AOloopControl.h:371
errno_t AOloopControl_AutoTuneGains(long loop, const char *IDout_name, float GainCoeff, long NBsamples)
Auto tune gains of the closed loop.
Definition: AOloopControl_AutoTuneGains.c:64
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
void __attribute__((constructor)) libinit_AOloopControl()
Definition: ImageStreamIO.c:77
long aoconfID_modevalPF
Definition: AOloopControl.h:397
Definition: AOloopControl_aorun.h:89
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.
Definition: AOloopControl_sig2Modecoeff.c:65
long aoconfID_cmd_modes
Definition: AOloopControl.h:392
long IDbuff
Definition: AOloopControl.h:145
AOLOOPCONF_WFSim WFSim
Definition: AOloopControl.h:222
int AOloopControl_RTstreamLOG_set_OFF(int loop, int rtlindex)
Definition: AOloopControl_RTstreamLOG.c:904
long IDbuff1
Definition: AOloopControl.h:147
AOLOOPCONF_aorun aorun
Definition: AOloopControl.h:218
errno_t AOloopControl_AutoTune()
Definition: AOloopControl.c:2554
int_fast8_t init_CM_local
Definition: AOloopControl.h:294
errno_t AOloopControl_setARPFgain(float gain)
Set ARPF gain (auto regressive predictive filter) Ex : a gain of 0.5 will correct 50% of the predicte...
Definition: AOloopControl_loop_param.c:54
char * destptr
Definition: AOloopControl.h:156
void AOloopControl_RTstreamLOG_update(long loop, long rtlindex, struct timespec tnow)
Definition: AOloopControl_RTstreamLOG.c:350
long long aoconfcnt0_wfsref_current
Definition: AOloopControl.h:384
errno_t AOloopControl_set_modeblock_gain(long loop, long blocknb, float gain, int add)
Set gain of block of modes.
Definition: AOloopControl_loop_param.c:146
float * srcptr
Definition: AOloopControl.h:153
errno_t AOloopControl_setlimitblock(long mb, float limitval)
Definition: AOloopControl.c:2490
errno_t AOloopControl_setmaxlimit(float maxlimit)
Set the limit maximum.
Definition: AOloopControl_loop_param.c:115
int AOloopcontrol_meminit
Definition: AOloopControl.h:291
errno_t AOloopControl_loopreset()
Reset the AO loop.
Definition: AOloopControl_loop_onoff.c:141
AOLOOPCONF_DMctrl DMctrl
Definition: AOloopControl.h:234
long aoconfID_modeARPFgainAuto
Definition: AOloopControl.h:396
int FileBuffer
Definition: AOloopControl.h:166
long aoconfID_dmdisp
Definition: AOloopControl.h:387
errno_t AOloopControl_setARPFgainAutoMin(float val)
Set ARPF.
Definition: AOloopControl_loop_param.c:68
AOLOOPCONF_AOcompute AOcompute
Definition: AOloopControl.h:230
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.
long frameindexend1
Definition: AOloopControl.h:141
int AOloopControl_aorun_RUN(char *fpsname)
Main loop function.
Definition: AOloopControl_aorun.c:371
errno_t AOloopControl_setmult(float multcoeff)
Multiplying coefficient, close to 1, in order to avoid divergence.
Definition: AOloopControl_loop_param.c:129
long aoconfID_imWFS2
Definition: AOloopControl.h:377
long aoconfID_pixstream_wfspixindex
Definition: AOloopControl.h:432
long frameindexend0
Definition: AOloopControl.h:140
errno_t AOloopControl_set_complatency_frame(float complatency_frame)
Set computation latency of primary DM write in unity of frame.
Definition: AOloopControl_time_param.c:61
long aoconfID_LIMIT_modes
Definition: AOloopControl.h:411