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

updated build, DisTime revisions

parent 60f81fe2
No related branches found
No related tags found
No related merge requests found
......@@ -152,6 +152,7 @@ public class ExampleSimulationProgram
// 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 your reports: narrative code for CommentPdu here (set all to empty strings to avoid sending)
......@@ -175,15 +176,18 @@ public class ExampleSimulationProgram
// OK now send the status PDUs for this loop, and then continue
System.out.println ("sending PDUs for simulation step " + simulationLoopCount + ", monitor loopback to confirm sent");
System.out.flush();
sendAllPdusForLoopTimestep(entityStatePdu_1, firePdu_1a, currentTimeStepComment, narrativeMessage1, narrativeMessage2, narrativeMessage3);
sendSinglePdu(entityStatePdu_2); // me too i.e. 2!
System.out.println ("... [PDUs 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;
}
} // end of simulation loop
......@@ -409,7 +413,10 @@ public class ExampleSimulationProgram
CommentPdu commentPdu = pduFactory.makeCommentPdu(commentType, newCommentsList.toArray(new String[0])); // comments);
sendSinglePdu(commentPdu);
if (isVerboseComments())
{
System.out.println("*** [Narrative comment sent: " + commentType.name() + "] " + newCommentsList.toString());
System.out.flush();
}
}
}
}
......
......@@ -61,7 +61,7 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
boolean simulationComplete = false; // sentinel variable as termination condition, are we done yet?
// TODO reset Clock Time to today's date and timestamp to zero, providing consistent outputs for each simulation run
DisTime.setEpochCurrentTimestamp();
DisTime.setEpochLvcNow();
simulationTime = initialTime - currentTimeStep; // pre-initialization for first loop
initializeSimulationEntities();
......
......@@ -51,6 +51,7 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
......@@ -876,8 +877,10 @@ public class PduTrack
pduTrack.setDefaultWaypointInterval(1.0f); // experimentation with timestamp values
// DisTime.setInitialTimestampEpoch(DisTime.getCurrentDisAbsoluteTimestamp()); // TODO testing
int epoch = DisTime.getEpoch();
System.out.println(TRACE_PREFIX + "DisTime.getInitialTimestampEpoch()=" + epoch + " (" + DisTime.convertToString(epoch) + ")");
Instant epoch = DisTime.getEpochLvc();
System.out.println(TRACE_PREFIX + "DisTime.hasEpochLvc()=" + DisTime.hasEpochLvc() +
", DisTime.getEpochLvc()=" + epoch +
", Instant.now()=" + Instant.now());
EntityID entityID_123 = new EntityID();
entityID_123.setSiteID(1).setApplicationID(2).setEntityID(3); // made-up example ID;
......
This diff is collapsed.
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