Skip to content
Snippets Groups Projects
Commit 3f77bf7c authored by Oblak, William (Maj)'s avatar Oblak, William (Maj)
Browse files

Merge origin/master

parents cc74bca8 1e1a7d57
No related branches found
No related tags found
No related merge requests found
Showing
with 348 additions and 19 deletions
import simkit.SimEntityBase;
import simkit.random.RandomVariate;
import simkit.random.RandomVariateFactory;
public class Customer extends SimEntityBase{
private RandomVariate beefPreference;
private RandomVariate porkPreference;
private RandomVariate chickenPreference;
private RandomVariate eggsPreference;
public Customer(double averagePurchaseOfBeef, double beefPlusMinus, double averagePurchaseOfPork, double porkPlusMinus, double averagePurchaseOfChicken, double chickenPlusMinus, double averagePurchaseOfEggs, double eggsPlusMinus) {
this.beefPreference = RandomVariateFactory.getInstance("Normal", averagePurchaseOfBeef, beefPlusMinus);
this.porkPreference = RandomVariateFactory.getInstance("Normal", averagePurchaseOfPork, porkPlusMinus);
this.chickenPreference = RandomVariateFactory.getInstance("Normal", averagePurchaseOfChicken, chickenPlusMinus);
this.eggsPreference = RandomVariateFactory.getInstance("Normal", averagePurchaseOfEggs, eggsPlusMinus);
}
public void doRun() {
waitDelay("Transaction", 0.0);
}
public void doTransaction() {
double beef = beefPreference.generate();
beef = beef < 0 ? 0 : beef;
double pork = porkPreference.generate();
pork = pork < 0 ? 0 : pork;
double chicken = chickenPreference.generate();
chicken = chicken < 0 ? 0 : chicken;
double eggs = eggsPreference.generate();
eggs = eggs < 0 ? 0 : eggs;
waitDelay("Transaction", 0.0, beef, pork, chicken, eggs);
waitDelay("Transaction", 7.0);
}
public RandomVariate getBeefPreference() {
return beefPreference;
}
public RandomVariate getPorkPreference() {
return porkPreference;
}
public RandomVariate getChickenPreference() {
return chickenPreference;
}
public RandomVariate getEggsPreference() {
return eggsPreference;
}
}
import java.text.DecimalFormat;
public class FarmStore {
private double bankAccount;
private double BEEFCOST = 10; // Cost per pound
private double PORKCOST = 5; // Cost per pound
private double CHICKENCOST = 2; // Cost per pound
private double EGGSCOST = 2; // Cost per dozen
protected double beefQuantity; // Quantity in pounds
protected double porkQuantity; // Quantity in pounds
protected double chickenQuantity; // Quantity in pounds
protected double eggQuantity; // Quantity in dozens
public FarmStore() {
this.bankAccount = 0;
this.beefQuantity = 0;
this.porkQuantity = 0;
this.chickenQuantity = 0;
this.eggQuantity = 0;
}
public String doTransaction(double beef, double pork, double chicken, double eggs) {
DecimalFormat df = new DecimalFormat("#.##");
if (this.beefQuantity < beef) {
beef = Math.max(this.beefQuantity, 0);
System.out.println("We are out of beef");
}
else {beef = Double.parseDouble(df.format(beef));}
if (this.porkQuantity < pork) {
pork = Math.max(this.porkQuantity, 0);
System.out.println("We are out of pork");
}
else {pork = Double.parseDouble(df.format(pork));}
if (this.chickenQuantity < chicken) {
chicken = Math.max(this.chickenQuantity, 0);
System.out.println("We are out of chicken");
}
else {chicken = Double.parseDouble(df.format(chicken));}
if (this.eggQuantity < eggs) {
eggs = Math.max(this.eggQuantity, 0);
System.out.println("We are out of eggs");
}
else {eggs = Double.parseDouble(df.format(eggs));}
this.beefQuantity -= beef;
this.porkQuantity -= pork;
this.chickenQuantity -= chicken;
this.eggQuantity -= eggs;
double cost = beef * BEEFCOST + pork * PORKCOST + chicken * CHICKENCOST + eggs * EGGSCOST;
cost = Double.parseDouble(df.format(cost));
this.bankAccount += cost;
return "Product purchased:\nBeef: " + beef + " lbs\nPork: " + pork + " lbs\nChicken: " + chicken + " lbs\nEggs: " + eggs + " dozen\nTransaction total: $" + cost;
}
public String doResupply(double beef, double pork, double chicken, double eggs) {
this.beefQuantity += beef;
this.porkQuantity += pork;
this.chickenQuantity += chicken;
this.eggQuantity += eggs;
return "Product received:\nBeef: " + beef + " lbs\t\tCurrent Stock: " + beefQuantity + " lbs\nPork: " + pork
+ " lbs\tCurrent Stock: " + porkQuantity + " lbs\nChicken: " + chicken + " lbs\tCurrent Stock: " + chickenQuantity
+ " lbs\nEggs: " + eggs + " dozen\tCurrent Stock: " + eggQuantity + " dozen\nCurrent Profit: $" + bankAccount;
}
}
\ No newline at end of file
public class LivestockRanch {
private int totalCattle;
private int totalPigs;
private int totalBroilerChickens;
private int totalLayerChickens;
private double cattleProcessRate;
private double pigProcessRate;
private double chickenProcessRate;
private double eggLayingRate;
public LivestockRanch (int totalCattle, int totalPigs, int totalBroilerChickens, int totalLayerChickens) {
this.totalCattle = totalCattle;
this.totalPigs = totalPigs;
this.totalBroilerChickens = totalBroilerChickens;
this.totalLayerChickens = totalLayerChickens;
this.cattleProcessRate = totalCattle * 500 / (3 * 12); // Processing 1/3 of the total population per year, 1 per month, at 500 lbs of beef per cow
this.pigProcessRate = totalPigs * 150 / 6; // Processing 1/6 of the total population per month, at 150 lbs of pork per pig
this.chickenProcessRate = totalBroilerChickens * 6 / 3; // Processing 1/3 of the total population per month, at 6 lbs per chicken
this.eggLayingRate = totalLayerChickens * (25 / 12); // 25 eggs per layer chicken (divided by 12 to be sold in dozens)
}
public int getTotalCattle() {
return totalCattle;
}
public int getTotalPigs() {
return totalPigs;
}
public int getTotalBroilerChickens() {
return totalBroilerChickens;
}
public int getTotalLayerChickens() {
return totalLayerChickens;
}
public double getCattleProcessRate() {
return cattleProcessRate;
}
public double getPigProcessRate() {
return pigProcessRate;
}
public double getChickenProcessRate() {
return chickenProcessRate;
}
public double getEggLayingRate() {
return eggLayingRate;
}
}
import java.io.*;
import java.net.*;
public class Server {
public static void main(String[] args) {
FarmStore market = new FarmStore();
try {
// Create server socket
ServerSocket serverSocket = new ServerSocket(12345);
System.out.println("Server listening on port 12345...");
while (true) {
// Accept client connection
Socket clientSocket = serverSocket.accept();
System.out.println("Client connected: " + clientSocket.getInetAddress().getHostAddress());
// Start a new thread to handle the client connection
ClientHandler clientHandler = new ClientHandler(clientSocket, market);
clientHandler.start();
}
} catch (IOException e) {
e.printStackTrace();
}
}
static class ClientHandler extends Thread {
private Socket clientSocket;
private FarmStore market;
public ClientHandler(Socket socket, FarmStore market) {
this.clientSocket = socket;
this.market = market;
}
public void run() {
try {
// Read data from client
BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
String request = in.readLine();
String[] parsedRequest = request.split(",");
System.out.println("Received request from client: " + request);
// Process request
String response = processRequest(parsedRequest[0], Double.parseDouble(parsedRequest[1]), Double.parseDouble(parsedRequest[2]), Double.parseDouble(parsedRequest[3]), Double.parseDouble(parsedRequest[4]));
System.out.print("Sending response to client: " + response);
// Send response to client
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
out.println(response);
// Close connections
in.close();
out.close();
clientSocket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
private String processRequest(String request, double beef, double pork, double chicken, double eggs) {
// Process the request and execute the corresponding method
if (request.equals("doTransaction")) {
return market.doTransaction(beef, pork, chicken, eggs); // Assuming appropriate arguments for the method
} else if (request.equals("doResupply")) {
return market.doResupply(beef, pork, chicken, eggs);
} else {
return "Invalid request!";
}
}
}
}
......@@ -70,6 +70,7 @@
<word>simulationists</word>
<word>src</word>
<word>subclassed</word>
<word>subpackage</word>
<word>TcpExamples</word>
<word>teardown</word>
<word>thisHostName</word>
......
# Start, ENCODING_PLAINTEXT, [PduRecorder] 20230604_183013, DIS capture file, .\pduLog\PduCaptureLog.dislog
# Timestamp(8 bytes),ProtocolVersion,CompatibilityVersion,ExerciseID,PduType,PduStatus,HeaderLength,PduLength,then PDU-specific data
# =============================================
# DisPduType 11 CREATE_ENTITY, Session time 18:30:13.5, session duration 00:00:00.0, Pdu timestamp -2131319063 22:55:37.0, simulation stream interval 0 00:00:00.0
0,0,60,-107,-83,78,20,41,7,4,11,5,-128,-10,-90,-23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
# DisPduType 11 CREATE_ENTITY, Session time 18:30:13.5, session duration 00:00:00.0, Pdu timestamp -2131319063 22:55:37.0, simulation stream interval 0 00:00:00.0
0,0,0,0,1,-64,110,112,7,4,11,5,-128,-10,-90,-23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
# DisPduType 22 COMMENT, Session time 18:30:13.5, session duration 00:00:00.0, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,0,1,-58,-69,-72,7,1,22,5,0,0,0,0,0,32,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,-81,-46,0,0,1,64,83,105,109,117,108,97,116,105,111,110,32,116,105,109,101,115,116,101,112,32,100,117,114,97,116,105,111,110,32,49,46,48,32,115,101,99,111,110,100,115
# DisPduType 22 COMMENT, Session time 18:30:13.6, session duration 00:00:00.1, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,0,6,-108,-17,92,7,1,22,5,0,0,0,0,0,32,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,-53,32,0,0,2,16,83,105,109,117,108,97,116,105,111,110,32,116,105,109,101,32,48,46,48,32,97,116,32,76,111,99,97,108,68,97,116,101,84,105,109,101,32,50,48,50,51,45,48,54,45,48,52,84,49,56,58,51,48,58,49,51,46,54,54,50,50,56,53,54,48,48,0,0,0,0,0,0
# DisPduType 01 ENTITY_STATE, Session time 18:30:14.7, session duration 00:00:01.2, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,0,73,86,-81,-20,7,1,1,1,0,0,0,0,0,-112,40,0,0,1,0,2,0,3,1,0,1,2,0,-31,4,17,12,0,0,0,0,-31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,-16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,69,110,116,105,116,121,32,35,53,51,0,0,0,0
# DisPduType 02 FIRE, Session time 18:30:14.8, session duration 00:00:01.3, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,0,79,-14,69,60,7,1,2,2,0,0,0,0,0,96,40,0,0,2,0,3,0,0,0,2,0,3,0,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,122,0,0
# DisPduType 22 COMMENT, Session time 18:30:15.0, session duration 00:00:01.4, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,0,86,70,-14,-104,7,1,22,5,0,0,0,0,0,32,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,3,-87,-72,0,0,0,-8,77,86,51,53,48,48,32,69,120,97,109,112,108,101,83,105,109,117,108,97,116,105,111,110,80,114,111,103,114,97,109,0,0,3,-87,-72,0,0,0,-80,114,117,110,83,105,109,117,108,97,116,105,111,110,40,41,32,108,111,111,112,32,49,0,0
# DisPduType 01 ENTITY_STATE, Session time 18:30:15.1, session duration 00:00:01.5, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,0,93,21,15,116,7,1,1,1,0,0,0,0,0,-112,40,0,0,1,0,2,0,4,2,0,1,3,0,-51,62,2,2,0,0,0,0,-31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,32,69,110,116,105,116,121,32,35,50,0,0,0,0
# DisPduType 01 ENTITY_STATE, Session time 18:30:16.2, session duration 00:00:02.6, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,0,-97,54,-55,56,7,1,1,1,0,0,0,0,0,-112,40,0,0,1,0,2,0,3,1,0,1,2,0,-31,4,17,12,0,0,0,0,-31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,69,110,116,105,116,121,32,35,53,51,0,0,0,0
# DisPduType 02 FIRE, Session time 18:30:16.3, session duration 00:00:02.7, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,0,-91,-105,-87,-96,7,1,2,2,0,0,0,0,0,96,40,0,0,2,0,3,0,0,0,2,0,3,0,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,122,0,0
# DisPduType 22 COMMENT, Session time 18:30:16.4, session duration 00:00:02.8, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,0,-84,33,1,4,7,1,22,5,0,0,0,0,0,32,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,3,-87,-72,0,0,0,-8,77,86,51,53,48,48,32,69,120,97,109,112,108,101,83,105,109,117,108,97,116,105,111,110,80,114,111,103,114,97,109,0,0,3,-87,-72,0,0,0,-80,114,117,110,83,105,109,117,108,97,116,105,111,110,40,41,32,108,111,111,112,32,50,0,0
# DisPduType 01 ENTITY_STATE, Session time 18:30:16.5, session duration 00:00:03.0, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,0,-77,10,-64,24,7,1,1,1,0,0,0,0,0,-112,40,0,0,1,0,2,0,4,2,0,1,3,0,-51,62,2,2,0,0,0,0,-31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,32,69,110,116,105,116,121,32,35,50,0,0,0,0
# DisPduType 01 ENTITY_STATE, Session time 18:30:17.6, session duration 00:00:04.1, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,0,-11,40,-96,80,7,1,1,1,0,0,0,0,0,-112,40,0,0,1,0,2,0,3,1,0,1,2,0,-31,4,17,12,0,0,0,0,-31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,69,110,116,105,116,121,32,35,53,51,0,0,0,0
# DisPduType 02 FIRE, Session time 18:30:17.7, session duration 00:00:04.2, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,0,-5,100,-125,48,7,1,2,2,0,0,0,0,0,96,40,0,0,2,0,3,0,0,0,2,0,3,0,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,122,0,0
# DisPduType 22 COMMENT, Session time 18:30:17.8, session duration 00:00:04.3, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,1,1,-72,-80,108,7,1,22,5,0,0,0,0,0,32,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,3,-87,-72,0,0,0,-8,77,86,51,53,48,48,32,69,120,97,109,112,108,101,83,105,109,117,108,97,116,105,111,110,80,114,111,103,114,97,109,0,0,3,-87,-72,0,0,0,-80,114,117,110,83,105,109,117,108,97,116,105,111,110,40,41,32,108,111,111,112,32,51,0,0
# DisPduType 01 ENTITY_STATE, Session time 18:30:17.9, session duration 00:00:04.4, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,1,7,-66,-30,96,7,1,1,1,0,0,0,0,0,-112,40,0,0,1,0,2,0,4,2,0,1,3,0,-51,62,2,2,0,0,0,0,-31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,32,69,110,116,105,116,121,32,35,50,0,0,0,0
# DisPduType 01 ENTITY_STATE, Session time 18:30:19.0, session duration 00:00:05.5, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,1,74,47,123,-16,7,1,1,1,0,0,0,0,0,-112,40,0,0,1,0,2,0,3,1,0,1,2,0,-31,4,17,12,0,0,0,0,-31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,69,110,116,105,116,121,32,35,53,51,0,0,0,0
# DisPduType 02 FIRE, Session time 18:30:19.1, session duration 00:00:05.6, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,1,80,75,63,-60,7,1,2,2,0,0,0,0,0,96,40,0,0,2,0,3,0,0,0,2,0,3,0,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,122,0,0
# DisPduType 22 COMMENT, Session time 18:30:19.3, session duration 00:00:05.7, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,1,86,-74,-12,112,7,1,22,5,0,0,0,0,0,32,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,3,-87,-72,0,0,0,-8,77,86,51,53,48,48,32,69,120,97,109,112,108,101,83,105,109,117,108,97,116,105,111,110,80,114,111,103,114,97,109,0,0,3,-87,-72,0,0,0,-80,114,117,110,83,105,109,117,108,97,116,105,111,110,40,41,32,108,111,111,112,32,52,0,0
# DisPduType 01 ENTITY_STATE, Session time 18:30:19.4, session duration 00:00:05.8, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,1,94,78,-15,96,7,1,1,1,0,0,0,0,0,-112,40,0,0,1,0,2,0,4,2,0,1,3,0,-51,62,2,2,0,0,0,0,-31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,32,69,110,116,105,116,121,32,35,50,0,0,0,0
# DisPduType 01 ENTITY_STATE, Session time 18:30:20.5, session duration 00:00:06.9, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,1,-96,68,-75,-96,7,1,1,1,0,0,0,0,0,-112,40,0,0,1,0,2,0,3,1,0,1,2,0,-31,4,17,12,0,0,0,0,-31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,69,110,116,105,116,121,32,35,53,51,0,0,0,0
# DisPduType 02 FIRE, Session time 18:30:20.6, session duration 00:00:07.0, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,1,-90,-12,29,-116,7,1,2,2,0,0,0,0,0,96,40,0,0,2,0,3,0,0,0,2,0,3,0,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,122,0,0
# DisPduType 22 COMMENT, Session time 18:30:20.7, session duration 00:00:07.2, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,1,-83,104,49,-108,7,1,22,5,0,0,0,0,0,32,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,3,-87,-72,0,0,0,-8,77,86,51,53,48,48,32,69,120,97,109,112,108,101,83,105,109,117,108,97,116,105,111,110,80,114,111,103,114,97,109,0,0,3,-87,-72,0,0,0,-80,114,117,110,83,105,109,117,108,97,116,105,111,110,40,41,32,108,111,111,112,32,53,0,0
# DisPduType 01 ENTITY_STATE, Session time 18:30:20.8, session duration 00:00:07.3, Pdu timestamp 0 00:00:00.0, simulation stream interval 2131319063 01:04:23.0
0,0,0,1,-77,-11,-11,-56,7,1,1,1,0,0,0,0,0,-112,40,0,0,1,0,2,0,4,2,0,1,3,0,-51,62,2,2,0,0,0,0,-31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,32,69,110,116,105,116,121,32,35,50,0,0,0,0
# DisPduType 22 COMMENT, Session time 18:30:20.9, session duration 00:00:07.4, Pdu timestamp -3558 23:00:42.0, simulation stream interval 2131315505 00:05:05.0
0,0,0,1,-70,30,81,112,7,1,22,5,-1,-1,-14,26,0,32,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,9,90,-90,0,0,0,-8,77,86,51,53,48,48,32,69,120,97,109,112,108,101,83,105,109,117,108,97,116,105,111,110,80,114,111,103,114,97,109,0,0,9,90,-90,0,0,1,48,114,117,110,83,105,109,117,108,97,116,105,111,110,40,41,32,99,111,109,112,108,101,116,101,100,32,115,117,99,99,101,115,115,102,117,108,108,121,0,0
# Finish, ENCODING_PLAINTEXT, [PduRecorder] 20230604_183023, DIS capture file, .\pduLog\PduCaptureLog.dislog
......@@ -2,6 +2,8 @@
This directory holds temporary PDU log files which may be deleted at any time!
To clean out old log files, simply run [build.xml](build.xml) target `clean.all.log.files`
Each time you run a DIS simulation and a PduRecorder is listening, another
log file is created. File names are numbered sequentially and uniquely, so that
important PDU log captures can later be copied and saved to where they are needed.
......@@ -14,4 +16,4 @@ the corresponding homework or project directory (and likely renaming as well).
Note that the PDU log files are very tolerant of inline comments starting with
a # character, so you can document success/failure and TODO issues there as well.
To clean out old log files, simply run [build.xml](build.xml) target `clean.all.log.files`
<!-- https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/pduLog/README.md -->
......@@ -93,8 +93,12 @@ public class ExampleSimulationProgram
*/
public ExampleSimulationProgram(String address, int port)
{
disChannel.setNetworkAddress(address);
disChannel.setNetworkPort (port);
disChannel.setNetworkAddress (address);
disChannel.setNetworkPort (port);
disChannel.setVerboseComments (false); // TODO rename library method to disambiguate CommentPDU
// TODO still seems really chatty... add silent mode?
disChannel.setVerboseDisNetworkInterface(false); // Default false
disChannel.setVerbosePduRecorder (false); // default false
initialize();
}
......
examples/src/OpenDis7Examples/ExampleSimulationProgramFlowDiagram.png

131 KiB

No preview for this file type
ant -f C:\\x-nps-gitlab\\NetworkedGraphicsMV3500\\examples -Dnb.internal.action.name=run.single -Djavac.includes=OpenDis7Examples/ExampleSimulationProgram.java -Drun.class=OpenDis7Examples.ExampleSimulationProgram run-single
ant -f C:\\x3d-nps-gitlab\\NetworkedGraphicsMV3500\\examples -Dnb.internal.action.name=run run
init:
Deleting: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties
Deleting: C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties
deps-jar:
Updating property file: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties
Compiling 1 source file to C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\classes
compile-single:
run-single:
[DisChannel] thisHostName=IT160907-UWALPP
[DisThreadedNetworkInterface] using network interface PANGP Virtual Ethernet Adapter
Updating property file: C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties
Compiling 1 source file to C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\build\classes
warning: [options] system modules path not set in conjunction with -source 17
1 warning
Copying 1 file to C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\build\classes
compile:
run:
[DisChannel] thisHostName=IT160907-INFLPP
[DisThreadedNetworkInterface] using network interface Intel(R) Wi-Fi 6E AX210 160MHz
[DisThreadedNetworkInterface] datagramSocket.joinGroup address=239.1.2.3 port=3000 isConnected()=false createDatagramSocket() complete.
[DisThreadedNetworkInterface] createThreads() receiveThread.isAlive()=true
[DisThreadedNetworkInterface] createThreads() sendingThread.isAlive()=true
[DisChannel ExampleSimulationProgram] Network confirmation: address=239.1.2.3 port=3000
[DisChannel ExampleSimulationProgram] Beginning pdu save to directory ./pduLog
[PduRecorder] Recorder log file open: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog1.dislog
[DisThreadedNetworkInterface] using network interface PANGP Virtual Ethernet Adapter
[PduRecorder] Recorder log file open: C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog28.dislog
[DisThreadedNetworkInterface] using network interface Intel(R) Wi-Fi 6E AX210 160MHz
[DisThreadedNetworkInterface] datagramSocket.joinGroup address=239.1.2.3 port=3000 isConnected()=false createDatagramSocket() complete.
[DisThreadedNetworkInterface] createThreads() receiveThread.isAlive()=true
[DisThreadedNetworkInterface] createThreads() sendingThread.isAlive()=true
[PduRecorder PduRecorder] listening to IP address 239.1.2.3 on port 3000
[DisChannel ExampleSimulationProgram] just checking: disChannel.getNetworkAddress()=239.1.2.3, getNetworkPort()=3000
[DisThreadedNetworkInterface ExampleSimulationProgram] [receipt 1] DisPduType 11 CREATE_ENTITY, size 28 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram] [sending 1] DisPduType 11 CREATE_ENTITY, size 28 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram] [sending 2] DisPduType 11 CREATE_ENTITY, size 28 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram] [receipt 1] DisPduType 11 CREATE_ENTITY, size 28 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram] [receipt 2] DisPduType 11 CREATE_ENTITY, size 28 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram] [sending 3] DisPduType 22 COMMENT, size 80 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram] [receipt 3] DisPduType 22 COMMENT, size 80 bytes)
......@@ -34,7 +37,7 @@ run-single:
[DisThreadedNetworkInterface ExampleSimulationProgram] [sending 4] DisPduType 22 COMMENT, size 112 bytes)
[DisThreadedNetworkInterface ExampleSimulationProgram] [receipt 4] DisPduType 22 COMMENT, size 112 bytes)
[DisThreadedNetworkInterface PduRecorder] [receipt 4] DisPduType 22 COMMENT, size 112 bytes)
[DisChannel ExampleSimulationProgram] *** [CommentPdu TIME] [Simulation time 0.0 at LocalDateTime 2022-06-25T21:11:35.986332500]
[DisChannel ExampleSimulationProgram] *** [CommentPdu TIME] [Simulation time 0.0 at LocalDateTime 2023-05-15T12:17:06.454742800]
... My simulation just did something, no really...
... [Pausing for 1.0 seconds]
... sending PDUs of interest for simulation step 1, monitor loopback to confirm sent
......@@ -126,19 +129,19 @@ run-single:
[DisThreadedNetworkInterface PduRecorder] [receipt 25] DisPduType 22 COMMENT, size 120 bytes)
[DisChannel ExampleSimulationProgram] *** [CommentPdu COMPLETE_EVENT_REPORT] [MV3500 ExampleSimulationProgram, runSimulation() completed successfully]
... [final=completion CommentPdu successfully sent for simulation]
*** setKillSentinelAndInterrupts() killed=true sendingThread.isInterrupted()=false receiveThread.isInterrupted()=true
*** setKillSentinelAndInterrupts() killed=true sendingThread.isInterrupted()=true receiveThread.isInterrupted()=true
[DisThreadedNetworkInterface PduRecorder] close(): pdus2send.size()=0 baos.size()=0 dos.size()=0
[DisThreadedNetworkInterface PduRecorder] datagramSocket.leaveGroup address=239.1.2.3 port=3000 isClosed()=true close() complete.
*** killThread() status: sendingThread.isAlive()=false sendingThread.isInterrupted()=true
*** killThread() status: receiveThread.isAlive()=false receiveThread.isInterrupted()=true
*** Thread close status: sendingThread.isAlive()=false receiveThread.isAlive()=false
PduRecorder.stop() closing recorder log file: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog1.dislog
*** setKillSentinelAndInterrupts() killed=true sendingThread.isInterrupted()=false receiveThread.isInterrupted()=true
PduRecorder.stop() closing recorder log file: C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog28.dislog
*** setKillSentinelAndInterrupts() killed=true sendingThread.isInterrupted()=true receiveThread.isInterrupted()=true
[DisThreadedNetworkInterface ExampleSimulationProgram] close(): pdus2send.size()=0 baos.size()=0 dos.size()=2808
[DisThreadedNetworkInterface ExampleSimulationProgram] datagramSocket.leaveGroup address=239.1.2.3 port=3000 isClosed()=true close() complete.
*** killThread() status: sendingThread.isAlive()=false sendingThread.isInterrupted()=true
*** killThread() status: receiveThread.isAlive()=false receiveThread.isInterrupted()=true
*** Thread close status: sendingThread.isAlive()=false receiveThread.isAlive()=false
[DisChannel ExampleSimulationProgram] complete.
BUILD SUCCESSFUL (total time: 13 seconds)
BUILD SUCCESSFUL (total time: 14 seconds)
examples/src/OpenDis7Examples/ExampleSimulationProgramSequenceDiagram.png

87.9 KiB | W: | H:

examples/src/OpenDis7Examples/ExampleSimulationProgramSequenceDiagram.png

163 KiB | W: | H:

examples/src/OpenDis7Examples/ExampleSimulationProgramSequenceDiagram.png
examples/src/OpenDis7Examples/ExampleSimulationProgramSequenceDiagram.png
examples/src/OpenDis7Examples/ExampleSimulationProgramSequenceDiagram.png
examples/src/OpenDis7Examples/ExampleSimulationProgramSequenceDiagram.png
  • 2-up
  • Swipe
  • Onion skin
No preview for this file type
......@@ -36,19 +36,28 @@ auxiliary.show.customizer.message=<message>
<spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1">
<word>archivally</word>
<word>autogenerated</word>
<word>brutzman</word>
<word>codebase</word>
<word>codebases</word>
<word>DIS</word>
<word>gitlab</word>
<word>html</word>
<word>https</word>
<word>IITSEC</word>
<word>integrators</word>
<word>interoperability</word>
<word>interoperable</word>
<word>Javadoc</word>
<word>LVC</word>
<word>McGregor</word>
<word>multicast</word>
<word>NPS</word>
<word>opendis</word>
<word>PDUs</word>
<word>Redistributions</word>
<word>TENA</word>
<word>UML</word>
<word>wargaming</word>
<word>WebRTC</word>
<word>Wikipedia</word>
</spellchecker-wordlist>
......
No preview for this file type
No preview for this file type
![TENA logo](https://www.tena-sda.org/logos/TENA-logo-128px.png)
<!-- View this page at https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/presentations/10_TENA_References.md -->
# Test and Training Enabling Architecture (TENA)
TENA is Government Off The Shelf (GOTS) software supporting a wide range of Live Virtual Constructive (LVC) capability.
......
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