14 #ifndef _AOLOOPCONTROL_H
15 #define _AOLOOPCONTROL_H
22 #define maxNBMB 100 // maximum number of mode blocks
23 #define MAXNBMODES 10000 // maximum number of control modes
24 #define MAX_NUMBER_TIMER 100
67 int_fast8_t GPUstatus[50];
69 struct timespec timer[MAX_NUMBER_TIMER];
113 uint_fast32_t sizeWFS_active[100];
148 char DMmodesname[80];
151 uint_fast16_t NBmodes_block[100];
152 uint_fast16_t modeBlockIndex[MAXNBMODES];
153 uint_fast16_t indexmaxMB[maxNBMB];
242 double block_PFresrms[100];
243 double block_OLrms[100];
244 double block_Crms[100];
245 double block_WFSrms[100];
246 double block_limFrac[100];
255 double blockave_PFresrms[100];
256 double blockave_OLrms[100];
257 double blockave_Crms[100];
258 double blockave_WFSrms[100];
259 double blockave_limFrac[100];
362 int_fast8_t
AOcompute(
long loop,
int normalize);
364 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);
368 long AOloopControl_sig2Modecoeff(
const char *WFSim_name,
const char *IDwfsref_name,
const char *WFSmodes_name,
const char *outname);
506 int_fast8_t
AOloopControl_OptimizePSF_LO(
const char *psfstream_name,
const char *IDmodes_name,
const char *dmstream_name,
long delayframe,
long NBframes);
508 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_logon()
int_fast8_t AOloopControl_setgain(float gain)
Definition: AOloopControl.c:6223
int_fast8_t on
Definition: AOloopControl.h:172
int_fast8_t AOloopControl_scanGainBlock(long NBblock, long NBstep, float gainStart, float gainEnd, long NBgain)
Definition: AOloopControl.c:6454
int_fast8_t AOloopControl_run()
Main loop function.
Definition: AOloopControl.c:2875
uint_fast64_t WFScntRM
Definition: AOloopControl.h:115
int_fast8_t AOloopControl_setmult(float multcoeff)
Definition: AOloopControl.c:6275
int_fast8_t AOloopControl_WFSzpupdate_loop(const char *IDzpdm_name, const char *IDzrespM_name, const char *IDwfszp_name)
Definition: AOloopControl.c:2629
float AUTOTUNEGAINS_evolTimescale
Definition: AOloopControl.h:188
int_fast8_t GPU1
Definition: AOloopControl.h:213
int_fast8_t statusM1
Definition: AOloopControl.h:65
int_fast8_t GPU4
Definition: AOloopControl.h:216
int_fast8_t GPUusesem
Definition: AOloopControl.h:222
int_fast8_t AOloopControl_DMfilteredWrite_off()
Definition: AOloopControl.c:5988
int_fast8_t AOloopControl_setARPFgain(float gain)
Definition: AOloopControl.c:6235
int_fast8_t AOloopControl_AUTOTUNE_LIMITS_on()
Definition: AOloopControl.c:6007
double ALL_Crms
Definition: AOloopControl.h:249
Definition: AOloopControl.h:41
int_fast8_t AOloopControl_set_AUTOTUNE_LIMITS_mcoeff(float AUTOTUNE_LIMITS_mcoeff)
Definition: AOloopControl.c:6093
uint_fast16_t NBtimer
Definition: AOloopControl.h:68
int_fast8_t AOloopControl_DMfilteredWrite_on()
Definition: AOloopControl.c:5976
int_fast8_t AOloopControl_AutoTuneGains(long loop, const char *IDout_name, float GainCoeff, long NBsamples)
Definition: AOloopControl.c:5298
uint_fast32_t AveStats_NBpt
Definition: AOloopControl.h:254
double ALLave_WFSrms
Definition: AOloopControl.h:263
int_fast8_t AOloopControl_loopstep(long loop, long NBstep)
Definition: AOloopControl.c:5889
uint_fast32_t activeWFScnt
Definition: AOloopControl.h:112
int_fast8_t AOloopControl_setparam(long loop, const char *key, double value)
Definition: AOloopControl.c:5819
int_fast8_t init_RM
Definition: AOloopControl.h:87
float gain
Definition: AOloopControl.h:173
float mult
Definition: AOloopControl.h:160
long AOloopControl_dm2dm_offload(const char *streamin, const char *streamout, float twait, float offcoeff, float multcoeff)
Definition: AOloopControl.c:5754
float maxlimit
Definition: AOloopControl.h:159
int_fast8_t set_DM_modesRM(long loop)
Definition: AOloopControl.c:3305
int_fast8_t CMMODE
Definition: AOloopControl.h:176
int_fast8_t AOloopControl_set_wfsmextrlatency_frame(float wfsmextrlatency_frame)
Definition: AOloopControl.c:6204
int_fast8_t AOloopControl_AUTOTUNE_GAINS_off()
Definition: AOloopControl.c:6116
int_fast8_t AOloopControl_setmultfrange(long m0, long m1, float multfval)
Definition: AOloopControl.c:7319
uint_fast16_t NBDMmodes
Definition: AOloopControl.h:155
int_fast8_t AOloopControl_setmaxlimit(float maxlimit)
Definition: AOloopControl.c:6263
uint_fast32_t sizeyDM
Definition: AOloopControl.h:134
int_fast8_t GPU3
Definition: AOloopControl.h:215
int_fast8_t AOloopControl_loopkill()
Definition: AOloopControl.c:5877
int_fast8_t AOloopControl_loopreset()
Definition: AOloopControl.c:5909
int_fast8_t GPUall
Definition: AOloopControl.h:221
int_fast8_t AOloopControl_set_loopfrequ(float loopfrequ)
Definition: AOloopControl.c:6167
int_fast8_t init
Definition: AOloopControl.h:80
int_fast8_t AOcompute(long loop, int normalize)
Main computation function, runs once per loop iteration.
Definition: AOloopControl.c:3341
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)
Definition: AOloopControl.c:3943
uint_fast32_t activeDMcnt
Definition: AOloopControl.h:136
int_fast8_t AOloopControl_ARPFon()
Definition: AOloopControl.c:6136
int_fast8_t init_wfsref0
Definition: AOloopControl.h:157
int_fast8_t AOloopControl_setLoopNumber(long loop)
Definition: AOloopControl.c:5805
int_fast8_t AOloopControl_AUTOTUNE_GAINS_on()
Definition: AOloopControl.c:6104
int_fast8_t AOloopControl_set_AUTOTUNE_LIMITS_delta(float AUTOTUNE_LIMITS_delta)
Definition: AOloopControl.c:6069
float hardwlatency_frame
Definition: AOloopControl.h:53
int_fast8_t DMfilteredWriteON
Definition: AOloopControl.h:177
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)
Definition: AOloopControl.c:6590
double RMSmodesCumul
Definition: AOloopControl.h:238
long AUTOTUNEGAINS_NBsamples
Definition: AOloopControl.h:189
static int loadcreateshm_log
Definition: AOloopControl.h:28
int_fast8_t AOloopControl_logoff()
int_fast8_t AOloopControl_DMprimaryWrite_on()
Definition: AOloopControl.c:5952
int_fast8_t AOloopControl_set_complatency_frame(float complatency_frame)
Definition: AOloopControl.c:6192
uint_fast32_t sizeyWFS
Definition: AOloopControl.h:110
double ALLave_limFrac
Definition: AOloopControl.h:264
int_fast8_t AOloopControl_setlimitrange(long m0, long m1, float limval)
Definition: AOloopControl.c:7289
double ALLave_OLrms
Definition: AOloopControl.h:261
uint_fast16_t DMmodesNBblock
Definition: AOloopControl.h:150
float wfsmextrlatency
Definition: AOloopControl.h:60
int_fast8_t AOloopControl_InitializeMemory()
Initialize memory - function called within C code only (no CLI call)
int_fast8_t AOloopControl_OptimizePSF_LO(const char *psfstream_name, const char *IDmodes_name, const char *dmstream_name, long delayframe, long NBframes)
Definition: AOloopControl.c:6523
int_fast8_t GPU0
Definition: AOloopControl.h:212
uint_fast64_t cnt
Definition: AOloopControl.h:81
int_fast8_t GPU2
Definition: AOloopControl.h:214
double RMSmodes
Definition: AOloopControl.h:237
float AUTOTUNE_LIMITS_delta
Definition: AOloopControl.h:184
int_fast8_t init_CM
Definition: AOloopControl.h:88
int_fast8_t DMprimaryWriteON
Definition: AOloopControl.h:175
double ALL_OLrms
Definition: AOloopControl.h:248
uint_fast16_t framesAve
Definition: AOloopControl.h:174
float loopfrequ
Definition: AOloopControl.h:49
int_fast8_t AOloopControl_AUTOTUNE_LIMITS_off()
Definition: AOloopControl.c:6020
static FILE * loadcreateshm_fplog
Definition: AOloopControl.h:29
int_fast8_t GPU7
Definition: AOloopControl.h:219
int_fast8_t AUTOTUNE_LIMITS_ON
Definition: AOloopControl.h:181
int_fast8_t AOloopControl_setgainrange(long m0, long m1, float gainval)
Definition: AOloopControl.c:7259
int_fast8_t AOloopControl_setgainblock(long mb, float gainval)
Definition: AOloopControl.c:7349
float wfsmextrlatency_frame
Definition: AOloopControl.h:61
uint_fast64_t RMSmodesCumulcnt
Definition: AOloopControl.h:239
int_fast8_t set_DM_modes(long loop)
Sends modal commands to DM by matrix-vector multiplication.
Definition: AOloopControl.c:3235
long AOloopControl_computeWFSresidualimage(long loop, char *IDalpha_name)
Definition: AOloopControl.c:4191
float complatency
Definition: AOloopControl.h:56
double ALL_limFrac
Definition: AOloopControl.h:251
int_fast8_t init_CMc
Definition: AOloopControl.h:89
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)
Definition: AOloopControl.c:3822
int_fast8_t AOloopControl_set_AUTOTUNE_LIMITS_perc(float AUTOTUNE_LIMITS_perc)
Definition: AOloopControl.c:6082
uint_fast64_t DMupdatecnt
Definition: AOloopControl.h:83
int_fast8_t AOloopControl_ARPFoff()
Definition: AOloopControl.c:6148
float hardwlatency
Definition: AOloopControl.h:52
uint_fast64_t WFScnt
Definition: AOloopControl.h:114
double ALL_WFSrms
Definition: AOloopControl.h:250
int_fast8_t status
Definition: AOloopControl.h:63
int_fast8_t kill
Definition: AOloopControl.h:84
long AOloopControl_ComputeOpenLoopModes(long loop)
Definition: AOloopControl.c:4357
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)
Definition: AOloopControl.c:2759
int_fast8_t AOloopControl_setlimitblock(long mb, float limitval)
Definition: AOloopControl.c:7373
int_fast8_t AOloopControl_loopon()
Definition: AOloopControl.c:5850
int_fast8_t GPU5
Definition: AOloopControl.h:217
int_fast8_t statusM
Definition: AOloopControl.h:64
int_fast8_t AUTOTUNE_GAINS_ON
Definition: AOloopControl.h:186
uint_fast32_t sizexDM
Definition: AOloopControl.h:133
uint_fast32_t sizeDM_active
Definition: AOloopControl.h:137
uint_fast32_t sizeDM
Definition: AOloopControl.h:135
int_fast8_t AOloopControl_loadconfigure(long loop, int mode, int level)
Load configuation parameters from disk.
Definition: AOloopControl.c:1493
float WFSnormfloor
Definition: AOloopControl.h:118
long AOloopControl_sig2Modecoeff(const char *WFSim_name, const char *IDwfsref_name, const char *WFSmodes_name, const char *outname)
Definition: AOloopControl.c:4079
float WFStotalflux
Definition: AOloopControl.h:119
int_fast8_t AOloopControl_logprocess_modeval(const char *IDname)
Definition: AOloopControl.c:6814
float AUTOTUNE_LIMITS_mcoeff
Definition: AOloopControl.h:183
uint_fast32_t sizeWFS
Definition: AOloopControl.h:111
uint_fast64_t cntmax
Definition: AOloopControl.h:82
int_fast8_t AOloopControl_loopoff()
Definition: AOloopControl.c:5865
int_fast8_t AOloopControl_AutoTune()
Definition: AOloopControl.c:7445
uint_fast8_t DMMODE
Definition: AOloopControl.h:132
int_fast8_t init_AOloopControl()
Initialize AOloopControl command line interface.
float ARPFgain
Definition: AOloopControl.h:201
uint_fast32_t sizexWFS
Definition: AOloopControl.h:109
int_fast8_t AOloopControl_set_modeblock_gain(long loop, long blocknb, float gain, int add)
Definition: AOloopControl.c:6303
int_fast8_t initmapping
Definition: AOloopControl.h:90
float AUTOTUNE_LIMITS_perc
Definition: AOloopControl.h:182
int_fast8_t AOloopControl_DMprimaryWrite_off()
Definition: AOloopControl.c:5964
int_fast8_t GPU6
Definition: AOloopControl.h:218
float AUTOTUNEGAINS_updateGainCoeff
Definition: AOloopControl.h:187
int_fast8_t AOloopControl_setframesAve(long nbframes)
Definition: AOloopControl.c:6287
int_fast8_t AOLCOMPUTE_TOTAL_ASYNC
Definition: AOloopControl.h:223
double ALLave_Crms
Definition: AOloopControl.h:262
int_fast8_t AOloopControl_setmultfblock(long mb, float multfval)
Definition: AOloopControl.c:7396
int_fast8_t AOloopControl_set_hardwlatency_frame(float hardwlatency_frame)
Definition: AOloopControl.c:6179
int_fast8_t AOloopControl_setWFSnormfloor(float WFSnormfloor)
Definition: AOloopControl.c:6247
int_fast8_t WFSnormalize
Definition: AOloopControl.h:117
int_fast8_t ControlMatrixMultiply(float *cm_array, float *imarray, long m, long n, float *outvect)
Definition: AOloopControl.c:3213
float complatency_frame
Definition: AOloopControl.h:57