WSF
Interface_J11.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI//REL TO USA ONLY
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#ifndef L16_LINK16INTERFACE_J11_HPP
12#define L16_LINK16INTERFACE_J11_HPP
13
14#include <list>
15#include <map>
16
17// L16
18#include "wsf_l16_export.h"
19
20#include "Message11_0.hpp"
21#include "MessagesPreDef.hpp"
22
23// WSF
24#include "UtCallback.hpp"
25#include "UtCallbackHolder.hpp"
26#include "WsfEvent.hpp"
27#include "WsfStringId.hpp"
28
29// Forward declarations
30class DisEntityId;
31class UtInput;
32class WsfDisPlatform;
33class WsfMessage;
34class WsfPlatform;
35class WsfTrack;
36class WsfWeapon;
38
39namespace WsfL16
40{
41class Interface;
42
43class WSF_L16_EXPORT Interface_J11_Setup
44{
45public:
47 bool ProcessInput(UtInput& aInput);
50 void SetDebugEnabled(bool aDebugEnabled) { mDebugEnabled = aDebugEnabled; }
51
52protected:
53 void AddTypeOfNEW(WsfStringId aPlatformType, int aNEW_Type);
55 // void UpdateWeaponTrackNumber(const DisEntityId& aSenderEntityId,
56 // const unsigned int aSenderTrackNumber,
57 // const unsigned int aAddresseeTrackNumber);
58
61
65
67 typedef std::pair<WsfStringId, Messages::J11_0::WeaponNEW_TypeField::WeaponNEW_TypeType> TypeOfNEW_MapTypePair;
68 typedef std::map<WsfStringId, Messages::J11_0::WeaponNEW_TypeField::WeaponNEW_TypeType> TypeOfNEW_MapType;
69 typedef std::map<WsfStringId, Messages::J11_0::WeaponNEW_TypeField::WeaponNEW_TypeType>::iterator TypeOfNEW_MapTypeIterator;
70
72
73 typedef std::map<unsigned int, WsfStringId> ControllerMapType;
75};
76
78class WSF_L16_EXPORT Interface_J11 : public Interface_J11_Setup
79{
80public:
87
89 Interface_J11(Interface* aInterfacePtr, Interface_J11_Setup& aScenario);
90
92 virtual ~Interface_J11();
93
94 void Initialize();
95
96
98
99
100 void ProcessJ11Message(const DisEntityId& aSenderEntityId, const Messages::InitialBase& aMessage, int aSubLabel);
101 void ProcessJ11_0Message(const DisEntityId& aSenderEntityId, const Messages::InitialBase& aMessage);
102 void ProcessJ11_1Message(const DisEntityId& aSenderEntityId, const Messages::InitialBase& aMessage);
103 void ProcessJ11_2Message(const DisEntityId& aSenderEntityId, const Messages::InitialBase& aMessage);
104
105 void WeaponFired(double aSimTime, const WsfWeaponEngagement* aEngagementPtr, const WsfTrack* aTargetTrackPtr);
106
107 void WeaponTerminated(double aSimTime, const WsfWeaponEngagement* aEngagementPtr);
108
109 void HandoffControlChange(const DisEntityId& aSenderEntityId,
110 const unsigned int aSenderTrackNumber,
111 WsfPlatform* aWeaponPlatformPtr,
112 const Messages::InitialBase& aMessage);
113
114 void InFlightTargetUpdate(const DisEntityId& aSenderEntityId,
115 WsfPlatform* aWeaponPlatformPtr,
116 const Messages::InitialBase& aMessage);
117
119 double ProcessWIFT_Event(double aSimTime, WsfPlatform* aWeaponPlatformPtr);
120
121 void SendBombHitIndicationReport(WsfPlatform* aWeaponPlatformPtr, WsfPlatform* aTargetPlatformPtr);
122
123 void SendWeaponSelfAbortReport(WsfPlatform* aWeaponPlatformPtr, const std::string& aExtendedResult);
125
126 WsfSimulation* GetSimulation() const;
127
128 static UtCallbackListN<void(const DisEntityId&, const unsigned int, unsigned int&)> FindWeaponIndex;
129
130 static UtCallbackListN<void(WsfWeapon*, WsfDisPlatform*&)> UpdateFiringEntity;
131
132private:
134 class WIFT_Event : public WsfEvent
135 {
136 public:
137 WIFT_Event(double aSimTime, Interface_J11* aInterfacePtr, WsfPlatform* aPlatformPtr);
138
139 EventDisposition Execute() override;
140
141 private:
142 Interface_J11* mInterfacePtr;
143 size_t mPlatformIndex;
144 };
145
147 typedef std::pair<unsigned int, unsigned int> NEW_MapTypePair;
148 typedef std::map<unsigned int, unsigned int> NEW_MapType;
149 typedef std::map<unsigned int, unsigned int>::iterator NEW_MapTypeIterator;
150
153 void CreateTerminationResultMap();
154
156 bool DeleteNEW_MapData(NEW_MapType& aNEW_Map, const unsigned int aKey);
157
159 bool DeleteDirectorToWeapon(const DisEntityId& aDisEntityId, unsigned int aWeaponTrackNumber);
160
161 void PurgeWeaponRecords(size_t aWeaponPlatformIndex);
162
164 bool FindIntercept(const double aWpnLocWCS[3],
165 double aWpnSpeed,
166 const double aTgtLocWCS[3],
167 const double aTgtVelWCS[3],
168 double aIntLocWCS[3]);
169
171 void FillTrack(const DisEntityId& aSenderEntityId, const Messages::InitialBase& aMessage, WsfTrack* aTrackPtr);
172
174 WsfPlatform* FindPlatform(unsigned int aTrackNumber);
175
177 Messages::J11_0::WeaponDetailedStatusField::WeaponDetailedStatusType
178 GetDetailedStatusInformation(const std::string& aExtendedResult);
179
181 void GetInterceptData(WsfPlatform* aWeaponPlatformPtr, double& aTimeToGo, double& aRangeToGo);
182
184 bool GetNEW_MapData(NEW_MapType& aNEW_Map, const unsigned int aKey, unsigned int& aValue);
185
187 Messages::J11_0::WeaponNEW_TypeField::WeaponNEW_TypeType GetNEW_Type(WsfPlatform* aWeaponPlatformPtr);
188
191 unsigned int GetNumberOfWeaponsFired(unsigned int aFiringPlatformIndex);
192
194 WsfPlatform* GetWeapon(const DisEntityId& aSenderEntityId, unsigned int aWeaponTrackNumber);
195
197 bool IsJTIDS_EnabledWeapon(WsfPlatform* aWeaponPlatformPtr);
198
200 bool IsNetworkEnabledWeapon(WsfPlatform* aWeaponPlatformPtr);
201
203 bool IsActive(WsfPlatform* aWeaponPlatformPtr);
204
206 bool IsTracking(WsfPlatform* aWeaponPlatformPtr);
207
209 void ProcessJMessage(WsfPlatform* aWeaponPlatformPtr, const Messages::InitialBase& aMessage);
210
212 bool ReceiveMessage(WsfPlatform* aWeaponPlatformPtr, WsfMessage& aMessage);
213
215 bool SendMessage(WsfPlatform* aWeaponPlatformPtr, Messages::InitialBase* aMessage);
216
218 bool SetDirectorToWeapon(const DisEntityId& aDisEntityId, unsigned int aWeaponTrackNumber, size_t aWeaponPlatformIndex);
219
221 typedef std::pair<DisEntityId, unsigned int> EID_MapTypePair;
222 typedef std::multimap<DisEntityId, unsigned int> EID_MapType;
223 typedef std::multimap<DisEntityId, unsigned int>::iterator EID_MapTypeIterator;
224
226 // bool SetEntityIDMapData(EID_MapType& aEID_Map,
227 // const DisEntityId& aDisEntityId,
228 // const unsigned int aValue);
229
231 void SetL16ComputerTrackNumber(WsfPlatform* aWeaponPlatformPtr, unsigned int aWeaponTrackNumber);
232
234 bool SetNEW_MapData(NEW_MapType& aNEW_Map, const unsigned int aKey, const unsigned int aValue);
235
237 void UpdateDirector(const DisEntityId& aSenderEntityId, const unsigned int aSenderTrackNumber);
238
240 // void UpdateWeaponTrackNumber(const DisEntityId& aSenderEntityId,
241 // const unsigned int aSenderTrackNumber,
242 // const unsigned int aAddresseeTrackNumber);
243 //
244 // bool mDebugEnabled; //! Debug flag
245 // bool mDebugPrintMessages;
246 //
247 // bool mAllowAnyComm; //! True if any comm device can be used
248 // bool mUseTimeOfTargetMeasurement; //! True if using J11.1C3 TIME OF TARGET MEASUREMENT
249 // double mWIFT_Interval; //! Weapon in-flight track report interval
250 //
251 Interface* mInterfacePtr;
253 NEW_MapType mFiringPlatformToWeaponCountMap;
254
256 // EID_MapType mPendingControllerToNEWsMap;
257
259 NEW_MapType mNEW_TrackNumber;
260
262 NEW_MapType mNEW_ControllerTrackNumber;
263
265 NEW_MapType mPendingDirectorTrackNumber;
266
268 typedef std::pair<EID_MapTypePair, size_t> D_NEW_MapTypePair;
269 typedef std::map<EID_MapTypePair, size_t> D_NEW_MapType;
270 typedef std::map<EID_MapTypePair, size_t>::iterator D_NEW_MapTypeIterator;
271
272 D_NEW_MapType mDirectorToWeaponMap;
273
275 typedef std::pair<WsfStringId, Messages::J11_0::WeaponDetailedStatusField::WeaponDetailedStatusType> Result_MapTypePair;
276 typedef std::map<WsfStringId, Messages::J11_0::WeaponDetailedStatusField::WeaponDetailedStatusType> Result_MapType;
277 typedef std::map<WsfStringId, Messages::J11_0::WeaponDetailedStatusField::WeaponDetailedStatusType>::iterator Result_MapTypeIterator;
278
279 Result_MapType mResultMap;
280};
281} // namespace WsfL16
282
283#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
An internal class used by WsfDisInterface to maintain information about a platform.
Definition WsfDisPlatform.hpp:67
Definition WsfEvent.hpp:29
Definition Interface_J11.hpp:44
std::map< unsigned int, WsfStringId > ControllerMapType
Definition Interface_J11.hpp:73
bool mDebugPrintMessages
Debug flag.
Definition Interface_J11.hpp:60
bool mUseTimeOfTargetMeasurement
True if any comm device can be used.
Definition Interface_J11.hpp:63
void SetDebugEnabled(bool aDebugEnabled)
Definition Interface_J11.hpp:50
ControllerMapType mControllerMap
Definition Interface_J11.hpp:74
std::map< WsfStringId, Messages::J11_0::WeaponNEW_TypeField::WeaponNEW_TypeType > TypeOfNEW_MapType
Definition Interface_J11.hpp:68
TypeOfNEW_MapType mTypeOfNEW_Map
Definition Interface_J11.hpp:71
bool mAllowAnyComm
Definition Interface_J11.hpp:62
Interface_J11_Setup()
Definition Interface_J11.cpp:54
double mWIFT_Interval
True if using J11.1C3 TIME OF TARGET MEASUREMENT.
Definition Interface_J11.hpp:64
bool mDebugEnabled
Definition Interface_J11.hpp:59
bool ProcessInput(UtInput &aInput)
Definition Interface_J11.cpp:68
std::pair< WsfStringId, Messages::J11_0::WeaponNEW_TypeField::WeaponNEW_TypeType > TypeOfNEW_MapTypePair
Weapon in-flight track report interval.
Definition Interface_J11.hpp:67
std::map< WsfStringId, Messages::J11_0::WeaponNEW_TypeField::WeaponNEW_TypeType >::iterator TypeOfNEW_MapTypeIterator
Definition Interface_J11.hpp:69
WsfL16::Interface_J11 is an interface to DisSignal PDUs conveying J11 messages.
Definition Interface_J11.hpp:79
static UtCallbackListN< void(WsfWeapon *, WsfDisPlatform *&)> UpdateFiringEntity
Definition Interface_J11.hpp:130
Interface_J11(Interface *aInterfacePtr, Interface_J11_Setup &aScenario)
Constructor.
Definition Interface_J11.cpp:150
static UtCallbackListN< void(const DisEntityId &, const unsigned int, unsigned int &)> FindWeaponIndex
Definition Interface_J11.hpp:128
J11_MessageType
Definition Interface_J11.hpp:82
@ cWEAPON_DIRECTIVE
Definition Interface_J11.hpp:84
@ cWEAPON_COORDINATION
Definition Interface_J11.hpp:85
@ cWEAPON_PESPONSE_STATUS
Definition Interface_J11.hpp:83
Definition Interface.hpp:116
A base class for messages sent among simulation communication objects, processors and sensors.
Definition WsfMessage.hpp:33
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
The main controller for a simulation.
Definition WsfSimulation.hpp:109
An object that represents an 'track' (perception) of something.
Definition WsfTrack.hpp:120
Definition WsfWeaponEngagement.hpp:43
Definition WsfWeapon.hpp:63
This file should be included prior to defining a message. Currently there is a limit of 32 fields per...
Definition AllMessages.hpp:55
Copyrights Multiple, All Rights Reserved