def executeMonitorPlots (self): self.printSep() print "- Generating graph files" for each in self.monitorPlots: fileName = each + " series - Seed " + str(self.seed) + ".ps" plot = SimPlot () pl = plot.plotLine (self.monitorPlots[each], color="blue",width=2) pl.postscr(fileName) print "Graph file created\t:\t " + fileName
edge = [ind, rod] self.EdgeList.append(edge) self.EdgeList = dict(self.EdgeList) def channelOn(self, chn): self.EdgeList[chn].color = v.color.red def channelOff(self, chn): self.EdgeList[chn].color = v.color.green initialize() Net = Network() if G.vis_on: V = Vis() for N in Net.Nodes: N.initCounterparts() N.activate() simulate(until=G.max_time) print 'Sim Finished, Visualising graphs...' if not G.vis_on: plt = SimPlot() plt2 = SimPlot() plt2.plotLine(Net.waitQMon) plt.plotLine(Net.activeQMon) plt.mainloop() #nx.draw(Net.graph_plan) #plt.show()
self.EdgeList[chn].color=v.color.red def channelOff(self,chn): self.EdgeList[chn].color=v.color.green initialize() Net = Network() if G.vis_on: V = Vis() for N in Net.Nodes: N.initCounterparts() N.activate() simulate(until=G.max_time) print 'Sim Finished, Visualising graphs...' if not G.vis_on: plt = SimPlot() plt2 = SimPlot() plt2.plotLine(Net.waitQMon) plt.plotLine(Net.activeQMon) plt.mainloop() #nx.draw(Net.graph_plan) #plt.show()
self.group = grp def execute(self): yield hold, self, random.expovariate(1.0/lamb_da) while True: for server in serverList: if server.name==self.group: yield put,self,server,1 yield hold, self, random.expovariate(1.0/lamb_da) initialize() for grp in group_sizes: server = Level(name=grp, unitName='bandWidth', capacity='unbounded', monitored=True) serverList.append(server) for person in range(group_sizes[grp]): p = Person(grp) activate(p,p.execute()) N = Network() activate(N,N.execute()) simulate(until=30) plt = SimPlot() for s in serverList: plt.plotLine(s.bufferMon) plt.mainloop() print 'done'
recipient = self.got[0].origin P = Packet(recipient, self.ID, 'ARQ') yield put, self, self.MacOut.macOutQueue, [P] class Packet(): def __init__(self, recipient, origin, p_type): self.recipient = recipient self.origin = origin self.p_type = p_type #ARQ or Data ('out') initialize() Network.Nodes = [NodeHead(i) for i in range(G.node_num)] for N in Network.Nodes: N.initCounterparts() N.activate() simulate(until=G.max_time) print 'Sim Finished, Visualising graphs...' plt = SimPlot() plt2 = SimPlot() plt2.plotLine(Network.Channels.waitMon) plt.plotLine(Network.Channels.actMon) plt.mainloop()
# Prog1.py from SimPy.SimPlot import * plt = SimPlot() plt.plotLine([[0, 0], [1, 1], [2, 4], [3, 9]]) plt.mainloop()
def MyXYPlot(X, Y): Z = zip(X, Y) plt = SimPlot() plt.plotLine(Z) plt.mainloop()
#print self.ID, 'got ARQ, putting in ScreenResponse' yield put, self, self.Computer.ScreenResponse, self.got #print self.ID, 'put in screenResponse SUCCESS' elif self.got[0].p_type == 'out': #print self.ID, 'got DATA, putting ARQ in macOutQueue' recipient = self.got[0].origin P = Packet(recipient, self.ID, 'ARQ') yield put, self, self.MacOut.macOutQueue, [P] #print self.ID, 'put in macOutQueue SUCCESS' class Packet(): def __init__(self, recipient, origin, p_type): self.recipient = recipient self.origin = origin self.p_type = p_type initialize() Network.Nodes = [NodeHead(i) for i in range(G.node_num)] for N in Network.Nodes: N.initCounterparts() N.activate() simulate(until=G.max_time) print 'Sim Finished, Visualising graphs...' plt = SimPlot() #plt.plotLine(Network.Channels.waitMon) plt.plotLine(Network.Channels.actMon) plt.mainloop()
# Prog2.py from SimPy.SimPlot import * plt = SimPlot() plt.plotLine([[0, 0], [1, 1], [2, 4], [3, 9]], title="This is prettier", color="red", width=2, smooth=True) plt.mainloop()