forked from kpg141260/Erlang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherlang_test.py
126 lines (111 loc) · 5.56 KB
/
erlang_test.py
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import erlang_c
# Create object from Erlang_C class
# (SLA, TTA, ATT, ACW, ABNT, MAX_WAIT, NV, CCC, INTERVAL, OPS_HRS)
ec = erlang_c.Erlang(0.80, 30, 300, 40, 20, 30, False, 1, 60, 16)
# Assumptions for this example - Call Center
# (SLA) Service Level of 80% of calls answered in 30 seconds
# (TTA) Time to Answer = 20 seconds
# (AIT) Average Interaction Time = 300 seconds
# (AIW) Average After Call Wrap = 40 seconds
# (ABNT) Average Abandon Time = 20 seconds
# Max Wait Time = 30 seconds
# (NV) Non-Voice = False - this is for voice
# (CCC) Concurrent Transactions per agent is 1
# The interval is 60 minutes
# operations hours are 16 hours
# Service Time is 30 seconds - this is the target for the answer time after a phone rings
service_time = 30
call_data = [["08:00", 100], ["09:00", 120], ["10:00", 168], ["11:00", 236], ["12:00", 331], ["13:00", 464], ["14:00", 650], ["15:00", 910], ["16:00", 546], ["17:00", 328], ["18:00", 197], ["19:00", 119], ["20:00", 72], ["21:00", 44], ["22:00", 27], ["23:00", 17]]
max_call_vol = 0
idx = 0
count = 0
for x in call_data:
if x[1] > max_call_vol:
max_call_vol = x[1]
idx = count
count += 1
agents = ec.Agents (service_time, max_call_vol)
ec.print_info()
print ("\n-- Calculations for maximum call volume --\n")
x = call_data[idx]
print ("Largest Call Volume found at {} with {} calls.".format(x[0], x[1]))
print ("\nUsing largest call volume {} for next calculations...\n".format(x[1]))
print ("Agents: {}".format(agents))
print ("Utilisation: {:0.2f}".format(ec.Utilisation(agents, max_call_vol) * 100))
print ("Trunks: {}".format(ec.Trunks(agents, max_call_vol)))
print ("SLA: {:0.2f}".format(ec.SLA(agents, max_call_vol, service_time) * 100))
print ("ASA: {}sec".format(ec.ASA(agents, max_call_vol)))
print ("Abandoned: {:0.2f}".format(ec.Abandon(agents, max_call_vol) * 100))
print ("Queued: {:0.2f}".format(ec.Queued(agents, max_call_vol) * 100))
print ("Queue Time {}sec".format(ec.QueueTime(agents, max_call_vol)))
print ("Queue Size {}".format(ec.QueueSize(agents, max_call_vol)))
print ("\nCalculating data set...\n")
print ("Time Agents Utilisation SLA ASA Abandoned Queued Queue-Time Queue-Size")
print ("-----------------------------------------------------------------------------------------")
for x in call_data:
tm = x[0]
ag = ec.Agents (service_time, x[1])
ut = ec.Utilisation(ag, x[1]) * 100
sla = ec.SLA(ag, x[1], service_time) * 100
asa = ec.ASA(ag, x[1])
abn = ec.Abandon(ag, x[1]) * 100
qc = ec.Queued(ag, x[1]) * 100
qt = ec.QueueTime(ag, x[1])
qs = ec.QueueSize(ag, x[1])
print ("{} {} {:0.2f}% {:0.2f}% {:0}sec {:0.2f}% {:0.2f}% {} {}".format(tm, ag, ut, sla, asa, abn, qc, qt, qs))
print ()
del ec
# Create new object from Erlang_C class
# (SLA, TTA, ATT, ACW, ABNT, MAX_WAIT, NV, CCC, INTERVAL, OPS_HRS)
ec = erlang_c.Erlang(0.80, 30, 300, 40, 20, 30, True, 3, 60, 16)
# Assumptions for this example - Call Center
# (SLA) Service Level of 80% of calls answered in 30 seconds
# (TTA) Time to Answer = 20 seconds
# (AIT) Average Interaction Time = 300 seconds
# (AIW) Average After Call Wrap = 40 seconds
# (ABNT) Average Abandon Time = 20 seconds
# Max Wait Time = 30 seconds
# (NV) Non-Voice = True - this is for chat
# (CCC) Concurrent Transactions per agent is 3 - meaning an agent can handle 3 chat sessions concurrently
# The interval is 60 minutes
# operations hours are 16 hours
# Service Time is 30 seconds - this is the target for the answer time after a phone rings
service_time = 30
call_data = [["08:00", 100], ["09:00", 120], ["10:00", 168], ["11:00", 236], ["12:00", 331], ["13:00", 464], ["14:00", 650], ["15:00", 910], ["16:00", 546], ["17:00", 328], ["18:00", 197], ["19:00", 119], ["20:00", 72], ["21:00", 44], ["22:00", 27], ["23:00", 17]]
max_call_vol = 0
idx = 0
count = 0
for x in call_data:
if x[1] > max_call_vol:
max_call_vol = x[1]
idx = count
count += 1
agents = ec.Agents (service_time, max_call_vol)
ec.print_info()
print ("\n-- Calculations for maximum call volume --\n")
x = call_data[idx]
print ("Largest Call Volume found at {} with {} calls.".format(x[0], x[1]))
print ("\nUsing largest call volume {} for next calculations...\n".format(x[1]))
print ("Agents: {}".format(agents))
print ("Utilisation: {:0.2f}".format(ec.Utilisation(agents, max_call_vol) * 100))
print ("SLA: {:0.2f}".format(ec.SLA(agents, max_call_vol, service_time) * 100))
print ("ASA: {}sec".format(ec.ASA(agents, max_call_vol)))
print ("Abandoned: {:0.2f}".format(ec.Abandon(agents, max_call_vol) * 100))
print ("Queued: {:0.2f}".format(ec.Queued(agents, max_call_vol) * 100))
print ("Queue Time {}sec".format(ec.QueueTime(agents, max_call_vol)))
print ("Queue Size {}".format(ec.QueueSize(agents, max_call_vol)))
print ("\nCalculating data set...\n")
print ("Time Agents Utilisation SLA ASA Abandoned Queued Queue-Time Queue-Size")
print ("-----------------------------------------------------------------------------------------")
for x in call_data:
tm = x[0]
ag = ec.Agents (service_time, x[1])
ut = ec.Utilisation(ag, x[1]) * 100
sla = ec.SLA(ag, x[1], service_time) * 100
asa = ec.ASA(ag, x[1])
abn = ec.Abandon(ag, x[1]) * 100
qc = ec.Queued(ag, x[1]) * 100
qt = ec.QueueTime(ag, x[1])
qs = ec.QueueSize(ag, x[1])
print ("{} {} {:0.2f}% {:0.2f}% {:0}sec {:0.2f}% {:0.2f}% {} {}".format(tm, ag, ut, sla, asa, abn, qc, qt, qs))
print ()