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

Merge origin/master

parents 8f40a6ae 5561076f
No related branches found
No related tags found
No related merge requests found
Showing
with 1569 additions and 724 deletions
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.desc=Student assignments performed 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/assignments
application.splash=../..\\NetworkedGraphicsMV3500\\documentation\\images\\OpenDisSurferDude.png
application.title=NPS Networked Graphics MV3500 assignments
application.vendor=Don Brutzman
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar
# Avoid compilation or inclusion of student project depending on mutex libraries only available in JDK8
# https://stackoverflow.com/questions/27906896/exclude-package-from-build-but-not-from-view-in-netbeans-8
excludes=**/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/**
dist.archive.excludes=**/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/**
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Networked_Graphics_MV3500_assignments.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
file.reference.dis-enums-1.3.jar=../lib/dis-enums-1.3.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.simkit-doc.zip=../lib/simkit-doc.zip
file.reference.simkit-src.zip=../lib/simkit-src.zip
file.reference.simkit.jar=../lib/simkit.jar
#file.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-classes.jar
#file.reference.opendis7-pdus-classes.jar=../lib/opendis7-pdus-classes.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${file.reference.opendis7-full.jar}:\
${file.reference.dis-enums-1.3.jar}:\
${file.reference.open-dis_4.16.jar}:\
${file.reference.simkit-doc.zip}:\
${file.reference.simkit-src.zip}:\
${file.reference.simkit.jar}
# ${file.reference.opendis7-enumerations-classes.jar}:\
# ${file.reference.opendis7-pdus-classes.jar}:\
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:deprecation -Xlint:unchecked
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=20
javac.target=20
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=-header "NPS Networked Graphics MV3500 Assignments"
javadoc.author=true
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
#javadoc.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-javadoc.jar
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=MV3500 Assignments
jlink.launcher=false
jlink.launcher.name=Networked_Graphics_MV3500_assignments
jnlp.codebase.type=no.codebase
jnlp.descriptor=application
jnlp.enabled=false
jnlp.mixed.code=default
jnlp.offline-allowed=false
jnlp.signed=false
jnlp.signing=
jnlp.signing.alias=
jnlp.signing.keystore=
# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found.
manifest.custom.application.library.allowable.codebase=
# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts.
manifest.custom.caller.allowable.codebase=
# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed
manifest.custom.codebase=
# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions)
manifest.custom.permissions=
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=JDK_22
project.licensePath=../license.txt
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# 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.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
#source.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-source.jar
src.dir=src
test.src.dir=test
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.desc=Student assignments performed 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/assignments
application.splash=../..\\NetworkedGraphicsMV3500\\documentation\\images\\OpenDisSurferDude.png
application.title=NPS Networked Graphics MV3500 assignments
application.vendor=Don Brutzman
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar
# Avoid compilation or inclusion of student project depending on mutex libraries only available in JDK8
# https://stackoverflow.com/questions/27906896/exclude-package-from-build-but-not-from-view-in-netbeans-8
excludes=**/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/**
dist.archive.excludes=**/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/**
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Networked_Graphics_MV3500_assignments.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
file.reference.dis-enums-1.3.jar=../lib/dis-enums-1.3.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.simkit-doc.zip=../lib/simkit-doc.zip
file.reference.simkit-src.zip=../lib/simkit-src.zip
file.reference.simkit.jar=../lib/simkit.jar
#file.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-classes.jar
#file.reference.opendis7-pdus-classes.jar=../lib/opendis7-pdus-classes.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${file.reference.opendis7-full.jar}:\
${file.reference.dis-enums-1.3.jar}:\
${file.reference.open-dis_4.16.jar}:\
${file.reference.simkit-doc.zip}:\
${file.reference.simkit-src.zip}:\
${file.reference.simkit.jar}
# ${file.reference.opendis7-enumerations-classes.jar}:\
# ${file.reference.opendis7-pdus-classes.jar}:\
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:deprecation -Xlint:unchecked
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=20
javac.target=20
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=-header "NPS Networked Graphics MV3500 Assignments"
javadoc.author=true
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
#javadoc.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-javadoc.jar
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=MV3500 Assignments
jlink.launcher=false
jlink.launcher.name=Networked_Graphics_MV3500_assignments
jnlp.codebase.type=no.codebase
jnlp.descriptor=application
jnlp.enabled=false
jnlp.mixed.code=default
jnlp.offline-allowed=false
jnlp.signed=false
jnlp.signing=
jnlp.signing.alias=
jnlp.signing.keystore=
# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found.
manifest.custom.application.library.allowable.codebase=
# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts.
manifest.custom.caller.allowable.codebase=
# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed
manifest.custom.codebase=
# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions)
manifest.custom.permissions=
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
project.licensePath=../license.txt
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# 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.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
#source.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-source.jar
src.dir=src
test.src.dir=test
......@@ -7,7 +7,7 @@ import java.time.DayOfWeek;
//import java.time.LocalTime; // conversion?
/**
* This client program establishes a socket connection to the {@link RomeroServerHW2},
* This client program establishes a socket connection to the RomeroServerHW2,
* then checks how long it takes to read the single line it expects as a server response.
*
* @author Don McGregor
......
......@@ -5,7 +5,7 @@ import java.net.*;
/**
* <p>
* This utility class supports the {@link RomeroServerHW2} program,
* This utility class supports the RomeroServerHW2 program,
* handling all programming logic needed for a new socket connection
* to run in a thread of its own. This is the server
* portion as well, so we artificially invent what happens
......@@ -43,7 +43,6 @@ public class RomeroHandlerThreadHW2 extends Thread
}
/** Handles one connection
* @overriding run() method in Java Thread class is deliberate
*/
@Override
public void run()
......
......@@ -3,7 +3,7 @@
* 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;
package MV3500Cohort2024JulySeptember.homework3.Bavlsik;
import edu.nps.moves.dis7.entities.swe.platform.surface._001Poseidon;
import edu.nps.moves.dis7.entities.swe.platform.surface._002Triton;
......@@ -25,7 +25,7 @@ import java.util.logging.Logger;
* @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
public class BavlsikSimulationProgram
{
/* **************************** infrastructure code, modification is seldom needed ************************* */
......@@ -72,7 +72,7 @@ public class ExampleSimulationProgram
*/
// base constructor is not invoked automatically by other constructors
// https://stackoverflow.com/questions/581873/best-way-to-handle-multiple-constructors-in-java
public ExampleSimulationProgram()
public BavlsikSimulationProgram()
{
initialize();
}
......@@ -80,7 +80,7 @@ public class ExampleSimulationProgram
* Constructor to create an instance of this class.
* @param newDescriptor describes this program, useful for logging and debugging
*/
public ExampleSimulationProgram(String newDescriptor)
public BavlsikSimulationProgram(String newDescriptor)
{
descriptor = newDescriptor;
initialize();
......@@ -90,7 +90,7 @@ public class ExampleSimulationProgram
* @param address network address to use
* @param port corresponding network port to use
*/
public ExampleSimulationProgram(String address, int port)
public BavlsikSimulationProgram(String address, int port)
{
disChannel.setNetworkAddress (address);
disChannel.setNetworkPort (port);
......@@ -299,7 +299,7 @@ public class ExampleSimulationProgram
}
catch (InterruptedException iex) // handle any exception that your code might choose to provoke!
{
Logger.getLogger(ExampleSimulationProgram.class.getSimpleName()).log(Level.SEVERE, null, iex);
Logger.getLogger(BavlsikSimulationProgram.class.getSimpleName()).log(Level.SEVERE, null, iex);
}
}
......@@ -386,7 +386,7 @@ public class ExampleSimulationProgram
}
/** Locally instantiable copy of program, can be subclassed. */
protected static ExampleSimulationProgram thisProgram;
protected static BavlsikSimulationProgram thisProgram;
/**
* Main method is first executed when a program instance is loaded.
......@@ -396,7 +396,7 @@ public class ExampleSimulationProgram
*/
public static void main(String[] args)
{
thisProgram = new ExampleSimulationProgram("test constructor"); // create instance of self within static main() method
thisProgram = new BavlsikSimulationProgram("test constructor"); // create instance of self within static main() method
thisProgram.disChannel.printlnTRACE("main() started...");
......
## Homework 3: Example Simulation Recording using OpenDIS Network Streams
<!-- Viewable at https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/assignments/src/MV3500Cohort2024JulySeptember/homework3/README.md -->
### Assignment
1. Adapt the functionality for [OpenDIS ExampleSimulationProgram](../../../../examples/src/OpenDis7Examples/ExampleSimulationProgram.java), modifying provided code
2. Experiment with the enumeration values that set up each entity and PDU. What works for you? What makes sense for your future work?
3. Adapt or replace the UML diagrams to describe what you have going on.
4. Record, save and replay your result stream using [PduRecorder](https://savage.nps.edu/opendis7-java/javadoc/edu/nps/moves/dis7/utilities/stream/PduRecorder.html) or [Wireshark](https://www.wireshark.org)
* see local [assignments/src/pduLog](../../../pduLog) subdirectory for latest opendis log files
* Coming soon, we will also (again have) [X3D-Edit](https://savage.nps.edu/X3D-Edit) for DIS stream recording/replay
5. Observe good-practice conventions in the [assignments README](../../../README.md) and [current-course README](../README.md) instructions.
This assignment presents a Problem Prototyping opportunity.
While some minimal functionality is expected, the general outline of
a networking problem and proposed solution holds great interest.
Think of it as warmup preparation for your future work.
This is also a freeplay opportunity.
You have the option to pick one or more of the provided course example programs
and adapt the source to demonstrate a new client-server handshake protocol of interest.
Be sure to provide a rationale that justifies why the networking choices you made
(TCP/UDP, unicast/multicast, etc.) are the best for the problem you are addressing.
You may find that the prior [homework2 README](../homework2/README.md) still provides
helpful details on what specific deliverables are expected in each homework assignment.
Team efforts are encouraged, though if you choose a team approach be sure to justify why.
This is a good warmup prior to final projects. Have fun with Java networking!
### Prior Assignment, August 2019
In 2019, students worked together on a single project to check wireless multicast connectivity recently deployed on NPS campus.
See their experimental results in the [NPS Multicast Connectivity Report](../../MV3500Cohort2019JulySeptember/homework3).
/**
* 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.Bavlsik;
## Homework 3: Example Simulation Recording using OpenDIS Network Streams
<!-- Viewable at https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/assignments/src/MV3500Cohort2024JulySeptember/homework3/README.md -->
### Assignment
1. Adapt the functionality for [OpenDIS ExampleSimulationProgram](../../../../examples/src/OpenDis7Examples/ExampleSimulationProgram.java), modifying provided code
2. Experiment with the enumeration values that set up each entity and PDU. What works for you? What makes sense for your future work?
3. Adapt or replace the UML diagrams to describe what you have going on.
4. Record, save and replay your result stream using [PduRecorder](https://savage.nps.edu/opendis7-java/javadoc/edu/nps/moves/dis7/utilities/stream/PduRecorder.html) or [Wireshark](https://www.wireshark.org)
* see local [assignments/src/pduLog](../../../pduLog) subdirectory for latest opendis log files
* Coming soon, we will also (again have) [X3D-Edit](https://savage.nps.edu/X3D-Edit) for DIS stream recording/replay
5. Observe good-practice conventions in the [assignments README](../../../README.md) and [current-course README](../README.md) instructions.
This assignment presents a Problem Prototyping opportunity.
While some minimal functionality is expected, the general outline of
a networking problem and proposed solution holds great interest.
Think of it as warmup preparation for your future work.
This is also a freeplay opportunity.
You have the option to pick one or more of the provided course example programs
and adapt the source to demonstrate a new client-server handshake protocol of interest.
Be sure to provide a rationale that justifies why the networking choices you made
(TCP/UDP, unicast/multicast, etc.) are the best for the problem you are addressing.
You may find that the prior [homework2 README](../homework2/README.md) still provides
helpful details on what specific deliverables are expected in each homework assignment.
Team efforts are encouraged, though if you choose a team approach be sure to justify why.
This is a good warmup prior to final projects. Have fun with Java networking!
### Prior Assignment, August 2019
In 2019, students worked together on a single project to check wireless multicast connectivity recently deployed on NPS campus.
See their experimental results in the [NPS Multicast Connectivity Report](../../MV3500Cohort2019JulySeptember/homework3).
/**
* 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.Lennon;
......@@ -4,9 +4,24 @@
## Description
Modification to ...
Assigment 3, show a simple Modeling & Simulation loop.
- "Add DIS outputs (general skills)"
<!--
Assigment 4
- Show use of Simkit, DIS and Viskit together.
Final essay
- What do you think?
"And you get to use the word networking and combination, whatever else interest you,
you know, thesis, challenging for my warfare community cell phone, thinking about international partnerships".
<!--
Phrases taken from: <b>https://www.divein.com/everyday/monday-motivation-quotes/</b>
......
......@@ -8,7 +8,6 @@
*/
package MV3500Cohort2024JulySeptember.homework3.Williams;
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.*;
......@@ -25,9 +24,9 @@ import java.util.logging.Logger;
* tasks of interest, and then reporting activity via PDUs to the network.
* Default program initialization includes PDU recording turned on by default.
*
* Homework 3 Networking choices:
* Homework 3 networking choices:
* This simulation uses UDP multicast for efficient distribution of PDUs to
* multiple participants, which is suitable for large-scale simulations where
* multiple participants, which is great for large-scale simulations where
* state updates need to reach all networked participants. UDP is chosen over
* TCP due to its lower latency, which is essential for real-time simulations.
*
......@@ -39,65 +38,38 @@ import java.util.logging.Logger;
*/
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 */
private double simulationTimeStepDuration = 1.0;
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;
/**
* 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.
*/
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);
......@@ -108,9 +80,6 @@ public class ExampleSimulationProgram
initialize();
}
/** Initialize channel setup for OpenDis7 and report a test PDU
* @see initializeDisChannel
* @see initializeSimulationEntities */
private void initialize()
{
initializeDisChannel();
......@@ -122,7 +91,6 @@ public class ExampleSimulationProgram
disChannel.sendCommentPdu(simulationTimeSeconds, DisChannel.COMMENTPDU_SIMULATION_TIMESTEP, timeStepMessage);
}
/** Initialize channel setup for OpenDis7 and report a test PDU */
private void initializeDisChannel()
{
if (disChannel == null)
......@@ -143,8 +111,6 @@ public class ExampleSimulationProgram
disChannel.getPduRecorder().setVerbose(true);
}
/** Initialize simulation entities.
*/
public void initializeSimulationEntities()
{
if (pduFactory == null)
......@@ -155,30 +121,31 @@ public class ExampleSimulationProgram
firePdu_1b = pduFactory.makeFirePdu();
munitionDescriptor1 = new MunitionDescriptor();
// Define participants
entityID_1.setSiteID(1).setApplicationID(2).setEntityID(3);
entityID_1.setSiteID((int)(Math.random() * 100))
.setApplicationID((int)(Math.random() * 100))
.setEntityID((int)(Math.random() * 100));
disChannel.addEntity(entityID_1);
entityID_2.setSiteID(1).setApplicationID(2).setEntityID(4);
entityID_2.setSiteID((int)(Math.random() * 100))
.setApplicationID((int)(Math.random() * 100))
.setEntityID((int)(Math.random() * 100));
disChannel.addEntity(entityID_2);
entityStatePdu_1.setEntityID(entityID_1);
entityStatePdu_1.setForceId(ForceID.FRIENDLY);
entityStatePdu_1.setEntityType(new _001Poseidon());
entityStatePdu_1.setMarking("Entity #53");
entityStatePdu_1.setMarking("Ethan's Poseidon #1");
entityStatePdu_2.setEntityID(entityID_2);
entityStatePdu_2.setForceId(ForceID.OPPOSING);
entityStatePdu_2.setEntityType(new _002Triton());
entityStatePdu_2.setMarking("Entity #2");
entityStatePdu_2.setMarking("Ethan's Triton #2");
munitionDescriptor1.setQuantity(1);
firePdu_1a.setDescriptor(munitionDescriptor1).setRange(1000.0f);
}
/**
* This runSimulationLoops() method is customizable for running new simulations.
*/
@SuppressWarnings("SleepWhileInLoop")
public void runSimulationLoops ()
{
......@@ -195,13 +162,14 @@ public class ExampleSimulationProgram
{
simulationLoopCount++;
entityStatePdu_1.getEntityLocation().setX(entityStatePdu_1.getEntityLocation().getX() + 1.0);
entityStatePdu_1.getEntityLocation().setX(entityStatePdu_1.getEntityLocation().getX() + (Math.random() * 2));
System.out.println ("... My simulation just did something...");
System.out.flush();
narrativeMessage1 = "MV3500 ExampleSimulationProgram";
narrativeMessage2 = "runSimulation() loop " + simulationLoopCount;
narrativeMessage1 = "Ethan's Custom Simulation Program";
narrativeMessage2 = "Loop " + simulationLoopCount + " - MV3500 Custom Version";
narrativeMessage3 = "Simulation developed by Ethan Williams";
if (simulationLoopCount > MAX_LOOP_COUNT)
{
......@@ -242,14 +210,6 @@ public class ExampleSimulationProgram
}
}
/**
* Send EntityState, Fire, Comment PDUs for this loop.
* @param simTimeSeconds simulation time in seconds
* @param entityStatePdu the ESPDU to send
* @param firePdu the FirePDU to send
* @param commentType enumeration value describing purpose of the narrative comment PDU
* @param comments String array of narrative comments
*/
public void sendAllPdusForLoopTimestep(double simTimeSeconds,
EntityStatePdu entityStatePdu,
FirePdu firePdu,
......@@ -265,10 +225,6 @@ public class ExampleSimulationProgram
disChannel.sendCommentPdu(simTimeSeconds, commentType, comments);
}
/**
* 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)
{
if (args.length == 2)
......@@ -285,47 +241,26 @@ public class ExampleSimulationProgram
}
}
/**
* Get simple descriptor for this network interface, used in trace statements
* @return simple descriptor name
*/
public String getDescriptor() {
return descriptor;
}
/**
* Set new simple descriptor 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.
* @param args command-line parameters: network address and port.
*/
public static void main(String[] args)
{
thisProgram = new ExampleSimulationProgram("test constructor");
......@@ -342,4 +277,4 @@ public class ExampleSimulationProgram
System.exit(0);
}
}
\ No newline at end of file
}
For Homework 3, I modified the OpenDIS ExampleSimulationProgram to enhance its functionality
by experimenting with entity enumeration values and adjusting the network communication setup.
On the networking side, I configured the program to use UDP multicast for distribution of the PDUs across
multiple participants in the simulation. I did this to attempt to create the
low-latency communication needed in large-scale simulations, where UDP's minimal overhead is
advantageous, and multicast ensures that updates reach all clients at the same time. I also
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 loop to run for a maximum of 10 iterations.
\ No newline at end of file
For Homework 3, I altered the ExampleSimulationProgram by randomizing the entity IDs
and I also introduced randomized movement patterns for the entities during the simulation loop.
These changes make the simulation more realistic and ensuring variability in each run.
\ No newline at end of file
......@@ -17,19 +17,20 @@ common.run.args=-Xmx256m \
win.run.args=${common.run.args}
run.arg1=-Dawt.useSystemAAFontSettings=gasp
unix.run.args=${common.run.args} ${run.arg1}
unix.run.args=${common.run.args} \
-Dawt.useSystemAAFontSettings=gasp
run.arg2=-Dapple.awt.graphics.UseQuartz=true \
mac.run.args=${common.run.args} \
-Dapple.awt.graphics.UseQuartz=true \
-Dapple.laf.useScreenMenuBar=true \
-Dapple.awt.brushMetalLook=true \
-Xdock:name=${product.shortname} \
--add-exports java.desktop/com.apple.eawt=ALL-UNNAMED
mac.run.args=${common.run.args} ${run.arg2}
# property used to identify Viskit config files
dot.viskit.dir=${user.home}/.${product.shortname}
c_app.xml=${viskit.dir}/configuration/c_app.xml
c_gui.xml=${viskit.dir}/configuration/c_gui.xml
proj.xml=${viskit.dir}/configuration/viskitProject.xml
splash.image=${viskit.dir}/configuration/ViskitSplash2.png
......@@ -319,7 +319,7 @@ POSSIBILITY OF SUCH DAMAGE.
<copy todir ="${dot.viskit.dir}" file="${c_gui.xml}"/>
</target>
<target name="reset.viskit" description="clear an out of synch configuration and metadata directory - only when necessary">
<target name="reset.viskit" description="Replace an out-of-synch configuration with known good defaults - only when necessary">
<echo message="Reset user's Viskit configuration files in ${dot.viskit.dir}"/>
<delete includeemptydirs="yes" dir="${dot.viskit.dir}"/>
<mkdir dir="${dot.viskit.dir}"/>
......@@ -327,6 +327,7 @@ POSSIBILITY OF SUCH DAMAGE.
<!-- ${c_app.xml} and ${c_gui.xml} are properties in the build.properties definitions -->
<copy todir="${dot.viskit.dir}" file="${c_app.xml}" verbose="true"/>
<copy todir="${dot.viskit.dir}" file="${c_gui.xml}" verbose="true"/>
<copy todir="examples/src/ViskitOpenDis7Examples" file="${proj.xml}" overwrite="true"/>
</target>
</project>
\ No newline at end of file
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
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.homepage=https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/tree/master/examples
application.splash=..\\..\\NetworkedGraphicsMV3500\\documentation\\images\\OpenDisSurferDude.png
application.title=NPS Networked Graphics MV3500 examples
application.vendor=Don Brutzman
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.name=Networked_Graphics_MV3500_examples
dist.jar=${dist.dir}/${dist.name}.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
project.licensePath=../license.txt
viskit.proj.dir=ViskitOpenDis7Examples
viskit.proj.lib.dir=src/${viskit.proj.dir}/lib
opendis.helper=SimkitOpenDis7Examples.run.OpenDisHelper
excludes=ViskitOpenDis7Examples/
file.reference.dis-enums-1.3.jar=../lib/dis-enums-1.3.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.simkit-doc.zip=../lib/simkit-doc.zip
file.reference.simkit-src.zip=../lib/simkit-src.zip
file.reference.simkit.jar=../lib/simkit.jar
#file.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-classes.jar
#file.reference.opendis7-pdus-classes.jar=../lib/opendis7-pdus-classes.jar
includes=**/*.java
jar.compress=false
javac.classpath=\
${file.reference.opendis7-full.jar}:\
${file.reference.open-dis_4.16.jar}:\
${file.reference.dis-enums-1.3.jar}:\
${file.reference.simkit.jar}:\
${file.reference.simkit-doc.zip}:\
${file.reference.simkit-src.zip}
# ${file.reference.opendis7-enumerations-classes.jar}:\
# ${file.reference.opendis7-pdus-classes.jar}:\
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:deprecation -Xlint:unchecked
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=21
javac.target=21
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=-header "NPS Networked Graphics MV3500 Examples"
javadoc.author=true
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
#javadoc.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-javadoc.jar
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=MV3500 Examples
jlink.launcher=false
jlink.launcher.name=Networked_Graphics_MV3500_examples
main.class=TcpExamples.TcpExample1Telnet
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=JDK_22
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# 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.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
#source.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-source.jar
src.dir=src
src.src.dir=otherProjects\\DisDemo\\src
src.src2.dir=otherProjects\\DisShooting\\src
src.src3.dir=otherProjects\\WebSocketGateway\\src
#src.src4.dir=otherProjects\\BasicServletDemo\\src
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
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.homepage=https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/tree/master/examples
application.splash=..\\..\\NetworkedGraphicsMV3500\\documentation\\images\\OpenDisSurferDude.png
application.title=NPS Networked Graphics MV3500 examples
application.vendor=Don Brutzman
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.name=Networked_Graphics_MV3500_examples
dist.jar=${dist.dir}/${dist.name}.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
project.licensePath=../license.txt
viskit.proj.dir=ViskitOpenDis7Examples
viskit.proj.lib.dir=src/${viskit.proj.dir}/lib
opendis.helper=SimkitOpenDis7Examples.run.OpenDisHelper
excludes=ViskitOpenDis7Examples/
file.reference.dis-enums-1.3.jar=../lib/dis-enums-1.3.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.simkit-doc.zip=../lib/simkit-doc.zip
file.reference.simkit-src.zip=../lib/simkit-src.zip
file.reference.simkit.jar=../lib/simkit.jar
#file.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-classes.jar
#file.reference.opendis7-pdus-classes.jar=../lib/opendis7-pdus-classes.jar
includes=**/*.java
jar.compress=false
javac.classpath=\
${file.reference.opendis7-full.jar}:\
${file.reference.open-dis_4.16.jar}:\
${file.reference.dis-enums-1.3.jar}:\
${file.reference.simkit.jar}:\
${file.reference.simkit-doc.zip}:\
${file.reference.simkit-src.zip}
# ${file.reference.opendis7-enumerations-classes.jar}:\
# ${file.reference.opendis7-pdus-classes.jar}:\
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:deprecation -Xlint:unchecked
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=21
javac.target=21
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=-header "NPS Networked Graphics MV3500 Examples"
javadoc.author=true
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
#javadoc.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-javadoc.jar
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=MV3500 Examples
jlink.launcher=false
jlink.launcher.name=Networked_Graphics_MV3500_examples
main.class=TcpExamples.TcpExample1Telnet
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# 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.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
#source.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-source.jar
src.dir=src
src.src.dir=otherProjects\\DisDemo\\src
src.src2.dir=otherProjects\\DisShooting\\src
src.src3.dir=otherProjects\\WebSocketGateway\\src
#src.src4.dir=otherProjects\\BasicServletDemo\\src
......@@ -27,13 +27,13 @@ public class UnicastUdpSender
private static final String MY_NAME = System.getProperty("user.name"); // guru incantation 8)
// public static final int SENDING_PORT = 1414; // not needed, can let system choose an open local port
/** socket value of shared interest */
public static final int UDP_PORT = UnicastUdpReceiver.UDP_PORT; // 1415; ensure consistent
public static final int UDP_PORT = 1415;// ensure consistent
private static final int TOTAL_PACKETS_TO_SEND = 100;
/** socket value of shared interest */
public static final String DESTINATION_HOST = "localhost";
//public static final String DESTINATION_HOST = "localhost";
// here is what we need for lab comms
// public static final String DESTINATION_HOST = "10.1.105.16"; // localhost 127.0.0.1 or argon 10.1.105.1 or 10.1.105.1 or whatever
public static final String DESTINATION_HOST = "127.0.0.1"; // localhost 127.0.0.1 or argon 10.1.105.1 or 10.1.105.1 or whatever
/**
* Program invocation, execution starts here
......@@ -46,7 +46,7 @@ public class UnicastUdpSender
DataOutputStream dos = null;
int packetID = 0; // counter variable to send in packet
float countdown = -1.0f; // unreachable value is good sentinel to ensure expected changes occur
String message = MY_NAME + " says Hello MV3500"; // no really
String message = MY_NAME + " says Hello Professor!"; // no really
String padding = new String();
try
......
......@@ -24,5 +24,6 @@
<PropertyChangeListenerConnection property="N" listener="numArrivalsStat" source="aPOpenDis7" description=""/>
<PropertyChangeListenerConnection property="C" listener="numEntityCreationsStat" source="aPOpenDis7" description=""/>
<PropertyChangeListenerConnection property="R" listener="numEntityRemovalsStat" source="aPOpenDis7" description=""/>
<Output entity="aPOpenDis7"/>
<Schedule stopTime="100.0" verbose="false" saveReplicationData="false"/>
</SimkitAssembly>
......@@ -36,5 +36,7 @@
<PropertyChangeListenerConnection property="numberAvailableServers" listener="numAvailServersStat" source="simpleServer" description=""/>
<PropertyChangeListenerConnection property="numberArrivals" listener="numArrivalsStat" source="arrivalProcessOpenDis7" description=""/>
<PropertyChangeListenerConnection property="numberServed" listener="numServedStat" source="simpleServer" description=""/>
<Output entity="arrivalProcessOpenDis7"/>
<Output entity="simpleServer"/>
<Schedule stopTime="100000.0" verbose="false" saveReplicationData="false"/>
</SimkitAssembly>
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