From fe3c19373133dd5fdd5b0558a6f2abb66c312c56 Mon Sep 17 00:00:00 2001 From: brutzman <brutzman@nps.edu> Date: Sun, 14 May 2023 21:04:36 -0700 Subject: [PATCH] rename for consistency, simple cleanups --- .../SimpleServerOpenDis7.java | 203 ++++++++++++++++++ .../TwoCraneBerthsOpenDis7.java | 27 +-- .../run/RunSimpleServer.java | 7 +- .../run/RunSimpleServerOpenDis7.java | 6 +- .../run/RunSimpleServerOpenDis7Log.txt | 43 ++-- .../run/RunTwoCraneBerthsLog.txt | 12 +- .../run/RunTwoCraneBerthsOpenDis7Log.txt | Bin 12485 -> 70372 bytes .../run/RunTwoCranesBerth.java | 92 -------- 8 files changed, 257 insertions(+), 133 deletions(-) create mode 100644 examples/src/SimkitOpenDis7Examples/SimpleServerOpenDis7.java delete mode 100644 examples/src/SimkitOpenDis7Examples/run/RunTwoCranesBerth.java diff --git a/examples/src/SimkitOpenDis7Examples/SimpleServerOpenDis7.java b/examples/src/SimkitOpenDis7Examples/SimpleServerOpenDis7.java new file mode 100644 index 0000000000..de9824ebc3 --- /dev/null +++ b/examples/src/SimkitOpenDis7Examples/SimpleServerOpenDis7.java @@ -0,0 +1,203 @@ +package SimkitOpenDis7Examples; + +import edu.nps.moves.dis7.enumerations.DisPduType; +import edu.nps.moves.dis7.pdus.EntityStatePdu; +import edu.nps.moves.dis7.utilities.DisChannel; +import edu.nps.moves.dis7.utilities.PduFactory; +import simkit.Priority; +import simkit.SimEntityBase; +import simkit.random.RandomVariate; + +/** + * Simple Server component. Instances of this class cannot be used on their own, + * but require another SimEntity to schedule Arrival events. If it is desired to + * listen to an event of another name,use an Adapter instance. + * + * The StartService is schedule with a positive priority, which will ensure it + * will occur ahead of any simultaneously scheduled Arrival events, as long as + * they have the default priority of 0.0. + * + * @author abuss@nps.edu + */ +public class SimpleServerOpenDis7 extends SimEntityBase +{ + // Utility constructor method: initial descriptor and verboseness of disNetworkInterface, pduRecorder + private final DisChannel disChannel = new DisChannel("TwoCraneBerthsOpenDis7", false, true); + + PduFactory pduFactory = new PduFactory(); + EntityStatePdu espduCrane = (EntityStatePdu) pduFactory.createPdu(DisPduType.ENTITY_STATE); + + /** + * Total number of servers + */ + private int totalNumberServers; + + /** + * Generates service times + */ + private RandomVariate serviceTimeGenerator; + + /** + * number of available servers at any time + */ + protected int numberAvailableServers; + + /** + * number in queue at any time + */ + protected int numberInQueue; + + /** + * Number customers served + */ + protected int numberServed; + + /** + * Zero-argument constructor + */ + public SimpleServerOpenDis7() { + } + + /** + * Creates a new instance of SimpleServer with the given parameters + * + * @param totalNumberServers Total number of servers + * @param serviceTimeGenerator Service time generator. Must be RandomVariate + * instance that only generates non-negative values. + */ + public SimpleServerOpenDis7(int totalNumberServers, RandomVariate serviceTimeGenerator) { + setTotalNumberServers(totalNumberServers); + setServiceTimeGenerator(serviceTimeGenerator); + } + + /** + * Set numberAvailable servers to total number servers, numberInQueue to 0, + * numberServed to 0. + */ + @Override + public void reset() { + super.reset(); + numberInQueue = 0; + numberAvailableServers = totalNumberServers; + numberServed = 0; + } + + /** + * Just fires PropertyChange events + */ + public void doRun() { + firePropertyChange("numberInQueue", getNumberInQueue()); + firePropertyChange("numberAvailableServers", getNumberAvailableServers()); + firePropertyChange("numberServed", getNumberServed()); + } + + /** + * Increment number in queue. If a server is available, schedule + * StartService immediately with priority of 1.0 + */ + public void doArrival() { + int oldNumberInQueue = numberInQueue; + numberInQueue = numberInQueue + 1; + firePropertyChange("numberInQueue", oldNumberInQueue, getNumberInQueue()); + if (getNumberAvailableServers() > 0) { + waitDelay("StartService", 0.0, Priority.HIGH); + } + } + + /** + * Decrement numberInQueue and numberAvailableServers Schedule EndService + * after service time delay + */ + public void doStartService() { + int oldNumberInQueue = numberInQueue; + numberInQueue = numberInQueue - 1; + firePropertyChange("numberInQueue", oldNumberInQueue, numberInQueue); + int oldNumberAvailableServers = numberAvailableServers; + numberAvailableServers = numberAvailableServers - 1; + firePropertyChange("numberAvailableServers", oldNumberAvailableServers, numberAvailableServers); + +// double serviceTime = getServiceTimeGenerator().generate(); +// firePropertyChange("serviceTime", serviceTime); + + waitDelay("EndService", serviceTimeGenerator); + + } + + /** + * Increment numberAvailableServers If customers in queue, schedule + * StartService immediately with HIGH priority + */ + public void doEndService() { + int oldNumberAvailableServers = numberAvailableServers; + numberAvailableServers = numberAvailableServers + 1; + firePropertyChange("numberAvailableServers", oldNumberAvailableServers, numberAvailableServers); + + int oldNumberServed = numberServed; + numberServed = numberServed + 1; + firePropertyChange("numberServed", oldNumberServed, numberServed); + + if (getNumberInQueue() > 0) { + waitDelay("StartService", 0.0, Priority.HIGH); + } + } + + /** + * accessor method to get a state variable + * @return the numberAvailableServers + */ + public int getNumberAvailableServers() { + return numberAvailableServers; + } + + /** + * accessor method to get a state variable + * @return the numberInQueue + */ + public int getNumberInQueue() { + return numberInQueue; + } + + /** + * accessor method to set a state variable + * @param totalNumberServers total number of servers + * @throws IllegalArgumentException if totalNumberServers < 0 + */ + public void setTotalNumberServers(int totalNumberServers) { + if (totalNumberServers <= 0) { + throw new IllegalArgumentException("Need positive number of servers: " + totalNumberServers); + } + this.totalNumberServers = totalNumberServers; + } + + /** + * accessor method to get a state variable + * @return the serviceTimeGenerator + */ + public RandomVariate getServiceTimeGenerator() { + return this.serviceTimeGenerator; + } + + /** + * accessor method to set a state variable + * @param serviceTimeGenerator the serviceTimeGenerator to set + */ + public void setServiceTimeGenerator(RandomVariate serviceTimeGenerator) { + this.serviceTimeGenerator = serviceTimeGenerator; + } + + /** + * accessor method to get a state variable + * @return the totalNumberServers + */ + public int getTotalNumberServers() { + return this.totalNumberServers; + } + + /** + * accessor method to get a state variable + * @return the numberServed + */ + public int getNumberServed() { + return this.numberServed; + } +} diff --git a/examples/src/SimkitOpenDis7Examples/TwoCraneBerthsOpenDis7.java b/examples/src/SimkitOpenDis7Examples/TwoCraneBerthsOpenDis7.java index 7314d3e7f5..6482e6ef27 100644 --- a/examples/src/SimkitOpenDis7Examples/TwoCraneBerthsOpenDis7.java +++ b/examples/src/SimkitOpenDis7Examples/TwoCraneBerthsOpenDis7.java @@ -26,7 +26,10 @@ import simkit.SimEntityBase; public class TwoCraneBerthsOpenDis7 extends SimEntityBase { // Utility constructor method: initial descriptor and verboseness of disNetworkInterface, pduRecorder - private final DisChannel disChannel = new DisChannel("TwoCraneBerthsOpenDis7", false, true); + private final DisChannel disChannel = new DisChannel("TwoCraneBerthsOpenDis7", false, true); + + PduFactory pduFactory = new PduFactory(); + EntityStatePdu espduCrane = (EntityStatePdu) pduFactory.createPdu(DisPduType.ENTITY_STATE); /** * Queue of Ships waiting to go into the berth @@ -76,10 +79,10 @@ public class TwoCraneBerthsOpenDis7 extends SimEntityBase /** * Only PropertyChangeEvents */ - public void doRun() { - disChannel.setVerboseComments(true); + public void doRun() + { disChannel.setVerboseComments(true); - // TODO what is happening? not seen in logs... + disChannel.setVerboseDisNetworkInterface(true); firePropertyChange("queue", getQueue()); firePropertyChange("berth", getBerth()); @@ -209,9 +212,6 @@ public class TwoCraneBerthsOpenDis7 extends SimEntityBase waitDelay("EndUnloadingOneCrane", ship.getRemainingUnloadingTime(), ship); } - // can be member variables (for efficiency, move above) or else embdedded within method (move below) - PduFactory pduFactory = new PduFactory(); - EntityStatePdu espduCrane = (EntityStatePdu) pduFactory.createPdu(DisPduType.ENTITY_STATE); /** * Perform crane container unloading operations and send PDUs to report progress @@ -272,7 +272,7 @@ public class TwoCraneBerthsOpenDis7 extends SimEntityBase espduCrane.setEntityLocation(pierDistanceForCraneOffload, 0.0, 0.0); disChannel.sendSinglePdu(disTimeStamp, espduCrane); disChannel.sendCommentPdu(disTimeStamp, VariableRecordType.CARGO, - "Crane at position " + pierDistanceForCraneOffload + "m for offload after " + craneTravelDuration + " seconds"); + "Crane moved to position " + pierDistanceForCraneOffload + "m for offload after " + craneTravelDuration + " seconds"); // 4. repeat until done: Crane rotates, lift container, rotates, lower container for (int containerIndex = 1; containerIndex <= numberContainers; containerIndex++) @@ -281,14 +281,15 @@ public class TwoCraneBerthsOpenDis7 extends SimEntityBase double craneRotationDelay = 90.0 / craneRotationRate; // units analysis: degrees / (degrees/second) = seconds espduCrane.setEntityOrientation(orientationToShip); disChannel.sendSinglePdu(disTimeStamp, espduCrane); - disChannel.sendCommentPdu(disTimeStamp, VariableRecordType.CARGO, "Crane oriented to ship after " + craneRotationDelay + " seconds"); + disChannel.sendCommentPdu(disTimeStamp, VariableRecordType.CARGO, "Crane oriented to ship after " + craneRotationDelay + " seconds" + + " with craneRotationRate=" + craneRotationRate + " degrees/second"); // // 4.b announce next step without further delay, then perform container hookup - disChannel.sendCommentPdu(disTimeStamp, VariableRecordType.CARGO, "Hooking up Container " + containerIndex + " to crane "); // TODO + whichCrane + disChannel.sendCommentPdu(disTimeStamp, VariableRecordType.CARGO, "Hooking up Container " + containerIndex + " to crane has started..."); // TODO + whichCrane disTimeStamp += containerHookupDuration; // disChannel.sendSinglePdu(disTimeStamp, espduCrane); // superfluous, crane hasn't moved - disChannel.sendCommentPdu(disTimeStamp, VariableRecordType.CARGO, "Hooked up: Container " + containerIndex + " to crane " // TODO + whichCrane + disChannel.sendCommentPdu(disTimeStamp, VariableRecordType.CARGO, "Hooked up: Container " + containerIndex + " to crane" // TODO + whichCrane + " after " + craneRotationDelay + " seconds"); // 4.c crane rotates to pier @@ -296,12 +297,12 @@ public class TwoCraneBerthsOpenDis7 extends SimEntityBase espduCrane.setEntityOrientation(orientationToPier); disChannel.sendSinglePdu(disTimeStamp, espduCrane); disChannel.sendCommentPdu(disTimeStamp, VariableRecordType.CARGO, "Crane oriented to pier after " + craneRotationDelay + " seconds" + - " (" + craneRotationRate + " degrees/second)"); + " with craneRotationRate=" + craneRotationRate + " degrees/second"); // 4.d crane unhooks container disTimeStamp += containerDetachDuration; // disChannel.sendSinglePdu(disTimeStamp, espduCrane); // superfluous, crane hasn't moved - disChannel.sendCommentPdu(disTimeStamp, VariableRecordType.CARGO, "Detached: Container " + containerIndex + " on pier" // TODO + whichCrane + disChannel.sendCommentPdu(disTimeStamp, VariableRecordType.CARGO, "Crane detached: Container " + containerIndex + " on pier" // TODO + whichCrane + " after " + containerDetachDuration + " seconds"); // send PDUs accordingly diff --git a/examples/src/SimkitOpenDis7Examples/run/RunSimpleServer.java b/examples/src/SimkitOpenDis7Examples/run/RunSimpleServer.java index 4e7e54a79f..bcd76af541 100644 --- a/examples/src/SimkitOpenDis7Examples/run/RunSimpleServer.java +++ b/examples/src/SimkitOpenDis7Examples/run/RunSimpleServer.java @@ -36,14 +36,15 @@ public class RunSimpleServer * Run a simple program and compute statistical measurement of results. * @param args the command line arguments */ - public static void main(String args[]) { - String rvName = "Uniform"; + public static void main(String args[]) + { + String rvName = "Uniform"; // TODO is enumeration available? double lower = 0.9; double upper = 2.2; RandomVariate interarrivalTimeGenerator = RandomVariateFactory.getInstance(rvName, lower, upper); ArrivalProcess arrival = new ArrivalProcess(interarrivalTimeGenerator); - rvName = "Gamma"; + rvName = "Gamma"; // TODO is enumeration available? double alpha = 1.7; double beta = 1.8; diff --git a/examples/src/SimkitOpenDis7Examples/run/RunSimpleServerOpenDis7.java b/examples/src/SimkitOpenDis7Examples/run/RunSimpleServerOpenDis7.java index 067cf51b7f..26dc0a8710 100644 --- a/examples/src/SimkitOpenDis7Examples/run/RunSimpleServerOpenDis7.java +++ b/examples/src/SimkitOpenDis7Examples/run/RunSimpleServerOpenDis7.java @@ -53,13 +53,13 @@ public class RunSimpleServerOpenDis7 RandomVariate interarrivalTimeGenerator = RandomVariateFactory.getInstance(rvName, lower, upper); ArrivalProcessOpenDis7 arrival = new ArrivalProcessOpenDis7(interarrivalTimeGenerator); - rvName = "Gamma"; + rvName = "Gamma"; // TODO is enumeration available? double alpha = 1.7; double beta = 1.8; RandomVariate serviceTimeGenerator = RandomVariateFactory.getInstance(rvName, alpha, beta); - int numServ = 2; - SimpleServerOpenDis7 server = new SimpleServer(numServ, serviceTimeGenerator); + int numServ = 1; + SimpleServerOpenDis7 server = new SimpleServerOpenDis7(numServ, serviceTimeGenerator); arrival.addSimEventListener(server); SimplePropertyDumper simplePropertyDumper = new SimplePropertyDumper(); diff --git a/examples/src/SimkitOpenDis7Examples/run/RunSimpleServerOpenDis7Log.txt b/examples/src/SimkitOpenDis7Examples/run/RunSimpleServerOpenDis7Log.txt index 332809acd9..fbc63d4c92 100644 --- a/examples/src/SimkitOpenDis7Examples/run/RunSimpleServerOpenDis7Log.txt +++ b/examples/src/SimkitOpenDis7Examples/run/RunSimpleServerOpenDis7Log.txt @@ -1,20 +1,22 @@ -ant -f C:\\x-nps-gitlab\\NetworkedGraphicsMV3500\\examples -Dnb.internal.action.name=run.single -Djavac.includes=SimkitOpenDis7Examples/run/RunSimpleServerOpenDis7.java -Drun.class=SimkitOpenDis7Examples.run.RunSimpleServerOpenDis7 run-single +ant -f C:\\x3d-nps-gitlab\\NetworkedGraphicsMV3500\\examples -Dnb.internal.action.name=run.single -Djavac.includes=SimkitOpenDis7Examples/run/RunSimpleServerOpenDis7.java -Drun.class=SimkitOpenDis7Examples.run.RunSimpleServerOpenDis7 run-single 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 +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 compile-single: run-single: -[DisChannel] thisHostName=IT160907-UWALPP -[DisThreadedNetworkInterface] using network interface PANGP Virtual Ethernet Adapter +[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] Network confirmation: address=239.1.2.3 port=3000 [DisChannel] Beginning pdu save to directory ./pduLog -[PduRecorder] Recorder log file open: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog3.dislog -[DisThreadedNetworkInterface] using network interface PANGP Virtual Ethernet Adapter +[PduRecorder] Recorder log file open: C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog22.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 @@ -23,18 +25,19 @@ run-single: [DisThreadedNetworkInterface DisChannel] [sending 1] DisPduType 22 COMMENT, size 80 bytes) [DisThreadedNetworkInterface DisChannel] [receipt 1] DisPduType 22 COMMENT, size 80 bytes) [DisThreadedNetworkInterface PduRecorder] [receipt 1] DisPduType 22 COMMENT, size 80 bytes) -[DisChannel] *** [CommentPdu narrative sent: OTHER] [ArrivalProcessOpenDis7 initialized] +[DisChannel] *** [CommentPdu OTHER] [ArrivalProcessOpenDis7 initialized] +[DisChannel] thisHostName=IT160907-INFLPP ArrivalProcessOpenDis7.1 interarrivalTimeGenerator = Uniform (0.900, 2.200) -SimpleServer.2 - totalNumberServers = 2 +SimpleServerOpenDis7.2 + totalNumberServers = 1 serviceTimeGenerator = Gamma (1.700, 1.800) Simulation ended at time 100,000.000 -There have been 64,475 arrivals -There have been 64,472 customers served -Average number in queue 15.9655 -Average utilization 0.9819 +There have been 64,526 arrivals +There have been 32,790 customers served +Average number in queue 15912.7375 +Average utilization 1.0000 Execution complete. *** setKillSentinelAndInterrupts() killed=true sendingThread.isInterrupted()=true receiveThread.isInterrupted()=true [DisThreadedNetworkInterface PduRecorder] close(): pdus2send.size()=0 baos.size()=0 dos.size()=0 @@ -43,5 +46,11 @@ Execution complete. *** 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\PduCaptureLog3.dislog -BUILD SUCCESSFUL (total time: 5 seconds) +PduRecorder.stop() closing recorder log file: C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog22.dislog +*** setKillSentinelAndInterrupts() killed=true sendingThread.isInterrupted()=true receiveThread.isInterrupted()=true +[DisThreadedNetworkInterface DisChannel] close(): pdus2send.size()=0 baos.size()=0 dos.size()=80 +[DisThreadedNetworkInterface DisChannel] 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 +BUILD SUCCESSFUL (total time: 10 seconds) diff --git a/examples/src/SimkitOpenDis7Examples/run/RunTwoCraneBerthsLog.txt b/examples/src/SimkitOpenDis7Examples/run/RunTwoCraneBerthsLog.txt index 31c40868a7..437f9dc4c5 100644 --- a/examples/src/SimkitOpenDis7Examples/run/RunTwoCraneBerthsLog.txt +++ b/examples/src/SimkitOpenDis7Examples/run/RunTwoCraneBerthsLog.txt @@ -1,9 +1,11 @@ -ant -f C:\\x-nps-gitlab\\NetworkedGraphicsMV3500\\examples -Dnb.internal.action.name=run.single -Djavac.includes=SimkitOpenDis7Examples/run/RunTwoCranesBerth.java -Drun.class=SimkitOpenDis7Examples.run.RunTwoCranesBerth run-single +ant -f C:\\x3d-nps-gitlab\\NetworkedGraphicsMV3500\\examples -Dnb.internal.action.name=run.single -Djavac.includes=SimkitOpenDis7Examples/run/RunTwoCraneBerths.java -Drun.class=SimkitOpenDis7Examples.run.RunTwoCraneBerths run-single 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 +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 compile-single: run-single: ShipArrivalProcess.1 @@ -20,4 +22,4 @@ Average # in queue: 0.6834 Average # busy berths: 1.1737 Average time in system: 1.3207 Average delay in queue: 0.4857 -BUILD SUCCESSFUL (total time: 3 seconds) +BUILD SUCCESSFUL (total time: 6 seconds) diff --git a/examples/src/SimkitOpenDis7Examples/run/RunTwoCraneBerthsOpenDis7Log.txt b/examples/src/SimkitOpenDis7Examples/run/RunTwoCraneBerthsOpenDis7Log.txt index aba711da01084e011e06b8f5942e90fb9a725c2e..84d6808b7f615e7a8ce352220840024de2503fd3 100644 GIT binary patch literal 70372 zcmeI5U31e&7KZm0|B9~K8$uDG4}YdA7nzV@QVR@~gxTF9)ReF~i9nXTk{rnV`fb^< z<fe5vYU{Mn#c(kLv3*|md5`+lqg=Ef=j`x?ogQ6ZfAfOFc$ppEhI!<Fy1stP^RG$z zg$J)ve|Z<qvp0WuBip{d=HL9qGU6FKd>MbT!Z_z?>_?VA&%-3PVt>Jp(^YI`VSF2L z@utuIy+0T4n@6jFXUCV};!BwSzU1-CFq@n`7JDH+^5S9@UwutZQ$Oav@HD^6w(qiv z8lqHDcOLl}RK+UZ09Ik*)x*u#8ia9}9}Qmei09&a9u*z<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49w^)kP}Ebg<(12 z{F1hNQ>nSd1FgUh5}@)WrHL(WU=zyw{5fa}vWWDX#HHfo4Mx^{ZOwkv^Mg0aeU|dp zCIeLym5X7VE*y#h$rce<(kd%M)?_JV#II!DZC?>f*If(Z-Ew_2ESzDqXr|4bXVp5v zS~7}*)9!FI=>L6j@?}67Wv^d|GP<!Xbc?$PVj}Nsj0y8Rz-_1oM@t_w&)Ap2SU>yP zde}QM?}qi#U58TZ&C&Z6`x<PVeXYFg>+50f$ds9Vee>+=<z;`c9`=q*nb{v~p8Y|2 z**Dh1-jOLY`^M(kH_FTYa6RlDnKH9K+&ufk^0IHPhrJ_HX7<g^vu~D{{n2{ZJ2GWv zf3$h_N9ASTS`T|irp)YHn`hrDFZ*h+9{8?Kndy_A8~-nUHF&{)ncjM5x%T3(`<AtB z-*Vfx-1aSP*M60r^|o*MTF-jhw{$<&eeFY~4fL$HeM|SVDyQMNO5Hm$W&Ues+qZPt zI}OKG*gG<1X20!Qy6l~X<0|YOnKHBA_AOoZPQ!5(_Kr-M*>C%nE_<ipxC(nmrp)ZO zeM^_U({Nmcy(3d*_S?Rt%iirbt^(iHDKq{5Ro~L1!SyUI#@=X<l_mjc`q9{FxcdHK zgXZZx?<`AhXmF1vDecUfhJ0d~rsCQ=js0r9@nXFgf~HA5yIyN~U)VjJk-#4`RSZ8e z%&@()Q>}X4JDQN5;^OnbKRl`*IBPeVegHb(%(UI+SDW?b({gSosp<zBGEMUJdM$Wf zk1%Er?y-S?aMWmeo-?BAYa>%TN*vS7C(ZiNIBh;T`!p}R=26*CmnWxv7+v;ygVE^E W%Tw4j($HwN^`%W?vGW1OJ?|g-^;`b{ diff --git a/examples/src/SimkitOpenDis7Examples/run/RunTwoCranesBerth.java b/examples/src/SimkitOpenDis7Examples/run/RunTwoCranesBerth.java deleted file mode 100644 index ba18b32837..0000000000 --- a/examples/src/SimkitOpenDis7Examples/run/RunTwoCranesBerth.java +++ /dev/null @@ -1,92 +0,0 @@ -package SimkitOpenDis7Examples.run; - -import SimkitOpenDis7Examples.ShipArrivalProcess; -import SimkitOpenDis7Examples.TwoCraneBerths; -import simkit.Schedule; -import simkit.random.RandomVariate; -import simkit.random.RandomVariateFactory; -import simkit.stat.CollectionSizeTimeVaryingStats; -import simkit.stat.SimpleStatsTally; - -/** - * Run simple two-berth model for 10 years (3650 days). - * <h2>Output:</h2><pre> -ShipArrivalProcess.1 - unloadTimeGenerator = Uniform (0.500, 1.500) - interarrivalTimeGenerator = Exponential (0.700) -TwoCraneBerths.2 - -Simulation ended at time 3,650.0 - -Number of ships arriving: 5,135 -Number of ships unloaded: 5,129 -Maximum # in queue: 11 -Average # in queue: 0.6834 -Average # busy berths: 1.1737 -Average time in system: 1.3207 -Average delay in queue: 0.4857 -</pre> -* - * @author abuss@nps.edu - */ -public class RunTwoCranesBerth -{ - /** Default constructor */ - public RunTwoCranesBerth() - { - // default constructor - } - /** - * Run a simple program and compute statistical measurement of results. - * @param args the command line arguments - */ - public static void main(String[] args) { - RandomVariate interarrivalTimeGenerator = - RandomVariateFactory.getInstance("Exponential", 0.7); - RandomVariate unloadingTimeGenerator = - RandomVariateFactory.getInstance("Uniform", 0.5, 1.5); - ShipArrivalProcess shipArrivalProcess = - new ShipArrivalProcess(interarrivalTimeGenerator, - unloadingTimeGenerator); - - TwoCraneBerths twoCraneBerths = new TwoCraneBerths(); - shipArrivalProcess.addSimEventListener(twoCraneBerths); - - SimpleStatsTally delayInQueueStat = new SimpleStatsTally("delayInQueue"); - SimpleStatsTally timeInSystemStat = new SimpleStatsTally("timeInSystem"); - CollectionSizeTimeVaryingStats numberInQueueStat = - new CollectionSizeTimeVaryingStats("queue"); - CollectionSizeTimeVaryingStats numberInBerthStat = - new CollectionSizeTimeVaryingStats("berth"); -// SimplePropertyDumper simplePropertyDumper = new SimplePropertyDumper(); -// twoCraneBerths.addPropertyChangeListener(simplePropertyDumper); - - twoCraneBerths.addPropertyChangeListener(delayInQueueStat); - twoCraneBerths.addPropertyChangeListener(timeInSystemStat); - twoCraneBerths.addPropertyChangeListener(numberInQueueStat); - twoCraneBerths.addPropertyChangeListener(numberInBerthStat); - - System.out.println(shipArrivalProcess); - System.out.println(twoCraneBerths); - - double stopTime = 10 * 365; - Schedule.stopAtTime(stopTime); - Schedule.setVerbose(false); - - Schedule.reset(); - Schedule.startSimulation(); - - System.out.printf("%nSimulation ended at time %,.1f%n%n", - Schedule.getSimTime()); - - System.out.printf("Number of ships arriving:\t%,d%n", shipArrivalProcess.getNumberArrivals()); - System.out.printf("Number of ships unloaded:\t%,d%n", timeInSystemStat.getCount()); - System.out.printf("Maximum # in queue:\t\t%.0f%n", numberInQueueStat.getMaxObs()); - System.out.printf("Average # in queue:\t\t%.4f%n", numberInQueueStat.getMean()); - System.out.printf("Average # busy berths:\t\t%.4f%n", numberInBerthStat.getMean()); - System.out.printf("Average time in system:\t\t%.4f%n", - timeInSystemStat.getMean()); - System.out.printf("Average delay in queue:\t\t%.4f%n", - delayInQueueStat.getMean()); } - -} -- GitLab