WSF
WsfSimulation.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 WSFSIMULATION_HPP
13#define WSFSIMULATION_HPP
14
15#include "wsf_export.h"
16
17#include <map>
18#include <memory>
19#include <mutex>
20#include <set>
21#include <string>
22#include <vector>
23
24class UtAtmosphere;
25class UtInput;
26#include "UtMemory.hpp"
27#include "UtRandom.hpp"
28class UtScriptClass;
29#include "UtScriptExecutor.hpp"
30class UtScriptTypes;
31#include "UtWallClock.hpp"
33class WsfApplication;
35#include "WsfClockSource.hpp"
36#include "WsfCommObserver.hpp"
37#include "WsfDateTime.hpp"
38#include "WsfDisObserver.hpp"
39#include "WsfEM_Manager.hpp"
40class WsfEnvironment;
41#include "WsfEvent.hpp"
42#include "WsfEventManager.hpp"
43#include "WsfException.hpp"
45#include "WsfExtensionList.hpp"
46#include "WsfFuelObserver.hpp"
47#include "WsfGroupManager.hpp"
48class WsfIFF_Manager;
49class WsfLOS_Manager;
50class WsfMover;
51#include "WsfMoverObserver.hpp"
54class WsfPlatform;
56class WsfPlatformPart;
58class WsfProcessor;
61class WsfRoute;
62class WsfScenario;
65class WsfSensor;
66#include "WsfSensorObserver.hpp"
70#include "WsfStringId.hpp"
71class WsfSystemLog;
72#include "WsfTaskObserver.hpp"
73#include "WsfTrackObserver.hpp"
74#include "WsfTypes.hpp"
75class WsfZone;
77#include "WsfZoneObserver.hpp"
78
81namespace wsf
82{
84namespace comm
85{
86class Comm;
87class NetworkManager;
88} // namespace comm
89} // namespace wsf
90
107
109{
110public:
122
132
135 {
136 public:
138 };
139
142 {
143 public:
144 StartError();
145 };
146
151 {
152 public:
153 CreateError();
154 };
155
157
159 {
160 public:
161 AddPlatformEvent(double aSimTime, WsfPlatform* aPlatformPtr);
162
163 ~AddPlatformEvent() override;
164
165 EventDisposition Execute() override;
166
167 private:
168 WsfPlatform* mPlatformPtr;
169 };
170
171 WsfSimulation(const WsfScenario& aScenario, unsigned int aRunNumber);
172 virtual ~WsfSimulation();
173 WsfSimulation(const WsfSimulation& aSrc) = delete;
174 WsfSimulation& operator=(const WsfSimulation& aRhs) = delete;
175
176 const WsfScenario& GetScenario() const { return mScenario; }
177 WsfApplication& GetApplication() const;
178
180
181 virtual void Initialize();
182
183 virtual void PrepareSimulation();
184
185 virtual void AddEvent(std::unique_ptr<WsfEvent> aEventPtr);
186 // A helper function to construct and queue an event, returning a non-owning reference to the event
187 template<typename T, typename... Args>
188 T* AddEventT(Args&&... args)
189 {
190 static_assert(std::is_base_of<WsfEvent, T>::value, "Template type argument must derive from WsfEvent");
191 auto eventPtr = ut::make_unique<T>(std::forward<Args>(args)...);
192 auto returnPtr = eventPtr.get();
193 AddEvent(std::move(eventPtr));
194 return returnPtr;
195 }
196
197 virtual void AddWallEvent(std::unique_ptr<WsfEvent> aEventPtr);
198 // A helper function to construct and queue a wall event, returning a non-owning reference to the event
199 template<typename T, typename... Args>
200 T* AddWallEventT(Args&&... args)
201 {
202 static_assert(std::is_base_of<WsfEvent, T>::value, "Template type argument must derive from WsfEvent");
203 auto eventPtr = ut::make_unique<T>(std::forward<Args>(args)...);
204 auto returnPtr = eventPtr.get();
205 AddWallEvent(std::move(eventPtr));
206 return returnPtr;
207 }
208
209 virtual double AdvanceTime();
210
211 virtual double AdvanceTime(double aSimTime);
212
213 virtual bool ShouldExecute() const;
214
215 virtual void Start();
216
217 virtual void Pause();
218
219 void PauseAndRequestAdvance(double);
220
221 virtual void Resume();
222
223 virtual void Complete(double aSimTime);
224
225 virtual void RequestReset();
226
227 virtual void WaitForAdvanceTime();
228
242 bool IsActive() const { return (mState == cACTIVE); }
243
245 State GetState() const { return mState; }
246
248 const std::string& GetStateString() const;
249
251 static const std::string& GetStateString(State aState);
252
256
257 virtual std::string GetCompletionReasonString() const;
258
259 virtual void RequestTermination();
260
262 void SetEndTime(double aEndTime);
263
265 double GetSimTime() const { return mSimTime; }
266
268 double GetEndTime() const { return mEndTime; }
269
270 virtual double GetNextEventTime() const;
271
275 double GetRealTime() const { return mRealTime; }
276
278 bool IsRealTime() const { return mIsRealTime; }
279
281 double GetWallTime() const;
282
288 double GetTimeBehind() const { return mTimeBehind; }
289
292 double GetTimestep() const { return mTimestep; }
293
296 double GetSyncTimestep() const { return mSyncTimestep; }
297
299 virtual void SetRealtime(double aSimTime, bool aIsRealTime) {}
300
301 void SetIsExternallyStarted(bool aIsExternallyStarted);
302
304 bool IsExternallyStarted() const { return mIsExternallyStarted; }
305
307 bool MultiThreadingActive() const { return mMultiThreadingActive; }
308
310 void SetMultiThreadingActive(bool aMultiThreadingActive) { mMultiThreadingActive = aMultiThreadingActive; }
311
313 bool IsEventStepSimulation() const { return mAmAnEventStepSimulation; }
314
315 void SetAmAnEventStepSimulation(bool aFlag) { mAmAnEventStepSimulation = aFlag; }
316
317 void SetClockSource(std::unique_ptr<WsfClockSource> aClockSourcePtr);
318
321 const WsfClockSource* GetClockSource() const { return mClockSourcePtr.get(); }
322
323 virtual double GetClockRate() const;
324
325 virtual void SetClockRate(double aClockRate);
326
327 virtual void
328 SetTimeParameters(int aTimeScheme, double aSimTime, double aClockRate, double aTimeStep, bool aTimeAdvance = false);
330
332
333 virtual bool AddPlatform(WsfPlatform* aPlatformPtr);
334
335 virtual bool AddPlatform(double aSimTime, WsfPlatform* aPlatformPtr);
336
337 // void AssignPlatformToSimulation(WsfPlatform* aPlatformPtr);
338
339 // Remove the Platform from the Simulation and cleans up the memory if aDeleteMemory is true
340 virtual void DeletePlatform(double aSimTime, WsfPlatform* aPlatformPtr, bool aDeleteMemory = true);
341
342 WsfPlatform* GetPlatformByIndex(size_t aIndex) const;
343
344 WsfPlatform* GetPlatformByName(WsfStringId aNameId) const;
345
346 bool PlatformExists(size_t aIndex) const;
347
348 WsfStringId GetPlatformNameId(size_t aIndex) const;
349
350 WsfStringId GetPlatformTypeId(size_t aIndex) const;
352
364
365 size_t GetPlatformCount() const;
366
367 WsfPlatform* GetPlatformEntry(size_t aEntry) const;
369
371
372 virtual bool TurnPartOff(double aSimTime, WsfPlatformPart* aPartPtr) { return TurnPartOffP(aSimTime, aPartPtr); }
373
374 virtual bool TurnPartOn(double aSimTime, WsfPlatformPart* aPartPtr) { return TurnPartOnP(aSimTime, aPartPtr); }
375
376 virtual bool SetPartOperational(double aSimTime, WsfPlatformPart* aPartPtr, bool aOperational = true)
377 {
378 return SetPartOperationalP(aSimTime, aPartPtr, aOperational);
379 }
380
381 virtual void SetPartUpdateInterval(double aSimTime, WsfPlatformPart* aPartPtr, double aUpdateInterval);
383
385
386 virtual bool PlatformDeleted(double aSimTime, WsfPlatform* aOldPlatformPtr);
387
388 virtual void ProcessRemovePlatformEvent(double aSimTime, WsfPlatform* aPlatformPtr, bool aDeletePlatform);
389
390 virtual void ProcessPlatformBrokenEvent(double aSimTime, WsfPlatform* aPlatformPtr);
392
394
395
396 virtual void SimulationStarting() { Start(); }
398 virtual void SimulationComplete(double aSimTime) { Complete(aSimTime); }
400
402 bool IsFlexibleRealtime() const { return mIsFlexibleRealtime; }
403
404 void SetFlexibleRealtime() { mIsFlexibleRealtime = true; }
405
407
408 WsfAdvancedBehaviorObserver& GetAdvancedBehaviorObserver() const { return mAdvancedBehaviorObserver; }
409 WsfBehaviorObserver& GetBehaviorObserver() const { return mBehaviorObserver; }
410 WsfCommObserver& GetCommObserver() const { return mCommObserver; }
411 WsfDisObserver& GetDisObserver() const { return mDisObserver; }
412 WsfExchangeObserver& GetExchangeObserver() const { return mExchangeObserver; }
413 WsfFuelObserver& GetFuelObserver() const { return mFuelObserver; }
414 WsfMoverObserver& GetMoverObserver() const { return mMoverObserver; }
415 WsfPlatformObserver& GetPlatformObserver() const { return mPlatformObserver; }
416 WsfPlatformPartObserver& GetPlatformPartObserver() const { return mPlatformPartObserver; }
417 WsfProcessorObserver& GetProcessorObserver() const { return mProcessorObserver; }
418 WsfScriptStateMachineObserver& GetScriptStateMachineObserver() const { return mScriptStateMachineObserver; }
419 WsfSensorObserver& GetSensorObserver() const { return mSensorObserver; }
420 WsfSimulationObserver& GetSimulationObserver() const { return mSimulationObserver; }
421 WsfTaskObserver& GetTaskObserver() const { return mTaskObserver; }
422 WsfTrackObserver& GetTrackObserver() const { return mTrackObserver; }
423 WsfZoneObserver& GetZoneObserver() const { return mZoneObserver; }
425
427
428 WsfSimulationExtension* FindExtension(const std::string& aName) const;
429 WsfSimulationExtension& GetExtension(const std::string& aName) const;
430 const WsfExtensionList& GetExtensions() const { return mExtensionList; }
431
432 void RegisterExtension(const std::string& aName, std::unique_ptr<WsfSimulationExtension> aExtensionPtr);
433 const std::vector<std::string>& GetExtensionNames() const;
435
436 unsigned int AssignUniqueId();
437
438 ut::Random& GetRandom();
439 ut::Random& LockRandom();
440 void UnlockRandom();
441
442 ut::Random& GetScriptRandom();
443 ut::Random& LockScriptRandom();
444 void UnlockScriptRandom();
445
446 wsf::TerrainInterface* GetTerrainInterface() const;
448 const WsfDateTime& GetDateTime() const { return mDateTime; }
449 WsfGroupManager& GetGroupManager() { return mGroupManager; }
450 wsf::comm::NetworkManager* GetCommNetworkManager() const { return mCommNetworkManagerPtr; }
451 WsfMultiThreadManager& GetMultiThreadManager() { return mMultiThreadManager; }
452 WsfPathFinderList& GetPathFinderList() const { return mPathFinderList; }
453 WsfScriptContext& GetScriptContext() { return mGlobalContext; }
454 const WsfScriptContext& GetScriptContext() const { return mGlobalContext; }
455 WsfLOS_Manager* GetLOS_Manager() const { return mLOS_ManagerPtr; }
456 WsfZoneAttenuation& GetZoneAttenuation() { return mZoneAttenuation; }
458 UtScriptExecutor& GetScriptExecutor() { return mScriptExecutor; }
459 UtAtmosphere& GetAtmosphere() const;
460 WsfEnvironment& GetEnvironment() const;
461 WsfSystemLog& GetSystemLog() const;
462 WsfIFF_Manager* GetIFF_Manager() const;
463
464 unsigned int NextMessageSerialNumber() { return ++mNextMessageSerialNumber; }
465 unsigned int NextEngagementSerialNumber() { return ++mNextEngagementSerialNumber; }
466 unsigned int PreviousEngagementSerialNumber() const { return mNextEngagementSerialNumber; }
467 void ReclaimPreviousEngagementSerialNumber() { --mNextEngagementSerialNumber; }
468 double CreateMessageDataTag();
469
471 bool MultiThreaded() const { return mMultiThreaded; }
472
474 unsigned int GetRunNumber() const { return mRunNumber; }
475
476 unsigned int GetFinalRunNumber() const;
477
478 bool RandomizeFrequency() const;
479
480 bool UseDefaultFrequency() const;
482
484
485 std::string SubstituteOutputFileVariables(const std::string& aOutputFile);
486
487protected:
489
490 void AddToPlatformList(WsfPlatform* aPlatformPtr);
491
492 bool DeleteFromPlatformList(WsfPlatform* aPlatformPtr);
493
494 bool PlatformPointerExists(WsfPlatform* aPlatformPtr);
495
496 void ResetPlatformList();
497
502 bool AddInputPlatforms();
504
505 virtual bool TurnPartOffP(double aSimTime, WsfPlatformPart* aPartPtr);
506
507 virtual bool TurnPartOnP(double aSimTime, WsfPlatformPart* aPartPtr);
508
509 virtual bool SetPartOperationalP(double aSimTime, WsfPlatformPart* aPartPtr, bool aOperational);
510
511 virtual void DispatchWallEvents();
512 virtual void DispatchSimEvents(double aSimTime);
513 virtual void DispatchEvents(double aSimTime);
514
515 virtual bool PlatformInitialized(double aSimTime, WsfPlatform* aNewPlatformPtr);
516
517 virtual bool PlatformIntroduced(double aSimTime, WsfPlatform* aNewPlatformPtr);
518
519
520 virtual bool SimulationInitialized();
521
522 virtual void CreateClock();
523
524 virtual bool PlatformIsAvailable(WsfPlatform* aPlatformPtr);
525
528
531
534
536 std::unique_ptr<WsfClockSource> mClockSourcePtr{nullptr};
537
541
543 double mSimTime{0.0};
544
547 double mRealTime{false};
548
550 double mTimeBehind{0.0};
551
555 double mTimestep{0.0};
556
559
562
565
568
570 unsigned int mRunNumber;
571
573
575
577
579
581 double mEndTime{std::numeric_limits<double>::max()};
582
583 bool mIsRealTime{false};
584
585private:
586 void AssignDefaultName(WsfPlatform* aPlatformPtr);
587
588 bool IntroducePlatform(double aSimTime, WsfPlatform* aNewPlatformPtr);
589
590 void TurnOnSystems(double aSimTime, WsfPlatform* aPlatformPtr);
591
592 void HandlePlatformInitializationFailure(WsfPlatform* aPlatformPtr);
593
594 const WsfScenario& mScenario;
595
597 std::vector<WsfStringId> mPlatformNameIds;
598
600 std::vector<WsfStringId> mPlatformTypeIds;
601
603 UtWallClock mWallClock;
604
606 double mSyncTimestep{0.0};
607
609 double mClockRate;
610
611 double mNextMessageDataTag{1.0};
612
613 unsigned int mNextMessageSerialNumber{0};
614
615 unsigned int mNextEngagementSerialNumber{0};
616
617 std::recursive_mutex mUniqueIdMutex;
618 unsigned int mUniqueId{0};
619
622 ut::Random mRandom;
623 std::recursive_mutex mRandomMutex;
624
628 ut::Random mScriptRandom;
629 std::recursive_mutex mScriptRandomMutex;
630
632 bool mIsExternallyStarted{false};
633
635 bool mMultiThreadingActive{false};
636
638 bool mAmAnEventStepSimulation{true};
639
642 bool mIsFlexibleRealtime{false};
643
645 std::map<WsfStringId, int> mNextDefaultNameNumber;
646
650 mutable WsfAdvancedBehaviorObserver mAdvancedBehaviorObserver;
651 mutable WsfBehaviorObserver mBehaviorObserver;
652 mutable WsfCommObserver mCommObserver;
653 mutable WsfDisObserver mDisObserver;
654 mutable WsfExchangeObserver mExchangeObserver;
655 mutable WsfFuelObserver mFuelObserver;
656 mutable WsfMoverObserver mMoverObserver;
657 mutable WsfPlatformObserver mPlatformObserver;
658 mutable WsfPlatformPartObserver mPlatformPartObserver;
659 mutable WsfProcessorObserver mProcessorObserver;
660 mutable WsfScriptStateMachineObserver mScriptStateMachineObserver;
661 mutable WsfSensorObserver mSensorObserver;
662 mutable WsfSimulationObserver mSimulationObserver;
663 mutable WsfTaskObserver mTaskObserver;
664 mutable WsfTrackObserver mTrackObserver;
665 mutable WsfZoneObserver mZoneObserver;
666
667 wsf::comm::NetworkManager* mCommNetworkManagerPtr{nullptr};
668 WsfGroupManager mGroupManager;
669 WsfLOS_Manager* mLOS_ManagerPtr{nullptr};
670 WsfMultiThreadManager mMultiThreadManager;
671 WsfPathFinderList& mPathFinderList;
672 WsfZoneAttenuation mZoneAttenuation;
673
674 UtScriptExecutor mScriptExecutor;
675
677 WsfScriptContext mGlobalContext;
678
680 std::vector<WsfPlatform*> mPlatforms;
681
684 std::vector<WsfPlatform*> mPlatformsByIndex;
685
687 std::map<WsfStringId, WsfPlatform*> mPlatformsByName;
688
689 // Records the creation order of extensions
690 WsfExtensionList mExtensionList;
691};
692
693// Helper macro for observer objects to implement their callback accessors
694#define WSF_OBSERVER_CALLBACK_DEFINE(OBSERVER, EVENT) \
695 WsfObserver::EVENT##Callback& WsfObserver::EVENT(const WsfSimulation* aSimulationPtr) \
696 { \
697 return aSimulationPtr->Get##OBSERVER##Observer().EVENT; \
698 }
699
700#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfApplication.hpp:45
Maintain the current simulation clock.
Definition WsfClockSource.hpp:22
A singleton object used to maintain the start date and time of the simulation.
Definition WsfDateTime.hpp:34
Definition WsfEM_Manager.hpp:44
Definition WsfEnvironment.hpp:37
Definition WsfEventManager.hpp:41
WsfEvent()=default
EventDisposition
Definition WsfEvent.hpp:37
WsfException(const std::string &aWhat) noexcept
Definition WsfException.hpp:24
Definition WsfExtensionList.hpp:46
Definition WsfGroupManager.hpp:33
IFF manager (Singleton).
Definition WsfIFF_Manager.hpp:27
Definition WsfLOS_Manager.hpp:94
Definition WsfMover.hpp:37
A specialization class to handle multi-thread capabilities in the WSF core framework via thread pools...
Definition WsfMultiThreadManager.hpp:35
Definition WsfPathFinder.hpp:253
Definition WsfPlatformPart.hpp:61
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
Definition WsfProcessor.hpp:39
A specialization of WsfClockSource to support a real-time clock.
Definition WsfRealTimeClockSource.hpp:27
A collection of WsfWaypoint objects that represent a path to be followed.
Definition WsfRoute.hpp:40
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
Definition WsfScriptContext.hpp:71
Definition WsfSensor.hpp:92
Definition WsfSimulationExtension.hpp:41
Definition WsfSimulationInput.hpp:30
EventDisposition Execute() override
Definition WsfSimulation.cpp:1739
AddPlatformEvent(double aSimTime, WsfPlatform *aPlatformPtr)
Definition WsfSimulation.cpp:1750
CreateError()
Definition WsfSimulation.cpp:1775
InitializeError()
Definition WsfSimulation.cpp:1763
StartError()
Definition WsfSimulation.cpp:1769
unsigned int PreviousEngagementSerialNumber() const
Definition WsfSimulation.hpp:466
double mRealTime
Definition WsfSimulation.hpp:547
virtual bool TurnPartOff(double aSimTime, WsfPlatformPart *aPartPtr)
Definition WsfSimulation.hpp:372
double mSyncAccumulatedTime
The wall clock time taken to execute the current synchronized time step.
Definition WsfSimulation.hpp:558
virtual bool TurnPartOn(double aSimTime, WsfPlatformPart *aPartPtr)
Definition WsfSimulation.hpp:374
wsf::comm::NetworkManager * GetCommNetworkManager() const
Definition WsfSimulation.hpp:450
const WsfExtensionList & GetExtensions() const
Definition WsfSimulation.hpp:430
WsfEM_Manager & GetEM_Manager()
Definition WsfSimulation.hpp:457
WsfZoneObserver & GetZoneObserver() const
Definition WsfSimulation.hpp:423
State
An enumerated type specifying the state of the simulation.
Definition WsfSimulation.hpp:113
@ cINITIALIZING
The WsfSimulation::Initialize method is being called.
Definition WsfSimulation.hpp:115
@ cPENDING_COMPLETE
Simulation processing is complete; waiting on a call to WsfSimulation::Complete.
Definition WsfSimulation.hpp:119
@ cPENDING_INITIALIZE
The simulation has been constructed and is ready for WsfSimulation::Initialize to be called.
Definition WsfSimulation.hpp:114
@ cPENDING_START
Initialization is complete, ready for WsfSimulation::Start to be called.
Definition WsfSimulation.hpp:116
@ cSTARTING
The WsfSimulation::Start method is being called.
Definition WsfSimulation.hpp:117
@ cACTIVE
Start is complete, the simulation is in progress.
Definition WsfSimulation.hpp:118
@ cCOMPLETE
Simulation is complete.
Definition WsfSimulation.hpp:120
std::unique_ptr< WsfClockSource > mClockSourcePtr
Pointer to the simulation clock source object.
Definition WsfSimulation.hpp:536
WsfMultiThreadManager & GetMultiThreadManager()
Definition WsfSimulation.hpp:451
WsfExchangeObserver & GetExchangeObserver() const
Definition WsfSimulation.hpp:412
void SetAmAnEventStepSimulation(bool aFlag)
Definition WsfSimulation.hpp:315
WsfPathFinderList & GetPathFinderList() const
Definition WsfSimulation.hpp:452
virtual void AddWallEvent(std::unique_ptr< WsfEvent > aEventPtr)
Definition WsfSimulation.cpp:176
unsigned int GetRunNumber() const
Get the current run number.
Definition WsfSimulation.hpp:474
T * AddWallEventT(Args &&... args)
Definition WsfSimulation.hpp:200
WsfScriptStateMachineObserver & GetScriptStateMachineObserver() const
Definition WsfSimulation.hpp:418
virtual void SimulationComplete(double aSimTime)
Deprecated form of Complete();.
Definition WsfSimulation.hpp:398
bool mMultiThreaded
Definition WsfSimulation.hpp:576
void SetFlexibleRealtime()
Definition WsfSimulation.hpp:404
double GetSimTime() const
Get the last time to which the simulation was updated.
Definition WsfSimulation.hpp:265
CompletionReason
An enumerated type specifying the reason for completion of the simulation.
Definition WsfSimulation.hpp:125
@ cNONE
No reason; the simulation is not in a PENDING_COMPLETE or COMPLETE state.
Definition WsfSimulation.hpp:126
@ cTERMINATE
A terminate was commanded through a call to WsfSimulation::Terminate.
Definition WsfSimulation.hpp:129
@ cRESET
A reset was commanded through a call to WsfSimulation::Reset.
Definition WsfSimulation.hpp:128
@ cOTHER
Other reason that can be used by derived classes.
Definition WsfSimulation.hpp:130
@ cEND_TIME_REACHED
The simulation has reached the specified end time.
Definition WsfSimulation.hpp:127
WsfDisObserver & GetDisObserver() const
Definition WsfSimulation.hpp:411
bool mIsRealTime
Definition WsfSimulation.hpp:583
WsfEM_Manager mEM_Manager
EM manager.
Definition WsfSimulation.hpp:527
double mSimTime
The last time to which the simulation has been updated (seconds).
Definition WsfSimulation.hpp:543
unsigned int mRunNumber
The current run number being executed.
Definition WsfSimulation.hpp:570
WsfSensorObserver & GetSensorObserver() const
Definition WsfSimulation.hpp:419
WsfTrackObserver & GetTrackObserver() const
Definition WsfSimulation.hpp:422
double GetEndTime() const
Get the defined end time of the simulation.
Definition WsfSimulation.hpp:268
bool MultiThreaded() const
Return whether the simulation should multi-thread were appropriate.
Definition WsfSimulation.hpp:471
virtual void Complete(double aSimTime)
Definition WsfSimulation.cpp:832
WsfGroupManager & GetGroupManager()
Definition WsfSimulation.hpp:449
double GetTimeBehind() const
Definition WsfSimulation.hpp:288
WsfScriptContext & GetScriptContext()
Definition WsfSimulation.hpp:453
double mMinimumMoverTimestep
Definition WsfSimulation.hpp:578
bool IsActive() const
Definition WsfSimulation.hpp:242
WsfMoverObserver & GetMoverObserver() const
Definition WsfSimulation.hpp:414
const WsfScriptContext & GetScriptContext() const
Definition WsfSimulation.hpp:454
WsfSimulation(const WsfSimulation &aSrc)=delete
bool IsFlexibleRealtime() const
Return 'true' if the simulation's real-time constraint is flexible.
Definition WsfSimulation.hpp:402
bool IsEventStepSimulation() const
Return event step simulation indicator.
Definition WsfSimulation.hpp:313
const WsfScenario & GetScenario() const
Definition WsfSimulation.hpp:176
bool IsExternallyStarted() const
Return whether the simulation is to be started by an external source.
Definition WsfSimulation.hpp:304
WsfEventManager mWallEventManager
Wall clock-based event manager object.
Definition WsfSimulation.hpp:533
WsfFuelObserver & GetFuelObserver() const
Definition WsfSimulation.hpp:413
virtual bool TurnPartOnP(double aSimTime, WsfPlatformPart *aPartPtr)
Definition WsfSimulation.cpp:1363
virtual void SimulationStarting()
Deprecated form of Start();.
Definition WsfSimulation.hpp:396
WsfBehaviorObserver & GetBehaviorObserver() const
Definition WsfSimulation.hpp:409
double mTimeBehind
The amount of time the simulation clock is behind the real-time clock.
Definition WsfSimulation.hpp:550
virtual bool SetPartOperational(double aSimTime, WsfPlatformPart *aPartPtr, bool aOperational=true)
Definition WsfSimulation.hpp:376
virtual void SetRealtime(double aSimTime, bool aIsRealTime)
Instructs the simulation to run in a real-time mode.
Definition WsfSimulation.hpp:299
volatile State mState
The current state of the simulation.
Definition WsfSimulation.hpp:561
WsfPlatformPartObserver & GetPlatformPartObserver() const
Definition WsfSimulation.hpp:416
WsfRealTimeClockSource * mRealTimeClockSourcePtr
Definition WsfSimulation.hpp:540
const WsfDateTime & GetDateTime() const
Definition WsfSimulation.hpp:448
void SetMultiThreadingActive(bool aMultiThreadingActive)
Set whether multi-threading is currently active ('true') or not ('false').
Definition WsfSimulation.hpp:310
double GetMinimumMoverTimestep() const
Definition WsfSimulation.hpp:481
virtual bool TurnPartOffP(double aSimTime, WsfPlatformPart *aPartPtr)
Definition WsfSimulation.cpp:1347
State GetState() const
Return the simulation's current state.
Definition WsfSimulation.hpp:245
WsfAdvancedBehaviorObserver & GetAdvancedBehaviorObserver() const
Definition WsfSimulation.hpp:408
double mTimestep
Definition WsfSimulation.hpp:555
WsfTaskObserver & GetTaskObserver() const
Definition WsfSimulation.hpp:421
WsfZoneAttenuation & GetZoneAttenuation()
Definition WsfSimulation.hpp:456
WsfEventManager mEventManager
Simulation event manager object.
Definition WsfSimulation.hpp:530
bool mExternalEventReady
True if an external event needs to be processed.
Definition WsfSimulation.hpp:567
WsfPlatformObserver & GetPlatformObserver() const
Definition WsfSimulation.hpp:415
UtScriptExecutor & GetScriptExecutor()
Definition WsfSimulation.hpp:458
WsfDateTime mDateTime
Definition WsfSimulation.hpp:574
bool MultiThreadingActive() const
Return whether the simulation multi-threading is currently active.
Definition WsfSimulation.hpp:307
unsigned int NextEngagementSerialNumber()
Definition WsfSimulation.hpp:465
virtual void Start()
Definition WsfSimulation.cpp:889
double GetTimestep() const
Definition WsfSimulation.hpp:292
void ReclaimPreviousEngagementSerialNumber()
Definition WsfSimulation.hpp:467
WsfSimulation & operator=(const WsfSimulation &aRhs)=delete
virtual void AddEvent(std::unique_ptr< WsfEvent > aEventPtr)
Definition WsfSimulation.cpp:162
WsfProcessorObserver & GetProcessorObserver() const
Definition WsfSimulation.hpp:417
WsfDateTime & GetDateTime()
Definition WsfSimulation.hpp:447
const WsfClockSource * GetClockSource() const
Definition WsfSimulation.hpp:321
bool IsRealTime() const
Return whether this simulation is running real-time, or a multiple of real-time.
Definition WsfSimulation.hpp:278
T * AddEventT(Args &&... args)
Definition WsfSimulation.hpp:188
volatile CompletionReason mCompletionReason
The reason for simulation completion.
Definition WsfSimulation.hpp:564
unsigned int NextMessageSerialNumber()
Definition WsfSimulation.hpp:464
double GetSyncTimestep() const
Definition WsfSimulation.hpp:296
virtual bool SetPartOperationalP(double aSimTime, WsfPlatformPart *aPartPtr, bool aOperational)
Definition WsfSimulation.cpp:1383
WsfSimulation(const WsfScenario &aScenario, unsigned int aRunNumber)
Definition WsfSimulation.cpp:94
CompletionReason GetCompletionReason() const
Definition WsfSimulation.hpp:255
WsfCommObserver & GetCommObserver() const
Definition WsfSimulation.hpp:410
double GetRealTime() const
Definition WsfSimulation.hpp:275
WsfLOS_Manager * GetLOS_Manager() const
Definition WsfSimulation.hpp:455
WsfSimulationObserver & GetSimulationObserver() const
Definition WsfSimulation.hpp:420
const WsfSimulationInput & mSimulationInput
Definition WsfSimulation.hpp:572
const WsfSimulationInput & GetSimulationInput() const
Definition WsfSimulation.hpp:483
double mEndTime
The end time of the simulation (seconds).
Definition WsfSimulation.hpp:581
Definition WsfSystemLog.hpp:28
Definition WsfZoneAttenuation.hpp:27
Definition WsfZone.hpp:63
Manages interface to terrain for a set of WsfTerrain objects.
Definition WsfTerrain.hpp:43
Definition WsfComm.hpp:43
Definition WsfCommNetworkManager.hpp:44
Definition WsfComm.cpp:34
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Definition WsfAdvancedBehaviorObserver.hpp:31
Definition WsfBehaviorObserver.hpp:33
Definition WsfCommObserver.hpp:125
Definition WsfDisObserver.hpp:52
Definition WsfExchangeObserver.hpp:42
Definition WsfFuelObserver.hpp:34
Definition WsfMoverObserver.hpp:52
Definition WsfPlatformObserver.hpp:71
Definition WsfPlatformPartObserver.hpp:42
Definition WsfProcessorObserver.hpp:46
Definition WsfScriptStateMachineObserver.hpp:32
Definition WsfSensorObserver.hpp:61
Definition WsfSimulationObserver.hpp:117
Definition WsfTaskObserver.hpp:38
Definition WsfTrackObserver.hpp:56
Definition WsfZoneObserver.hpp:33
Copyrights Multiple, All Rights Reserved