Skip to content
Snippets Groups Projects
Commit b374550f authored by justi's avatar justi
Browse files

Frank Assignment 3

parent 15627cec
No related branches found
No related tags found
No related merge requests found
package MV3500Cohort2021JulySeptember.homework3.Frank;
import static com.google.common.collect.Multimaps.index;
import edu.nps.moves.dis7.enumerations.VariableRecordType;
import edu.nps.moves.dis7.pdus.CommentPdu;
import edu.nps.moves.dis7.pdus.EntityID;
import edu.nps.moves.dis7.pdus.EntityStatePdu;
import edu.nps.moves.dis7.pdus.FirePdu;
import edu.nps.moves.dis7.pdus.Pdu;
import edu.nps.moves.dis7.pdus.Vector3Double;
import edu.nps.moves.dis7.utilities.CoordinateConversions;
import edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface;
import edu.nps.moves.dis7.utilities.PduFactory;
import edu.nps.moves.dis7.utilities.stream.PduRecorder;
......@@ -20,8 +23,6 @@ import java.util.logging.Logger;
* reporting them to the network. Default settings include PDU recording turned
* on by default.
*/
public class FrankUdpServer {
/**
......@@ -34,6 +35,11 @@ public class FrankUdpServer {
* methods are setup, teardown and configuration that you don't have to
* worry about.
*/
// ICBM coordinates for my office
double latitude = 36.595517;
double longitude = -121.877000;
@SuppressWarnings("SleepWhileInLoop")
public void runSimulation() {
try {
......@@ -41,6 +47,12 @@ public class FrankUdpServer {
* seconds for real-time execution (not simulation time, which may
* or may not be the same)
*/
// ICBM coordinates for my office
double latitude = 36.595517;
double longitude = -121.877000;
final double LOOP_DURATION_SECONDS = 1.0;
final int MAX_LOOP_COUNT = 10; // be deliberate out out there!
int loopCount = 0; // initialized at 0
......@@ -61,9 +73,8 @@ public class FrankUdpServer {
// TODO simulation management PDUs for startup
// loop the simulation while allowed, programmer can set additional conditions to break out and finish
int port = 3000;
MulticastSocket socket = null; // must be i
int port = 3000;
MulticastSocket socket = null; // must be i
socket = new MulticastSocket(port);
while (loopCount < MAX_LOOP_COUNT) // are we done yet?
{
......@@ -125,7 +136,7 @@ public class FrankUdpServer {
} catch (InterruptedException iex) // handle any exception that your code might choose to provoke!
{
Logger.getLogger(FrankUdpServer.class.getName()).log(Level.SEVERE, null, iex);
} catch (Exception ex){
} catch (Exception ex) {
}
}
/* **************************** infrastructure code, modification is seldom needed ************************* */
......@@ -345,9 +356,12 @@ public class FrankUdpServer {
thisProgram.setUpNetworkInterface();
String DEFAULT_OUTPUT_DIRECTORY = "./pduLog";
String outputDirectory = DEFAULT_OUTPUT_DIRECTORY;
System.out.println("Beginning pdu save to directory " + outputDirectory);
//System.out.println(" latitude, longitude: [" + latitude + ", " + longitude + "]");
PduRecorder pduRecorder = new PduRecorder(outputDirectory, networkAddress, networkPort); // assumes save
thisProgram.runSimulation(); // ... your simulation execution code goes in there ...
......
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