Skip to content
Snippets Groups Projects
Commit 61969673 authored by advan's avatar advan
Browse files

Merge origin/master

parents cceb3058 b07b8d92
No related branches found
No related tags found
No related merge requests found
...@@ -4,13 +4,12 @@ import java.io.*; ...@@ -4,13 +4,12 @@ import java.io.*;
import java.net.*; import java.net.*;
/** /**
* This client program establishes a socket connection to the {@link TcpExamples.TcpExample4DispatchServer}, * This client program establishes a socket connection to the ,
* then checks how long it takes to read the single line it expects as a server response. * then checks how long it takes to read the single line it expects as a server response.
* The modification I have added is it checks for a password from the server. And it matches it says success and disconnects * The modification I have added is it checks for a password from the server. And it matches it says success and disconnects
* No fancy footwork here, it is pretty simple and similar to {@link TcpExamples.TcpExample3Client}. * No fancy footwork here, it is pretty simple and similar to TcpExamples.TcpExample3Client}.
* borrowed code from class
* *
* @see TcpExample4DispatchServer
* @see TcpExample4HandlerThread
* *
* @see <a href="../../../src/TcpExamples/TcpExample4TerminalLog.txt" target="blank">TcpExample4TerminalLog.txt</a> * @see <a href="../../../src/TcpExamples/TcpExample4TerminalLog.txt" target="blank">TcpExample4TerminalLog.txt</a>
* @see <a href="../../../src/TcpExamples/TcpExample4SequenceDiagram.png" target="blank">TcpExample4SequenceDiagram.png</a> * @see <a href="../../../src/TcpExamples/TcpExample4SequenceDiagram.png" target="blank">TcpExample4SequenceDiagram.png</a>
...@@ -19,7 +18,7 @@ import java.net.*; ...@@ -19,7 +18,7 @@ import java.net.*;
* @author Don McGregor * @author Don McGregor
* @author Don Brutzman * @author Don Brutzman
* @author MV3500 class * @author MV3500 class
* @MarkMM * @author MarkMM
*/ */
public class Matiski2Client public class Matiski2Client
{ {
......
...@@ -5,18 +5,16 @@ import java.net.*; ...@@ -5,18 +5,16 @@ import java.net.*;
/** /**
* <p> * <p>
* This utility class supports the {@link TcpExamples.TcpExample4DispatchServer} program, * This utility class supports the TcpExamples.TcpExample4DispatchServer program,
* handling all programming logic needed for a new socket connection * handling all programming logic needed for a new socket connection
* to run in a thread of its own. This is the server * to run in a thread of its own. This is the server
* portion as well, so we artificially invent what happens * portion as well, so we artificially invent what happens
* if the server can't respond to a connection for several seconds. * if the server can't respond to a connection for several seconds.
* </p> * </p>
* <p> * <p>
* Warning: do not run this class! It is created and used automatically by {@link TcpExamples.TcpExample4DispatchServer} at run time. * Warning: do not run this class! It is created and used automatically by TcpExamples.TcpExample4DispatchServer} at run time.
* </p> * </p>
* * see examples
* @see TcpExample4Client
* @see TcpExample4DispatchServer
* *
* @see <a href="../../../src/TcpExamples/TcpExample4TerminalLog.txt" target="blank">TcpExample4TerminalLog.txt</a> * @see <a href="../../../src/TcpExamples/TcpExample4TerminalLog.txt" target="blank">TcpExample4TerminalLog.txt</a>
* @see <a href="../../../src/TcpExamples/TcpExample4SequenceDiagram.png" target="blank">TcpExample4SequenceDiagram.png</a> * @see <a href="../../../src/TcpExamples/TcpExample4SequenceDiagram.png" target="blank">TcpExample4SequenceDiagram.png</a>
...@@ -25,6 +23,7 @@ import java.net.*; ...@@ -25,6 +23,7 @@ import java.net.*;
* @author Don McGregor * @author Don McGregor
* @author Don Brutzman * @author Don Brutzman
* @author MV3500 class * @author MV3500 class
* borrowed heavily from above authors
*/ */
public class Matiski2HandlerThread extends Thread public class Matiski2HandlerThread extends Thread
{ {
......
...@@ -9,8 +9,6 @@ import java.net.*; ...@@ -9,8 +9,6 @@ import java.net.*;
* This advanced technique is often used in high=performance high=capacity server programs. * This advanced technique is often used in high=performance high=capacity server programs.
* *
* *
* @see TcpExample4Client
* @see Matiski2HandlerThread
* *
* @see <a href="../../../src/TcpExamples/TcpExample4TerminalLog.txt" target="blank">TcpExample4TerminalLog.txt</a> * @see <a href="../../../src/TcpExamples/TcpExample4TerminalLog.txt" target="blank">TcpExample4TerminalLog.txt</a>
* @see <a href="../../../src/TcpExamples/TcpExample4SequenceDiagram.png" target="blank">TcpExample4SequenceDiagram.png</a> * @see <a href="../../../src/TcpExamples/TcpExample4SequenceDiagram.png" target="blank">TcpExample4SequenceDiagram.png</a>
...@@ -19,6 +17,7 @@ import java.net.*; ...@@ -19,6 +17,7 @@ import java.net.*;
* @author Don McGregor * @author Don McGregor
* @author Don Brutzman * @author Don Brutzman
* @author MV3500 class * @author MV3500 class
* borrowed heavily from above authors
*/ */
public class Matiski2Server public class Matiski2Server
{ {
......
/**
* Copyright (c) 2008-2023, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved.
* This work is provided under a BSD open-source license, see project license.html or license.txt
* @author brutzman@nps.edu
*/
package MV3500Cohort2024JulySeptember.homework3.Romero;
import edu.nps.moves.dis7.entities.swe.platform.surface._001Poseidon;
import edu.nps.moves.dis7.entities.swe.platform.surface._002Triton;
import edu.nps.moves.dis7.enumerations.*;
import edu.nps.moves.dis7.pdus.*;
import edu.nps.moves.dis7.utilities.DisChannel;
import edu.nps.moves.dis7.utilities.PduFactory;
import java.time.LocalDateTime;
import java.util.logging.Level;
import java.util.logging.Logger;
/** The purpose of this inheritable class is to provide an easily modifiable
* example simulation program that includes DIS-capable entities performing
* tasks of interest, and then reporting activity via PDUs to the network.
* 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" target="_blank">ExampleSimulationProgramLog.txt</a>
* @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/ExampleSimulationProgramPduCaptureLog.dislog" target="_blank">ExampleSimulationProgramPduCaptureLog.dislog</a>
* @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/ExampleSimulationProgramFlowDiagram.pdf" target="_blank">ExampleSimulationProgramFlowDiagram.pdf</a>
* @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/ExampleSimulationProgramWireshark.png" target="_blank">ExampleSimulationProgramWireshark.png</a>
* @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/ExampleSimulationProgramSequenceDiagram.png" target="_blank">ExampleSimulationProgramSequenceDiagram.png</a>
*/
public class ExampleSimulationProgram
{
/* **************************** infrastructure code, modification is seldom needed ************************* */
private String descriptor = this.getClass().getSimpleName();
/** DIS channel defined by network address/port combination includes multiple utility capabilities */
protected DisChannel disChannel;
/** Factory object used to create new PDU instances */
protected PduFactory pduFactory;
/** seconds per loop for real-time or simulation execution */
private double simulationTimeStepDuration = 1.0; // seconds TODO encapsulate
/** initial simulation time in seconds */
double simulationTimeInitial = 0.0;
/** current simulation time in seconds */
double simulationTimeSeconds = simulationTimeInitial;
/** Maximum number of simulation loops */
int MAX_LOOP_COUNT = 4;
String narrativeMessage1 = new String();
String narrativeMessage2 = new String();
String narrativeMessage3 = new String();
/** EntityID settings for entity 1 */
protected EntityID entityID_1 = new EntityID();
/** EntityID settings for entity 2 */
protected EntityID entityID_2 = new EntityID();
/** ESPDU for entity 1 */
protected EntityStatePdu entityStatePdu_1;
/** ESPDU for entity 2 */
protected EntityStatePdu entityStatePdu_2;
/** FirePdu for entity 1 first weapon (if any) */
protected FirePdu firePdu_1a;
/** FirePdu for entity 1 second weapon (if any) */
protected FirePdu firePdu_1b;
/** MunitionDescriptor for these weapons */
protected MunitionDescriptor munitionDescriptor1;
// hey programmer, what other state do you want? this is a good place to declare it...
/**
* Constructor to create an instance of this class.
* Design goal: additional built-in initialization conveniences can go here
* to keep your efforts focused on the runSimulation() method.
*/
// base constructor is not invoked automatically by other constructors
// https://stackoverflow.com/questions/581873/best-way-to-handle-multiple-constructors-in-java
public ExampleSimulationProgram()
{
initialize();
}
/**
* Constructor to create an instance of this class.
* @param newDescriptor describes this program, useful for logging and debugging
*/
public ExampleSimulationProgram(String newDescriptor)
{
descriptor = newDescriptor;
initialize();
}
/**
* Utility Constructor that allows your example simulation program to override default network address and port
* @param address network address to use
* @param port corresponding network port to use
*/
public ExampleSimulationProgram(String address, int port)
{
disChannel.setNetworkAddress (address);
disChannel.setNetworkPort (port);
disChannel.setVerboseComments (true); // TODO rename library method to disambiguate CommentPDU
// TODO still seems really chatty... add silent mode?
disChannel.setVerboseDisNetworkInterface(true); // Default false
disChannel.setVerbosePduRecorder (true); // default false
initialize();
}
/** Initialize channel setup for OpenDis7 and report a test PDU
* @see initializeDisChannel
* @see initializeSimulationEntities */
private void initialize()
{
initializeDisChannel(); // must come first, uses PduFactory
initializeSimulationEntities(); // set unchanging parameters
disChannel.join(); // TODO further functionality expected
String timeStepMessage = "Simulation timestep duration " + getSimulationTimeStepDuration() + " seconds";
disChannel.sendCommentPdu(simulationTimeSeconds, DisChannel.COMMENTPDU_SIMULATION_TIMESTEP, timeStepMessage);
// additional constructor initialization can go here
}
/** Initialize channel setup for OpenDis7 and report a test PDU */
private void initializeDisChannel()
{
if (disChannel == null)
disChannel = new DisChannel();
else
{
disChannel.printlnTRACE ("*** warning, duplicate invocation of initializeDisChannel() ignored");
return;
}
pduFactory = disChannel.getPduFactory();
disChannel.setDescriptor(this.getClass().getSimpleName()); // ExampleSimulationProgram might be a superclass
disChannel.setUpNetworkInterface();
disChannel.printlnTRACE ("just checking: disChannel.getNetworkAddress()=" + disChannel.getNetworkAddress() +
", getNetworkPort()=" + disChannel.getNetworkPort());
disChannel.getDisNetworkInterface().setVerbose(true); // sending and receipt
disChannel.printlnTRACE ("just checking: hasVerboseSending()=" + disChannel.getDisNetworkInterface().hasVerboseSending() +
", hasVerboseReceipt()=" + disChannel.getDisNetworkInterface().hasVerboseReceipt());
disChannel.getPduRecorder().setVerbose(true);
// TODO confirm whether recorder is explicitly started by programmer (or not)
// disChannel.sendCommentPdu(VariableRecordType.OTHER, "DisThreadedNetworkInterface.initializeDisChannel() complete"); // hello channel, debug
}
/** Get ready, get set... initialize simulation entities. Who's who in the zoo?
*/
public void initializeSimulationEntities()
{
if (pduFactory == null)
pduFactory = disChannel.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?
// Assuming you keep track of entity objects... here is some support for for Entity 1.
// PDU objects are already declared and instances created, so now set their values.
// who is who in our big zoo, sufficient for global participation if we need it
entityID_1.setSiteID(1).setApplicationID(2).setEntityID(3); // made-up example ID;
disChannel.addEntity(entityID_1);
entityID_2.setSiteID(1).setApplicationID(2).setEntityID(4); // made-up example ID;
disChannel.addEntity(entityID_2);
// TODO someday, use enumerations for sites as part of a SimulationManager object; e.g. is there a unique site triplet for MOVES Institute?
entityStatePdu_1.setEntityID(entityID_1);
entityStatePdu_1.setForceId(ForceID.FRIENDLY);
entityStatePdu_1.setEntityType(new _001Poseidon()); // note import statement above
// entityStatePdu_1.setMarking("Entity #1");
entityStatePdu_1.setEntityType(new edu.nps.moves.dis7.entities.usa.platform.air.MV22B()); // note import statement at top
entityStatePdu_1.setMarking("Entity #53");
entityStatePdu_1.getMarkingString(); // use Netbeans Debug breakpoint here to check left justified...
entityStatePdu_2.setEntityID(entityID_2);
entityStatePdu_2.setForceId(ForceID.OPPOSING);
entityStatePdu_2.setEntityType(new _002Triton()); // note import statement above
entityStatePdu_2.setMarking("Entity #2");
// TODO how should we customize this munition? what are key parameters for your simulation?
// more is needed here by scenario authors...
munitionDescriptor1.setQuantity(1);
firePdu_1a.setDescriptor(munitionDescriptor1).setRange(1000.0f);
}
/**
* This runSimulationLoops() method is for you, a customizable programmer-modifiable
* code block for defining and running a new simulation of interest.
*
* Welcome! Other parts of this program handle bookkeeping and plumbing tasks so that
* you can focus on your model entities and activities.
* Expandable support includes DIS EntityStatePdu, FirePdu and CommentPdu all available for
* modification and sending in a simulation loop.
* Continuous improvement efforts seek to make this program as easy and straightforward
* as possible for DIS simulationists to use and adapt.
* All of the other methods are setup, teardown and configuration that you may find
* interesting, even helpful, but don't really have to worry about.
*/
@SuppressWarnings("SleepWhileInLoop") // yes we might do that
public void runSimulationLoops ()
{
try
{
final int SIMULATION_MAX_LOOP_COUNT = 10; // be deliberate out there! also avoid infinite loops.
int simulationLoopCount = 0; // variable, initialized at 0
boolean simulationComplete = false; // sentinel variable as termination condition, are we done yet?
// TODO reset Clock Time for today's date and timestamp to zero, providing consistent outputs for each simulation run
String timeMessage = "Simulation time " + simulationTimeSeconds + " at LocalDateTime " + LocalDateTime.now();
disChannel.sendCommentPdu(simulationTimeSeconds, DisChannel.COMMENTPDU_TIME, timeMessage);
// TODO replace enumeration with disChannel.COMMENTPDU_TIME
// TODO fix VariableRecordType.TIME_AMP_DATE_VALID
// ===================================================================================================
// loop the simulation while allowed, programmer can set additional conditions to break out and finish
while (simulationLoopCount < SIMULATION_MAX_LOOP_COUNT) // are we done yet?
{
simulationLoopCount++; // good practice: increment loop counter as first action in that loop
// =============================================================================================
// * your own simulation code starts here! *****************************************************
// =============================================================================================
// are there any other variables to modify at the beginning of your loop?
// are your reading any DIS PDUs from the network? check for them here
// compute a track, update an ESPDU, whatever it is that your model is doing...
// Where is my entity? Insert changes in position; this sample only changes X position.
entityStatePdu_1.getEntityLocation().setX(entityStatePdu_1.getEntityLocation().getX() + 1.0); // 1m per timestep
// decide whether to fire, and then update the firePdu. Hmmm, you might want a target to shoot at!
// etc. etc. your code goes here for your simulation of interest
// something happens between my simulation entities, la de da de da...
System.out.println ("... My simulation just did something, no really...");
System.out.flush(); // make sure this arrives to user even if other threads somehow become deadlocked
// make your reports: narrative code for CommentPdu here (set all to empty strings to avoid sending)
narrativeMessage1 = "MV3500 ExampleSimulationProgram";
narrativeMessage2 = "runSimulation() loop " + simulationLoopCount;
narrativeMessage3 = ""; // intentionally blank for testing
// your loop termination condition goes here
if (simulationLoopCount > MAX_LOOP_COUNT) // for example
{
simulationComplete = true;
}
// =============================================================================================
// * your own simulation code is finished here! ************************************************
// =============================================================================================
// staying synchronized with timestep: wait duration for elapsed time in this loop
// Thread.sleep needs a (long) parameter for milliseconds, which are clumsy to use sometimes
Thread.sleep((long)(getSimulationTimeStepDuration() * 1000)); // units of seconds * (1000 msec/sec) = milliseconds
System.out.println ("... [Pausing for " + getSimulationTimeStepDuration() + " seconds]");
// OK now send the status PDUs for this loop, and then continue
System.out.println ("... sending PDUs of interest for simulation step " + simulationLoopCount + ", monitor loopback to confirm sent");
System.out.flush();
// TODO set timesteps in PDUs
sendAllPdusForLoopTimestep(simulationTimeSeconds,
entityStatePdu_1,
firePdu_1a,
DisChannel.COMMENTPDU_APPLICATION_STATUS,
narrativeMessage1, narrativeMessage2, narrativeMessage3);
disChannel.sendSinglePdu(simulationTimeSeconds, entityStatePdu_2); // me too i.e. 2!
System.out.println ("... [PDUs of interest successfully sent for this loop]");
System.out.flush();
// ===============================
// 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
{
System.out.println ("... [loop termination condition met, simulationComplete=" + simulationComplete + "]"); // ", final loopCount=" + loopCount +
System.out.flush();
break;
}
simulationTimeSeconds += getSimulationTimeStepDuration(); // good practice: increment simulationTime as lastst action in that loop
} // end of simulation loop, continue until done
// ===================================================================================================// ===================================================================================================// ===================================================================================================// ===================================================================================================
narrativeMessage2 = "runSimulation() completed successfully"; // all done, so tell everyone else on the channel
// TODO better javadoc needs to be autogenerated for VariableRecordType enumerations
disChannel.sendCommentPdu(DisChannel.COMMENTPDU_NARRATIVE, narrativeMessage1, narrativeMessage2, narrativeMessage3);
System.out.println ("... [final=completion CommentPdu successfully sent for simulation]");
// disChannel.getPduRecorder(). TODO record XML as well
disChannel.leave(); // embedded SimulationManager is expected to send appropriate PDUs for entity, application shutdown
}
catch (InterruptedException iex) // handle any exception that your code might choose to provoke!
{
Logger.getLogger(ExampleSimulationProgram.class.getSimpleName()).log(Level.SEVERE, null, iex);
}
}
/**
* Send EntityState, Fire, Comment PDUs that got updated for this loop, reflecting state of current simulation timestep.
* @param simTimeSeconds simulation time in second, applied to PDU as timestamp
* @param entityStatePdu the ESPDU to send, if any
* @param firePdu the FirePDU to send, if any
* @param commentType enumeration value describing purpose of the narrative comment PDU
* @param comments String array of narrative comments
* @see DisChannel
// * @see DisTime // TODO find renamed version
* @see <a href="https://docs.oracle.com/javase/tutorial/java/javaOO/arguments.html" target="_blank">Passing Information to a Method or a Constructor</a> Arbitrary Number of Arguments
*/
public void sendAllPdusForLoopTimestep(double simTimeSeconds,
EntityStatePdu entityStatePdu,
FirePdu firePdu,
VariableRecordType commentType,
// vararg... variable-length set of String comments can optionally follow
String... comments)
{
if (entityStatePdu != null)
disChannel.sendSinglePdu(simTimeSeconds, entityStatePdu);
if (firePdu != null)
disChannel.sendSinglePdu(simTimeSeconds, firePdu); // bang
disChannel.sendCommentPdu(simTimeSeconds, commentType, comments); // empty comments are filtered
}
/**
* Initial execution via main() method: handle args array of command-line initialization (CLI) arguments here
* @param args command-line parameters: network address and port
*/
protected void handleArguments (String[] args)
{
// initial execution: handle args array of initialization arguments here
if (args.length == 2)
{
if ((args[0] != null) && !args[0].isEmpty())
thisProgram.disChannel.setNetworkAddress(args[0]);
if ((args[1] != null) && !args[1].isEmpty())
thisProgram.disChannel.setNetworkPort(Integer.parseInt(args[1]));
}
else if (args.length != 0)
{
System.err.println("Usage: " + thisProgram.getClass().getSimpleName() + " [address port]");
System.exit(-1);
}
}
/**
* Get simple descriptor (such as parent class name) for this network interface, used in trace statements
* @return simple descriptor name
*/
public String getDescriptor() {
return descriptor;
}
/**
* Set new simple descriptor (such as parent class name) for this network interface, used in trace statements
* @param newDescriptor simple descriptor name for this interface
*/
public void setDescriptor(String newDescriptor) {
if (newDescriptor == null)
newDescriptor = "";
this.descriptor = newDescriptor;
}
/**
* parameter accessor method
* @return the simulationTimeStepDuration in seconds
*/
public double getSimulationTimeStepDuration() {
return simulationTimeStepDuration;
}
/**
* parameter accessor method
* @param timeStepDurationSeconds the simulationTimeStepDuration in seconds to set
*/
public void setSimulationTimeStepDuration(double timeStepDurationSeconds) {
this.simulationTimeStepDuration = timeStepDurationSeconds;
}
/** Locally instantiable copy of program, can be subclassed. */
protected static ExampleSimulationProgram thisProgram;
/**
* Main method is first executed when a program instance is loaded.
* @see <a href="https://docs.oracle.com/javase/tutorial/getStarted/application/index.html" target="_blank">Java Tutorials: A Closer Look at the "Hello World!" Application</a>
* @param args command-line parameters: network address and port.
* Command-line arguments are an array of optional String parameters that are passed from execution environment during invocation
*/
public static void main(String[] args)
{
thisProgram = new ExampleSimulationProgram("test constructor"); // create instance of self within static main() method
thisProgram.disChannel.printlnTRACE("main() started...");
thisProgram.handleArguments(args); // process any command-line invocation arguments
thisProgram.runSimulationLoops(); // ... your simulation execution code goes in there ...
thisProgram.disChannel.tearDownNetworkInterface(); // make sure no processes are left lingering
thisProgram.disChannel.printlnTRACE("complete."); // report successful completion
System.exit(0); // ensure all threads and sockets released
}
}
# Rene Romero Homework 3
***
## Description
Modification to ...
<!--
Phrases taken from: <b>https://www.divein.com/everyday/monday-motivation-quotes/</b>
<a href="images/MOTD.png"><img src="images/MOTD.png" width="700" align="center"/></a>
Message of the day reference: <b>https://en.wikipedia.org/wiki/Message_of_the_day </b>
-->
/**
* Final project assignments supporting the NPS MOVES MV3500 Networked Graphics course.
*
* @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/tree/master/assignments" target="_blank">networkedGraphicsMV3500 assignments</a>
* @see java.lang.Package
* @see <a href="https://stackoverflow.com/questions/22095487/why-is-package-info-java-useful" target="_blank">StackOverflow: why-is-package-info-java-useful</a>
* @see <a href="https://stackoverflow.com/questions/624422/how-do-i-document-packages-in-java" target="_blank">StackOverflow: how-do-i-document-packages-in-java</a>
*/
package MV3500Cohort2024JulySeptember.homework3.Romero;
For Homework 3, I modified the OpenDIS ExampleSimulationProgram to enhance its functionality For Homework 3, I modified the OpenDIS ExampleSimulationProgram to enhance its functionality
by experimenting with entity enumeration values and adjusting the network communication setup. by experimenting with entity enumeration values and adjusting the network communication setup.
Specifically, I changed the entities in the simulation to a Swedish Poseidon-class surface vessel On the networking side, I configured the program to use UDP multicast for distribution of the PDUs across
(Entity 1) and a Triton-class surface vessel (Entity 2) from the dis entities list. multiple participants in the simulation. I did this to attempt to create the
I assigned Entity 1 to the friendly force and Entity 2 to the enemy force to simulate an adversarial scenario, low-latency communication needed in large-scale simulations, where UDP's minimal overhead is
and I configured a FirePDU for Entity 1 with custom munition settings. On the networking side, I configured the advantageous, and multicast ensures that updates reach all clients at the same time. I also
program to use UDP multicast for distribution of the PDUs across
multiple participants in a simulation environment. This choice was driven by the need for
low-latency communication in large-scale simulations, where UDP's minimal overhead is
advantageous, and multicast ensures that updates reach all participants simultaneously. I also
enabled verbose logging to facilitate debugging. Additionally, I adjusted enabled verbose logging to facilitate debugging. Additionally, I adjusted
the simulation loop to increment Entity 1’s position in each iteration, simulating movement, and set the simulation loop to increment Entity 1’s position in each iteration, simulating movement, and set
the loop to run for a maximum of 10 iterations, with the ability to terminate early if certain the loop to run for a maximum of 10 iterations.
conditions are met. In my opinion, these changes improve the program’s ability to simulate realistic \ No newline at end of file
scenarios while maintaining efficient and responsive network communication.
\ No newline at end of file
annotation.processing.enabled=true annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false annotation.processing.enabled.in.editor=false
annotation.processing.processors.list= annotation.processing.processors.list=
annotation.processing.run.all.processors=true annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.desc=Example programs provided as part of NPS course Networked Graphics MV3500. This course is an introduction to network communications in simulation applications. Topics include an introduction to the TCP/IP protocol stack; TCP/IP socket communications, including TCP, UDP, and multicast; and protocol design issues, with emphasis on Distributed Interactive Simulation (DIS) Protocol and High Level Architecture (HLA). Course emphasis is on creation and testing of network programming network code and web-browser applications. application.desc=Example programs provided as part of NPS course Networked Graphics MV3500. This course is an introduction to network communications in simulation applications. Topics include an introduction to the TCP/IP protocol stack; TCP/IP socket communications, including TCP, UDP, and multicast; and protocol design issues, with emphasis on Distributed Interactive Simulation (DIS) Protocol and High Level Architecture (HLA). Course emphasis is on creation and testing of network programming network code and web-browser applications.
application.homepage=https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/tree/master/examples application.homepage=https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/tree/master/examples
application.splash=..\\..\\NetworkedGraphicsMV3500\\documentation\\images\\OpenDisSurferDude.png application.splash=..\\..\\NetworkedGraphicsMV3500\\documentation\\images\\OpenDisSurferDude.png
application.title=NPS Networked Graphics MV3500 examples application.title=NPS Networked Graphics MV3500 examples
application.vendor=Don Brutzman application.vendor=Don Brutzman
build.classes.dir=${build.dir}/classes build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned: # This directory is removed when the project is cleaned:
build.dir=build build.dir=build
build.generated.dir=${build.dir}/generated build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here: # Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport: # Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket #debug.transport=dt_socket
debug.classpath=\ debug.classpath=\
${run.classpath} ${run.classpath}
debug.modulepath=\ debug.modulepath=\
${run.modulepath} ${run.modulepath}
debug.test.classpath=\ debug.test.classpath=\
${run.test.classpath} ${run.test.classpath}
debug.test.modulepath=\ debug.test.modulepath=\
${run.test.modulepath} ${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar # Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes= dist.archive.excludes=
# This directory is removed when the project is cleaned: # This directory is removed when the project is cleaned:
dist.dir=dist dist.dir=dist
dist.name=Networked_Graphics_MV3500_examples dist.name=Networked_Graphics_MV3500_examples
dist.jar=${dist.dir}/${dist.name}.jar dist.jar=${dist.dir}/${dist.name}.jar
dist.javadoc.dir=${dist.dir}/javadoc dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath= endorsed.classpath=
project.licensePath=../license.txt project.licensePath=../license.txt
viskit.proj.dir=ViskitOpenDis7Examples viskit.proj.dir=ViskitOpenDis7Examples
viskit.proj.lib.dir=src/${viskit.proj.dir}/lib viskit.proj.lib.dir=src/${viskit.proj.dir}/lib
opendis.helper=SimkitOpenDis7Examples.run.OpenDisHelper opendis.helper=SimkitOpenDis7Examples.run.OpenDisHelper
excludes=ViskitOpenDis7Examples/ excludes=ViskitOpenDis7Examples/
file.reference.dis-enums-1.3.jar=../lib/dis-enums-1.3.jar file.reference.dis-enums-1.3.jar=../lib/dis-enums-1.3.jar
file.reference.opendis7-full.jar=../lib/opendis7-full.jar file.reference.opendis7-full.jar=../lib/opendis7-full.jar
file.reference.open-dis_4.16.jar=../lib/open-dis_4.16.jar file.reference.open-dis_4.16.jar=../lib/open-dis_4.16.jar
file.reference.simkit-doc.zip=../lib/simkit-doc.zip file.reference.simkit-doc.zip=../lib/simkit-doc.zip
file.reference.simkit-src.zip=../lib/simkit-src.zip file.reference.simkit-src.zip=../lib/simkit-src.zip
file.reference.simkit.jar=../lib/simkit.jar file.reference.simkit.jar=../lib/simkit.jar
#file.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-classes.jar #file.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-classes.jar
#file.reference.opendis7-pdus-classes.jar=../lib/opendis7-pdus-classes.jar #file.reference.opendis7-pdus-classes.jar=../lib/opendis7-pdus-classes.jar
includes=**/*.java includes=**/*.java
jar.compress=false jar.compress=false
javac.classpath=\ javac.classpath=\
${file.reference.opendis7-full.jar}:\ ${file.reference.opendis7-full.jar}:\
${file.reference.open-dis_4.16.jar}:\ ${file.reference.open-dis_4.16.jar}:\
${file.reference.dis-enums-1.3.jar}:\ ${file.reference.dis-enums-1.3.jar}:\
${file.reference.simkit.jar}:\ ${file.reference.simkit.jar}:\
${file.reference.simkit-doc.zip}:\ ${file.reference.simkit-doc.zip}:\
${file.reference.simkit-src.zip} ${file.reference.simkit-src.zip}
# ${file.reference.opendis7-enumerations-classes.jar}:\ # ${file.reference.opendis7-enumerations-classes.jar}:\
# ${file.reference.opendis7-pdus-classes.jar}:\ # ${file.reference.opendis7-pdus-classes.jar}:\
# Space-separated list of extra javac options # Space-separated list of extra javac options
javac.compilerargs=-Xlint:deprecation -Xlint:unchecked javac.compilerargs=-Xlint:deprecation -Xlint:unchecked
javac.deprecation=false javac.deprecation=false
javac.external.vm=true javac.external.vm=true
javac.modulepath= javac.modulepath=
javac.processormodulepath= javac.processormodulepath=
javac.processorpath=\ javac.processorpath=\
${javac.classpath} ${javac.classpath}
javac.source=22 javac.source=21
javac.target=22 javac.target=21
javac.test.classpath=\ javac.test.classpath=\
${javac.classpath}:\ ${javac.classpath}:\
${build.classes.dir} ${build.classes.dir}
javac.test.modulepath=\ javac.test.modulepath=\
${javac.modulepath} ${javac.modulepath}
javac.test.processorpath=\ javac.test.processorpath=\
${javac.test.classpath} ${javac.test.classpath}
javadoc.additionalparam=-header "NPS Networked Graphics MV3500 Examples" javadoc.additionalparam=-header "NPS Networked Graphics MV3500 Examples"
javadoc.author=true javadoc.author=true
javadoc.encoding=${source.encoding} javadoc.encoding=${source.encoding}
javadoc.html5=false javadoc.html5=false
javadoc.noindex=false javadoc.noindex=false
javadoc.nonavbar=false javadoc.nonavbar=false
javadoc.notree=false javadoc.notree=false
javadoc.private=false javadoc.private=false
#javadoc.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-javadoc.jar #javadoc.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-javadoc.jar
javadoc.splitindex=true javadoc.splitindex=true
javadoc.use=true javadoc.use=true
javadoc.version=false javadoc.version=false
javadoc.windowtitle=MV3500 Examples javadoc.windowtitle=MV3500 Examples
jlink.launcher=false jlink.launcher=false
jlink.launcher.name=Networked_Graphics_MV3500_examples jlink.launcher.name=Networked_Graphics_MV3500_examples
main.class=TcpExamples.TcpExample1Telnet main.class=TcpExamples.TcpExample1Telnet
manifest.file=manifest.mf manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false mkdist.disabled=false
platform.active=default_platform platform.active=JDK_22
run.classpath=\ run.classpath=\
${javac.classpath}:\ ${javac.classpath}:\
${build.classes.dir} ${build.classes.dir}
# Space-separated list of JVM arguments used when running the project. # Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value: # To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs= run.jvmargs=
run.modulepath=\ run.modulepath=\
${javac.modulepath} ${javac.modulepath}
run.test.classpath=\ run.test.classpath=\
${javac.test.classpath}:\ ${javac.test.classpath}:\
${build.test.classes.dir} ${build.test.classes.dir}
run.test.modulepath=\ run.test.modulepath=\
${javac.test.modulepath} ${javac.test.modulepath}
source.encoding=UTF-8 source.encoding=UTF-8
#source.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-source.jar #source.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-source.jar
src.dir=src src.dir=src
src.src.dir=otherProjects\\DisDemo\\src src.src.dir=otherProjects\\DisDemo\\src
src.src2.dir=otherProjects\\DisShooting\\src src.src2.dir=otherProjects\\DisShooting\\src
src.src3.dir=otherProjects\\WebSocketGateway\\src src.src3.dir=otherProjects\\WebSocketGateway\\src
#src.src4.dir=otherProjects\\BasicServletDemo\\src #src.src4.dir=otherProjects\\BasicServletDemo\\src
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