Plot of simulation output

Example output

In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import csv
import numpy as np


time = []
cum_service_level = []
service_level = []
call_volume = []
i = 0
with open('/tmp/SimulationSummary.dat', 'rb') as csvfile:
    spamreader = csv.reader(csvfile, delimiter=' ')
    for row in spamreader:
        time.append(row[0])
        cum_service_level.append(row[1])
        service_level.append(row[2])
        call_volume.append(row[3])
        i += 1

fig, ax1 = plt.subplots(figsize=(8,5))
ax1.plot(time, cum_service_level, 'b-', label='Cum Service Level')
ax1.set_xlabel('Time ID in 15 Min Buckets', fontsize='large')
ax1.set_ylabel('Service Level(%)', color='b', fontsize='large')
ax1.set_ylim(0,100)
ax1.xaxis.set_ticks(np.arange(0, 673, 96))
ax1.plot(time, service_level, color='g', label='Service Level')
ax1.grid(True)
ax1.legend(loc='upper center', bbox_to_anchor=(0.5, -0.1),
          fancybox=True, shadow=True, ncol=5)

ax2 = ax1.twinx()
ax2.plot(time, call_volume, 'r-', label='Call Volume')
ax2.set_ylabel('Call Volume in 15 Min buckets', color='r', fontsize='large')
#ax2.legend(loc='upper center', bbox_to_anchor=(0.5, -0.2),
          #fancybox=True, shadow=True, ncol=5)

handles, labels = ax2.get_legend_handles_labels()
lgd = ax2.legend(handles, labels, loc='upper center', bbox_to_anchor=(0.5,-0.2), fancybox=True,shadow=True)

plt.title('Service Level', fontsize='large')
plt.savefig('servicelevel.png', bbox_extra_artists=(lgd,), bbox_inches='tight')
plt.show()
        
In [2]:
%matplotlib inline
import matplotlib.pyplot as plt
import csv
import numpy as np


time = []
cum_wait_time = []
wait_time = []
agents = []
i = 0
with open('/tmp/SimulationSummary.dat', 'rb') as csvfile:
    spamreader = csv.reader(csvfile, delimiter=' ')
    for row in spamreader:
        time.append(row[0])
        cum_wait_time.append(row[6])
        wait_time.append(row[5])
        agents.append(row[4])
        i += 1

fig, ax1 = plt.subplots(figsize=(8,5))
ax1.plot(time, cum_wait_time, 'b-', label='Cum Wait Time(sec)')
ax1.set_xlabel('Time ID in 15 Min Buckets', fontsize='large')
ax1.set_ylabel('Wait Time(sec)', color='b', fontsize='large')
ax1.set_ylim(0,100)
ax1.xaxis.set_ticks(np.arange(0, 673, 96))
ax1.plot(time, wait_time, color='g', label='Wait Time')
ax1.grid(True)
ax1.legend(loc='upper center', bbox_to_anchor=(0.5, -0.1),
          fancybox=True, shadow=True, ncol=5)

ax2 = ax1.twinx()
ax2.plot(time, agents, 'r-', label='Agents')
ax2.set_ylabel('Number of Agents', color='r', fontsize='large')
#ax2.legend(loc='upper center', bbox_to_anchor=(0.5, -0.2),
          #fancybox=True, shadow=True, ncol=5)

handles, labels = ax2.get_legend_handles_labels()
lgd = ax2.legend(handles, labels, loc='upper center', bbox_to_anchor=(0.5,-0.2), fancybox=True,shadow=True)

plt.title('Service Level', fontsize='large')
plt.savefig('waittime.png', bbox_extra_artists=(lgd,), bbox_inches='tight')
plt.show()
In [3]:
%matplotlib inline
import matplotlib.pyplot as plt
import csv
import numpy as np


time = []
actual = []
filtered = []

i = 0
with open('/tmp/sipp.dat', 'rb') as csvfile:
    spamreader = csv.reader(csvfile, delimiter=' ')
    for row in spamreader:
        time.append(row[0])
        actual.append(row[1])
        filtered.append(row[2])
        i += 1

fig, ax1 = plt.subplots(figsize=(8,5))
ax1.plot(time, actual, 'b-', label='Actual/Offered', linewidth=0.5)
ax1.set_xlabel('Time ID in 15 Min Buckets', fontsize='large')
ax1.set_ylabel('Actual/Offered', color='b', fontsize='large')
ax1.set_ylim(0.8,1.2)
ax1.xaxis.set_ticks(np.arange(0, 673, 96))
ax1.grid(True)
ax1.legend(loc='upper center', bbox_to_anchor=(0.5, -0.1),
          fancybox=True, shadow=True, ncol=5)

ax2 = ax1.twinx()
ax2.plot(time, filtered, 'r-', label='Filtered', linewidth=2.0)
ax2.set_ylabel('Filtered', color='r', fontsize='large')
ax2.set_ylim(0.8,1.2)
#ax2.legend(loc='upper center', bbox_to_anchor=(0.5, -0.2),
          #fancybox=True, shadow=True, ncol=5)

handles, labels = ax2.get_legend_handles_labels()
lgd = ax2.legend(handles, labels, loc='upper center', bbox_to_anchor=(0.5,-0.2), fancybox=True,shadow=True)

plt.title('Actual Vs Offered Call Load (Normlized)', fontsize='large')
plt.savefig('ActualVsOffered.png', bbox_extra_artists=(lgd,), bbox_inches='tight')
plt.show()
In [4]:
%matplotlib inline
import matplotlib.pyplot as plt
import csv
import numpy as np


time = []
agents = []
adjustment = []

i = 0
with open('/tmp/sipp.dat', 'rb') as csvfile:
    spamreader = csv.reader(csvfile, delimiter=' ')
    for row in spamreader:
        time.append(row[0])
        agents.append(row[3])
        adjustment.append(row[4])
        i += 1

fig, ax1 = plt.subplots(figsize=(8,5))
ax1.plot(time, agents, 'b-', label='Number of Agents', linewidth=1.0)
ax1.set_xlabel('Time ID in 15 Min Buckets', fontsize='large')
ax1.set_ylabel('Number of Agents Required (Erlang C)', color='b', fontsize='large')
ax1.xaxis.set_ticks(np.arange(0, 673, 96))
ax1.grid(True)
ax1.legend(loc='upper center', bbox_to_anchor=(0.5, -0.1),
          fancybox=True, shadow=True, ncol=5)

ax2 = ax1.twinx()
ax2.plot(time, adjustment, 'r-', label='SIPP Adjustment', linewidth=1.0)
ax2.set_ylabel('SIPP Adjustment', color='r', fontsize='large')
ax2.set_ylim(-10,10)
#ax2.legend(loc='upper center', bbox_to_anchor=(0.5, -0.2),
          #fancybox=True, shadow=True, ncol=5)

handles, labels = ax2.get_legend_handles_labels()
lgd = ax2.legend(handles, labels, loc='upper center', bbox_to_anchor=(0.5,-0.2), fancybox=True,shadow=True)

plt.title('Agent Requirement and SIPP Adjustment', fontsize='large')
plt.savefig('sipp.png', bbox_extra_artists=(lgd,), bbox_inches='tight')
plt.show()
In [ ]: