SAS Institute QSIM Application Discrete Event Simulation User Manual
Below you will find brief information for QSIM Application. It is a discrete event simulation tool used for modeling and analyzing queueing systems. You can build models to simulate processes and understand their behavior before implementation, particularly useful in network, manufacturing, and transportation scenarios.
Advertisement
Advertisement
QSIM Application Discrete Event Queueing Simulation Release 6.11 Win32s, OS/2, Sun Solaris 1 & 2, HPUX, AIX QSIM Application Discrete Event Queueing Simulation Release 6.11 Win32s, OS/2, Sun Solaris 1 & 2, HPUX, AIX Marc-david Cohen Phil Meanor SAS Institute, Inc., SAS Campus Drive Cary, NC 27513, USA (919) 677-8000 x7630 [email protected] PRELIMINARY DRAFT May 1995 This material is a preliminary draft, and SAS Institute Inc. makes no warranty about the accuracy of this document. The Institute is not responsible for errors in the text or for any discrepancies between this documentation and the product described as it now exists or as it will exist. Contents 1 Getting Started : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 2 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 2 Invoking QSIM User Interface 1 : : : : : : : : : : : : : : : : : : : : : : 8 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 9 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 9 A Simple M/M/1 Queueing Model Queueing : Service Statistics : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 2 Building a Model with Elementary Components Elementary Components : : : : : : : : : : : : : : : : : : : : : : : : : : : 9 11 11 Source Components : : : : : : : : : : : : : : : : : : : : : : : : : : 12 Server Components : : : : : : : : : : : : : : : : : : : : : : : : : : 14 Queue Components : : : : : : : : : : : : : : : : : : : : : : : : : : 16 : : : : : : : : : : : : : : : : : : : : : : : : : : : 18 Logic Components : : : : : : : : : : : : : : : : : : : : : : : : : : 26 : : : : : : : : : : : : : : : : : : : : : : : : : : : 29 Holder Components Chart Components : : : : : : : : : : : : : : : : 35 : : : : : : : : : : : : : : : : : : : : : : : : : : : 36 Port, Connector, and Label Components Connecting Components i CONTENTS ii Transactions History : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 38 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 39 Attributes : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Trigger Messages : : : : : : : : : : : : : : : : : : : : : : : : : : : 41 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 42 Unique Component IDs : : : : : : : : : : : : : : : : : : : : : : : : : : : 3 Building a Model with Compound Components Assembling Components into Compound Components Editing Components 47 48 : : : : : : : : : : : : : : : : : : : : 49 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 52 Templates for Reusing Components : : : : : : : : : : : : : : : : : : : : : 4 Random and Exogenous Variation in the Model Random Sources of Variation : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 58 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 59 61 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 62 62 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 63 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 65 Templates Graphs 55 56 5 Saving and Restoring Models 52 : : : : : : : : : : : : : : : : : : : : : : : : FormulaDistribution DataSource : 46 : : : : : : : : : : : Controlling Subcomponent Exposure State 40 : : : : : : : : : : : : : : : : : : : : : : Timing Transaction Arrivals Formulas 40 Sample Paths : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : The Component Dictionary Data Set : : : : : : : : : : : : : : : : : : 66 66 CONTENTS iii : : : : : : : : : : : : : : : : : : : : 67 : : : : : : : : : : : : : : : : : : : : : : : 67 Component State Sample Paths Transaction Sample Paths 6 Analyzing the Sample Path Running a Simulation 69 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 72 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 72 Statistics on Component State Queue Length 70 Server Utilization : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 76 : : : : : : : : : : : : : : : : : : : : : : : : 77 : : : : : : : : : : : : : : : : : : : : : : : : : : 77 Data Step Program for Extracting Information Statistics on Transaction State Time in the System : 74 Data Step Program for Extracting Information : : : : : : : : : : : : : 7 Selected Examples 78 81 : : : : : : : : : : : : : : : : : : : : : : : : : : : : 81 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 84 Priority Queues : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 85 Batch Arrivals I : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 87 Batch Arrivals II : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 88 Queues with Reneging Scanning a Queue Nonhomogeneous Poisson Processes : : : : : : : : : : : : : : : : : : : : 89 Markov-modulated Poisson Arrivals : : : : : : : : : : : : : : : : : : : : : 91 : : : : : : : : : : : : : : : : : : : : : : : : : : : 93 State-Dependent Service : : : : : : : : : : : : : : : : : : : : : : : : : : 94 : : : : : : : : : : : : : : : : : : : : : : : : : 95 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 96 Servers that Break Down I Servers that Break Down II Batch Service I CONTENTS iv Batch Service II : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 97 Batch Service III : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 98 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 99 Assembly : : : : : : : : : : : : : : : : : : : : : : : : : : : : 100 : : : : : : : : : : : : : : : : : : : : : : : : : : : 101 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 102 Servers as Resources I Servers as Resources II Special Routing Index 105 Chapter 1 Getting Started The QSIM application is a SAS application for modeling and analyzing queueing systems using discrete event simulation. These models are used in a wide variety of scenarios that might be encountered in network and telecommunications systems, manufacturing systems, and transportation networks. For example, before instituting a reengineered business process, you could use QSIM to model the new process and study the model behavior to gain insight into how the new process might behave. Figure 1.1. An M/M/1 Queueing Model 1 2 CHAPTER 1. GETTING STARTED The application has a graphical user interface that requires no programming and provides all the tools for building, executing, and analyzing discrete event simulation models. Figure 1.1 shows a simple M/M/1 queueing model built with the QSIM application. An M/M/1 queueing model has a Poisson arrival process, exponential service times for a single server, and a FIFO queueing discipline. You can build a model of such a queueing system, control the simulation of the model, and produce summary statistics from the simulation sample path from within the application. You can save the model and the sample path in SAS data sets for reusue and further analysis. The application is designed to simplify model building by encouraging the construction of hierarchical models based on user built model components that can be stored, shared, and replicated easily. In this context a model is a directed network. Transactions flow through the network changing the state of the model upon arrival at vertices or nodes. The type of state change that occurs depends on the current state of the simulation and the particulars of the model. Invoking QSIM You invoke the application by typing QSIM on a command line. You can save a simulation that is running in its current state in a catalog. Suppose that you save an executing simulation in the catalog SASUSER.MM1.SIM. You can continue executing it by typing QSIM C=SASUSER.MM1.SIM. There are other ways of saving models when you don’t need to maintain the current state of the simulation. All of these methods are discussed in Chapter 5, ‘‘Saving and Restoring’’. User Interface When you invoke QSIM, a Simulation Window opens, as shown in Figure 1.2. The window has two panels; the toolbar panel on the left and the model panel on the right. You build the model in the model panel, using the mouse to select model components from a popup menu or from the toolbar. These model components are connected by arcs to produce a directed network representation of the model. You can change parameters and other properties of model components via popup menus from the components. USER INTERFACE 3 Figure 1.2. The Simulation Window For example, suppose you place the cursor on the background of an empty model panel and click the right mouse button. This displays the popup menu shown in Figure 1.3. You simply select one of the components on the menu, and the component will be placed wherever you click on the model panel. Note that the popup menu lists all the components supplied with the application. CHAPTER 1. GETTING STARTED 4 Figure 1.3. The Simulation Window Popup Menu Alternatively, you can choose a component from the toolbar on the left side of the Simulation Window by selecting the button that shows the component. If you don’t see the component, use the scrollbar on the right side of the tool panel to scroll the toolbar. Then, you can place the component wherever you click on the Simulation Window background. For example, to place a Sampler in the Simulation Window, you can select the background. button in the toolbar and then click on the Simulation Window The toolbar contains two types of buttons, state buttons and command buttons. The state buttons logically attach a state to the cursor so that when an object in the window is selected using the mouse, it receives a message indicating the cursor state. The command buttons operate similarly to push buttons, and they execute commands. USER INTERFACE 5 Figure 1.4. A Portion of the Simulation Toolbar Figure 1.4 shows a section of the toolbar. Notice that there are three groups of buttons. The buttons in the first group, which include the button, are state buttons that the cursor passes to a component when it is selected. The buttons in the middle group, which include the button, are command buttons that execute a command when button, are state pressed. The buttons in the bottom group, which include the buttons that the cursor passes to the background of the model panel. So if you select the and buttons and click on the background of the model panel, a Sampler is displayed in the window. Since the is also selected, if you click on a Sampler, you pick it up, move it to another location, and place it with a second mouse click. On button, an action will the other hand, if you select a command button such as the occur as soon as the button is selected; in this case, animation of the simulation will start. This paradigm for the user interface is used throughout the QSIM application. For example, to initiate an action on a component, you place the cursor on the component and click the right mouse button to popup a menu of actions, or you can select a cursor state button and click on a component for that action. CHAPTER 1. GETTING STARTED 6 Figure 1.5. The Sampler Popup Menu Figure 1.5 shows the popup menu on the Sampler. Notice that the first item in the menu names the type of component. The submenu from the Sampler entry lists the actions that are specific to that component. In this case, it includes: ‘‘Control Panel...,’’ which opens a window that enables you to control the component; ‘‘Start,’’ which starts the transaction sampling; and ‘‘Stop,’’ which stops the transaction sampling. Other general actions include ‘‘Expose/Hide Detail’’ for changing the Sampler representation from an image to a line drawing, ‘‘Grab’’ for moving the component, ‘‘Arc’’ for drawing an arc from this component to another component, and ‘‘Tools’’ for other less frequently used tools. Choosing any of these items will start the requested action. Alternatively, you can choose one of the icons from the toolbar. For example, if you select the button and you click on the Sampler, then the Sampler will follow the cursor until you click again and place the Sampler on the window background. Model components are connected by arcs. Transactions flow down arcs between components. You can connect two components with an arc by selecting the button on the toolbar and then selecting a component, for example. You will have a rubberband line to the cursor. Now when you select another component, an arc will connect the two components. If you move the cursor out of the Simulation Window, USER INTERFACE 7 the window may start power scrolling. Bringing the cursor back into the window will stop the scrolling. Clicking outside the window will stop the rubberband line mode. Model components have control panels associated with them. With these panels, you specify parameters and control the behavior of the component. The simulation also has a control panel, as shown in Figure 1.6. It is displayed by choosing the ‘‘File’’ menu option and the ‘‘Control Panel...’’ submenu option from the Simulation Window. Figure 1.6. The Simulation Control Panel The Simulation Control Panel shows the current simulation time. Time is measured in dimensionless units. This means that you are free to interpret the units as you wish. They can be fractions of a second, seconds, days, or weeks. Just remember that all the components use the same dimensionless units. The Simulation Control Panel also has two check boxes: one for toggling the animation and the other for collecting the simulation sample path into a SAS data set. The ‘‘Components’’ list box shows the highest level of components in the model. Since components can be nested into a hierarchy, there can be multiple levels. The push buttons ‘‘<-’’ and ‘‘->’’ under the list box enable you to navigate through this CHAPTER 1. GETTING STARTED 8 hierarchy. If you select a component and press one of the five buttons to the right of the ‘‘Components’’ list box, the component executes that action. For example, selecting Sampler in the list box and pressing the ‘‘Start’’ button starts transaction sampling in that sampler. The ‘‘Start’’ button at the bottom of the window starts all the components in the model. The ‘‘Interrupt’’ button interrupts the simulation and suspends all transactions. The ‘‘Reset’’ button resets all the components, destroys all events waiting to execute, and resets the simulation clock, and the ‘‘Dismiss’’ button closes the control panel. A Simple M/M/1 Queueing Model A simple example illustrates some of the concepts involved in model building. The network shown in Figure 1.7 models an M/M/1 queue. Transactions originate at the source node Sampler. The user chooses the interval between transactions, called the inter-arrival time, to be a sample of a random variable (from one of several distributions), a fixed amount, or the value of a variable read from a SAS data set. By default, the inter-arrival time is an observation of an exponential random variable with parameter 1. This models a Poisson Process for transaction arrivals. Figure 1.7. An M/M/1 Queueing Model A SIMPLE M/M/1 QUEUEING MODEL 9 Queueing When the transaction leaves the Sampler it flows down the arc to the node FIFO Queue. It is important to note that the movement of the transaction down the arc does not advance the simulation clock. On transaction arrival at the FIFO Queue, the queue broadcasts messages down arcs asking nodes downstream if they are busy or not. The responses depend on the types of components that are connected to the queue and the state of the simulation when the message is received. Details are given in the next chapter. It is important to note that broadcasting and evaluation of these messages also does not advance the simulation clock. If the queue gets a response that there is a nonbusy node, then it sends the transaction down the arc leading to that node. Otherwise, the transaction remains in the queue. When the simulation is first started the Server is empty; when it gets the message ‘‘are you busy’’ from the queue, it responds ‘‘no.’’ As a result, the queue routes the transaction down the arc to the Server. Service When the transaction arrives at the Server, service is scheduled and the transaction ties up the server. By default, the service time is an observation of an exponential random variable with parameter 1. Both the service distribution and its parameters can be changed using the server’s control panel. While the server is serving this transaction, any ‘‘are you busy’’ messages sent to it result in a ‘‘yes’’ response. When service is complete, the server sends the transaction on any arcs directed away from it and also sends a message up the arcs directed into it requesting an additional transaction. In this example, if the FIFO Queue is not empty, it will remove the transaction that has been there the longest and send it to the Server. By default, all queues in the system have a capacity of 50 transactions. Of course, this capacity can be changed through the user interface or programmatically, as discussed in the next chapter. Note that, since by default the inter-arrival times and the service times are E (1) exponential deviates, the transaction time in the system would not have a stationary distribution if the queue had infinite capacity. Statistics Finally, the transaction flows to a StripChart, which collects simple statistics on the transaction and displays the age of the transaction on the vertical axis versus time on the horizontal axis. The statistics collected include ‘‘m=’’ the sample mean age, ‘‘x=’’ the throughput (sample transaction arrival rate), ‘‘mx=’’ the maximum age, and ‘‘n=’’ the number of transactions that have arrived. The sample path as represented in the history of the transactions can be saved in a SAS data set via the StripChart component. The simulation is started either by using the right mouse button when the cursor is over the Sampler and selecting ‘‘Start’’ from the submenu in the ‘‘Sampler’’ selection, or 10 CHAPTER 1. GETTING STARTED by selecting the button in the toolbar and then selecting the Simulation Window. button in the Chapter 2 Building a Model with Elementary Components For ease in building and maintaining models, the QSIM application promotes hierarchical model building, user component construction, and component reuse by providing a comprehensive set of primitive components and the ability to assemble components into a compound component. For example, you can build a queue-server network, then encapsulate it, identfy an image to represent it, use it to define a template for additional replication, and save the template in a SAS data set to be shared in other models and by other users. This chapter discusses the details of the elementary components used in model building. Elementary Components There are several types of elementary components: sources, servers, queues, logic, holders, charts, and connectors. Although each of these has a special role, they have much in common, as is evident from their popup menus(displayed by pressing the right mouse button while pointing to the component). 11 12 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS Figure 2.1. The Popup Menu on the FIFO Queue Component Figure 2.1 shows a typical popup menu. The first entry in this popup menu is the name of the component. The submenu from that entry has ‘‘Control Panel...’’ as the first choice. Selecting it displays the component’s control panel, which enables you to set component parameters. Other choices include ‘‘Expose/Hide Details,’’ ‘‘Grab,’’ ‘‘Arc,’’ ‘‘Tools,’’ and ‘‘Options.’’ The ‘‘Expose/Hide Details’’ entry toggles the display of the component between an icon that represents the component, which you can change, and a drawn representation of the component. For some of the components, the drawn representation shows state information while the simulation is in progress and animating. For example, the family of queues slowly fills as transactions arrive and queue up. Many of the components also have internal state information that changes as the result of transaction arrival and other kinds of message sending. There are five general types of actions that either change component state or return information about the component state: transaction arrival, request for transaction, are you busy message, query message, and trigger message. The query message is sent from the Probe components and formulas. These messages make requests about the state of the component, for example, the number of transactions waiting in a queue. The trigger message is sent when a transaction arrives at a Trigger component, and it is used to change the state of the component. For example, since the Sampler services the ‘‘start’’ message, a transaction arriving at a Trigger component can start a Sampler. The sections that follow document the elementary components and show in tables the types of state and information messages that the components service. Each elementary component has a Control Panel associated with it. This panel provides you access to parameters that control the behavior and appearance of the component. Source Components The source components are sources of transactions. There are two types of sources: Sampler and Transaction Pool. ELEMENTARY COMPONENTS Icon 13 Component Description Sampler generates transactions with prescribed inter-arrival times Transaction Pool a source of transactions The Sampler generates a transaction, then waits a specified time interval before generating another transaction. The time between transactions, called the inter-arrival time, can be a sample of a random variable (from one of several distributions), a fixed amount, or the value of a variable read from a SAS data set. By default, the inter-arrival time is an observation of an exponential random variable with parameter 1. Figure 2.2. The Sampler Control Panel Figure 2.2 shows the Control Panel for the Sampler. The combobox labeled ‘‘Inter-Arrival-Time Distribution’’ enables you to specify the type of distribution. If you press the down arrow a list of distributions is displayed. You select the inter-arrival time distribution by selecting one of these. The control panel also has a slider for setting the capacity of the Sampler, that is, the number of transactions that can be generated by that control unit before the Sampler shuts off. The ‘‘Transaction Image’’ button on the control panel enables you to choose a bitmap image that would flow through the network when the animate push button on the simulation control panel is pressed. The Transaction Pool (the other source component) differs from the Sampler only in that it does not instantiate transactions unless it receives a request for transaction message. In other ways, it is identical to the Sampler. The following list documents the logic of the source components: 14 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS transaction arrival A transaction that originates at or flows into a source component flows out each arc directed away from it. Note that this means that the transaction can traverse multiple arcs and reside in multiple places simultaneously. request for transaction A Sampler passes requests to arcs leading into it. A Transaction Pool generates a transaction and intiates its flow. are you busy message The source components pass this request to arcs leading out of them and return their answers. query message sizeIs onIs idIs capacityIs remainingIs trigger message start stop reset setCapacity setDistribution setParameter1 setParameter2 returns the number of transactions sent. returns TRUE if the source component is started, else FALSE. returns the source component’s unique identifier. returns the capacity. returns the number of transactions remaining to be sent. starts the source component. stops the source component. stops the source component and resets the number of transactions to 1. sets the capacity from the transaction attribute ‘‘capacity.’’ sets the distribution from the transaction attribute ‘‘distribution.’’ This attribute should be a character string whose value is one of the distributions: Exponential, Gamma, Erlang, Uniform, IUniform, and Deterministic. sets the first parameter in the distribution from the transaction attribute ‘‘parameter1.’’ sets the second parameter in the distribution from the transaction attribute ‘‘parameter2.’’ Server Components Server compoents model a resource used by a transaction for a specified amount of time. There are two types of servers: Server and MServer. Icon Component Description Server provides service on/for a transaction MServer provides service simultaneously on/for multiple transactions ELEMENTARY COMPONENTS 15 The Server holds the transaction while it is served. The service time can be a sample of a random variable (from one of several distributions), a fixed amount, or the value of a variable read from a SAS data set. By default, the service time is an observation of an exponential random variable with parameter 1. An MServer, or multiple-server, can service multiple transactions simultaneously. The capacity of an MServer is set using the slider labeled ‘‘Capacity’’ on its control panel. Figure 2.3. The Multiple-Server Control Panel Notice that in the lower right-hand corner of the server components, there is a small rectangle. This is a Balk node. If a transaction arrives at a Server when it is busy or at an MServer when it is at capacity, the transaction will flow out the Balk node. Consider, for example, a situation where transactions are either serviced upon arrival by server 1 or, if server 1 is not free, wait for service from server 2. This is modeled by the network in Figure 2.4. Figure 2.4. Server Balk Model The following list documents the logic of the server components: transaction arrival If the server is busy, at capacity, or stopped, the transaction flows out the Balk node; otherwise service is scheduled. On 16 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS service completion, a request for transaction message is sent to arcs directed into the server. If a transaction is found, then its flow is initiated. Regardless, the transaction that just finished service flows on each of the arcs directed out of the server. request for transaction If the server is not busy or stopped, then pass on the request to all arcs directed into the server. are you busy message If the server is not busy and not stopped, then return FALSE; otherwise, return TRUE. query message sizeIs busyIs idIs trigger message returns the number of mutiple-server units that are busy. returns TRUE if the Server is busy or the MServer is at capacity; else, returns FALSE. returns the server’s unique identifier. start stop starts the server component. stops the server component. Transactions in service have normal completion. setCapacity sets the capacity from the transaction attribute ‘‘capacity.’’ setDistribution sets the distribution from the transaction attribute ‘‘distribution.’’ setParameter1 sets the first parameter in the distribution from the transaction attribute ‘‘parameter1.’’ setParameter2 sets the second parameter in the distribution from the transaction attribute ‘‘parameter2.’’ seize attempts to obtain service for the transaction that arrived at the Trigger. preempt removes all the transactions that are being served. They flow out of the Balk node. preemptContinue removes all the transactions that are being served. They flow out of the Balk node. The server requests transactions from upstream components. removeIt removes the transaction at the Trigger, if it is being served. It flows out of the Balk node. Queue Components Queue components are transient storage for transactions. There are three types of queues: FIFO Queues, LIFO Queues, and Priority Queues. ELEMENTARY COMPONENTS Icon 17 Component Description FIFO Queues first-in-first-out LIFO Queues last-in-first-out Priority Queues priority Each type of queue can behave as a ‘‘buffer’’ if the check box on the queue control panel is set. This means that when the transaction first arrives, the queue will not try to route it to a nonbusy component but will wait for a request for transaction message from a downstream component before sending it on. The Priority Queue uses the value of the numeric transaction attribute named ‘‘priority’’ to determine placement location in the queue. The numeric transaction attribute is assigned by the Modifier component, discussed in the ‘‘Logic Components’’ section. The greater the value of the attribute, the higher placement in the queue and the sooner the element will leave the queue. Figure 2.5. The FIFO Queue Control Panel The following list documents the logic of the Queue components. transaction arrival If the queue is off or at capacity, the transaction flows out the Balk node; otherwise, check whether the queue is a ‘‘buffer’’ type. If the queue is not a ‘‘buffer’’ type, send the message are you busy to the nodes on arcs directed away from the queue. If FALSE is returned, then route the transaction there; otherwise, queue the transaction. If the queue is a ‘‘buffer,’’ then do not check for nonbusy components; always queue the transaction. request for transaction If the queue is not empty (size > 0), then remove the next transaction according to the type of queue and send it out the arc directed to the component that made the request. 18 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS are you busy message always returns FALSE. query message sizeIs idIs trigger message empty balk insert filter releaseOne returns the number of transactions that are in the queue. returns the server’s unique identifier. empties the queue of all transactions. Note that the transactions do not leave via the Balk node. causes the transaction at the Trigger to leave the queue from the Balk node. inserts the transaction at the Trigger into the queue. evaluates a formula for each transaction in the queue. If the formula evaluates to TRUE, the transaction balks; otherwise, it maintains its place in the queue. The formula that is evaluated should be in an attribute named ‘‘formula’’ in the triggering transaction. releases one transaction from the queue via the the Balk node. Logic Components The logic components fall into two categories: those that control the flow of transactions are Adder, Splitter, Router, and Switch; and those that change the state of the simulation are Modifier and Trigger. Descriptions follow: Icon Component Description Adder assemble multiple transactions Splitter split single transactions Modifier assign an attribute to transactions MultiModifier assign attributes to transactions Trigger change components state MultiTrigger change components state Router direct flow as a function of system state Switch direct flow as a function of system state ELEMENTARY COMPONENTS 19 Trigger Component When a transaction arrives at a Trigger component, it initiates a message being sent to another component. For example, Figure 2.6 shows the control panel for a Trigger component. Notice that the ‘‘Queue’’ component is selected and that the ‘‘insert’’ trigger is also selected. Figure 2.6. The Trigger Control Panel When a transaction arrives at this Trigger, the insert message is sent to the specific queue named selected in the control panel. As documented in the section, ‘‘Queue Components,’’ the transaction that arrives at the Trigger is the one inserted into the queue name ‘‘FIFO Queue.’’ Notice the check box labeled ‘‘Schedule Trigger Event’’ in the trigger control panel. You select this check box to delay execution of the trigger event. You can specify the length of the delay by pressing the ‘‘Event Interval’’ button. This opens a Distribution window (like the one shown in Figure 2.32) from which you can choose a distribution, a fixed interval, or a numeric variable in a SAS data set. The following list documents the logic of the Trigger component: 20 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS transaction arrival executes the trigger; then the transaction flows down each arc directed away from the component. request for transaction the transaction flows down each arc directed away from the component. are you busy message if any of the components on arcs directed out of the Trigger is busy, then return TRUE; else, return FALSE. query message idIs trigger message none returns the component’s unique identifier. MultiTrigger Component When a transaction arrives at a MTrigger component, it initiates the sending of a set of messages to a set of components, one message to each component. For example, Figure 2.7 shows the control panel for a MTrigger component. Figure 2.7. The MTrigger Control Panel Notice that the list box labeled Triggers contains two entries, one labeled ‘‘Server 2 -> preempt’’ and the other labeled ‘‘Trigger.’’ The first one indicates that an arriving transaction will cause the ‘‘preempt’’ message to be sent to ‘‘Server 2.’’ The second one, labeled ‘‘Trigger,’’ is selected Notice that the ‘‘Server 2ueue’’ component is ELEMENTARY COMPONENTS 21 selected. Since the ‘‘Edit’’ button was pushed the second MTrigger Control Panel is displayed. In that window ‘‘Server 4’’ and ‘‘seize’’ have been selected. This means that the second message triggered by an arriving transaction will send the ‘‘seize’’ message to the component labeled ‘‘Server 4.’’ The following list documents the logic of the MTrigger component: transaction arrival sends each message to the appropriate component, then the transaction flows down each arc directed away from the component. request for transaction the transaction flows down each arc directed away from the component. are you busy message if any of the components on arcs directed out of the MTrigger is busy, then return TRUE; else, return FALSE. query message idIs trigger message none returns the component’s unique identifier. Modifier Component The Modifier component assigns an attribute to a transaction. The control panel, shown in Figure 2.8, provides a field for entering the attribute name and a push button for assigning a formula to the Modifier component. By default, when a transaction arrives at the component, a value is assigned to the attribute. How this value is evaluated depends on how you set the radio buttons in the control panel. It could be a simple character or numeric assignment, or it could be a formula evaluation, the sampling of a random variable, or the result of reading a variable from a data set. Regardless, the result of evaluation is the value given to the attribute. This attribute-value combination is unique to the transaction, and the transaction carries it on its route through the simulation network. 22 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS Figure 2.8. The Modifier Control Panel On the other hand, if you select the ‘‘Delay Formula Evaluation’’ check box, the formula is not evaluated when the transaction arrives at the modifier but is attached as an attribute to the transaction. This feature is used with the ‘‘filter’’ trigger message on queues. Details regarding formulas are discussed in the ‘‘Formulas’’ section. The following list documents the logic of the Modifier component: transaction arrival assigns the attribute; then the transaction flows down each arc directed away from the component. request for transaction the transaction flows down each arc directed away from the component. are you busy message if any of the components on arcs directed out of the Modifier is busy, then return TRUE; else, return FALSE. query message idIs trigger message none returns the component’s unique identifier. MultiModifier Component The MModifier component assign multiple attributes to a transaction. The control panel, shown in Figure 2.9, provides a field for entering the attribute name and an ‘‘OK’’ push button for adding the attribute to the attributes list. ELEMENTARY COMPONENTS Figure 2.9. 23 The MModifier Control Panel The list shows two attributes, named ‘‘class’’ and ‘‘priority.’’ By default when a transaction arrives at the component, each of the attributes is assigned a value as is done in the Modifier component. This attribute-value combinations are unique to the transaction, and the transaction carries them on its route through the simulation network. The following list documents the logic of the MModifier component: transaction arrival assigns the attribute; then the transaction flows down each arc directed away from the component. request for transaction the transaction flows down each arc directed away from the component. are you busy message if any of the components on arcs directed out of the Modifier is busy, then return TRUE; else, return FALSE. query message idIs trigger message none returns the component’s unique identifier. Router and Switch Components The Router and Switch components are for directing the flow of a transaction as a function of the state of the simulation. The Router can have a formula associated with each arc directed away from it. When a transaction arrives at the Router, each formula 24 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS is evaluated and the transaction flows down all arcs with formulas that evaluate to TRUE. The Switch is similar to the Router, but it has only one formula associated with it. The formula evaluation is interpreted as a case, which identifies an arc or set of arcs down which the transaction should flow. If the evaluation does not identify a valid case, the transaction flows out the Balk node. Figure 2.10. Switch Control Panel Figure 2.10 shows the control panel for a switch connected to two queues as in Figure 2.11. Selecting the button labeled ‘‘Formula’’ displays a Formula Manager Window (see Figure 2.30). There you build, verify, and save the formula associated with the switch. When a transaction arrives at the switch, the formula associated with the switch is evaluated. This value is compared to each of the cases listed in the Switch control panel. The transaction flows down the arcs associated with each of the cases that match. You can associate arcs with a case by selecting a case and pressing the ‘‘Edit’’ button. This displays the ‘‘Switch’’ window, as shown in Figure 2.10. In this window you select one or more of the listed components. For example, a Switch can be used to direct transactions to the smaller of two queues. ELEMENTARY COMPONENTS Figure 2.11. 25 Switch Controlled Queue Selection Figure 2.11 shows what such a model might look like and Figure ?? shows how you would identify formula values with cases and routing. See the ‘‘Formulas’’ section for further discussion. The following list documents the logic of the Switch component: transaction arrival evaluates the formula for the switch. It should evaluate to a number i. The transaction flows down the ith arc leaving the switch. If there is no ith arc, the transaction BALKS. request for transaction the transaction flows down each arc directed away from the component. are you busy message if any of the components on arcs directed out of the Switch is busy, then return TRUE; else, return FALSE. query message idIs trigger message none returns the server’s unique identifier. The following list documents the logic of the Router component: transaction arrival evaluates the formula for each arc leaving the router. If an evaluation returns TRUE, then the transaction flows down the associated arc. request for transaction the transaction flows down each arc directed away from the component. are you busy message if any of the components on arcs directed out of the Router is busy, then return TRUE; else, return FALSE. query message idIs trigger message none returns the component’s unique identifier. 26 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS Adder Component The following list documents the logic of the Adder component: transaction arrival if all components on arcs leading into the Adder can initiate flow, then initiate a transaction from each; otherwise, BALK the transaction. request for transaction if all components on arcs leading into the Adder can initiate flow, then initiate a transaction from each. are you busy message if all components on arcs leading into the Adder can initiate flow, then return TRUE; else, return FALSE. Query message idIs trigger message none returns the component’s unique identifier. Splitter Component The following list documents the logic of the Splitter component: transaction arrival the transaction flows down each arc directed away from the component. request for transaction if any of the components on arcs directed out of the Splitter is busy, then pass on the request to all components on arcs leading into the Splitter. are you busy message if any of the components on arcs directed out of the Splitter is busy, then return TRUE; else, return FALSE. query message idIs trigger message none returns the component’s unique identifier. Holder Components There are two types of holders, StringHolder and NumberHolder. These are used to hold strings and numbers that contain user defined state information. Icon Component Description NumberHolder storage for a number StringHolder storage for a string ELEMENTARY COMPONENTS 27 For example, suppose that you want to save the value of a transaction attribute called ‘‘weight’’ in a NumberHolder. Figure 2.12. Number Holder Saving ‘‘weight’’ Attribute In the model fragment in Figure 2.12, when the transaction arrives at the Trigger, the value of the ‘‘weight’’ attribute in that transaction is saved in the NumberHolder. Now, another part of the simulation can query the NumberHolder to find the current value of ‘‘weight.’’ You specify the name of the attribute that is stored in the NumberHolder in the NumberHolder Control Panel , which is displayed by selecting the ‘‘Control Panel...’’ selection on the popup menu on the NumberHolder. Figure 2.13. Number Holder Control Panel Notice that the NumberHolder control panel shown in Figure 2.13 has the attribute name ‘‘weight’’ in the field labeled ‘‘Attribute.’’ The transaction sets the NumberHolder when it arrives at the Trigger because the Trigger Control Panel , as shown in Figure 2.14, has the NumberHolder component selected and the setvalueFromAttribute selected. 28 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS Figure 2.14. A Trigger Control Panel The following list documents the logic of the holder components: transaction arrival increments COUNT; then flows the transaction to each arc directed away from the component. request for transaction passes on the request to all arcs directed into the component. are you busy message if any component on an arc leading out of the Trigger is busy, then return TRUE; otherwise, return FALSE. query message valueIs countIs returns the value in the holder. returns the number of transactions that have routed through the holder. trigger message setValueFromAttribute sets the value from the transaction attribute. clearSetValueFromAttribute clears the value then sets it. setValueFromTrigger sets the constant value that is given on the Trigger Control Panel. printValue prints the value on the SAS Log Window. printCount prints the count on the SAS Log Window. controls displays the Holder Control Panel. ELEMENTARY COMPONENTS 29 reset resets the value and the count. incrementCount increments the count. decrementCount decrements the count. + (for numberholder only) adds the transaction attribute to the value. - (for numberholder only) subtracts the transaction attribute from the value. setTimenow (for numberholder only) sets the simulation time into the value. Chart Components There are three types of charts, Barchart, Stripchart and Probe. The charts are used to display information about the performance of the system. Icon Component Description Barchart sample and display state information Probe sample and display state information Stripchart display transaction age Stripchart Component The StripChart displays the age of a transaction that arrives at it. The vertical axis is for transaction age and the horizontal axis is for simulation time. Figure 2.15. An m/m/1 Queue with StripChart 30 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS In Figure 2.15 there is an m/m/1 queueing model and a StripChart. When the transactions leave the server they travel to the StripChart. For each transaction that arrives to it, it shows its total time in the system. This includes the time the transaction spent in all queues and all servers. Figure 2.16. The StripChart Control Panel The control panel in Figure 2.16 shows that a server has been selected to be monitored. This means that, when transactions leave the server they flow to the stripchart where their ages are displayed. The control panel also shows simple statistics on transaction age. The ‘‘Display Controls’’ section provides control on the display scaling and on the stripchart speed. By default, the vertical axis is scaled to twice the difference between the maximum and minimum values. If you select the ‘‘Autoscale’’ check box, then the stripchart is rescaled periodically; otherwise scaling is controlled by the value of the ‘‘Vertical Axis Range’’ number on the Control Panel. When you select the ‘‘Collect Data’’ check box, the history of state changes for each transaction are saved in a SAS data set. The details of this data set are discussed in Chapter 5, ‘‘Saving and Restoring.’’ You can analyze the data you collect by pressing ELEMENTARY COMPONENTS 31 the ‘‘Analyze’’ button. This calculates additional summary statistics and prints the results in the SAS Output Window. The details of the type of analysis is discussed in Chapter 6, ‘‘Analyzing the Sample Path.’’ The following list documents the logic of the Stripchart component: transaction arrival flows the transaction on each arc directed away from the component. request for transaction passes on the request to all arcs directed into the component. are you busy message if any downstream component is busy then return TRUE; else, return FALSE. query message trigger message idIs meanIs maximumIs minimumIs throughputIs returns the source component’s unique identifier. returns the sample mean. returns sample maximum. returns the sample minimum. returns the sample throughput. start stop reset starts the chart component. stops the chart component. stops the chart component and resets it. Probe Component The Probe component also displays simulation state information on the vertical axis and time on the horizontal axis. But it can display a wider variety of information than the StripChart. Figure 2.17. An m/m/1 Queue with Probe As the name implies, the Probe sends messages out to various components and receives replies, which it plots. In Figure 2.17 the Probe is sampling the Server to see if 32 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS it’s busy or not and displaying the sample. The rate at which it sends these messages is specified by the ‘‘Inter-Sample-Time Distribution’’ combobox on its control panel. Figure 2.18 shows a Probe control panel. By default, the samples are sent at fixed, deterministic intervals of 1. Figure 2.18. The Probe Control Panel Notice that the queue is the selected component and that the state being monitored is the ‘‘busyIs.’’ If you look at the busyIs query message in the ‘‘Server Components’’ section, you see that it returns a TRUE if the server is busy and a FALSE otherwise. In the Probe, the TRUE is displayed as a 1 and the FALSE as a 0. So, by looking at this factor, you measure server utilization. The mean is an estimate of the probability that the server is busy. ELEMENTARY COMPONENTS 33 The following list documents the logic of the Probe component: transaction arrival flows the transaction on each arc directed away from the component. request for transaction passes on the request to all arcs directed into the component. are you busy message if any downstream component is busy then return TRUE; else, return FALSE. query message idIs trigger message meanIs maximumIs minimumIs throughputIs sampleSizeIs returns the source component’s unique identifier. returns the sample mean. returns sample maximum. returns the sample minimum. returns the sample throughput. returns the sample size. start stop reset starts the chart component. stops the chart component. stops the chart component and resets it. Bar Chart Component Like the Probe, the BarChart component displays simulation state information obtained from sampling other components in the model. The BarChart is composed of a bars. Each bar samples the state of a component in the model. The BarChart provides an encapsulation and some synchronozation of the the bars. Figure 2.19. The Bar Chart Popup Menu 34 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS Initially, a BarChart has is empty. You add bars to the chart by choosing the ‘‘Add Bar’’ selection on the popup menu on BarChart, as in Figure 2.19. Figure 2.20 shows an m/m/1 model with a bar chart with two bars. Figure 2.20. An m/m/1 Queue with Bar Chart One of the bars is sampling the server and displaying the sample mean server utilization. This is the same quantity sampled by the Probe in the example in the last section. The other bar is sampling the queue and displaying the sample mean queue size. The control panel for a bar, as shown in Figure 2.21, has a check box that controls whether the bar is to display the sample mean or the actual sample. By default, the sample mean is displayed. ELEMENTARY COMPONENTS Figure 2.21. 35 The Bar Control Panel Notice that this control panel looks similar to the control panel for the Probe. That is because of the similar function of the bar and the Probe The following list documents the logic of a bar: transaction arrival flows the transaction on each arc directed away from the component. request for transaction passes on the request to all arcs directed into the component. are you busy message if any downstream component is busy then return TRUE; else, return FALSE. query message trigger message idIs meanIs maximumIs minimumIs throughputIs sampleSizeIs returns the source component’s unique identifier. returns the sample mean. returns sample maximum. returns the sample minimum. returns the sample throughput. returns the sample size. start stop reset starts the chart component. stops the chart component. stops the chart component and resets it. Port, Connector, and Label Components Ports and Connectors aid in connecting components to each other and are useful when building hierarchical models and assembling components into larger aggregate components. You can annotate the simulation with text by using Labels. In addition, you can attach labels to many of the elementary components. You do this by selecting ‘‘Add label’’ from the popup menu on the component you want to annotate. Then, type the text you want to appear in the label. Icon Component Description Port for connecting multiple components Connector for connecting multiple components without using arcs Label for annotating the model 36 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS Figure 2.22 shows an example with a connector labeled ‘‘a.’’ When a transaction flows into connector ‘‘a,’’ it will flow out of all other connectors ‘‘a.’’ Figure 2.22. Simple Example Using a Connector The three ‘‘a’’ connectors are treated as identical. An equivalent model using an instance of a Port is shown in Figure 2.23. Figure 2.23. Simple Example Using a Port Here, you see the port explicitly connects the three components, which were implicitly connected using the Connector. You duplicate a Connector by selecting ‘‘Duplicate’’ on the popup menu. If you label the interior of the Connector, then all the duplicates of that connector will display the same text. Connecting Components The examples presented thus far used arcs to connect components. This section describes arcs and some of the features they provide in a more detail. The arc selection on the toolbar is a type of component state button. If it is selected and you click in a component, a rubberband line displays from the component to the cursor. If CONNECTING COMPONENTS 37 you don’t see this line, it means that the component doesn’t support arcs directed away from it. You will not get an error message. If there is a rubberband line attached to the cursor, when you click in another component that supports arcs directed towards it, the rubberband line is replaced by a solid arc. If, while the rubberband line is connected to the cursor, you move the cursor to the right or below the window border, the window will automatically scroll. This is power scrolling, and it allows you to connect components that may not be visible in the window simultaneously. If you click outside the window border while power scrolling, then the rubberband line is dropped. There are two types of arcs, regular arcs and segmented arcs. As the name implies, segmented arcs are composed of multiple line segments. Figure 2.24 shows the two types of arcs. Figure 2.24. Two Types of Arcs If you click on the simulation window background while a rubberband line is connected to the cursor, the selected point ends one line segment and begins another. In this way you can create circuitous routes between components. Notice the rectangular handle in the center of the arc. This is the arc’s ‘‘hot spot’’. If you click the right mouse button while the cursor is over the hot spot, a menu associated with the arc pops up. 38 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS Figure 2.25. Popup Menu for a Segmented Arc Notice that in the popup menu for segmented arcs in Figure 2.25, there is a selection titled ‘‘Perpendicular.’’ This selection causes the arc to be drawn so that the line segments are perpendicular to each other. As the numerous selections in Figure 2.25 show, a full range of capabilities are available. Although there are no visual indicators of the order in which arcs are initially drawn between components, this order can be important. For example, when a server sends the message up the arcs directed towards it requesting additional transactions, it sends the message first to the arc connected to it last. If that request results in no transactions, it sends the message to the next to last arc that was connected to it. Validating a model using animation can help you determine the order in which these events occur. Transactions Transactions are generated in three components: Sampler, Transaction Pool, and Adder. Transactions are discrete entities that traverse the simulation network, and they can be used to represent physical and conceptual things such as a partially assembled refrigerator on an assembly line, a telephone call in a phone system, or a check on the size of a queue. You can view the movement of transactions through the network by selecting the ‘‘Animate’’ check box on the Simulation Control Panel (see Figure 1.6). Bitmap images can be assigned to transactions in each of the three components in which they are TRANSACTIONS 39 generated. For example, the ‘‘Transaction Image’’ push button on the Sampler control panel (see Figure 2.2) opens a window from which you can choose an image to display on the transactions that originate at that Sampler. Figure 2.26 shows an example. Note that, although Figure 2.26 shows the image SASHELP.ORIMAGE.PHONE, any image in a SAS catalog can be used. Figure 2.26. Setting an Image for a Sampler Transaction When there are no references to transactions in the simulation the transaction is disposed of. This means that if a transaction does not reside in a queue, is busy in a server, is traversing an arc, or is being processed by another elementary component, it will be disposed of. You do not have to explicitly have to destroy them. History The transaction maintains a history of the processing it has received. For example, when a transaction enters a queue, it records the time it entered the queue and when it leaves the queue, it records the time it left the queue. When a transaction enters a StripChart, if the ‘‘Collect Data’’ check box is set (see Figure 2.16), then its history is written to a SAS data set. 40 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS Note that the transaction history is saved for only 1000 state changes. This limit enables transactions to travel in some cyclical networks. In particular, if a cycle has a simulation time delay resulting from time in a queue or in a server, then it is allowed. If the cycle does not, it can result in the standard ‘‘infinite loop’’ and a machine stack overflow. When this happens, the error is identified, and you can reset the simulation and continue. Attributes You assign an attribute to a transaction in the Modifier component. There are two types of attributes, numeric and character. An attribute is attached to the transaction for the duration of the transaction, but it can be given another value at any time. By default, the age of the transaction is stored as an attribute in the transaction. This is the quantity that is displayed in the StripChart. You can access it with the attribute name ‘‘age’’. Trigger Messages The Trigger component includes an entry labeled ‘‘Transaction’’ in the ‘‘Components’’ list. Figure 2.27 shows a Trigger control panel with this entry selected. TRANSACTIONS 41 Figure 2.27. Transaction Trigger Messages Notice the entries in the ‘‘Trigger’’ list box. These entries are possible behaviors to trigger when a transaction arrives at the Trigger component. removeFromServers removes the transaction from any servers by sending the ‘‘removeIt’’ message to all servers. removeFromQueues removes the transaction from any queues by sending the ‘‘balk’’ message to all queues. routeToId routes the transaction to the component that has id equal to the value of the ‘‘routeToId’’ attribute attached to the transaction. These options provide you additional modeling flexibility. The two examples ‘‘Servers as Resources II’’ and ‘‘Special Routing’’ in Chapter 7, Selected Examples, illustrate two uses of these capabilities. Timing Transaction Arrivals There are some issues concerning timing of transaction arrivals at a component. Consider model fragment A in Figure 2.28. 42 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS Figure 2.28. Model Fragment A Although transactions leaving the multiple-server will arrive at the Trigger and the StripChart at the same simulation time, the logic and behavior of each of these components will be executed in sequence. There is no guarantee which will occur first. Figure 2.29. Model Fragment B To guarantee that the Trigger ‘‘Server Off’’ executes before the transaction traverses to the StripChart, connect the components as in Figure 2.29. Formulas The Router, Switch, and Modifier components use formulas to control routing and set attributes. Formulas are specified in a Formula Manager window. Figure 2.30 shows one such window with the formula 5:0 + X , where X is a random variable with distribution E (1). FORMULAS 43 Figure 2.30. Formula Manager Window Formulas are built using the same type of user interface as that for building models. The toolbar has a set of command buttons and a set of state buttons. The state buttons are associated with the elements used to build formula expressions. You choose a state button to identify an element with the cursor. Then, click on the background to instantiate the formula element. The following table shows some of the elements: Icon Description another formula a transaction attribute the simulation clock a component in the model an observation of a variable in a SAS data set a number constant a string constant 44 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS Each of these selections has a popup menu associated with it. For example, the random variable icon shown in Figure 2.30 has a popup menu, shown in Figure 2.31. Figure 2.31. Popup Menu on the Random Variable Formula Element If you select ‘‘Edit,’’ the window shown in Figure 2.32 is displayed. From this window you select the distribution for the random variable. When the formula is evaluated (to set an attribute or determine transaction routing, for example), an observation of the random variable is made. Figure 2.32. Control Panel for the Random Variable Formula Element Another important formula element is the model . Recall an example discussed in the ‘‘Switch Components’’ section. There, the model in /frefswitchmodel routes transactions to the smallest queue. The control panel on the Switch shown in Figure 2.10 has ‘‘TRUE’’ as a case for routing to component ‘‘Queue 1’’. This means that you want the formula associated with this switch to return TRUE if queue 1 is smaller than queue 2. To accomplish this, you compare the sizes of the two queues and return TRUE if the size of ‘‘Queue 1’’ is less than the size of ‘‘Queue 2.’’ FORMULAS 45 Figure 2.33. Formula for Comparing the Size of Two Queues Figure 2.33 shows the formula for accomplishing this. The edit window on the left-hand model element is shown in Figure 2.34. Figure 2.34. The Model Element Edit Window The ‘‘Component’’ list box contains the simulation components. When you select one of these components the ‘‘Query’’ list box displays query messages for that component. When the formula is evaluated, the result of the query of the identified component will be used. For example, when the formula shown in Figure 2.33 is evaluated, the model element will query ‘‘Queue 1’’ with the message ‘‘sizeIs,’’ which will return the number of elements in its queue. Similarly, if you edit the model element on the right-hand side of the > and set it to query ‘‘sizeIs’’ of ‘‘Queue 2,’’ the formula will evaluate to TRUE if ‘‘Queue 1’’ has fewer elements than ‘‘Queue 2.’’ In this case, the switch will send the transaction to ‘‘Queue 1.’’ You should be careful when validating your models that they are behaving as you want them. There is not a great deal of error checking being done when formulas are evaluated, particularly with regard to type. For example, a Router may expect a TRUE or FALSE returned from a formula, but you could enter a valid formula that evaluates to a number or a string. QSIM would not detect this type of error but would function as if a nonzero number were TRUE. 46 CHAPTER 2. BUILDING A MODEL WITH ELEMENTARY COMPONENTS The formula syntax is standard with two exceptions. First, functions of one argument, such as the trigonometric functions, are specified in reverse polish style. So, an expression like log (X ) would be displayed as in in Figure 2.35. Figure 2.35. A Formula for the Log of a Random Variable Functions of two arguments, such as max and min, are specified between the arguments. So, an expression like max(X; :75) would be displayed as in Figure 2.36. Figure 2.36. A Formula for the Maximum of a Random Variable and .75 Unique Component IDs The system assigns a unique component id to each of the elementary components. This is done so that you can unambiguously identify each component that appears in a list box. For example, when you instantiate a Server all that appears in the Simulation Window is the icon . If you have several of these icons and you look at a Probe control panel, such as the one shown in Figure 2.18, you cannot distinguish them unless you give each a unique label. By default, each will have a unique id, which is appended to the name of the object and displayed in the list box. As an alternative, you can give the component a label, which will be displayed in the list box. By default, the iconic representation of a component in the Simulation Window, includes the unique id. Chapter 3 Building a Model with Compound Components The ability to assemble elementary components into larger aggregates is an important feature of QSIM. It encourages hierarchical model building, information hiding, and component reuse. This chapter discusses the details of compound components in model building. Figure 3.1. A Compound Component with Queue and a Server 47 48 CHAPTER 3. BUILDING A MODEL WITH COMPOUND COMPONENTS Assembling Components into Compound Components Recall that the popup menu on the Simulation Window (see Figure 1.3) has as its first entry ‘‘Assemble Components.’’ When you choose this selection, you get a rubberband rectangle with which you can sweep out an area on the Simulation Window. Any components that are completely within this region will be encapsulated in a compound component. Figure 3.1 shows an example compound component. This encapsulated queue and server can now be treated as a single unit, called a compound component, It has a popup menu, shown in Figure 3.2, which includes ‘‘Assemble Components’’ and ‘‘Disassemble Components’’ for assembling additional compound components within it and for removing the encapsulation. Figure 3.2. The Compound Component Popup Menu This compound component also includes ‘‘Edit,’’ a selection that opens a separate window for editing the contents of the compound component, and ‘‘Expose/Hide Details,’’ a selection that toggles the compound component with an icon. The default icon, , can be replaced with a user icon by using the ‘‘Options’’ selection on the Simulation Window popup menu (see Figure 1.3). CONTROLLING SUBCOMPONENT EXPOSURE 49 You can use the Port with nested compound nodes to build useful components for subsequent reuse. For example, by adding two Ports, one for transactions to enter the queue and the one for transactions to leave after service, and then assembling the ports and the compound component into a larger unit, you can further encapsulate the queue-server combination as shown in Figure 3.3. Figure 3.3. A Multi-Level Compound Component with Queue, Server, and Ports This demonstrates how you can nest compound components and build hierarchical models. Controlling Subcomponent Exposure Another feature that helps encourage the use of hierarchical models is the ability to limit the exposure of compound components. Even though the model in Figure 3.3 is nested and allows you to connect to ports, it still exposes submodel detail. However, the popup menu on the compound component also has an entry labeled ‘‘Expose/Hide Details.’’ Selection of this entry hides the detail in the compound component behind the icon . With the inner compound component hidden, the model shown in Figure 3.3 looks like Figure 3.4. Figure 3.4. A Multi-Level Compound Component with Ports You can expose the detail in the inner ‘‘Queue/Server’’ component by selecting ‘‘Expose/Hide Details’’ again on the inner component labeled ‘‘Logic.’’ With 50 CHAPTER 3. BUILDING A MODEL WITH COMPOUND COMPONENTS these features, you assemble components with complex behavior, attach ports to the substructures, then hide the detail, exposing only the structure necessary for using the compound component. Not only can you hide the visual details of compound components, but you can also hide the details of the logic in a compound component. Consider the model from Figure 3.4 but with additional labeling. Figure 3.5. A Multi-Level Compound Component with Details Hidden The popup menu on compound components in Figure 3.2 shows the selection ‘‘Select Components...’’. When this is selected for the component labeled ‘‘Logic,’’ the window in Figure 3.6 is displayed. In this window, you can select those components that you want exposed when queries are made on the ‘‘Logic’’ compound component. Figure 3.6. A Compound Component Control Panel The ‘‘All Components’’ list box contains all the components in the ‘‘Logic’’ compound component. The ‘‘Expose Components’’ list box contains only those that will be exposed. You move selections between the list boxes by pressing the push buttons CONTROLLING SUBCOMPONENT EXPOSURE 51 labeled ‘‘->’’ and ‘‘<-’’ after selecting those items you want moved. Notice that only ‘‘FIFO Queue’’ will be exposed. For example, consider the model shown in Figure 3.7. Figure 3.7. A Model with Switch and Compound Component Suppose that you want to use a model element in the formula for a Switch routing. You open an edit window on the model element, as shown in Figure 3.8. Figure 3.8. Control Panel for the Formula Model Element Notice that when the ‘‘Queue/Server’’ is selected, the ‘‘Query’’ list box displays the query messages from the FIFO Queue component. This is because you had previously selected only that element to be exposed. 52 CHAPTER 3. BUILDING A MODEL WITH COMPOUND COMPONENTS Editing Components Suppose that you want to edit the ‘‘Logic’’ component in the model in Figure 3.7. One way is to visually expose the detail in an edit window by selecting ‘‘Edit...’’ from the popup menu on compound components (see Figure 3.2). Figure 3.9 shows such an edit window for the ‘‘Logic’’ component. Figure 3.9. Editing the ‘‘Logic’’ Compound Component In this new window, you can modify the detail structure of the ‘‘Logic’’ compound component. Templates for Reusing Components Another powerful feature of compound components is the ability to use them as templates for replication. Figure 3.10. The Window for Naming Templates TEMPLATES FOR REUSING COMPONENTS 53 Selecting ‘‘Create Template...’’ from the popup menu on compound components, as shown in Figure 3.2, opens the window in Figure 3.10. Here you enter the name you want to give to the template, ‘‘Q/S’’, for example. When you press ‘‘OK,’’ a new state button is added to the toolbar, as shown in Figure 3.11. Figure 3.11. The Toolbar with the New ‘‘Q/S’’ Button Now, this button can be used to replicate the ‘‘Queue/Server’’ compound component. When you press it, the cursor has the state ‘‘Queue/Server,’’ and if you click on the Simulation Window background, you will get and instance of ‘‘Queue/Server.’’ You can also save these templates in SAS datasets for future use (see Chapter 5, ‘‘Saving and Restoring’’, for details). Note that it is possible to create templates that reference components not in the template itself. For example, you can have a Trigger as a template that references a queue not in that template. When the template is replicatated, the Trigger will no longer reference the queue and its reference to a component in the model will have to be reestablished. However, any references to components within the template will be preserved in replicates. 54 CHAPTER 3. BUILDING A MODEL WITH COMPOUND COMPONENTS Chapter 4 Random and Exogenous Variation in the Model Random and exogenous sources of variation play a central role in discrete event simulation. The Sampler, Server, MServer, and formulas are the principle sources of this variation in the QSIM models. However, there are other situations where variation can be useful. For example, you may want to delay the effect of a Trigger for some random or fixed amount of time. In each of these cases you have access to a combobox, such as the one in the Probe control panel shown in Figure 2.2, labeled to show the use of the source of variation. In this case, it is the time between samples that the Probe takes. If you click on the down arrow, a list that includes the possible distributions is displayed as in Figure 4.1. Figure 4.1. Source of Variation Combobox 55 56 CHAPTER 4. RANDOM AND EXOGENOUS VARIATION IN THE MODEL When you select one of these distributions, the selection is displayed in the text area to the left of the down arrow. For each distribution you select, you can set one or more parameters which further define the choice. There are two types of sources of variation, random and exogenous. These are not mutually exclusive. That is, an exogenous source of variation can be randomly generated. Random Sources of Variation The random sources of variation are generated using pseudo-random number generators. The QSIM application provides a set of standard generators. These include: Exponential, with mean 1= and density function f (x) = 1 exp x=; for 0 x; 0 Nonhomogenous Poisson, with rate paramter (t) and density function f (x) = 1(t) exp x=(t); for 0 x; 0 (t) where (t) is cyclic and continuous for all t 0 with sup (t) t0 Gamma, with parameters and n and density function f (x) = x nexp(n) ; for 0 x; 0 ; nZ + n 1 x= Erlang, with parameters and n and density function f (x) = x nexp(n) ; for 0 x; Z + ; nZ + n 1 x= Uniform, with parameter U and density function f (x) = U1 ; for 0 x; 0 U IUniform, with parameter U and density function f (x) = bU1 c ; for xZ; 0 U RANDOM SOURCES OF VARIATION 57 Deterministic, with parameter U and density function f (x) = 1; for x = U Each of these generators has a control panel for setting parameters. For example, if you pick Exponential from the list box in Figure 4.1 and then press the ‘‘Parameters’’ push button, the exponential control panel in Figure 4.2 will be displayed. In this window, you set the inital seed value and the mean 1=. Figure 4.2. The Exponential Control Panel The seed value for each distribution is initialized to 123456789. You have the responsibility of explicitly changing this value unless you want the same stream used for each random variable. Note that this means you are introducing a significant amount of correlation into the model that in all likelihood is not the system being modeled. Note that, by default, the Exponential mean in Figure 4.2, is set to 1. You can change the mean with the slider. The slider has a range of 0 to 10 for this parameter. If 10 is not large enough for the mean, you can increase it by pointing the cursor at the slider and pressing the right mouse button. This displays a popup menu with the entry ‘‘Attributes.’’ Selecting this will display the window in Figure 4.3. Figure 4.3. The Slider Attribute Window 58 CHAPTER 4. RANDOM AND EXOGENOUS VARIATION IN THE MODEL In this window you can change various parameters of the slider including the minimum and maximum values. To change the maximum value that an Exponential mean can have, enter a maximum value for the Exponential mean slider and press the button ‘‘Ok.’’ Now the slider can be moved to any value up to that maximum. FormulaDistribution QSIM provides a general function writing capability with the ‘‘FormulaDistribution’’ selection, shown in the list box in Figure 4.1. After you select it and then press the ‘‘Parameters’’ button, a Formula Manager Window (as shown in Figure 2.30) is displayed. From this window, you can write a function that returns a number that is used as the sample. For example, suppose you wanted a mixture distribution with density function f (x) = :5f1(x) + :5f2 (x) where f1 (x) is exponential with parameter and f2 (x) is uniform. Figure 4.4 shows a portion of the four windows needed to express this. Figure 4.4. An Example of a Mixture Distribution The bottom-most window is the FormulaDistribution Formula window, and it contains the conditional element . Editing this element provides you with the capability to specify the condition . If the condition evaluates to TRUE it returns the formula in the True Expression window , which is the appropriate exponential random variable; if it evaluates to FALSE, it returns the formula in the False Expression window , which is the uniform random variable. DATASOURCE 59 DataSource You have another opportunity to customize the source of variation with the ‘‘DataSource’’ selection shown in Figure 4.1. With this choice, you can select a SAS data set and a numeric variable. Whenever a sample is needed, an observation is read from the data set and the value of the selected variable is used as the sample value. You choose the data set by pressing the ‘‘Parameters’’ button, which displays the DataSource Control Window in Figure 4.5. Figure 4.5. The DataSource Control Suppose that you had executed the following data step which sampled 10000 observations from the mixture distribution with density function f (x) = :5f1(x) + :5f2 (x) where f1 (x) is exponential with parameter 1 and f2 (x) is uniform. data mixture; keep sample; do i = 1 to 10000; if ranuni(123456789) < .5 then sample = ranexp(98765432); else sample = ranuni(54321678); output; end; Then, the selections highlighted in Figure 4.5 would result in the sample being used. Note that the simulation may require more than 10000 observations of the random 60 CHAPTER 4. RANDOM AND EXOGENOUS VARIATION IN THE MODEL variable with this mixture density. In this case the DataSource will rewind the data set to the beginning and reuse the sample. If this feature is not accounted for, it could result in some unexpected and incorrect estimates of performance measures. Chapter 5 Saving and Restoring There are several ways to save information about the simulation. You can save the state of the simulation at a particular simulation instance; save a picture of the model as a SAS Graph object; save the sample path of a simulation; or save a representation of the simulation model or a piece of the model. Each of these saved representations can be reused, each in its own special way. Figure 5.1. The ‘‘Save As’’ Pull-down on the Simulation Window Figure 5.1 shows the pull-down menu on the Simulation Window from which you choose whether you want to save the state, a graph, or a model. 61 CHAPTER 5. SAVING AND RESTORING 62 State The state of the simulation includes the value of all parameters and settings, the logical and physical structure of the model, transactions in service, transactions waiting for service, and transactions in transit. The state does not include the sample path that the simulation may have taken to get to its current state. When you select ‘‘State...’’ from the pull-down in Figure 5.1, the Save State window in Figure 5.2 opens. Figure 5.2. Save State Window The state is saved in a SAS catalog whose name you can enter in this window. Suppose you have saved a simulation in catalog entry SASUSER.QSIM.DEFAULT. You can restart this simulation by entering the command ‘‘QSIM C=SASUSER.QSIM.DEFAULT’’ in any SAS window. The simulation will be continued from the state that it was in when it was saved. Any control panels or windows that were open will a be reopened. Models A model of the simulation includes the values of all parameters and settings, and the logical and physical structure of the model. It does not include information on transactions in service or those waiting for service. Nor does it include information on which windows and panels are open. When you select ‘‘Model...’’ from the pull-down in Figure 5.1, the Save Model window in Figure 5.3 opens. The model is saved in a SAS data set whose name you enter in the Save Model window. You can restore a model by selecting ‘‘Open...’’ from the pull-down in Figure 5.1. TEMPLATES 63 Figure 5.3. Save the Simulation Model Since a model is saved in a SAS data set it is possible to edit the model. However, this should not be done since it will result in errors when reading the model back into the simulation. Templates A template is the information attached to a state button in the toolbar. You define templates and add them to the toolbar as discussed in section ‘‘Templates for Reusing Components’’ in Chapter 3. If you want to save a template for use in a subsequent session or to share with other users you can save it in a SAS data set, which is very similar to a model data sets. If you press the command button in the simulation window toolbar, then the Toolbar Manager window will be displayed. CHAPTER 5. SAVING AND RESTORING 64 Figure 5.4. The Toolbar Manager Window You can customize the toolbar by selecting from the appropriate listbox, (see Figure 5.4) those icons you want displayed in the toolbar. When you press the ‘‘Apply’’ button the toolbar will be reconfigured as you requested. If you press the ‘‘Save Templates’’ button the Save Templates window will be displayed as in Figure 5.5. Figure 5.5. Save Templates Window A template is saved in a SAS data set whose name you enter in this window. In Figure 5.5, ‘‘Q/S’’ has been selected for saving. GRAPHS 65 To restore a template to the toolbar press the ‘‘Load Templates’’ button in the Toolbar Manager window in Figure 5.4. This displays the ‘‘Load Templates’’ window shown in Figure 5.6. Figure 5.6. Load Templates Window Here ‘‘SASUSER’’ and ‘‘Q/S’’ are selected. When the load button is pushed, the template will be loaded into the toolbar as in Figure 3.11. Graphs A graph is a visual representation of the model. There is no state information saved in the graph of the model. When you select ‘‘Graph...’’ from the pull-down in Figure 5.1, the ‘‘Save Graph’’/sbjiSave Graph Window window in Figure 5.7 opens. Figure 5.7. Save the Graph of the Simulation CHAPTER 5. SAVING AND RESTORING 66 There you enter the name of the entry in a catalog into which the graph representation is stored as a SAS/GRAPH grseg. Sample Paths There are two ways of accumulating sample path data. One is from the perspective of the components and the other is from the perspective of the transactions. Each of these puts the sampled data into a SAS data set that can be analyzed by your own programs. Each also relies on another SAS data set named ‘‘DICT,’’ which contains a dictionary for tying together components and unique component ids. Unlike the other pieces that are saved (state, models, templates, and graphs), the sample paths cannot be reconstituted by the QSIM application or by other applications or procedures within the SAS System. This information can be useful in user written SAS programs to further analyze these data. The Component Dictionary Data Set The component dictionary data set is always in WORK.DICT. It has two variables, CMPONENT and ID. Figure 5.8 shows a printout of the data set for a simple m/m/1 model. Figure 5.8. An M/M/1 Example Dictionary Data Set The value of the CMPONENT variable will be whatever label is associated with the component. Note that only elementary components will appear in this data set. SAMPLE PATHS 67 Component State Sample Paths The component state information is saved in the data set WORK.SAMPLE. For each change of state in the simulation a new observation is added. This data set contains three variables: TIMENOW, the simulation time when the state change occurred; ID, the id of the component that is changing state; and STATE, the value of the new state. Figure 5.9 shows an example. Notice that the ID corresponds to either the server or the queue as given in the dictionary in Figure 5.8. Figure 5.9. An M/M/1 Component State Sample Path Data Set Sample path data are not saved to WORK.SAMPLE until the ‘‘Collect Data’’ check box in the Simulation Control Panel (see Figure 1.6) is selected. Transaction Sample Paths The state information on the components in a transaction’s sample path can be saved to a data set in a StripChart. Figure 2.16 shows the ‘‘Collect Data’’ check box, which must be set to start saving data on the transactions arriving to that StripChart. These data are placed in a data set named for the StripChart’s id. If the StripChart’s id is 9, then the data set is named 9. CHAPTER 5. SAVING AND RESTORING 68 Figure 5.10. An M/M/1 Transaction State Sample Path Data Set Chapter 6 Analyzing the Sample Path The QSIM application provides some built-in analysis capabilities. You can obtain sample means, variance estimates, sample histograms, and other simple statistics on several measures of performance using the Probe and StripChart components. Future releases of the QSIM application will provide more built-in analysis capabilities. An additional feature is the ability to accumulate the sample paths in SAS data sets as discussed in Chapter 5, ‘‘Saving and Restoring.’’ With these data in data sets you can write your own programs to do more sophisticated analyses. When calculating statistics, QSIM uses the following measures of system performance: number in a queue time in a queue number of multiple-servers busy server utilization time in service and time in the system To illustrate some of the analysis features, this chapter uses the multiple-server single-input queueing model shown in Figure 6.1. 69 CHAPTER 6. ANALYZING THE SAMPLE PATH 70 Figure 6.1. A Single Queue 3-Server Model The inter-arrival time distribution is E (:33) and the service time distribution for each server is E (1). Transactions queue in a FIFO discipline and go to the first available server. This corresponds to the type of queueing that you encounter at check-in in many airports. Running a Simulation Suppose that you have built the model in Figure 6.1. There are several ways to start, stop and validate a simulation such as this. The toolbar has command buttons that send a start message to each of the components in the model. Alternatively, the state button can be used to logically associate the start message with the cursor. Then, selecting any component would start that component. So, you could start each of the samplers Sampler. without starting other components by pressing individually on each Another way to control the simulation is with the Simulation Control Panel as shown in Figure 6.2. RUNNING A SIMULATION Figure 6.2. 71 The Simulation Control Panel Notice the ‘‘Start’’ button at the bottom of the control panel. When pressed, it also starts each of the components in the model. Alternatively, you can select a component from the ‘‘Components’’ list box and start it by pressing the ‘‘Start’’ button to the right of the Components list box. Each of the buttons to the right of the components list box sends that message to the selected component. The ‘‘Reset’’ button at the bottom of the control panel resets all the components. But first it stops the simulation, resets the simulation clock, and removes all pending actions. This means, for example, that all queues are emptied and transactions in service are discarded. One effective way to validate a model is by animating the simulation and observing the behavior. The ‘‘Animate’’ check box on the Simulation Control Panel will turn animation on. In addition, you can add Triggers and StringHolders to display and print state information to help you with model validation. 72 CHAPTER 6. ANALYZING THE SAMPLE PATH Statistics on Component State The queues and servers are two of the component types for which performance measures are typically of interest. For queues you want to know the distribution on queue length, and for servers you want to know about server utilization. Other performance measures that may be of interest are time in the queue and time in service. These are discussed in the section ‘‘Statistics on Transaction State’’ later in this chapter. Queue Length You can obtain statistics on queue length and server utilization using the Probe component. On the Figure 6.3 control panel you can select the queue you want to monitor and the state you want to monitor using the list boxes. Figure 6.3. Probe Control Panel The component collects the sample mean, the sample throughput, the maximum, the minimum, and the number in the sample. These are displayed in the Probe Control panel and at the bottom of the Probe component. So, if you select to monitor a queue and you select to monitor the queue size, then the sample mean is the sample mean queue length. STATISTICS ON COMPONENT STATE Figure 6.4. 73 Probe Statistics on the FIFO Queue length The Probe can display more detailed statistics on queue length via SAS data sets. The Simulation Control panel in Figure 6.2 shows a ‘‘Collect Data’’ check box. If this is selected, then data on all component state changes are routed to the SAS data set named WORK.SAMPLE. If sample data have been collected for a time, then you can select a component and press the ‘‘Analyze’’ button to obtain some simple statistics. For example, you display data on the queue length on the single-queue multiple-server model in Figure 6.1 by selecting ‘‘FIFOQueue’’ in the Simulation Control panel and then pressing ‘‘Analyze.’’ Figure 6.5. Statistics on Queue Length 74 CHAPTER 6. ANALYZING THE SAMPLE PATH This generates the report shown in Figure 6.5 in the SAS Output Window. Figure 6.5 shows that the sample mean queue length is approximately 46.12 and that the sample variance is approximately 2.16. The ‘‘Analyze’’ button also opens a graphics window with the histogram on the queue length as in Figure 6.6. This shows the sample distribution of queue length for the complete sample path that was collected from the time the ‘‘Collect Data’’ check box is selected until the time the analyze button is pressed. Figure 6.6. Queue Length Histogram It is important to note that the observations in the sample path are not independent. There can be a significant amount of autocorrelation in the observations of queue length. Server Utilization The utilization of a server is another measure of system performance that is often of interest. Estimates on the probabality that a server is busy is one statistic for measuring utilization. If after collecting data using the ‘‘Collect Data’’ check box on the Simulation Control panel, you select a server from the components list box and press the ‘‘Analyze’’ button, you get a printout similar to that shown in Figure 6.7. STATISTICS ON COMPONENT STATE Figure 6.7. 75 Statistics on Server Utilization The mean shown is approximately .7214. This is an estimate of the probability that the server is busy. Figure 6.8. Server Utilization The pie chart in Figure 6.8 shows percent of time that the server is busy. 76 CHAPTER 6. ANALYZING THE SAMPLE PATH Data Step Program for Extracting Information When you press the ‘‘Analyze’’ button, the QSIM application executes SAS code to extract and summarize the sample path saved in the WORK.SAMPLE data set. You too can write a SAS program to extract and analyze these data. For example, suppose you want to subset the data on the time the queue is in each state. The following data step subsets WORK.SAMPLE with those observations that have state information on queue with ID 5: data subset; set sample; if id=5; keep timenow number time; label number="Queue Length"; time = ( timenow - lag(timenow) ); number = lag(state); The resulting data set has three variables: TIMENOW for the time that the state changes; NUMBER for the number in the queue; and TIME for the length of time in that state. The following SAS code executes the UNIVARIATE procedure to produce summary statistics and the GCHART procedure to produce a histogram as shown in Figure 6.6. proc univariate data=subset; weight time; var number; proc gchart; label = ‘‘Time in Queue’’; vbar number / subvar=time discrete; A similar SAS program subsets the data on server utilization and produces the output in Figure 6.8 and Figure 6.7. data subset; set sample; if id=4; keep timenow number time; label number="Utilization"; time = ( timenow - lag(timenow) ); number = lag(state); proc univariate data=subset; weight time; var busy; proc gchart; pie busy / sumvar=time discrete percent=outside; STATISTICS ON TRANSACTION STATE 77 Statistics on Transaction State As a transaction goes through the simulation it maintains a history of time spent at various components. When a transaction arrives at a StripChart, it displays its age on the vertical axis of the chart. The StripChart can also direct the transaction to store a record of its history in a SAS data set. The name of the data set is derived from the ID of the StripChart. If the StripChart has ID=14, then the data set is WORK. 14. Since the number of entries in the history of transactions can differ, the history information is stored sequentially in the data set. Figure 5.10 shows one such data set. Time in the System The StripChart component accumulates the sample mean age or system time of the transactions arriving to it. The Stripchart Control panel has a check box which when set, records the transaction histories in the SAS data set. Figure 2.16 shows such a control panel. If a simulation has been executing and the ‘‘Collect Data’’ check box has been set, then you can press the ‘‘Analyze’’ button to calculate statistics on the sample. Figure 6.9. A Histogram Showing Time in the Queue Univariate statistics are calculated and histograms are printed for each of the components that a transaction has visited before arriving at the StripChart. Figure 6.9 shows one such histogram on the time in FIFO queue 4 for all the transactions that arrived at the StripChart. Univariate statistics and a histogram on system time and for time in any other component that was visited by a transaction that arrives to the StripChart is also printed. 78 CHAPTER 6. ANALYZING THE SAMPLE PATH Data Step Program for Extracting Information The transaction’s sample path or history that is saved in a SAS data set is somewhat more complicated than that for components. This is because a transaction can be in service in multiple servers at a single time. A typical fragment of one is shown in Figure 5.10. As a result, a SAS program to take this data set and organize it so that there is a variable for each component and an observation for each transaction is somewhat more complex than the datastep that serves a similar purpose for components as shown above in the section ‘‘Data Step Program for Extracting Information.’’ The following program accomplishes this for transactions. It assumes that there was a StripChart with an ID of 14 that collected data into the corresponding data set named 14. data chart; retain l 0 no 0 b 0; keep no t id; set _14; if id=0 then do; t = b; if b>0 then output; no = no + 1; b=0; end; else if state=0 then do; t=timenow-l; b = b + t; output; end; else if state=1 then do; l=timenow; end; run; proc sort; by no id; run; data chart1; set chart; retain time; if id=lag(id) then time = t + lag(t); else do; time = t; output; end; by no; run; proc transpose data=chart1 out=chart2; by no; id id; var time; run; data chart2; set chart2; drop no _name_; label _0="Time in the System"; STATISTICS ON TRANSACTION STATE 79 run; Figure 6.10 shows some of the observations in a CHART2 data set, from the preceding program, on data collected by the StripChart in the single-queue multiple-server model in Figure 6.1. Figure 6.10. A Portion of the CHART2 Data Set Each observation in the data set corresponds to a transaction that has traveled through the network. The variable 0 has the total system time for the transactions; the variable 9 has the time the transactions spent in the component with ID equal to 9; variable 11 has the time the transactions spent in the component with ID equal to 11; and so forth. With these data you can construct the sample path of each transaction that eventually arrived at StripChart 14. 80 CHAPTER 6. ANALYZING THE SAMPLE PATH Chapter 7 Selected Examples This chapter shows examples of several common modeling structures. These models address such subjects as queues with reneging, priority queues, batch arrivals, and servers that break down. The examples are meant only to show how you would model these typical situations using the QSIM application. They are not meant to show how you would analyze these models to evaluate them or identify optimal parameterizations. Queues with Reneging When a customer arrives at a facility that includes queues and service, they may choose to enter a queue, if there is room, or leave the facility. Once in a queue, they may choose to leave it if they have waited ‘‘too’’ long. Not entering a queue and leaving a queue are two types of reneging. This example shows how to model some typical queues with reneging. The model in Figure 6.1 shows a single queue for three servers. It models the m/m/c/K system where c = 3 and K = 50. This system has Poisson arrivals to a single queue with a capacity of K transactions for service by c parallel servers. Another way to model this system is with the Multiple-Server, as in Figure 7.1. Figure 7.1. An m/m/c/K Model 81 CHAPTER 7. SELECTED EXAMPLES 82 This model is often compared to one with c parallel queues and servers, as in Figure 7.2. Figure 7.2. A 3-Queue 3-Server Model In this model, the switch component directs the transaction to one of the three queues. In this case, the transaction is routed to the shortest length queue. This is accomplished with two formulas tied to the switch. These are shown in Figure 2.11. Another variant on the parallel server models in Figure 7.1 and Figure 7.2 has customers entering a queue and, if they have waited for ‘‘too long,’’ deciding to switch to another queue. This decision making and queue switching policy is more complex but can be modeled as in Figure 7.3. Figure 7.3. A 2-Queue 2-Server Model with Reneging QUEUES WITH RENEGING 83 In this model, upon arrival, the transaction is assigned an attribute named ‘‘priority,’’ whose value is the current simulation time. This is done in the Modifier component labeled ‘‘priority.’’ Next, the transaction goes to a Switch which compares the two queues and sends the transaction down the path leading to the shorter of the two queues. Next, the transaction encounters a trigger which schedules the transaction to balk when it has spent a given amount of time in the queue. The default is a random variable with exponential with mean 1. When a transaction balks, it goes into another Switch which checks whether the other queue is shorter. If it is, the transaction is routed to the Connector ‘‘a’’ and goes to the end of the other queue. Otherwise the transaction goes back into the queue it just came out of at the same location after scheduling, in the Trigger, another, future check. CHAPTER 7. SELECTED EXAMPLES 84 Scanning a Queue In the preceding example, transactions balked from a queue at a time scheduled, by a trigger, before the transaction entered the queue. Similar behavior can be modeled by periodically scanning all the transactions in a queue and balking those transactions that meet some criteria that may be based on the state of the system. Figure 7.4. Scanning a Queue Figure 7.4 shows a simple model where the ‘‘Scanning Process’’ controls the periodic searching of the queue in the main process. The sampler in the ‘‘Scanning Process’’ has deterministic, inter-arrival time distribution so that at fixed times a transaction gets a formula and goes to the trigger that starts the scan of the queue. The formula has where the transaction attribute is ‘‘random.’’ Since the trigger is set to the queue in the main process and the ‘‘filter’’ trigger message, when the transaction arrives at the trigger the queue is scanned and each transaction whose value of the ‘‘random’’ attribute is less than .8 is balked. PRIORITY QUEUES 85 Priority Queues Many types of models require that multiple classes of transactions be served by a single server. For example, two different types of customers arrive at an auto repair shop. One type needs only minor repairs, the other type needs more major work. If one class has priority on getting service, then a priority queue is the appropriate modeling choice. Figure ?? shows one such model having two classes. Figure 7.5. A Priority Queue Example with Two Transaction Classes The two classes of transactions arrive according to independent Poisson processes as represented by the two Samplers. Transactions travel to Modifiers that set the priority to be either a 1 or a 2. They then enter a Priority Queue with the priority level determining their position in the queue; the higher priority transactions are serviced before the lower priority transactions. When the transactions finish service, they enter a Switch that directs them to one of two StripCharts as a function of priority class. The model in Figure ?? assumes that if a class 1 transaction is in service when a class 2 transaction arrives, the class 1 transaction completes service before the class 2 transaction starts service ahead of any other class 1 transactions in the queue. Figure 7.6 shows how you would modify the model if you wanted to preempt a class 1 transaction that was in service when a class 2 arrived. CHAPTER 7. SELECTED EXAMPLES 86 Figure 7.6. A Priority Queue Example with Two Transaction Classes and Preemption For this preemption, you would store the class of the transaction currently in service in a number holder. This storage is done by the trigger just below the number holder. Then, when a class 2 transaction arrives, it causes a check of the class of the transaction in service. If it is class 1 then it is preempted. Notice that any preempted class 1 transactions are routed back into the queue. BATCH ARRIVALS I 87 Batch Arrivals I The model in Figure 7.7 shows one way to represent batch arrivals. The compound component labeled ‘‘Arrival Process’’ has a sampler with the batch inter-arrival time distribution set. When a transaction arrives in this process, it traverses to the Trigger labeled ‘‘Reset’’ which resets the Sampler labeled ‘‘Batch Source.’’ Figure 7.7. Batch Arrivals The transaction then goes to the Trigger labeled ‘‘Start’’ which starts the ‘‘Batch Source’’ sampler. The ‘‘Batch Source’’ sampler has a deterministic inter-arrival time distribution with parameter 0 and capacity c, the batch size. Because of this inter-arrival time distribution, when the ‘‘Batch Source’’ sampler is started by the ‘‘Start’’ trigger the ‘‘Batch Source’’ generates c transactions at the current simulation time and sends them to the queue. This is the batch arrival of transactions. Notice the Probe labeled ‘‘Number in the Queue.’’ The periodic discrete jumps in queue length show a batch arrival. CHAPTER 7. SELECTED EXAMPLES 88 Batch Arrivals II Another variant on batch arrivals has batch size as a random variable. A simple extension to the previous model provides this alternative. Figure 7.8. Batch Arrivals Figure 7.8 shows two components added to the model of Figure 7.7: a Modifier labeled ‘‘capacity’’ and a Trigger labeled ‘‘Set Capacity.’’ The ‘‘capacity’’ modifier samples a uniform random variable on the interval [0; 30] and sets it in the attribute named ‘‘capacity’’ on the transaction in the ‘‘Arrival Process.’’ The ‘‘Set Capacity’’ trigger then sets the capacity of the ‘‘Batch Source’’ sampler to that value. Then, the ‘‘Start’’ trigger starts the ‘‘Batch Source’’ arrivals as before. Compare the Probe labeled ‘‘Number in the Queue’’ in this model to the previous example. Here, in addition to the timing of the discrete jumps in queue length, the size of the discrete jumps in queue length is random. NONHOMOGENEOUS POISSON PROCESSES 89 Nonhomogeneous Poisson Processes In many situations, the arrival rate or service rate is determined by a Poisson process whose parameter varies as a function of time. For example, if the arrival rate to a fast food restaurant varies with the time of day and increases to a local maximum during meal times, you can sample from a nonhomogeneous Poisson process. In QSIM there are some limitations to the shape of the rate function that are allowed. This function must be cyclical and bounded. The software takes the absolute value of the rate function to guarantee that it is nonnegative. In this example, shown in Figure 7.9, the model has deterministic arrival rate and nonhomogeneous Poisson service times. Figure 7.9. Nonhomogeneous Poisson Service The service rate is 9 + cos(0:001t), where t is the value of the simulation time when a sample is taken. This rate function is specified via the control panel for the random variable, as shown in Figure 7.10. CHAPTER 7. SELECTED EXAMPLES 90 Figure 7.10. Nonhomogeneous Poisson Control Panel In this window you can set two parameters of the process: the rate function and the maximum value that the rate function can take. The rate function is specified as a QSIM formula. When you press the ‘‘Rate Function’’ button, a Formula Manager window opens and allows you to specify the function. Figure 7.11. Rate Function Figure 7.11 shows the function used in this example. The maximum is needed by the algorithm that does the sampling. If this is not the correct maximum or the function specified is not cyclical, then the sample is not from the desired distribution. When the transactions from this simple model are displayed in the StripChart as in Figure 7.9, you can see the impact of the cyclical rate function on the transaction time in the system. MARKOV-MODULATED POISSON ARRIVALS 91 Markov-modulated Poisson Arrivals A Markov-modulated Poisson Process (MMPP) is a Poisson process that has its parameter controlled by a Markov process. These arrival processes are typical in communications modeling where time-varying arrival rates capture some of the important correlations between inter-arrival times. This example has a Markovmodulated Poisson process that serves to control the arrival process to a single queue, single server queueing model. Figure 7.12. Markov-Modulated Poisson Arrivals Figure 7.12 shows one way to model an MMPP. The process labeled ‘‘Markovmodulated Poisson Process’’ samples from an MMPP distribution and sets the value of the parameter lambda, the mean inter-arrival time for an exponential random variable in the Sampler labeled ‘‘MMPP Arrivals.’’ In the upper process, lambda is given the values 10, .1, and 1 based on the state of a Markov chain. The state state is changed in the Modifier components labeled ‘‘state.’’ Each has a conditional component driven by an observation of a uniform random variable. So, for a given state, the state is changed to the next state and the value of lambda is chosen for the ‘‘MMPP Arrivals’’ Sampler. The selected lambda is set in the ‘‘MMPP Arrivals’’ Sampler, and the process is delayed for an exponential amount of time whose parameter is state 92 CHAPTER 7. SELECTED EXAMPLES dependent. The transaction then goes to a switch that routes based on the state for the next state change. STATE-DEPENDENT SERVICE 93 State-Dependent Service In many situations, the rate of service depends on the type of service being performed. For example, the time it takes for a teller to service a customer in a bank depends on the type of service requested. State-dependent service distributions are modeled similarly to the Markov-modulated Poisson arrivals. Consider the example shown in Figure ??, in which there are multiple classes of transactions to a single queue. Figure 7.13. State Dependent Service Figure 7.13 shows this model with the addition of a Modifier to set the exponential mean service time. When the transaction leaves the queue to begin service, it passes through a Trigger that sets the parameter for the service time as a function of the class of transaction that is to receive the service. In addition to the parameter, other models can change the shape of the service distribution. CHAPTER 7. SELECTED EXAMPLES 94 Servers that Break Down I You may have a need to model a server that periodically breaks down and is repaired. For example, a machine on an assembly line may periodically fail. Figure 7.14 shows such a model. The component labeled ‘‘Server’’ is the server that experiences down periods when it cannot service transactions. Figure 7.14. A Server that Breaks Down The process in the compound component labeled ‘‘Break Down Loop’’ models the breakdown behavior. The transaction pool has a capacity of 1 so that, when it is started, one transaction is generated that cycles through the breakdown loop for the rest of the simulation. This loop has two delays: ‘‘Delay 1’’ models the time when the ‘‘Server’’ is in operation; ‘‘Delay 2’’ models the time when the ‘‘Server’’ is broken. The two triggers, labeled ‘‘Down’’ and ‘‘Up,’’ stop and start the ‘‘Server.’’ SERVERS THAT BREAK DOWN II 95 Servers that Break Down II Another variant of the server breakdown model concerns what happens to the transaction that is in service when the breakdown occurs. In the model in Figure 7.14, even though the ‘‘Server’’ is stopped when it breaks down, the transaction in service completes service. The model in Figure 7.15 adds the preemption of the transaction in service, which is routed back into the queue. Figure 7.15. A Server that Breaks Down By default, the transaction is placed at the end of the FIFO queue. So, if there were other transactions waiting for service, the preempted transaction would be behind them. Another variant on this model would place the preempted transaction into the front of the queue even though the queue was a FIFO for nonpreempted transactions. This variant could be accomplished using a priority queue where the transaction priority is the simulation time at the time the transaction arrived to the queue. See the preceding example on priority queues. CHAPTER 7. SELECTED EXAMPLES 96 Batch Service I Suppose that you want to service transactions in a batch where you start service simultaneously on all the items in the batch but the individual service times are independent and identically distributed. This might occur in a drying process, where you have arrivals to a drying machine determined by some arrival process. When there are enough items to fill the batch, the baking of all the items in the batch begins. However, as each item drys it is removed individually from the drying machine. Figure 7.16. Batch Service The model in Figure 7.16 accomplishes this batch service. In this model the multipleserver is set to the batch size and the ‘‘Server On’’ compound component turns the server on if it is empty and there are 10 or more transactions in the FIFOQueue. The Trigger labeled ‘‘Server Off’’ turns the server off when each transaction leaves service. When a server is off all transactions currently in service complete normally but the server will not send out messages for additional transactions. As a result service on all transactions in process will complete but additional arrivals to the system will queue until there are at least 10 and the server is empty. Notice the Probe labeled ‘‘Server Utilization.’’ It shows the number of transactions in service over time. It demonstrates graphically the batch service and independent nature of the service completions. BATCH SERVICE II 97 Batch Service II Some situations demand a somewhat different approach to batch service; for example, consider a washing machine. The machine is started when enough items have arrived for service to complete the batch. However, unlike the preceding example, all the items in the batch finish at the same time. The model in Figure 7.17 accomplishes this. Figure 7.17. Batch Service In this model the service distribution in the Multiple-Server labeled ‘‘Batch Server’’ is deterministic with a large parameter value for example, D. The Server labeled ‘‘Delay’’ provides the actual sample of the service time for the entire batch. And the ‘‘Batch Server’’ is turned on before the ‘‘Delay’’ and off after service for the batch is complete. Since turning the server off does not preempt transactions currently in service, there is another Trigger labeled ‘‘Preempt’’ that preempts all the transactions in the ‘‘Batch Server.’’ Since the transactions are preempted, they leave the server via the balk node. Notice the Probe labeled ‘‘Server Utilization.’’ It shows the number of transactions in service over time. It demonstrates graphically the batch service and dependent nature of the service completions. Note that, because of the modeling technique used here the service time distribution is the minimum of D and X , an exponential random variable. If you want the service time distribution to be X , then use caution in choosing D so that the probability that X > D is very small and highly unlikely to occur within the number of samples planned. CHAPTER 7. SELECTED EXAMPLES 98 Batch Service III Another variant on batch service has the transactions accumulating into a batch according to the arrival process and has service scheduled as soon as the first transaction arrives. Service on the entire batch completes at once. Figure 7.18. Batch Service Figure 7.18 shows a model of this batch service. When the first transaction arrives to the Server labeled ‘‘Delay’’ it initiates the definition of a batch. Any other transactions that arrive to that server are disgarded through the balk node. When the delay is complete the Trigger labeled ‘‘Preempt Service’’ terminates service on all the transactions in the Multiple-Server labeled ‘‘Batch Server.’’ As the transactions arrive they accumulate in the Multiple-Server for batch service. This server has a deterministic service distribution with a large parameter value for example, D. Note that because of the modeling technique used here, the service time distribution is the minimum of D and X , an exponential random variable. If you want the service time distribution to be X , then use caution in choosing D so that the probability that X > D is very small and highly unlikely to occur within the number of samples planned. Notice the Probe labeled ‘‘Server Utilization.’’ It shows the number of transactions in service over time. It demonstrates graphically the accumulation of the batch and the dependent nature of the service completions. ASSEMBLY 99 Assembly In a model of manufacturing systems there is often assembly of subunits into larger units. The assembly cannot occur unless all of the subunit pieces are available. An important component for modeling this behavior is the Adder. Figure 7.19. Assembly Unit Figure 7.19 shows the assembly of two subunits into a larger unit. Each subunit line produces components as modeled by servers 1 and 2. These subunits queue in the buffers at the end of the subunit assembly lines. When the multiple-server is free it requests a transaction from the Adder. The Adder requests one transaction from each of the lines going into it. If there is a transaction available from each of these lines, then it requests one. When all the transactions have arrived at the Adder, it generates a new transaction, which is sent down the arc to the multiple-server. CHAPTER 7. SELECTED EXAMPLES 100 Servers as Resources I There are instances in which where the system needs to schedule concurrent service from multiple servers on a single transaction. In these situations you can think of servers as resources that are being utilized by the transactions. For example, in an auto repair facility, several mechanics (modeled as servers) can work on a single car (the transaction) at a time. The Splitter is useful for treating servers as resources and capturing concurrent use of the resources. Figure 7.20. Servers as Resources Figure 7.20 shows a simple model with arrivals from two sources, each sending the transactions into a queue. If the two servers are free and there is a transaction in FIFO 1, then the first transaction inserted into the queue will flow to both the servers and service will start in each. The service times in each of these is independent (unless you construct and use a service time distribution that destroys this independence). When Server 2 becomes free, it requests a transaction. If Server 1 is busy, then the request can only be honored by a transaction in the FIFO 2 queue. When Server 1 becomes free, it requests a transaction that can only be honored if Server 2 is free and there is a transaction in FIFO 1. SERVERS AS RESOURCES II 101 Servers as Resources II In the preceding example, the resources (servers) performed service independently on a transaction. However, there are situations where the resource may be used in a more controlled way. Suppose there are two parallel lines that each require the use of a shared resource (a crane, for example). Figure 7.21. Servers as Resources Figure 7.21 shows such a model. As in the last example, the Splitter is used to capture the shared use of the resources by a transaction. In addition, there is a Trigger after each of the servers in the parallel lines. These triggers release the transaction from service in any other servers. So the time the transaction uses the Crane is the minimum of the time scheduled for Crane use and the line service time. In particular, if the service time in Server 1 is X and the service time specified for the Crane is Y , then the service time that the transaction actually receives in the Crane is min(X; Y ). This occurs because either the transaction finishes with the Crane before it is done with service in Server 1 (or Server 2) or it finishes with service in Server 1 (or Server 2) before the Crane service is completed. In this case, Trigger 1 (or Trigger 2) sends the ‘‘RemoveFromServers’’ messages (see Figure 2.27), which removes that transaction from any servers in which it may be receiving service. In this case, the transaction can be explicitly removed from service by the Crane. CHAPTER 7. SELECTED EXAMPLES 102 Special Routing There are other ways that independent streams can share resources. One is illustrated in Figure 7.22. Figure 7.22. Special Routing Here the Modifiers labeled ‘‘routeToId’’ set the attribute ‘‘routeToId’’ to the id of ‘‘FIFO 1’’ or ‘‘FIFO 2.’’ When the transaction finishes with the service of the ‘‘Crane’’ and traverses to the Trigger labeled ‘‘RouteToId,’’ it is routed to the component whose id is in its attribute ‘‘routeToId.’’ This is another way that transactions can be routed through the network. References Bratley, P., Fox, B.L. and Schrage, L.E. (1983), A Guide to Simulation, New York: Springer-Verlag. Fischer, W. and Meier-Hellstern K. (1992), “The Markov-modulated Poisson process (MMPP) cookbook,” Performance Evaluation, 18, 149-171. Fishman, G.S. (1978), Principles of Discrete Event Simulation, New York: John Wiley & Sons. Gross D., and Harris C.M. (1985), Fundamentals of Queueing Theory, Second Edition, New York: John Wiley & Sons. Kleijnen, J.P.C. (1987), Statistical Tools for Simulation Practitioners, New York: Marcel Dekker, Inc. Kleijnen, J.P.C. (1974), Statistical Techniques in Simulation - Part I, New York: Marcel Dekker, Inc. Kleijnen, J.P.C. (1975), Statistical Techniques in Simulation - Part II, New York: Marcel Dekker, Inc. Law, A.M., and Kelton, W.E. (1982), Simulation Modeling and Analysis, New York: McGraw-Hill Book Company. Rubinstein R.Y. (1981), Simulation and the Monte Carlo Method, New York: John Wiley & Sons. 103 104 CHAPTER 7. SELECTED EXAMPLES Index A D Adder, 26, 38, 99 Analyze, 73--74, 77 analyze data, 31 animation, 38 arcs, 6, 36 segmented, 38 are you busy message, 12 arrivals batch, 87--88 attribues, 42 attributes, 21--22, 40 Balk node, 15, 24 Bar Chart, 33--35 buffer, 17 data collection, 30, 39 DataSource Control Window, 59 DataSource Distribution, 59 Deterministic Distribution, 56 distribution, 19, 55 DataSource, 59 Deterministic, 56 Erlang, 56 Exponential, 56 Formula, 58 Gamma, 56 IUniform, 56 Markov-modulated Poisson, 91 Mixture, 58 Nonhomogeneous Poisson, 56, 89 Uniform, 56 C E B check box Collect Data, 73--74, 77 Collect Data, 73--74, 77 component dictionary data set, 66 component id, 46, 66 component state sample path, 67, 72 compound components, 47 controlling exposure, 49 editing, 52 popup menu, 48 connecting components, 36 Connector, 35, 83, 102 control panel, 7 Bar, 35 Compound Component, 50 DataSource, 59 Exponential Control Panel, 57 FIFO Queue, 17 MModifier, 23 Modifier, 22 MServer, 15 MTrigger, 20 NumberHolder, 27 Probe, 32, 55, 72 Sampler, 13 Simulation, 70, 73--74 StripChart, 30 Switch, 24 Trigger, 19, 28 elementary components, 11 Erlang Distribution, 56 Exponential Distribution, 56--57 Expose/Hide Details, 12 F FIFO Queue, 16 Formula Distribution, 58 Formula Manager Window, 24, 42, 90 formulas, 42 G Gamma Distribution, 56 graphs, 65 H histogram queue length, 74 time in queue, 77 I images, 39 IUniform Distribution, 56 L Label, 35 LIFO Queue, 16 Load Templates Window, 65 105 logic Adder, 26 Bar, 35 MModifier, 23 Modifier, 22 MTrigger, 21 NumberHolder, 28 Probe, 33 Queue components, 17 Router, 25 Server components, 15 Source components, 13 Splitter, 26 StringHolder, 28 StripChart, 31 Switch, 25 Trigger, 19 Logic Components, 18 M M/M/1 Queue, 8 Markov-modulated Poisson Process, 91 MModifier, 22 model, 62 assembly, 99 batch arrivals, 87--88 batch service, 96--98 queue with reneging, 81, 84 routing, 102 scanning a queue, 84 servers as resources, 100--102 service break down, 94--95 state-dependent service, 93 Modifier, 21, 40, 42, 83 MServer, 14, 55 MTrigger, 20 Disassemble Components, 48 Duplicate, 36 Edit, 48, 52 Expose/Hide Details, 6, 12, 48 Grab, 6 on arcs, 37 Options, 48 Select Components..., 50 Start, 6 Stop, 6 Tools, 6 Port, 35, 49 Priority Queue, 16, 83, 85 Probe, 29, 31, 55, 69, 72 Probe Control Panel, 72 pull-down menu selections Graph..., 65 Model..., 62 Open..., 62 State..., 62 pulldown menu selections Save As, 61 push button Analyze, 73--74, 77 Q query message, 12 queue priority, 83 reneging, 81, 84 scanning a queue, 84 Queue Components, 16 queue length statistics, 72 R random variation, 55 Router, 23, 42 N Nonhomogeneous Poisson Distribution, 56 Nonhomogeneous Poisson Process, 89 Nonhomogeneous Possion Parameter Window, 89 number in a queue, 69 NumberHolder, 26 NumberHolder Control Panel, 27 P pie chart server utilization, 75 popup menu, 6 Bar Chart, 33 popup menu selections Add Bar, 33 Arc, 6 Assemble Components, 48 Attributes, 57 Control Panel..., 6, 12 Create Template..., 53 S sample path, 66, 69 Sampler, 6, 12, 38, 55, 70 batch arrivals, 87--88 SAS data set, 30, 39, 73--74, 76, 78 SAS Graph, 65 Save Model Window, 62 Save State Window, 62 Save Templates Window, 64 saving information, 61 component dictionary data set, 66 component state sample path, 67 graphs, 65 model, 62 sample path, 66 state, 62 template, 63 transaction state sample path, 67 Server, 55 as resource, 100--102 batch, 96--98 break down, 94--95 state-dependent service, 93 Server Components, 14 server utilization, 69 server utilization statistics, 74 Simulation Control Panel, 7, 70, 73--74 Simulation Window, 3 slider changeing the slider range, 57 Source Components, 12 Splitter, 26, 100--101 start the simulation, 70 state, 62, 72 state change, 12, 19--20, 23 statistics, 31, 72 queue length, 72 server utilization, 74 time in the system, 77 stop the simulation, 70 StringHolder, 26 StripChart, 29 Stripchart, 29 StripChart, 67, 69, 77 Switch, 23, 42, 44, 83 system performance queue length, 72 server utilization, 74 time in the system, 77 T template, 63 Template Name Window, 53 templates, 52 time in a queue, 69 time in service, 69 time in system, 69 time in the system statistics, 77 toolbar, 4 command buttons, 4 customizing, 64 Formula Manager, 43 state buttons, 4 Toolbar Manager Window, 63 transaction attributes, 21--22, 40 generation, 13 history, 39, 77 timing of arrivals, 41 transaction arrival, 12 Transaction Pool, 12, 38 transaction state sample path, 67 transactions, 38 saving state information, 67 Trigger, 19, 55 delayed trigger event, 19 Trigger Control Pane, 27 trigger message, 12, 40 U Uniform Distribution, 56 User Interface, 2 W window Compound Node Editor, 52 DataSource Control, 59 Formula Manager, 24, 42, 58, 90 Load Templates, 65 Nonhomogeneous Possion Parameter, 89 NumberHolder Control Panel, 27 Probe Control Panel, 72 Save Graph, 65 Save Model, 62 Save State, 62 Save Templates, 64 Simulation Control Panel, 7, 70, 73--74 Simulation Manager, 3 Slider Attributes, 57 Template Name, 53 Toolbar Manager, 63 Trigger Control Panel, 27 ">
Download
Advertisement
Key features
Graphical user interface
Hierarchical model building
Component reuse
Discrete event simulation
Queueing system analysis
Frequently asked questions
QSIM is a SAS application for modeling and analyzing queueing systems using discrete event simulation.
You can build models of a wide variety of scenarios that might be encountered in network and telecommunications systems, manufacturing systems, and transportation networks.
You invoke the application by typing QSIM on a command line.