COMPASS  5.4.4
End-to-end AO simulation tool using GPU acceleration
sutra_controller_ls.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // This file is part of COMPASS <https://anr-compass.github.io/compass/>
3 //
4 // Copyright (C) 2011-2023 COMPASS Team <https://github.com/ANR-COMPASS>
5 // All rights reserved.
6 
7 // -----------------------------------------------------------------------------
8 
16 
17 #ifndef _SUTRA_CONTROLLER_LS_H_
18 #define _SUTRA_CONTROLLER_LS_H_
19 
20 #include <sutra_controller.h>
21 
22 template <typename Tcomp, typename Tout>
23 class sutra_controller_ls : public SutraController<Tcomp, Tout> {
24  public:
28 
29  // svd computations
33 
34  // loop components
35  CarmaObj<Tcomp> *d_cenbuff; // centroids circular buffer
36  CarmaObj<Tcomp> *d_err; // current error
37 
38  // Modal optimization components
39  int is_modopti; // Flag for using modal optimization
40  int nrec; // Number of recorded open slopes measurements
41  int nmodes; // Number of modes
42  Tcomp gmin; // Gain min
43  Tcomp gmax; // Gain max
44  int ngain; // Number of tested gains between gmin and gmax
45  Tcomp Fs; // Sampling frequency
46  int cpt_rec; // Counter for modal gains refresh
47  CarmaObj<Tcomp> *d_M2V; // Modes to Volts matrix
48  CarmaObj<Tcomp> *d_S2M; // Slopes to Modes matrix
49  CarmaObj<Tcomp> *d_slpol; // Open-loop measurements buffer, recorded and
50  // loaded from Yorick
51  CarmaObj<Tcomp> *d_Hcor; // Transfer function
52  CarmaObj<Tcomp> *d_compbuff; // Buffer for POLC computation
53  CarmaObj<Tcomp> *d_compbuff2; // Buffer for POLC computation
54 
55  public:
57  long nactu, float delay, SutraDms *dms, int *idx_dms,
58  int ndm, int *idx_centro, int ncentro);
61 
62  string get_type();
63 
64  int svdec_imat();
65  int build_cmat(int nfilt, bool filt_tt);
66  int build_cmat(int nfilt);
68  int frame_delay();
69  int comp_com();
70  int set_modal_gains(Tcomp *mgain);
71  int set_cmat(Tcomp *cmat);
72  int set_imat(Tcomp *imat);
73  int init_modalOpti(int nmodes, int nrec, Tcomp *M2V, Tcomp gmin, Tcomp gmax,
74  int ngain, Tcomp Fs);
75  int loadopen_loopSlp(Tcomp *ol_slopes);
77  int compute_Hcor();
78 };
79 
80 #endif // _SUTRA_CONTROLLER_LS_H_
this class provides the context in which CarmaObj are created
Definition: carma_context.h:79
this class provides the controller features to COMPASS
this class provides the controller_ls features to COMPASS
CarmaObj< Tcomp > * d_gain
CarmaObj< Tcomp > * d_cmat
CarmaObj< Tcomp > * d_Hcor
int loadopen_loopSlp(Tcomp *ol_slopes)
CarmaObj< Tcomp > * d_imat
int set_imat(Tcomp *imat)
CarmaObj< Tcomp > * d_eigenvals
CarmaObj< Tcomp > * d_compbuff2
CarmaObj< Tcomp > * d_S2M
CarmaObj< Tcomp > * d_slpol
sutra_controller_ls(CarmaContext *context, long nslope, long nactu, float delay, SutraDms *dms, int *idx_dms, int ndm, int *idx_centro, int ncentro)
CarmaObj< Tcomp > * d_compbuff
CarmaObj< Tcomp > * d_M2V
int modalControlOptimization()
CarmaObj< Tcomp > * d_cenbuff
int init_modalOpti(int nmodes, int nrec, Tcomp *M2V, Tcomp gmin, Tcomp gmax, int ngain, Tcomp Fs)
int build_cmat(int nfilt, bool filt_tt)
sutra_controller_ls(const sutra_controller_ls &controller)
int set_modal_gains(Tcomp *mgain)
int build_cmat(int nfilt)
int comp_com()
!!! YOU MUST set d_centroids before calling it!!!!
CarmaObj< Tcomp > * d_U
CarmaObj< Tcomp > * d_err
int set_cmat(Tcomp *cmat)
CarmaHostObj< Tcomp > * h_eigenvals