Debian Codegraph @

libs/indibase/indicorrelator.h

raw symbols SCIP
1 /*******************************************************************************
2 Copyright(c) 2010, 2017 Ilia Platone, Jasem Mutlaq. All rights reserved.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17 *******************************************************************************/
18
19 #pragma once
20
21 #include "indisensorinterface.h"cxx . . $ `<file>/libs/indibase/indisensorinterface.h`/
22 #include "dsp.h"cxx . . $ `<file>/libs/dsp/dsp.h`/
23 #include <fitsio.h>
24
25 #ifdef HAVE_WEBSOCKET
26 #include "indiwsserver.h"
27 #endif
28
29 #include <fitsio.h>
30
31 #include <memory>
32 #include <cstring>
33 #include <chrono>
34 #include <stdint.h>
35 #include <mutex>
36 #include <thread>
37
38 //JM 2019-01-17: Disabled until further notice
39 //#define WITH_EXPOSURE_LOOPING
40
41
42 /**
43 * \class INDI::Correlator
44 * \brief Class to provide general functionality of Monodimensional Correlator.
45 *
46 * The Correlator capabilities must be set to select which features are exposed to the clients.
47 * SetCorrelatorCapability() is typically set in the constructor or initProperties(), but can also be
48 * called after connection is established with the Correlator, but must be called /em before returning
49 * true in Connect().
50 *
51 * Developers need to subclass INDI::Correlator to implement any driver for Correlators within INDI.
52 *
53 * \example Correlator Simulator
54 * \author Jasem Mutlaq, Ilia Platone
55 *
56 */
57
58 namespace INDIcxx . . $ INDI/
59 {
60 class StreamManagercxx . . $ INDI/StreamManager#;
61
62 class Correlatorcxx . . $ INDI/Correlator# : public SensorInterfacecxx . . $ INDI/SensorInterface#
63 {
64 public:
65 /**
66 * \struct Baseline
67 * \brief the baseline (position of the telescopes) of this correlator.
68 */
69 typedef unioncxx . . $ INDI/Correlator#$anonymous_type_0#
70 {
71 structcxx . . $ INDI/Correlator#$anonymous_type_0#$anonymous_type_1#
72 {
73 double xcxx . . $ INDI/Correlator#$anonymous_type_0#$anonymous_type_1#x.;
74 double ycxx . . $ INDI/Correlator#$anonymous_type_0#$anonymous_type_1#y.;
75 double zcxx . . $ INDI/Correlator#$anonymous_type_0#$anonymous_type_1#z.;
76 };
77 double valuescxx . . $ INDI/Correlator#$anonymous_type_0#values.[3];
78 } Baselinecxx . . $ INDI/Correlator#Baseline#;
79
80 /**
81 * \enum UVCoordinate
82 * \brief The coordinates of the current projection into the UV plane.
83 */
84 typedef unioncxx . . $ INDI/Correlator#$anonymous_type_2#
85 {
86 structcxx . . $ INDI/Correlator#$anonymous_type_2#$anonymous_type_3#
87 {
88 double ucxx . . $ INDI/Correlator#$anonymous_type_2#$anonymous_type_3#u.;
89 double vcxx . . $ INDI/Correlator#$anonymous_type_2#$anonymous_type_3#v.;
90 };
91 double valuescxx . . $ INDI/Correlator#$anonymous_type_2#values.[2];
92 } UVCoordinatecxx . . $ INDI/Correlator#UVCoordinate#;
93
94 /**
95 * \enum Correlation
96 * \brief Struct containing the correlation, coordinate and baseline informations.
97 */
98 typedef structcxx . . $ INDI/Correlator#$anonymous_type_4#
99 {
100 Baselinecxx . . $ INDI/Correlator#Baseline# baselinecxx . . $ INDI/Correlator#$anonymous_type_4#baseline.;
101 UVCoordinatecxx . . $ INDI/Correlator#UVCoordinate# coordinatecxx . . $ INDI/Correlator#$anonymous_type_4#coordinate.;
102 double coefficientcxx . . $ INDI/Correlator#$anonymous_type_4#coefficient.;
103 } Correlationcxx . . $ INDI/Correlator#Correlation#;
104
105 enumcxx . . $ INDI/Correlator#$anonymous_type_5#
106 {
107 CORRELATOR_MAX_CAPABILITYcxx . . $ INDI/Correlator#CORRELATOR_MAX_CAPABILITY. = SENSOR_MAX_CAPABILITYcxx . . $ INDI/SensorInterface#SENSOR_MAX_CAPABILITY. << 0, /*!< Can the Sensor Integration be aborted? */
108 } CorrelatorCapabilitycxx . . $ INDI/Correlator#CorrelatorCapability.;
109
110 Correlatorcxx . . $ INDI/Correlator#Correlator(49f6e7a06ebc5aa8).();
111 virtual ~cxx . . $ INDI/Correlator#`~Correlator`(49f6e7a06ebc5aa8).Correlatorcxx . . $ INDI/Correlator#();
112
113 bool initPropertiescxx . . $ INDI/Correlator#initProperties(c9857a73d68e59ba).() override;
114 bool updatePropertiescxx . . $ INDI/Correlator#updateProperties(c9857a73d68e59ba).() override;
115 void ISGetPropertiescxx . . $ INDI/Correlator#ISGetProperties(85c52e162fed56f9).(const char *dev) override;
116 bool ISNewNumbercxx . . $ INDI/Correlator#ISNewNumber(b910d3521abb33fb).(const char *dev, const char *name, double values[], char *names[], int n) override;
117 bool ISNewSwitchcxx . . $ INDI/Correlator#ISNewSwitch(e439c05866add404).(const char *dev, const char *name, ISStatecxx . . $ ISState# *states, char *names[], int n) override;
118 bool ISNewTextcxx . . $ INDI/Correlator#ISNewText(1f3dbebc116ed926).(const char *dev, const char *name, char *texts[], char *names[], int n) override;
119 bool ISNewBLOBcxx . . $ INDI/Correlator#ISNewBLOB(1c8c4505943e50f6).(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[],
120 char *names[], int n) override;
121 bool ISSnoopDevicecxx . . $ INDI/Correlator#ISSnoopDevice(4c5c830808cba56b).(XMLEle *root) override;
122
123 virtual bool StartIntegrationcxx . . $ INDI/Correlator#StartIntegration(f8197d536af80c96).(double duration) override;
124
125 /**
126 * @brief getCorrelationDegree Get current correlation degree.
127 * @return the correlation coefficient.
128 */
129 virtual inline double getCorrelationDegreecxx . . $ INDI/Correlator#getCorrelationDegree(31fa7155c10fdd13).()
130 {
131 return 0.0;
132 }
133
134 /**
135 * @brief getCorrelation Get current correlation degree plus UV and baseline information.
136 * @return the correlation and UV coordinates.
137 */
138 inline Correlationcxx . . $ INDI/Correlator#Correlation# getCorrelationcxx . . $ INDI/Correlator#getCorrelation(33a4b5a9703b4f13).()
139 {
140 Correlationcxx . . $ INDI/Correlator#Correlation# ret;
141 ret.coordinatecxx . . $ INDI/Correlator#$anonymous_type_4#coordinate. =cxx . . $ INDI/Correlator#$anonymous_type_2#`operator=`(b30bbe0422fe4d2a). getUVCoordinatescxx . . $ INDI/Correlator#getUVCoordinates(8f729e255fd2900e).();
142 ret.baselinecxx . . $ INDI/Correlator#$anonymous_type_4#baseline. =cxx . . $ INDI/Correlator#$anonymous_type_0#`operator=`(1404a62531fd7de9). baselinecxx . . $ INDI/Correlator#baseline.;
143 ret.coefficientcxx . . $ INDI/Correlator#$anonymous_type_4#coefficient. = getCorrelationDegreecxx . . $ INDI/Correlator#getCorrelationDegree(31fa7155c10fdd13).();
144 return ret;
145 }
146
147 /**
148 * @brief setBaseline Set the baseline size in meters.
149 * @param baseline the baseline size.
150 */
151 void setBaselinecxx . . $ INDI/Correlator#setBaseline(c8a2ee128e7f347e).(Baselinecxx . . $ INDI/Correlator#Baseline# bl);
152
153 /**
154 * @brief setWavelength Set the observed wavelength.
155 * @param wavelength the wavelength in meters.
156 */
157 void setWavelengthcxx . . $ INDI/Correlator#setWavelength(ba8836b59fb42830).(double wl);
158
159 /**
160 * @brief setBandwidth Set the bandwidth of the correlator.
161 * @param bandwidth the instrumentation bandwidth in Hz.
162 */
163 void setBandwidthcxx . . $ INDI/Correlator#setBandwidth(ba8836b59fb42830).(double bw);
164
165 /**
166 * @brief setBaseline Get the baseline size in meters.
167 * @return the baseline size.
168 */
169 inline Baselinecxx . . $ INDI/Correlator#Baseline# getBaselinecxx . . $ INDI/Correlator#getBaseline(3fb7dd394503233b).()
170 {
171 return baselinecxx . . $ INDI/Correlator#baseline.;
172 }
173
174 /**
175 * @brief setWavelength Get the observed wavelength.
176 * @return the wavelength in meters.
177 */
178 inline double getWavelengthcxx . . $ INDI/Correlator#getWavelength(31fa7155c10fdd13).()
179 {
180 return wavelengthcxx . . $ INDI/Correlator#wavelength.;
181 }
182
183 /**
184 * @brief getUVCoordinates Get current UV projected coordinates with reference to the current sidereal time.
185 * @return the UV coordinates.
186 */
187 UVCoordinatecxx . . $ INDI/Correlator#UVCoordinate# getUVCoordinatescxx . . $ INDI/Correlator#getUVCoordinates(8f729e255fd2900e).();
188
189 /**
190 * @brief getUVCoordinates Get current UV projected coordinates with reference to the given sidereal time.
191 * \param lst the local sidereal time
192 * @return the UV coordinates.
193 */
194 UVCoordinatecxx . . $ INDI/Correlator#UVCoordinate# getUVCoordinatescxx . . $ INDI/Correlator#getUVCoordinates(62021475553e5a3d).(double lst);
195
196 /**
197 * @brief getUVCoordinates Get current UV projected coordinates with reference to zenith/azimuth baseline.
198 * \param alt altitude of the target
199 * \param az azimuth of the target
200 * @return the UV coordinates.
201 */
202 UVCoordinatecxx . . $ INDI/Correlator#UVCoordinate# getUVCoordinatescxx . . $ INDI/Correlator#getUVCoordinates(5d581f1bd5ae400b).(double alt, double az);
203
204 /**
205 * @brief getDelay Get current baseline delay with reference to the current sidereal time.
206 * @return the delay in meters.
207 */
208 double getDelaycxx . . $ INDI/Correlator#getDelay(31fa7155c10fdd13).();
209
210 /**
211 * @brief getUVCoordinates Get current baseline delay with reference to the given sidereal time.
212 * \param lst the local sidereal time
213 * @return the delay in meters.
214 */
215 double getDelaycxx . . $ INDI/Correlator#getDelay(447c67c6676f75c3).(double lst);
216
217 /**
218 * @brief getUVCoordinates Get current baseline delay with reference to zenith/azimuth baseline.
219 * \param alt altitude of the target
220 * \param az azimuth of the target
221 * @return the delay in meters.
222 */
223 double getDelaycxx . . $ INDI/Correlator#getDelay(d8e7e0733fa41c87).(double alt, double az);
224
225 /**
226 * @brief setBandwidth Get the bandwidth of the correlator.
227 * @return the instrumentation bandwidth in Hz.
228 */
229 inline double setBandwidthcxx . . $ INDI/Correlator#setBandwidth(31fa7155c10fdd13).()
230 {
231 return bandwidthcxx . . $ INDI/Correlator#bandwidth.;
232 }
233
234 /**
235 * @brief Return Vector Info Property
236 */
237 inline INumberVectorPropertycxx . . $ INumberVectorProperty# *getCorrelatorSettingscxx . . $ INDI/Correlator#getCorrelatorSettings(999695202a645091).()
238 {
239 return &CorrelatorSettingsNPcxx . . $ INDI/Correlator#CorrelatorSettingsNP.;
240 }
241
242 /**
243 * @brief GetCorrelatorCapability returns the Sensor capabilities.
244 */
245 uint32_tcxx . . $ uint32_t# GetCorrelatorCapabilitycxx . . $ INDI/Correlator#GetCorrelatorCapability(ddd8539a2fcdd4ce).() const
246 {
247 return capabilitycxx . . $ INDI/SensorInterface#capability.;
248 }
249
250 /**
251 * @brief SetCorrelatorCapability Set the Correlator capabilities. Al fields must be initilized.
252 * @param cap pointer to CorrelatorCapability struct.
253 */
254 void SetCorrelatorCapabilitycxx . . $ INDI/Correlator#SetCorrelatorCapability(cb2f890c2fdad230).(uint32_tcxx . . $ uint32_t# cap);
255
256 /**
257 * @brief setMinMaxStep for a number property element
258 * @param property Property name
259 * @param element Element name
260 * @param min Minimum element value
261 * @param max Maximum element value
262 * @param step Element step value
263 * @param sendToClient If true (default), the element limits are updated and is sent to the
264 * client. If false, the element limits are updated without getting sent to the client.
265 */
266 virtual void setMinMaxStepcxx . . $ INDI/Correlator#setMinMaxStep(de907d96cafce77a).(const char *property, const char *element, double min, double max, double step,
267 bool sendToClient) override;
268
269 typedef enumcxx . . $ INDI/Correlator#$anonymous_type_6#
270 {
271 CORRELATOR_BASELINE_Xcxx . . $ INDI/Correlator#CORRELATOR_BASELINE_X. = 0,
272 CORRELATOR_BASELINE_Ycxx . . $ INDI/Correlator#CORRELATOR_BASELINE_Y.,
273 CORRELATOR_BASELINE_Zcxx . . $ INDI/Correlator#CORRELATOR_BASELINE_Z.,
274 CORRELATOR_WAVELENGTHcxx . . $ INDI/Correlator#CORRELATOR_WAVELENGTH.,
275 CORRELATOR_BANDWIDTHcxx . . $ INDI/Correlator#CORRELATOR_BANDWIDTH.,
276 } CORRELATOR_INFO_INDEXcxx . . $ INDI/Correlator#CORRELATOR_INFO_INDEX#;
277 INumberVectorPropertycxx . . $ INumberVectorProperty# CorrelatorSettingsNPcxx . . $ INDI/Correlator#CorrelatorSettingsNP.;
278
279 private:
280 Baselinecxx . . $ INDI/Correlator#Baseline# baselinecxx . . $ INDI/Correlator#baseline.;
281 double wavelengthcxx . . $ INDI/Correlator#wavelength.;
282 double bandwidthcxx . . $ INDI/Correlator#bandwidth.;
283 INumbercxx . . $ INumber# CorrelatorSettingsNcxx . . $ INDI/Correlator#CorrelatorSettingsN.[5];
284 };
285 }