Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NetworkedGraphicsMV3500
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Savage
NetworkedGraphicsMV3500
Commits
c9702148
Commit
c9702148
authored
4 years ago
by
brutzman
Browse files
Options
Downloads
Patches
Plain Diff
add comments in class
parent
8af36c05
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/src/OpenDis7Examples/ExampleSimulationProgram.java
+10
-5
10 additions, 5 deletions
examples/src/OpenDis7Examples/ExampleSimulationProgram.java
examples/src/OpenDis7Examples/ExampleSimulationProgramOutput.txt
+16
-16
16 additions, 16 deletions
...s/src/OpenDis7Examples/ExampleSimulationProgramOutput.txt
with
26 additions
and
21 deletions
examples/src/OpenDis7Examples/ExampleSimulationProgram.java
+
10
−
5
View file @
c9702148
...
...
@@ -33,7 +33,7 @@ public class ExampleSimulationProgram
*/
public
ExampleSimulationProgram
()
{
// Under consideration.
// Under consideration.
Constructor is not currently needed.
}
/**
...
...
@@ -197,7 +197,7 @@ public class ExampleSimulationProgram
}
/**
*
Us
er-modifiable method for defining and running a simulation.
*
Programm
er-modifiable method for defining and running a
new
simulation
of interest
.
* Support include DIS EntityStatePdu, FirePdu and CommentPdu all available for
* modification and sending in a simulation loop.
*/
...
...
@@ -212,6 +212,8 @@ public class ExampleSimulationProgram
VariableRecordType
narrativeType
=
VariableRecordType
.
OTHER
;
// of potential use
boolean
simulationComplete
=
false
;
// sentinel variable as termination condition
// TODO reset clock to zero each time for consistent outputs.
// your model setup: who's who in this zoo?
// create PDU objects and set their values
...
...
@@ -222,8 +224,9 @@ public class ExampleSimulationProgram
entityStatePdu
.
setEntityID
(
entityID_1
);
FirePdu
firePdu
=
pduFactory
.
makeFirePdu
();
// should we customize this munition? what is it for your simulation?
while
(
loopCount
<
MAX_LOOP_COUNT
)
// loop while allowed, can set additional conditions to break
while
(
loopCount
<
MAX_LOOP_COUNT
)
// loop
the simulation
while allowed, can set additional conditions to break
{
String
narrativeMessage1
,
narrativeMessage2
,
narrativeMessage3
;
// initialize loop variables
...
...
@@ -234,6 +237,7 @@ public class ExampleSimulationProgram
// compute a track, update an ESPDU, whatever it is that your model is doing...
// Where is my entity?
entityStatePdu
.
getEntityLocation
().
setX
(
entityStatePdu
.
getEntityLocation
().
getX
()
+
1.0
);
// 1m per timestep
// decide whether to fire, and then update the firePdu. Hmmm, you might want a target to shoort at!
...
...
@@ -249,7 +253,7 @@ public class ExampleSimulationProgram
narrativeMessage2
=
"runSimulation() loop "
+
loopCount
;
narrativeMessage3
=
""
;
// intentionally blank for testing
// your loop termination condition
// your loop termination condition
goes here
if
(
loopCount
>
4
)
// for example
{
simulationComplete
=
true
;
...
...
@@ -258,7 +262,8 @@ public class ExampleSimulationProgram
// =============================================================================================
// keep track of timestep: wait duration for elapsed time in this loop
Thread
.
sleep
((
long
)(
LOOP_DURATION_SECONDS
*
1000
));
// seconds * (1000 msec/sec) = seconds
// Thread.sleep needs a (long) parameter for milliseconds, which are clumsy to use sometimes
Thread
.
sleep
((
long
)(
LOOP_DURATION_SECONDS
*
1000
));
// seconds * (1000 msec/sec) = milliseconds
System
.
out
.
println
(
"... Pausing for "
+
LOOP_DURATION_SECONDS
+
" seconds"
);
// send the status PDUs for this loop and continue
...
...
This diff is collapsed.
Click to expand it.
examples/src/OpenDis7Examples/ExampleSimulationProgramOutput.txt
+
16
−
16
View file @
c9702148
...
...
@@ -12,33 +12,33 @@ run-single:
Network confirmation: address=239.1.2.3 port=3000
... Pausing for 1.0 seconds
sending PDUs for simulation step 1, monitor loopback to confirm sent
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 1. received DISPDUType 1 ENTITY_STATE (timestamp
05:30:08
, size 144 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 2. received DISPDUType 2 FIRE (timestamp
05
:3
0
:1
2
, size 96 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 3. received DISPDUType 22 COMMENT (timestamp
05:54
:1
2
, size 104 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 1. received DISPDUType 1 ENTITY_STATE (timestamp
19:36:11
, size 144 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 2. received DISPDUType 2 FIRE (timestamp
19
:3
6
:1
8
, size 96 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 3. received DISPDUType 22 COMMENT (timestamp
20:00
:1
3
, size 104 bytes)
... PDUs successfully sent
... Pausing for 1.0 seconds
sending PDUs for simulation step 2, monitor loopback to confirm sent
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 4. received DISPDUType 1 ENTITY_STATE (timestamp
05:30:08
, size 144 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 5. received DISPDUType 2 FIRE (timestamp
05
:3
0
:1
2
, size 96 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 6. received DISPDUType 22 COMMENT (timestamp
06:20:07
, size 104 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 4. received DISPDUType 1 ENTITY_STATE (timestamp
19:36:11
, size 144 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 5. received DISPDUType 2 FIRE (timestamp
19
:3
6
:1
8
, size 96 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 6. received DISPDUType 22 COMMENT (timestamp
20:26:12
, size 104 bytes)
... PDUs successfully sent
... Pausing for 1.0 seconds
sending PDUs for simulation step 3, monitor loopback to confirm sent
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 7. received DISPDUType 1 ENTITY_STATE (timestamp
05:30:08
, size 144 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 8. received DISPDUType 2 FIRE (timestamp
05
:3
0
:1
2
, size 96 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 9. received DISPDUType 22 COMMENT (timestamp
06:46
:0
2
, size 104 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 7. received DISPDUType 1 ENTITY_STATE (timestamp
19:36:11
, size 144 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 8. received DISPDUType 2 FIRE (timestamp
19
:3
6
:1
8
, size 96 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 9. received DISPDUType 22 COMMENT (timestamp
20:52
:0
9
, size 104 bytes)
... PDUs successfully sent
... Pausing for 1.0 seconds
sending PDUs for simulation step 4, monitor loopback to confirm sent
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 10. received DISPDUType 1 ENTITY_STATE (timestamp
05:30:08
, size 144 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 11. received DISPDUType 2 FIRE (timestamp
05
:3
0
:1
2
, size 96 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 12. received DISPDUType 22 COMMENT (timestamp
07:11:55
, size 104 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 10. received DISPDUType 1 ENTITY_STATE (timestamp
19:36:11
, size 144 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 11. received DISPDUType 2 FIRE (timestamp
19
:3
6
:1
8
, size 96 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 12. received DISPDUType 22 COMMENT (timestamp
21:18:03
, size 104 bytes)
... PDUs successfully sent
... Pausing for 1.0 seconds
sending PDUs for simulation step 5, monitor loopback to confirm sent
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 13. received DISPDUType 1 ENTITY_STATE (timestamp
05:30:08
, size 144 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 14. received DISPDUType 2 FIRE (timestamp
05
:3
0
:1
2
, size 96 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 15. received DISPDUType 22 COMMENT (timestamp
07:37:4
9, size 104 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 13. received DISPDUType 1 ENTITY_STATE (timestamp
19:36:11
, size 144 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 14. received DISPDUType 2 FIRE (timestamp
19
:3
6
:1
8
, size 96 bytes)
[edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface] 15. received DISPDUType 22 COMMENT (timestamp
21:43:5
9, size 104 bytes)
... PDUs successfully sent
... Termination condition met, simulationComplete=true
BUILD SUCCESSFUL (total time:
8
seconds)
BUILD SUCCESSFUL (total time:
10
seconds)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment