Пример #1
0
function main()
{
    $noNodes = 0;
    $noStreams = 0;
    // the following is defined in the original C version but never used.
    $arrivals = 16.0 / 3600;
    /* 16 applications per hour */
    /* Branching probabilities and weights */
    $p12 = 0.3;
    $p13 = 0.7;
    $p23 = 0.2;
    $p32 = 0.1;
    $w3 = ($p13 + $p23 * $p12) / (1 - $p23 * $p32);
    $w2 = $p12 + $p32 * $w3;
    /* Initialize and solve the model */
    PDQ_Init("Passport Office");
    $noStreams = PDQ_CreateOpen("Applicant", 0.00427);
    $noNodes = PDQ_CreateNode("Window1", CEN, FCFS);
    $noNodes = PDQ_CreateNode("Window2", CEN, FCFS);
    $noNodes = PDQ_CreateNode("Window3", CEN, FCFS);
    $noNodes = PDQ_CreateNode("Window4", CEN, FCFS);
    PDQ_SetDemand("Window1", "Applicant", 20.0);
    PDQ_SetDemand("Window2", "Applicant", 600.0 * $w2);
    PDQ_SetDemand("Window3", "Applicant", 300.0 * $w3);
    PDQ_SetDemand("Window4", "Applicant", 60.0);
    PDQ_Solve(CANON);
    PDQ_Report();
}
Пример #2
0
function main()
{
    $noNodes = 0;
    $noStreams = 0;
    $arrivals_per_second = 0.1;
    /* Initialize and solve the model */
    PDQ_Init("Simple Series Circuit");
    $noStreams = PDQ_CreateOpen("Work", $arrivals_per_second);
    $noNodes = PDQ_CreateNode("Center1", CEN, FCFS);
    $noNodes = PDQ_CreateNode("Center2", CEN, FCFS);
    $noNodes = PDQ_CreateNode("Center3", CEN, FCFS);
    PDQ_SetDemand("Center1", "Work", 1.0);
    PDQ_SetDemand("Center2", "Work", 2.0);
    PDQ_SetDemand("Center3", "Work", 3.0);
    PDQ_Solve(CANON);
    PDQ_Report();
}
Пример #3
0
function main($argc, $argv)
{
    global $nodes, $streams;
    //---- Model specific variables -----
    $rx_prob = 0.3;
    $inter_arriv_rate = 0.5;
    $service_time = 0.75;
    $mean_visits = 1.0 / (1.0 - $rx_prob);
    //----- Initialize the model -----
    // Give model a name */
    PDQ_Init("Open Feedback");
    // Define the queueing center
    $nodes = PDQ_CreateNode("channel", CEN, FCFS);
    // Define the workload and circuit type
    $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);
    //----- Solve the model -----
    // Must use the CANONical method for an open circuit
    PDQ_Solve(CANON);
    // Generate a report
    PDQ_Report();
}
Пример #4
0
function main($argc, $argv)
{
    //----- Model specific variables -----
    global $nodes, $streams;
    $arrivRate = 0.75;
    $service_time = 1.0;
    //----- Initialize the model & Give it a name ------
    PDQ_Init("OpenCenter");
    //----- Change unit labels -----
    PDQ_SetWUnit("Customers");
    PDQ_SetTUnit("Seconds");
    //----- Define the queueing center -----
    $nodes = PDQ_CreateNode("server", CEN, FCFS);
    //----- Define the workload and circuit type -----
    $streams = PDQ_CreateOpen("work", $arrivRate);
    //----- Define service demand due to workload on the queueing center ------
    PDQ_SetDemand("server", "work", $service_time);
    //----- Solve the model -----
    //  Must use the CANONical method for an open circuit
    PDQ_Solve(CANON);
    //----- Generate a report -----
    PDQ_Report();
}
Пример #5
0
function main()
{
    // Name of this model ...
    $scenario = "C/S Upgrade2";
    global $job, $node;
    $noNodes = 0;
    $noStreams = 0;
    $txCD = "";
    $txRQ = "";
    $txSU = "";
    $dumCD = "";
    $dumRQ = "";
    $dumSU = "";
    $X = 0.0;
    $ulan = 0.0;
    $ufs = 0.0;
    $ugw = 0.0;
    $umf = 0.0;
    $work = 0;
    $dev = 0;
    $i = 0;
    $j = 0;
    $demand = array(array());
    // double [MAXPROC][MAXDEV]
    $util = array();
    // double [MAXDEV]
    $udsk = array();
    // double [MAXDEV]
    $upc = array();
    // double [MAXDEV]
    $udasd = array();
    // double [MAXDEV];
    for ($i = 0; $i < MAXDEV; $i++) {
        $util[$i] = 0.0;
        $udsk[$i] = 0.0;
        $upc[$i] = 0.0;
        $udasd[$i] = 0.0;
        for ($j = 0; $j < MAXPROC; $j++) {
            $demand[$j][$i] = 0.0;
        }
    }
    $PCarray = array();
    $FDarray = array();
    $MDarray = array();
    // Allocate PCarray
    for ($i = 0; $i < 2; $i++) {
        $PCarray[$i] = new DEVARRAY_TYPE();
    }
    // Allocate FDarray and MDarray
    for ($i = 0; $i < 10; $i++) {
        $FDarray[$i] = new DEVARRAY_TYPE();
        $MDarray[$i] = new DEVARRAY_TYPE();
    }
    $PCarray[0]->id = 0;
    $PCarray[0]->label = "PCreal";
    $PCarray[1]->id = 50;
    $PCarray[1]->label = "PCagg";
    for ($i = 0; $i < FS_DISKS; $i++) {
        $FDarray[$i]->id = FDA + $i;
        $FDarray[$i]->label = sprintf("FD%d", $i);
    }
    for ($i = 0; $i < MF_DISKS; $i++) {
        $MDarray[$i]->id = MDA + $i;
        $MDarray[$i]->label = sprintf("MD%d", $i);
    }
    /*
     * CPU service times are calculated from MIPS Instruction counts in
     * tables presented in original 1993 CMG paper.
     */
    $demand[CD_REQ][PC] = 200 * K / PC_MIPS;
    $demand[CD_RPY][PC] = 100 * K / PC_MIPS;
    $demand[RQ_REQ][PC] = 150 * K / PC_MIPS;
    $demand[RQ_RPY][PC] = 200 * K / PC_MIPS;
    $demand[SU_REQ][PC] = 300 * K / PC_MIPS;
    $demand[SU_RPY][PC] = 300 * K / PC_MIPS;
    $demand[REQ_CD][FS] = 50 * K / FS_MIPS;
    $demand[REQ_RQ][FS] = 70 * K / FS_MIPS;
    $demand[REQ_SU][FS] = 10 * K / FS_MIPS;
    $demand[CD_MSG][FS] = 35 * K / FS_MIPS;
    $demand[RQ_MSG][FS] = 35 * K / FS_MIPS;
    $demand[SU_MSG][FS] = 35 * K / FS_MIPS;
    $demand[GT_SND][GW] = 50 * K / GW_MIPS;
    $demand[GT_RCV][GW] = 50 * K / GW_MIPS;
    $demand[MF_CD][MF] = 50 * K / MF_MIPS;
    $demand[MF_RQ][MF] = 150 * K / MF_MIPS;
    $demand[MF_SU][MF] = 20 * K / MF_MIPS;
    // packets generated at each of the following sources ...
    $demand[LAN_TX][PC] = 2 * K * TR_FACT / TR_MBPS;
    $demand[LAN_TX][FS] = 2 * K * TR_FACT / TR_MBPS;
    $demand[LAN_TX][GW] = 2 * K * TR_FACT / TR_MBPS;
    /* File server Disk I/Os = #accesses x caching / (max IOs/Sec) */
    for ($i = 0; $i < FS_DISKS; $i++) {
        $demand[REQ_CD][$FDarray[$i]->id] = 1.0 * 0.5 / 128.9 / FS_DISKS;
        $demand[REQ_RQ][$FDarray[$i]->id] = 1.5 * 0.5 / 128.9 / FS_DISKS;
        $demand[REQ_SU][$FDarray[$i]->id] = 0.2 * 0.5 / 128.9 / FS_DISKS;
        $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 = 0; $i < MF_DISKS; $i++) {
        $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;
    }
    // Start building the PDQ model  ...
    PDQ_Init($scenario);
    // Define physical resources as queues ...
    $noNodes = PDQ_CreateNode($PCarray[0]->label, CEN, FCFS);
    //$noNodes = PDQ_CreateNode(PCarray[1]->label, CEN, FCFS);
    $noNodes = PDQ_CreateNode("FS", CEN, FCFS);
    $noNodes = PDQ_CreateNode("GW", CEN, FCFS);
    $noNodes = PDQ_CreateNode("MF", CEN, FCFS);
    for ($i = 0; $i < FS_DISKS; $i++) {
        $noNodes = PDQ_CreateNode($FDarray[$i]->label, CEN, FCFS);
    }
    for ($i = 0; $i < MF_DISKS; $i++) {
        $noNodes = PDQ_CreateNode($MDarray[$i]->label, CEN, FCFS);
    }
    $noNodes = PDQ_CreateNode("TR", CEN, FCFS);
    /*
     * NOTE: Althought the Token Ring LAN is a passive device,
     * it is treated as a separate node in order to agree to the results
     * presented in the original CMG'93 paper.
     */
    if ($noNodes > MAXDEV) {
        printf("Number of noNodes %d exceeds MAXDEV = %d", $noNodes, MAXDEV);
    }
    // Assign transaction names ...
    $txCD = "CatDsply";
    $txRQ = "RemQuote";
    $txSU = "StatusUp";
    $dumCD = "CDdummy ";
    $dumRQ = "RQdummy ";
    $dumSU = "SUdummy ";
    // Define an OPEN circuit workloads ...
    $noStreams = PDQ_CreateOpen($txCD, 4.0 / 60.0);
    $noStreams = PDQ_CreateOpen($txRQ, 8.0 / 60.0);
    $noStreams = PDQ_CreateOpen($txSU, 1.0 / 60.0);
    $noStreams = PDQ_CreateOpen($dumCD, (USERS - 1) * 4.0 / 60.0);
    $noStreams = PDQ_CreateOpen($dumRQ, (USERS - 1) * 8.0 / 60.0);
    $noStreams = PDQ_CreateOpen($dumSU, (USERS - 1) * 1.0 / 60.0);
    // Define the service demands on each physical resource
    // CD request + reply chain  from workflow diagram
    PDQ_SetDemand($PCarray[0]->label, $txCD, $demand[CD_REQ][PC] + 5 * $demand[CD_RPY][PC]);
    // PDQ_SetDemand($PCarray[1]->label, $dumCD,($demand[CD_REQ][PC] + (5 * $demand[CD_RPY][PC])) / (USERS - 1));
    PDQ_SetDemand("FS", $txCD, $demand[REQ_CD][FS] + 5 * $demand[CD_MSG][FS]);
    PDQ_SetDemand("FS", $dumCD, $demand[REQ_CD][FS] + 5 * $demand[CD_MSG][FS]);
    for ($i = 0; $i < FS_DISKS; $i++) {
        PDQ_SetDemand($FDarray[$i]->label, $txCD, $demand[REQ_CD][$FDarray[$i]->id] + 5 * $demand[CD_MSG][$FDarray[$i]->id]);
        PDQ_SetDemand($FDarray[$i]->label, $dumCD, $demand[REQ_CD][$FDarray[$i]->id] + 5 * $demand[CD_MSG][$FDarray[$i]->id]);
    }
    PDQ_SetDemand("GW", $txCD, $demand[GT_SND][GW] + 5 * $demand[GT_RCV][GW]);
    PDQ_SetDemand("GW", $dumCD, $demand[GT_SND][GW] + 5 * $demand[GT_RCV][GW]);
    PDQ_SetDemand("MF", $txCD, $demand[MF_CD][MF]);
    PDQ_SetDemand("MF", $dumCD, $demand[MF_CD][MF]);
    for ($i = 0; $i < MF_DISKS; $i++) {
        PDQ_SetDemand($MDarray[$i]->label, $txCD, $demand[MF_CD][$MDarray[$i]->id]);
        PDQ_SetDemand($MDarray[$i]->label, $dumCD, $demand[MF_CD][$MDarray[$i]->id]);
    }
    /*
     * NOTE: Synchronous process execution causes data related to the the CD
     * transaction to cross the LAN 12 times as depicted in the following
     * parameterization of PDQ_SetDemand.
     */
    PDQ_SetDemand("TR", $txCD, 1 * $demand[LAN_TX][PC] + 1 * $demand[LAN_TX][FS] + 5 * $demand[LAN_TX][GW] + 5 * $demand[LAN_TX][FS]);
    PDQ_SetDemand("TR", $dumCD, 1 * $demand[LAN_TX][PC] + 1 * $demand[LAN_TX][FS] + 5 * $demand[LAN_TX][GW] + 5 * $demand[LAN_TX][FS]);
    // RQ request + reply chain ...
    PDQ_SetDemand($PCarray[0]->label, $txRQ, $demand[RQ_REQ][PC] + 3 * $demand[RQ_RPY][PC]);
    // PDQ_SetDemand($PCarray[1]->label, $dumRQ,($demand[RQ_REQ][PC] + (3 * $demand[RQ_RPY][PC])) / (USERS - 1));
    PDQ_SetDemand("FS", $txRQ, $demand[REQ_RQ][FS] + 3 * $demand[RQ_MSG][FS]);
    PDQ_SetDemand("FS", $dumRQ, $demand[REQ_RQ][FS] + 3 * $demand[RQ_MSG][FS]);
    for ($i = 0; $i < FS_DISKS; $i++) {
        PDQ_SetDemand($FDarray[$i]->label, $txRQ, $demand[REQ_RQ][$FDarray[$i]->id] + 3 * $demand[RQ_MSG][$FDarray[$i]->id]);
        PDQ_SetDemand($FDarray[$i]->label, $dumRQ, $demand[REQ_RQ][$FDarray[$i]->id] + 3 * $demand[RQ_MSG][$FDarray[$i]->id]);
    }
    PDQ_SetDemand("GW", $txRQ, $demand[GT_SND][GW] + 3 * $demand[GT_RCV][GW]);
    PDQ_SetDemand("GW", $dumRQ, $demand[GT_SND][GW] + 3 * $demand[GT_RCV][GW]);
    PDQ_SetDemand("MF", $txRQ, $demand[MF_RQ][MF]);
    PDQ_SetDemand("MF", $dumRQ, $demand[MF_RQ][MF]);
    for ($i = 0; $i < MF_DISKS; $i++) {
        PDQ_SetDemand($MDarray[$i]->label, $txRQ, $demand[MF_RQ][$MDarray[$i]->id]);
        PDQ_SetDemand($MDarray[$i]->label, $dumRQ, $demand[MF_RQ][$MDarray[$i]->id]);
    }
    PDQ_SetDemand("TR", $txRQ, 1 * $demand[LAN_TX][PC] + 1 * $demand[LAN_TX][FS] + 3 * $demand[LAN_TX][GW] + 3 * $demand[LAN_TX][FS]);
    PDQ_SetDemand("TR", $dumRQ, 1 * $demand[LAN_TX][PC] + 1 * $demand[LAN_TX][FS] + 3 * $demand[LAN_TX][GW] + 3 * $demand[LAN_TX][FS]);
    // SU request + reply chain  ...
    PDQ_SetDemand($PCarray[0]->label, $txSU, $demand[SU_REQ][PC] + $demand[SU_RPY][PC]);
    // PDQ_SetDemand($PCarray[1]->label, $dumSU,(($demand[SU_REQ][PC] + $demand[SU_RPY][PC])) / (USERS - 1));
    PDQ_SetDemand("TR", $txSU, $demand[LAN_TX][PC]);
    PDQ_SetDemand("TR", $dumSU, $demand[LAN_TX][PC]);
    PDQ_SetDemand("FS", $txSU, $demand[REQ_SU][FS] + $demand[SU_MSG][FS]);
    PDQ_SetDemand("FS", $dumSU, $demand[REQ_SU][FS] + $demand[SU_MSG][FS]);
    for ($i = 0; $i < FS_DISKS; $i++) {
        PDQ_SetDemand($FDarray[$i]->label, $txSU, $demand[REQ_SU][$FDarray[$i]->id] + $demand[SU_MSG][$FDarray[$i]->id]);
        PDQ_SetDemand($FDarray[$i]->label, $dumSU, $demand[REQ_SU][$FDarray[$i]->id] + $demand[SU_MSG][$FDarray[$i]->id]);
    }
    PDQ_SetDemand("TR", $txSU, $demand[LAN_TX][FS]);
    PDQ_SetDemand("TR", $dumSU, $demand[LAN_TX][FS]);
    PDQ_SetDemand("GW", $txSU, $demand[GT_SND][GW] + $demand[GT_RCV][GW]);
    PDQ_SetDemand("GW", $dumSU, $demand[GT_SND][GW] + $demand[GT_RCV][GW]);
    PDQ_SetDemand("MF", $txSU, $demand[MF_SU][MF]);
    PDQ_SetDemand("MF", $dumSU, $demand[MF_SU][MF]);
    for ($i = 0; $i < MF_DISKS; $i++) {
        PDQ_SetDemand($MDarray[$i]->label, $txSU, $demand[MF_SU][$MDarray[$i]->id]);
        PDQ_SetDemand($MDarray[$i]->label, $dumSU, $demand[MF_SU][$MDarray[$i]->id]);
    }
    PDQ_SetDemand("TR", $txSU, 1 * $demand[LAN_TX][PC] + 1 * $demand[LAN_TX][FS] + 1 * $demand[LAN_TX][GW] + 1 * $demand[LAN_TX][FS]);
    PDQ_SetDemand("TR", $dumSU, 1 * $demand[LAN_TX][PC] + 1 * $demand[LAN_TX][FS] + 1 * $demand[LAN_TX][GW] + 1 * $demand[LAN_TX][FS]);
    PDQ_Solve(CANON);
    PDQ_Report();
    // Break out Tx response times and device utilizations ...
    printf("*** PDQ Breakout \"%s\" (%d clients) ***\n\n", $scenario, USERS);
    for ($dev = 0; $dev < $noNodes; $dev++) {
        $util[$dev] = 0.0;
        /* reset array */
        for ($work = 0; $work < $noStreams; $work++) {
            $util[$dev] += 100 * PDQ_GetUtilization($node[$dev]->devname, $job[$work]->trans->name, TRANS);
        }
    }
    printf("Transaction  \tLatency(Secs)\n");
    printf("-----------  \t-----------\n");
    for ($work = 0; $work < $noStreams; $work++) {
        printf("%s\t%7.4f\n", $job[$work]->trans->name, $job[$work]->trans->sys->response);
    }
    printf("\n\n");
    for ($dev = 0; $dev < $noNodes; $dev++) {
        // for ($i = 0; $i < USERS; $i++)
        for ($i = 0; $i < 2; $i++) {
            if ($node[$dev]->devname == $PCarray[$i]->label) {
                $upc[$i] += $util[$dev];
            }
            // SZ NOTE: In the original C version you use upc but you have never initialized it!!
        }
        if ($node[$dev]->devname == "GW") {
            $ugw += $util[$dev];
        }
        if ($node[$dev]->devname == "FS") {
            $ufs += $util[$dev];
        }
        for ($i = 0; $i < FS_DISKS; $i++) {
            if ($node[$dev]->devname == $FDarray[$i]->label) {
                $udsk[$i] += $util[$dev];
            }
            // SZ NOTE: In the original C version you use udsk but you have never initialized it!!
        }
        if ($node[$dev]->devname == "MF") {
            $umf += $util[$dev];
        }
        for ($i = 0; $i < MF_DISKS; $i++) {
            if ($node[$dev]->devname == $MDarray[$i]->label) {
                $udasd[$i] += $util[$dev];
            }
            // SZ NOTE: In the original C version you use udasd but you have never initialized it!!
        }
        if ($node[$dev]->devname == "TR") {
            $ulan += $util[$dev];
        }
    }
    printf("Node      \t%% Utilization\n");
    printf("----      \t--------------\n");
    printf("%s\t%7.4f\n", "Token Ring ", $ulan);
    printf("%s\t%7.4f\n", "Desktop PC ", $upc[0]);
    printf("%s\t%7.4f\n", "FileServer ", $ufs);
    for ($i = 0; $i < FS_DISKS; $i++) {
        printf("%s%d\t%7.4f\n", "FS Disk", $FDarray[$i]->id, $udsk[$i]);
    }
    printf("%s\t%7.4f\n", "Gateway SNA", $ugw);
    printf("%s\t%7.4f\n", "Mainframe  ", $umf);
    for ($i = 0; $i < MF_DISKS; $i++) {
        printf("%s%d\t%7.4f\n", "MFrame DASD", $MDarray[$i]->id, $udasd[$i]);
    }
}