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
510890e4
Commit
510890e4
authored
2 years ago
by
Brutzman, Don
Browse files
Options
Downloads
Patches
Plain Diff
rename
parent
985b84f4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/src/SimkitOpenDis7Examples/run/RunTwoCraneBerths.java
+92
-0
92 additions, 0 deletions
...les/src/SimkitOpenDis7Examples/run/RunTwoCraneBerths.java
with
92 additions
and
0 deletions
examples/src/SimkitOpenDis7Examples/run/RunTwoCraneBerths.java
0 → 100644
+
92
−
0
View file @
510890e4
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
RunTwoCraneBerths
{
/** Default constructor */
public
RunTwoCraneBerths
()
{
// 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
());
}
}
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