Skip to content
Snippets Groups Projects
Commit 149da06f authored by Brutzman, Don's avatar Brutzman, Don
Browse files

refactor ChannelOpenDis7 as member object rather than superclass, improving reuse

parent e90466ee
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,6 @@ import edu.nps.moves.dis7.entities.swe.platform.surface._002Triton; ...@@ -10,7 +10,6 @@ import edu.nps.moves.dis7.entities.swe.platform.surface._002Triton;
import edu.nps.moves.dis7.enumerations.*; import edu.nps.moves.dis7.enumerations.*;
import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.pdus.*;
import edu.nps.moves.dis7.utilities.PduFactory; import edu.nps.moves.dis7.utilities.PduFactory;
import java.util.ArrayList;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
...@@ -20,9 +19,12 @@ import java.util.logging.Logger; ...@@ -20,9 +19,12 @@ import java.util.logging.Logger;
* Default program initialization includes PDU recording turned on by default. * Default program initialization includes PDU recording turned on by default.
* @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/ExampleSimulationProgramLog.txt">ExampleSimulationProgramLog.txt</a> * @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/ExampleSimulationProgramLog.txt">ExampleSimulationProgramLog.txt</a>
*/ */
public class ExampleSimulationProgram extends ChannelOpenDis7 public class ExampleSimulationProgram // extends ChannelOpenDis7
{ {
/** seconds for real-time execution (not simulation time, which may or may not be the same) */ protected ChannelOpenDis7 channelOpenDis7;
protected PduFactory pduFactory;
/** seconds for real-time execution (not simulation time, which may or may not be .the same) */
double currentTimeStep = 1.0; // seconds double currentTimeStep = 1.0; // seconds
/** initial simulation time */ /** initial simulation time */
double initialTime = 0.0; double initialTime = 0.0;
...@@ -34,23 +36,42 @@ public class ExampleSimulationProgram extends ChannelOpenDis7 ...@@ -34,23 +36,42 @@ public class ExampleSimulationProgram extends ChannelOpenDis7
/** EntityID settings for entity 2 */ /** EntityID settings for entity 2 */
protected EntityID entityID_2 = new EntityID(); protected EntityID entityID_2 = new EntityID();
/** ESPDU for entity 1 */ /** ESPDU for entity 1 */
protected EntityStatePdu entityStatePdu_1 = pduFactory.makeEntityStatePdu(); protected EntityStatePdu entityStatePdu_1;
/** ESPDU for entity 2 */ /** ESPDU for entity 2 */
protected EntityStatePdu entityStatePdu_2 = pduFactory.makeEntityStatePdu(); protected EntityStatePdu entityStatePdu_2;
/** FirePdu for entity 1 first weapon (if any) */ /** FirePdu for entity 1 first weapon (if any) */
protected FirePdu firePdu_1a = pduFactory.makeFirePdu(); protected FirePdu firePdu_1a;
/** FirePdu for entity 1 second weapon (if any) */ /** FirePdu for entity 1 second weapon (if any) */
protected FirePdu firePdu_1b = pduFactory.makeFirePdu(); protected FirePdu firePdu_1b;
/** MunitionDescriptor for these weapons */ /** MunitionDescriptor for these weapons */
protected MunitionDescriptor munitionDescriptor1 = new MunitionDescriptor(); protected MunitionDescriptor munitionDescriptor1;
/** this class instantiated as an object */ /** this class instantiated as an object */
SimulationManager simulationManager = new SimulationManager(); SimulationManager simulationManager = new SimulationManager();
/** Initialize channel setup for OpenDis7 and report a test PDU */
private void initializeChannelOpenDis7()
{
channelOpenDis7.setUpNetworkInterface();
channelOpenDis7.printlnTRACE ("opendis7.getNetworkAddress()=" + channelOpenDis7.getNetworkAddress() +
", getNetworkPort()=" + channelOpenDis7.getNetworkPort());
// channelOpenDis7.sendCommentPdu(VariableRecordType.OTHER, "ArrivalProcessOpenDis7 initialized");
}
/** Get ready, get set... initialize simulation entities /** Get ready, get set... initialize simulation entities
*/ */
public void initializeSimulationEntities() public void initializeSimulationEntities()
{ {
initializeChannelOpenDis7();
pduFactory = channelOpenDis7.getPduFactory();
entityStatePdu_1 = pduFactory.makeEntityStatePdu();
entityStatePdu_2 = pduFactory.makeEntityStatePdu();
firePdu_1a = pduFactory.makeFirePdu();
firePdu_1b = pduFactory.makeFirePdu();
munitionDescriptor1 = new MunitionDescriptor();
// Your model setup: define participants. who's who in this zoo? // Your model setup: define participants. who's who in this zoo?
// Assuming you keep track of entity objects... here is some support for for Entity 1. // Assuming you keep track of entity objects... here is some support for for Entity 1.
...@@ -78,8 +99,8 @@ public class ExampleSimulationProgram extends ChannelOpenDis7 ...@@ -78,8 +99,8 @@ public class ExampleSimulationProgram extends ChannelOpenDis7
// TODO simulation management PDUs for startup, planning to design special class support // TODO simulation management PDUs for startup, planning to design special class support
// simulationManager.addEntity(); // simulationManager.addEntity();
simulationManager.setDescriptor("ExampleSimulationProgram"); simulationManager.setDescriptor("ExampleSimulationProgram");
simulationManager.addHost(thisHostName); simulationManager.addHost(ChannelOpenDis7.getThisHostName());
simulationManager.setDisThreadedNetworkInterface(disNetworkInterface); simulationManager.setDisThreadedNetworkInterface(channelOpenDis7.getDisNetworkInterface());
} }
/** /**
...@@ -106,7 +127,7 @@ public class ExampleSimulationProgram extends ChannelOpenDis7 ...@@ -106,7 +127,7 @@ public class ExampleSimulationProgram extends ChannelOpenDis7
// TODO reset Clock Time to today's date and timestamp to zero, providing consistent outputs for each simulation run // TODO reset Clock Time to today's date and timestamp to zero, providing consistent outputs for each simulation run
pduRecorder.setVerbose(true); channelOpenDis7.getPduRecorder().setVerbose(true);
initializeSimulationEntities(); initializeSimulationEntities();
...@@ -162,7 +183,7 @@ public class ExampleSimulationProgram extends ChannelOpenDis7 ...@@ -162,7 +183,7 @@ public class ExampleSimulationProgram extends ChannelOpenDis7
System.out.println ("sending PDUs for simulation step " + simulationLoopCount + ", monitor loopback to confirm sent"); System.out.println ("sending PDUs for simulation step " + simulationLoopCount + ", monitor loopback to confirm sent");
System.out.flush(); System.out.flush();
sendAllPdusForLoopTimestep(entityStatePdu_1, firePdu_1a, currentTimeStepComment, narrativeMessage1, narrativeMessage2, narrativeMessage3); sendAllPdusForLoopTimestep(entityStatePdu_1, firePdu_1a, currentTimeStepComment, narrativeMessage1, narrativeMessage2, narrativeMessage3);
sendSinglePdu(entityStatePdu_2); // me too i.e. 2! channelOpenDis7.sendSinglePdu(entityStatePdu_2); // me too i.e. 2!
System.out.println ("... [PDUs successfully sent for this loop]"); System.out.println ("... [PDUs successfully sent for this loop]");
System.out.flush(); System.out.flush();
...@@ -178,7 +199,7 @@ public class ExampleSimulationProgram extends ChannelOpenDis7 ...@@ -178,7 +199,7 @@ public class ExampleSimulationProgram extends ChannelOpenDis7
// =================================================================================================== // ===================================================================================================
narrativeMessage2 = "runSimulation() completed successfully"; // all done narrativeMessage2 = "runSimulation() completed successfully"; // all done
sendCommentPdu(narrativeComment, narrativeMessage1, narrativeMessage2, narrativeMessage3); channelOpenDis7.sendCommentPdu(narrativeComment, narrativeMessage1, narrativeMessage2, narrativeMessage3);
System.out.println ("... [final CommentPdu successfully sent for simulation]"); System.out.println ("... [final CommentPdu successfully sent for simulation]");
// TODO simulation management PDUs // TODO simulation management PDUs
...@@ -211,8 +232,11 @@ public class ExampleSimulationProgram extends ChannelOpenDis7 ...@@ -211,8 +232,11 @@ public class ExampleSimulationProgram extends ChannelOpenDis7
public ExampleSimulationProgram() public ExampleSimulationProgram()
{ {
// additional constructor initialization goes here // additional constructor initialization goes here
if (channelOpenDis7 == null)
channelOpenDis7 = new ChannelOpenDis7();
pduFactory = channelOpenDis7.getPduFactory();
} }
/** /**
* Utility Constructor that allows your example simulation program to override default network address and port * Utility Constructor that allows your example simulation program to override default network address and port
* @param address network address to use * @param address network address to use
...@@ -222,9 +246,9 @@ public class ExampleSimulationProgram extends ChannelOpenDis7 ...@@ -222,9 +246,9 @@ public class ExampleSimulationProgram extends ChannelOpenDis7
{ {
super(); super();
setNetworkAddress(address); channelOpenDis7.setNetworkAddress(address);
setNetworkPort(port); channelOpenDis7.setNetworkPort(port);
} }
/** /**
...@@ -242,11 +266,12 @@ public class ExampleSimulationProgram extends ChannelOpenDis7 ...@@ -242,11 +266,12 @@ public class ExampleSimulationProgram extends ChannelOpenDis7
String... comments) String... comments)
{ {
if (entityStatePdu != null) if (entityStatePdu != null)
sendSinglePdu(entityStatePdu); channelOpenDis7.sendSinglePdu(entityStatePdu);
if (firePdu != null) if (firePdu != null)
sendSinglePdu(firePdu); // bang channelOpenDis7.sendSinglePdu(firePdu); // bang
sendCommentPdu(commentType, comments);
channelOpenDis7.sendCommentPdu(commentType, comments); // empty comments are filtered
} }
/** /**
...@@ -259,9 +284,9 @@ public class ExampleSimulationProgram extends ChannelOpenDis7 ...@@ -259,9 +284,9 @@ public class ExampleSimulationProgram extends ChannelOpenDis7
if (args.length == 2) if (args.length == 2)
{ {
if ((args[0] != null) && !args[0].isEmpty()) if ((args[0] != null) && !args[0].isEmpty())
thisProgram.setNetworkAddress(args[0]); thisProgram.channelOpenDis7.setNetworkAddress(args[0]);
if ((args[1] != null) && !args[1].isEmpty()) if ((args[1] != null) && !args[1].isEmpty())
thisProgram.setNetworkPort(Integer.parseInt(args[1])); thisProgram.channelOpenDis7.setNetworkPort(Integer.parseInt(args[1]));
} }
else if (args.length != 0) else if (args.length != 0)
{ {
...@@ -281,23 +306,25 @@ public class ExampleSimulationProgram extends ChannelOpenDis7 ...@@ -281,23 +306,25 @@ public class ExampleSimulationProgram extends ChannelOpenDis7
*/ */
public static void main(String[] args) public static void main(String[] args)
{ {
setTRACE_PREFIX("[" + ExampleSimulationProgram.class.getName() + "] "); thisProgram = new ExampleSimulationProgram(); // create instance of self
thisProgram.channelOpenDis7.setTRACE_PREFIX("[" + ExampleSimulationProgram.class.getName() + "] ");
System.out.println(getTRACE_PREFIX() + "main() started..."); thisProgram.channelOpenDis7.printlnTRACE("main() started...");
thisProgram = new ExampleSimulationProgram(); // creates instance of self within static main() method thisProgram = new ExampleSimulationProgram(); // creates instance of self within static main() method
thisProgram.handleArgs (args); // process command-line invocation arguments thisProgram.handleArgs (args); // process command-line invocation arguments
thisProgram.setUpNetworkInterface(); thisProgram.channelOpenDis7.setUpNetworkInterface();
// thisProgram.pduRecorder.setDescriptor (TRACE_PREFIX.replace("[","").replace("]","") + " pduRecorder"); // thisProgram.pduRecorder.setDescriptor (TRACE_PREFIX.replace("[","").replace("]","") + " pduRecorder");
thisProgram.runSimulationLoops(); // ... your simulation execution code goes in there ... thisProgram.runSimulationLoops(); // ... your simulation execution code goes in there ...
thisProgram.tearDownNetworkInterface(); // make sure no processes are left lingering thisProgram.channelOpenDis7.tearDownNetworkInterface(); // make sure no processes are left lingering
System.out.println(getTRACE_PREFIX() + "complete."); // report successful completion thisProgram.channelOpenDis7.printlnTRACE("complete."); // report successful completion
System.exit(0); // ensure all threads and sockets released System.exit(0); // ensure all threads and sockets released
} }
......
...@@ -6,8 +6,9 @@ Updating property file: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\b ...@@ -6,8 +6,9 @@ Updating property file: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\b
Compiling 1 source file to C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\classes Compiling 1 source file to C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\classes
compile-single: compile-single:
run-single: run-single:
[OpenDis7]thisHostName=IT160907-UWALPP
[OpenDis7Examples.ExampleSimulationProgram] main() started... [OpenDis7Examples.ExampleSimulationProgram] main() started...
[OpenDis7Examples.ExampleSimulationProgram] thisHostName=IT160907-UWALPP [OpenDis7]thisHostName=IT160907-UWALPP
[DisThreadedNetworkInterface] using network interface PANGP Virtual Ethernet Adapter [DisThreadedNetworkInterface] using network interface PANGP Virtual Ethernet Adapter
[DisThreadedNetworkInterface] datagramSocket.joinGroup address=239.1.2.3 port=3000 isConnected()=false createDatagramSocket() complete. [DisThreadedNetworkInterface] datagramSocket.joinGroup address=239.1.2.3 port=3000 isConnected()=false createDatagramSocket() complete.
[DisThreadedNetworkInterface] createThreads() receiveThread.isAlive()=true [DisThreadedNetworkInterface] createThreads() receiveThread.isAlive()=true
...@@ -20,20 +21,41 @@ Recorder log file open: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\ ...@@ -20,20 +21,41 @@ Recorder log file open: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\
[DisThreadedNetworkInterface] createThreads() receiveThread.isAlive()=true [DisThreadedNetworkInterface] createThreads() receiveThread.isAlive()=true
[DisThreadedNetworkInterface] createThreads() sendingThread.isAlive()=true [DisThreadedNetworkInterface] createThreads() sendingThread.isAlive()=true
[PduRecorder PduRecorder] listening to IP address 239.1.2.3 on port 3000 [PduRecorder PduRecorder] listening to IP address 239.1.2.3 on port 3000
[DisThreadedNetworkInterface] using network interface PANGP Virtual Ethernet Adapter
[DisThreadedNetworkInterface] datagramSocket.joinGroup address=239.1.2.3 port=3000 isConnected()=false createDatagramSocket() complete.
[DisThreadedNetworkInterface] createThreads() receiveThread.isAlive()=true
[DisThreadedNetworkInterface] createThreads() sendingThread.isAlive()=true
Network confirmation: address=239.1.2.3 port=3000
Beginning pdu save to directory ./pduLog
Recorder log file open: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog1.dislog
[DisThreadedNetworkInterface] using network interface PANGP Virtual Ethernet Adapter
[DisThreadedNetworkInterface] datagramSocket.joinGroup address=239.1.2.3 port=3000 isConnected()=false createDatagramSocket() complete.
[DisThreadedNetworkInterface] createThreads() receiveThread.isAlive()=true
[DisThreadedNetworkInterface] createThreads() sendingThread.isAlive()=true
[PduRecorder PduRecorder] listening to IP address 239.1.2.3 on port 3000
[OpenDis7]opendis7.getNetworkAddress()=239.1.2.3, getNetworkPort()=3000
... My simulation just did something, no really... ... My simulation just did something, no really...
... [Pausing for 1.0 seconds] ... [Pausing for 1.0 seconds]
sending PDUs for simulation step 1, monitor loopback to confirm sent sending PDUs for simulation step 1, monitor loopback to confirm sent
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 1] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 1] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 1] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 1] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 1] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 1] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 1] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 1] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 2] DisPduType 02 FIRE, size 96 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 2] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 2] DisPduType 02 FIRE, size 96 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 2] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 2] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 2] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 2] DisPduType 02 FIRE, size 96 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 2] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 3] DisPduType 22 COMMENT, size 104 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 3] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 3] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 3] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 3] DisPduType 22 COMMENT, size 104 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 3] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 3] DisPduType 22 COMMENT, size 104 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 3] DisPduType 22 COMMENT, size 104 bytes)
*** [CommentPdu narrative sent: APPLICATION_TIMESTEP] [MV3500 ExampleSimulationProgram, runSimulation() loop 1] *** [CommentPdu narrative sent: APPLICATION_TIMESTEP] [MV3500 ExampleSimulationProgram, runSimulation() loop 1]
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 4] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 4] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 4] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 4] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 4] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 4] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 4] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 4] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
... [PDUs successfully sent for this loop] ... [PDUs successfully sent for this loop]
...@@ -43,16 +65,24 @@ sending PDUs for simulation step 2, monitor loopback to confirm sent ...@@ -43,16 +65,24 @@ sending PDUs for simulation step 2, monitor loopback to confirm sent
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 5] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 5] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 5] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 5] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 5] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 5] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 5] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 5] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 6] DisPduType 02 FIRE, size 96 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 6] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 6] DisPduType 02 FIRE, size 96 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 6] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 6] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 6] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 6] DisPduType 02 FIRE, size 96 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 6] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 7] DisPduType 22 COMMENT, size 104 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 7] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 7] DisPduType 22 COMMENT, size 104 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 7] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 7] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 7] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 7] DisPduType 22 COMMENT, size 104 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 7] DisPduType 22 COMMENT, size 104 bytes)
*** [CommentPdu narrative sent: APPLICATION_TIMESTEP] [MV3500 ExampleSimulationProgram, runSimulation() loop 2] *** [CommentPdu narrative sent: APPLICATION_TIMESTEP] [MV3500 ExampleSimulationProgram, runSimulation() loop 2]
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 8] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 8] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 8] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 8] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 8] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 8] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 8] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 8] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
... [PDUs successfully sent for this loop] ... [PDUs successfully sent for this loop]
... My simulation just did something, no really... ... My simulation just did something, no really...
... [Pausing for 1.0 seconds] ... [Pausing for 1.0 seconds]
...@@ -60,15 +90,23 @@ sending PDUs for simulation step 3, monitor loopback to confirm sent ...@@ -60,15 +90,23 @@ sending PDUs for simulation step 3, monitor loopback to confirm sent
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 9] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 9] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 9] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 9] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 9] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 9] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 9] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 9] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 10] DisPduType 02 FIRE, size 96 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 10] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 10] DisPduType 02 FIRE, size 96 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 10] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 10] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 10] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 10] DisPduType 02 FIRE, size 96 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 10] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 11] DisPduType 22 COMMENT, size 104 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 11] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 11] DisPduType 22 COMMENT, size 104 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 11] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 11] DisPduType 22 COMMENT, size 104 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 11] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 11] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 11] DisPduType 22 COMMENT, size 104 bytes)
*** [CommentPdu narrative sent: APPLICATION_TIMESTEP] [MV3500 ExampleSimulationProgram, runSimulation() loop 3] *** [CommentPdu narrative sent: APPLICATION_TIMESTEP] [MV3500 ExampleSimulationProgram, runSimulation() loop 3]
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 12] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 12] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 12] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 12] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 12] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 12] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 12] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 12] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
... [PDUs successfully sent for this loop] ... [PDUs successfully sent for this loop]
... My simulation just did something, no really... ... My simulation just did something, no really...
...@@ -77,15 +115,23 @@ sending PDUs for simulation step 4, monitor loopback to confirm sent ...@@ -77,15 +115,23 @@ sending PDUs for simulation step 4, monitor loopback to confirm sent
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 13] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 13] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 13] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 13] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 13] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 13] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 13] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 13] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 14] DisPduType 02 FIRE, size 96 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 14] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 14] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 14] DisPduType 02 FIRE, size 96 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 14] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 14] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 14] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 14] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 15] DisPduType 22 COMMENT, size 104 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 15] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 15] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 15] DisPduType 22 COMMENT, size 104 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 15] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 15] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 15] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 15] DisPduType 22 COMMENT, size 104 bytes)
*** [CommentPdu narrative sent: APPLICATION_TIMESTEP] [MV3500 ExampleSimulationProgram, runSimulation() loop 4] *** [CommentPdu narrative sent: APPLICATION_TIMESTEP] [MV3500 ExampleSimulationProgram, runSimulation() loop 4]
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 16] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 16] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 16] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 16] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 16] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 16] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 16] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 16] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
... [PDUs successfully sent for this loop] ... [PDUs successfully sent for this loop]
... My simulation just did something, no really... ... My simulation just did something, no really...
...@@ -93,21 +139,31 @@ sending PDUs for simulation step 4, monitor loopback to confirm sent ...@@ -93,21 +139,31 @@ sending PDUs for simulation step 4, monitor loopback to confirm sent
sending PDUs for simulation step 5, monitor loopback to confirm sent sending PDUs for simulation step 5, monitor loopback to confirm sent
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 17] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 17] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 17] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 17] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 17] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 17] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 17] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 17] DisPduType 01 ENTITY_STATE Entity #1, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 18] DisPduType 02 FIRE, size 96 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 18] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 18] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 18] DisPduType 02 FIRE, size 96 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 18] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 18] DisPduType 02 FIRE, size 96 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 18] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 18] DisPduType 02 FIRE, size 96 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 19] DisPduType 22 COMMENT, size 104 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 19] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 19] DisPduType 22 COMMENT, size 104 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 19] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 19] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 19] DisPduType 22 COMMENT, size 104 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 19] DisPduType 22 COMMENT, size 104 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 19] DisPduType 22 COMMENT, size 104 bytes)
*** [CommentPdu narrative sent: APPLICATION_TIMESTEP] [MV3500 ExampleSimulationProgram, runSimulation() loop 5] *** [CommentPdu narrative sent: APPLICATION_TIMESTEP] [MV3500 ExampleSimulationProgram, runSimulation() loop 5]
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 20] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 20] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 20] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 20] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 20] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 20] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 20] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 20] DisPduType 01 ENTITY_STATE Entity #2, size 144 bytes)
... [PDUs successfully sent for this loop] ... [PDUs successfully sent for this loop]
... [loop termination condition met, simulationComplete=true] ... [loop termination condition met, simulationComplete=true]
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 21] DisPduType 22 COMMENT, size 120 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [sending 21] DisPduType 22 COMMENT, size 120 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 21] DisPduType 22 COMMENT, size 120 bytes) [DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 21] DisPduType 22 COMMENT, size 120 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram pdu looping] [receipt 21] DisPduType 22 COMMENT, size 120 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 21] DisPduType 22 COMMENT, size 120 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 21] DisPduType 22 COMMENT, size 120 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 21] DisPduType 22 COMMENT, size 120 bytes)
*** [CommentPdu narrative sent: COMPLETE_EVENT_REPORT] [MV3500 ExampleSimulationProgram, runSimulation() completed successfully] *** [CommentPdu narrative sent: COMPLETE_EVENT_REPORT] [MV3500 ExampleSimulationProgram, runSimulation() completed successfully]
... [final CommentPdu successfully sent for simulation] ... [final CommentPdu successfully sent for simulation]
...@@ -118,6 +174,6 @@ sending PDUs for simulation step 5, monitor loopback to confirm sent ...@@ -118,6 +174,6 @@ sending PDUs for simulation step 5, monitor loopback to confirm sent
*** killThread() status: receiveThread.isAlive()=false receiveThread.isInterrupted()=true *** killThread() status: receiveThread.isAlive()=false receiveThread.isInterrupted()=true
*** Thread close status: sendingThread.isAlive()=false receiveThread.isAlive()=false *** Thread close status: sendingThread.isAlive()=false receiveThread.isAlive()=false
PduRecorder.stop() closing recorder log file: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog.dislog PduRecorder.stop() closing recorder log file: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog1.dislog
[OpenDis7Examples.ExampleSimulationProgram] complete. [OpenDis7]complete.
BUILD SUCCESSFUL (total time: 10 seconds) BUILD SUCCESSFUL (total time: 10 seconds)
...@@ -8,7 +8,6 @@ package OpenDis7Examples; ...@@ -8,7 +8,6 @@ package OpenDis7Examples;
import edu.nps.moves.dis7.entities.swe.platform.surface._001Poseidon; import edu.nps.moves.dis7.entities.swe.platform.surface._001Poseidon;
import edu.nps.moves.dis7.enumerations.ForceID; import edu.nps.moves.dis7.enumerations.ForceID;
import edu.nps.moves.dis7.pdus.EntityID;
import edu.nps.moves.dis7.pdus.EntityStatePdu; import edu.nps.moves.dis7.pdus.EntityStatePdu;
import edu.nps.moves.dis7.pdus.Pdu; import edu.nps.moves.dis7.pdus.Pdu;
import edu.nps.moves.dis7.pdus.Vector3Double; import edu.nps.moves.dis7.pdus.Vector3Double;
...@@ -29,7 +28,7 @@ import java.util.logging.Logger; ...@@ -29,7 +28,7 @@ import java.util.logging.Logger;
* @see <a href="https://gitlab.nps.edu/Savage/SavageTheses/-/tree/master/BrennenstuhlTobias">https://gitlab.nps.edu/Savage/SavageTheses/-/tree/master/BrennenstuhlTobias</a> * @see <a href="https://gitlab.nps.edu/Savage/SavageTheses/-/tree/master/BrennenstuhlTobias">https://gitlab.nps.edu/Savage/SavageTheses/-/tree/master/BrennenstuhlTobias</a>
*/ */
public class ExampleTrackInterpolation extends ExampleSimulationProgram public class ExampleTrackInterpolation extends ExampleSimulationProgram
{ {
// -------------------- Begin Variables for X3D autogenerated code // -------------------- Begin Variables for X3D autogenerated code
private X3dCreateInterpolators x3dInterpolators = new X3dCreateInterpolators(); private X3dCreateInterpolators x3dInterpolators = new X3dCreateInterpolators();
private X3dCreateLineSet x3dLineSet = new X3dCreateLineSet(); private X3dCreateLineSet x3dLineSet = new X3dCreateLineSet();
...@@ -70,8 +69,8 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram ...@@ -70,8 +69,8 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
entityID_1.setSiteID(1).setApplicationID(2).setEntityID(3); // made-up example ID; entityID_1.setSiteID(1).setApplicationID(2).setEntityID(3); // made-up example ID;
// TODO someday, use enumerations; is there a unique site triplet for MOVES Institute? // TODO someday, use enumerations; is there a unique site triplet for MOVES Institute?
pduRecorder.setVerbose(false); channelOpenDis7.getPduRecorder().setVerbose(false);
pduRecorder.hasVerboseOutput(); // debug check channelOpenDis7.getPduRecorder().hasVerboseOutput(); // debug check
EntityStatePdu espdu_1 = pduFactory.makeEntityStatePdu(); EntityStatePdu espdu_1 = pduFactory.makeEntityStatePdu();
espdu_1.setEntityID(entityID_1); espdu_1.setEntityID(entityID_1);
...@@ -96,9 +95,9 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram ...@@ -96,9 +95,9 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
pduTrack_1.addPdu(espdu_1); // initial location pduTrack_1.addPdu(espdu_1); // initial location
// OK send initial PDUs prior to loop // OK send initial PDUs prior to loop
if (pduRecorder.hasVerboseOutput()) if (channelOpenDis7.getPduRecorder().hasVerboseOutput())
System.out.println("sending PDUs for simulation step " + simulationLoopCount + ", monitor loopback to confirm sent"); System.out.println("sending PDUs for simulation step " + simulationLoopCount + ", monitor loopback to confirm sent");
sendSinglePdu(espdu_1); channelOpenDis7.sendSinglePdu(espdu_1);
// sendCommentPdu(currentTimeStepComment, narrativeMessage1, narrativeMessage2, narrativeMessage3); // sendCommentPdu(currentTimeStepComment, narrativeMessage1, narrativeMessage2, narrativeMessage3);
pduSentList.add(espdu_1); pduSentList.add(espdu_1);
reportPdu(simulationLoopCount, espdu_1.getEntityLocation(), directionEntity_1); reportPdu(simulationLoopCount, espdu_1.getEntityLocation(), directionEntity_1);
...@@ -152,16 +151,16 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram ...@@ -152,16 +151,16 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
if (false) // real-time operation or simulation speedup if (false) // real-time operation or simulation speedup
{ {
Thread.sleep((long) (currentTimeStep * 1000)); // seconds * (1000 msec/sec) = milliseconds Thread.sleep((long) (currentTimeStep * 1000)); // seconds * (1000 msec/sec) = milliseconds
System.out.println(getTRACE_PREFIX() + "Pausing for " + currentTimeStep + " seconds"); System.out.println(channelOpenDis7.getTRACE_PREFIX() + "Pausing for " + currentTimeStep + " seconds");
} }
// OK now send the status PDUs for this loop, and then continue // OK now send the status PDUs for this loop, and then continue
if (pduRecorder.hasVerboseOutput()) if (channelOpenDis7.getPduRecorder().hasVerboseOutput())
System.out.println("sending PDUs for simulation step " + simulationLoopCount + ", monitor loopback to confirm sent"); System.out.println("sending PDUs for simulation step " + simulationLoopCount + ", monitor loopback to confirm sent");
sendSinglePdu(espdu_1); channelOpenDis7.sendSinglePdu(espdu_1);
sendCommentPdu(currentTimeStepComment, narrativeMessage1, narrativeMessage2, narrativeMessage3); channelOpenDis7.sendCommentPdu(currentTimeStepComment, narrativeMessage1, narrativeMessage2, narrativeMessage3);
if (pduRecorder.hasVerboseOutput()) if (channelOpenDis7.getPduRecorder().hasVerboseOutput())
System.out.println(getTRACE_PREFIX() + "PDUs successfully sent for this loop"); System.out.println(channelOpenDis7.getTRACE_PREFIX() + "PDUs successfully sent for this loop");
pduSentList.add(espdu_1); pduSentList.add(espdu_1);
pduTrack_1.addPdu(espdu_1); pduTrack_1.addPdu(espdu_1);
Vector3Double location = espdu_1.getEntityLocation(); Vector3Double location = espdu_1.getEntityLocation();
...@@ -171,15 +170,15 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram ...@@ -171,15 +170,15 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
// current loop now finished, check whether to terminate if simulation complete, otherwise continue // current loop now finished, check whether to terminate if simulation complete, otherwise continue
if (simulationComplete || (simulationLoopCount > 10000)) // for example; including fail-safe condition is good if (simulationComplete || (simulationLoopCount > 10000)) // for example; including fail-safe condition is good
{ {
System.out.println(getTRACE_PREFIX() + "loop termination condition met, simulationComplete=" + simulationComplete); // ", final loopCount=" + loopCount + System.out.println(channelOpenDis7.getTRACE_PREFIX() + "loop termination condition met, simulationComplete=" + simulationComplete); // ", final loopCount=" + loopCount +
break; break;
} }
} // end of simulation loop } // end of simulation loop
// =================================================================================================== // ===================================================================================================
System.out.println(getTRACE_PREFIX() + "all PDUs successfully sent for this loop (pduSentList.size()=" + pduSentList.size() + " total)"); System.out.println(channelOpenDis7.getTRACE_PREFIX() + "all PDUs successfully sent for this loop (pduSentList.size()=" + pduSentList.size() + " total)");
// track analysis // track analysis
System.out.println(getTRACE_PREFIX() + "pduTrack_1 initialLocation=" + pduTrack_1.getInitialLocation() + ", latestLocation=" + pduTrack_1.getLatestLocation()); System.out.println(channelOpenDis7.getTRACE_PREFIX() + "pduTrack_1 initialLocation=" + pduTrack_1.getInitialLocation() + ", latestLocation=" + pduTrack_1.getLatestLocation());
pduTrack_1.sortPdus() pduTrack_1.sortPdus()
.createRawWaypoints(); .createRawWaypoints();
...@@ -191,9 +190,9 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram ...@@ -191,9 +190,9 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
System.out.println("================================="); System.out.println("=================================");
narrativeMessage2 = "runSimulation() completed successfully"; // all done narrativeMessage2 = "runSimulation() completed successfully"; // all done
sendCommentPdu(narrativeComment, narrativeMessage1, narrativeMessage2, narrativeMessage3); channelOpenDis7.sendCommentPdu(narrativeComment, narrativeMessage1, narrativeMessage2, narrativeMessage3);
if (pduRecorder.hasVerboseOutput()) if (channelOpenDis7.getPduRecorder().hasVerboseOutput())
System.out.println(getTRACE_PREFIX() + "final CommentPdu successfully sent for simulation"); channelOpenDis7.printlnTRACE("final CommentPdu successfully sent for simulation");
// TODO simulation management PDUs // TODO simulation management PDUs
} }
catch (InterruptedException iex) // handle any exception that your code might choose to provoke! catch (InterruptedException iex) // handle any exception that your code might choose to provoke!
...@@ -233,27 +232,29 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram ...@@ -233,27 +232,29 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
*/ */
public static void main(String[] args) public static void main(String[] args)
{ {
setTRACE_PREFIX("[" + ExampleTrackInterpolation.class.getName() + "] "); thisProgram = new ExampleTrackInterpolation(); // create instance of self
thisProgram.channelOpenDis7.setTRACE_PREFIX("[" + ExampleTrackInterpolation.class.getName() + "] ");
System.out.println(getTRACE_PREFIX() + "main() started..."); thisProgram.channelOpenDis7.printlnTRACE("main() started...");
thisProgram = new ExampleTrackInterpolation(); // creates instance of self within static main() method thisProgram = new ExampleTrackInterpolation(); // creates instance of self within static main() method
thisProgram.handleArgs (args); // process command-line invocation arguments thisProgram.handleArgs (args); // process command-line invocation arguments
thisProgram.setUpNetworkInterface(); thisProgram.channelOpenDis7.setUpNetworkInterface();
thisProgram.pduRecorder.setDescriptor (getTRACE_PREFIX().replace("[","").replace("]","") + " pduRecorder"); thisProgram.channelOpenDis7.getPduRecorder().setDescriptor (thisProgram.channelOpenDis7.getTRACE_PREFIX().replace("[","").replace("]","") + " pduRecorder");
thisProgram.pduRecorder.setVerbose(false); thisProgram.channelOpenDis7.getPduRecorder().setVerbose(false);
thisProgram.setVerboseComments(false); thisProgram.channelOpenDis7.setVerboseComments(false);
thisProgram.disNetworkInterface.setVerbose(false); thisProgram.channelOpenDis7.getDisNetworkInterface().setVerbose(false);
thisProgram.runSimulationLoops(); // ... your simulation execution code goes in there ... thisProgram.runSimulationLoops(); // ... your simulation execution code goes in there ...
thisProgram.tearDownNetworkInterface(); // make sure no processes are left lingering thisProgram.channelOpenDis7.tearDownNetworkInterface(); // make sure no processes are left lingering
System.out.println(getTRACE_PREFIX() + "complete."); // report successful completion thisProgram.channelOpenDis7.printlnTRACE("complete."); // report successful completion
System.exit(0); // ensure all threads and sockets released System.exit(0); // ensure all threads and sockets released
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment