WSF
WsfPassiveSensor.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 WSFPASSIVESENSOR_HPP
13#define WSFPASSIVESENSOR_HPP
14
15#include "wsf_export.h"
16
17#include <list>
18#include <map>
19#include <memory>
20#include <mutex>
21#include <vector>
22
23#include "TblLookup.hpp"
24#include "UtInput.hpp"
25class UtScriptClass;
26class UtScriptTypes;
27#include "WsfEM_Antenna.hpp"
28#include "WsfEM_Rcvr.hpp"
29class WsfEM_Xmtr;
32#include "WsfSensor.hpp"
33#include "WsfSensorBeam.hpp"
34#include "WsfSensorMode.hpp"
36#include "WsfStringId.hpp"
38#include "WsfTrack.hpp"
40
42
44{
45public:
51
52 // Define inner classes to be declared friends to access outer class members on some compilers
53 class PassiveRcvr;
54 class PassiveBeam;
55 class PassiveMode;
56 friend class PassiveRcvr;
57 friend class PassiveBeam;
58 friend class PassiveMode;
59
62 {
63 public:
64 Interactor() = delete;
65 Interactor(WsfEM_Xmtr* aXmtrPtr, PassiveRcvr* aRcvrPtr, bool aUseListener, bool aUseChangeListener);
66
70 enum
71 {
76 };
77
78 // NOTE: No destructor is defined even though there are pointers. This is just a place to store things.
79 // It is left to others to delete things at the proper time.
80
82 WsfEM_Xmtr* mXmtrPtr = nullptr;
89 double mLastAttemptTime = 0.0;
91 double mPSOS_CumulativePd = 0.0;
96 bool mUseListener = false;
98 bool mUseChangeListener = false;
99 };
100
101 using InteractorList = std::list<Interactor>;
102
105 using TargetInteractorMap = std::map<size_t, InteractorList>;
106
108 {
109 public:
110 double mLowerFrequency = 0.0;
111 double mUpperFrequency = 0.0;
112 double mDwellTime = 0.0;
113 double mRevisitTime = 0.0;
114 };
115
117 class PassiveRcvr : public WsfEM_Rcvr
118 {
119 public:
120 PassiveRcvr(WsfEM_Antenna* aAntennaPtr);
121 PassiveRcvr(const PassiveRcvr& aSrc, WsfEM_Antenna* aAntennaPtr);
122
123 bool Initialize(WsfSimulation& aSimulation) override;
124 bool ProcessInput(UtInput& aInput) override;
125
126 bool CanInteractWith(WsfEM_Xmtr* aXmtrPtr) override;
127 bool AddInteractor(WsfEM_Xmtr* aXmtrPtr) override;
128 bool RemoveInteractor(WsfEM_Xmtr* aXmtrPtr) override;
129
130 void EmitterActiveCallback(double aSimTime, WsfEM_Interaction& aResult) override;
131 void SignalChangeCallback(double aSimTime, size_t aTargetIndex) override;
132
133 bool TuneFrequencyBand(double aSimTime,
134 bool aReset,
135 unsigned int aFrequencyBandNumber,
136 double aLowerFreq,
137 double aUpperFreq,
138 double aDwellTime,
139 double aRevisitTime);
140
141 double ComputeReceivedPower(double aSourceAz,
142 double aSourceEl,
143 double aEBS_Az,
144 double aEBS_El,
145 double aReceivedPowerDensity,
146 WsfEM_Types::Polarization aPolarization,
147 double aFrequency,
148 double& aAntennaGain) override;
149
150 std::vector<FrequencyBand> mFrequencyBands;
155 };
156
159 {
160 public:
161 PassiveBeam();
162 PassiveBeam(const PassiveBeam& aSrc);
163 PassiveBeam& operator=(const PassiveBeam& aRhs);
164 ~PassiveBeam() override;
165
166 // WsfSensorBeam methods
167 WsfEM_Rcvr* GetEM_Rcvr() override { return mRcvrPtr; }
168
169 bool ProcessInput(UtInput& aInput) override;
170
171 bool Initialize(WsfSensor* aSensorPtr, PassiveMode* aModePtr);
172
173 bool AttemptToDetect(double aSimTime,
174 WsfEM_Xmtr* aXmtrPtr,
175 WsfSensorResult& aResult,
176 WsfEM_Interaction* aAuxInteractionPtr,
177 bool aPSOS_Enabled,
178 Interactor* aInteractorPtr);
179
180 bool ComputePSOS_Effects(double aSimTime, WsfEM_Xmtr* aXmtrPtr, WsfSensorResult& aResult, Interactor* aInteractorPtr);
181
182 void ProcessFailedPSOS_Detection(double aSimTime, Interactor* aInteractorPtr);
183
186
187 size_t GetDetectionThresholdCount(SignalType aSignalType) const;
188 void GetDetectionThresholdEntry(SignalType aSignalType, size_t aIndex, double& aFrequency, double& aThreshold) const;
189
190 size_t GetDetectionSensitivityCount(SignalType aSignalType) const;
191 void GetDetectionSensitivityEntry(SignalType aSignalType, size_t aIndex, double& aFrequency, double& aSensitivity) const;
192
193 bool TuneFrequencyBand(double aSimTime,
194 bool aReset,
195 unsigned int aFrequencyBandNumber,
196 double aLowerFreq,
197 double aUpperFreq,
198 double aDwellTime,
199 double aRevistTime);
201
205 };
206
209 {
210 public:
212 {
213 public:
214 bool ProcessInput(UtInput& aInput) override;
215 PassiveErrorModel* Clone() const override { return new PassiveErrorModel(*this); }
216
217 void ApplyMeasurementErrors(const wsf::SphericalMeasurementErrors& aErrors, WsfSensorResult& aResult) override;
218 std::unique_ptr<wsf::SphericalMeasurementErrors> ComputeMeasurementErrors(WsfSensorResult& aResult) const override;
219
220 private:
221 struct ErrorTable
222 {
223 TblIndVarU<double> mFrequency;
224 TblDepVar1<double> mErrorSigma;
225 };
226
227 static void SelectErrorSigma(const ErrorTable& aErrorTable, double aFrequency, double& aErrorSigma);
228 static void ReadErrorTable(UtInput& aInput, ErrorTable& aErrorTable, UtInput::ValueType aValueType);
229
230 bool mUsingErrorTables;
231 ErrorTable mAzErrorTable;
232 ErrorTable mElErrorTable;
233 ErrorTable mRangeErrorTable;
234 };
235
236 PassiveMode();
237 PassiveMode(const PassiveMode& aSrc);
238 PassiveMode& operator=(const PassiveMode& aRhs);
239 ~PassiveMode() override;
240
241 // WsfSensorMode methods
242 size_t GetBeamCount() const override { return mBeamList.size(); }
243 WsfSensorBeam* GetBeamEntry(size_t aIndex) override { return &(mBeamList[aIndex]); }
244
245 WsfMode* Clone() const override;
246
247 bool Initialize(double aSimTime) override;
248
249 bool ProcessInput(UtInput& aInput) override;
250
251 bool AttemptToDetect(double aSimTime, WsfPlatform* aTargetPtr, Settings& aSettings, WsfSensorResult& aResult) override;
252
253 bool CanDetect(double aSimTime, WsfEM_Xmtr* aXmtrPtr, WsfSensorResult& aResult, WsfEM_Interaction& aAuxInteraction);
254
255 void Deselect(double aSimTime) override;
256 void Select(double aSimTime) override;
257
258 void UpdateTrack(double aSimTime, WsfTrack* aTrackPtr, WsfPlatform* aTargetPtr, WsfSensorResult& aResult) override;
259
260 void UpdateTrackReportingFlags(double aSimTime, WsfTrack* aTrackPtr) override;
261
262 bool AddInteractor(WsfEM_Xmtr* aXmtrPtr, PassiveRcvr* aRcvrPtr);
263
264 bool RemoveInteractor(WsfEM_Xmtr* aXmtrPtr, PassiveRcvr* aRcvrPtr);
265
266 void EmitterActiveCallback(double aSimTime, WsfEM_Interaction& aResult, PassiveRcvr* aRcvrPtr);
267
268 bool TuneFrequencyBand(double aSimTime,
269 bool aReset,
270 size_t aBeamNumber,
271 unsigned int aFrequencyBandNumber,
272 double aLowerFreq,
273 double aUpperFreq,
274 double aDwellTime,
275 double aRevisitTime);
276
289
290 std::vector<PassiveBeam> mBeamList;
292
293 protected:
294 virtual void ComputeInterferenceEffect(double aSimTime, WsfEM_Xmtr* aXmtrPtr, WsfEM_Rcvr* aRcvrPtr) {}
295
297 virtual bool UseListenerForInterferer(WsfEM_Xmtr* aXmtrPtr) { return false; }
298
299 private:
300 mutable std::recursive_mutex mMutex;
301 };
302
303 WsfPassiveSensor(WsfScenario& aScenario);
306 ~WsfPassiveSensor() override = default;
307
309
310 bool AttemptToDetect(double aSimTime, WsfPlatform* aTargetPtr, Settings& aSettings, WsfSensorResult& aResult) override;
311
312 WsfSensor* Clone() const override;
313 bool Initialize(double aSimTime) override;
314 bool ProcessInput(UtInput& aInput) override;
315 void Update(double aSimTime) override;
316 void TurnOff(double aSimTime) override;
317
318 size_t GetEM_RcvrCount() const override;
319 WsfEM_Rcvr& GetEM_Rcvr(size_t aIndex) const override;
321
322 bool TuneFrequencyBand(double aSimTime,
323 bool aReset,
324 WsfStringId aModeNameId,
325 size_t aBeamNumber,
326 unsigned int aFrequencyBandNumber,
327 double aLowerFreq,
328 double aUpperFreq,
329 double aDwellTime,
330 double aRevisitTime);
331
332 // Returns the number of Frequency Bands for the given beam
333 unsigned int GetNumberofFrequencyBands(WsfStringId aModeId, size_t aBeam);
334
335 const char* GetScriptClassName() const override { return "WsfPassiveSensor"; }
336
337 static std::unique_ptr<UtScriptClass> CreateScriptClass(const std::string& aClassName, UtScriptTypes* aScriptTypesPtr);
338
339private:
340 void SignalChangeCallback(double aSimTime, size_t aTargetIndex);
341
343 std::vector<PassiveMode*> mPassiveModeList;
344
346 WsfTargetTypeReporting mTargetTypeReporting;
347
349 WsfEmitterTypeReporting mEmitterTypeReporting;
350
355 std::vector<WsfTrack::Signal> mSignalList;
356
358 bool mUpdateActive;
359};
360
361// Script Accessor Class
363{
364public:
365 WsfScriptPassiveSensorClass(const std::string& aClassName, UtScriptTypes* aTypesPtr);
366
367 UT_DECLARE_SCRIPT_METHOD(FrequencyBandCount_1);
368 UT_DECLARE_SCRIPT_METHOD(FrequencyBandCount_2);
369 UT_DECLARE_SCRIPT_METHOD(TuneFrequencyBand);
370};
371
372#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfEM_Antenna.hpp:49
Definition WsfEM_Interaction.hpp:68
Definition WsfEM_Rcvr.hpp:68
WsfEM_Rcvr(RcvrFunction aFunction, WsfEM_Antenna *aAntennaPtr=nullptr)
Definition WsfEM_Rcvr.cpp:61
Definition WsfEM_Xmtr.hpp:55
Definition WsfEmitterTypeReporting.hpp:33
Definition WsfMode.hpp:32
Definition WsfPassiveDetector.hpp:27
An internal class used to keep track of interacting transmitters and receivers.
Definition WsfPassiveSensor.hpp:62
unsigned char mDetectStatus
Definition WsfPassiveSensor.hpp:94
double mLastAttemptTime
The time when the last listening detection was attempted (successful or unsuccessful).
Definition WsfPassiveSensor.hpp:89
@ cDS_FAILED_SIGNAL
Failed detection because of insufficient received signal.
Definition WsfPassiveSensor.hpp:75
@ cDS_FAILED_GEOMETRY
Failed detection because of geometric constraints.
Definition WsfPassiveSensor.hpp:74
@ cDS_NOT_ATTEMPTED
No detection attempt was performed.
Definition WsfPassiveSensor.hpp:72
@ cDS_DETECTED
A detection attempt was successful.
Definition WsfPassiveSensor.hpp:73
double mPSOS_CumulativePd
The cumulative Pd accumulated over multiple detection chances (for PSOS).
Definition WsfPassiveSensor.hpp:91
WsfEM_Xmtr * mXmtrPtr
Pointer to the transmitter.
Definition WsfPassiveSensor.hpp:82
bool mUseListener
'true' if the listening detection method should be used (vs. polling)
Definition WsfPassiveSensor.hpp:96
WsfSensorResult * mResultPtr
Definition WsfPassiveSensor.hpp:87
bool mUseChangeListener
'true' if target signal updates are to be listened for and updated (vs. polling).
Definition WsfPassiveSensor.hpp:98
PassiveRcvr * mRcvrPtr
Pointer to the receiver.
Definition WsfPassiveSensor.hpp:84
A 'beam' of a sensor 'mode'.
Definition WsfPassiveSensor.hpp:159
PassiveRcvr * mRcvrPtr
Definition WsfPassiveSensor.hpp:203
PassiveBeam & operator=(const PassiveBeam &aRhs)
Definition WsfPassiveSensor.cpp:787
WsfEM_Antenna * mAntennaPtr
Definition WsfPassiveSensor.hpp:202
PassiveBeam()
Definition WsfPassiveSensor.cpp:769
WsfPassiveDetector mDetector
Definition WsfPassiveSensor.hpp:204
WsfEM_Rcvr * GetEM_Rcvr() override
Definition WsfPassiveSensor.hpp:167
Definition WsfPassiveSensor.hpp:212
PassiveErrorModel * Clone() const override
Create a clone of "this" object.
Definition WsfPassiveSensor.hpp:215
bool ProcessInput(UtInput &aInput) override
Definition WsfPassiveSensor.cpp:2527
A 'mode' of the sensor.
Definition WsfPassiveSensor.hpp:209
double mUnframedDetectionCoastTime
Definition WsfPassiveSensor.hpp:277
bool mUnframedDetectionOptimization
Definition WsfPassiveSensor.hpp:282
virtual bool UseListenerForInterferer(WsfEM_Xmtr *aXmtrPtr)
Returns true if the mode should utilize the 'listener' detection method for an interference transmitt...
Definition WsfPassiveSensor.hpp:297
TargetInteractorMap mTargetInteractorMap
Definition WsfPassiveSensor.hpp:291
virtual void ComputeInterferenceEffect(double aSimTime, WsfEM_Xmtr *aXmtrPtr, WsfEM_Rcvr *aRcvrPtr)
Definition WsfPassiveSensor.hpp:294
PassiveMode()
Definition WsfPassiveSensor.cpp:1255
size_t GetBeamCount() const override
Definition WsfPassiveSensor.hpp:242
bool mImplicitBeamUsed
Definition WsfPassiveSensor.hpp:280
std::vector< PassiveBeam > mBeamList
Definition WsfPassiveSensor.hpp:290
double mRangingTimeTrackQuality
Definition WsfPassiveSensor.hpp:279
bool mPSOS_Enabled
Definition WsfPassiveSensor.hpp:288
double mRangingTime
Definition WsfPassiveSensor.hpp:278
WsfSensorBeam * GetBeamEntry(size_t aIndex) override
Definition WsfPassiveSensor.hpp:243
bool mExplicitBeamUsed
Definition WsfPassiveSensor.hpp:281
A specialized WsfEM_Rcvr that can receive on multiple frequency bands.
Definition WsfPassiveSensor.hpp:118
void EmitterActiveCallback(double aSimTime, WsfEM_Interaction &aResult) override
Definition WsfPassiveSensor.cpp:551
bool mPSOS_Enabled
Definition WsfPassiveSensor.hpp:152
bool CanInteractWith(WsfEM_Xmtr *aXmtrPtr) override
Definition WsfPassiveSensor.cpp:495
PassiveRcvr(WsfEM_Antenna *aAntennaPtr)
Definition WsfPassiveSensor.cpp:350
std::vector< FrequencyBand > mFrequencyBands
Definition WsfPassiveSensor.hpp:150
bool AddInteractor(WsfEM_Xmtr *aXmtrPtr) override
Definition WsfPassiveSensor.cpp:534
void SignalChangeCallback(double aSimTime, size_t aTargetIndex) override
Definition WsfPassiveSensor.cpp:559
bool RemoveInteractor(WsfEM_Xmtr *aXmtrPtr) override
Definition WsfPassiveSensor.cpp:543
bool mHavePSOS_FrequencyData
Definition WsfPassiveSensor.hpp:153
bool Initialize(WsfSimulation &aSimulation) override
Definition WsfPassiveSensor.cpp:373
bool ProcessInput(UtInput &aInput) override
Definition WsfPassiveSensor.cpp:436
bool mPSOS_DebugEnabled
Definition WsfPassiveSensor.hpp:154
bool TuneFrequencyBand(double aSimTime, bool aReset, unsigned int aFrequencyBandNumber, double aLowerFreq, double aUpperFreq, double aDwellTime, double aRevisitTime)
Definition WsfPassiveSensor.cpp:566
PassiveMode * mModePtr
Definition WsfPassiveSensor.hpp:151
double ComputeReceivedPower(double aSourceAz, double aSourceEl, double aEBS_Az, double aEBS_El, double aReceivedPowerDensity, WsfEM_Types::Polarization aPolarization, double aFrequency, double &aAntennaGain) override
Definition WsfPassiveSensor.cpp:746
A specialization of WsfSensor that provides the baseline passive RF sensor.
Definition WsfPassiveSensor.hpp:44
bool ProcessInput(UtInput &aInput) override
Definition WsfPassiveSensor.cpp:136
WsfPassiveSensor & operator=(const WsfPassiveSensor &)=delete
std::map< size_t, InteractorList > TargetInteractorMap
Definition WsfPassiveSensor.hpp:105
bool AttemptToDetect(double aSimTime, WsfPlatform *aTargetPtr, Settings &aSettings, WsfSensorResult &aResult) override
Definition WsfPassiveSensor.cpp:89
~WsfPassiveSensor() override=default
unsigned int GetNumberofFrequencyBands(WsfStringId aModeId, size_t aBeam)
Definition WsfPassiveSensor.cpp:317
WsfPassiveSensor(WsfScenario &aScenario)
Definition WsfPassiveSensor.cpp:46
const char * GetScriptClassName() const override
Definition WsfPassiveSensor.hpp:335
bool Initialize(double aSimTime) override
Definition WsfPassiveSensor.cpp:124
bool TuneFrequencyBand(double aSimTime, bool aReset, WsfStringId aModeNameId, size_t aBeamNumber, unsigned int aFrequencyBandNumber, double aLowerFreq, double aUpperFreq, double aDwellTime, double aRevisitTime)
Definition WsfPassiveSensor.cpp:274
std::list< Interactor > InteractorList
Definition WsfPassiveSensor.hpp:101
SignalType
Definition WsfPassiveSensor.hpp:47
@ cST_PULSED
Definition WsfPassiveSensor.hpp:49
@ cST_CONTINUOUS
Definition WsfPassiveSensor.hpp:48
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
UT_DECLARE_SCRIPT_METHOD(FrequencyBandCount_1)
UT_DECLARE_SCRIPT_METHOD(FrequencyBandCount_2)
UT_DECLARE_SCRIPT_METHOD(TuneFrequencyBand)
WsfScriptPassiveSensorClass(const std::string &aClassName, UtScriptTypes *aTypesPtr)
Definition WsfPassiveSensor.cpp:2414
WsfScriptSensorClass(const std::string &aClassName, UtScriptTypes *aScriptTypesPtr)
Definition WsfScriptSensorClass.cpp:133
Definition WsfSensorBeam.hpp:58
WsfSensorBeam()
Definition WsfSensorBeam.cpp:20
WsfSensorMode()
Definition WsfSensorMode.cpp:47
virtual void ApplyMeasurementErrors(WsfSensorResult &aResult)
Definition WsfSensorMode.cpp:590
virtual WSF_DEPRECATED void ComputeMeasurementErrors(WsfSensorResult &aResult, double &aAzError, double &aElError, double &aRangeError, double &aRangeRateError) final
Definition WsfSensorMode.cpp:608
Definition WsfSensorResult.hpp:27
Definition WsfSensor.hpp:133
bool ProcessInput(UtInput &aInput) override
Definition WsfSensor.cpp:380
void Update(double aSimTime) override
Definition WsfSensor.cpp:497
virtual WsfEM_Rcvr & GetEM_Rcvr(size_t aIndex) const
Definition WsfSensor.cpp:660
WsfSensor(const WsfScenario &aScenario)
Definition WsfSensor.cpp:52
virtual size_t GetEM_RcvrCount() const
Definition WsfSensor.cpp:646
WsfSensor * Clone() const override=0
bool Initialize(double aSimTime) override
Definition WsfSensor.cpp:255
WsfSensor & operator=(const WsfSensor &aSrc)=delete
void TurnOff(double aSimTime) override
Definition WsfSensor.cpp:523
virtual bool AttemptToDetect(double aSimTime, WsfPlatform *aTargetPtr, Settings &aSettings, WsfSensorResult &aResult)
Definition WsfSensor.cpp:224
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Definition WsfTargetTypeReporting.hpp:33
An object that represents an 'track' (perception) of something.
Definition WsfTrack.hpp:120
Definition WsfStandardSensorErrorModel.hpp:47
Polarization
Polarization of the electromagnetic wave.
Definition WsfEM_Types.hpp:21
Definition WsfPassiveSensor.hpp:108
double mUpperFrequency
Definition WsfPassiveSensor.hpp:111
double mRevisitTime
Definition WsfPassiveSensor.hpp:113
double mLowerFrequency
Definition WsfPassiveSensor.hpp:110
double mDwellTime
Definition WsfPassiveSensor.hpp:112
A standard set of errors associated with single sensor mono-static detections.
Definition WsfStandardSensorErrorModel.hpp:26
Copyrights Multiple, All Rights Reserved