COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
sutra_controller_mv.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_MV_H_
43 #define _SUTRA_CONTROLLER_MV_H_
44 
45 #include <carma_cublas.h>
46 #include <carma_host_obj.h>
47 #include <sutra_centroider.h>
48 #include <sutra_controller.h>
49 #include <sutra_dm.h>
50 #include <sutra_utils.h>
51 #include <sutra_wfs.h>
52 
53 template <typename Tcomp, typename Tout>
54 class sutra_controller_mv : public SutraController<Tcomp, Tout> {
55  public:
59 
60  // Cphim & Cmm features
66  // svd computations
69  // CarmaObj<Tcomp> *d_U;
70 
71  // loop components
72  CarmaObj<Tcomp> *d_cenbuff; // centroids circular buffer
73  CarmaObj<Tcomp> *d_compbuff; // Buffer for computations
75  CarmaObj<Tcomp> *d_olmeas; // Open-loop measurements for POLC
76  CarmaObj<Tcomp> *d_err; // current error
77 
78  cublasHandle_t cublas_handle;
79 
80  public:
81  sutra_controller_mv(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(const char *dmtype, char *method);
91  int build_cmat(Tcomp cond);
92  int frame_delay();
93  int comp_com();
94  int set_modal_gains(Tcomp *mgain);
95  int set_cmat(Tcomp *cmat);
96  int set_imat(Tcomp *imat);
97  // Florian features
98  int load_noisemat(Tcomp *noise);
99  int do_covmat(SutraDm *ydm, char *method, int *indx_pup, long dim,
100  Tcomp *xpos, Tcomp *ypos, long Nkl, Tcomp norm, Tcomp ampli);
101  int do_geomat(CarmaObj<Tcomp> *d_geocov, CarmaObj<Tcomp> *d_IF, long n_pts,
102  Tcomp ampli);
103  int piston_filt(CarmaObj<Tcomp> *d_statcov);
104  int piston_filt_cphim(CarmaObj<Tcomp> *d_cphim, Tcomp *F);
105  int filter_cphim(Tcomp *F, Tcomp *Nact);
106  int filter_cmat(Tcomp cond);
107  int invgen(CarmaObj<Tcomp> *d_mat, Tcomp cond, int job);
109  Tcomp cond);
111  Tcomp cond);
112  // int
113  // do_statmat(T *statcov,long dim, T *xpos, T *ypos, T norm,
114  // CarmaDevice *device);
115  int DDiago(CarmaObj<Tcomp> *d_statcov, CarmaObj<Tcomp> *d_geocov);
116  int load_covmat(Tcomp *covmat);
117  int load_klbasis(Tcomp *klbasis);
118  int compute_Cmm(SutraAtmos *atmos, SutraSensors *sensors, double *L0,
119  double *cn2, double *alphaX, double *alphaY, double diamTel,
120  double cobs);
121  int compute_Cphim(SutraAtmos *atmos, SutraSensors *sensors, SutraDms *dms,
122  double *L0, double *cn2, double *alphaX, double *alphaY,
123  double *X, double *Y, double *xactu, double *yactu,
124  double diamTel, double *k2, long *NlayerDm,
125  long *indLayerDm, double FoV, double *pitch,
126  double *alt_dm);
127 };
128 
129 #endif // _SUTRA_CONTROLLER_MV_H_
sutra_controller_mv::d_cenbuff
CarmaObj< Tcomp > * d_cenbuff
Definition: sutra_controller_mv.h:72
sutra_centroider.h
sutra_controller_mv::get_type
string get_type()
sutra_controller_mv
this class provides the controller_mv features to COMPASS
Definition: sutra_controller_mv.h:54
sutra_controller.h
carma_cublas.h
this file provides the cublas features to CarmaObj
sutra_controller_mv::frame_delay
int frame_delay()
SutraController::delay
Tcomp delay
Definition: sutra_controller.h:79
sutra_controller_mv::d_cmat
CarmaObj< Tcomp > * d_cmat
Definition: sutra_controller_mv.h:57
sutra_controller_mv::d_noisemat
CarmaObj< Tcomp > * d_noisemat
Definition: sutra_controller_mv.h:63
sutra_controller_mv::d_compbuff
CarmaObj< Tcomp > * d_compbuff
Definition: sutra_controller_mv.h:73
sutra_controller_mv::h_Cmmeigenvals
CarmaHostObj< Tcomp > * h_Cmmeigenvals
Definition: sutra_controller_mv.h:67
sutra_controller_mv::sutra_controller_mv
sutra_controller_mv(CarmaContext *context, long nvalid, long nslope, long nactu, float delay, SutraDms *dms, int *idx_dms, int ndm, int *idx_centro, int ncentro)
SutraDms
Definition: sutra_dm.h:164
sutra_controller_mv::d_err
CarmaObj< Tcomp > * d_err
Definition: sutra_controller_mv.h:76
sutra_controller_mv::compute_Cphim
int compute_Cphim(SutraAtmos *atmos, SutraSensors *sensors, SutraDms *dms, double *L0, double *cn2, double *alphaX, double *alphaY, double *X, double *Y, double *xactu, double *yactu, double diamTel, double *k2, long *NlayerDm, long *indLayerDm, double FoV, double *pitch, double *alt_dm)
sutra_controller_mv::svdec_imat
int svdec_imat()
sutra_controller_mv::d_gain
CarmaObj< Tcomp > * d_gain
Definition: sutra_controller_mv.h:58
sutra_controller_mv::set_imat
int set_imat(Tcomp *imat)
sutra_controller_mv::build_cmat
int build_cmat(Tcomp cond)
sutra_controller_mv::~sutra_controller_mv
~sutra_controller_mv()
sutra_controller_mv::comp_com
int comp_com()
!!! YOU MUST set d_centroids before calling it!!!!
sutra_controller_mv::load_klbasis
int load_klbasis(Tcomp *klbasis)
sutra_controller_mv::d_covmat
CarmaObj< Tcomp > * d_covmat
Definition: sutra_controller_mv.h:61
SutraAtmos
this class provides the atmos features to COMPASS
Definition: sutra_atmos.h:50
sutra_wfs.h
sutra_controller_mv::d_imat
CarmaObj< Tcomp > * d_imat
Definition: sutra_controller_mv.h:56
sutra_controller_mv::set_modal_gains
int set_modal_gains(Tcomp *mgain)
sutra_controller_mv::sutra_controller_mv
sutra_controller_mv(const sutra_controller_mv &controller)
sutra_controller_mv::d_olmeas
CarmaObj< Tcomp > * d_olmeas
Definition: sutra_controller_mv.h:75
sutra_controller_mv::load_noisemat
int load_noisemat(Tcomp *noise)
sutra_controller_mv::DDiago
int DDiago(CarmaObj< Tcomp > *d_statcov, CarmaObj< Tcomp > *d_geocov)
sutra_controller_mv::build_cmat
int build_cmat(const char *dmtype, char *method)
sutra_controller_mv::set_cmat
int set_cmat(Tcomp *cmat)
sutra_controller_mv::piston_filt_cphim
int piston_filt_cphim(CarmaObj< Tcomp > *d_cphim, Tcomp *F)
sutra_controller_mv::invgen_cpu
int invgen_cpu(CarmaObj< Tcomp > *d_mat, CarmaHostObj< Tcomp > *h_eigen, Tcomp cond)
sutra_controller_mv::h_eigenvals
CarmaHostObj< Tcomp > * h_eigenvals
Definition: sutra_controller_mv.h:68
CarmaObj< Tcomp >
sutra_controller_mv::do_covmat
int do_covmat(SutraDm *ydm, char *method, int *indx_pup, long dim, Tcomp *xpos, Tcomp *ypos, long Nkl, Tcomp norm, Tcomp ampli)
CarmaContext
this class provides the context in which CarmaObj are created
Definition: carma_context.h:104
sutra_controller_mv::d_Cmm
CarmaObj< Tcomp > * d_Cmm
Definition: sutra_controller_mv.h:64
SutraController::nslope
int nslope()
Definition: sutra_controller.h:124
sutra_controller_mv::d_Cphim
CarmaObj< Tcomp > * d_Cphim
Definition: sutra_controller_mv.h:65
sutra_utils.h
CarmaHostObj< Tcomp >
sutra_controller_mv::compute_Cmm
int compute_Cmm(SutraAtmos *atmos, SutraSensors *sensors, double *L0, double *cn2, double *alphaX, double *alphaY, double diamTel, double cobs)
SutraSensors
this class provides the sensors features to COMPASS
Definition: sutra_sensors.h:59
sutra_controller_mv::d_KLbasis
CarmaObj< Tcomp > * d_KLbasis
Definition: sutra_controller_mv.h:62
sutra_controller_mv::cublas_handle
cublasHandle_t cublas_handle
Definition: sutra_controller_mv.h:78
sutra_controller_mv::load_covmat
int load_covmat(Tcomp *covmat)
sutra_dm.h
SutraController::nactu
int nactu()
Definition: sutra_controller.h:123
sutra_controller_mv::d_compbuff2
CarmaObj< Tcomp > * d_compbuff2
Definition: sutra_controller_mv.h:74
sutra_controller_mv::piston_filt
int piston_filt(CarmaObj< Tcomp > *d_statcov)
SutraDm
this class provides the dm features to COMPASS
Definition: sutra_dm.h:73
sutra_controller_mv::invgen
int invgen(CarmaObj< Tcomp > *d_mat, CarmaHostObj< Tcomp > *h_eigen, Tcomp cond)
sutra_controller_mv::do_geomat
int do_geomat(CarmaObj< Tcomp > *d_geocov, CarmaObj< Tcomp > *d_IF, long n_pts, Tcomp ampli)
sutra_controller_mv::invgen
int invgen(CarmaObj< Tcomp > *d_mat, Tcomp cond, int job)
sutra_controller_mv::filter_cphim
int filter_cphim(Tcomp *F, Tcomp *Nact)
sutra_controller_mv::filter_cmat
int filter_cmat(Tcomp cond)
SutraController
this class provides the controller features to COMPASS
Definition: sutra_controller.h:73
carma_host_obj.h