Esempio n. 1
0
def GetProdU():
    pdq.Init("")

    pdq.streams = pdq.CreateClosed("Production", pdq.TERM, 20.0, 20.0)
    pdq.nodes = pdq.CreateNode("CPU", pdq.CEN, pdq.FCFS)
    pdq.nodes = pdq.CreateNode("DK1", pdq.CEN, pdq.FCFS)
    pdq.nodes = pdq.CreateNode("DK2", pdq.CEN, pdq.FCFS)

    pdq.SetDemand("CPU", "Production", 0.30)
    pdq.SetDemand("DK1", "Production", 0.08)
    pdq.SetDemand("DK2", "Production", 0.10)

    pdq.Solve(pdq.APPROX)

    return (pdq.GetUtilization("CPU", "Production", pdq.TERM))
Esempio n. 2
0
def multiserver(m, stime):
    work = "reqs"
    node = "bus"

    x = 0.0

    for i in range(1, CPUS + 1):
        if (i <= m):
            pdq.Init("multibus")

            streams = pdq.CreateClosed(work, pdq.TERM, i, 0.0)
            nodes = pdq.CreateNode(node, pdq.CEN, pdq.ISRV)

            pdq.SetDemand(node, work, stime)
            pdq.Solve(pdq.EXACT)

            x = pdq.GetThruput(pdq.TERM, work)

            sm_x[i] = x
        else:
            sm_x[i] = x
Esempio n. 3
0
def mem_model(n, m):
    x = 0.0

    for i in range(1, n + 2):
        if (i <= m):
            pdq.Init("")

            pdq.nodes = pdq.CreateNode("CPU", pdq.CEN, pdq.FCFS)
            pdq.nodes = pdq.CreateNode("DK1", pdq.CEN, pdq.FCFS)
            pdq.nodes = pdq.CreateNode("DK2", pdq.CEN, pdq.FCFS)

            pdq.streams = pdq.CreateClosed("work", pdq.TERM, i, 0.0)

            pdq.SetDemand("CPU", "work", 3.0)
            pdq.SetDemand("DK1", "work", 4.0)
            pdq.SetDemand("DK2", "work", 2.0)

            pdq.Solve(pdq.EXACT)

            x = pdq.GetThruput(pdq.TERM, "work")

            sm_x.append(x)
        else:
            sm_x.append(x)  # last computed value
Esempio n. 4
0
#
#---------------------------------------------------------------------

import pdq

#---------------------------------------------------------------------
# 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 -----------
Esempio n. 5
0
###############################################################################

#
#  $Id: open1.py,v 1.3 2009/03/26 02:55:32 pfeller Exp $
#
#---------------------------------------------------------------------

import pdq

arrivalRate = 0.75
serviceTime = 1.0


#---- Initialize the system ------------------------------------------

pdq.Init("Open Center in PyDQ")
pdq.SetComment("This is just a simple M/M/1 queue.");


pdq.nodes = pdq.CreateNode("server", pdq.CEN, pdq.FCFS)

pdq.streams = pdq.CreateOpen("work", arrivalRate)
   
pdq.SetWUnit("Customers")
pdq.SetTUnit("Seconds")

pdq.SetDemand("server", "work", serviceTime)

pdq.Solve(pdq.CANON)

Esempio n. 6
0
#
# Based on time_share.c
#
# Illustrates PDQ solver for closed uni-server queue.  Compare with repair.c
#

##### Model specific variables #######################################

#pop   = 200.0
pop = 100.0
think = 300.0
servt = 0.63

##### Initialize the model giving it a name ##########################

pdq.Init("Time Share Computer")
pdq.SetComment("This is just a simple M/M/1 queue.")

##### Define the workload and circuit type ###########################

pdq.streams = pdq.CreateClosed("compile", pdq.TERM, pop, think)

##### Define the queueing center #####################################

pdq.nodes = pdq.CreateNode("CPU", pdq.CEN, pdq.FCFS)

##### Define service demand ##########################################

pdq.SetDemand("CPU", "compile", servt)

##### Solve the model ################################################
Esempio n. 7
0
            break


#---------------------------------------------------------------------

think = 10.0
importrs = 300

Sifp = 0.10
Samp = 0.60
Sdsu = 1.20
Nifp = 15
Namp = 50
Ndsu = 100

pdq.Init("Teradata DBC-10/12")

# Create parallel centers

for k in range(Nifp):
    name = "IFP%d" % k
    nodes = pdq.CreateNode(name, pdq.CEN, pdq.FCFS)

for k in range(Namp):
    name = "AMP%d" % k
    nodes = pdq.CreateNode(name, pdq.CEN, pdq.FCFS)

for k in range(Ndsu):
    name = "DSU%d" % k
    nodes = pdq.CreateNode(name, pdq.CEN, pdq.FCFS)
Esempio n. 8
0
#
# open1msq.py
#
# Created by NJG on Fri, Apr 13, 2007 (test MSQ vs. M/M/1 in PyDQ)
#
#  $Id: open1msq.py,v 1.2 2009/03/26 02:55:32 pfeller Exp $
#
#---------------------------------------------------------------------

import pdq

arrivalRate = 0.75
serviceTime = 1.0

pdq.Init("Open1 MSQ Test")
pdq.SetComment("Cf. M/M/1/FCFS against MSQ with m=1 in PyDQ.")

pdq.streams = pdq.CreateOpen("work", arrivalRate)

pdq.SetWUnit("Customers")
pdq.SetTUnit("Seconds")

pdq.nodes = pdq.CreateNode("MM1", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("MMm", 1, pdq.MSQ)

pdq.SetDemand("MM1", "work", serviceTime)
pdq.SetDemand("MMm", "work", serviceTime)

pdq.Solve(pdq.CANON)
Esempio n. 9
0
#---------------------------------------------------------------------

# Prevent this program from loading pdq.py in this directory
import sys
del sys.path[0]

import pdq

#---- Define globals -------------------------------------------------

arrivRate = 0.75
service_time = 1.0

#---- Initialize -----------------------------------------------------

pdq.Init("OpenCenter")
pdq.SetComment("A simple M/M/1 queue")

#---- Define the workload and circuit type ---------------------------

pdq.streams = pdq.CreateOpen("work", arrivRate)

pdq.SetWUnit("Customers")
pdq.SetTUnit("Seconds")

#---- Define the queueing center -------------------------------------

pdq.nodes = pdq.CreateNode("server", pdq.CEN, pdq.FCFS)

#---- Define service demand due to workload on the queueing center ---
Esempio n. 10
0
#  This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY  #
#  KIND, either express or implied.                                           #
###############################################################################

#
# mmm.py
#
# Created by NJG on Fri, Apr 13, 2007
#

import pdq

# Parameters taken from mmm_sim.py file
arrivalRate = 2.0
serviceTime = 1.0

pdq.Init("M/M/m in PyDQ")
pdq.SetComment("Cf. SimPy Results.")

pdq.streams = pdq.CreateOpen("work", arrivalRate)
pdq.SetWUnit("Customers")
pdq.SetTUnit("Seconds")

pdq.nodes = pdq.CreateNode("server", 3, pdq.MSQ)

pdq.SetDemand("server", "work", serviceTime)

pdq.Solve(pdq.CANON)

pdq.Report()
Esempio n. 11
0
    demand[(CD_Msg, FDarray[i].id)] = (1.0 * 0.5 / 128.9) / FS_DISKS
    demand[(RQ_Msg, FDarray[i].id)] = (1.5 * 0.5 / 128.9) / FS_DISKS
    demand[(SU_Msg, FDarray[i].id)] = (0.5 * 0.5 / 128.9) / FS_DISKS

#  Mainframe DASD I/Os = (#accesses / (max IOs/Sec)) / #disks

for i in range(MF_DISKS):
    demand[(MF_CD, MDarray[i].id)] = (2.0 / 60.24) / MF_DISKS
    demand[(MF_RQ, MDarray[i].id)] = (4.0 / 60.24) / MF_DISKS
    demand[(MF_SU, MDarray[i].id)] = (1.0 / 60.24) / MF_DISKS

# demand.dump()

#----- Start building the PDQ model --------------------------------------------

pdq.Init(scenario)

#  Define physical resources as queues ...

no_nodes = pdq.CreateNode("PC", pdq.CEN, pdq.FCFS)
no_nodes = pdq.CreateNode("FS", pdq.CEN, pdq.FCFS)

for i in range(FS_DISKS):
    no_nodes = pdq.CreateNode(FDarray[i].label, pdq.CEN, pdq.FCFS)

no_nodes = pdq.CreateNode("GW", pdq.CEN, pdq.FCFS)
no_nodes = pdq.CreateNode("MF", pdq.CEN, pdq.FCFS)

for i in range(MF_DISKS):
    no_nodes = pdq.CreateNode(MDarray[i].label, pdq.CEN, pdq.FCFS)
Esempio n. 12
0
#  This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY  #
#  KIND, either express or implied.                                           #
###############################################################################

#
# Created by NJG on Wed, Apr 18, 2007
#
# Queueing model of an email-spam analyzer system comprising a
# battery of SMP servers essentially running in batch mode.
# Each node was a 4-way SMP server.
# The performance metric of interest was the mean queue length.
#
# This simple M/M/4 model gave results that were in surprisingly
# good agreement with monitored queue lengths.
#
# $Id: spamcan.py,v 1.2 2009/03/26 02:55:32 pfeller Exp $

import pdq

# Measured parameters
servers = 4
arivrate = 0.66  # per min
servtime = 6.0  # seconds

pdq.Init("SPAM Analyzer")
nstreams = pdq.CreateOpen("Email", arivrate)
nnodes = pdq.CreateNode("spamCan", int(servers), pdq.MSQ)
pdq.SetDemand("spamCan", "Email", servtime)
pdq.Solve(pdq.CANON)
pdq.Report()
Esempio n. 13
0
#  KIND, either express or implied.                                           #
###############################################################################

#
# Created by NJG on Wed, Apr 18, 2007
#
# Queueing model of an email-spam analyzer system comprising a
# battery of SMP servers essentially running in batch mode.
# Each node was a 4-way SMP server.
# The performance metric of interest was the mean queue length.
#
# This simple M/M/4 model gave results that were in surprisingly
# good agreement with monitored queue lengths.
#
# $Id: spamcan1.py,v 1.2 2009/03/31 00:48:34 pfeller Exp $

import pdq

# Measured performance parameters
cpusPerServer = 4
emailThruput = 2376  # emails per hour
scannerTime = 6.0  # seconds per email

pdq.Init("Spam Farm Model")
# Timebase is SECONDS ...
nstreams = pdq.CreateOpen("Email", float(emailThruput) / 3600)
nnodes = pdq.CreateNode("spamCan", int(cpusPerServer), pdq.MSQ)
pdq.SetDemand("spamCan", "Email", scannerTime)
pdq.Solve(pdq.CANON)
pdq.Report()
Esempio n. 14
0
#
#  $Id: mc-test.py,v 4.3 2009/03/26 02:55:32 pfeller Exp $
#
#---------------------------------------------------------------------

import pdq

#---------------------------------------------------------------------
#  Based on multiclass-test.c
#
#  Test Exact.c lib
#
#  From A.Allen Example 6.3.4, p.413
#---------------------------------------------------------------------

pdq.Init("Multiclass Test")

#---- Define the workload and circuit type ---------------------------

pdq.streams = pdq.CreateClosed("term1", pdq.TERM, 5.0, 20.0)
pdq.streams = pdq.CreateClosed("term2", pdq.TERM, 15.0, 30.0)
pdq.streams = pdq.CreateClosed("batch", pdq.BATCH, 5.0, 0.0)

#---- Define the queueing center -------------------------------------

pdq.nodes = pdq.CreateNode("node1", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("node2", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("node3", pdq.CEN, pdq.FCFS)

#---- Define service demand ------------------------------------------
Esempio n. 15
0
            dbstr3 = "Visits: %5.4f %5.4f %5.4f" % (self.visitRatio[0], \
               self.visitRatio[1], self.visitRatio[2])
            ShowState("%s\n%s\n%s\n%s" % (dbstr0, dbst1, dbstr2, dbstr3))


def ShowState(*L):
    """ L is a list of strings.  Displayed by sys.stderr as concatenated 
        elements of L and then stops execution
    """
    sys.stderr.write("*** Trace state *** \n%s\n***\n" % "".join(L))
    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()
Esempio n. 16
0

#---- Initialize the model -----------------------------------------------------

tech = pdq.APPROX

if (tech == pdq.EXACT):
   technique = "EXACT"
else:
   technique = "APPROX"

print "**** %s Solution ****:\n" % technique
print "  N      R (w1)    R (w2)"

for pop in range(1, 10):
   pdq.Init("Test_Exact_calc")

   #---- Define the workload and circuit type ----------------------------------

   pdq.streams = pdq.CreateClosed("w1", pdq.TERM, 1.0 * pop, think)
   pdq.streams = pdq.CreateClosed("w2", pdq.TERM, 1.0 * pop, think)

   #---- Define the queueing center --------------------------------------------

   pdq.nodes = pdq.CreateNode("node", pdq.CEN, pdq.FCFS)

   #---- service demand --------------------------------------------------------

   pdq.SetDemand("node", "w1", 1.0)
   pdq.SetDemand("node", "w2", 0.5)
Esempio n. 17
0
#!/usr/bin/env python
###############################################################################
#  Copyright (C) 1994 - 2009, Performance Dynamics Company                    #
#                                                                             #
#  This software is licensed as described in the file COPYING, which          #
#  you should have received as part of this distribution. The terms           #
#  are also available at http://www.perfdynamics.com/Tools/copyright.html.    #
#                                                                             #
#  You may opt to use, copy, modify, merge, publish, distribute and/or sell   #
#  copies of the Software, and permit persons to whom the Software is         #
#  furnished to do so, under the terms of the COPYING file.                   #
#                                                                             #
#  This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY  #
#  KIND, either express or implied.                                           #
###############################################################################

#
# M/M/1 in PyDQ

import pdq

pdq.Init("Python Test Script")
pdq.nodes = pdq.CreateNode("Deadhorse", pdq.CEN, pdq.FCFS)
pdq.streams = pdq.CreateOpen("Floggit", 0.75)
pdq.SetWUnit("Cust")
pdq.SetTUnit("Min")
pdq.SetDemand("Deadhorse", "Floggit", 1.0)
pdq.Solve(pdq.CANON)
pdq.Report()
Esempio n. 18
0
Zinvl = ZX
Zwthr = ZX

Xcpu = 0.0
Pcpu = 0.0
Ubrd = 0.0
Ubwr = 0.0
Ubin = 0.0
Ucht = 0.0
Ucrd = 0.0
Ucwr = 0.0
Ucin = 0.0

#---------------------------------------------------------------------

pdq.Init("ABC Model")

#----- Create single bus queueing center -----------------------------

nodes = pdq.CreateNode(BUS, pdq.CEN, pdq.FCFS)

#----- Create per CPU cache queueing centers -------------------------

for i in range(MAXCPU):
    cname = "%s%d" % (L2C, i)
    nodes = pdq.CreateNode(cname, pdq.CEN, pdq.FCFS)

#----- Create CPU nodes, workloads, and demands ----------------------

(no, Wrwht) = intwt(Nrwht)
Esempio n. 19
0
#
# Created by NJG on Thu, May 31, 2007
#
# Blair Zajac, author of Orca states:
# "If long term trends indicate increasing figures, more or faster CPUs
# will eventually be necessary unless load can be displaced. For ideal
# utilization of your CPU, the maximum value here should be equal to the
# number of CPUs in the box."
#
# Zajac's comment implies any waiting line is bad.
# PDQ steady-state model for HPC/batch workload with 
# stretch factor == 1 (no waiting line).
# Very low arrival rate over 10 hour period.

import pdq

processors  = 4
arrivalRate = 0.099 # jobs per hour (very low arrivals)
crunchTime  = 10.0  # hours (very long service time)

pdq.Init("ORCA LA Model")
s = pdq.CreateOpen("Crunch", arrivalRate)
n = pdq.CreateNode("HPCnode", int(processors), pdq.MSQ)
pdq.SetDemand("HPCnode", "Crunch", crunchTime)
pdq.SetWUnit("Jobs")
pdq.SetTUnit("Hour")
pdq.Solve(pdq.CANON)
pdq.Report()

Esempio n. 20
0
import pdq

#  Based on closed.c
#  
#  Illustrate use of PDQ solver for a closed circuit queue.

#---- Model specific variables ---------------------------------------

pop      = 3.0
think    = 0.1


#---- Initialize the model -------------------------------------------
# Give model a name and initialize internal PDQ variables

pdq.Init("Closed Queue")

#print "**** %s ****:" % (solve_as == pdq.EXACT ? "EXACT" : "APPROX")


#--- Define the workload and circuit type ----------------------------

pdq.streams = pdq.CreateClosed("w1", pdq.TERM, 1.0 * pop, think)


#--- Define the queueing center --------------------------------------

pdq.nodes   = pdq.CreateNode("node", pdq.CEN, pdq.FCFS)


#---- Define service demand ------------------------------------------
Esempio n. 21
0
    
    Created by NJG on Fri, Apr 13, 2007
    
    PDQ model using 2 MSQ nodes in tandem.
"""

import pdq

from math import *

arrivalRate = 40.0 / 60  # cust per min
browseTime = 45.0  # mins
buyingTime = 4.0  # mins
cashiers = 3

pdq.Init("Big Book Store Model")

# Create an open circuit Jackson network
streams = pdq.CreateOpen("Customers", arrivalRate)

pdq.SetWUnit("Cust")
pdq.SetTUnit("Min")  # timebase for PDQ report

#*** New MSQ flag tells PDQ the following are multiserver nodes ***

# M/M/inf queue defined as 100 times the number of Erlangs = lambda * S
nodes = pdq.CreateNode("Browsing",
                       int(ceil(arrivalRate * browseTime)) * 100, pdq.MSQ)

# M/M/m where m is the number of cashiers
nodes = pdq.CreateNode("Checkout", cashiers, pdq.MSQ)
Esempio n. 22
0
    pdq.Solve(pdq.APPROX)

    return (pdq.GetUtilization("CPU", "Production", pdq.TERM))


#---------------------------------------------------------------------

if (PRIORITY):
    Ucpu_prod = GetProdU()
    msg = priOn
else:
    msg = noPri

#---------------------------------------------------------------------

pdq.Init(msg)

#---- Workloads ------------------------------------------------------

pdq.streams = pdq.CreateClosed("Production", pdq.TERM, 20.0, 20.0)
pdq.streams = pdq.CreateClosed("Developmnt", pdq.TERM, 15.0, 15.0)

#---- Nodes ----------------------------------------------------------

pdq.nodes = pdq.CreateNode("CPU", pdq.CEN, pdq.FCFS)

if (PRIORITY):
    pdq.nodes = pdq.CreateNode("shadCPU", pdq.CEN, pdq.FCFS)

pdq.nodes = pdq.CreateNode("DK1", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("DK2", pdq.CEN, pdq.FCFS)
Esempio n. 23
0
#
#  $Id$
#
#---------------------------------------------------------------------

import pdq

#---------------------------------------------------------------------
# Based on simple_series_circuit.c
#
# An open queueing circuit with 3 centers.

arrivals_per_second = 0.10

pdq.Init("Simple Series Circuit")

pdq.streams = pdq.CreateOpen("Work", arrivals_per_second)

pdq.nodes = pdq.CreateNode("Center1", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("Center2", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("Center3", pdq.CEN, pdq.FCFS)

pdq.SetDemand("Center1", "Work", 1.0)
pdq.SetDemand("Center2", "Work", 2.0)
pdq.SetDemand("Center3", "Work", 3.0)

pdq.Solve(pdq.CANON)

pdq.Report()
Esempio n. 24
0
#  copies of the Software, and permit persons to whom the Software is         #
#  furnished to do so, under the terms of the COPYING file.                   #
#                                                                             #
#  This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY  #
#  KIND, either express or implied.                                           #
###############################################################################

#
# Created by NJG on Wed, Apr 18, 2007
#
#
# $Id: orca.py,v 1.2 2009/03/26 02:55:32 pfeller Exp $

import pdq

# Measured parameters
servers = 4
arivrate = 0.099  # per hr
servtime = 10.0  # hrs

pdq.Init("ORCA Batch")
nstreams = pdq.CreateOpen("Crunch", arivrate)
pdq.SetWUnit("Jobs")
pdq.SetTUnit("Hours")

nnodes = pdq.CreateNode("HPC", int(servers), pdq.MSQ)

pdq.SetDemand("HPC", "Crunch", servtime)
pdq.Solve(pdq.CANON)
pdq.Report()
Esempio n. 25
0
v = array([L[0]/L[0], L[1]/L[0], L[2]/L[0], L[3]/L[0]])
print "Visit ratios: ", v[0], v[1], v[2], v[3]

# Service times in seconds
S = array([20, 600, 300, 60])

# Service demands in seconds
D = array([v[0]*S[0], v[1]*S[1], v[2]*S[2], v[3]*S[3]])


""" Use the service demands derived from the solved traffic equations 
    to parameterize and solve PyDQ queueing model of the passport office
"""

# Initialize and solve the model 
pdq.Init("Passport Office");

numStreams = pdq.CreateOpen("Applicant", L[0]);

numNodes = pdq.CreateNode("Window0", pdq.CEN, pdq.FCFS);
numNodes = pdq.CreateNode("Window1", pdq.CEN, pdq.FCFS);
numNodes = pdq.CreateNode("Window2", pdq.CEN, pdq.FCFS);
numNodes = pdq.CreateNode("Window3", pdq.CEN, pdq.FCFS);

pdq.SetDemand("Window0", "Applicant", D[0]);
pdq.SetDemand("Window1", "Applicant", D[1]);
pdq.SetDemand("Window2", "Applicant", D[2]);
pdq.SetDemand("Window3", "Applicant", D[3]);

pdq.Solve(pdq.CANON);
pdq.Report();
Esempio n. 26
0
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()