WSF
WsfEW_Effect.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 WSFEW_EFFECT_HPP
13#define WSFEW_EFFECT_HPP
14
15#include "wsf_mil_export.h"
16
17#include <set>
18
19class UtInput;
20class UtInputBlock;
21#include "UtLog.hpp"
22#include "UtOptional.hpp"
23#include "UtRandom.hpp"
24#include "WsfEM_Rcvr.hpp"
25#include "WsfEM_Xmtr.hpp"
26class WsfEW_EA;
27class WsfEW_EA_EP;
28class WsfEW_EP;
29class WsfEW_Effects;
30#include "WsfEW_Types.hpp"
31#include "WsfObject.hpp"
32class WsfPlatform;
33class WsfEW_Technique;
35
36
43
44class WSF_MIL_EXPORT WsfEW_Effect : public WsfObject
45{
46public:
71
81
103
111
121
122 WsfEW_Effect() = default;
124 ~WsfEW_Effect() override;
125
127
128
131 WsfEW_Effect* Clone() const override = 0;
132
133 virtual bool Initialize(WsfSimulation& aSimulation);
134 bool ProcessInput(UtInput& aInput) override;
136
138
139 // =================================================================================================
150 virtual void ProcessUnmitigatedEffect(double aSimTime,
151 const WsfEM_Interaction& aTargetInteraction,
152 const WsfEM_Interaction& aJammerToTgtInteraction,
153 const ut::optional<WsfEM_Interaction>& aTgtToJammerInteraction,
154 WsfEW_Effects& aEW_Effects);
155
156 // =================================================================================================
168 virtual void ProcessMitigatedEffect(double aSimTime,
169 const WsfEM_Interaction& aTargetInteraction,
170 const WsfEM_Interaction& aJammerToTgtInteraction,
171 const ut::optional<WsfEM_Interaction>& aTgtToJammerInteraction,
172 WsfEW_Effects& aEW_Effects,
173 WsfEW_Effect* aEW_EffectPtr = nullptr);
174
176
177 virtual void ApplyUnmitigatedEffect(WsfEW_Effects& aEW_Effects) const = 0;
178
179 virtual void ApplyMitigatedEffect(WsfEW_Effect* aEW_EffectPtr, WsfEW_Effects& aEW_Effects) const = 0;
180
181 // =================================================================================================
192 virtual void UpdateEffects(double aSimTime,
193 const WsfEM_Interaction& aTargetInteraction,
194 const WsfEM_Interaction& aJammerToTgtInteraction,
195 const ut::optional<WsfEM_Interaction>& aTgtToJammerInteraction,
196 WsfEW_Effects& aEW_Effects,
197 WsfEW_Effect* aEW_EffectPtr = nullptr);
199
201
202
203 virtual void RemoveJammerXmtr(unsigned int aXmtrId);
204 virtual void RemoveJammerXmtr(WsfEM_Xmtr* aJammerXmtrPtr);
206
208
209
211 void SetSystemFunctionMask(SystemFunction aSystemFunction) { mSystemFunctionMask = aSystemFunction; }
212 void SetSystemFunctionMask(const std::string& aSystemFunctionId);
213
215 void AddSystemFunctionMask(SystemFunction aSystemFunction) { mSystemFunctionMask |= aSystemFunction; }
216 void AddSystemFunctionMask(const std::string& aSystemFunctionId);
217
220 unsigned int GetSystemFunctionMask() const { return mSystemFunctionMask; }
221
222 static WsfEW_Effect::SystemFunction ConvertToEW_SystemFunction(WsfEM_Rcvr::RcvrFunction aRcvrFunction);
223 static WsfEW_Effect::SystemFunction ConvertToEW_SystemFunction(WsfEM_Xmtr::XmtrFunction aXmtrFunction);
225
227
228
231 void SetCoherencyMask(Coherency aCoherency) { mCoherencyMask = aCoherency; }
232
235 void AddCoherencyMask(Coherency aCoherency) { mCoherencyMask |= aCoherency; }
236
239 unsigned int GetCoherencyMask() const { return mCoherencyMask; }
240
241 static unsigned int ConvertCoherencyIdToMask(WsfStringId aCoherencyId);
243
244
246
247
250 void SetBehavior(Behavior aBehavior) { mBehavior = aBehavior; }
251
254 Behavior GetBehavior() const { return mBehavior; }
256
258
259
262 void SetDebug(bool aDebug) { mDebug = aDebug; }
263
266 bool DebugEnabled() const { return mDebug; }
268
270
271
274 void SetEA_EP_Ptr(WsfEW_EA_EP* aPtr) { mEA_EP_Ptr = aPtr; }
275
278 WsfEW_EA_EP* GetEA_EP_Ptr() const { return mEA_EP_Ptr; }
279
282 WsfEW_EA* GetEA_Ptr() const;
283
286 WsfEW_EP* GetEP_Ptr() const;
287
290 WsfEW_Technique* GetTechniquePtr() const { return mTechniquePtr; }
291
294 void SetTechniquePtr(WsfEW_Technique* aPtr) { mTechniquePtr = aPtr; }
296
299 virtual double GetJammingPulseDensity() const { return 1.0; }
300 virtual double GetJammingPulseDensity(WsfEM_Xmtr* aXmtrPtr) const { return 1.0; }
301
302 virtual bool AllowTarget(WsfPlatform* aXmtrPlatform, WsfPlatform* aTargetPlatform) const;
303
305
306
307 virtual void UpdateCurrentIds(WsfEM_Rcvr* aRcvrPtr, WsfEM_Xmtr* aXmtrPtr, WsfPlatform* aTargetPtr);
309
310 WsfSimulation* GetSimulation() const;
311
312 ut::Random& GetRandom() { return mRandom; }
313
314protected:
316 class WSF_MIL_EXPORT EffectData : public WsfEW_Types::EW_EffectData
317 {
318 public:
319 EffectData() = default;
320 EffectData& operator=(const EffectData&) = delete;
321 ~EffectData() override = default;
322
323 bool ProcessInput(UtInput& aInput) override;
324 bool Initialize(WsfSimulation& aSimulation) override;
325
326 EW_EffectData* Clone() const override;
327
328 void Reset() override;
329
330 WsfEW_Effect* GetEffectPtr() { return mEffectPtr; }
331 void SetEffectPtr(WsfEW_Effect* aEffectPtr) { mEffectPtr = aEffectPtr; }
332
333 protected:
334 EffectData(const EffectData& aSrc);
335
336 private:
337 WsfEW_Effect* mEffectPtr{nullptr};
338 };
339
340 WsfEW_Effect(const WsfEW_Effect& aSrc);
341
346 virtual void PrintUpdateMessage(ut::log::MessageStream& aStream, double aSimTime, WsfEW_Effect* aEW_EffectPtr = nullptr);
347
348 void ResetProtectionTypeFlag(WsfEM_Xmtr* aXmtrPtr, const WsfEM_Interaction& aTargetInteraction, WsfEW_Effects& aEW_Effects);
349
351
352 bool ProcessEffectDataBlock(UtInputBlock& aInputBlock, WsfStringId aSystemTypeId);
353 virtual EffectData& GetEffectData(WsfStringId aSystemTypeId);
354 void ResetEffectData(WsfStringId aSystemTypeId){};
355 bool EffectDataExists(WsfStringId aSystemTypeId) const;
356 virtual EffectData* NewEffectData() { return new EffectData(); }
357 void InsertNewEffectData(WsfStringId aSystemTypeId, WsfEW_Types::EW_EffectData* aEffectPtr);
358
362 virtual EffectData* PropagateEffectDataPtr(WsfStringId aSystemTypeId);
364
365
368 unsigned int mCoherencyMask{cEC_NONE};
369 bool mDebug{false};
370
371 // The below values change after each call to UpdateEffects and anytime the UpdateCurrentIds is called.
377
380
383
385 bool mUpdatingEffect{true}; // set to true initially to prevent updates before initialization
386
387 using EffectDataMap = std::map<WsfStringId, EffectData*>; // Main effect data map.
388
391
392private:
393 using TargetAllowRejectSet = std::set<WsfStringId>;
394
395 WsfEW_Technique* mTechniquePtr{nullptr};
396 WsfEW_EA_EP* mEA_EP_Ptr{nullptr};
397
398 TargetProtectionType mProtectionType{
399 cTP_ALL};
400 TargetAllowRejectSet mAllowedTargetSet;
401 TargetAllowRejectSet mRejectedTargetSet;
402
403 ut::Random mRandom;
404};
405
406#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
Definition WsfEM_Interaction.hpp:68
Definition WsfEM_Rcvr.hpp:68
RcvrFunction
RcvrFunction defines the intended purpose of the receiver.
Definition WsfEM_Rcvr.hpp:80
Definition WsfEM_Xmtr.hpp:55
XmtrFunction
XmtrFunction defines the intended purpose of the transmitter.
Definition WsfEM_Xmtr.hpp:69
Definition WsfEW_EA_EP.hpp:38
Definition WsfEW_EA.hpp:37
Definition WsfEW_EP.hpp:36
Base effect data used to derive from in inheriting effect classes.
Definition WsfEW_Effect.hpp:317
bool Initialize(WsfSimulation &aSimulation) override
Definition WsfEW_Effect.cpp:702
void Reset() override
Definition WsfEW_Effect.cpp:708
WsfEW_Effect * GetEffectPtr()
Definition WsfEW_Effect.hpp:330
void SetEffectPtr(WsfEW_Effect *aEffectPtr)
Definition WsfEW_Effect.hpp:331
EffectData & operator=(const EffectData &)=delete
~EffectData() override=default
WsfEW_Technique * GetTechniquePtr() const
Definition WsfEW_Effect.hpp:290
void AddSystemFunctionMask(SystemFunction aSystemFunction)
Set the system type.
Definition WsfEW_Effect.hpp:215
void SetDebug(bool aDebug)
Definition WsfEW_Effect.hpp:262
std::map< WsfStringId, EffectData * > EffectDataMap
Definition WsfEW_Effect.hpp:387
ut::Random & GetRandom()
Definition WsfEW_Effect.hpp:312
TargetProtectionType
The target protection type this effect is limited to.
Definition WsfEW_Effect.hpp:106
@ cTP_SELF_PROTECT
Definition WsfEW_Effect.hpp:109
@ cTP_NON_SELF_PROTECT
Definition WsfEW_Effect.hpp:108
@ cTP_ALL
Definition WsfEW_Effect.hpp:107
Coherency
The signal coherency the EW effect exhibits on the affected system.
Definition WsfEW_Effect.hpp:74
@ cEC_NONCOHERENT_PULSE
Definition WsfEW_Effect.hpp:78
@ cEC_NONE
Definition WsfEW_Effect.hpp:75
@ cEC_COHERENT
Definition WsfEW_Effect.hpp:77
@ cEC_NONCOHERENT
Definition WsfEW_Effect.hpp:76
@ cEC_COHERENT_PULSE
Definition WsfEW_Effect.hpp:79
Behavior
The behavior the EW effect exhibits.
Definition WsfEW_Effect.hpp:49
@ cEB_FLOODED_MAINTAINED
System is flooded, either track or messages, but is mitigated.
Definition WsfEW_Effect.hpp:66
@ cEB_UNDEFINED
Definition WsfEW_Effect.hpp:50
@ cEB_NEXT_FREE_MASK
For use by derived classes to specify additional behavior masks.
Definition WsfEW_Effect.hpp:69
@ cEB_MAINTAIN_TRACK
Track is maintained.
Definition WsfEW_Effect.hpp:52
@ cEB_TRACK_ERROR
Track errors are applied.
Definition WsfEW_Effect.hpp:53
@ cEB_FALSE_TARGET_EFFECT
False target effect.
Definition WsfEW_Effect.hpp:60
@ cEB_SIGNAL_POWER_EFFECT
Signal power or receiver noise delta gain effect.
Definition WsfEW_Effect.hpp:58
@ cEB_JAM_STROBE_EFFECT
Jam strobe effects are applied.
Definition WsfEW_Effect.hpp:67
@ cEB_AGILITY_EFFECT
Agility effects are applied.
Definition WsfEW_Effect.hpp:62
@ cEB_REPEATER_EFFECT
Repeater jamming effects are applied.
Definition WsfEW_Effect.hpp:63
@ cEB_TARGET_REJECT_EFFECT
Reject target effect, used to zero jamming power when applied.
Definition WsfEW_Effect.hpp:68
@ cEB_REPEATER_UPDATE
Repeater logic is present and is updated.
Definition WsfEW_Effect.hpp:64
@ cEB_DROP_TRACK
Track is dropped.
Definition WsfEW_Effect.hpp:51
@ cEB_DROP_MESSAGE
Message is dropped.
Definition WsfEW_Effect.hpp:54
@ cEB_MAINTAIN_MESSAGE
Message is maintained.
Definition WsfEW_Effect.hpp:55
@ cEB_FLOODED_BLOCKED
System is flooded, either track or messages and is causing blockage.
Definition WsfEW_Effect.hpp:65
@ cEB_JAMMER_POWER_EFFECT
Jammer power gain effect.
Definition WsfEW_Effect.hpp:57
@ cEB_SLC_DEGRADE_EFFECT
Sidelobe canceler degrade effect.
Definition WsfEW_Effect.hpp:59
@ cEB_PULSE_EFFECT
Pulse jammer effect.
Definition WsfEW_Effect.hpp:61
@ cEB_MESSAGE_ERROR
Message error is applied.
Definition WsfEW_Effect.hpp:56
WsfStringId mCurrentTargetId
Current target Id.
Definition WsfEW_Effect.hpp:372
WsfStringId mEffectingSystemId
The type Id of the system doing the effecting, changes with each call to UpdateEffects(....
Definition WsfEW_Effect.hpp:382
WsfEW_Effect * Clone() const override=0
Behavior mBehavior
The behavior that this EW effect exhibits.
Definition WsfEW_Effect.hpp:367
int mCurrentXmtrUniqueId
Current transmitter unique Id.
Definition WsfEW_Effect.hpp:375
bool mUpdatingEffect
Variable to prevent infinite recursion in UpdateEffect.
Definition WsfEW_Effect.hpp:385
virtual void UpdateEffects(double aSimTime, const WsfEM_Interaction &aTargetInteraction, const WsfEM_Interaction &aJammerToTgtInteraction, const ut::optional< WsfEM_Interaction > &aTgtToJammerInteraction, WsfEW_Effects &aEW_Effects, WsfEW_Effect *aEW_EffectPtr=nullptr)
Definition WsfEW_Effect.cpp:374
WsfEW_Effect & operator=(const WsfEW_Effect &)=delete
virtual bool Initialize(WsfSimulation &aSimulation)
Definition WsfEW_Effect.cpp:69
bool DebugEnabled() const
Definition WsfEW_Effect.hpp:266
WsfEW_EA_EP * GetEA_EP_Ptr() const
Definition WsfEW_Effect.hpp:278
virtual double GetJammingPulseDensity(WsfEM_Xmtr *aXmtrPtr) const
Definition WsfEW_Effect.hpp:300
void AddCoherencyMask(Coherency aCoherency)
Definition WsfEW_Effect.hpp:235
void SetTechniquePtr(WsfEW_Technique *aPtr)
Definition WsfEW_Effect.hpp:294
unsigned int GetCoherencyMask() const
Definition WsfEW_Effect.hpp:239
int mCurrentRcvrUniqueId
Current receiver unique Id.
Definition WsfEW_Effect.hpp:376
virtual void ProcessMitigatedEffect(double aSimTime, const WsfEM_Interaction &aTargetInteraction, const WsfEM_Interaction &aJammerToTgtInteraction, const ut::optional< WsfEM_Interaction > &aTgtToJammerInteraction, WsfEW_Effects &aEW_Effects, WsfEW_Effect *aEW_EffectPtr=nullptr)
Definition WsfEW_Effect.cpp:239
WsfStringId mCurrentXmtrPlatformId
Current transmitting platform Id.
Definition WsfEW_Effect.hpp:373
unsigned int mSystemFunctionMask
The system type mask that this EW effect can affect.
Definition WsfEW_Effect.hpp:366
unsigned int GetSystemFunctionMask() const
Definition WsfEW_Effect.hpp:220
unsigned int mCoherencyMask
The coherency of this effect wrt to the affected system.
Definition WsfEW_Effect.hpp:368
ModulationType
Definition WsfEW_Effect.hpp:85
@ cEM_PHASECODE
Definition WsfEW_Effect.hpp:94
@ cEM_PHASEMOD
Definition WsfEW_Effect.hpp:93
@ cEM_PHASEKEY
Definition WsfEW_Effect.hpp:92
@ cEM_COHPULSE
Definition WsfEW_Effect.hpp:88
@ cEM_CW
Definition WsfEW_Effect.hpp:87
@ cEM_NONE
Definition WsfEW_Effect.hpp:86
@ cEM_BPSK
Definition WsfEW_Effect.hpp:98
@ cEM_DPSK
Definition WsfEW_Effect.hpp:100
@ cEM_NONCOHPULSE
Definition WsfEW_Effect.hpp:89
@ cEM_FSK
Definition WsfEW_Effect.hpp:96
@ cEM_QPSK
Definition WsfEW_Effect.hpp:99
@ cEM_QAM
Definition WsfEW_Effect.hpp:101
@ cEM_LINEARFM
Definition WsfEW_Effect.hpp:90
@ cEM_ASK
Definition WsfEW_Effect.hpp:95
@ cEM_PSK
Definition WsfEW_Effect.hpp:97
@ cEM_NONLINEARFM
Definition WsfEW_Effect.hpp:91
EffectDataMap mEffectDataMap
Map of the System Type Id to the data required for this effect.
Definition WsfEW_Effect.hpp:390
void SetEA_EP_Ptr(WsfEW_EA_EP *aPtr)
Definition WsfEW_Effect.hpp:274
virtual void ApplyUnmitigatedEffect(WsfEW_Effects &aEW_Effects) const =0
WsfStringId mCurrentRcvrPlatformId
Current receiving platform Id.
Definition WsfEW_Effect.hpp:374
virtual void ApplyMitigatedEffect(WsfEW_Effect *aEW_EffectPtr, WsfEW_Effects &aEW_Effects) const =0
virtual void ProcessUnmitigatedEffect(double aSimTime, const WsfEM_Interaction &aTargetInteraction, const WsfEM_Interaction &aJammerToTgtInteraction, const ut::optional< WsfEM_Interaction > &aTgtToJammerInteraction, WsfEW_Effects &aEW_Effects)
Definition WsfEW_Effect.cpp:207
void SetSystemFunctionMask(SystemFunction aSystemFunction)
Set the system type.
Definition WsfEW_Effect.hpp:211
void SetCoherencyMask(Coherency aCoherency)
Definition WsfEW_Effect.hpp:231
virtual void RemoveJammerXmtr(unsigned int aXmtrId)
Definition WsfEW_Effect.cpp:399
WsfStringId mEffectedSystemId
The type Id of the system being effected, changes with each call to UpdateEffects(....
Definition WsfEW_Effect.hpp:379
virtual double GetJammingPulseDensity() const
Definition WsfEW_Effect.hpp:299
Behavior GetBehavior() const
Definition WsfEW_Effect.hpp:254
WsfEW_Effect()=default
virtual EffectData * NewEffectData()
Definition WsfEW_Effect.hpp:356
void ResetEffectData(WsfStringId aSystemTypeId)
Definition WsfEW_Effect.hpp:354
bool mDebug
The debug flag, 'true' for debug, false otherwise.
Definition WsfEW_Effect.hpp:369
void SetBehavior(Behavior aBehavior)
Definition WsfEW_Effect.hpp:250
SystemFunction
The type of system function types the EW effect can affect.
Definition WsfEW_Effect.hpp:114
@ cES_UNDEFINED
Definition WsfEW_Effect.hpp:115
@ cES_JAMMER
Effect is meant for jammer systems.
Definition WsfEW_Effect.hpp:118
@ cES_COMM
Effect is meant for comm systems.
Definition WsfEW_Effect.hpp:116
@ cES_SENSOR
Effect is meant for sensor systems.
Definition WsfEW_Effect.hpp:117
@ cES_NEXT_FREE_MASK
For use by derived classes to specify additional EW function masks.
Definition WsfEW_Effect.hpp:119
Definition WsfEW_Effects.hpp:41
Definition WsfEW_Technique.hpp:37
Definition WsfEW_Types.hpp:40
WsfObject()
This is the constructor for the WsfObject class.
Definition WsfObject.cpp:88
virtual WsfObject * Clone() const =0
virtual bool ProcessInput(UtInput &aInput)
Definition WsfObject.cpp:140
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Copyrights Multiple, All Rights Reserved