COMPASS  5.4.4
End-to-end AO simulation tool using GPU acceleration
sutra_controller_generic_linear.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_GENERIC_LINEAR_H_
18 #define _SUTRA_CONTROLLER_GENERIC_LINEAR_H_
19 
20 #include <sutra_acquisim.h>
21 #include <sutra_controller.h>
22 
23 #include <memory>
24 
25 template <typename Tcomp, typename Tout>
26 class sutra_controller_generic_linear : public SutraController<Tcomp, Tout> {
27 
28 
29 private:
32 
33  bool m_polc;
34  bool m_modal;
35  int m_n_slope_buffers;
36  int m_n_states;
37  int m_n_state_buffers;
38  int m_n_modes;
39  int m_n_iir_in;
40  int m_n_iir_out;
41 
44 
46 
47 public:
48 
49  bool polc(){return m_polc;}
50  bool modal(){return m_modal;}
51  int n_slope_buffers(){return m_n_slope_buffers;}
52  int n_states(){return m_n_states;}
53  int n_state_buffers(){return m_n_state_buffers;}
54  int n_modes(){return m_n_modes;}
55  int n_iir_in(){return m_n_iir_in;}
56  int n_iir_out(){return m_n_iir_out;}
57 
58  std::unique_ptr<CarmaObj<Tcomp>> d_x_now;
59  std::unique_ptr<CarmaObj<Tcomp>> d_s_now;
60  std::unique_ptr<CarmaObj<Tcomp>> d_u_now;
61 
62  std::deque<CarmaObj<Tcomp> *> d_circular_x;
63  std::deque<CarmaObj<Tcomp> *> d_circular_s;
64  std::deque<CarmaObj<Tcomp> *> d_circular_u_in;
65  std::deque<CarmaObj<Tcomp> *> d_circular_u_out;
66 
67  std::vector<CarmaObj<Tcomp>*> d_matA;
68  std::vector<CarmaObj<Tcomp>*> d_matL;
69  std::unique_ptr<CarmaObj<Tcomp>> d_matK;
70  std::unique_ptr<CarmaObj<Tcomp>> d_matD;
71  std::unique_ptr<CarmaObj<Tcomp>> d_matF;
72 
73  std::vector<CarmaObj<Tcomp>*> d_iir_a;
74  std::vector<CarmaObj<Tcomp>*> d_iir_b;
75 
80 
81  public:
84  CarmaContext *context, int nslope, int nslopes_buffers, int nactu, int nstates,
85  int nstates_buffers, int nmodes, int niir_in, int niir_out,
86  float delay, bool polc, bool is_modal,
87  SutraDms *dms, int *idx_dms, int ndm, int *idx_centro, int ncentro);
88  //sutra_controller_generic_linear(const sutra_controller_generic_linear &controller);
90 
91  string get_type();
92  string get_commandlaw();
93  int set_matA(float * A, int i);
94  int set_matL(float * L, int i);
95  int set_matK(float * K);
96  int set_matD(float * D);
97  int set_matF(float * F);
98  int set_iir_a(float * iir_a, int i);
99  int set_iir_b(float * iir_b, int i);
100  int set_polc(bool p);
102  int comp_polc();
103  int comp_com();
104 
105  int recursion();
106  int innovation();
110 
111 };
112 
113 template <typename T>
114 void pad_cmat(T *idata, int m, int n, T *odata, int m2, int n2,
115  CarmaDevice *device);
116 #endif // _SUTRA_CONTROLLER_GENERIC_LINEAR_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_generic features to COMPASS
std::vector< CarmaObj< Tcomp > * > d_iir_b
list of iir 'b' vectors (inputs)
std::deque< CarmaObj< Tcomp > * > d_circular_s
circ buffer slopes
std::vector< CarmaObj< Tcomp > * > d_iir_a
list of iir 'a' vectors (outputs)
std::unique_ptr< CarmaObj< Tcomp > > d_s_now
vector used for slope calcs
int set_matL(float *L, int i)
std::unique_ptr< CarmaObj< Tcomp > > d_matD
D matrix (interaction matrix)
int set_matA(float *A, int i)
int set_iir_a(float *iir_a, int i)
std::unique_ptr< CarmaObj< Tcomp > > d_matK
K matrix (state to modes)
std::unique_ptr< CarmaObj< Tcomp > > d_matF
F matrix (mode to actu)
std::vector< CarmaObj< Tcomp > * > d_matL
list of L matrices (innovations)
std::vector< CarmaObj< Tcomp > * > d_matA
list of A matrices (recursions)
int set_iir_b(float *iir_b, int i)
int comp_com()
!!! YOU MUST set d_centroids before calling it!!!!
std::deque< CarmaObj< Tcomp > * > d_circular_u_out
circ buffer iir output
std::deque< CarmaObj< Tcomp > * > d_circular_u_in
circ buffer iir inputs
sutra_controller_generic_linear(CarmaContext *context, int nslope, int nslopes_buffers, int nactu, int nstates, int nstates_buffers, int nmodes, int niir_in, int niir_out, float delay, bool polc, bool is_modal, SutraDms *dms, int *idx_dms, int ndm, int *idx_centro, int ncentro)
std::unique_ptr< CarmaObj< Tcomp > > d_u_now
vector used for modal calcs
std::unique_ptr< CarmaObj< Tcomp > > d_x_now
vector used for state calcs
std::deque< CarmaObj< Tcomp > * > d_circular_x
circ buffer states
void pad_cmat(T *idata, int m, int n, T *odata, int m2, int n2, CarmaDevice *device)