Skip to content

Commit

Permalink
Adjust for single library header
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanielloNTIA committed Nov 21, 2024
1 parent f0ebdaf commit 57fdc5b
Show file tree
Hide file tree
Showing 11 changed files with 142 additions and 225 deletions.
2 changes: 1 addition & 1 deletion app/include/Structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
#pragma once

#include "ITS.ITU.PSeries.P2108/Enums.h" // For ClutterType
#include "P2108.h" // For ClutterType enum

#include <string> // for std::string

Expand Down
40 changes: 0 additions & 40 deletions include/ITS.ITU.PSeries.P2108/Enums.h

This file was deleted.

79 changes: 0 additions & 79 deletions include/ITS.ITU.PSeries.P2108/P2108.h

This file was deleted.

43 changes: 0 additions & 43 deletions include/ITS.ITU.PSeries.P2108/ReturnCodes.h

This file was deleted.

136 changes: 136 additions & 0 deletions include/P2108.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/** @file P2108.h
* Interface header for this library
*/
#pragma once

#include <string> // for std::string
#include <unordered_map> // for std::unordered_map

namespace ITS {
namespace ITU {
namespace PSeries {
namespace P2108 {

// Define cross-platform PROPLIB_API to export functions
#ifndef DOXYGEN_SHOULD_SKIP
#ifndef PROPLIB_API
#ifdef _WIN32
#define PROPLIB_API extern "C" __declspec(dllexport)
#else
#define PROPLIB_API extern "C"
#endif
#endif
#endif

////////////////////////////////////////////////////////////////////////////////
// Enums

/** Clutter type enum, based on Table 3 in Section 3.1 */
enum ClutterType {
WATER_SEA = 1, /**< Water/sea clutter type */
OPEN_RURAL = 2, /**< Open/rural clutter type */
SUBURBAN = 3, /**< Suburban clutter type */
URBAN = 4, /**< Urban clutter type */
TREES_FOREST = 5, /**< Trees/forest clutter type */
DENSE_URBAN = 6, /**< Dense urban clutter type */
};

/*******************************************************************************
* Default values of the representative clutter height @f$ R @f$,
* in meters, by clutter type.
*
* These should be used as inputs to the height gain terminal
* correction model when local information is not available.
******************************************************************************/
enum RepresentativeClutterHeight {
R__WATER_SEA = 10, /**< @f$ R @f$ for the trees/forest clutter type */
R__OPEN_RURAL = 10, /**< @f$ R @f$ for the open/rural clutter type */
R__SUBURBAN = 10, /**< @f$ R @f$ for the suburban clutter type */
R__URBAN = 15, /**< @f$ R @f$ for the urban clutter type */
R__TREES_FOREST = 15, /**< @f$ R @f$ for the trees/forest clutter type */
R__DENSE_URBAN = 20, /**< @f$ R @f$ for the dense urban clutter type */
};

/*******************************************************************************
* Return Codes defined by this software (0-127)
******************************************************************************/
// clang-format off
enum ReturnCode {
SUCCESS = 0, /**< Successful execution */

// Section 3.1 Error Codes
ERROR31__FREQUENCY = 32, /**< Frequency must be between 0.3 and 3 GHz */
ERROR31__ANTENNA_HEIGHT, /**< Antenna height must be @f$ \geq @f$ 0 meters */
ERROR31__STREET_WIDTH, /**< Street width must be @f$ > @f$ 0 meters */
ERROR31__CLUTTER_HEIGHT, /**< Representative clutter height must be @f$ > @f$ 0 meters */
ERROR31__CLUTTER_TYPE, /**< Invalid value for clutter type */

// Section 3.2 Error Codes
ERROR32__FREQUENCY = 48, /**< Frequency must be between 2 and 67 GHz */
ERROR32__DISTANCE, /**< Path distance must be @f$ \geq @f$ 0.25 km */
ERROR32__PERCENTAGE, /**< Percentage must be between 0 and 100 */

// Section 3.3 Error Codes
ERROR33__FREQUENCY = 64, /**< Frequency must be between 10 and 100 GHz */
ERROR33__THETA, /**< Elevation angle must be between 0 and 100 GHz */
ERROR33__PERCENTAGE, /**< Percentage must be between 0 and 100 */
};
// clang-format on

////////////////////////////////////////////////////////////////////////////////
// Constants
/** Approximate value of @f$ \pi @f$ */
constexpr double PI = 3.14159265358979323846;

////////////////////////////////////////////////////////////////////////////////
// Public Functions
PROPLIB_API ReturnCode AeronauticalStatisticalModel(
const double f__ghz,
const double theta__deg,
const double p,
double &L_ces__db
);
PROPLIB_API ReturnCode TerrestrialStatisticalModel(
const double f__ghz, const double d__km, const double p, double &L_ctt__db
);
PROPLIB_API ReturnCode HeightGainTerminalCorrectionModel(
const double f__ghz,
const double h__meter,
const double w_s__meter,
const double R__meter,
const ClutterType clutter_type,
double &A_h__db
);
PROPLIB_API char *GetReturnStatusCharArray(const int code);
PROPLIB_API void FreeReturnStatusCharArray(char *c_msg);

////////////////////////////////////////////////////////////////////////////////
// Private Functions
std::string GetReturnStatus(const int code);
double cot(const double x);
double InverseComplementaryCumulativeDistribution(const double q);
double Equation_2a(const double nu);
double Equation_2b(
const double K_h2, const double h__meter, const double R__meter
);
ReturnCode Section3p1_InputValidation(
const double f__ghz,
const double h__meter,
const double w_s__meter,
const double R__meter
);
ReturnCode Section3p2_InputValidation(
const double f__ghz, const double d__km, const double p
);
ReturnCode Section3p3_InputValidation(
const double f__ghz, const double theta__deg, const double p
);
double TerrestrialStatisticalModelHelper(
const double f__ghz, const double d__km, const double p
);


} // namespace P2108
} // namespace PSeries
} // namespace ITU
} // namespace ITS
57 changes: 0 additions & 57 deletions include/PropLibTemplate.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/AeronauticalStatisticalModel.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @file AeronauticalStatisticalModel.cpp
* Implements the model from ITU-R P.2108 Section 3.3.
*/
#include "ITS.ITU.PSeries.P2108/P2108.h"
#include "P2108.h"

#include <cmath> // for std::pow, std::log, std::tan

Expand Down
2 changes: 1 addition & 1 deletion src/HeightGainTerminalCorrectionModel.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @file HeightGainTerminalCorrectionModel.cpp
* Implements the model from ITU-R P.2108 Section 3.1.
*/
#include "ITS.ITU.PSeries.P2108/P2108.h"
#include "P2108.h"

#include <cmath> // for std::atan, std::log10, std::pow, std::sqrt

Expand Down
2 changes: 1 addition & 1 deletion src/InverseComplementaryCumulativeDistribution.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @internal @file InverseComplementaryCumulativeDistribution.cpp
* @brief Implements a function to calculate the inverse CCDF.
*/
#include "ITS.ITU.PSeries.P2108/P2108.h"
#include "P2108.h"

#include <cmath> // for std::log, std::sqrt
#include <stdexcept> // for std::out_of_range
Expand Down
Loading

0 comments on commit 57fdc5b

Please sign in to comment.