~thomas-philipp/openwns-systemtest-library/queueing-experimental

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import openwns
import openwns.evaluation
import openwns.evaluation.generators
import openwns.queuingsystem

meanJobProcessingTime = 0.005
meanVacationDuration = 0.01

class Params:
    ro = 0.8
    server = "D"
    arrival = "M"
    multiServerMode = "asynchronous" # synchronous or asynchronous
    vacMode = "MV"  # MV for multiple or SV for single vacation mode
    tLimit = 0.05
    serverCount = 12
params = Params()

meanJobInterArrivalTime = meanJobProcessingTime / (params.ro * params.serverCount)

if params.arrival == "M":
    jobInterArrivalTimeDist = openwns.distribution.NegExp(meanJobInterArrivalTime)
else:
    jobInterArrivalTimeDist = openwns.distribution.Fixed(meanJobInterArrivalTime)

if params.server == "M":
    jobProcessingTimeDist = openwns.distribution.NegExp(meanJobProcessingTime)
else:
    jobProcessingTimeDist = openwns.distribution.Fixed(meanJobProcessingTime)

vacationDurationDist = openwns.distribution.NegExp(meanVacationDuration)


gated_service_ggn = openwns.queuingsystem.GSModel(params.multiServerMode,
                                                  params.vacMode,
                                                  params.serverCount,
                                                  jobInterArrivalTimeDist,
                                                  jobProcessingTimeDist,
                                                  vacationDurationDist,
                                                  params.tLimit)

sim = openwns.Simulator(simulationModel = gated_service_ggn,
                        maxSimTime      = 2000.0)

sim.outputStrategy = openwns.simulator.OutputStrategy.DELETE

node = openwns.evaluation.createSourceNode(sim, 'QueueSize')
node.getLeafs().appendChildren(openwns.evaluation.generators.SettlingTimeGuard(5.0))
node.getLeafs().appendChildren(openwns.evaluation.generators.Moments())
node.getLeafs().appendChildren(openwns.evaluation.generators.PDF(minXValue = 0.0, maxXValue = 150.0, resolution = 150))

node = openwns.evaluation.createSourceNode(sim, 'SojournTime')
node.getLeafs().appendChildren(openwns.evaluation.generators.SettlingTimeGuard(5.0))
node.getLeafs().appendChildren(openwns.evaluation.generators.Moments())
node.getLeafs().appendChildren(openwns.evaluation.generators.PDF(minXValue = 0.0, maxXValue = 0.1, resolution = 1000))

node = openwns.evaluation.createSourceNode(sim, 'WaitingTime')
node.getLeafs().appendChildren(openwns.evaluation.generators.SettlingTimeGuard(5.0))
node.getLeafs().appendChildren(openwns.evaluation.generators.Moments())
node.getLeafs().appendChildren(openwns.evaluation.generators.PDF(minXValue = 0.0, maxXValue = 0.1, resolution = 1000))

openwns.setSimulator(sim)