COMPASS  5.0.0
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-2019 COMPASS Team <https://github.com/ANR-COMPASS>
5 // All rights reserved.
6 // Distributed under GNU - LGPL
7 //
8 // COMPASS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
9 // General Public License as published by the Free Software Foundation, either version 3 of the License,
10 // or any later version.
11 //
12 // COMPASS: End-to-end AO simulation tool using GPU acceleration
13 // The COMPASS platform was designed to meet the need of high-performance for the simulation of AO systems.
14 //
15 // The final product includes a software package for simulating all the critical subcomponents of AO,
16 // particularly in the context of the ELT and a real-time core based on several control approaches,
17 // with performances consistent with its integration into an instrument. Taking advantage of the specific
18 // hardware architecture of the GPU, the COMPASS tool allows to achieve adequate execution speeds to
19 // conduct large simulation campaigns called to the ELT.
20 //
21 // The COMPASS platform can be used to carry a wide variety of simulations to both testspecific components
22 // of AO of the E-ELT (such as wavefront analysis device with a pyramid or elongated Laser star), and
23 // various systems configurations such as multi-conjugate AO.
24 //
25 // COMPASS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
26 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 // See the GNU Lesser General Public License for more details.
28 //
29 // You should have received a copy of the GNU Lesser General Public License along with COMPASS.
30 // If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>.
31 // -----------------------------------------------------------------------------
32 
41 
42 #ifndef _SUTRA_CONTROLLER_LS_H_
43 #define _SUTRA_CONTROLLER_LS_H_
44 
45 #include <sutra_controller.h>
46 
47 template <typename Tcomp, typename Tout>
48 class sutra_controller_ls : public SutraController<Tcomp, Tout> {
49  public:
53 
54  // svd computations
58 
59  // loop components
60  CarmaObj<Tcomp> *d_cenbuff; // centroids circular buffer
61  CarmaObj<Tcomp> *d_err; // current error
62 
63  // Modal optimization components
64  int is_modopti; // Flag for using modal optimization
65  int nrec; // Number of recorded open slopes measurements
66  int nmodes; // Number of modes
67  Tcomp gmin; // Gain min
68  Tcomp gmax; // Gain max
69  int ngain; // Number of tested gains between gmin and gmax
70  Tcomp Fs; // Sampling frequency
71  int cpt_rec; // Counter for modal gains refresh
72  CarmaObj<Tcomp> *d_M2V; // Modes to Volts matrix
73  CarmaObj<Tcomp> *d_S2M; // Slopes to Modes matrix
74  CarmaObj<Tcomp> *d_slpol; // Open-loop measurements buffer, recorded and
75  // loaded from Yorick
76  CarmaObj<Tcomp> *d_Hcor; // Transfer function
77  CarmaObj<Tcomp> *d_compbuff; // Buffer for POLC computation
78  CarmaObj<Tcomp> *d_compbuff2; // Buffer for POLC computation
79 
80  public:
81  sutra_controller_ls(CarmaContext *context, long nvalid, long nslope,
82  long nactu, float delay, SutraDms *dms, int *idx_dms,
83  int ndm, int *idx_centro, int ncentro);
86 
87  string get_type();
88 
89  int svdec_imat();
90  int build_cmat(int nfilt, bool filt_tt);
91  int build_cmat(int nfilt);
93  int frame_delay();
94  int comp_com();
95  int set_modal_gains(Tcomp *mgain);
96  int set_cmat(Tcomp *cmat);
97  int set_imat(Tcomp *imat);
98  int init_modalOpti(int nmodes, int nrec, Tcomp *M2V, Tcomp gmin, Tcomp gmax,
99  int ngain, Tcomp Fs);
100  int loadopen_loopSlp(Tcomp *ol_slopes);
103 };
104 
105 #endif // _SUTRA_CONTROLLER_LS_H_
sutra_controller.h
sutra_controller_ls::get_type
string get_type()
sutra_controller_ls::build_cmat_modopti
int build_cmat_modopti()
SutraController::delay
Tcomp delay
Definition: sutra_controller.h:79
sutra_controller_ls::d_slpol
CarmaObj< Tcomp > * d_slpol
Definition: sutra_controller_ls.h:74
SutraDms
Definition: sutra_dm.h:164
sutra_controller_ls::d_imat
CarmaObj< Tcomp > * d_imat
Definition: sutra_controller_ls.h:50
sutra_controller_ls::set_imat
int set_imat(Tcomp *imat)
sutra_controller_ls::d_Hcor
CarmaObj< Tcomp > * d_Hcor
Definition: sutra_controller_ls.h:76
sutra_controller_ls::set_cmat
int set_cmat(Tcomp *cmat)
sutra_controller_ls::init_modalOpti
int init_modalOpti(int nmodes, int nrec, Tcomp *M2V, Tcomp gmin, Tcomp gmax, int ngain, Tcomp Fs)
sutra_controller_ls::d_gain
CarmaObj< Tcomp > * d_gain
Definition: sutra_controller_ls.h:52
sutra_controller_ls::compute_Hcor
int compute_Hcor()
sutra_controller_ls::d_M2V
CarmaObj< Tcomp > * d_M2V
Definition: sutra_controller_ls.h:72
sutra_controller_ls::nrec
int nrec
Definition: sutra_controller_ls.h:65
sutra_controller_ls::loadopen_loopSlp
int loadopen_loopSlp(Tcomp *ol_slopes)
sutra_controller_ls::h_eigenvals
CarmaHostObj< Tcomp > * h_eigenvals
Definition: sutra_controller_ls.h:56
sutra_controller_ls::build_cmat
int build_cmat(int nfilt, bool filt_tt)
sutra_controller_ls::d_cmat
CarmaObj< Tcomp > * d_cmat
Definition: sutra_controller_ls.h:51
sutra_controller_ls::modalControlOptimization
int modalControlOptimization()
sutra_controller_ls::d_compbuff2
CarmaObj< Tcomp > * d_compbuff2
Definition: sutra_controller_ls.h:78
sutra_controller_ls::Fs
Tcomp Fs
Definition: sutra_controller_ls.h:70
sutra_controller_ls::d_err
CarmaObj< Tcomp > * d_err
Definition: sutra_controller_ls.h:61
sutra_controller_ls::~sutra_controller_ls
~sutra_controller_ls()
sutra_controller_ls::build_cmat
int build_cmat(int nfilt)
sutra_controller_ls::d_compbuff
CarmaObj< Tcomp > * d_compbuff
Definition: sutra_controller_ls.h:77
sutra_controller_ls::comp_com
int comp_com()
!!! YOU MUST set d_centroids before calling it!!!!
sutra_controller_ls
this class provides the controller_ls features to COMPASS
Definition: sutra_controller_ls.h:48
CarmaObj< Tcomp >
sutra_controller_ls::nmodes
int nmodes
Definition: sutra_controller_ls.h:66
CarmaContext
this class provides the context in which CarmaObj are created
Definition: carma_context.h:104
sutra_controller_ls::d_cenbuff
CarmaObj< Tcomp > * d_cenbuff
Definition: sutra_controller_ls.h:60
SutraController::nslope
int nslope()
Definition: sutra_controller.h:124
sutra_controller_ls::ngain
int ngain
Definition: sutra_controller_ls.h:69
CarmaHostObj< Tcomp >
sutra_controller_ls::svdec_imat
int svdec_imat()
sutra_controller_ls::d_U
CarmaObj< Tcomp > * d_U
Definition: sutra_controller_ls.h:57
sutra_controller_ls::d_eigenvals
CarmaObj< Tcomp > * d_eigenvals
Definition: sutra_controller_ls.h:55
sutra_controller_ls::cpt_rec
int cpt_rec
Definition: sutra_controller_ls.h:71
sutra_controller_ls::set_modal_gains
int set_modal_gains(Tcomp *mgain)
SutraController::nactu
int nactu()
Definition: sutra_controller.h:123
sutra_controller_ls::d_S2M
CarmaObj< Tcomp > * d_S2M
Definition: sutra_controller_ls.h:73
sutra_controller_ls::gmax
Tcomp gmax
Definition: sutra_controller_ls.h:68
sutra_controller_ls::sutra_controller_ls
sutra_controller_ls(CarmaContext *context, long nvalid, long nslope, long nactu, float delay, SutraDms *dms, int *idx_dms, int ndm, int *idx_centro, int ncentro)
sutra_controller_ls::is_modopti
int is_modopti
Definition: sutra_controller_ls.h:64
sutra_controller_ls::sutra_controller_ls
sutra_controller_ls(const sutra_controller_ls &controller)
sutra_controller_ls::gmin
Tcomp gmin
Definition: sutra_controller_ls.h:67
SutraController
this class provides the controller features to COMPASS
Definition: sutra_controller.h:73
sutra_controller_ls::frame_delay
int frame_delay()