sys.exit(1) # PDQ modeling code starts here ... jNet = JackNet("SimPy Jackson Network", 1) # create an instance pdq.Init(jNet.name) pdq.SetWUnit("Msgs") pdq.SetTUnit("Time") # Create PDQ context and workload for the network streams = pdq.CreateOpen(jNet.work, jNet.arrivRate) # Create PDQ queues for i in range(len(jNet.router)): nodes = pdq.CreateNode(jNet.router[i], pdq.CEN, pdq.FCFS) pdq.SetVisits(jNet.router[i], jNet.work, jNet.visitRatio[i], \ jNet.servTime[i]) # Solve the model and report the peformance measures pdq.Solve(pdq.CANON) pdq.Report() # generic PDQ format # Collect particular PDQ statistics print "---------- Selected PDQ Metrics for SimPy Comparison ---------" for i in range(len(jNet.router)): msgs = pdq.GetQueueLength(jNet.router[i], jNet.work, pdq.TRANS) print "Mean queue%d: %7.4f (%s)" % (i + 1, msgs, "Not in SimPy report") jNet.totalMsgs += msgs print "Mean number: %7.4f" % jNet.totalMsgs print "Mean delay: %7.4f %11s" % (pdq.GetResponse(pdq.TRANS, jNet.work), \ "(Little's law Q = X R holds!)")
# Based on open_feedback rx_prob = 0.30 inter_arriv_rate = 0.5 service_time = 0.75 mean_visits = 1.0 / (1.0 - rx_prob) #----- Initialize the model ------------------------------------------ pdq.Init("Open Feedback") #---- Define the queueing center ------------------------------------- pdq.nodes = pdq.CreateNode("channel", pdq.CEN, pdq.FCFS) #---- Define the workload and circuit type --------------------------- pdq.streams = pdq.CreateOpen("message", inter_arriv_rate) #---- Define service demand due to workload on the queueing center --- pdq.SetVisits("channel", "message", mean_visits, service_time) #---- Must import the CANONical method for an open circuit ----------- pdq.Solve(pdq.CANON) pdq.Report() #---------------------------------------------------------------------
import pdq L = 50 S = 0.01 pdq.Init("example 7") nodes = pdq.CreateNode("Kanal", pdq.CEN, pdq.FCFS) stream = pdq.CreateOpen("Poruka", L) pdq.SetVisits("Kanal", "Poruka", 1.0 / 0.7, S) # pdq.SetDemand("Kanal", "Poruka", S) pdq.Solve(pdq.CANON) pdq.Report()