| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // This file is part of INSTINCT, the INS Toolkit for Integrated | ||
| 2 | // Navigation Concepts and Training by the Institute of Navigation of | ||
| 3 | // the University of Stuttgart, Germany. | ||
| 4 | // | ||
| 5 | // This Source Code Form is subject to the terms of the Mozilla Public | ||
| 6 | // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| 7 | // file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
| 8 | |||
| 9 | /// @file SNRMask.hpp | ||
| 10 | /// @brief Signal to Noise Ratio Mask | ||
| 11 | /// @author T. Topp (topp@ins.uni-stuttgart.de) | ||
| 12 | /// @date 2023-12-17 | ||
| 13 | |||
| 14 | #pragma once | ||
| 15 | |||
| 16 | #include <array> | ||
| 17 | |||
| 18 | #include "Navigation/GNSS/Core/Frequency.hpp" | ||
| 19 | #include "Navigation/Transformations/Units.hpp" | ||
| 20 | |||
| 21 | namespace NAV | ||
| 22 | { | ||
| 23 | |||
| 24 | /// Signal to Noise Ratio Mask | ||
| 25 | class SNRMask | ||
| 26 | { | ||
| 27 | public: | ||
| 28 | /// @brief Default Constructor | ||
| 29 | SNRMask(); | ||
| 30 | |||
| 31 | /// @brief Shows a button to select the SNR Mask | ||
| 32 | /// @param[in] label Text to display on the button. If empty, just 'SNR Mask' will be written | ||
| 33 | bool ShowGuiWidgets(const char* label = nullptr); | ||
| 34 | |||
| 35 | /// @brief Checks wether all SNR values are 0 | ||
| 36 | [[nodiscard]] bool isInactive() const; | ||
| 37 | |||
| 38 | /// @brief Checks wether the SNR values passes the SNR mask | ||
| 39 | /// @param[in] freq Frequency of the signal | ||
| 40 | /// @param[in] elevation Elevation in [rad] of the satellite transmitting the signal | ||
| 41 | /// @param[in] SNR Signal to Noise Ratio in [dbHz] | ||
| 42 | /// @return True if the value passed the mask | ||
| 43 | [[nodiscard]] bool checkSNRMask(Frequency freq, double elevation, double SNR) const; | ||
| 44 | |||
| 45 | /// @brief Disables the SNR mask by setting all values to 0 | ||
| 46 | 1202 | void disable() | |
| 47 | { | ||
| 48 |
2/2✓ Branch 0 taken 32454 times.
✓ Branch 1 taken 1202 times.
|
33656 | for (auto& m : mask) |
| 49 | { | ||
| 50 |
2/2✓ Branch 0 taken 324540 times.
✓ Branch 1 taken 32454 times.
|
356994 | for (auto& snr : m.second.first) |
| 51 | { | ||
| 52 | 324540 | snr = 0.0; | |
| 53 | } | ||
| 54 | } | ||
| 55 | 1202 | } | |
| 56 | |||
| 57 | private: | ||
| 58 | /// @brief Elevations [rad]. Checks to smaller or equal than the value | ||
| 59 | static constexpr std::array<double, 10> elevations = { | ||
| 60 | deg2rad(5.0), | ||
| 61 | deg2rad(15.0), | ||
| 62 | deg2rad(25.0), | ||
| 63 | deg2rad(35.0), | ||
| 64 | deg2rad(45.0), | ||
| 65 | deg2rad(55.0), | ||
| 66 | deg2rad(65.0), | ||
| 67 | deg2rad(75.0), | ||
| 68 | deg2rad(85.0), | ||
| 69 | deg2rad(90.0), | ||
| 70 | }; | ||
| 71 | |||
| 72 | /// @brief Values when changed override all others | ||
| 73 | std::pair<std::array<double, elevations.size()>, bool> allOverride = { {}, true }; | ||
| 74 | |||
| 75 | /// @brief Masks for all frequencies and SNR [dbHz] values + lock together boolean | ||
| 76 | std::array<std::pair<Frequency, std::pair<std::array<double, elevations.size()>, bool>>, Frequency::GetAll().size()> mask; | ||
| 77 | |||
| 78 | friend void to_json(json& j, const SNRMask& obj); | ||
| 79 | friend void from_json(const json& j, SNRMask& obj); | ||
| 80 | }; | ||
| 81 | |||
| 82 | /// @brief Converts the provided object into json | ||
| 83 | /// @param[out] j Json object which gets filled with the info | ||
| 84 | /// @param[in] obj Object to convert into json | ||
| 85 | void to_json(json& j, const SNRMask& obj); | ||
| 86 | /// @brief Converts the provided json object into a node object | ||
| 87 | /// @param[in] j Json object with the needed values | ||
| 88 | /// @param[out] obj Object to fill from the json | ||
| 89 | void from_json(const json& j, SNRMask& obj); | ||
| 90 | |||
| 91 | } // namespace NAV | ||
| 92 |