WSF
WsfMTI_TableManager.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFMTI_TABLEMANAGER_HPP
13#define WSFMTI_TABLEMANAGER_HPP
14
15#include "wsf_export.h"
16
17#include <algorithm>
18#include <cmath>
19#include <deque>
20#include <fstream>
21#include <iostream>
22#include <iterator>
23#include <map>
24#include <set>
25#include <sstream>
26#include <string>
27#include <vector>
28
29#include "TblLookup.hpp"
30#include "UtMath.hpp"
31
39class WSF_EXPORT WsfMTI_TableManager
40{
41public:
44 {
45 public:
47 virtual ~MTI_AdjustmentTable() = default;
48
49 virtual double ComputeAdjustmentFactor(double aClosingSpeed, double aFrequency);
50
51 // For External Services.
53 TblIndVarU<double>& GetSpeedFrequencyTable() { return mSpeedFrequencyTable; }
54 TblDepVar1<double>& GetAdjustmentTable() { return mAdjustmentTable; }
55
57 void SetDopplerFrequency(bool aIsDopplerFrequency) { mIV_IsDopplerFrequency = aIsDopplerFrequency; }
58
59 protected:
62 TblIndVarU<double> mSpeedFrequencyTable; // closing speed or Doppler frequency
63 TblDepVar1<double> mAdjustmentTable;
64 };
65
69 {
70 public:
72 {
74 : mFreqencyHz(0.0)
75 , mMTI_TablePtr(nullptr)
76 {
77 }
78
81 };
82
85
86 void AddTable(double aFrequencyHz, std::vector<double>& aSpeedValues, std::vector<double>& aAdjustmentValues);
87
89
90 double ComputeAdjustmentFactor(double aClosingSpeed, double aFrequency) override;
91
92 protected:
93 std::vector<FreqTablePair> mFreqTablePairList;
94 };
95
96 // Reads a MTI table, where the data is separated by commas
97 // @param aFileName The name of the file to be read
98 // @param aAdjustmentTable The table of data to be read into.
99 // @return If the given file was read without incidence
100 bool ReadCsv(const std::string& aFileName, MTI_AdjustmentTable& aAdjustmentTable);
101
102 // Reads a MTI table, where the data is separated by commas. This
103 // is for a different table format, where mulitple independent columns map to
104 // the same last dependent (attenuation) column. Each independent
105 // column has a specific frequency, which is indicated in its header.
106 // @param aFileName The name of the file to be read
107 MTI_AdjustmentTable* ReadCsvCompound(const std::string& aFileName);
108
109 // Reads a MTI table, where the data is binary AND created by WriteBinary
110 // @param aFileName The name of the file to be read.
111 // @param aAdjustmentTable The table of data to be read into.
112 // @return If the given file was read without incidence
113 bool ReadBinary(const std::string& aFileName, MTI_AdjustmentTable& aAdjustmentTable);
114
115 // Writes a table in memory to a binary file
116 // @param aFileName The name of the file to be written
117 // @param aAdjustmentTable The table of data to be written.
118 void WriteBinary(const std::string& aFileName, MTI_AdjustmentTable& aAdjustmentTable);
119
120 // Writes a table in memory to a CSV text file, which could be compared to the original
121 // @param aFileName The name of the file to be written
122 // @param aAdjustmentTable The table of data to be written.
123 void WriteCsv(const std::string& aFileName, MTI_AdjustmentTable& aAdjustmentTable);
124
127 static WsfMTI_TableManager& GetManager();
128
131 void SetDebug(bool aTruth) { mDebug = aTruth; }
133
134protected:
136 {
138 // WsfMTI_TableManager::MTI_AdjustmentTable* mAdjustmentTable;
139 std::vector<double> speedValues;
140 // std::vector<double> adjustmentValues;
141 };
142
143private:
145 WsfMTI_TableManager();
146 WsfMTI_TableManager(const WsfMTI_TableManager& aSrc);
147 virtual ~WsfMTI_TableManager();
148
149 WsfMTI_TableManager operator=(const WsfMTI_TableManager& aSrc) = delete;
150
151 bool mDebug;
152
153 static WsfMTI_TableManager* sTheManager;
154};
155#endif
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
std::vector< FreqTablePair > mFreqTablePairList
Definition WsfMTI_TableManager.hpp:93
MTI_AdjustmentTableCompound()
Definition WsfMTI_TableManager.cpp:542
double ComputeAdjustmentFactor(double aClosingSpeed, double aFrequency) override
virtual
Definition WsfMTI_TableManager.cpp:594
WsfMTI_TableManager::MTI_AdjustmentTable * GetTable(double aFrequencyHz)
Definition WsfMTI_TableManager.cpp:573
void AddTable(double aFrequencyHz, std::vector< double > &aSpeedValues, std::vector< double > &aAdjustmentValues)
Definition WsfMTI_TableManager.cpp:555
A nested class for the MTI adjustment table. This was extracted from WsfRadarSensor.
Definition WsfMTI_TableManager.hpp:44
bool IsDopplerFrequency() const
Definition WsfMTI_TableManager.hpp:52
virtual double ComputeAdjustmentFactor(double aClosingSpeed, double aFrequency)
Definition WsfMTI_TableManager.cpp:514
TblIndVarU< double > mSpeedFrequencyTable
Definition WsfMTI_TableManager.hpp:62
TblDepVar1< double > & GetAdjustmentTable()
Definition WsfMTI_TableManager.hpp:54
TblDepVar1< double > mAdjustmentTable
Definition WsfMTI_TableManager.hpp:63
MTI_AdjustmentTable()
Definition WsfMTI_TableManager.cpp:537
void SetDopplerFrequency(bool aIsDopplerFrequency)
If read from external table, the independent variable is speed.
Definition WsfMTI_TableManager.hpp:57
bool mIV_IsDopplerFrequency
'true' if the independent variable is closing speed, 'false' if it is Doppler frequency
Definition WsfMTI_TableManager.hpp:61
TblIndVarU< double > & GetSpeedFrequencyTable()
Definition WsfMTI_TableManager.hpp:53
void SetDebug(bool aTruth)
Definition WsfMTI_TableManager.hpp:131
void WriteBinary(const std::string &aFileName, MTI_AdjustmentTable &aAdjustmentTable)
Definition WsfMTI_TableManager.cpp:396
void WriteCsv(const std::string &aFileName, MTI_AdjustmentTable &aAdjustmentTable)
Definition WsfMTI_TableManager.cpp:346
bool ReadCsv(const std::string &aFileName, MTI_AdjustmentTable &aAdjustmentTable)
Definition WsfMTI_TableManager.cpp:73
static WsfMTI_TableManager & GetManager()
Static.
Definition WsfMTI_TableManager.cpp:47
MTI_AdjustmentTable * ReadCsvCompound(const std::string &aFileName)
This table-version has mutiple columns mapped to a single function outputs/attenuations.
Definition WsfMTI_TableManager.cpp:183
bool ReadBinary(const std::string &aFileName, MTI_AdjustmentTable &aAdjustmentTable)
Definition WsfMTI_TableManager.cpp:440
A data structure used for parsing the compound tables.
Definition WsfMTI_TableManager.hpp:136
double mFrequencyHz
Definition WsfMTI_TableManager.hpp:137
std::vector< double > speedValues
Definition WsfMTI_TableManager.hpp:139
double mFreqencyHz
Definition WsfMTI_TableManager.hpp:79
FreqTablePair()
Definition WsfMTI_TableManager.hpp:73
MTI_AdjustmentTable * mMTI_TablePtr
Definition WsfMTI_TableManager.hpp:80
Copyrights Multiple, All Rights Reserved