mirror of
https://github.com/30hours/blah2.git
synced 2024-11-18 12:33:58 +00:00
Add constants namespace for speed of light, etc
This commit is contained in:
parent
c37704457d
commit
3ccf6dc093
5 changed files with 25 additions and 10 deletions
|
@ -15,6 +15,7 @@
|
|||
#include "process/detection/Interpolate.h"
|
||||
#include "process/spectrum/SpectrumAnalyser.h"
|
||||
#include "process/tracker/Tracker.h"
|
||||
#include "data/meta/Constants.h"
|
||||
|
||||
#include <ryml/ryml.hpp>
|
||||
#include <ryml/ryml_std.hpp> // optional header, provided for std:: interop
|
||||
|
@ -193,8 +194,8 @@ int main(int argc, char **argv)
|
|||
tree["process"]["tracker"]["initiate"]["N"] >> n;
|
||||
tree["process"]["tracker"]["delete"] >> nDelete;
|
||||
tree["process"]["tracker"]["initiate"]["maxAcc"] >> maxAcc;
|
||||
rangeRes = 299792458.0/fs;
|
||||
lambda = 299792458.0/fc;
|
||||
rangeRes = (double)Constants::c/fs;
|
||||
lambda = (double)Constants::c/fc;
|
||||
Tracker *tracker = new Tracker(m, n, nDelete, ambiguity->cpi_length_seconds(), maxAcc, rangeRes, lambda);
|
||||
|
||||
// setup process spectrum analyser
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "Detection.h"
|
||||
#include "data/meta/Constants.h"
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <chrono>
|
||||
|
@ -93,7 +94,7 @@ std::string Detection::delay_bin_to_km(std::string json, uint32_t fs)
|
|||
document["delay"].Clear();
|
||||
for (int i = 0; i < delay.size(); i++)
|
||||
{
|
||||
document["delay"].PushBack(1.0*delay[i]*(299792458/(double)fs)/1000, allocator);
|
||||
document["delay"].PushBack(1.0*delay[i]*(Constants::c/(double)fs)/1000, allocator);
|
||||
}
|
||||
|
||||
rapidjson::StringBuffer strbuf;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "Map.h"
|
||||
#include "data/meta/Constants.h"
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <chrono>
|
||||
|
@ -172,7 +173,7 @@ std::string Map<T>::delay_bin_to_km(std::string json, uint32_t fs)
|
|||
document["delay"].Clear();
|
||||
for (int i = 0; i < delay.size(); i++)
|
||||
{
|
||||
document["delay"].PushBack(1.0*delay[i]*(299792458/(double)fs)/1000, allocator);
|
||||
document["delay"].PushBack(1.0*delay[i]*(Constants::c/(double)fs)/1000, allocator);
|
||||
}
|
||||
|
||||
rapidjson::StringBuffer strbuf;
|
||||
|
|
11
src/data/meta/Constants.h
Normal file
11
src/data/meta/Constants.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef CONSTANTS_H
|
||||
#define CONSTANTS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Constants
|
||||
{
|
||||
const uint32_t c = 299792458;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -8,6 +8,7 @@
|
|||
#include "data/Detection.h"
|
||||
#include "data/Track.h"
|
||||
#include "process/tracker/Tracker.h"
|
||||
#include "data/meta/Constants.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -24,9 +25,9 @@ TEST_CASE("Constructor", "[constructor]")
|
|||
double cpi = 1;
|
||||
double maxAccInit = 10;
|
||||
double fs = 2000000;
|
||||
double rangeRes = 299792458.0/fs;
|
||||
double rangeRes = (double)Constants::c/fs;
|
||||
double fc = 204640000;
|
||||
double lambda = 299792458.0/fc;
|
||||
double lambda = (double)Constants::c/fc;
|
||||
Tracker tracker = Tracker(m, n, nDelete,
|
||||
cpi, maxAccInit, rangeRes, lambda);
|
||||
}
|
||||
|
@ -40,9 +41,9 @@ TEST_CASE("Process ACTIVE track constant acc", "[process]")
|
|||
double cpi = 1;
|
||||
double maxAccInit = 10;
|
||||
double fs = 2000000;
|
||||
double rangeRes = 299792458.0/fs;
|
||||
double rangeRes = (double)Constants::c/fs;
|
||||
double fc = 204640000;
|
||||
double lambda = 299792458.0/fc;
|
||||
double lambda = (double)Constants::c/fc;
|
||||
Tracker tracker = Tracker(m, n, nDelete,
|
||||
cpi, maxAccInit, rangeRes, lambda);
|
||||
|
||||
|
@ -64,9 +65,9 @@ TEST_CASE("Test predict", "[predict]")
|
|||
double cpi = 1;
|
||||
double maxAccInit = 10;
|
||||
double fs = 2000000;
|
||||
double rangeRes = 299792458.0/fs;
|
||||
double rangeRes = (double)Constants::c/fs;
|
||||
double fc = 204640000;
|
||||
double lambda = 299792458.0/fc;
|
||||
double lambda = (double)Constants::c/fc;
|
||||
Tracker tracker = Tracker(m, n, nDelete,
|
||||
cpi, maxAccInit, rangeRes, lambda);
|
||||
|
||||
|
|
Loading…
Reference in a new issue