VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
multiVehicleFed.h
Go to the documentation of this file.
1 /*******************************************************************************
2  ** Copyright (c) 2014 MAK Technologies, Inc
3  ** All rights reserved.
4  *******************************************************************************/
5 
6 #pragma once
7 
10 #include <vl/publisherContainer.h>
12 #include "vehicleSim.h"
13 
14 class DtF18Initializer;
16 class DtExerciseConn;
17 
49 
53 {
54 public:
55 
56  // User parallel execution, or serial execution
57  enum mode { PARALLEL=1, SERIAL=2 };
58 
61 
63  virtual ~DtMultiVehicleFed();
64 
66 
67  // Set up and initialize for an exercise
68  void initializeExConn(DtTime theTimeOutInterval, DtF18Initializer *initializer);
69 
70  // initialize the fleet
71  void initializeFleet(int appNumOffset, int theNumVehicles, const DtF18Initializer *initializer);
72 
73  // Process inputs up to maximum elapsed real time
74  void drainInput(double tMaxRealElapsed);
75 
76  // Set/get the simulation time
78  void setSimTime(double time);
79  double simTime() const;
81 
82  // Get the number of remote entities
83  int numberRemoteEntities() const;
84 
85  // Simulate all vehicles
86  void simulate();
87 
88  // Publish all vehicle outputs
89  void publish();
90 
91  // Sleep until real time catches up to simulated time
92  double sleep(double deltaTime);
93 
94  // Dismantle the fleet
95  void dismantleFleet();
96 
97  // Dismantle an exercise
98  void dismantleExConn();
99 
100  // Execution mode
101  void setExecutionMode(mode theMode);
102  mode executionMode() const;
103 
104 protected:
105 
106  // Factory to create and initialize a single fleet vehicle.
107  DtVehicleSim *vehicleFactory(int num, int appNumOffset,
108  const DtF18Initializer *initializer, DtObjectPublisherContainer& pubContainer);
109 
110  DtString& getVehicleName(int num, const DtString& baseName, DtString& name);
111 
112  // Detonation callback handler
113  static void theDetonationCb(DtDetonationInteraction *theDetonation, void *theUserData);
114 
115  // Process detonation over all vehicles in parallel
116  void processDetonation(const DtDetonationInteraction *theDetonation);
117 
118 private:
119  mode myMode; // Whether to execute in parallel or serial
120  DtTime mySimTime; // Simulated time
121  DtClock *myClock; // Exercise clock
122 
123  // Exercise connection for this simulation
125 
126  // Reflected entity list, tracks entities published by remote simulations
128 
129  // Container for fleet (all vehicles published by this simulation)
130  // This shows how to use the general parallel execution container.
132 
133  // Container of published objects.
134  // This shows how to publish objects in parallel, simpler than DtParallelExecutionContainer.
136 };
DtReflectedEntityList * myRel
Definition: multiVehicleFed.h:127
DtVehicleSim * vehicleFactory(int num, int appNumOffset, const DtF18Initializer *initializer, DtObjectPublisherContainer &pubContainer)
Instances of DtDetonationInteraction are used to communicate information associated with the impact o...
Definition: detonationInteractionHLA.h:37
Instances of DtExerciseConn are used to provide an application&#39;s interface or connection to the netwo...
Definition: exerciseConnHLA.h:61
void drainInput(double tMaxRealElapsed)
mode executionMode() const
Part of the F18 example.
Definition: f18/vehicleSim.h:31
DtF18Initializer derives from DtVrlApplicationInitializer and describes how command line/MTL paramete...
Definition: f18Init.h:29
void setSimTime(double time)
Used to set and maintain time in a simulation.
Definition: vlTime.h:25
void processDetonation(const DtDetonationInteraction *theDetonation)
virtual ~DtMultiVehicleFed()
Pure Virtual destructor.
DtObjectPublisherContainer myPublishedObjects
Definition: multiVehicleFed.h:135
DtExerciseConn * myExConn
Definition: multiVehicleFed.h:124
mode
Definition: multiVehicleFed.h:57
multiVehicleFed.h
Definition: multiVehicleFed.h:52
Contains DtTimedSection, DtTimeStatistic, and DtPerformanceStats classes.
static void theDetonationCb(DtDetonationInteraction *theDetonation, void *theUserData)
DtObjectPublisherContainer is an ObjectPublisher container which will execute a method on all contain...
Definition: publisherContainer.h:43
DtMultiVehicleFed()
Constructor.
DtString & getVehicleName(int num, const DtString &baseName, DtString &name)
Instances of DtReflectedEntityList are used to manage remote entities from the network.
Definition: reflectedEntityListHLA.h:38
int numberRemoteEntities() const
DtParallelExecutionContainer< DtVehicleSim > mySimulatedVehicles
Definition: multiVehicleFed.h:131
Definition: multiVehicleFed.h:57
void setExecutionMode(mode theMode)
Contains the DtParallelExecutionContainer class declarations.
DtClock * myClock
Definition: multiVehicleFed.h:121
Definition: multiVehicleFed.h:57
double simTime() const
DtTime mySimTime
Definition: multiVehicleFed.h:120
void initializeExConn(DtTime theTimeOutInterval, DtF18Initializer *initializer)
DtReal DtTime
A definition of DtTime.
Definition: vlTime.h:19
Instances of DtString are used to represent strings.
Definition: vlString.h:29
mode myMode
Definition: multiVehicleFed.h:119
This file provides protocol independence for Detonation Interactions.
DtExerciseConn * exerciseConn()
Definition: multiVehicleFed.h:65
double sleep(double deltaTime)
void initializeFleet(int appNumOffset, int theNumVehicles, const DtF18Initializer *initializer)

Document ID: Generated on Wed Mar 27 02:04:30 EDT 2024 from SVN revision 264570
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)