mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
wooferTweeterFilter.hpp
Go to the documentation of this file.
1 /** \file
2  * \author Jared R. Males (jaredmales@gmail.com)
3  * \brief
4  * \ingroup mxAO_sim_files
5  *
6  */
7 
8 #ifndef __wooferTweeterFilter_hpp__
9 #define __wooferTweeterFilter_hpp__
10 
11 #include "wooferTweeterDM.hpp"
12 
13 namespace mx
14 {
15 namespace AO
16 {
17 namespace sim
18 {
19 
20 
21 template< typename wooferFilterT, typename tweeterFilterT>
22 class wooferTweeterFilter
23 {
24 
25 public:
26 
27  typedef typename wooferFilterT::floatT floatT;
28 
29  typedef std::complex<floatT> complexT;
30 
31  ///The wavefront data type
32  typedef wavefront<floatT> wavefrontT;
33 
34  ///The command type
35  typedef wooferTweeterCommand<floatT> commandT;
36 
37 
38  wooferTweeterFilter();
39 
40  wooferFilterT woofer;
41  tweeterFilterT tweeter;
42 
43  int wooferNModes;
44  int tweeterNModes;
45 
46 public:
47 
48  template<typename dmT>
49  void initialize(dmT & dm);
50 
51  void filterCommands(commandT & filtAmps, commandT & rawAmps);
52 
53  int _lowOrders;
54 
55  void initMeasurements(commandT & filtAmps, commandT & rawAmps)
56  {
57  filtAmps.wooferVect.resize(1, wooferNModes);
58  filtAmps.wooferVect.setZero();
59  filtAmps.tweeterVect.resize(1, tweeterNModes);
60  filtAmps.tweeterVect.setZero();
61 
62  rawAmps.wooferVect.resize(1, wooferNModes);
63  rawAmps.wooferVect.setZero();
64  rawAmps.tweeterVect.resize(1, tweeterNModes);
65  rawAmps.tweeterVect.setZero();
66  }
67 
68 };
69 
70 
71 template< typename wooferFilterT, typename tweeterFilterT>
72 wooferTweeterFilter<wooferFilterT, tweeterFilterT>::wooferTweeterFilter()
73 {
74 }
75 
76 
77 
78 
79 template< typename wooferFilterT, typename tweeterFilterT>
80 template<typename dmT>
81 void wooferTweeterFilter<wooferFilterT, tweeterFilterT>::initialize(dmT & dm)
82 {
83  woofer.initialize(dm.woofer);
84  wooferNModes = dm.woofer.nModes();
85 
86  tweeter.initialize(dm.tweeter);
87  tweeterNModes = dm.tweeter.nModes();
88 }
89 
90 
91 
92 template< typename wooferFilterT, typename tweeterFilterT>
93 void wooferTweeterFilter<wooferFilterT, tweeterFilterT>::filterCommands(commandT & filtAmps, commandT & rawAmps)
94 {
95  static int called = 0;
96 
97  if(called == 51)
98  {
99  woofer.setGains(0.1);
100  }
101 
102  if(called == 101)
103  {
104  for(int i=78; i< 1680; ++i)
105  tweeter.setLeak(i, 0.01);
106  }
107 
108  woofer.filterCommands(filtAmps.wooferVect, rawAmps.wooferVect);
109  tweeter.filterCommands(filtAmps.tweeterVect, rawAmps.tweeterVect);
110 
111  ++called;
112 }
113 
114 
115 } //namespace sim
116 } //namespace AO
117 } //namespace mx
118 
119 #endif //__wooferTweeterFilter_hpp__
The mxlib c++ namespace.
Definition: mxError.hpp:107