WSF
WsfSimulation Class Reference

The main controller for a simulation. More...

#include <WsfSimulation.hpp>

Inheritance diagram for WsfSimulation:
Collaboration diagram for WsfSimulation:

Classes

class  InitializeError
 An exception that is thrown when Initialize() fails. More...
class  StartError
 An exception that is thrown when Start() fails. More...
class  CreateError
class  AddPlatformEvent
 An internal event scheduled to add a platform at the specified time. More...

Public Types

enum  State {
  cPENDING_INITIALIZE , cINITIALIZING , cPENDING_START , cSTARTING ,
  cACTIVE , cPENDING_COMPLETE , cCOMPLETE
}
 An enumerated type specifying the state of the simulation. More...
enum  CompletionReason {
  cNONE , cEND_TIME_REACHED , cRESET , cTERMINATE ,
  cOTHER
}
 An enumerated type specifying the reason for completion of the simulation. More...

Public Member Functions

 WsfSimulation (const WsfScenario &aScenario, unsigned int aRunNumber)
virtual ~WsfSimulation ()
 WsfSimulation (const WsfSimulation &aSrc)=delete
WsfSimulationoperator= (const WsfSimulation &aRhs)=delete
const WsfScenarioGetScenario () const
WsfApplicationGetApplication () const

AddInputPlatforms

Non-public method for adding platforms as part of the standard simulation initialization routine. During runtime, platforms are added individually using the AddPlatform methods that are publicly available as part of the WsfSimulation interface.

WsfEM_Manager mEM_Manager
 EM manager.
WsfEventManager mEventManager
 Simulation event manager object.
WsfEventManager mWallEventManager
 Wall clock-based event manager object.
std::unique_ptr< WsfClockSourcemClockSourcePtr {nullptr}
 Pointer to the simulation clock source object.
WsfRealTimeClockSourcemRealTimeClockSourcePtr {nullptr}
double mSimTime {0.0}
 The last time to which the simulation has been updated (seconds).
double mRealTime {false}
double mTimeBehind {0.0}
 The amount of time the simulation clock is behind the real-time clock.
double mTimestep {0.0}
double mSyncAccumulatedTime {0.0}
 The wall clock time taken to execute the current synchronized time step.
volatile State mState {cPENDING_INITIALIZE}
 The current state of the simulation.
volatile CompletionReason mCompletionReason {cNONE}
 The reason for simulation completion.
bool mExternalEventReady {false}
 True if an external event needs to be processed.
unsigned int mRunNumber
 The current run number being executed.
const WsfSimulationInputmSimulationInput
WsfDateTime mDateTime
bool mMultiThreaded
double mMinimumMoverTimestep
double mEndTime {std::numeric_limits<double>::max()}
 The end time of the simulation (seconds).
bool mIsRealTime {false}
bool AddInputPlatforms ()
virtual bool TurnPartOffP (double aSimTime, WsfPlatformPart *aPartPtr)
virtual bool TurnPartOnP (double aSimTime, WsfPlatformPart *aPartPtr)
virtual bool SetPartOperationalP (double aSimTime, WsfPlatformPart *aPartPtr, bool aOperational)
virtual void DispatchWallEvents ()
 Dispatch any pending wall clock events up to and including the indicated time.
virtual void DispatchSimEvents (double aSimTime)
virtual void DispatchEvents (double aSimTime)
virtual bool PlatformInitialized (double aSimTime, WsfPlatform *aNewPlatformPtr)
virtual bool PlatformIntroduced (double aSimTime, WsfPlatform *aNewPlatformPtr)
virtual bool SimulationInitialized ()
virtual void CreateClock ()
virtual bool PlatformIsAvailable (WsfPlatform *aPlatformPtr)

Simulation State and Time management

virtual void Initialize ()
virtual void PrepareSimulation ()
virtual void AddEvent (std::unique_ptr< WsfEvent > aEventPtr)
template<typename T, typename... Args>
T * AddEventT (Args &&... args)
virtual void AddWallEvent (std::unique_ptr< WsfEvent > aEventPtr)
template<typename T, typename... Args>
T * AddWallEventT (Args &&... args)
virtual double AdvanceTime ()
virtual double AdvanceTime (double aSimTime)
virtual bool ShouldExecute () const
virtual void Start ()
virtual void Pause ()
 Pause execution of the simulation.
void PauseAndRequestAdvance (double)
 Pause the execution of the simulation and request a time advance in scaled-and-stepped mode.
virtual void Resume ()
 Resume execution of the paused simulation.
virtual void Complete (double aSimTime)
virtual void RequestReset ()
virtual void WaitForAdvanceTime ()
bool IsActive () const
State GetState () const
 Return the simulation's current state.
const std::string & GetStateString () const
 Return the string representation of the simulation's current state.
CompletionReason GetCompletionReason () const
virtual std::string GetCompletionReasonString () const
virtual void RequestTermination ()
void SetEndTime (double aEndTime)
 Set the defined end time of the simulation.
double GetSimTime () const
 Get the last time to which the simulation was updated.
double GetEndTime () const
 Get the defined end time of the simulation.
virtual double GetNextEventTime () const
double GetRealTime () const
bool IsRealTime () const
 Return whether this simulation is running real-time, or a multiple of real-time.
double GetWallTime () const
 Get the current wall-clock time since simulation creation.
double GetTimeBehind () const
double GetTimestep () const
double GetSyncTimestep () const
virtual void SetRealtime (double aSimTime, bool aIsRealTime)
 Instructs the simulation to run in a real-time mode.
void SetIsExternallyStarted (bool aIsExternallyStarted)
bool IsExternallyStarted () const
 Return whether the simulation is to be started by an external source.
bool MultiThreadingActive () const
 Return whether the simulation multi-threading is currently active.
void SetMultiThreadingActive (bool aMultiThreadingActive)
 Set whether multi-threading is currently active ('true') or not ('false').
bool IsEventStepSimulation () const
 Return event step simulation indicator.
void SetAmAnEventStepSimulation (bool aFlag)
void SetClockSource (std::unique_ptr< WsfClockSource > aClockSourcePtr)
const WsfClockSourceGetClockSource () const
virtual double GetClockRate () const
 Returns the clock rate of the simulation.
virtual void SetClockRate (double aClockRate)
 Changes the clock rate of the simulation.
virtual void SetTimeParameters (int aTimeScheme, double aSimTime, double aClockRate, double aTimeStep, bool aTimeAdvance=false)
 Change the time parameters of the simulation.
static const std::string & GetStateString (State aState)
 Return the string representation of the provided simulation state.

Platform addition, deletion and query methods.

virtual bool AddPlatform (WsfPlatform *aPlatformPtr)
virtual bool AddPlatform (double aSimTime, WsfPlatform *aPlatformPtr)
virtual void DeletePlatform (double aSimTime, WsfPlatform *aPlatformPtr, bool aDeleteMemory=true)
WsfPlatformGetPlatformByIndex (size_t aIndex) const
WsfPlatformGetPlatformByName (WsfStringId aNameId) const
bool PlatformExists (size_t aIndex) const
 Returns 'true' if the platform with the specified index still exists.
WsfStringId GetPlatformNameId (size_t aIndex) const
 Return the name (ID) of a platform, even if the platform has been deleted from the simulation.
WsfStringId GetPlatformTypeId (size_t aIndex) const
 Return the type (ID) of a platform, even if the platform has been deleted from the simulation.

Platform list iteration methods

The following methods can be used to iterate over the list of known platforms. For example:

for (size_t i = 0; i < simulationPtr->GetPlatformCount(); ++i)
{
WsfPlatform* platformPtr = simulationPtr->GetPlatformEntry(i);
... blah blah blah ...
}
WsfPlatform * platformPtr
Definition WsfScriptTrackClass.cpp:507
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
size_t GetPlatformCount () const
WsfPlatformGetPlatformEntry (size_t aEntry) const

Subsystem status change methods

virtual bool TurnPartOff (double aSimTime, WsfPlatformPart *aPartPtr)
virtual bool TurnPartOn (double aSimTime, WsfPlatformPart *aPartPtr)
virtual bool SetPartOperational (double aSimTime, WsfPlatformPart *aPartPtr, bool aOperational=true)
virtual void SetPartUpdateInterval (double aSimTime, WsfPlatformPart *aPartPtr, double aUpdateInterval)

Methods that are public, but aren't part of the public interface.

virtual bool PlatformDeleted (double aSimTime, WsfPlatform *aOldPlatformPtr)
virtual void ProcessRemovePlatformEvent (double aSimTime, WsfPlatform *aPlatformPtr, bool aDeletePlatform)
 Called from RemovePlatformEvent to complete the processing of deleting a platform.
virtual void ProcessPlatformBrokenEvent (double aSimTime, WsfPlatform *aPlatformPtr)
 Call from PlatformBrokenEvent to complete the processing of the broken of a platform.

Deprecated methods.

virtual void SimulationStarting ()
 Deprecated form of Start();.
virtual void SimulationComplete (double aSimTime)
 Deprecated form of Complete();.
bool IsFlexibleRealtime () const
 Return 'true' if the simulation's real-time constraint is flexible.
void SetFlexibleRealtime ()

Observer access methods.

WsfAdvancedBehaviorObserverGetAdvancedBehaviorObserver () const
WsfBehaviorObserverGetBehaviorObserver () const
WsfCommObserverGetCommObserver () const
WsfDisObserverGetDisObserver () const
WsfExchangeObserverGetExchangeObserver () const
WsfFuelObserverGetFuelObserver () const
WsfMoverObserverGetMoverObserver () const
WsfPlatformObserverGetPlatformObserver () const
WsfPlatformPartObserverGetPlatformPartObserver () const
WsfProcessorObserverGetProcessorObserver () const
WsfScriptStateMachineObserverGetScriptStateMachineObserver () const
WsfSensorObserverGetSensorObserver () const
WsfSimulationObserverGetSimulationObserver () const
WsfTaskObserverGetTaskObserver () const
WsfTrackObserverGetTrackObserver () const
WsfZoneObserverGetZoneObserver () const

Simulation extension methods.

WsfSimulationExtensionFindExtension (const std::string &aName) const
WsfSimulationExtensionGetExtension (const std::string &aName) const
const WsfExtensionListGetExtensions () const
void RegisterExtension (const std::string &aName, std::unique_ptr< WsfSimulationExtension > aExtensionPtr)
const std::vector< std::string > & GetExtensionNames () const
unsigned int AssignUniqueId ()
 Assign the next unique identifier for WsfUniqueId.
ut::Random & GetRandom ()
ut::Random & LockRandom ()
void UnlockRandom ()
ut::Random & GetScriptRandom ()
ut::Random & LockScriptRandom ()
void UnlockScriptRandom ()
wsf::TerrainInterfaceGetTerrainInterface () const
WsfDateTimeGetDateTime ()
const WsfDateTimeGetDateTime () const
WsfGroupManagerGetGroupManager ()
wsf::comm::NetworkManagerGetCommNetworkManager () const
WsfMultiThreadManagerGetMultiThreadManager ()
WsfPathFinderListGetPathFinderList () const
WsfScriptContextGetScriptContext ()
const WsfScriptContextGetScriptContext () const
WsfLOS_ManagerGetLOS_Manager () const
WsfZoneAttenuationGetZoneAttenuation ()
WsfEM_ManagerGetEM_Manager ()
UtScriptExecutor & GetScriptExecutor ()
UtAtmosphere & GetAtmosphere () const
 Return the UtAtmosphere object used by the simulation.
WsfEnvironmentGetEnvironment () const
WsfSystemLogGetSystemLog () const
WsfIFF_ManagerGetIFF_Manager () const
unsigned int NextMessageSerialNumber ()
unsigned int NextEngagementSerialNumber ()
unsigned int PreviousEngagementSerialNumber () const
void ReclaimPreviousEngagementSerialNumber ()
double CreateMessageDataTag ()
bool MultiThreaded () const
 Return whether the simulation should multi-thread were appropriate.
unsigned int GetRunNumber () const
 Get the current run number.
unsigned int GetFinalRunNumber () const
bool RandomizeFrequency () const
bool UseDefaultFrequency () const
double GetMinimumMoverTimestep () const
const WsfSimulationInputGetSimulationInput () const
std::string SubstituteOutputFileVariables (const std::string &aOutputFile)

Platform list maintenance methods.

void AddToPlatformList (WsfPlatform *aPlatformPtr)
bool DeleteFromPlatformList (WsfPlatform *aPlatformPtr)
bool PlatformPointerExists (WsfPlatform *aPlatformPtr)
void ResetPlatformList ()
 Reset the list to its initial (empty) state.

Detailed Description

The main controller for a simulation.

The 'simulation' object acts as the main controller for a simulation. While it is possible to use the framework without a simulation object, the simulation object will almost always be required for all but the most trivial of simulations.

The simulation object provides methods to:

  • Maintain an event queue
  • Supervise the addition and deletion of platforms
  • Turn platform systems on and off in a coordinated manner.
  • Maintain simulation 'observers'

Most methods within the class are virtual so a derived class may be used to provide custom simulation functionality.

Member Enumeration Documentation

◆ CompletionReason

An enumerated type specifying the reason for completion of the simulation.

Enumerator
cNONE 

No reason; the simulation is not in a PENDING_COMPLETE or COMPLETE state.

cEND_TIME_REACHED 

The simulation has reached the specified end time.

cRESET 

A reset was commanded through a call to WsfSimulation::Reset.

cTERMINATE 

A terminate was commanded through a call to WsfSimulation::Terminate.

cOTHER 

Other reason that can be used by derived classes.

◆ State

An enumerated type specifying the state of the simulation.

Enumerator
cPENDING_INITIALIZE 

The simulation has been constructed and is ready for WsfSimulation::Initialize to be called.

cINITIALIZING 

The WsfSimulation::Initialize method is being called.

cPENDING_START 

Initialization is complete, ready for WsfSimulation::Start to be called.

cSTARTING 

The WsfSimulation::Start method is being called.

cACTIVE 

Start is complete, the simulation is in progress.

cPENDING_COMPLETE 

Simulation processing is complete; waiting on a call to WsfSimulation::Complete.

cCOMPLETE 

Simulation is complete.

Constructor & Destructor Documentation

◆ WsfSimulation() [1/2]

◆ ~WsfSimulation()

WsfSimulation::~WsfSimulation ( )
virtual

◆ WsfSimulation() [2/2]

WsfSimulation::WsfSimulation ( const WsfSimulation & aSrc)
delete

References WsfSimulation().

Member Function Documentation

◆ AddEvent()

void WsfSimulation::AddEvent ( std::unique_ptr< WsfEvent > aEventPtr)
virtual

Add an event to the simulation event queue.

Parameters
aEventPtrA pointer to the event to be queued. This classes assumes ownership of the object.

Reimplemented in WsfFrameStepSimulation.

References mEventManager.

Referenced by wsf::comm::NetworkAdHoc::AddAddressRate(), AddEventT(), AddInputPlatforms(), wsf::comm::NetworkAdHoc::AddNamedRate(), AddPlatform(), WsfBrawlerProcessor::AddSelfCalledConsciousnessEvent(), WsfScriptContext::AddTimedEvents(), WsfRouteMover::AddUnpauseEventFor(), WsfImplicitWeapon::BeginEngagement(), WsfLaserWeapon::BeginShot(), WsfJTIDS_SlotGroup::BeginTransmitEvent(), WsfImplicitWeapon::CeaseFire(), wsf::comm::NetworkAdHoc::ChangeRate(), WsfTaskManager::CheckMessageAcknowledged(), WsfImplicitWeapon::ClearEngagement(), WsfWeapon::ContinueSalvo(), WsfTaskManager::CreateDelayTask(), DeletePlatform(), WsfTrackStateController::DeleteTrack(), WsfTrackStateController::DiscoverTrack(), WsfArticulatedPart::EnableArticulationUpdates(), WsfTrackStateController::EnterState(), WsfLaserWeapon::EvaluateCooling(), WsfTrackStateController::EvaluationComplete(), WsfPlatformPartEvent::Execute(), WsfPlatform::ExecuteScriptAtTime(), WsfScriptProcessor::ExecuteScriptAtTime(), WsfExplicitWeapon::FireP(), WsfWeapon::FireSalvo(), XWsfSeaTraffic::HandleDeparture(), XWsfSeaTraffic::HandleEnterLoiter(), Tool::Initialize(), wsf::comm::NetworkAdHoc::Initialize(), WsfClusterCorrelation::Initialize(), WsfEventStepSimulation::Initialize(), WsfMobilityAndFirepowerLethality::Initialize(), WsfPerceptionProcessor::Initialize(), Initialize(), WsfTSPI_Mover::Initialize(), XWsfAirTraffic::Initialize(), XWsfSeaTraffic::SeaPort::Initialize(), WsfTrackProcessor::InitializeMemberData(), WsfMilInterface::KillPlatform(), wsf::comm::ProtocolIGMP::NetworkReceive(), wsf::coverage::Coverage::PendingStart(), wsf::comm::router::ProtocolAdHoc::PerfectCommAdded(), wsf::comm::router::ProtocolAdHoc::PerfectCommRemoved(), wsf::comm::router::ProtocolAdHoc::PerfectConnectionAdded(), wsf::comm::router::ProtocolAdHoc::PerfectConnectionRemoved(), WsfEventStepSimulation::PlatformInitialized(), WsfDisInterface::PrepareExtension(), WsfExtInterface::PrepareExtension(), WsfTrackStateController::ProcessMessage(), WsfWeapon::ProcessReloading(), WsfQuantumTaskerProcessor::ProcessTaskStatusMessage(), WsfTaskManager::ProcessTaskStatusMessage(), wsf::comm::medium::Guided::PropagateMessage(), WsfCyclicTrackReporting::ReportFusedTracks(), WsfCyclicTrackReporting::ReportRawTracks(), wsf::space::OrbitalMissionSimulationContext::Schedule(), wsf::comm::ComponentHW::ScheduleAltFreqChange(), WsfOTH_RadarSensor::OTH_Mode::ScheduleAltFreqChange(), WsfRadarSensor::RadarMode::ScheduleAltFreqChange(), wsf::comm::LayerEvent::ScheduleCommLayerEvent(), wsf::comm::Event::ScheduleDeliverMessageEvent(), wsf::space::OrbitalMissionSimulationContext::ScheduleMission(), WsfSensor::ScheduleModeChange(), WsfEventPipeInterface::SendModeActive(), WsfDisPlatform::SendOrQueueEmissionsPDU(), WsfTaskManager::SendTaskMessage(), wsf::comm::medium::Medium::SetActiveModeDelayed(), wsf::comm::medium::Medium::SetActiveModeDelayed(), WsfPerceptionProcessor::SetAssetUpdateInterval(), WsfWaypointMover::SetCompleteTime(), WsfPlatformPart::SetDamageFactor(), SetEndTime(), WsfEventStepSimulation::SetPartUpdateInterval(), WsfPerceptionProcessor::SetThreatUpdateInterval(), SetTimeParameters(), wsf::UCI_SensorComponent::SlewComplete(), WsfTimeDelayQueue::SubmitRequest(), WsfWeaponTaskManager::TaskCorrelated(), WsfWeaponEngagement::Terminate(), wsf::comm::medium::Guided::TransmitMessage(), wsf::comm::medium::Unguided::TransmitMessage(), WsfDisPlatform::TrySendCMEData(), WsfEventStepSimulation::TurnPartOff(), WsfEventStepSimulation::TurnPartOn(), wsf::comm::NetworkAdHoc::Update(), wsf::comm::NetworkAdHoc::Update(), wsf::comm::NetworkAdHoc::Update(), XWsfAirTraffic::UpdateFlightStatus(), WsfL16::Interface_J11::WeaponFired(), and WsfWeaponTaskManager::WeaponFired().

◆ AddEventT()

template<typename T, typename... Args>
T * WsfSimulation::AddEventT ( Args &&... args)
inline

References AddEvent().

◆ AddInputPlatforms()

bool WsfSimulation::AddInputPlatforms ( )
protected

Adds platforms to the simulation in a phase-stepped manner. This is only used by the simulation during initialization of platforms. Any addition of platforms outside of this process is done on a platform-by-platform basis using the standard AddPlatform call.

References AddEvent(), AddToPlatformList(), WsfPlatform::Clone(), WsfScriptContext::ExecuteScript(), WsfScriptContext::FindScript(), WsfScriptContext::GetClass(), GetExtension(), GetPlatformByName(), GetScriptContext(), ok, WsfObserver::PlatformAdded(), WsfObserver::PlatformInitialized(), PlatformInitialized(), PlatformIsAvailable(), WsfObserver::PlatformOmitted(), PlatformPointerExists(), platformPtr, WsfSimulationExtension::PlatformsInitialized(), and WsfScriptContext::ValidateScript().

Referenced by Initialize().

◆ AddPlatform() [1/2]

bool WsfSimulation::AddPlatform ( double aSimTime,
WsfPlatform * aPlatformPtr )
virtual

Add a platform to an active simulation.

This method should be used to add platforms to a simulation that is running.

It is an error to invoke this before WsfSimulation::Initialize has been called.

Parameters
aSimTimeThe time at which to add the platform to the simulation.
aPlatformPtrPointer to the platform to be added. This class assumes ownership of the platform.
Returns
'true' if the platform was added or 'false' if an not.
Note
If aSimTime is less than the current simulation time, it will be clamped to the current simulation time. If aSimTime is greater than the current simulation time, it will be scheduled to be added to the simulation at that future time.

Reimplemented in WsfFrameStepSimulation.

References AddEvent(), AddToPlatformList(), cINITIALIZING, DeleteFromPlatformList(), WsfPlatform::GetIndex(), WsfObject::GetName(), WsfObject::GetNameId(), GetPlatformByName(), GetPlatformCount(), GetPlatformEntry(), GetSimTime(), WsfPlatform::Initialize(), WsfPlatform::Initialize2(), WsfPlatform::IsExternallyControlled(), mState, ok, WsfObserver::PlatformAdded(), WsfObserver::PlatformDeleted(), WsfPlatform::PlatformDeleted(), WsfObserver::PlatformInitialized(), PlatformInitialized(), PlatformPointerExists(), WsfPlatform::SetDeleted(), and simTime.

◆ AddPlatform() [2/2]

bool WsfSimulation::AddPlatform ( WsfPlatform * aPlatformPtr)
virtual

Add a platform to an active simulation.

This method should be used to add platforms to a simulation that is running.

It is an error to invoke this before WsfSimulation::Initialize has been called.

Parameters
aPlatformPtrPointer to the platform to be added. This class assumes ownership of the platform.
Returns
'true' if the platform was added or 'false' if an not.

Reimplemented in WsfFrameStepSimulation.

References AddPlatform(), and GetSimTime().

Referenced by WsfFrameStepSimulation::AddPlatform(), WsfFrameStepSimulation::AddPlatform(), AddPlatform(), engage::Platform::AddToSimulation(), WsfP6DOF_Mover::CheckForNewlyJettisonedPlatforms(), Sensor::CreateAndInitialize(), Target::CreateAndInitialize(), HorizontalMapFunction::Execute(), WsfSimulation::AddPlatformEvent::Execute(), Tool::Initialize(), and wsf::coverage::RectangularGrid::PreparePlatforms().

◆ AddToPlatformList()

void WsfSimulation::AddToPlatformList ( WsfPlatform * aPlatformPtr)
protected

Add a platform to the list of platforms.

It is assumed the caller has already verified the platform does not exist in the list.

Parameters
aPlatformPtrPointer to the platform to be added.

References WsfPlatform::GetIndex(), WsfObject::GetNameId(), WsfObject::GetTypeId(), and WsfPlatform::SetIndex().

Referenced by AddInputPlatforms(), and AddPlatform().

◆ AddWallEvent()

void WsfSimulation::AddWallEvent ( std::unique_ptr< WsfEvent > aEventPtr)
virtual

Add an event to the real-world event queue. Event will be triggered based on WallClock time, rather than simulation time, and will not pause if the simulation pauses. This should be used for Simulation Management events, not simulated events.

Parameters
aEventPtrA pointer to the event to be queued. This class assumes ownership of the object.

References mWallEventManager.

Referenced by AddWallEventT(), and WsfDisInterface::SimulationPausing().

◆ AddWallEventT()

template<typename T, typename... Args>
T * WsfSimulation::AddWallEventT ( Args &&... args)
inline

References AddWallEvent().

◆ AdvanceTime() [1/2]

double WsfSimulation::AdvanceTime ( )
virtual

◆ AdvanceTime() [2/2]

double WsfSimulation::AdvanceTime ( double aSimTime)
virtual

Dispatch the next event if its time is less than or equal to the specified time.

Parameters
aSimTimeDesired simulation time.
Returns
If an event was dispatched then the time of the event, otherwise 'aSimTime'.

Reimplemented in WsfFrameStepSimulation.

References WsfObserver::AdvanceTime(), cPENDING_COMPLETE, DispatchEvents(), GetEndTime(), WsfEvent::GetTime(), mClockSourcePtr, mEventManager, mSimTime, and mState.

◆ AssignUniqueId()

unsigned int WsfSimulation::AssignUniqueId ( )

Assign the next unique identifier for WsfUniqueId.

Referenced by WsfUniqueId::AssignUniqueId().

◆ Complete()

void WsfSimulation::Complete ( double aSimTime)
virtual

Indicate that the application has completed its simulation loop.

This performs the following action (in the order specified):

  • Marks the simulation as complete.
  • Stops the clock.
  • Invokes SimulationComplete for each registered simulation observer.
  • Deletes all remaining platforms.
  • Deletes all remaining events in the event queue
  • Invokes the Complete method for each registered simulation extension.
  • Resets the clock back to 0.0
Parameters
aSimTimeThe current simulation time.

Reimplemented in WsfEventStepSimulation, and WsfFrameStepSimulation.

References cACTIVE, cCOMPLETE, cEND_TIME_REACHED, cNONE, WsfSimulationExtension::Complete(), cPENDING_COMPLETE, GetExtension(), GetPlatformCount(), GetPlatformEntry(), mClockSourcePtr, mCompletionReason, mEndTime, mEventManager, mSimTime, mState, ProcessRemovePlatformEvent(), ResetPlatformList(), and WsfObserver::SimulationComplete().

Referenced by WsfEventStepSimulation::Complete(), WsfFrameStepSimulation::Complete(), WsfStandardApplication::RunEventLoop(), and SimulationComplete().

◆ CreateClock()

void WsfSimulation::CreateClock ( )
protectedvirtual

This is a method used to create the type of clock the simulation expects.

Note
See WsfEventStepSimulation for a non-trivial implementation.

Reimplemented in WsfEventStepSimulation, and WsfFrameStepSimulation.

References SetClockSource().

Referenced by Initialize().

◆ CreateMessageDataTag()

double WsfSimulation::CreateMessageDataTag ( )

◆ DeleteFromPlatformList()

bool WsfSimulation::DeleteFromPlatformList ( WsfPlatform * aPlatformPtr)
protected

Delete a platform pointer from the list of platforms.

This only deletes the pointer from the list. It does not delete the platform.

Returns
'true' if the platform was successfully removed from the list or 'false' if it did not exist in the list.

References WsfPlatform::GetIndex(), and WsfObject::GetNameId().

Referenced by AddPlatform(), and PlatformDeleted().

◆ DeletePlatform()

void WsfSimulation::DeletePlatform ( double aSimTime,
WsfPlatform * aPlatformPtr,
bool aDeleteMemory = true )
virtual

Delete a platform from the simulation

Parameters
aSimTimeCurrent simulation time
aPlatformPtrPointer to platform to be deleted
aDeleteMemoryIf true (default), platform's memory will be cleaned up. Otherwise, platform is simply removed from the simulation and ownership of platform is released.

A platform cannot be deleted directly because the caller may be something on the platform itself (such as a mover). In such a case the platform pointer must remain valid until the active event completes. To get around this, we schedule this event for the current simulation time. This allows the current event to complete and causes the platform to actually get deleted when this event is dispatched.

Reimplemented in WsfFrameStepSimulation.

References AddEvent(), WsfPlatform::GetIndex(), WsfPlatform::IsDeleted(), WsfPlatform::NotifyDeleting(), PlatformExists(), ProcessRemovePlatformEvent(), and WsfPlatform::SetDeleted().

Referenced by WsfWeaponTaskManager::AbortFiring(), WsfExplicitWeapon::AddWeaponToSimulation(), WsfTowedMover::CleanUpStowedAsset(), WsfAirMover::CrashIntoGround(), WsfP6DOF_Mover::CrashIntoGroundCB(), WsfBrawlerMover::DeleteMover(), WsfFrameStepSimulation::DeletePlatform(), WsfMilInterface::KillPlatform(), ATG_LAR_And_LC_Generator::LARGenUpdate(), SAM_LaunchComputerGenerator::LCGenUpdate(), WsfTowedMover::OnPlatformDeleted(), WsfGuidedMoverBase::PrelaunchAdvanceTime(), WsfWeaponFuse::PrivateDetonate(), WsfDisRemoveEntity::Process(), WsfWeaponServer::ProcessCommand(), WsfPlatformPart::SetDamageFactor(), WsfDisPlatform::SetEntityState(), WsfDisWeaponEvents::TransferPlatformToInternalControl(), ATA_LaunchComputerGenerator::Update(), Fires::FiresMover::Update(), WsfChaffMover::Update(), WsfDisMover::Update(), WsfGuidedMoverBase::Update(), WsfOffsetMover::Update(), WsfTSPI_Mover::Update(), XWsfAirTraffic::UpdateFlightStatus(), and UT_DEFINE_SCRIPT_METHOD().

◆ DispatchEvents()

void WsfSimulation::DispatchEvents ( double aSimTime)
protectedvirtual

Dispatch any pending events up to and including the indicated time.

Parameters
aSimTimeAll events whose time is less than or equal to this value will be dispatched.

References DispatchSimEvents(), and DispatchWallEvents().

Referenced by AdvanceTime(), and AdvanceTime().

◆ DispatchSimEvents()

void WsfSimulation::DispatchSimEvents ( double aSimTime)
protectedvirtual

Dispatch any pending events up to and including the indicated time.

Parameters
aSimTimeAll events whose time is less than or equal to this value will be dispatched.

References mEventManager.

Referenced by DispatchEvents().

◆ DispatchWallEvents()

void WsfSimulation::DispatchWallEvents ( )
protectedvirtual

Dispatch any pending wall clock events up to and including the indicated time.

References mWallEventManager.

Referenced by DispatchEvents().

◆ FindExtension()

◆ GetAdvancedBehaviorObserver()

WsfAdvancedBehaviorObserver & WsfSimulation::GetAdvancedBehaviorObserver ( ) const
inline

◆ GetApplication()

WsfApplication & WsfSimulation::GetApplication ( ) const

◆ GetAtmosphere()

UtAtmosphere & WsfSimulation::GetAtmosphere ( ) const

Return the UtAtmosphere object used by the simulation.

Referenced by WsfSA_Processor::CalculateObservables(), and WsfSA_Processor::UpdateFlightKinematicsData().

◆ GetBehaviorObserver()

WsfBehaviorObserver & WsfSimulation::GetBehaviorObserver ( ) const
inline

◆ GetClockRate()

double WsfSimulation::GetClockRate ( ) const
virtual

◆ GetClockSource()

const WsfClockSource * WsfSimulation::GetClockSource ( ) const
inline

Return the current clock source object.

Returns
Pointer to the current clock source object.

References mClockSourcePtr.

Referenced by WsfDisSetDataR::PopulateResponse(), SetTimeParameters(), WsfXIO_SimTimeService::UpdateEvent::UpdateEvent(), and WsfXIO_TimeSynchronization::WsfXIO_TimeSynchronization().

◆ GetCommNetworkManager()

wsf::comm::NetworkManager * WsfSimulation::GetCommNetworkManager ( ) const
inline

Referenced by wsf::comm::router::Router::AddInterface(), wsf::comm::NetworkGeneric::AddLinkP(), wsf::comm::NetworkDirectedRing::AddMemberP(), wsf::comm::NetworkMesh::AddMemberP(), wsf::comm::NetworkMeshLegacy::AddMemberP(), wsf::comm::NetworkPointToPoint::AddMemberP(), wsf::comm::NetworkRing::AddMemberP(), wsf::comm::NetworkStar::AddMemberP(), wsf::comm::router::OSPF_Area::ElectionDR(), wsf::comm::medium::Guided::EndPropagation(), wsf::comm::medium::Unguided::EndPropagation(), wsf::comm::medium::Guided::EndTransmission(), wsf::comm::medium::Unguided::EndTransmission(), wsf::comm::IGMP_SubscriptionEvent::Execute(), wsf::comm::router::ProtocolOSPF::GetGraph(), getLinkedAndReachablePlatformParts(), wsf::comm::ProtocolIGMP::GetQuerier(), wsf::comm::Comm::Initialize(), wsf::comm::router::ProtocolLegacy::Initialize(), wsf::comm::router::ProtocolMulticast::Initialize(), wsf::comm::router::Router::Initialize(), wsf::comm::router::OSPF_Area::InitializeCallbacks(), wsf::comm::Network::InitializeLinkage(), wsf::comm::NetworkDirectedRing::InitializeLinkageP(), wsf::comm::NetworkRing::InitializeLinkageP(), wsf::comm::router::ProtocolAdHoc::InitializeState(), wsf::comm::ProtocolIGMP::JoinGroup(), wsf::comm::ProtocolIGMP::LeaveGroup(), WsfMessageProcessor::Selector::Matches(), wsf::comm::ProtocolIGMP::PhysicalReceive(), WsfJTIDS_Terminal::PrintDebugReception(), wsf::comm::NetworkLayer::ProcessLayerMessage(), WsfUplinkProcessor::ProcessMessage(), wsf::comm::router::ProtocolOSPF::ReceiveDR_GraphAdd(), wsf::comm::router::ProtocolOSPF::ReceiveDR_GraphDrop(), wsf::comm::router::ProtocolOSPF::ReceiveHello(), WsfRIPRProcessor::ReceiveMessage(), wsf::comm::NetworkStar::RemoveHub(), wsf::comm::router::Router::RemoveInterface(), wsf::comm::NetworkGeneric::RemoveLinkP(), wsf::comm::NetworkDirectedRing::RemoveMemberP(), wsf::comm::NetworkMesh::RemoveMemberP(), wsf::comm::NetworkPointToPoint::RemoveMemberP(), wsf::comm::NetworkRing::RemoveMemberP(), wsf::comm::NetworkStar::RemoveMemberP(), wsf::comm::router::ProtocolOSPF::RouteFromBackbone(), wsf::comm::router::ProtocolOSPF::RouteToBackbone(), wsf::comm::router::ProtocolOSPF::Routing(), wsf::comm::PhysicalLayer::Send(), wsf::comm::router::ProtocolMulticast::Send(), wsf::comm::SlotGroupLayerJTIDS::Send(), wsf::comm::router::ProtocolOSPF::SendDR_GraphAdd(), wsf::comm::router::ProtocolOSPF::SendDR_GraphDrop(), WsfL16::ComputerPart::SendJMessage(), wsf::ExternalLinks::SendMessage(), WsfBMDisseminateC2::SendMessage(), WsfRIPRJob::SendMessageBidJob(), WsfRIPRProcessor::SendMessageJobAward(), WsfRIPRJob::SendMessageSetProgress(), WsfRIPRJob::SendMessageUnbidJob(), WsfTaskManager::SendTaskMessage(), wsf::comm::ProtocolIGMP::Setup(), wsf::comm::router::ProtocolLegacy::Setup(), wsf::comm::router::ProtocolMulticast::Setup(), wsf::comm::router::ProtocolOSPF::Setup(), wsf::comm::medium::Guided::TransmitMessage(), wsf::comm::medium::Unguided::TransmitMessage(), wsf::comm::NetworkAdHoc::Update(), wsf::comm::NetworkAdHoc::Update(), wsf::comm::NetworkAdHoc::Update(), WsfUplinkProcessor::UplinkTrack(), wsf::comm::UT_DEFINE_SCRIPT_METHOD(), wsf::comm::UT_DEFINE_SCRIPT_METHOD(), wsf::comm::UT_DEFINE_SCRIPT_METHOD(), wsf::comm::UT_DEFINE_SCRIPT_METHOD(), wsf::comm::UT_DEFINE_SCRIPT_METHOD(), wsf::comm::UT_DEFINE_SCRIPT_METHOD(), wsf::comm::UT_DEFINE_SCRIPT_METHOD(), wsf::comm::UT_DEFINE_SCRIPT_METHOD(), wsf::comm::Comm::ValidateGateway(), wsf::comm::router::ProtocolAdHoc::ValidNetwork(), and WsfMessage::WsfMessage().

◆ GetCommObserver()

◆ GetCompletionReason()

CompletionReason WsfSimulation::GetCompletionReason ( ) const
inline

Return the simulation's reason for completion. If the simulation has not actually completed, the returned value will be cNONE

References mCompletionReason.

Referenced by WsfStandardApplication::RunEventLoop().

◆ GetCompletionReasonString()

std::string WsfSimulation::GetCompletionReasonString ( ) const
virtual

Return the string representation of the simulation's reason for completion. If the simulation has not actually completed, the returned value will be "NONE".

References cEND_TIME_REACHED, cNONE, cRESET, cTERMINATE, and mCompletionReason.

Referenced by WsfStandardApplication::RunEventLoop().

◆ GetDateTime() [1/2]

◆ GetDateTime() [2/2]

const WsfDateTime & WsfSimulation::GetDateTime ( ) const
inline

References mDateTime.

◆ GetDisObserver()

WsfDisObserver & WsfSimulation::GetDisObserver ( ) const
inline

◆ GetEM_Manager()

WsfEM_Manager & WsfSimulation::GetEM_Manager ( )
inline

References mEM_Manager.

Referenced by WsfEM_XmtrRcvr::GetEM_Manager().

◆ GetEndTime()

double WsfSimulation::GetEndTime ( ) const
inline

◆ GetEnvironment()

◆ GetExchangeObserver()

WsfExchangeObserver & WsfSimulation::GetExchangeObserver ( ) const
inline

◆ GetExtension()

◆ GetExtensionNames()

const std::vector< std::string > & WsfSimulation::GetExtensionNames ( ) const

◆ GetExtensions()

const WsfExtensionList & WsfSimulation::GetExtensions ( ) const
inline

◆ GetFinalRunNumber()

unsigned int WsfSimulation::GetFinalRunNumber ( ) const

◆ GetFuelObserver()

WsfFuelObserver & WsfSimulation::GetFuelObserver ( ) const
inline

◆ GetGroupManager()

WsfGroupManager & WsfSimulation::GetGroupManager ( )
inline

◆ GetIFF_Manager()

WsfIFF_Manager * WsfSimulation::GetIFF_Manager ( ) const

◆ GetLOS_Manager()

WsfLOS_Manager * WsfSimulation::GetLOS_Manager ( ) const
inline

◆ GetMinimumMoverTimestep()

double WsfSimulation::GetMinimumMoverTimestep ( ) const
inline

References mMinimumMoverTimestep.

◆ GetMoverObserver()

WsfMoverObserver & WsfSimulation::GetMoverObserver ( ) const
inline

◆ GetMultiThreadManager()

◆ GetNextEventTime()

double WsfSimulation::GetNextEventTime ( ) const
virtual

Return the time of the next event in the event queue. If there is no event, the current simulation time is returned.

References WsfEvent::GetTime(), mEventManager, and mSimTime.

◆ GetPathFinderList()

WsfPathFinderList & WsfSimulation::GetPathFinderList ( ) const
inline

Referenced by WsfSimulation().

◆ GetPlatformByIndex()

WsfPlatform * WsfSimulation::GetPlatformByIndex ( size_t aIndex) const

Return the pointer to the platform given its unique platform index. The return value is 0 if the platform does not exist.

Referenced by WsfWeaponTaskManager::AbortFiring(), WsfRIPRProcessor::ActiveWeaponPlatform(), WsfQuantumTaskerProcessor::AssignTask(), WsfTaskManager::AssignTask(), WsfWeaponTaskManager::AssignTask(), WsfCTD_SensorComponent::AttemptToDetect(), WsfBMUtils::BelievedAlive(), WsfSA_Assess::CalculatePrioritizedTargets(), WsfSA_Assess::CalculatePrioritizedThreats(), WsfXIO_ScriptService::CheckParams(), WsfExchangeProcessor::ClosestPossibleProvider(), WsfBallisticMissileLaunchComputer::ComputeLateralTargetOffset(), WsfDisVisualization::Connected(), MTT_PerceivedCluster::CopyFrom(), WsfTruthCorrelation::CorrelateImpl(), WsfSA_Perceive::CreateAssetsList(), WsfSA_Perceive::CreateBanditsList(), WsfSA_Processor::DebugTestOutput(), WsfDisWeaponEvents::DirectedEnergyWeaponFired(), WsfDisWeaponEvents::DirectedEnergyWeaponHit(), WsfEclipseEventManager::Enable(), WsfTrackStateController::EnterState(), WsfBallisticMissileLaunchComputer::EstimatedTimeToIntercept(), WsfTabularLaunchComputer::EstimatedTimeToIntercept(), wsf::comm::ComponentHW::AltFrequencyChangeEvent::Execute(), wsf::comm::Event::Execute(), wsf::comm::LayerEvent::Execute(), WsfArticulatedPartEvent::Execute(), WsfBrawlerConsicousnessEvent::Execute(), WsfImplicitWeapon::TerminateEngagementEvent::Execute(), WsfMoverUpdateEvent::Execute(), WsfPerceptionProcessorUpdateEvent::Execute(), WsfScriptEvent::Execute(), WsfSensor::ModeChangeEvent::Execute(), WsfSensorMode::AltFrequencyChangeEvent::Execute(), WsfWeapon::SalvoEvent::Execute(), WsfTrackStateController::ExitState(), WsfSA_Assess::ExpectedDetectionRangeAgainstTarget(), WsfSA_Assess::ExpectedDetectionRangeByTarget(), WsfSA_Assess::ExpectedNormalizedDetectionRangeAgainstTarget(), WsfSA_Assess::ExpectedNormalizedWezRangeAgainstTarget(), WsfXIO_TaskService::FindTaskProcessor(), WsfBMUtils::GetAssignedPlatformFromAssignedIDRecord(), WsfTaskCancelMessage::GetAssignee(), WsfTaskControlMessage::GetAssignee(), WsfTaskStatusMessage::GetAssignee(), WsfTaskCancelMessage::GetAssigner(), WsfTaskControlMessage::GetAssigner(), WsfTaskStatusMessage::GetAssigner(), WsfWeaponEngagement::GetFiringPlatform(), WsfWeaponEngagement::GetMissDistance(), WsfStatusMessage::GetPlatform(), WsfBMUtils::GetPlatformFromUnitID(), WsfBMUtils::GetPlatformFromUnitIDRecord(), WsfZoneDefinition::GetReferencePlatform(), WsfAssociationMessage::GetSensorPlatform(), WsfBMUtils::GetTarget(), WsfLaserDesignations::Spot::GetTargetAdjustedLocationWCS(), wsf::event::utils::GetTargetName(), wsf::event::utilsCSV::GetTargetName(), WsfWeaponEngagement::GetTargetPlatform(), WsfOrbitalManeuver::GetTargetPropagatorPerception(), WsfBMUtils::GetUnitIDRecordFromPlatformIndex(), WsfWeaponEngagement::GetWeaponPlatform(), WsfEventPipeInterface::HandleScheduledEntityStateRequest(), WsfWeaponEngagement::Initialize(), WsfGuidedMoverBase::Initialize2(), WsfThreatProcessor::IsThreatening(), WsfRIPRProcessor::IsUplinkingTo(), WsfMilInterface::KillPlatform(), ATG_LAR_And_LC_Generator::LARGenUpdate(), SAM_LaunchComputerGenerator::LCGenUpdate(), WsfLaserDesignations::Spot::LocalUpdate(), WsfEOIR_Sensor::NotifyObservers(), WsfExchange::Transactor::OppositePlatformName(), WsfExchange::Transactor::OwningPlatformName(), WsfEventPipeInterface::PackTrack(), WsfTaskManager::PendingMessage::PendingMessage(), WsfLaserDesignator::PerformScheduledDetections(), WsfOTH_RadarSensor::PerformScheduledDetections(), WsfRadarSensor::PerformScheduledDetections(), WsfSensor::PerformScheduledDetections(), WsfBeamDirector::WsfBeamDirectorMode::PointAtTargetUpdate(), WsfZoneDefinition::PointIsInside(), WsfGuidedMoverBase::PrelaunchAdvanceTime(), wsf::event::ExchangeCompleted::Print(), wsf::event::ExchangeNegotiated::Print(), wsf::event::ExchangeQueried::Print(), wsf::event::ExchangeRequestFailed::Print(), wsf::event::ExchangeCompleted::PrintCSV(), wsf::event::ExchangeNegotiated::PrintCSV(), wsf::event::ExchangeQueried::PrintCSV(), wsf::event::ExchangeRequestFailed::PrintCSV(), wsf::event::utils::PrintTrackData(), wsf::event::utilsCSV::PrintTrackData(), wsf::event::utils::PrintWE_PlayerData(), wsf::event::utilsCSV::PrintWE_PlayerData(), WsfWeaponFuse::PrivateDetonate(), WsfWeaponServer::ProcessCommand(), WsfSA_Perceive::ProcessMessage(), WsfTrackProcessor::ProcessMessage(), WsfWeaponTaskManager::ProcessTaskStatusMessage(), WsfDefaultHEL::Propagate(), WsfQuantumTaskerProcessor::RejectTask(), WsfExchange::Transactor::RequestorPlatformName(), WsfExchange::Transactor::ResponderPlatformName(), WsfWeaponTaskManager::RoundsFiredAt(), WsfRouteFinder::Route(), WsfWeaponTaskManager::SalvosFiredAt(), wsf::comm::util::SelectRecipients(), WsfDefaultSensorScheduler::SelectTarget(), WsfPhysicalScanSensorScheduler::SelectTarget(), WsfSectorScanSensorScheduler::SelectTarget(), WsfSpinSensorScheduler::SelectTarget(), WsfTaskManager::SendTaskMessage(), WsfAccessReport::SensorDetectionChangedHandler(), WsfLaserDesignations::Spot::SetDesignatedIndex(), WsfExchangeProcessor::SetSupplierAbility(), WsfPerfectTracker::SetTargetByIndex(), WsfRIPRProcessor::StartUplinking(), WsfUplinkProcessor::StartUplinking(), WsfRIPRProcessor::StopUplinking(), WsfUplinkProcessor::StopUplinking(), WsfRIPRProcessor::TargetPlatform(), WsfWeaponEffects::Terminate(), WsfWeaponTaskManager::TimeWeaponLastFiredFor(), WsfWeaponTaskManager::TimeWeaponLastTerminatedFor(), WsfCTD_SensorComponent::TrackerAllowTracking(), ATA_LaunchComputerGenerator::Update(), TargetMover::Update(), WsfEOIR_Sensor::Update(), WsfLaserTracker::Update(), WsfPerfectTracker::Update(), WsfQuantumTaskerProcessor::Update(), WsfShadowMover::Update(), WsfStraightLineMover::Update(), WsfHighEnergyLaser::UpdateEngagementGeometry(), WsfSA_Assess::UpdateEngagementsData(), WsfMilDisPlatform::UpdateJammerSystem(), WsfOrbitDeterminationFusion::UpdateLocalTrackFromNonLocalTrack(), WsfEventPipeInterface::UpdatePartArticulation(), WsfSA_Perceive::UpdatePerceivedItemsCalculation(), WsfZoneDefinition::UpdateReference(), WsfLOS_Manager::UpdateStateData(), WsfLocalTrackStatus::UpdateTargetName(), WsfGuidanceComputer::UpdateTargetPerception(), WsfP6DOF_GuidanceComputer::UpdateTargetPerception(), WsfWeaponFuse::UpdateTargetState(), WsfWeaponTrackProcessor::UpdateTargetTrack(), WsfSA_Processor::UpdateTrackData(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), WsfWeaponTaskManager::WeaponFired(), WsfWeaponTaskManager::WeaponsActiveFor(), WsfRIPRProcessor::WeaponsIncoming(), WsfL16::Interface_J11::WeaponTerminated(), and WsfWeaponEngagement::WsfWeaponEngagement().

◆ GetPlatformByName()

WsfPlatform * WsfSimulation::GetPlatformByName ( WsfStringId aNameId) const

Return a pointer to a platform given the string ID of the platform name.

Returns
A pointer to the platform or 0 if the platform does not exist.

References platformPtr.

Referenced by AddInputPlatforms(), AddPlatform(), WsfSensorProcessor::AddSensor(), WsfFusionCenter::AdjustTrackQuantities(), WsfImplicitWeapon::BeginEngagement(), wsf::coverage::Grid::CategorizeAssets(), WsfXIO_ScriptService::CheckParams(), WsfSatelliteBreakupModel::CollisionalBreakup(), MTT_PerceivedCluster::CopyFrom(), wsf::cyber::EngagementManager::CyberAttack(), wsf::cyber::EngagementManager::CyberScan(), FlightPathAnalysisFunction::Execute(), HorizontalMapFunction::Execute(), WsfSatelliteBreakupModel::ExplosiveBreakup(), WsfCuedLaserWeapon::Fire(), wsf::comm::Network::GetAddressFromNamedComm(), WsfTaskManager::GetMessageSender(), WsfFalseTargetBlip::GetReferenceJammerToRadarRange(), WsfZoneDefinition::GetReferencePlatform(), WsfTrack::GetTargetIndex(), WsfOrbitalManeuver::GetTargetPropagatorTruth(), Tool::Initialize(), WsfFormationFlyer::Initialize(), WsfOffsetMover::Initialize(), WsfTrack::Initialize(), wsf::comm::NetworkManager::InitializeUserLinks(), notifyOfPlatformsNotPresentInSimulation(), WsfZoneDefinition::PointIsInside(), wsf::altloc::Component::PreInitialize(), wsf::coverage::CompositeGrid::PreparePlatforms(), wsf::coverage::ExistingPlatformGrid::PreparePlatforms(), WsfWeaponServer::ProcessCommand(), WsfL16::Interface_J11::ProcessJ11_0Message(), WsfSensorProcessor::RemoveSensor(), wsf::comm::SlotGroupLayerJTIDS::Send(), wsf::ExternalLinks::SendMessage(), WsfOffsetMover::SetReference(), WsfRIPRProcessor::SetTargetByName(), wsf::comm::NetworkAdHoc::Update(), WsfPerfectTracker::Update(), WsfFalseTarget::UpdateBaseBlipPositions(), WsfFalseTarget::UpdateBlipPositions(), WsfFusionCenter::UpdateFalseTargetTracks(), WsfFormationFlyer::UpdateLeadInfo(), WsfFusionCenter::UpdateRealTargetTracks(), WsfZoneDefinition::UpdateReference(), WsfWeaponFuse::UpdateTargetState(), WsfWeaponTaskManager::UplinkStart(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), wsf::comm::UT_DEFINE_SCRIPT_METHOD(), wsf::cyber::UT_DEFINE_SCRIPT_METHOD(), wsf::comm::Comm::ValidateGateway(), WsfRIPRProcessor::WeaponsIncoming(), and WsfMessage::WsfMessage().

◆ GetPlatformCount()

◆ GetPlatformEntry()

◆ GetPlatformNameId()

◆ GetPlatformObserver()

WsfPlatformObserver & WsfSimulation::GetPlatformObserver ( ) const
inline

◆ GetPlatformPartObserver()

WsfPlatformPartObserver & WsfSimulation::GetPlatformPartObserver ( ) const
inline

◆ GetPlatformTypeId()

WsfStringId WsfSimulation::GetPlatformTypeId ( size_t aIndex) const

Return the type (ID) of a platform, even if the platform has been deleted from the simulation.

◆ GetProcessorObserver()

WsfProcessorObserver & WsfSimulation::GetProcessorObserver ( ) const
inline

◆ GetRandom()

ut::Random & WsfSimulation::GetRandom ( )

Referenced by WsfJamStrobeDetector::ApplyMeasurementErrors(), WsfTRIMSIM_Processor::ComputeMeasurementErrors(), WsfBrawlerProcessor::GetConsciousnessEventTime(), wsf::altloc::SimulationExtension::GetDraw(), WsfSensorTracker::GetRandom(), WsfNavigationMesh::GetRandomLocation(), WsfPathFinder::GetRandomLocation(), WsfNavigationErrors::GlobalGaussian(), XWsfSeaTraffic::HandleDeparture(), WsfGuidedMover::IgniteStage(), WsfClusterCorrelation::Initialize(), WsfDirectionFinderProcessor::Initialize(), WsfElementESA_AntennaPattern::Initialize(), WsfESA_AntennaPattern::Initialize(), WsfESA_NX_AntennaPattern::Initialize(), WsfFalseTargetScreener::Initialize(), WsfJTIDS_SlotGroup::Initialize(), WsfL16::SurveillancePart::Initialize(), WsfNavigationErrors::Initialize(), WsfNoiseCloud::Initialize(), WsfPhysicalScanSensorScheduler::Initialize(), WsfRandomVariable::Initialize(), WsfSensor::Initialize(), WsfSpinSensorScheduler::Initialize(), WsfTrackProcessor::InitializeMemberData(), WsfIntersectMesh::Intersect(), WsfIntersectProcessor::Intersect(), WsfBehaviorTreeWeightedRandomNode::LocalExecute(), WsfPlatformAvailability::PlatformIsAvailable(), XWsfAirTraffic::ProcessEvent(), WsfGuidedMover::SeparateStage(), WsfP6DOF_Mover::SetDestroyed(), WsfRandomVariable::SetGenerator(), WsfAdvancedBehaviorTreeWeightedRandomNode::TickFunction(), WsfSensorsManagerFovSensorScheduler::TurnOn(), WsfEventStepSimulation::TurnPartOn(), WsfHighEnergyLaser::UpdateEngagementGeometry(), WsfEmitterTypeReporting::UpdateReportedEmitterType(), and WsfTargetTypeReporting::UpdateReportedTargetType().

◆ GetRealTime()

double WsfSimulation::GetRealTime ( ) const
inline

Get the last sampled real-time clock time.

Note
This value may not be maintained for non-realtime simulations.

References mRealTime.

Referenced by WsfStandardApplication::RunEventLoop().

◆ GetRunNumber()

unsigned int WsfSimulation::GetRunNumber ( ) const
inline

◆ GetScenario()

◆ GetScriptContext() [1/2]

◆ GetScriptContext() [2/2]

const WsfScriptContext & WsfSimulation::GetScriptContext ( ) const
inline

◆ GetScriptExecutor()

◆ GetScriptRandom()

ut::Random & WsfSimulation::GetScriptRandom ( )

◆ GetScriptStateMachineObserver()

WsfScriptStateMachineObserver & WsfSimulation::GetScriptStateMachineObserver ( ) const
inline

◆ GetSensorObserver()

WsfSensorObserver & WsfSimulation::GetSensorObserver ( ) const
inline

◆ GetSimTime()

double WsfSimulation::GetSimTime ( ) const
inline

Get the last time to which the simulation was updated.

References mSimTime.

Referenced by wsf::comm::NetworkAdHoc::AddAddressRate(), WsfPassiveSensor::PassiveMode::AddInteractor(), wsf::comm::NetworkGeneric::AddLinkP(), wsf::comm::NetworkDirectedRing::AddMemberP(), wsf::comm::NetworkMesh::AddMemberP(), wsf::comm::NetworkMeshLegacy::AddMemberP(), wsf::comm::NetworkPointToPoint::AddMemberP(), wsf::comm::NetworkRing::AddMemberP(), wsf::comm::NetworkStar::AddMemberP(), wsf::comm::NetworkAdHoc::AddNamedRate(), WsfLaserDesignations::AddOrUpdate(), AddPlatform(), AddPlatform(), WsfUplinkProcessor::AddTrackUplink(), WsfUplinkProcessor::AddUplink(), engage::SimulationExtension::AdvanceTime(), WsfEW_AgilityEffect::ApplyUnmitigatedEffect(), wsf::comm::NetworkAdHoc::ChangeRate(), WsfArticulatedPart::ClearCueing(), WsfTRIMSIM_Processor::ComputeMeasurementErrors(), wsf::cyber::EngagementManager::CyberScan(), WsfRIPRJobBoard::DeleteCompletedJobs(), WsfBrawlerMover::DeleteMover(), WsfLaserWeapon::GetCoolingTimeRemaining(), WsfEW_EP::GetMitigatingEffects(), WsfDisUtil::GetSimTime(), WsfGuidanceComputer::GetSimTime(), WsfXIO_WeaponComponent::GetSimTime(), WsfXIO_WeaponComponent::HandleStateChangeRequest(), AirToAirLaunchComputerGenerator::Initialize(), ATA_LaunchComputerGenerator::Initialize(), BallisticMissileLaunchComputerGenerator::Initialize(), OrbitalLaunchComputerGenerator::Initialize(), Tool::Initialize(), wsf::comm::NetworkAdHoc::Initialize(), WsfClusterCorrelation::Initialize(), WsfEM_Rcvr::Initialize(), WsfEM_Xmtr::Initialize(), WsfEventStepSimulation::Initialize(), WsfEW_TrackEffect::TrackEffectData::Initialize(), WsfExtEntityDeadReckon::Initialize(), WsfScriptContext::Initialize(), wsf::comm::NetworkDirectedRing::InitializeLinkageP(), wsf::comm::NetworkRing::InitializeLinkageP(), WsfBehaviorTreeNode::LogNodeStructure(), WsfExchange::ModifyCapabilities(), notifyOfPlatformsNotPresentInSimulation(), WsfSpaceMoverBase::PerformStagingOperation(), WsfSpinSensorScheduler::PlatformAdded(), WsfTankedFuel::PlatformDeleted(), WsfWeaponTaskManager::PlatformDeleted(), WsfDisInterface::PrepareExtension(), wsf::event::utils::PrintDateTime(), wsf::event::utilsCSV::PrintDateTime(), wsf::event::utils::PrintTime(), wsf::event::utilsCSV::PrintTime(), WsfDisDataQuery::Process(), WsfDisResupplyCancel::Process(), WsfWeaponServer::ProcessCommand(), WsfL16::Interface_J11::ProcessJ11_0Message(), WsfL16::Interface_J11::ProcessJ11_1Message(), WsfL16::Interface_J11::ProcessJ11_2Message(), WsfL16::Interface_J11::ProcessWIFT_Event(), WsfRIPRJobBoard::PurgeUntouchedJobs(), WsfEventPipeInterface::RecordBool(), WsfEventPipeInterface::RecordDouble(), WsfEventPipeInterface::RecordInt(), WsfEventPipeInterface::RecordString(), WsfLaserDesignations::Remove(), wsf::comm::NetworkStar::RemoveHub(), WsfPassiveSensor::PassiveMode::RemoveInteractor(), wsf::comm::NetworkGeneric::RemoveLinkP(), wsf::comm::NetworkDirectedRing::RemoveMemberP(), wsf::comm::NetworkMesh::RemoveMemberP(), wsf::comm::NetworkPointToPoint::RemoveMemberP(), wsf::comm::NetworkRing::RemoveMemberP(), wsf::comm::NetworkStar::RemoveMemberP(), WsfUplinkProcessor::RemoveUplink(), WsfExtEntityDeadReckon::RequireExternalEntities(), WsfL16::Interface_J11::SendBombHitIndicationReport(), WsfL16::Interface_J11::SendWeaponSelfAbortReport(), wsf::comm::medium::Medium::SetActiveModeDelayed(), wsf::comm::medium::Medium::SetActiveModeDelayed(), WsfTrackManager::SetCorrelationStrategy(), WsfArticulatedPart::SetCuedLocationWCS(), WsfArticulatedPart::SetCuedOrientation(), WsfBehaviorTreeNode::SetExecutedLastRun(), WsfTrackManager::SetFusionStrategy(), WsfWeapon::SetQuantityRemaining(), WsfSpaceMoverBase::SetTargetOrientationECI(), WsfHybridMover::SetType(), WsfDisInterface::SimulationPausing(), WsfUplinkProcessor::StartUplinking(), WsfUplinkProcessor::StopUplinking(), SAM_LaunchComputerGenerator::TestPoints(), WsfAdvancedBehaviorTreeRepeaterNode::TickFunction(), WsfRIPRJob::Touch(), WsfJTIDS_SlotGroup::TransmitEventsStopped(), wsf::comm::NetworkAdHoc::Update(), wsf::comm::NetworkAdHoc::Update(), wsf::comm::NetworkAdHoc::Update(), WsfStandardApplication::UpdateOptionsP(), WsfLaserDesignations::Spot::UpdateTo(), UT_DEFINE_SCRIPT_METHOD(), wsf::comm::UT_DEFINE_SCRIPT_METHOD(), wsf::comm::UT_DEFINE_SCRIPT_METHOD(), wsf::comm::UT_DEFINE_SCRIPT_METHOD(), wsf::comm::UT_DEFINE_SCRIPT_METHOD(), wsf::comm::UT_DEFINE_SCRIPT_METHOD(), WsfEventStepSimulation::WaitForAdvanceTime(), WsfL16::Interface_J11::WeaponFired(), WsfRIPRJob::WsfRIPRJob(), WsfRIPRJob::WsfRIPRJob(), WsfScriptEvent::WsfScriptEvent(), WsfScriptEvent::WsfScriptEvent(), and WsfScriptEvent::WsfScriptEvent().

◆ GetSimulationInput()

const WsfSimulationInput & WsfSimulation::GetSimulationInput ( ) const
inline

◆ GetSimulationObserver()

WsfSimulationObserver & WsfSimulation::GetSimulationObserver ( ) const
inline

◆ GetState()

State WsfSimulation::GetState ( ) const
inline

◆ GetStateString() [1/2]

const std::string & WsfSimulation::GetStateString ( ) const

Return the string representation of the simulation's current state.

References mState.

◆ GetStateString() [2/2]

const std::string & WsfSimulation::GetStateString ( State aState)
static

Return the string representation of the provided simulation state.

◆ GetSyncTimestep()

double WsfSimulation::GetSyncTimestep ( ) const
inline

Return the scaled and stepped DIS-NRT timestep (if running DIS-NRT).

Returns
the current timestep in a scaled-and-stepped simulation.

◆ GetSystemLog()

WsfSystemLog & WsfSimulation::GetSystemLog ( ) const

◆ GetTaskObserver()

WsfTaskObserver & WsfSimulation::GetTaskObserver ( ) const
inline

◆ GetTerrainInterface()

◆ GetTimeBehind()

double WsfSimulation::GetTimeBehind ( ) const
inline

Get the amount of time the simulation clock is behind real-time clock.

A derived class may optionally maintain this value for use as a hint to other simulation components that the simulation clock has fallen 'sufficiently' behind the real-time clock and that they should take action to try to reduce the workload. The default value is zero (not running behind).

References mTimeBehind.

◆ GetTimestep()

double WsfSimulation::GetTimestep ( ) const
inline

Return the simulation timestep (if the simulation is time-stepped).

Returns
The simulation timestep for time-stepped simulation or 0 for an event driven simulation.

References mTimestep.

Referenced by WsfDisInterface::ExecuteSensorUpdateEvent(), WsfARGO8_Mover::Initialize(), WsfDisSetDataR::PopulateResponse(), and WsfDisDataQueryR::ProduceResponse().

◆ GetTrackObserver()

WsfTrackObserver & WsfSimulation::GetTrackObserver ( ) const
inline

◆ GetWallTime()

double WsfSimulation::GetWallTime ( ) const

Get the current wall-clock time since simulation creation.

Get the current wall clock elapsed time since simulation creation.

Referenced by WsfDisInterface::SimulationPausing().

◆ GetZoneAttenuation()

WsfZoneAttenuation & WsfSimulation::GetZoneAttenuation ( )
inline

◆ GetZoneObserver()

WsfZoneObserver & WsfSimulation::GetZoneObserver ( ) const
inline

◆ Initialize()

void WsfSimulation::Initialize ( )
virtual

Initialize the simulation.

This method initializes the simulation by performing the following actions:

  • Invokes the Initialize method for each registered simulation extension.
  • Invokes Initialize each registered simulation observer.
  • Adds the 'initial state' platforms to the simulation.
  • Invokes the derived class SimulationInitialized() method.
  • Marks the simulation as 'pending_start'

Upon completion of this call, the application should call WsfSimulation::Start, enter a loop to execute events and then call WsfSimulation::Complete.

Exceptions
WsfSimulation::InitializeErrorif an error is encountered.
Note
It is an error to call this method again without calling WsfSimulation::Complete.

Reimplemented in WsfEventStepSimulation, and WsfFrameStepSimulation.

References AddEvent(), AddInputPlatforms(), WsfObserver::InitializeCallback::Callback(), cINITIALIZING, cPENDING_INITIALIZE, cPENDING_START, WsfSimulationInput::cPP_ABOVE_NORMAL, WsfSimulationInput::cPP_BELOW_NORMAL, WsfSimulationInput::cPP_HIGH, WsfSimulationInput::cPP_NORMAL, WsfSimulationInput::cPP_REALTIME, CreateClock(), FindExtension(), GetEndTime(), GetExtension(), GetScenario(), GetScriptContext(), WsfObserver::Initialize(), WsfSimulationExtension::Initialize(), WsfScriptContext::InitializeGlobalContext(), mIsRealTime, mRealTime, mSimTime, mSimulationInput, mState, mTimeBehind, ok, WsfSimulationExtension::PendingStart(), WsfSimulationExtension::PrepareExtension(), SimulationInitialized(), WsfObserver::SimulationInitializing(), and WsfObserver::SimulationPendingStart().

Referenced by WsfPlatform::AssignToSimulation(), WsfEventStepSimulation::Initialize(), WsfFrameStepSimulation::Initialize(), and WsfStandardApplication::InitializeSimulation().

◆ IsActive()

bool WsfSimulation::IsActive ( ) const
inline

Return whether the simulation currently is in the ACTIVE state (see WsfSimulation::State for a list of simulation states).

Note
This method is used to conditionally either advance the simulation time or trigger a call to WsfSimulation::Complete, as follows:
// Code Fragment illustrating the IsActive() method in a simulation main loop.
while (sim.IsActive())
{
sim.AdvanceTime();
}
sim.Complete(sim.GetEndTime());

References cACTIVE, and mState.

Referenced by engage::Task::Execute(), and WsfStandardApplication::RunEventLoop().

◆ IsEventStepSimulation()

bool WsfSimulation::IsEventStepSimulation ( ) const
inline

Return event step simulation indicator.

Referenced by WsfExtEntityDeadReckon::Initialize().

◆ IsExternallyStarted()

bool WsfSimulation::IsExternallyStarted ( ) const
inline

Return whether the simulation is to be started by an external source.

Referenced by WsfEventStepSimulation::SetRealtime(), WsfFrameStepSimulation::SetRealtime(), and WsfFrameStepSimulation::Start().

◆ IsFlexibleRealtime()

bool WsfSimulation::IsFlexibleRealtime ( ) const
inline

Return 'true' if the simulation's real-time constraint is flexible.

◆ IsRealTime()

bool WsfSimulation::IsRealTime ( ) const
inline

Return whether this simulation is running real-time, or a multiple of real-time.

References mIsRealTime.

Referenced by WsfDisIO_Thread::Initialize(), WsfStandardApplication::RunEventLoop(), WsfEventStepSimulation::TurnPartOn(), and WsfStandardApplication::UpdateOptionsP().

◆ LockRandom()

ut::Random & WsfSimulation::LockRandom ( )

◆ LockScriptRandom()

ut::Random & WsfSimulation::LockScriptRandom ( )

◆ MultiThreaded()

◆ MultiThreadingActive()

◆ NextEngagementSerialNumber()

unsigned int WsfSimulation::NextEngagementSerialNumber ( )
inline

◆ NextMessageSerialNumber()

unsigned int WsfSimulation::NextMessageSerialNumber ( )
inline

◆ operator=()

WsfSimulation & WsfSimulation::operator= ( const WsfSimulation & aRhs)
delete

References WsfSimulation().

◆ Pause()

void WsfSimulation::Pause ( )
virtual

Pause execution of the simulation.

References cACTIVE, mClockSourcePtr, mState, and WsfObserver::SimulationPausing().

Referenced by PauseAndRequestAdvance(), and WsfDisStopFreeze::Process().

◆ PauseAndRequestAdvance()

void WsfSimulation::PauseAndRequestAdvance ( double aSimTime)

Pause the execution of the simulation and request a time advance in scaled-and-stepped mode.

References GetClockRate(), mSyncAccumulatedTime, Pause(), and WsfObserver::RequestTimeAdvance().

Referenced by SetTimeParameters().

◆ PlatformDeleted()

bool WsfSimulation::PlatformDeleted ( double aSimTime,
WsfPlatform * aOldPlatformPtr )
virtual

Virtual method invoked by the base class used to notify other platforms and observers of the impending deletion of a platform. This is called immediately prior to deleting the platform object.

Parameters
aSimTimeThe current simulation time.
aOldPlatformPtrPointer to the platform to be deleted.
Returns
'true' if successful and 'false' otherwise.

Reimplemented in WsfEventStepSimulation.

References DeleteFromPlatformList(), WsfPlatform::GetDamageFactor(), GetPlatformCount(), GetPlatformEntry(), WsfPlatform::IsBroken(), WsfPlatform::NotifyDeleted(), WsfObserver::PlatformBroken(), WsfObserver::PlatformDeleted(), and platformPtr.

Referenced by WsfEventStepSimulation::PlatformDeleted(), and ProcessRemovePlatformEvent().

◆ PlatformExists()

bool WsfSimulation::PlatformExists ( size_t aIndex) const

Returns 'true' if the platform with the specified index still exists.

Referenced by DeletePlatform().

◆ PlatformInitialized()

bool WsfSimulation::PlatformInitialized ( double aSimTime,
WsfPlatform * aNewPlatformPtr )
protectedvirtual

Virtual method invoked by the base class just after it has called the a platforms Initialize() method.

It is provided so derived classes can perform their own unique platform initialization.

Parameters
aSimTimeThe current simulation time.
aNewPlatformPtrPointer to the platform just initialized.
Returns
'true' if successful and 'false' otherwise.

Reimplemented in WsfEventStepSimulation.

Referenced by AddInputPlatforms(), and AddPlatform().

◆ PlatformIntroduced()

bool WsfSimulation::PlatformIntroduced ( double aSimTime,
WsfPlatform * aNewPlatformPtr )
protectedvirtual

Virtual method invoked by the base class after it has introduced a new platform to the simulation.

Parameters
aSimTimeThe current simulation time.
aNewPlatformPtrPointer to the platform just introduced.
Returns
'true' if successful and 'false' otherwise.

Reimplemented in WsfEventStepSimulation.

Referenced by WsfEventStepSimulation::PlatformIntroduced().

◆ PlatformIsAvailable()

bool WsfSimulation::PlatformIsAvailable ( WsfPlatform * aPlatformPtr)
protectedvirtual

Referenced by AddInputPlatforms().

◆ PlatformPointerExists()

bool WsfSimulation::PlatformPointerExists ( WsfPlatform * aPlatformPtr)
protected

Does the platform pointer already exist in the list?

Parameters
aPlatformPtrThe pointer to be tested.
Returns
'true' if already in the list or 'false' if not.

Referenced by AddInputPlatforms(), and AddPlatform().

◆ PrepareSimulation()

void WsfSimulation::PrepareSimulation ( )
virtual

◆ PreviousEngagementSerialNumber()

unsigned int WsfSimulation::PreviousEngagementSerialNumber ( ) const
inline

◆ ProcessPlatformBrokenEvent()

void WsfSimulation::ProcessPlatformBrokenEvent ( double aSimTime,
WsfPlatform * aPlatformPtr )
virtual

Call from PlatformBrokenEvent to complete the processing of the broken of a platform.

References WsfPlatform::OnBrokenEvent().

Referenced by WsfMilInterface::KillPlatform().

◆ ProcessRemovePlatformEvent()

void WsfSimulation::ProcessRemovePlatformEvent ( double aSimTime,
WsfPlatform * aPlatformPtr,
bool aDeletePlatform )
virtual

Called from RemovePlatformEvent to complete the processing of deleting a platform.

References PlatformDeleted(), and WsfPlatform::SetDeleted().

Referenced by Complete(), and DeletePlatform().

◆ RandomizeFrequency()

bool WsfSimulation::RandomizeFrequency ( ) const

◆ ReclaimPreviousEngagementSerialNumber()

void WsfSimulation::ReclaimPreviousEngagementSerialNumber ( )
inline

◆ RegisterExtension()

◆ RequestReset()

void WsfSimulation::RequestReset ( )
virtual

Reset the simulation.

This method is called when some external source wants to reset the simulation. A derived class can override this method to perform its own special processing.

The default behavior is to set the simulation state to PENDING_COMPLETE with a completion reason of RESET. It is the responsibility of the caller to detect this condition and take action.

References cACTIVE, cPENDING_COMPLETE, cRESET, mCompletionReason, and mState.

Referenced by WsfDisStopFreeze::Process().

◆ RequestTermination()

void WsfSimulation::RequestTermination ( )
virtual

Terminate the simulation.

This method is called when some external source wants to terminate the simulation. A derived class can override this method to perform its own special processing.

The default behavior is to set the simulation state to PENDING_COMPLETE with a completion reason of TERMINATE. It is the responsibility of the caller to detect this condition and take action.

References cACTIVE, cPENDING_COMPLETE, cTERMINATE, mCompletionReason, and mState.

Referenced by WsfDisStopFreeze::Process(), and engage::SimulationExtension::WeaponTerminated().

◆ ResetPlatformList()

void WsfSimulation::ResetPlatformList ( )
protected

Reset the list to its initial (empty) state.

Referenced by Complete(), and WsfSimulation().

◆ Resume()

void WsfSimulation::Resume ( )
virtual

◆ SetAmAnEventStepSimulation()

void WsfSimulation::SetAmAnEventStepSimulation ( bool aFlag)
inline

◆ SetClockRate()

void WsfSimulation::SetClockRate ( double aClockRate)
virtual

◆ SetClockSource()

void WsfSimulation::SetClockSource ( std::unique_ptr< WsfClockSource > aClockSourcePtr)

Set the clock source object.

The clock source object is the source of time for the simulation. Not all simulations require a simulation clock. For instance, in an event-stepped simulation the flow of time can be derived from the events. However one may want to run the event-stepped simulation in a real-time environment. Attaching a real-time clock object will (if used properly) prevent events from being dispatched until the correct simulation is encountered.

There can be only once clock source. Calling this method deletes any previously defined clock source and replaces it with the new source. The clock source is owned by the simulation and will be deleted when the simulation is deleted.

Parameters
aClockSourcePtrPointer to the clock source object. This class assumes ownership of the object.

References mClockSourcePtr, mRealTimeClockSourcePtr, mSimulationInput, and WsfObserver::SimulationClockRateChange().

Referenced by WsfEventStepSimulation::CreateClock(), WsfFrameStepSimulation::CreateClock(), and CreateClock().

◆ SetEndTime()

void WsfSimulation::SetEndTime ( double aEndTime)

Set the defined end time of the simulation.

References AddEvent(), cCOMPLETE, cINITIALIZING, mEndTime, and mState.

Referenced by weapon_tools(), and engage::SimulationExtension::WeaponTerminated().

◆ SetFlexibleRealtime()

void WsfSimulation::SetFlexibleRealtime ( )
inline

◆ SetIsExternallyStarted()

void WsfSimulation::SetIsExternallyStarted ( bool aIsExternallyStarted)

Allow an external source (esp., an observer such as the DIS Interface) to start the simulation in lieu of the simulation's starting itself.

Referenced by WsfDisInterface::ActivateConnection(), WsfXIO_Simulation::Initialize(), and WsfDisInterface::PrepareExtension().

◆ SetMultiThreadingActive()

void WsfSimulation::SetMultiThreadingActive ( bool aMultiThreadingActive)
inline

Set whether multi-threading is currently active ('true') or not ('false').

◆ SetPartOperational()

virtual bool WsfSimulation::SetPartOperational ( double aSimTime,
WsfPlatformPart * aPartPtr,
bool aOperational = true )
inlinevirtual

References SetPartOperationalP().

◆ SetPartOperationalP()

bool WsfSimulation::SetPartOperationalP ( double aSimTime,
WsfPlatformPart * aPartPtr,
bool aOperational )
protectedvirtual

Set the platform part operation state

Parameters
aSimTimeThe current simulation time.
aPartPtrA pointer to the system whose operational state is to be changed
aOperationalDesired operational state of the system
Returns
'true' if successful or 'false' if operational state was not changed

References WsfPlatformPart::IsOperational(), and WsfPlatformPart::SetOperational().

Referenced by SetPartOperational().

◆ SetPartUpdateInterval()

void WsfSimulation::SetPartUpdateInterval ( double aSimTime,
WsfPlatformPart * aPartPtr,
double aUpdateInterval )
virtual

Set the update interval for a platform part. This method defines how often the simulation executive will call the Update() method.

Parameters
aSimTimeThe current simulation time.
aPartPtrA pointer to the sensor whose update interval is to be changed.
aUpdateIntervalThe new update interval. If this value is less than or equal to zero, the periodic calls to Update() will be deactivated until another call is made to reactive the periodic calls.

Reimplemented in WsfEventStepSimulation.

References WsfPlatformPart::SetUpdateInterval().

Referenced by WsfSensor::SetNextUpdateTime().

◆ SetRealtime()

virtual void WsfSimulation::SetRealtime ( double aSimTime,
bool aIsRealTime )
inlinevirtual

Instructs the simulation to run in a real-time mode.

Reimplemented in WsfEventStepSimulation, and WsfFrameStepSimulation.

Referenced by WsfStandardApplication::UpdateOptionsP().

◆ SetTimeParameters()

void WsfSimulation::SetTimeParameters ( int aTimeScheme,
double aSimTime,
double aClockRate,
double aTimeStep,
bool aTimeAdvance = false )
virtual

◆ ShouldExecute()

bool WsfSimulation::ShouldExecute ( ) const
virtual

Determine whether the simulation should be executed. To test for a reset condition or the end of a set of Monte-Carlo repetitions, this method can be called as the exit condition of a while loop (see example, below).

Note
This execution proceeds with calls to WsfSimulation::Initialize, WsfSimulation::Start and WsfSimulation::AdvanceTime, as shown below.
// Example simulation loop, using the ShouldExecute() method.
while (sim.ShouldExecute())
{
sim.Initialize();
sim.Start();
while (sim.IsActive())
{
sim.AdvanceTime();
}
sim.Complete(sim.GetEndTime());
};

References cCOMPLETE, cPENDING_INITIALIZE, cRESET, mCompletionReason, and mState.

◆ SimulationComplete()

virtual void WsfSimulation::SimulationComplete ( double aSimTime)
inlinevirtual

Deprecated form of Complete();.

References Complete().

◆ SimulationInitialized()

bool WsfSimulation::SimulationInitialized ( )
protectedvirtual

Virtual method invoked by the base class Initialize() method after it has performed the basic simulation initialization.

Derived classes can use it to add any additional functionality they require.

Returns
'true' if successful and 'false' otherwise.

Referenced by Initialize().

◆ SimulationStarting()

virtual void WsfSimulation::SimulationStarting ( )
inlinevirtual

Deprecated form of Start();.

References Start().

◆ Start()

void WsfSimulation::Start ( )
virtual

Indicate the application is going to start its simulation loop.

This performs the following actions:

  • Resets the clock back to 0.0
  • Invokes the Start method for each registered simulation extension.
  • Invokes SimulationStarting for each registered observer.
  • Mark the simulation as active.
Note
This should be invoked IMMEDIATELY before starting the simulation loop as some observers may be time-sensitive.

Reimplemented in WsfFrameStepSimulation.

References cACTIVE, cCOMPLETE, cNONE, cPENDING_START, cSTARTING, GetExtension(), mClockSourcePtr, mCompletionReason, mState, WsfObserver::SimulationStarting(), and WsfSimulationExtension::Start().

Referenced by WsfStandardApplication::RunEventLoop(), SimulationStarting(), WsfFrameStepSimulation::Start(), and weapon_tools().

◆ SubstituteOutputFileVariables()

std::string WsfSimulation::SubstituteOutputFileVariables ( const std::string & aOutputFile)

Performs substitution for naming output files d - Run Number D - Date M-D-Y T - Time HHMMSS

References GetRunNumber().

Referenced by WsfDisInterface::ActivateConnection(), WsfEventPipeInterface::AddedToSimulation(), wsf::event::output::SimulationExtension::OpenFile(), and wsf::console::ScenarioExtension::SimulationCreated().

◆ TurnPartOff()

virtual bool WsfSimulation::TurnPartOff ( double aSimTime,
WsfPlatformPart * aPartPtr )
inlinevirtual

◆ TurnPartOffP()

bool WsfSimulation::TurnPartOffP ( double aSimTime,
WsfPlatformPart * aPartPtr )
protectedvirtual

Turn off a platform part.

Parameters
aSimTimeThe current simulation time.
aPartPtrA pointer to the system to be turned off.
Returns
'true' if successful or 'false' if already turned off.

Reimplemented in WsfFrameStepSimulation.

References WsfPlatformPart::IsTurnedOn(), and WsfPlatformPart::TurnOff().

Referenced by TurnPartOff(), and WsfFrameStepSimulation::TurnPartOffP().

◆ TurnPartOn()

◆ TurnPartOnP()

bool WsfSimulation::TurnPartOnP ( double aSimTime,
WsfPlatformPart * aPartPtr )
protectedvirtual

Turn on a platform part.

Parameters
aSimTimeThe current simulation time.
aPartPtrA pointer to the system to be turned on.
Returns
'true' if successful or 'false' if already turned on.

Reimplemented in WsfFrameStepSimulation.

References WsfPlatformPart::CanBeTurnedOn(), WsfPlatformPart::IsOperational(), WsfPlatformPart::IsTurnedOn(), and WsfPlatformPart::TurnOn().

Referenced by TurnPartOn(), and WsfFrameStepSimulation::TurnPartOnP().

◆ UnlockRandom()

void WsfSimulation::UnlockRandom ( )

◆ UnlockScriptRandom()

void WsfSimulation::UnlockScriptRandom ( )

◆ UseDefaultFrequency()

bool WsfSimulation::UseDefaultFrequency ( ) const

References mSimulationInput.

◆ WaitForAdvanceTime()

void WsfSimulation::WaitForAdvanceTime ( )
virtual

Member Data Documentation

◆ mClockSourcePtr

◆ mCompletionReason

volatile CompletionReason WsfSimulation::mCompletionReason {cNONE}
protected

◆ mDateTime

WsfDateTime WsfSimulation::mDateTime
protected

◆ mEM_Manager

WsfEM_Manager WsfSimulation::mEM_Manager
protected

EM manager.

Referenced by GetEM_Manager().

◆ mEndTime

double WsfSimulation::mEndTime {std::numeric_limits<double>::max()}
protected

The end time of the simulation (seconds).

Referenced by Complete(), GetEndTime(), SetEndTime(), and WsfSimulation().

◆ mEventManager

◆ mExternalEventReady

bool WsfSimulation::mExternalEventReady {false}
protected

True if an external event needs to be processed.

◆ mIsRealTime

◆ mMinimumMoverTimestep

double WsfSimulation::mMinimumMoverTimestep
protected

◆ mMultiThreaded

bool WsfSimulation::mMultiThreaded
protected

Referenced by MultiThreaded(), and WsfSimulation().

◆ mRealTime

double WsfSimulation::mRealTime {false}
protected

◆ mRealTimeClockSourcePtr

WsfRealTimeClockSource* WsfSimulation::mRealTimeClockSourcePtr {nullptr}
protected

If mClockSourcePtr is a WsfRealTimeClockSource, points to mClockSourcePtr, otherwise it is nullptr.

Referenced by AdvanceTime(), and SetClockSource().

◆ mRunNumber

unsigned int WsfSimulation::mRunNumber
protected

The current run number being executed.

Referenced by GetRunNumber(), and WsfSimulation().

◆ mSimTime

double WsfSimulation::mSimTime {0.0}
protected

The last time to which the simulation has been updated (seconds).

Referenced by WsfFrameStepSimulation::AdvanceTime(), AdvanceTime(), AdvanceTime(), Complete(), GetNextEventTime(), GetSimTime(), and Initialize().

◆ mSimulationInput

◆ mState

◆ mSyncAccumulatedTime

double WsfSimulation::mSyncAccumulatedTime {0.0}
protected

The wall clock time taken to execute the current synchronized time step.

Referenced by AdvanceTime(), PauseAndRequestAdvance(), and SetTimeParameters().

◆ mTimeBehind

double WsfSimulation::mTimeBehind {0.0}
protected

The amount of time the simulation clock is behind the real-time clock.

Referenced by GetTimeBehind(), Initialize(), and WsfEventStepSimulation::WaitForAdvanceTime().

◆ mTimestep

double WsfSimulation::mTimestep {0.0}
protected

The timestep or frame time for a fixed timestep simulation. For event-driven simulations this will be zero (the default value). For time-stepped simulations, the derived class must set this to their timestep.

Referenced by GetTimestep(), and WsfFrameStepSimulation::Initialize().

◆ mWallEventManager

WsfEventManager WsfSimulation::mWallEventManager
protected

Wall clock-based event manager object.

Referenced by AddWallEvent(), DispatchWallEvents(), and WsfSimulation().


The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved