/*
    bookstore.c
    
    Created by NJG on Wed, Apr 4, 2007

    PDQ model using 2 MSQ nodes in tandem.
 */

#include <stdio.h>
#include <string.h>
#include <math.h>
#include "PDQ_Lib.h"

int main(void) {

    int              nodes;
    int              streams;
    
    double           arrivalRate    = 40.0/60;  // cust per min
    double           browseTime     = 45.0;     // mins 
    double           buyingTime     = 4.0;      // mins
    int              cashiers       = 3;
        
    PDQ_Init("Big Book Store Model");
        
    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", (intceil(arrivalRate * browseTime) * 100MSQ); 
    
    // M/M/m where m is the number of cashiers  
    nodes = PDQ_CreateNode("Checkout"cashiersMSQ); 
    
    // Set service times ...
    PDQ_SetDemand("Browsing""Customers"browseTime);
    PDQ_SetDemand("Checkout""Customers"buyingTime);
    
    PDQ_Solve(CANON);
    PDQ_Report();
   
}  // main