|
| 1 | +/*********************************************************************************************************************** |
| 2 | + * LibDegorasSLR (Degoras Project SLR Library). * |
| 3 | + * * |
| 4 | + * A modern and efficient C++ base library for Satellite Laser Ranging (SLR) software and real-time hardware * |
| 5 | + * related developments. Developed as a free software under the context of Degoras Project for the Spanish Navy * |
| 6 | + * Observatory SLR station (SFEL) in San Fernando and, of course, for any other station that wants to use it! * |
| 7 | + * * |
| 8 | + * Copyright (C) 2024 Degoras Project Team * |
| 9 | + * < Ángel Vera Herrera, avera@roa.es - angeldelaveracruz@gmail.com > * |
| 10 | + * < Jesús Relinque Madroñal > * |
| 11 | + * * |
| 12 | + * This file is part of LibDegorasSLR. * |
| 13 | + * * |
| 14 | + * Licensed under the European Union Public License (EUPL), Version 1.2 or subsequent versions of the EUPL license * |
| 15 | + * as soon they will be approved by the European Commission (IDABC). * |
| 16 | + * * |
| 17 | + * This project is free software: you can redistribute it and/or modify it under the terms of the EUPL license as * |
| 18 | + * published by the IDABC, either Version 1.2 or, at your option, any later version. * |
| 19 | + * * |
| 20 | + * This project is distributed in the hope that it will be useful. Unless required by applicable law or agreed to in * |
| 21 | + * writing, it is distributed on an "AS IS" basis, WITHOUT ANY WARRANTY OR CONDITIONS OF ANY KIND; without even the * |
| 22 | + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the EUPL license to check specific * |
| 23 | + * language governing permissions and limitations and more details. * |
| 24 | + * * |
| 25 | + * You should use this project in compliance with the EUPL license. You should have received a copy of the license * |
| 26 | + * along with this project. If not, see the license at < https://eupl.eu/ >. * |
| 27 | + **********************************************************************************************************************/ |
| 28 | + |
| 29 | +/** ******************************************************************************************************************** |
| 30 | + * @file pass_calculator.h |
| 31 | + * @author Degoras Project Team |
| 32 | + * @brief This file contains the declaration of the PassCalculator class. |
| 33 | + * @copyright EUPL License |
| 34 | +***********************************************************************************************************************/ |
| 35 | + |
| 36 | +// ===================================================================================================================== |
| 37 | +#pragma once |
| 38 | +// ===================================================================================================================== |
| 39 | + |
| 40 | +// C++ INCLUDES |
| 41 | +// ===================================================================================================================== |
| 42 | +#include <vector> |
| 43 | +// ===================================================================================================================== |
| 44 | + |
| 45 | +// LIBRARY INCLUDES |
| 46 | +// ===================================================================================================================== |
| 47 | +#include "LibDegorasSLR/libdegorasslr_global.h" |
| 48 | +#include "LibDegorasSLR/UtilitiesSLR/predictors/predictor_slr_base.h" |
| 49 | +// ===================================================================================================================== |
| 50 | + |
| 51 | +// DPSLR NAMESPACES |
| 52 | +// ===================================================================================================================== |
| 53 | +namespace dpslr{ |
| 54 | +namespace slr{ |
| 55 | +namespace utils{ |
| 56 | +// ===================================================================================================================== |
| 57 | + |
| 58 | +/** |
| 59 | + * @brief The Pass struct contains data about a space object pass |
| 60 | + */ |
| 61 | +struct LIBDPSLR_EXPORT Pass |
| 62 | +{ |
| 63 | + struct LIBDPSLR_EXPORT Step |
| 64 | + { |
| 65 | + timing::dates::MJDateTime mjd; ///< Modified julian date of step. |
| 66 | + math::units::Degrees azim; ///< Azimuth of the step in degrees. |
| 67 | + math::units::Degrees elev; ///< Elevation of the step in degrees. |
| 68 | + long double azim_rate; ///< Azimuth rate of step in deg/s |
| 69 | + long double elev_rate; ///< Elevation rate of step in deg/s |
| 70 | + }; |
| 71 | + |
| 72 | + math::units::Seconds interval; ///< Interval between two steps in seconds |
| 73 | + math::units::Degrees min_elev; ///< Minimum elevation for pass. |
| 74 | + std::vector<Step> steps; ///< Steps of the pass |
| 75 | +}; |
| 76 | + |
| 77 | +/** |
| 78 | + * @brief This class implements a utility that calculates passes using a SLR predictor. |
| 79 | + */ |
| 80 | +class LIBDPSLR_EXPORT PassCalculator |
| 81 | +{ |
| 82 | +public: |
| 83 | + |
| 84 | + enum ResultCode |
| 85 | + { |
| 86 | + NOT_ERROR, |
| 87 | + PREDICTOR_NOT_VALID, |
| 88 | + INTERVAL_OUTSIDE_OF_PREDICTOR, |
| 89 | + SOME_PREDICTIONS_NOT_VALID, |
| 90 | + OTHER_ERROR |
| 91 | + |
| 92 | + }; |
| 93 | + |
| 94 | + /** |
| 95 | + * @brief PassCalculator constructs the pass calculator. |
| 96 | + * @param predictor the predictor used to calculate the passes. |
| 97 | + * @param min_elev minimum elevation of the pass in degrees. By default is 0, i.e., above the horizon. |
| 98 | + * @param interval interval between two steps of the pass in seconds. By default is 1 second. |
| 99 | + */ |
| 100 | + PassCalculator(predictors::PredictorSlrPtr predictor, math::units::Degrees min_elev = 0, |
| 101 | + math::units::Seconds interval = 1.L); |
| 102 | + |
| 103 | + |
| 104 | + /** |
| 105 | + * @brief Setter for minimum elevation. |
| 106 | + * @param min_elev the minimum elevation in degrees. |
| 107 | + */ |
| 108 | + void setMinElev(math::units::Degrees min_elev); |
| 109 | + /** |
| 110 | + * @brief Getter for minimum elevation. |
| 111 | + * @return the minimum elevation in degrees. |
| 112 | + */ |
| 113 | + math::units::Degrees minElev() const; |
| 114 | + /** |
| 115 | + * @brief Setter for interval. |
| 116 | + * @param interval the interval for interpolation in seconds. |
| 117 | + */ |
| 118 | + void setInterval(math::units::Seconds interval); |
| 119 | + /** |
| 120 | + * @brief Getter for interval. |
| 121 | + * @return the interval for interpolation in seconds. |
| 122 | + */ |
| 123 | + math::units::Seconds interval() const; |
| 124 | + |
| 125 | + /** |
| 126 | + * @brief Get passes within the given interval of time. |
| 127 | + * @param mjd_start the modified julian date of interval start. |
| 128 | + * @param mjd_end the modified julian date of interval end. |
| 129 | + * @param passes the returned passes. |
| 130 | + * @return The result of the operation. |
| 131 | + */ |
| 132 | + ResultCode getPasses(const timing::dates::MJDateTime &mjd_start, |
| 133 | + const timing::dates::MJDateTime &mjd_end, |
| 134 | + std::vector<Pass> &passes) const; |
| 135 | + |
| 136 | + |
| 137 | +private: |
| 138 | + math::units::Degrees min_elev_; |
| 139 | + math::units::Seconds interval_; |
| 140 | + predictors::PredictorSlrPtr predictor_; |
| 141 | +}; |
| 142 | + |
| 143 | + |
| 144 | +}}} // END NAMESPACES. |
| 145 | +// ===================================================================================================================== |
0 commit comments