gaps-online-software 0.10
online software for the TOF system for the GAPS experiment
Loading...
Searching...
No Matches
monitoring.h
1#ifndef MONITORINGPACKETS_H_INCLUDED
2#define MONITORINGPACKETS_H_INCLUDED
3
4#include <array>
5
6#include "tof_typedefs.h"
7#include "serialization.h"
8
21 static constexpr u16 HEAD = 0xAAAA;
23 static constexpr u16 TAIL = 0x5555;
25 static constexpr u8 SIZE = 25;
26
32 f32 ltb_temp ;
33 std::array<f32, 3> thresh ;
34
36
39 static auto from_bytestream(const Vec<u8> &stream, usize &pos)
40 -> LTBMoniData;
41
43 auto to_string() const -> std::string;
44};
45
46std::ostream& operator<<(std::ostream& os, const LTBMoniData& moni);
47
53struct RBMoniData {
54 static constexpr u16 HEAD = 0xAAAA;
55 static constexpr u16 TAIL = 0x5555;
56 static constexpr u8 SIZE = 151;
57
58 u8 board_id ;
60 u16 rate ;
61 f32 tmp_drs ;
62 f32 tmp_clk ;
63 f32 tmp_adc ;
65 f32 tmp_zynq ;
66 f32 tmp_lis3mdltr ;
67 f32 tmp_bm280 ;
69 f32 pressure ;
71 f32 humidity ;
72 f32 mag_x ;
73 f32 mag_y ;
74 f32 mag_z ;
76 f32 mag_tot ;
77 f32 drs_dvdd_voltage ;
78 f32 drs_dvdd_current ;
79 f32 drs_dvdd_power ;
80 f32 p3v3_voltage ;
81 f32 p3v3_current ;
82 f32 p3v3_power ;
83 f32 zynq_voltage ;
84 f32 zynq_current ;
85 f32 zynq_power ;
86 f32 p3v5_voltage ;
87 f32 p3v5_current ;
88 f32 p3v5_power ;
89 f32 adc_dvdd_voltage ;
90 f32 adc_dvdd_current ;
91 f32 adc_dvdd_power ;
92 f32 adc_avdd_voltage ;
93 f32 adc_avdd_current ;
94 f32 adc_avdd_power ;
95 f32 drs_avdd_voltage ;
96 f32 drs_avdd_current ;
97 f32 drs_avdd_power ;
98 f32 n1v5_voltage ;
99 f32 n1v5_current ;
100 f32 n1v5_power ;
101
102 RBMoniData();
103
104 static auto from_bytestream(const Vec<u8> &stream, usize &pos)
105 -> RBMoniData;
106
108 auto to_string() const -> std::string;
109};
110
111std::ostream& operator<<(std::ostream& os, const RBMoniData& moni);
112
117 static constexpr u16 HEAD = 0xAAAA;
118 static constexpr u16 TAIL = 0x5555;
119 static constexpr u8 SIZE = 89;
120
121 u8 board_id;
122 std::array<f32, 3> p3v6_preamp_vcp;
123 std::array<f32, 3> n1v6_preamp_vcp;
124 std::array<f32, 3> p3v4f_ltb_vcp;
125 std::array<f32, 3> p3v4d_ltb_vcp;
126 std::array<f32, 3> p3v6_ltb_vcp;
127 std::array<f32, 3> n1v6_ltb_vcp;
128 f32 pds_temp;
129 f32 pas_temp;
130 f32 nas_temp;
131 f32 shv_temp;
132
133 PBMoniData();
134
136 static auto from_bytestream(const Vec<u8> &stream, usize &pos)
137 -> PBMoniData;
138
140 auto to_string() const -> std::string;
141};
142
143std::ostream& operator<<(std::ostream& os, const PBMoniData& moni);
144
149 static constexpr u16 HEAD = 0xAAAA;
150 static constexpr u16 TAIL = 0x5555;
151 static constexpr u8 SIZE = 89;
152
153 u8 board_id;
154 std::array<f32, 16> temps;
155 std::array<f32, 16> biases;
156 PAMoniData();
157
159 static auto from_bytestream(const Vec<u8> &stream, usize &pos)
160 -> PAMoniData;
161
163 auto to_string() const -> std::string;
164};
165
166std::ostream& operator<<(std::ostream& os, const PAMoniData& moni);
167
173 static constexpr u16 HEAD = 0xAAAA;
174 static constexpr u16 TAIL = 0x5555;
175 static constexpr u8 SIZE = 6;
176
177 f32 fpga_temp ;
178 f32 fpga_vccint ;
179 f32 fpga_vccaux ;
180 f32 fpga_vccbram ;
181 u16 rate ;
182 u16 lost_rate ;
183 u32 tiu_busy_len ;
184 u8 tiu_status ;
185 u8 prescale_pc ;
186 u16 daq_queue_len;
187
188 MtbMoniData();
189
190 auto to_string() const -> std::string;
191
192 auto get_tiu_emulation_mode() const -> bool;
193 auto get_tiu_use_aux_link() const -> bool;
194 auto get_tiu_bad() const -> bool;
195 auto get_tiu_busy_stuck() const -> bool;
196 auto get_tiu_ignore_busy() const -> bool;
198 auto get_fpga_temp() const -> f32;
200 static auto from_bytestream(const Vec<u8>& payload, usize& pos)
201 -> MtbMoniData;
202};
203
204std::ostream& operator<<(std::ostream& os, const MtbMoniData& moni);
205
211 static constexpr u16 HEAD = 0xAAAA;
212 static constexpr u16 TAIL = 0x5555;
213 static constexpr u8 SIZE = 41;
214
215 u32 uptime ;
216 u8 disk_usage ;
217 std::array<u32, 4> cpu_freq ;
218 f32 cpu_temp ;
219 f32 cpu0_temp ;
220 f32 cpu1_temp ;
221 f32 mb_temp ;
222
223 CPUMoniData();
225 static auto from_bytestream(const Vec<u8>& payload, usize &pos)
226 -> CPUMoniData;
227
228 auto to_string() const -> std::string;
229};
230
231std::ostream& operator<<(std::ostream& os, const CPUMoniData& moni);
232
233#endif
Definition monitoring.h:210
static auto from_bytestream(const Vec< u8 > &payload, usize &pos) -> CPUMoniData
extract moni data from payload
Allow to extend all classes with a from_tofpacket method.
Definition serialization.h:18
Definition monitoring.h:19
static auto from_bytestream(const Vec< u8 > &stream, usize &pos) -> LTBMoniData
f32 trenz_temp
FIXME - temperature.
Definition monitoring.h:30
auto to_string() const -> std::string
String representatioin for printing.
static constexpr u16 HEAD
struct begin marker bytes
Definition monitoring.h:21
static constexpr u8 SIZE
byte size with HEAD + TAIL
Definition monitoring.h:25
u8 board_id
FIXME - this might be the RB id.
Definition monitoring.h:28
static constexpr u16 TAIL
struct end marker bytes
Definition monitoring.h:23
Definition monitoring.h:172
auto get_fpga_temp() const -> f32
Convert ADC temp from adc values to Celsius.
Definition monitoring.h:148
static auto from_bytestream(const Vec< u8 > &stream, usize &pos) -> PAMoniData
Factory function - restore PAMoniData from byte-representation.
auto to_string() const -> std::string
String representation for pretty printing.
Definition monitoring.h:116
auto to_string() const -> std::string
String representation for pretty printing.
static auto from_bytestream(const Vec< u8 > &stream, usize &pos) -> PBMoniData
Factor function - restore PAMoniData from byte-representation.
Definition monitoring.h:53
f32 humidity
ambient humidity
Definition monitoring.h:71
f32 pressure
ambient pressure
Definition monitoring.h:69
auto to_string() const -> std::string
String representatioin for printing.
u16 rate
Rate as recorded by the board itself.
Definition monitoring.h:60
f32 mag_tot
total strength of magnetic field
Definition monitoring.h:76
f32 tmp_zynq
fpga temperature
Definition monitoring.h:65