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
adf2c3b2
Commit
adf2c3b2
authored
1 year ago
by
dansl
Browse files
Options
Downloads
Patches
Plain Diff
Commit additions for Steady State and Transient Stats
parent
cf796e91
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MV3302ClassCode/src/mv3302/StoppedPartArrivalProcess.java
+12
-13
12 additions, 13 deletions
MV3302ClassCode/src/mv3302/StoppedPartArrivalProcess.java
MV3302ClassCode/src/mv3302/run/RunTransientAnalysis.java
+20
-15
20 additions, 15 deletions
MV3302ClassCode/src/mv3302/run/RunTransientAnalysis.java
with
32 additions
and
28 deletions
MV3302ClassCode/src/mv3302/StoppedPartArrivalProcess.java
+
12
−
13
View file @
adf2c3b2
...
...
@@ -6,14 +6,15 @@ package mv3302;
import
simkit.random.RandomVariate
;
/**
*
* @author dansl
*/
public
final
class
StoppedPartArrivalProcess
extends
PartArrivalProcess
{
private
RandomVariate
interarrivalTimeGenerator
;
//
private RandomVariate interarrivalTimeGenerator;
public
int
stopTime
;
//int stopTime = 480;
/**
* Zero-argument constructor
...
...
@@ -27,13 +28,13 @@ public final class StoppedPartArrivalProcess extends PartArrivalProcess {
*
* @param interarrivalTimes Given inter arrival times
*/
public
StoppedPartArrivalProcess
(
RandomVariate
interarrivalTimeGenerator
)
{
setInterarrivalTimeGenerator
(
interarrivalTimeGenerator
)
;
public
StoppedPartArrivalProcess
(
int
stopTime
)
{
this
.
stopTime
=
stopTime
;
}
@Override
public
void
doRun
()
{
waitDelay
(
"StopArrivals"
,
interarrivalTimeGenerator
);
waitDelay
(
"StopArrivals"
,
getStopTime
()
);
}
/**
...
...
@@ -45,18 +46,16 @@ public final class StoppedPartArrivalProcess extends PartArrivalProcess {
}
/**
* @return the
interarrivalTimeGenerator
* @return the
stopTime
*/
@Override
public
RandomVariate
getInterarrivalTimeGenerator
()
{
return
interarrivalTimeGenerator
;
public
int
getStopTime
()
{
return
stopTime
;
}
/**
* @param
interarrivalTimeGenerator the interarrivalTimeGenerator
to set
* @param
stopTime the stopTime
to set
*/
@Override
public
void
setInterarrivalTimeGenerator
(
RandomVariate
interarrivalTimeGenerator
)
{
this
.
interarrivalTimeGenerator
=
interarrivalTimeGenerator
;
public
void
setStopTime
(
int
stopTime
)
{
this
.
stopTime
=
stopTime
;
}
}
This diff is collapsed.
Click to expand it.
MV3302ClassCode/src/mv3302/run/RunTransientAnalysis.java
+
20
−
15
View file @
adf2c3b2
package
mv3302.run
;
import
static
java
.
lang
.
Math
.
sqrt
;
import
mv3302.PartArrivalProcess
;
import
mv3302.StoppedPartArrivalProcess
;
import
mv3302.TransferLineComponent
;
import
mv3302.TransientStats
;
...
...
@@ -22,7 +23,9 @@ public class RunTransientAnalysis {
public
static
void
main
(
String
args
[])
{
RandomVariate
interarrivalTimeGenerator
=
RandomVariateFactory
.
getInstance
(
"Exponential"
,
2.5
);
StoppedPartArrivalProcess
arrivalProcess
=
new
StoppedPartArrivalProcess
(
interarrivalTimeGenerator
);
int
stopTime
=
480
;
PartArrivalProcess
partArrivalProcess
=
new
PartArrivalProcess
(
interarrivalTimeGenerator
);
StoppedPartArrivalProcess
stoppedArrivalProcess
=
new
StoppedPartArrivalProcess
(
stopTime
);
RandomVariate
[]
processingTimeGenerator
=
{
RandomVariateFactory
.
getInstance
(
"Exponential"
,
2.4
),
RandomVariateFactory
.
getInstance
(
"Gamma"
,
3.2
,
3.3
),
RandomVariateFactory
.
getInstance
(
"Uniform"
,
4.5
,
6.7
),
RandomVariateFactory
.
getInstance
(
"Exponential"
,
3.0
)};
...
...
@@ -35,36 +38,38 @@ public class RunTransientAnalysis {
TransferLineComponent
transferLineComponent
=
new
TransferLineComponent
(
processingTimeGenerator
,
totalNumberWorkstations
);
arrivalProcess
.
addSimEventListener
(
transferLineComponent
);
partArrivalProcess
.
addSimEventListener
(
transferLineComponent
);
stoppedArrivalProcess
.
addSimEventListener
(
transferLineComponent
);
TransientStats
delayInQueueTransient
=
new
TransientStats
(
"delayInQueue"
);
// SimpleStatsTally delayInQueueTransient = new SimpleStatsTally("delayInQueue");
//
SimpleStatsTally
totalTimeInSystemStat
=
new
SimpleStatsTally
(
"totalTimeInSystem"
);
SimpleStatsTally
delayInQueueStat
=
new
SimpleStatsTally
(
"delayInQueue"
);
transferLineComponent
.
addPropertyChangeListener
(
delayInQueueTransient
);
transferLineComponent
.
addPropertyChangeListener
(
totalTimeInSystemStat
);
System
.
out
.
println
(
arrivalProcess
);
System
.
out
.
println
(
partArrivalProcess
);
System
.
out
.
println
(
stoppedArrivalProcess
);
System
.
out
.
println
(
transferLineComponent
);
SimpleStatsTally
outer
DelayInQueue
Stat
=
new
SimpleStatsTally
(
"outer
DelayInQueue
"
);
SimpleStatsTally
outer
TimeInSystem
Stat
=
new
SimpleStatsTally
(
"outer
TimeInSystem
"
);
int
stopTime
=
5
0
;
int
numberReplications
=
20
0
;
double
alpha
=
0.05
;
Schedule
.
stopOnEvent
(
stopTime
,
"Arrival"
);
Schedule
.
stopOnEvent
(
10000
,
"Arrival"
);
System
.
out
.
println
(
"Avg Delay In Queue"
);
for
(
int
replication
=
1
;
replication
<=
stopTime
;
++
replication
)
{
Schedule
.
reset
();
delayInQueueTransien
t
.
reset
();
totalTimeInSystemSta
t
.
reset
();
Schedule
.
startSimulation
();
outer
DelayInQueue
Stat
.
newObservation
(
delayInQueue
Stat
.
getMean
());
outer
TimeInSystem
Stat
.
newObservation
(
totalTimeInSystem
Stat
.
getMean
());
System
.
out
.
printf
(
"%d %.3f ± %.3f%n"
,
replication
,
outer
DelayInQueue
Stat
.
getMean
(),
outer
DelayInQueue
Stat
.
getStandardDeviation
()
*
StudentT
.
getQuantile
(
1.0
-
0.5
*
alpha
,
outer
DelayInQueue
Stat
.
getCount
()
-
1
)
/
sqrt
(
outer
DelayInQueue
Stat
.
getCount
())
outer
TimeInSystem
Stat
.
getMean
(),
outer
TimeInSystem
Stat
.
getStandardDeviation
()
*
StudentT
.
getQuantile
(
1.0
-
0.5
*
alpha
,
outer
TimeInSystem
Stat
.
getCount
()
-
1
)
/
sqrt
(
outer
TimeInSystem
Stat
.
getCount
())
);
}
...
...
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