dimval 0.2.0
Modern C++23 header-only library of dimensional values (units, measures, ranges)
Loading...
Searching...
No Matches
rf_sdr.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <dimval/define.hpp>
9#include <dimval/units/rf.hpp>
10#include <dimval/units/si.hpp>
11
12// -----------------------------------------------------------------------------
13// Frequency-related
14// -----------------------------------------------------------------------------
15
16DIMVAL_DEFINE_MEASURE(CenterFrequency,
17 ::dimval::Hertz,
18 "center_frequency",
19 "Center Frequency",
20 ::comms::Icon::from("ph:wave-sine"),
21 ::comms::Colors::mui::light_blue[400])
22
23DIMVAL_DEFINE_MEASURE(SampleRate,
24 ::dimval::Hertz,
25 "sample_rate",
26 "Sample Rate",
27 ::comms::Icons::mdi::chart_timeline_variant,
28 ::comms::Colors::mui::light_blue[500])
29
30DIMVAL_DEFINE_MEASURE(SymbolRate,
31 ::dimval::Hertz,
32 "symbol_rate",
33 "Symbol Rate",
34 ::comms::Icons::mdi::chart_bell_curve,
35 ::comms::Colors::mui::light_blue[600])
36
37DIMVAL_DEFINE_MEASURE(Bandwidth,
38 ::dimval::Hertz,
39 "bandwidth",
40 "Bandwidth",
41 ::comms::Icons::mdi::arrow_expand_horizontal,
42 ::comms::Colors::mui::light_blue[300])
43
44DIMVAL_DEFINE_MEASURE(IntermediateFrequency,
45 ::dimval::Hertz,
46 "intermediate_frequency",
47 "Intermediate Frequency",
48 ::comms::Icon::from("ph:wave-sine"),
49 ::comms::Colors::mui::light_blue[700])
50
51// -----------------------------------------------------------------------------
52// Power / signal level
53// -----------------------------------------------------------------------------
54
56 ::dimval::Watt,
57 "rf_power",
58 "RF Power",
59 ::comms::Icons::mdi::signal,
60 ::comms::Colors::mui::deep_orange[400])
61
62DIMVAL_DEFINE_MEASURE(RfPowerDbm,
63 ::dimval::DecibelMilliwatt,
64 "rf_power_dbm",
65 "RF Power Level",
66 ::comms::Icons::mdi::signal,
67 ::comms::Colors::mui::deep_orange[500])
68
69DIMVAL_DEFINE_MEASURE(RfPowerDbw,
70 ::dimval::DecibelWatt,
71 "rf_power_dbw",
72 "RF Power Level",
73 ::comms::Icons::mdi::signal,
74 ::comms::Colors::mui::deep_orange[600])
75
76DIMVAL_DEFINE_MEASURE(SignalLevelDbuv,
77 ::dimval::DecibelMicrovolt,
78 "signal_level_dbuv",
79 "Signal Level",
80 ::comms::Icons::mdi::signal,
81 ::comms::Colors::mui::deep_orange[300])
82
83DIMVAL_DEFINE_MEASURE(SignalLevelDbmv,
84 ::dimval::DecibelMillivolt,
85 "signal_level_dbmv",
86 "Signal Level",
87 ::comms::Icons::mdi::signal,
88 ::comms::Colors::mui::deep_orange[200])
89
90// -----------------------------------------------------------------------------
91// Gain / loss / quality
92// -----------------------------------------------------------------------------
93
95 ::dimval::Decibel,
96 "gain",
97 "Gain",
98 ::comms::Icons::mdi::chart_bell_curve,
99 ::comms::Colors::mui::green[400])
100
102 ::dimval::Decibel,
103 "loss",
104 "Loss",
105 ::comms::Icons::mdi::chart_bell_curve,
106 ::comms::Colors::mui::red[400])
107
108DIMVAL_DEFINE_MEASURE(PathLoss,
109 ::dimval::Decibel,
110 "path_loss",
111 "Path Loss",
112 ::comms::Icons::mdi::chart_bell_curve,
113 ::comms::Colors::mui::red[400])
114
116 ::dimval::Decibel,
117 "snr",
118 "Signal-to-Noise Ratio",
119 ::comms::Icons::mdi::chart_bell_curve,
120 ::comms::Colors::mui::green[400])
121
123 ::dimval::Decibel,
124 "cnr",
125 "Carrier-to-Noise Ratio",
126 ::comms::Icons::mdi::chart_bell_curve,
127 ::comms::Colors::mui::green[400])
128
130 ::dimval::Decibel,
131 "eb_no",
132 "Energy per Bit to Noise Density Ratio",
133 ::comms::Icons::mdi::chart_bell_curve,
134 ::comms::Colors::mui::green[500])
135
137 ::dimval::Decibel,
138 "mer",
139 "Modulation Error Ratio",
140 ::comms::Icons::mdi::chart_bell_curve,
141 ::comms::Colors::mui::green[400])
142
143DIMVAL_DEFINE_MEASURE(EvmPercent,
144 ::dimval::Percent,
145 "evm_percent",
146 "Error Vector Magnitude",
147 ::comms::Icons::mdi::percent,
148 ::comms::Colors::mui::red[400],
149 static constexpr int default_precision = 2;)
150
152 ::dimval::Decibel,
153 "evm_db",
154 "Error Vector Magnitude",
155 ::comms::Icons::mdi::percent,
156 ::comms::Colors::mui::red[400])
157
158// -----------------------------------------------------------------------------
159// Phase / IQ
160// -----------------------------------------------------------------------------
161
163 ::dimval::PhaseDegree,
164 "phase",
165 "Phase",
166 ::comms::Icons::mdi::angle_acute,
167 ::comms::Colors::mui::deep_purple[400])
168
169DIMVAL_DEFINE_MEASURE(PhaseRadians,
170 ::dimval::PhaseRadian,
171 "phase_radians",
172 "Phase",
173 ::comms::Icons::mdi::angle_acute,
174 ::comms::Colors::mui::deep_purple[500])
175
176DIMVAL_DEFINE_MEASURE(IqImbalanceGain,
177 ::dimval::Decibel,
178 "iq_imbalance_gain",
179 "IQ Gain Imbalance",
180 ::comms::Icons::mdi::sine_wave,
181 ::comms::Colors::mui::green[600])
182
183DIMVAL_DEFINE_MEASURE(IqImbalancePhase,
184 ::dimval::PhaseDegree,
185 "iq_imbalance_phase",
186 "IQ Phase Imbalance",
187 ::comms::Icons::mdi::sine_wave,
188 ::comms::Colors::mui::deep_purple[600])
189
190// -----------------------------------------------------------------------------
191// Frequency error / stability / drift
192// -----------------------------------------------------------------------------
193
194DIMVAL_DEFINE_MEASURE(FrequencyErrorHz,
195 ::dimval::Hertz,
196 "frequency_error_hz",
197 "Frequency Error",
198 ::comms::Icons::mdi::tune_variant,
199 ::comms::Colors::mui::red[400])
200
201DIMVAL_DEFINE_MEASURE(FrequencyErrorPpm,
202 ::dimval::PartsPerMillion,
203 "frequency_error_ppm",
204 "Frequency Error",
205 ::comms::Icons::mdi::tune_variant,
206 ::comms::Colors::mui::red[400])
207
208DIMVAL_DEFINE_MEASURE(FrequencyStabilityPpb,
209 ::dimval::PartsPerBillion,
210 "frequency_stability_ppb",
211 "Frequency Stability",
212 ::comms::Icons::mdi::tune,
213 ::comms::Colors::mui::cyan[400])
214
215DIMVAL_DEFINE_MEASURE(ClockDrift,
216 ::dimval::SecondsPerDay,
217 "clock_drift",
218 "Clock Drift",
219 ::comms::Icons::mdi::clock_alert_outline,
220 ::comms::Colors::mui::blue[400])
221
222// -----------------------------------------------------------------------------
223// Spectral / noise density
224// -----------------------------------------------------------------------------
225
226DIMVAL_DEFINE_MEASURE(NoiseDensityVoltage,
227 ::dimval::VoltPerRootHertz,
228 "noise_density_voltage",
229 "Voltage Noise Density",
230 ::comms::Icons::mdi::chart_line,
231 ::comms::Colors::mui::cyan[400])
232
233DIMVAL_DEFINE_MEASURE(NoiseDensityCurrent,
234 ::dimval::AmperePerRootHertz,
235 "noise_density_current",
236 "Current Noise Density",
237 ::comms::Icons::mdi::chart_line,
238 ::comms::Colors::mui::cyan[500])
239
240DIMVAL_DEFINE_MEASURE(PowerSpectralDensity,
241 ::dimval::WattPerHertz,
242 "power_spectral_density",
243 "Power Spectral Density",
244 ::comms::Icons::mdi::chart_line,
245 ::comms::Colors::mui::cyan[600])
246
247DIMVAL_DEFINE_MEASURE(NoiseDensityDb,
248 ::dimval::DecibelPerHertz,
249 "noise_density_db",
250 "Noise Density",
251 ::comms::Icons::mdi::chart_line,
252 ::comms::Colors::mui::cyan[700])
Macros that expand into a CRTP unit/measure struct and a runtime auto-registration for it.
#define DIMVAL_DEFINE_MEASURE(Tag, BaseUnit, Id, Name, Icon, Color,...)
Define a measure struct in ::dimval and auto-register its descriptor.
Definition define.hpp:102
Dimensionless units.
Practical / accepted units that mostly carry their own kind: clock drift, rotational frequency,...
RF / SDR units — logarithmic ratios (dB family + Neper), phase angle alternates, spectral density uni...
Canonical SI units (base + derived) and accepted/practical alts.