SAS Simulation Studio User's Guide
Below you will find brief information for Simulation Studio 1.4. This guide helps you model and analyze systems using discrete-event simulation. Understand the features, execution, and analysis tools necessary for both novice and advanced simulation users. Customize your models to meet your specific simulation needs.
Advertisement
Advertisement
® SAS Simulation Studio 1.4 User’s Guide The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2009. SAS® Simulation Studio 1.4: User’s Guide. Cary, NC: SAS Institute Inc. SAS® Simulation Studio 1.4: User’s Guide Copyright © 2009, SAS Institute Inc., Cary, NC, USA All rights reserved. Produced in the United States of America. For a hard-copy book: No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, or otherwise, without the prior written permission of the publisher, SAS Institute Inc. For a Web download or e-book: Your use of this publication shall be governed by the terms established by the vendor at the time you acquire this publication. U.S. Government Restricted Rights Notice: Use, duplication, or disclosure of this software and related documentation by the U.S. government is subject to the Agreement with SAS Institute and the restrictions set forth in FAR 52.227-19, Commercial Computer Software-Restricted Rights (June 1987). SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513. 1st electronic book, May 2009 SAS® Publishing provides a complete selection of books and electronic products to help customers use SAS software to its fullest potential. For more information about our e-books, e-learning products, CDs, and hard-copy books, visit the SAS Publishing Web site at support.sas.com/publishing or call 1-800-727-3228. SAS® and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Other brand and product names are registered trademarks or trademarks of their respective companies. Contents Chapter 1. Overview of SAS Simulation Studio . . . . . . . . . . . . . . . 1 Chapter 2. Introduction to SAS Simulation Studio . . . . . . . . . . . . . . 15 Chapter 3. Simulation Models . . . . . . . . . . . . . . . . . . . . . 25 Chapter 4. Experiments . . . . . . . . . . . . . . . . . . . . . . . . 33 Chapter 5. Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Chapter 6. Compound Blocks . . . . . . . . . . . . . . . . . . . . . . 51 Chapter 7. Entities . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Chapter 8. Log and Trace . . . . . . . . . . . . . . . . . . . . . . . 61 Chapter 9. Block Templates . . . . . . . . . . . . . . . . . . . . . . 65 Chapter 10. Data Collection, Analysis, and Reporting . . . . . . . . . . . . . 69 Chapter 11. Batch Execution . . . . . . . . . . . . . . . . . . . . . . 73 Appendix A. Basic Template . . . . . . . . . . . . . . . . . . . . . . 75 Appendix B. Random Variation in a Model . . . . . . . . . . . . . . . . . 113 Appendix C. Design of Experiments . . . . . . . . . . . . . . . . . . . 125 Appendix D. Input Analysis . . . . . . . . . . . . . . . . . . . . . . 135 Appendix E. Examples of Simulation Studio Models . . . . . . . . . . . . . 139 iv Chapter 1 Overview of SAS Simulation Studio Contents What Is Simulation? . . . . . . . What Is SAS Simulation Studio? . A Simple M/M/1 Queueing Model Running the Model . . . . . Collecting Statistics . . . . Repair Shop Example . . . . . . . Compound Blocks . . . . . Model Logic . . . . . . . . Collecting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 3 5 6 7 8 9 11 What Is Simulation? Simulation is a very broad term that is applied across many fields and industries. In its most general sense, simulation is the process of building or designing a model that mimics the behavior of a particular real-life system. These models can be either physical or logical. Examples of physical models include flight simulators, wind tunnels, and earthquake simulators. This document focuses on logical models, which can usually be represented by computer programs. For some systems governed by logical and mathematical relationships, you can use traditional mathematical techniques such as queueing theory and differential equations to derive an analytical solution. For these systems, obtaining an exact answer is a benefit. However, you often need to make simplifying assumptions about the system being studied in order to obtain an analytical model; this simplification brings to the forefront the question of model validity. You can build a simple model of a complex system, but that does not necessarily mean that the model is valid. Many real-world systems are composed of not only extremely complicated and intricate mathematical and logical relationships, but also a significant random component. For these systems, you simply might not be able to derive an analytical model. Instead, you can use a computer to build a model of the system and numerically generate data that you can use to foster a better understanding of the behavior of the real-world system. Part of the art of designing a computer simulation model is deciding which aspects of the real-life system are necessary to include in the model so that the data generated by the model can be used to make effective decisions. 2 F Chapter 1: Overview of SAS Simulation Studio One of the main advantages of computer simulation is the ability to model extremely complex systems that ordinarily would be impossible to model using traditional analytical techniques. On the other hand, the data generated by a computer simulation model is not exact and, to complicate matters even further, the output is random if any of the model’s inputs is random. This randomness makes it more difficult to analyze the output from computer simulations, and often advanced statistical methods are required to formulate valid conclusions about the behavior of the system. The field of computer-based simulation is itself very broad and includes a number of different classes of modeling techniques. This document focuses primarily on discrete-event modeling methods in which the state of the model is dynamic and the state of the model changes only at countable, distinct points in time. For example, the operation of an emergency room at a hospital over a 24-hour period can be modeled using discrete-event simulation techniques. A state change in this example can be triggered by the arrival of a new patient or the departure of a nurse for a meal break. Each state change occurs at a distinct point in time, and the simulation model operates by scheduling these events and proceeds by advancing the simulation time to the next event or state change. The popularity of simulation as a tool for design and analysis has grown over recent years, especially with the advancement of computing technology. Part of simulation’s popularity is also due to the numerous and diverse areas where it can be applied. Some areas where discrete-event simulation has been successfully used include manufacturing, telecommunications, transportation, military, and health care. What Is SAS Simulation Studio? SAS Simulation Studio is a SAS application that uses discrete-event simulation to model and analyze systems. Simulation Studio is based on the Java programming language and provides the following user interfaces: a graphical user interface that requires no programming and provides all the tools for building, executing, and analyzing discrete-event simulation models a programmatic interface that allows enables you to run models in batch model Although having a comprehensive set of modeling tools is an important quality in a simulation package, having advanced analysis tools is arguably just as important. As mentioned in the previous section, analyzing output from discrete-event simulations often requires advanced statistical methods. Simulation Studio is designed to interact with both SAS software and JMP® software so that you can conduct sophisticated statistical analyses of your results. Data generated by the model can be saved as a SAS dataset or JMP table for later analysis, or alternatively you can use a SAS block included in the basic template of modeling blocks to execute SAS or JMP code directly from Simulation Studio. Simulation Studio includes a state-of-the-art Experiment window that gives you an organized way to investigate the effects of different parameters on your model output in addition to a place to record results. For a discrete-event simulation model in general, you might be interested in conducting the following types of experiments: A Simple M/M/1 Queueing Model F 3 a sensitivity analysis where a parameter in the model is varied and the effect on some recorded response is examined. For example, you might be interested in the effect on customer waiting times of hiring an additional cashier at a store. a comparison of two or more systems. For example, given two different factory floor layout options, you might want to determine which one yields a higher throughput. an experimental design for a system that has flexibility in how several different parameters can be set. You might want to use an experimental design (such as a full factorial) to efficiently organize the testing of different parameter combinations and then study the effect on one or more results. The Simulation Studio Experiment window can be used to conduct all these different types of simulation experiments. It can interface with JMP software to generate experimental designs and then seamlessly pass the simulated results from the design back to the JMP program for analysis. Simulation Studio is also designed to support multiple models and experiments in a single project so that factors and responses can be defined once and used for all models in the project. This is especially useful when comparing two or more systems. No matter how advanced the available output analysis tools, they are essentially useless if the inputs to the model have not been estimated correctly. Input analysis is another important aspect of building a simulation model. In Simulation Studio input analysis can be facilitated by using JMP distribution estimation capabilities. Simulation Studio is a flexible discrete-event simulation tool designed to provide the necessary modeling and analysis tools for both novice and advanced simulation users. Furthermore, Simulation Studio attempts to avoid being simply a black box that takes model inputs and mysteriously produces model outputs. Rather, it includes features that enable you to customize your models and tailor Simulation Studio to meet your specific needs. A Simple M/M/1 Queueing Model To illustrate some of the basic concepts involved in building models in Simulation Studio, consider a model of a simple banking system with one teller. Assume that customers arrive at the bank at a rate of 10 per hour (so that the interarrival time between customers is a sample from the exponential distribution with a mean of 6 minutes). Customers wait in a single line on a first-come, first-served basis. Also assume that the teller has a service rate of 12 customers per hour (so that the service time for each customer is a sample from the exponential distribution with a mean of 5 minutes). This simple banking system is an example of an M/M/1 queueing system. For a queueing system such as this one, the following statistics might be of interest: average time a customer spends waiting in line length of the queue number of customers served in one day 4 F Chapter 1: Overview of SAS Simulation Studio Figure 1.1 An M/M/1 Queueing Model Figure 1.1 shows a Simulation Studio model of the banking system. All the blocks used in this example can be found in the basic template of blocks provided with the application. (The labels of blocks in Figure 1.1 have been changed from their default labels to reflect their role in this model. The default labels match the block type.) Customer arrivals to the bank are modeled using an Entity Generator block labeled Arriving Customers in Figure 1.1. The Entity Generator block has an input value port for the interarrival time. (See “Ports” on page 26 for more information about ports.) generates a sample from the exponential distribution (representing The Numeric Source block the next interarrival time) and the Entity Generator pulls that value through the InterArrivalTime port. Figure 1.2 shows the dialog box for the Numeric Source block. Since time in Simulation Studio is dimensionless, you can use hours or minutes or any other time unit in any Simulation Studio model, as long as you use the same units consistently throughout the model. Running the Model F 5 Figure 1.2 Numeric Source Block Dialog Box When the entity that represents a customer leaves the Arriving Customers Entity Generator block, it is pushed to the FIFO Queue block . The movement of the entity down the link does not advance the simulation clock. If the queue has a limited capacity and is full when the entity arrives, the entity is pushed out the FIFO Queue block’s OutBalk port. If the queue is not full, the FIFO Queue block attempts to push the entity to the Server block (representing the bank teller). If the Server is available, it accepts the entity. Otherwise, the entity waits in the queue. When the Server becomes available, it requests an entity from the queue. When the entity arrives at the Server block , a service time is sampled from the second Numeric Source block and pulled by the Server through the InServiceTime port. Once the entity completes its service, it is pushed out to the Disposer block where it leaves the system. The Server then requests another entity from the queue. Running the Model Figure 1.3 shows the Experiment window for this model. A single experimental design point, called point1, has the number of replications set to 1 and the length of the simulation set to 540 minutes (one banking day). 6 F Chapter 1: Overview of SAS Simulation Studio Figure 1.3 M/M/1 Queueing Model: One Design Point To display the simulation clock, select RunIShowISimulation Clock from the Simulation Studio menu. To turn on the animation, click the Animation button . To run this model, click the Start button . To pause the model, click the Pause button . To restart the model, click the Start button again. When the model finishes running, only the Reset button is active. You must click the Reset button before you make changes to the experiment window or rerun the model. Collecting Statistics You can use the Number Holder block to collect and display statistics such as minimum, maximum, sum, and mean as the model is running. In Figure 1.3, a Number Holder block (labeled Average Waiting Time) is connected to the OutWait port on the FIFO Queue block. (Although the ports on a block are not labeled in Figure 1.3, when you rest your mouse pointer on a port, a tooltip displays the port name.) Double-clicking any block in a model opens the properties dialog box for that block. Figure 1.4 shows the dialog box for this Number Holder block. As each entity leaves the queue, its wait time is pushed into the Number Holder block, whose Display field is set to Mean. The Number Holder Repair Shop Example F 7 then recomputes the average waiting time and displays the new value. In this example, the average waiting time for customers computed over one banking day is 16.813 minutes. Figure 1.4 Number Holder Block Properties A second Number Holder block (labeled Current Queue Length), with the Display field set to Value, is connected to the OutLength port on the FIFO Queue block. Each time an entity enters or leaves the queue, the new queue length is pushed to the Current Queue Length Number Holder block and the updated queue length is displayed. Number Holder blocks can display only averages for observation-based statistics, such as waiting time. For time-dependent statistics such as queue length, Number Holder blocks should be used only to display the minimum, maximum, sum, or current value. In Figure 1.3, the final queue length is 2. Finally, there is a third Number Holder block (labeled Number Serviced), with the Display field set to Value, connected to the OutCount port on the Disposer block . Each time an entity leaves the system, the Number Serviced Number Holder block updates its value and displays the current number of entities serviced. In this example, the number of customers served by the end of one day is 88. Repair Shop Example This section discusses a more complicated model to demonstrate some of the additional features and capabilities of Simulation Studio, including compound blocks, branching based on probability, and using the various plotting blocks to monitor the status of the model as it is running. 8 F Chapter 1: Overview of SAS Simulation Studio Suppose parts arrive at a repair shop at a rate of four per hour. Upon arrival, a part is taken to the service desk where it is inspected. The time it takes a person to inspect the part is uniformly distributed between 5 and 15 minutes. The service desk can repair 35% of the parts. The rest require more complicated repairs and must be sent to the repair station. At the repair station, the part is worked on by a repairman. The time it takes a repairman to diagnose and fix the problem is uniformly distributed with a minimum of 10 minutes and a maximum of 45 minutes. With a probability of 0.09 a repairman cannot fix the part, and it is sent to the scrap area. Otherwise, the repaired part is sent on to a quality control manager who inspects the part to determine whether it has been repaired properly. The time it takes a quality control manager to inspect a part is uniformly distributed between 6 and 18 minutes. Two people work at the service desk, and two people work at the repair desk. Assume the travel time for parts between all stations is 1 minute. The shop is open from 9:00 a.m. to 6:00 p.m., Monday through Friday. The simulation is run for one work week (or 45 hours). Compound Blocks Figure 1.5 shows the completed repair shop model. This model contains several yellow blocks labeled Arrivals, Delay, and Chance; these are compound blocks. If you double-click the yellow compound block labeled Arrivals, you see that it is made up of two blocks: a Numeric Source block and an Entity Generator block. (See Figure 1.6.) Compound blocks are a handy way to organize and streamline your model by collapsing groups of blocks into one block. Compound blocks are also useful in situations where you have the same logic repeated more than once because they can be saved to a template and later reused. For example, double-clicking a Chance compound block reveals that it is made up of three blocks. (See Figure 1.7.) By combining them into one compound block and saving it to a template, you can easily reuse this same logic at other places in your model. See Chapter 6, “Compound Blocks,” for more information about creating and saving compound blocks. Model Logic F 9 Figure 1.5 Repair Shop Model Figure 1.6 Arrivals Compound Block Figure 1.7 Chance Compound Block Model Logic Entities that represent the parts are created in the Arrivals compound block and are pushed to a Delay compound block where they are held for one minute, representing the travel time between stations. Next they are pushed to the Service DeskQ Queue block where they wait for the next available associate at the service desk. After service is completed at the service desk, the entity is 10 F Chapter 1: Overview of SAS Simulation Studio pushed to a Chance compound block, which is used to model branching based on probability (in particular, to model that 35% of the parts are repaired at the service desk while the rest are sent on to the repair station). If you right-click the Switch block inside the first Chance compound block to open the Block Properties dialog box, you see that there are two cases defined: one named FurtherRepair and one named Fixed. (See Figure 1.8.) The Port option indicates that the switch value comes through the InSwitchValue port. After the two cases have been defined, two additional entity output ports are dynamically created on the Switch block to allow routing of entities based on the switch value. The InSwitchValue port is connected to a Formula block. Figure 1.8 Switch Block Properties Figure 1.9 shows the Block Properties dialog box for the Formula block. After you add one input variable named runif of type Number, the Formula block dynamically creates an input port labeled runif. Connected to the runif input port is a Numeric Source block. This Numeric Source block generates a sample from the uniform distribution with a minimum of 0 and a maximum of 1. After the value for runif is pulled by the Formula block, the expression cond(runif>0.35,1,0) is evaluated as follows. If runif is greater than 0.35, then the value 1 is returned and pushed out of the Formula block and into the Switch block. Otherwise, the value 0 is returned and pushed out. The Switch block then receives either the value of 1 or 0 and uses the value to determine which output port the entity should use to leave the Switch block. Collecting Data F 11 Figure 1.9 Formula Block Properties If a part is fixed at the service desk, it leaves the system. Otherwise, it is pushed on to the second Delay compound block where it is held for one minute. It then waits in the repair desk queue for the next available repairman. After being serviced by a repairman, the part is pushed into the second Chance block. Here the expression cond(runif>0.09,1,0) is evaluated so that with probability 0.09 the part cannot be fixed and is scrapped (that is, the entity leaves the system). Parts that are fixed move on to the third Delay compound block where they wait for one minute and then are pushed into the quality control queue. After being inspected by the quality control manager, the part leaves the system. Collecting Data Several blocks in Simulation Studio can be used to collect data. One of these blocks used in the repair shop model is the Server Stats Collector block . This block can be placed anywhere in the model window because entities do not flow through it. Figure 1.10 shows the Block Properties dialog box for the Server Stats Collector block. A list of all blocks that implement the ServerStats interface in the model is shown, and you can select the ones for which you want to collect statistics. The data collected can be saved to a file as a SAS dataset or JMP table or passed to one of the Simulation Studio plotting blocks. 12 F Chapter 1: Overview of SAS Simulation Studio Figure 1.10 Server Stats Block Properties In the repair shop model, a Bar Chart block is connected to the OutData port of the Server Stats Collector block. Figure 1.11 shows the Block Properties dialog box for the Bar Chart block, which requests a bar chart of the average utilization for each of the three servers in the model. After the model is run, the bar chart shows that the average utilization at the quality control station is significantly higher than at the repair or service desks. (See Figure 1.5.) Collecting Data F 13 Figure 1.11 Bar Chart Block Properties To further investigate the severity of the bottleneck at the quality control station, you can connect a Number Holder block (labeled WaitingTimeQC) to the OutWait port on the quality control queue. Then you can pass the waiting time values to a Scatter Plot block by connecting the OutCollected port of the Number Holder block to the InData port of the Scatter Plot block. For the plots to display correctly, the Collect Data check box in the Number Holder Block Properties dialog box must be selected. (See Figure 1.4.) As the model runs, you see that the waiting time at the quality control station continues to increase. Appendix E, “Examples of Simulation Studio Models,” revisits this repair shop model. 14 Chapter 2 Introduction to SAS Simulation Studio Contents Simulation Studio Graphical User Interface Installing and Starting Simulation Studio . Installing Simulation Studio . . . . . Starting Simulation Studio . . . . . . Configuring Simulation Studio . . . . Launching SAS and JMP Servers . . Simulation Studio Menu and Toolbar . . . Block Template Display Area . . . . . . . Simulation Studio Projects . . . . . . . . . Projects Explorer . . . . . . . . . . . Project Window . . . . . . . . . . . Log and Trace Window . . . . . . . Project Status Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 16 16 17 17 18 18 19 20 20 21 24 24 Simulation Studio Graphical User Interface As mentioned in Chapter 1, “Overview of SAS Simulation Studio,” Simulation Studio provides a graphical user interface (GUI) and a batch interface. Initially, most users typically use the Simulation Studio GUI to build and execute simulation models. This chapter provides a high-level overview of Simulation Studio from the GUI perspective and discusses the major components of the application framework. The batch interface is detailed in Chapter 11, “Batch Execution.” 16 F Chapter 2: Introduction to SAS Simulation Studio Figure 2.1 Simulation Studio Application Framework When you start the Simulation Studio application, the graphical user interface opens on your computer screen as shown in Figure 2.1. This window consists of six main areas: menu, toolbar, block template display area, project explorer, project desktop, and project status bar. The following sections provide details about each of these areas. Of course, before you can view the Simulation Studio GUI, you have to know how to launch the application. Installing and Starting Simulation Studio Installing Simulation Studio The installation program for Simulation Studio asks where you want to install the software on your computer. The default location is \Program Files\SAS\SimulationStudio\1.5. If you choose the default location, the installation software loads the software and adds an entry for Simulation Studio to the Start menu. The installation routine also includes an option to add a Simulation Studio icon to your desktop for launching Simulation Studio. Configuring Simulation Studio F 17 Simulation Studio requires you to have a valid version of either the SAS/OR® or JMP software or both installed on your computer. It also needs to know the location of this software on your system. This information is referred to as the Simulation Studio configuration data. The configuration data must be supplied to Simulation Studio for the application to launch. Starting Simulation Studio To start Simulation Studio, you can either double-click the Simulation Studio desktop icon or select the Simulation Studio entry from the Start menu (StartIProgramsISASISimulation Studio 1.5.) Configuring Simulation Studio When you attempt to launch the Simulation Studio application for the first time, it has not yet acquired the configuration data it needs. The message “No valid SAS/OR or JMP license” appears because at this point Simulation Studio does not know where to look for SAS or JMP software on your machine. Then Simulation Studio displays the SAS Simulation Configuration dialog box for you to enter the necessary information. (See Figure 2.2.) Under Analytical Servers, enter the directory location for the version of SAS or JMP software you want to use with Simulation Studio. (The default paths for these locations are usually something like \Program Files\SAS\SAS 9. 2 or \Program Files\SAS\JMP8.) You need to supply the information for at least one of these items for the application to function. If you populate the information for only one of the servers, the Default Data Format choice is made automatically. If you supply both SAS and JMP server information, you might have to choose your default data format. (This format information is used for reading and writing data when the filename extension is not provided with an input or output filename.) Figure 2.2 Configuration Dialog Box 18 F Chapter 2: Introduction to SAS Simulation Studio Launching SAS and JMP Servers If you want to submit SAS code (probably through a SAS block in your simulation model) or interact with JMP software during a Simulation Studio session, you need to have the Simulation Studio SAS server or JMP server (or both) running on your computer. You must launch these servers manually. The server code is installed in the launchSASServer directory under your Simulation Studio installation directory. To launch the SAS server, double-click the file SASServers9_2.bat in the launchSASServer directory. (You might need to edit this file to reflect the location of the sas.exe you specified for the SAS folder in the configuration dialog box.) The process for launching the Simulation Studio JMP server is similar except that you open and run the JMP script file named JMP_Sim_Server.JSL. (Use the Run Script menu option from a JMP window.) Simulation Studio Menu and Toolbar The main Simulation Studio menu consists of five items: File, Template, Run, Analyze, and Tools. Use the File menu (shown in Figure 2.3) to open, create, close, and save projects, models, and experiments in Simulation Studio. When you open or create a new project, Simulation Studio opens a new project window in the Project Desktop area of the GUI and updates the Project Explorer accordingly. If this is a new project, a new (empty) model and experiment are also created. When an existing project is opened, all models and experiments in that project are opened and entries are created for them in the Project Explorer. Figure 2.3 File Menu A Simulation Studio template stores information about a collection of Simulation Studio blocks. Template details are provided in Chapter 9, “Block Templates.” Use the Template menu to open, create, close, and save Simulation Studio templates. Opening a template adds the template name to the Template list box in the Block Template Display area of the application. You can use this list box to determine which template palette is visible in the Block Template Display area of the application. Select TemplateIClose to remove the current template name from the Template list box and also remove the associated blocks from the Template palette. Select Save or SaveAs to save the current template to disk storage. More details about templates are provided in Chapter 9, “Block Templates.” Block Template Display Area F 19 The Run menu (Figure 2.4) controls much of the model execution and animation. Many of the controls are also found in the toolbar. The functionality associated with model execution controls (Start, Pause, and so on) is discussed in Chapter 3, “Simulation Models.” Select Show to enable or disable the simulation clock and replication count displays for the current model. When visible, the clock and replication count appear in the upper right corner of an individual Project window. Figure 2.4 Run Menu To access the JMP distribution-fitting platform, select AnalyzeIInput Analysis. To open the configuration dialog box (Figure 2.2), select ToolsIConfiguration. The toolbar (Figure 2.5) provides quick access to most of the functionality in the Run menu. The animation icon acts as a toggle switch for turning execution animation on and off. Clicking an icon in the toolbar invokes the functionality associated with that icon. The remaining toolbar icons are discussed in Chapter 3, “Simulation Models.” Figure 2.5 Toolbar Block Template Display Area The Block Template Display area (Figure 2.6) consists of two components. The Template list box contains the names of all the templates currently loaded into Simulation Studio. The selection displayed in the Template list box represents the currently active template. In Figure 2.6 the template labeled “basic” is active. The area immediately below the list box, called the Template Palette area, displays the templates for the individual blocks contained in the currently active template. You can change the format of the displayed items in the Template Palette area by using the pop-up menu available on the Block Template Display area background. Display options include Large Icons, Small Icons, List, Text Only, and Icons Only. You can also use this pop-up menu to view specific information about an individual block. Selecting Block Info from the pop-up menu opens a dialog box to display information about the corresponding block. This information includes the block name, class path, icon, and tooltip associated with the block. Menu options are also available 20 F Chapter 2: Introduction to SAS Simulation Studio via the pop-up menu to remove blocks from and import blocks to the template. When you rest the pointer on an individual block icon in the Template Palette, a tooltip appears that contains a brief description of the block. The Template Palette area is your source for blocks when you are using the Simulation Studio GUI to build your simulation model. To add blocks to your simulation model, drag items (template icons) from the Template Palette into a Model window. This process creates an instance of the associated block in your model. Templates are discussed in detail in Chapter 9, “Block Templates.” Figure 2.6 Template Display Area Simulation Studio Projects A project in Simulation Studio (ideally) contains models and experiments that are in some way associated with each other and helps to provide organizational structure to all of your models and experiments. A project must contain at least one model and experiment, but there is no limit to how many models and experiments can be in a project. Any number of projects can be loaded into Simulation Studio at one time. In addition to organizing models and experiments, projects provide storage for factor and response definitions that can be shared across models and experiments in that project. Factors and responses are discussed in Chapter 4, “Experiments.” Projects Explorer The Project Explorer (located on the top left side of the GUI in Figure 2.1) uses a tree structure to display the projects, associated models, and experiments that are currently loaded into the application. Figure 2.7 shows a Project Explorer with two projects loaded: crane and repairshopDOE, each with one model and one experiment. Project Window F 21 Figure 2.7 Sample Project Explorer Selecting a project, model, or experiment name listed in the Project Explorer hierarchy causes the windows associated with that item to activate and pop to the top in the Project window. The activated model and experiment names are shown in bold. Up to one model and one experiment in a project can be activated. Context-sensitive pop-up menus are available on the items displayed in the Project Explorer. You can right-click a project to open a dialog box to edit factors and responses associated with the project and also to change the base directory location where any simulation results are stored. You can right-click a model to open the Anchors dialog box to associate block parameters in a model to project factors and responses and also to set flags in blocks for automatically saving results. You can right-click an experiment to open a dialog box to include factors and responses. Factors, responses, and anchors are detailed in Chapter 4, “Experiments.” Project Window Each project loaded into Simulation Studio has a Project window associated with it in the Project Desktop area of the GUI. A newly created Project window is displayed in Figure 2.8. Each Project window has a desktop area at the top and a tabbed window at the bottom. The Project Desktop area contains any Model windows and Experiment windows associated with the project. When a new Project window is first created, it has one (empty) Model window, one Experiment window, and at the bottom of the frame, Log and Trace tabs. Project windows can be minimized as needed using controls on the Project window frame. To open the Factor and Response definition dialog boxes, right-click on the background of a Project window. See Chapter 4, “Experiments,” for details about factors and responses. 22 F Chapter 2: Introduction to SAS Simulation Studio Figure 2.8 Sample Project Window Model Window Each model in a project has a Model window associated with it. You use this window to graphically construct and display a simulation model. You drag a block from the Template Palette into a Model window to create an instance of the block associated with that template in your model. You connect the blocks in your model by creating links between ports on the various blocks. You can rightclick or double-click an individual block to open a dialog box where you can modify parameters associated with the block. Interacting with blocks and models is discussed in detail in Chapter 3, “Simulation Models.” Closing a Model window deletes the window and removes the model entry Project Window F 23 from the Project Explorer. N OTE : Modified models are not automatically saved upon closing. Figure 2.9 displays a sample Model window that contains a simple M/M/1 model. Figure 2.9 Sample Model Window Experiment Window You use Experiment windows to control the initialization and running of simulation models. Each experiment in a project has an Experiment window in the Project window. By default, each Experiment window contains columns for controlling the start and end times of a simulation run (or design point) along with a column for designating how many times you want to repeat this run. An experiment must have at least one design point in order to run an associated simulation model. You can use an Experiment window to control initialization of block parameters before running a simulation model. Any factor or response defined on the project can be included in an experiment. Using this and other features of experiments is discussed in Chapter 4, “Experiments.” As with a Model window, closing an Experiment window deletes the window and removes the experiment entry from the Project Explorer. Figure 2.10 shows a sample Experiment window including a factor labeled maxentities and a response labeled Number Serviced. To modify the content of an Experiment window, right-click on the background of the Experiment window and select the appropriate item from the pop-up menu. 24 F Chapter 2: Introduction to SAS Simulation Studio Figure 2.10 Sample Experiment Window Log and Trace Window Each Project window also contains one Log and Trace window in a tabbed format along the bottom of the Project window frame. (See Figure 2.8.) The Log tab displays log messages from either the currently running or most recently run model. Each log message has a Severity Level associated with it along with the source and simulation time of the message. The Tracer feature must be enabled for trace messages to appear in the Trace tab. You enable the Tracer feature by using a pop-up menu available on the Trace tab background. Trace messages are generated by individual blocks during the execution of a model and are intended to provide details about events and execution flow within the blocks. Additional details about the log and trace facilities in Simulation Studio are provided in Chapter 8, “Log and Trace.” Project Status Bar The Project Status bar, located at the bottom of the GUI, displays the path name of the currently active project. Chapter 3 Simulation Models Contents Overview of Models . . . . . . . . . . . Blocks . . . . . . . . . . . . . . . . . . . Ports . . . . . . . . . . . . . . . . . . . . Entities and Values . . . . . . . . . . . . Building a Model . . . . . . . . . . . . . Running a Model . . . . . . . . . . . . . Saving a Project . . . . . . . . . . . . . . Opening a Project, Model, or Experiment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 25 26 28 29 29 30 31 Overview of Models In Simulation Studio, the term model means an abstraction or representation of a system that you want to investigate or study. Most models represent a simplified version of the real system, but they still must capture the essence of the system under investigation to be useful. In Simulation Studio, models are composed of blocks, and blocks communicate with each other through ports. In the Simulation Studio GUI, blocks are said to be connected if a port on one block has a link to a port on another block, creating a path for information to flow between them. A model in Simulation Studio is usually a series of blocks arranged or connected in a configuration that represents the system under investigation. This chapter provides an overview of blocks, ports, and the types of information that flow between them. The details about each of these subjects is provided in later chapters. This chapter also discusses how to use the Simulation Studio GUI to build, run, and save a simulation model. Blocks In Simulation Studio, blocks are the most fundamental units used to build a simulation model. Each block usually encapsulates some well-defined and specialized functionality. Communication 26 F Chapter 3: Simulation Models between blocks is accomplished through the ports defined on the individual blocks. In the Simulation Studio GUI, you manually create a link between the ports on blocks to provide a path for information to flow when the simulation is running. Simulation Studio provides a default collection of basic blocks for model construction. These blocks appear in, and can be accessed through, the basic template of the application. The details about these individual blocks is provided in Appendix A, “Basic Template.” Each block has a pop-up menu associated with it that you can open by right-clicking the block in the Model window. This menu looks similar to the one displayed in Figure 3.1. Figure 3.1 Sample Block Menu This menu provides various functionality, including access to the block properties dialog box. The properties dialog box displays any individual parameters for the block along with a block functionality overview page. You can also open a block’s properties dialog box by double-clicking the block. In addition to the basic blocks provided by Simulation Studio, you can create compound blocks by aggregating a series of blocks, or you can create your own basic blocks. The details about these subjects are covered in later chapters. Ports Ports represent the basic interface to blocks. Blocks usually have multiple ports. Depending on the functionality of the block, a block can have static ports (the same ports are always available for this type of block) or dynamic ports (ports can be dynamically created or deleted based on various properties of the block). An example of a block with static ports is the Entity Generator block used to create entities. (See Figure 3.2.) This block always has an InterArrivalTime, BatchSize, Signal, OutEntity, and OutBalk port. Ports F 27 Figure 3.2 Entity Generator Block with Five Static Ports The Modifier block has static ports and optional dynamic ports. You use a Modifier block (Figure 3.3) to assign attributes to an entity that flows through a model. The number of ports available on the Modifier block is dependent on the number of attributes you have decided to set using that block. In Figure 3.3, three attributes are assigned using this Modifier block, so the block’s icon displays three dynamic attribute input ports along with the Modifier block’s standard static input and (two) output entity ports. Figure 3.3 Modifier Block with Three Dynamic Attribute Ports Blocks have two types of ports: value ports and entity ports. The ports are color-coded with value ports displayed in blue and entity ports in red. Value ports are always located on the top and bottom of the block icon, and entity ports are displayed on the right and left sides of the block icon. In general, values are information such as numbers, character strings, and so on, and entities represent “special objects” that flow through the model during a simulation, potentially carrying additional information or properties along with them. Each value port can either be an input value port or an output value port. Similarly, entity ports can be input or output ports. An input port is used to get information into the block, and an output port is either used by the block to push information out or used by another block to pull information from the block. Input ports are drawn as triangles on the perimeter of a block, and output ports are represented by squares. In Figure 3.2, the InterArrivalTime port represents an input value port and the OutEntity port is an output entity port. When you first rest the pointer over a port, a tooltip with a brief label for the port appears. The ports for each block are described on the Overview tab in the block’s properties dialog box. 28 F Chapter 3: Simulation Models Entities and Values Two general types of information are communicated between blocks: values and entities. Values can be numbers, strings, or generic Java objects, and they are usually associated with state information or properties on blocks. Value ports are used to access or set value information associated with blocks. As an example, the FIFO Queue block has a numeric property called capacity that represents the maximum number of entities the queue can hold at one time. Although you can use the properties dialog box of a FIFO Queue to set its capacity, you can also connect the InCapacity port (as shown in Figure 3.4) to a numeric output port of another block that sends out a numeric value while the simulation is running. The FIFO Queue block also has a numeric value output port called OutLength. Every time the number of entities in the queue changes, the length of the queue is pushed out its OutLength port. It is also possible to query the length of the queue via a connection to the OutLength port. Figure 3.4 FIFO Queue Block Although most values are simply numbers or strings, values can also be Java objects. Some blocks collect information or statistics and store the data in a custom Java object. This storage object can be shared with other blocks. An example of this functionality is the Number Holder block. The Number Holder block provides an option to store data values that pass through the block in a storage object, and the Number Holder block has an output port called OutCollected to provide access to this storage object. For example, you might be interested in displaying the values being collected in the Number Holder block while the simulation is running, so you could connect the DataIn input port (of value type Object) of a Histogram block to the OutCollected port of the Number Holder block. The Histogram block would then display a representation of the data passing through the Number Holder block when the simulation is running. The second type of information passed between blocks is called an entity. Entities are “special objects” in Simulation Studio and have a unique role in this discrete-event simulation application. Although value information tends to flow between two blocks and is immediately consumed, entities usually flow through the model and have a much longer life span. Entities can have properties or attributes assigned to them, and these properties might be modified during the simulation execution. Blocks can use property information assigned to entities in their internal processing and logic to affect simulation execution. Consider the simple M/M/1 example presented in Chapter 1, “Overview of SAS Simulation Studio.” Suppose this example represents customers waiting to check out at a cashier, and the entities that Building a Model F 29 flow through the model represent customers. You could modify this model to assign a property to the customers (entities) to represent how many items the customer is purchasing and then use this information to determine how long it takes the customer to check out at the cashier. Additional information about entities and their role in Simulation Studio is given in Chapter 7, “Entities.” Building a Model Using the Simulation Studio GUI to build a simulation model is straightforward. It consists of dragging icons from the Template Palette window into a Model window and then creating links between the appropriate ports on the various blocks in the model. (Of course, the hard part is actually determining the appropriate composition of the model.) To create an instance of a specific block in a Model window, you drag the appropriate icon or text in the Template Palette window into the Model window to the location where you want the block to be created. During the drag, a transparent icon is attached to the pointer. (You can always drag the new block instance around in the Model window to move it to another position.) You can modify the properties on any block in your model by using the properties dialog box associated with each block. You can open this dialog by right-clicking the block and selecting the Block Properties menu item. Double-clicking the block icon causes the properties dialog box to open as well. After you have some blocks in your Model window, you can begin to create links between the ports on the various blocks to enable the flow of values and entities between blocks. To create a link, position the pointer over a port you want to be an endpoint of the link and hold down the left mouse button. (Note that the port size enlarges when the pointer is over it, indicating port selection.) A rubberband line appears connecting the selected port with the pointer. While holding down the left mouse button, move the pointer until it is positioned over the port you want to connect to and then release the left mouse button. If the types associated with the two selected ports are compatible, a link is created between them. Running a Model Before you can run your simulation model, you must have an active model and an active experiment, and the active experiment must have at least one design point selected or highlighted in the Experiment window. (For more information about experiments, see Chapter 4, “Experiments.”) Although a project can have multiple models and experiments associated with it and multiple windows visible in the Project window, only one model and one experiment are considered active at any particular time. The active model and active experiment are identified by bold text for their names in the Project Explorer window. To activate a model or experiment, you can either select the name in the Project Explorer window or select the window associated with the model or experiment in the Project window. 30 F Chapter 3: Simulation Models After you have a valid model and experiment selected (that is, active), you can use any of the following methods to start the simulation running. You can select the icon on the toolbar or select RunIStart from the main menu. You can also select the icon on the toolbar or select RunIAugment. (See Chapter 4, “Experiments,” for additional information about augment run.) Simulation Studio attempts to synchronize the active model and active experiment, initializes the model by using the experiment, and begins running the simulation. If this process is successful, the active model and experiment transition into the running state, and their labels are displayed using a red font in the Project Explorer. You can stop or pause a running simulation at any point by selecting either the icon on the toolbar or RunIPause from the main menu. While the simulation model is running, only the Pause and Reset icons are selectable on the toolbar. When the simulation has finished running, the Pause icon is not selectable. N OTE : The simulation clock might not be advancing and no animation might be visible, but the simulation engine might still be processing data. During the early stages of developing and validating your simulation model, it is often useful to employ the animation feature in Simulation Studio. Animation can be switched on and off using the toolbar icon or through the Animate check box on the Run menu. When animation is activated, the flow of information is graphically depicted in the Model window, with value movement visualized with blue icons and entity movement with red icons. These blue and red icons are shown traversing the various links in the model. Although animation slows the execution of the model, it can provide valuable insight when debugging your model or demonstrating the mechanics of your model to others. Another option is the ability to display the simulation clock and replication count while the simulation is running. These values can provide you valuable feedback on the status and progress of your model execution. Controls for these options are provided under the RunIShow menu. Finally, selecting the icon or RunIReset reinitializes the simulation clock and random number stream “states” and also invokes any reset method on any blocks in the active model. Saving a Project Saving models, experiments, and factor/response definitions is currently done on a project basis. That is, only entire projects can be saved. All models, experiments, and factor and response definitions that are associated with a project are saved when a project is saved. To save a project, select FileISave or FileISaveAs from the main menu. A File dialog box opens where you select the folder or directory location in which to save the project. Opening a Project, Model, or Experiment F 31 Opening a Project, Model, or Experiment Although you can save only an entire project, Simulation Studio enables you to open an individual project, model, or experiment. Opening a project results in opening all models and experiments associated with that project. To open a project, model, or experiment, select File from the main menu. There are options to open a project, model, or experiment. When you open a project, a new entry is created in the Project Explorer tree for that project along with subentries for any models and experiments that reside in that particular project. When you open an individual model or experiment, that item is included in the currently active project and a new leaf is created in the Project Explorer under the appropriate project node. 32 Chapter 4 Experiments Contents Overview of Experiments . . . . Factors, Responses, and Anchors Experiment Window . . . . . . Design Points . . . . . . . Replicate Rows . . . . . . Running an Experiment . . . . . Augment Run . . . . . . . . . . Saving and Loading Design Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 33 38 40 41 42 42 43 Overview of Experiments The concept of an experiment can have a variety of meanings or connotations in different contexts and fields of study. In Simulation Studio, an experiment provides a facility to automate the initialization and running of simulation models and also to record measures from a simulation run. That is, you can use an experiment to set parameters on blocks in your model before you run the model (without manually editing the individual blocks) and also to extract and record measures from blocks at the end of each simulation run. This feature provides you with a powerful facility to automate running a wide range of simulation scenarios and the capability to conduct full design of experiment testing. Factors, Responses, and Anchors In keeping with traditional design of experiments terminology, the term factors describes the variables or parameters that are manipulated or changed for each experimental design point. The term responses refers to measures that are recorded for each experimental run. In Simulation Studio, factors and responses are defined on a project basis. You use the Factors and Responses dialog boxes (Figure 4.1 and Figure 4.2, respectively) to define factors and responses for a specific Simulation Studio project. To open a Factors or Responses dialog box, right-click the Project window background (or right-click the project name in the Project Explorer) and select Factors or Responses. 34 F Chapter 4: Experiments Figure 4.1 Factors Dialog Box Figure 4.2 Responses Dialog Box The process of creating factor and response definitions essentially creates a factor and response database for the project. This database facilitates the reuse of these definitions across experiments and models. Any factor or response defined on a project can be included in any experiment in the project. To include a factor and response in (or remove it from) an experiment, right-click in an Experiment window and select Factor Inclusion or Response Inclusion from the pop-up menu shown in Figure 4.3. In the resulting dialog box, select or clear the factor or response as desired. Factors, Responses, and Anchors F 35 Figure 4.3 Experiment Menu Figure 4.4 Factor Inclusion Dialog Box Simulation Studio must map the factors and responses included in an experiment to block parameters and measures in the simulation model. This is accomplished using an anchor, which defines the link between a factor or response defined on a project and an actual block parameter or measure in a specific model. Anchor information is used to associate factors and responses in an experiment with simulation models in a particular project at run time. To demonstrate the anchor definition process, consider the simple M/M/1 model depicted in Figure 4.5 for simulating waiting in line for a bank teller to become available. To open the Anchor dialog box (Figure 4.6), which defines both factor and response anchors, right-click in the Model window and select Anchors from the pop-up menu. The Anchors dialog box presents separate tabs for displaying the factor anchors and the response anchors. In Figure 4.6, no anchors have been defined on this model yet. 36 F Chapter 4: Experiments Figure 4.5 Simple Bank Teller Model Figure 4.6 Sample Anchors Dialog Box The processes for creating response and factor anchors are completely analogous, so this section discusses only creating response anchors. Click New on the Response Anchors tab in the Anchors dialog box to cause the New Anchor dialog box for responses to be displayed. (See Figure 4.7.) The Responses list in the upper right area of the New Anchor dialog box displays the names of all the responses defined on this project. In this example the project has five defined responses. (Recall that factors and responses are defined on a project basis.) When you select a response name in this Factors, Responses, and Anchors F 37 list, the details associated with that response are displayed in the Details table of the dialog box below the Responses list. Figure 4.7 Sample New Anchor Dialog Box for Responses The Blocks area contains a hierarchical representation of the names of all blocks in the model that contain potential response anchors. Selecting a block name causes the Candidates list to be populated with the names of the possible response anchors associated with the selected block. In Figure 4.8 the block named FIFO Queue is selected and all of its potential response anchors appear in the Candidates list. The details for any item selected in the Candidates list are displayed in the Details table below the Candidates list. Figure 4.8 New FIFO Queue Response Anchor Dialog Box 38 F Chapter 4: Experiments To create an anchor link between a response anchor candidate from a block in your model to a response defined in your project, select an item in the Candidates list and also an item in the Responses list. Then click OK. This results in an entry being added to the Anchors dialog box. (See Figure 4.9.) You can edit or remove an entry from this table by selecting the appropriate row in the table and then clicking either Edit or Remove. Figure 4.9 Populated Anchors Dialog Box When you attempt to run a simulation model-experiment combination, Simulation Studio attempts to map the factor and response anchors defined on the model to the factors and responses included in the experiment. If a mismatch exists, Simulation Studio writes an error message to the Log window and stops the model execution. Experiment Window Figure 4.10 shows a sample Experiment window. This table is sometimes referred to as the design matrix for an experiment. All the information associated with an experiment is displayed in its design matrix. Each row in the matrix is called a design point, and it can contain values for a label, execution controls, factor settings, and responses measured during model execution. You can add or remove design points using the pop-up menu available on the Experiment window background. The design matrix is initially populated with four default columns labeled PointName, StartTime, EndTime, and Replicates. The PointName column assigns a label to the design point. Although a default value (pointN) is generated for this field when the design point is created, you can edit this field to be any text you choose. The StartTime and EndTime values control the execution start and end time (on the simulation clock) for an individual simulation run. The simulation clock begins running at the value displayed in the StartTime field for the design point, and the simulation ends or stops when the simulation clock reaches the time entered in the EndTime field. (Note that time has no unit in Simulation Studio.) The final default column in the design matrix is labeled Replicates. Experiment Window F 39 The value contained in this field represents how many times you want to run this particular design point. You can edit the default values for the StartTime, EndTime, and Replicates by selecting Properties from the Experiment window pop-up menu and modifying the values in the resulting Properties dialog box. Each replication of a design point uses the same factor settings. However, different random substreams are used in each replication. Additional details about replicates are provided in Appendix C, “Design of Experiments.” Figure 4.10 Sample Experiment Window Only the default columns in the design matrix are necessary to actually run a simulation model. Figure 4.10 shows a design matrix with one additional factor, maxentities, and one response, Number Serviced. Any factors or responses defined on a project can be added to the design matrix by using the Factor Inclusion or Response Inclusion dialog boxes, respectively. You can open these dialog boxes via menu entries in the Experiment window pop-up menu. Figure 4.11 shows a sample Factor Inclusion dialog box. The names of all the factors defined on the project are listed in the Factors list along with an individual check box for each entry. In this example three factors have been defined on the project. When you select the factor name, the details associated with that factor are displayed on the right side of the dialog box. The check box adjacent to the factor name controls inclusion of the factor into the design matrix. In Figure 4.11 only the factor named NumServers is included in the experiment. The Response Inclusion dialog box works analogously to the Factor Inclusion dialog. Color coding in the column header of the design matrix indicates which role that column plays in the experiment. The default columns have gray headers; any added factors are denoted by yellow background headers; and a pink background header is used for response columns. 40 F Chapter 4: Experiments Figure 4.11 Sample Factor Inclusion Dialog Box Design Points You can run an experiment with only one design point and only the default execution control parameters. In fact, this is often the case when you are first building, debugging, and validating your model. However, after you have confidence in your simulation model and you want to use it for investigating the process you are trying to model, automating the manipulation of block parameters and running the corresponding simulations becomes very important and useful. After you have determined what factors and responses you want to include in your experiment, the next step is to determine how many design points you need in your experiment and what values are assigned to the individual cells in your design matrix. The factors you are manipulating, the number of levels in each of the factors, the goals of the experiment, and so on, all contribute in determining the number of design points and the contents of the individual cells in your design matrix. Options are available in the Experiment window pop-up menu to add (and delete) design points to the design matrix. You can manually create new rows in the matrix and then edit the individual cells to enter the desired parameter/factor values. If you are interested in an automated approach to designing your experiment and possibly developing a metamodel for your simulation model, Simulation Studio provides a link to the JMP design of experiments capabilities. To access this functionality, select Make Design from the Experiment window pop-up menu. The details about using JMP software to populate your design matrix and create a metamodel for your simulation model are discussed in Appendix C, “Design of Experiments.” Replicate Rows F 41 Replicate Rows One of the default columns in the experiment design matrix is labeled Replicates. The value in this column represents how many times you want to run the associated design point in this experiment. The default value for the entire column is 1 replicate. To edit the default replicate value, right-click in the Experiment window to open the Properties dialog box. Each replication run for a given design point uses the same factor levels. However, different random streams (if random streams are used in the model) are used for each replicate. If the number of replicates for a given design point is greater than 1 (and you have included responses in your experiment), a small blue triangle precedes the replication value in the design matrix replication cell. Clicking this triangle causes the replication rows to be expanded or collapsed in the matrix. Figure 4.12 and Figure 4.13 show the different display states. Figure 4.12 Replicate Rows Collapsed Figure 4.13 Replicate Rows Expanded The factor level values are not displayed for each of the replicate rows—only the replication number and any measured response values are displayed. If a design point has replicate rows and it is in a collapsed state, the value displayed for any response value is a summary statistic calculated from all the values collected for that design point for that response. The average value is displayed by default. You can change the summary statistic displayed by right-clicking the appropriate response column heading in the Experiment window and selecting from the statistics available. (See Figure 4.14.) 42 F Chapter 4: Experiments Figure 4.14 Response Summary Menu Running an Experiment After you have created and populated the design points in your Experiment window, you are ready to run your simulation model. (You must have identified the active experiment, and it must have at least one valid design point.) You can select one or more design points to automatically run in sequence. You can select a collection of design points either by dragging the pointer over the desired design points or by using the Control or Shift key in combination with clicking to perform standard extended selection of design points. Selected design points are highlighted in the design matrix. You can start running the selected design points in any of the following ways. You can select the icon on the toolbar or select RunIStart from the main menu. You can also select the icon from the toolbar or the RunIAugment from the main menu. (Augment run is discussed in more detail in the following section.) Selected design points are run in the order in which they appear in the design matrix. The currently running design point is indicated by a red font in the design matrix. You can pause or suspend a simulation run by selecting the icon on the toolbar or by selecting RunIPause from the main menu. To restart the simulation execution, simply select the icon or RunIStart again. Consider the following when you run an experiment: It is often useful to display the simulation clock and replication count to monitor the progress of the experiment. Use the options under the RunIShow menu to display these values. Random number streams (substreams) advance with each replication of a design point but reset when moving on to the next design point. Messages can be written to the Log window while the simulation is running. Messages with a SEVERE level are displayed on the GUI in addition to being written to the log. Augment Run Suppose you have created an experiment, run it, and then decide you need additional design points or more replicates for individual design points. After you have modified your experiment to reflect these needs, you can select the RunIStart from the main menu (or use the corresponding toolbar Saving and Loading Design Data F 43 option) to run the simulation again. Simulation Studio clears any previous results and proceeds to run or rerun every selected design point and replication in the experiment. If no design points are selected, all points in the entire experiment are rerun. Alternatively, you can manually select the design points you need to run or rerun and then select RunIStart or use the corresponding toolbar option. This second approach also has limitations because you cannot select replications within an individual design point. Simulation Studio provides another alternative, called augment run, to facilitate this simulation scenario. When you select the icon from the toolbar or select RunIAugment from the main menu, Simulation Studio attempts to run any design points and replication rows that have not been previously run in the experiment. This unique approach provides you an option for incrementally expanding your design matrix results. Saving and Loading Design Data Options are available on the Experiment window pop-up menu (Figure 4.3) to save and load experiment design data. Selecting Save Design from the pop-up menu opens a File Chooser dialog box where you select or type the filename to which you want to save the data. The data in the experiment design matrix is saved to either a SAS data set or JMP data table, depending on your configuration data settings or the filename extension specified. Unlike the data displayed in the Experiment window, all individual replicate rows are completely populated with all the factor values along with the response values. Any rows that contain summary information for replication rows are not included in the saved data. The resulting saved data is in a format that can be passed to SAS procedures or JMP routines. You can also load saved experiment data into a Simulation Studio Experiment window. Selecting Load Design from the Experiment window pop-up menu opens a File Chooser dialog box where you enter the filename for the previously saved data. Simulation Studio attempts to load the data into an Experiment window. From there, you can select Analyze Results from the Experiment window pop-up menu to pass the data back to a JMP routine for design of experiments analysis (if the experiment has factors included). 44 Chapter 5 Blocks Contents Overview of Blocks . . . . . . . . . . Block Labels . . . . . . . . . . . . . Block Pop-up Menu and Dialog Boxes Managing Anchors . . . . . . . Managing Block Properties . . Saving a Block Instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 45 46 46 48 49 Overview of Blocks The block represents the fundamental component of Simulation Studio simulation models. All blocks in the base template are either directly or indirectly derived from a base block class. The base block class implements the message handling protocols and defines how blocks communicate with each other through ports. Each block is responsible for creating any ports it needs to perform the functionality required by the block. From a GUI perspective, ports completely define the interface to most blocks. Port management and related port message handling are two vital functions required of all blocks. For the most part, blocks communicate with other blocks by using links between ports. When using the Simulation Studio GUI, you can create a link from an output port only to an input port of compatible type. If you have multiple links on a given port, logic in the port determines which connections are used and in what order. The default behavior is to use the connections in the order in which they were created. Block Labels A default label is generated for each instance of a block. If only one instance of a particular block appears in a model, the block name is used as the default label. Otherwise, an integer is appended to the default label to indicate how many instances of the block have previously been created in the model. The block label is used to identify individual blocks in any lists, dialogs, and so on. The 46 F Chapter 5: Blocks label can be displayed next to the block icon in the Model window, but by default, a block label is not visible. Block Pop-up Menu and Dialog Boxes Each block has a pop-up menu and several dialog boxes associated with it. The pop-up menu is shown in Figure 5.1. Selecting Delete removes the corresponding block from the model. Select Toggle Label to show or hide the block’s label. You can modify a block’s label by selecting Edit Label and using the controls in the resulting dialog box to change the label text, specify whether the label is visible or not, and reposition the label around the block icon. Figure 5.1 Sample Block Menu The three remaining pop-up menu items, Anchors, Block Properties, and Save, all produce their own dialog boxes when selected. Managing Anchors As mentioned in Chapter 4, “Experiments,” anchors are used in association with experiments. Each project has a collection of factors and responses defined on it, and each experiment in that project might include any of these factors and responses. Simulation Studio must know how to map the factors and responses in an experiment to block parameters in the simulation model under investigation. This is accomplished through anchors. The Anchors dialog box (Figure 5.2) shows all factor and response anchors defined on the model. Use the New, Edit, and Remove buttons in this dialog box to manipulate the entries in these tables. Managing Anchors F 47 Figure 5.2 Sample Anchors Dialog Box Clicking New opens the New Anchor dialog box (Figure 5.3) where you can associate block parameters in your model to factor and response definitions in the project. Selecting a block label in the model tree on the left side of the New Anchor dialog box causes the names of any factor (or response) parameter candidates associated with the block to be displayed in the center Candidates list. To match a parameter with a project factor (or response), you must select both the parameter name in the Candidates list and the project factor name in the Factors list, and then click OK. A new entry is then created in the Anchors dialog box. The anchors are matched to the experiment factors and responses when you attempt to run an experiment. 48 F Chapter 5: Blocks Figure 5.3 New Anchor Dialog Box Managing Block Properties Selecting Block Properties from the block pop-up menu opens a tabbed dialog box, usually with at least two tabs. (You can also open the Block Properties dialog box for a block by double-clicking the block.) One tab is labeled Overview, and it contains a brief description of the block along with information about any block parameters. The other tabs usually provide controls for manipulating or editing block parameters. Figure 5.4 shows the parameter controls for an Entity Generator block. If the block supports the saving of data, another tab labeled Save is available with options related to saving data. Saving a Block Instance F 49 Figure 5.4 Entity Generator Block Properties Saving a Block Instance Selecting Save from the block pop-up menu opens a dialog box that provides options for saving the instance of the block to disk for reuse with a template. This dialog is essentially a file selection control for choosing the filename for saving the block. 50 Chapter 6 Compound Blocks Contents Overview of Compound Blocks . . . . . . . . . . Assembling and Disassembling a Compound Block Collapsing and Expanding a Compound Block . . Labeling and Saving a Compound Block . . . . . . Tunnels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 52 52 53 53 Overview of Compound Blocks Simulation models have the potential to become very large, possibly incorporating hundreds of blocks. Simulation Studio provides the ability to assemble blocks into larger aggregates called compound blocks. This feature encourages hierarchical model building and information hiding and also facilitates component reuse. Figure 6.1 shows a small model that contains a compound block which encapsulates a Numeric Source and Server block. Figure 6.2 displays the same model, this time with the compound block collapsed. For very large complicated models, compound blocks can greatly reduce the visual complexity and improve the interpretability of the model. Figure 6.1 Sample Compound Block 52 F Chapter 6: Compound Blocks Figure 6.2 Sample Compound Block—Collapsed Assembling and Disassembling a Compound Block To create or assemble blocks into a compound block: 1. With the pointer positioned in the appropriate Model window, hold down the Shift + Ctrl keys while simultaneously holding down the left mouse button and sweep out a rectangular area in the Model window encompassing the blocks you want to assemble into a compound block. When you release the mouse button and Shift + Ctrl keys, a red rectangle appears in the Model window replacing the sweep rectangle. All the blocks entirely within the rectangle also have a red highlight or selection box around them. 2. Right-click within this red rectangle, and select Assemble Compound. Selecting this menu item creates a new compound block that contains all the highlighted blocks. To disassemble a compound block, right-click a compound block and select Disassemble Compound from the resulting pop-up menu. Collapsing and Expanding a Compound Block To hide the contents of a compound block, double-click the compound block. This causes the visual representation of the compound block to be replaced with a small yellow square similar in size to a basic block icon. This is sometimes referred to as a collapsed compound block. Labeling and Saving a Compound Block F 53 To expand a collapsed compound block to its original size, double-click the collapsed compound block. Labeling and Saving a Compound Block As with basic blocks, you can edit the label associated with a compound block and switch between displaying and hiding it. It is often useful to give a compound block a descriptive, concise label that reflects its functionality or usage. Since the contents of a compound block are usually not visible, a good label can be particularly helpful for understanding its functionality in a simulation model. The procedure for saving a compound block to disk and also for adding it to a template for reuse purposes is identical to the procedure described in Chapter 5, “Blocks,” for basic blocks. Tunnels How do you connect ports on blocks external to a compound block with ports on blocks within a compound block? If the visual for the compound block is in an expanded state (as in Figure 6.1), then you can simply connect ports from any block to ports on blocks within the compound block as you would for any other block. However, if the compound block is collapsed, you have no way of knowing what blocks or ports are available to you inside the compound block. Usually when you create a compound block you have some specific functionality you want your group of blocks to perform, and you connect them in a very specific manner. You also know which blocks require inputs from outside of the compound block and which blocks pass output from the compound block. That is, you know which ports you are going to use as input ports and which ports you are going to use as output ports for the compound block to make it function as designed. Additional connections could potentially alter the desired functionality of your compound block in unpredictable ways. Simulation Studio provides a feature called a tunnel to facilitate input and output for a compound block. You can think of tunnels as special ports for a compound block. Blocks (and their ports) located outside the compound block that need to send information to the compound block connect to input tunnels defined on the compound block. Similarly, blocks expecting information from the compound block connect to its output tunnels. Blocks internal to the compound block that need connections outside the compound block also connect through tunnels. You add or remove tunnels for a compound block using the Add/Remove Tunnels dialog box (Figure 6.3) available through the pop-up menu on a compound block. This dialog box provides options for creating various types of ports on a compound block. You can also edit the default name given to a tunnel to something more meaningful for your compound block. The name cannot contain spaces. 54 F Chapter 6: Compound Blocks Figure 6.3 Tunnels Dialog Box Figure 6.4 depicts a compound block with an input entity tunnel, an output entity tunnel, and an input value tunnel. The placement of the various tunnel types around the compound block is automatic and is analogous to that of ports on basic blocks. The graphic used to depict a tunnel is a combination of the graphics used for an input port and output port because the tunnel serves both functions depending on whether your perspective is from inside the compound block or outside it. Figure 6.4 Compound Block with Tunnels If you collapse the compound block, as shown in Figure 6.5, the compound block appears much the same as a basic block. A compound block can be treated essentially as a “black box” in terms of functionality. Tunnels F 55 Figure 6.5 Collapsed Compound Block with Tunnels What happens to tunnels if you decide to disassemble the compound block? They turn into Connector blocks so that no functionality is lost in the simulation model. Figure 6.6 shows the result of disassembling the compound block in Figure 6.5. Figure 6.6 Result of Disassembling a Compound Block with Tunnels 56 Chapter 7 Entities Contents Overview of Entities Entity Types . . . . . Creating Entities . . Disposing of Entities Entity Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 57 58 59 59 Overview of Entities Entities are discrete objects that can traverse a simulation model or network. They can be used to represent physical or conceptual items in your model such as cars in a traffic model, telephone calls in a telecommunications system, customers in a retail environment, and so on. You can use various Simulation Studio blocks to assign attributes to entities as they flow through your simulation model and use other blocks to read entity attributes and act on them. When you have the animation feature turned on in Simulation Studio, you can view the movement of entities through your simulation model when it is executing. If the Tracer is enabled, entity information is also displayed on the Trace tab in Simulation Studio. Entity Types All of the examples in this document so far have used the default regular entity type. If you do not specify an EntityType in the Entity Generator block, then the default regular entity type is used. The Entity Types dialog box shown in Figure 7.1 enables you to add attributes to the default entity types, and it also enables you to create new entity types. Entity types can be defined at the model level. To open the Entity Types dialog box, right-click the model name in the Project Explorer and then select Entity Types. 58 F Chapter 7: Entities Figure 7.1 Entity Types Dialog Box User-created entity types can be either regular entities or resource entities. Both regular and resource entities can be processed using any of the blocks provided in the basic modeling template. Resource entities, however, also have capabilities that will be used by the blocks provided in the resource modeling template, which will be available in a future release of Simulation Studio. Unless otherwise specified, the term entity refers generically to either a regular entity or resource entity. Creating Entities The default basic modeling template provided with Simulation Studio contains two blocks capable of generating entities: the Entity Generator block and the Clone block. These blocks are described in Appendix A, “Basic Template.” Entity Generator blocks are usually the primary source of entities in your simulation models. You can specify the quantity and type of entities you want your Entity Generator blocks to generate. You also need to have a connection to the Entity Generator block’s InterArrivalTime input port so the Entity Generator can determine when to schedule the next entity creation event. Multiple entities can be created at each entity creation event by using the BatchSize input port on the Entity Generator block. (See the Entity Generator details in Appendix A, “Basic Template.”) There is no limit on the number of Entity Generator blocks you can have in your simulation model, and the limit on the number of entities of a given type you can generate is the Java programming language value Integer.MAX_VALUE. Disposing of Entities F 59 Disposing of Entities Although it is possible to generate an almost endless number of entities, each entity has associated memory costs. It is important to let Simulation Studio know when you are finished with an entity so that it can efficiently manage any memory issues related to entities. In a simulation model, you indicate you are finished using an entity by routing it to a Disposer block . Each simulation model should have at least one Disposer block. When an entity enters a Disposer block, it is marked as free and reduces memory allocation costs at run-time in the application. Entity Attributes Entities can have attributes associated with them. Attribute names must be unique, are case sensitive, and cannot contain spaces or blanks. Attribute values can be strings, numbers, or Java objects. Each entity has two default attributes named Id and BirthTime. The Id value is a unique integer assigned (in sequence) when the entity is created, and the BirthTime value is the simulation clock time when the entity was created. You can add additional default attributes (along with their default values) to an entity type by using the Entity Types dialog box at design time. (See Figure 7.1.) Each new entity created of that type automatically has all the attributes defined on that entity type as shown in the Entity Types dialog box. The Modifier block in your simulation model can also be used to add or modify other entity attributes at simulation time. Other blocks are provided in Simulation Studio to read entity attribute values and use this information in their processing. Individual blocks are discussed in Appendix A, “Basic Template.” As a simple example of using entity attributes, consider the scenario where you want to model an electronics repair shop. Your entities could represent customers coming into the repair shop, and you could assign attributes to each of these customers to represent what type of equipment they need repaired, an indicator of the severity of the problem, warranty information, and so on. You could then use these attributes to route customer entities to different technicians in the shop depending on the values of the attributes. You could use the severity attribute to calculate a time-to-repair value. Attributes are intended to give your entities unique characteristics that you can use to make your simulation model more representative of the system that you are investigating. 60 Chapter 8 Log and Trace Contents Overview of Logging and Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . Log Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Trace Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 61 62 Overview of Logging and Tracing The Log and Trace tabs (located at the bottom of the Project window) provide feedback during the execution of a simulation model. Both the application and individual blocks can post model execution state, event, and error information to these tabs while the model is running. The Log tab contains messages regarding potential configuration and execution state anomalies, warnings, and so on. The Trace tab (if the Tracer is enabled) usually displays simulation clock timestamps and state information for individual blocks as execution progresses. Log Tab Messages can be posted to the Log tab by both the application framework and the individual blocks. Each message consists of four components: level, description, source, and time. The value in the Level column represents the severity of the log message; possible values include SEVERE, WARNING, and INFO. A SEVERE log message indicates a major problem has been encountered with the simulation model, and execution is terminated. Figure 8.1 displays a SEVERE log message from an Entity Generator block. To function properly, an Entity Generator block requires a connection to its InterArrivalTime input port from which it can pull numeric values. That connection appears to be missing in this example. A WARNING message usually suggests that a condition has occurred that warrants further investigation. An example of such a condition might be a block receiving a negative number when it was expecting a nonnegative value. An INFO message simply contains information but does not indicate a potential problem. 62 F Chapter 8: Log and Trace The Time column in the Log tab displays the (simulation clock) time when the message was logged. Some messages, such as the one in the SEVERE log message example in Figure 8.1, can be logged before the model execution actually begins; therefore the Time value is empty for these messages. The Description column contains the message text, and the Source column displays the label of the block that generates the message. Clicking an entry in the Source column causes the associated block to be highlighted in the Model window. Figure 8.1 Sample Log Tab Trace Tab Trace messages provide details about state changes, events, and execution flow within individual blocks; they are useful for debugging or tuning your simulation models. The Tracer must be enabled before any trace messages are generated. You can enable the Tracer by using the pop-up menu available on the Trace tab background. The following types of entries are displayed on the Trace tab: simulation clock timestamps (displayed in black) entity information (displayed in red) value information (displayed in blue) When the Tracer is enabled, a timestamp is posted to the Trace tab every time the simulation clock advances. All other trace messages are generated by the individual blocks. Each block is responsible for the content of its trace messages and for determining when to generate trace messages. Although it is possible (and likely) for any simulation model execution to generate a considerable volume of trace messages, the Trace tab has a limited size buffer associated with it to store the messages. Therefore, only the most recent trace messages are retained in the trace buffer after the buffer is full. Figure 8.2 shows a sample Trace tab. Trace Tab F 63 Figure 8.2 Sample Trace Tab 64 Chapter 9 Block Templates Contents Overview of Block Templates . . . . . . Using the Template Menu . . . . . . . . Using the Template Palette Pop-up Menu Template Document Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 66 66 67 Overview of Block Templates Simulation Studio templates provide a facility for managing the blocks you use to build your simulation models, and the Simulation Studio template palette offers a visual representation of template content. A Simulation Studio template contains information about a collection of blocks. This information is stored as an XML document. There is no limit on the number of templates you can load into Simulation Studio. The content of any loaded template can be viewed in the Template Palette area of the application. As discussed in Chapter 3, “Simulation Models,” you drag an item from the Simulation Studio palette into a Model window to create an instance of the associated block in your simulation model. When Simulation Studio starts, it automatically loads a default template named basic, which provides a collection of blocks useful for building queuing simulation models. These blocks include Entity Generators, Queues, Servers, and so on; they are described in detail in Appendix A, “Basic Template.” This collection of blocks will evolve in succeeding Simulation Studio releases. You can also create a custom template and save it to a data file for later use either by using selections described in “Using the Template Palette Pop-up Menu” on page 66 to modify an existing template or by creating a template XML document as described in “Template Document Format” on page 67. Although there are no constraints on the contents of a template (other than the element format described in “Template Document Format” on page 67), you usually create a collection of blocks that have some theme in common. For example, you might create a template with blocks for simulating a manufacturing environment, or you might create a template with blocks specifically designed to address health care services simulation. 66 F Chapter 9: Block Templates Using the Template Menu You use the Template menu to load an existing template saved on disk, create a new (empty) template, or save a loaded (probably modified) template back to disk. To load an existing template into Simulation Studio, select Open. This opens a File Selection dialog box where you choose the template filename and then click Open. The chosen template is then loaded into the application, and the template name is added to the Templates list box. Selecting a template name in the Templates list box causes the Template Palette area of Simulation Studio to be populated with the items contained in the associated template. Only one template is active at any time. Using the Template Palette Pop-up Menu A pop-up menu is available on the Template Palette window area background with options for various palette display formats with various combinations of icons and labels. (See Figure 9.1.) Figure 9.1 Template Palette Menu In addition to the palette formatting options, this menu contains three other items: Block Info, Remove Block, and Import Block. Select Block Info to view template information that is related to a particular item displayed in the palette. Select Remove Block to delete an item from the palette. Select Import Block to add a new entry to the currently visible template (that is, the template displayed in the palette). Selecting Import Block opens a dialog box that contains fields where you enter the same information found in the Block Info dialog box. (This is the same information found in a block element entry in a template XML document.) Template Document Format F 67 Template Document Format Figure 9.2 shows a simple template XML document that contains one block. The <block> element in a template document represents a single item in the template. The <block> element attributes and child elements are listed and described in the header in Figure 9.2. Only the name and type attributes are required in each <block> element. The information in any <tabbed_page> child elements in a <block> element represent the dialog pages that are associated with the Block Properties dialog box for each block. Figure 9.2 Sample Template Document 68 Chapter 10 Data Collection, Analysis, and Reporting Contents Overview . . . . . . . . . . Data Collection . . . . . . . Block Data Storage . . . . . Data Analysis and Reporting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 69 70 72 Overview Running simulation models has the potential to generate large volumes of data. The subject matter of your simulation investigation or the sophistication of your model often dictates what type of data you need to collect from each of your simulation runs along with the amount of data required to perform an appropriate analysis. Different stages of model development might also have different data collection requirements. For example, when you are initially building and debugging your model, you might collect data that will not be necessary after the model is validated. Simulation Studio provides various blocks with data collection capabilities and plots for displaying data. The experiment features in Simulation Studio provide another way to collect data. (See Chapter 4, “Experiments.”) After you have collected and saved your data from simulation runs, SAS and JMP software offer many options for analyzing the data and generating reports. Since data analysis and reporting requirements vary widely for different simulation scenarios, this chapter focuses on the data collection aspects of Simulation Studio. Data Collection For the purposes of this document, data collection refers to the process of collecting values while a simulation model is running and also to saving the values to data files for later analysis and reporting. Although plot and chart blocks (Histogram, Scatter Plot, and so on) can display data in Simulation Studio, they do not collect any data. Therefore, they are not considered part of the data collection process. 70 F Chapter 10: Data Collection, Analysis, and Reporting There are currently five blocks in the basic template that can collect and save data: the Bucket, Number Holder, Probe, Queue Stats Collector, and Server Stats Collector blocks. The specifics on the functionality of these blocks, along with the types of information they can collect, are provided in Appendix A, “Basic Template.” Two features that all these blocks have in common (in addition to being able to collect data) are the ability to save their collected data to a file and an option to automatically save the data at the end of each simulation run. After the data are stored in a file (a SAS data set or JMP table), you can use your favorite analysis software to investigate your data and generate reports. Each of these blocks accumulates data in an internal Java object referred to as a data model. This data model can be accessed by other blocks via the OutData port on the data collection blocks. The contents of the data model can also be saved to an external data file. Block Data Storage Simulation Studio saves the data collected by blocks on a project basis and employs a hierarchical approach for data storage. For each project you can supply the root directory name for any data collection results by using the Results menu item available on the project pop-up menu in the Project Explorer window. (See Figure 10.1.) Figure 10.1 Project Menu Selecting Results opens the Results dialog box where you enter the name of the root directory to be used for storing model execution results. You can supply the filename associated with an individual block’s data storage by using the block’s Block Properties dialog box. If you do not provide a filename, a default one is generated automatically. Simulation Studio creates a hierarchical directory structure to store any results based on the hierarchical structure of the model. This structure reflects any nesting of blocks due to the use of compound blocks. Another Simulation Studio feature provided to facilitate data collection is the Auto Save Results menu item available from the model pop-up menu in the Project Explorer window. (See Figure 10.2.) Block Data Storage F 71 Figure 10.2 Model Menu Recall that all blocks capable of collecting and saving data provide an option to automatically save any collected data at the end of each simulation run. This option is usually set in the Block Properties dialog box for each individual block. If you have a considerable number of blocks that are collecting data in your model or the collection blocks are nested in compound blocks, it might take a considerable amount of effort to open all the individual dialog boxes and make the appropriate selections. Using a hierarchical format, the Auto Save Results dialog box displays all the blocks in the model with data collection capabilities. (See Figure 10.3.) From here you can set the automatic save option for any of these blocks by selecting the appropriate check boxes in the dialog box. This enables you to avoid opening the individual block dialog boxes. Figure 10.3 Auto Save Results Dialog Box A Simulation Studio experiment provides another option for collecting data on simulation runs. Recall from Chapter 4, “Experiments,” that experiments are composed of factors and responses where factors are set prior to running an experiment and responses are values extracted from the model at the end of a simulation run. Since experiments can be saved to a file, this offers another 72 F Chapter 10: Data Collection, Analysis, and Reporting means of collecting simulation data. As discussed in Appendix C, “Design of Experiments,” you can pass experiment data to JMP software (if available) using the Analyze Results menu item from an Experiment window pop-up menu. Data Analysis and Reporting Each block that collects data provides an output port (usually labeled OutData) that other blocks can use to access its data. The plot blocks (Histogram, Scatterplot, and so on) are the usual recipients of this data, and these blocks can provide some real-time data analysis while the simulation is running. However, usually you want to use SAS or JMP software to analyze the data you have saved to data sets during your simulation runs. If you collected data using the Simulation Studio experiment features in coordination with JMP routines for design of experiments, you probably want to pass the experimental results back to the JMP program for analysis. This process is described in Appendix C, “Design of Experiments.” Chapter 11 Batch Execution Contents Overview of Batch Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command Line Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Log Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 73 74 Overview of Batch Execution Everything in this document so far has focused on using the Simulation Studio GUI to construct and run simulation models. You build your simulation model in the Model window, create your experiment, and then save and run your simulation model. To rerun a saved model, you reload it into a project (along with an associated experiment) and start the model execution process. Simulation Studio provides an alternative method for running saved models and experiments that does not involve using the GUI. Simulation Studio is a Java application, and it contains a Java class named Simulation that enables you to run models in batch mode. Command Line Interface The Java class Simulation accepts two command line arguments: -m and -e. The -m argument specifies the pathname for a Simulation Studio model you want to execute, and the -e argument specifies the experiment pathname. You can use this Java class with the Java interpreter to run simulation models from a Microsoft Windows command prompt. Usually, you want to change directories to the directory where you installed Simulation Studio and launch the Java interpreter from that point. (The current default installation location is \Program Files\SAS\SimulationStudio\<release_number> .) A sample command line for executing a model-experiment pair looks like this: $java -classpath SASSimulation.jar com.sas.analytics.simulation.Simulation -m projectsnMyProjectnMyModel.simmdl -e projectsnMyProjectnMyExperiment.simexp 74 F Chapter 11: Batch Execution You must supply the appropriate classpath arguments for the Java interpreter to be able to locate the Java classes in your model. The classpath options provided in the previous example should be sufficient for the Java interpreter to locate any classes provided in the basic template delivered with Simulation Studio. Log Messages Any log messages generated during the execution of a model are directed to the command prompt window. Appendix A Basic Template Contents Overview of the Basic Template . . . . . . . . . Source Blocks . . . . . . . . . . . . . . . . . . . Entity Generator Block . . . . . . . . . . . Value Generator Block . . . . . . . . . . . Clone Block . . . . . . . . . . . . . . . . Numeric Source Block . . . . . . . . . . . Text Source Block . . . . . . . . . . . . . Time Now Block . . . . . . . . . . . . . . Queue Blocks . . . . . . . . . . . . . . . . . . . Description Common to All Queue Blocks FIFO Queue Block . . . . . . . . . . . . . LIFO Queue Block . . . . . . . . . . . . . Priority Queue Block . . . . . . . . . . . . Server Blocks . . . . . . . . . . . . . . . . . . . Server Block . . . . . . . . . . . . . . . . Delay Block . . . . . . . . . . . . . . . . Attribute Blocks . . . . . . . . . . . . . . . . . Modifier Block . . . . . . . . . . . . . . . Extractor Block . . . . . . . . . . . . . . Gate Block . . . . . . . . . . . . . . . . . Display Blocks . . . . . . . . . . . . . . . . . . Number Holder Block . . . . . . . . . . . String Holder Block . . . . . . . . . . . . Logic Blocks . . . . . . . . . . . . . . . . . . . Switch Block . . . . . . . . . . . . . . . . Data Collection and Analysis Blocks . . . . . . . Bucket Block . . . . . . . . . . . . . . . . Probe Block . . . . . . . . . . . . . . . . Server Stats Collector Block . . . . . . . . Queue Stats Collector Block . . . . . . . . Other Blocks . . . . . . . . . . . . . . . . . . . Counter Block . . . . . . . . . . . . . . . Disposer Block . . . . . . . . . . . . . . . Formula Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 77 77 79 81 82 83 84 85 85 86 86 87 88 88 89 90 90 91 92 93 93 95 96 96 97 97 99 101 103 105 105 106 107 76 F Appendix A: Basic Template Plot Blocks . . . . . . Histogram Block BarChart Block . Scatterplot Block Boxplot Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 109 110 111 112 Overview of the Basic Template The Simulation Studio basic template provides a fundamental collection of blocks you can use to build your simulation model. More blocks will be added to the basic template as they become available in future releases of Simulation Studio. The following sections provide overviews of the functionality of the various blocks in the basic template. Each block description includes a brief summary of what the block does along with a description of the controls in the block’s properties dialog box. Also included are the Factor and Response candidates associated with each block for use with the experiment features in Simulation Studio. Entity Generator Block F 77 Source Blocks Entity Generator Block Description The Entity Generator block generates entities. You can control when the entities are created, how many entities are created, and how many entities are created simultaneously. After an entity is created, the Entity Generator attempts to send the new entity out the OutEntity port. If this fails, it then tries to push the entity out the OutBalk port. If this also fails, the entity is destroyed and a message is sent to the Tracer. Multiple entities can be generated every time an entity creation event occurs in an Entity Generator. The number of entities to create at an entity creation event is referred to as the batch size. When the Entity Generator is preparing to schedule an entity creation event, it attempts to pull a value from its BatchSize port and associates this value with the entity creation event. (If nothing is connected to the BatchSize port, it uses a default batch size of 1.) When the actual entity creation event occurs in the Entity Generator, the Entity Generator creates the number of entities specified in the associated batch size value (within the constraints of the maximum number of entities limit). All entities are sent out individually either through the OutEntity port or the OutBalk port. You can specify the maximum number of entities that the Entity Generator can generate in addition to the maximum number of batches. The Entity Generator stops creating entities whenever either of these limits is reached. Fields are provided to set the start and end time (in terms of the simulation clock) for controlling the duration of operation of the block. The Signal port can be used to initiate entity creation as well. When a non-false value arrives at the Signal port, the Entity Generator pulls values from its InterArrivalTime and BatchSize ports and schedules an entity creation event. If the Signal port receives a false value, all events scheduled for this Entity Generator are removed from the simulation event queue and disposed. You can use the Entity Types dialog box to specify the types of entities the Entity Generator block can create. Open the Entity Types dialog box using the Entity Types menu item available from the model pop-up menu in the Project Explorer window. You can enter default values for any of the editable entity attribute fields in the Entity Types dialog box. 78 F Appendix A: Basic Template Properties Dialog Box Controls Limits The Maximum Number of Entities field specifies the maximum number of entities this Entity Generator is permitted to generate. Selecting the Infinite check box supersedes the value of the Maximum Number of Entities field. Similarly, the Maximum Number of Batches field specifies the maximum number of batches of entities this Entity Generator is permitted to generate. Selecting the Infinite check box supersedes the value of the Maximum Number of Batches field. If both of these fields contain valid values, the Entity Generator stops creating new entities as soon as either of the criteria has been met. Timing The Start Time field designates the simulation time at which the first entity is generated by this Entity Generator. This value must be greater than 0. Similarly, the End Time field specifies the simulation time when no more entities can be generated by the Entity Generator. The End Time must be greater than or equal to the Start Time. Selecting the Infinite check box supersedes the value of the End Time field. First Entity Creation Specifies when the first entity is created by the Entity Generator. Select At Start Time to cause the first entity to be created at the time specified in the Start Time field. If you select At First Interarrival Time, the Entity Generator pulls the first interarrival time value from the InterArrivalTime port and schedules the first entity to be created at that time. The pulled value determines how long the Entity Generator waits before generating the first entity. (Whenever the interarrival time value is not a number, the simulation terminates. If the value is a number but less than 0, the Entity Generator logs a warning and uses a value of 0.) If you select After Signal Arrival, the Entity Generator waits until a non-false value arrives at the Signal port before scheduling the first entity creation. To Schedule the Creation of Next Entity If you select this check box, after the Entity Generator has created a new entity and pushed it downstream, it automatically pulls a value from its InterArrivalTime port and uses this value to schedule the generation of the next entity creation. If you clear this check box, future entity creation events can be scheduled only using the Signal port. Candidates for Design of Experiments Factors StartTime (double), EndTime (double), MaxEntities (integer), MaxBatches (integer) Responses None Value Generator Block F 79 Value Generator Block Description The Value Generator block generates values. The Value Generator pulls a value from its InterValueTime port to determine how long it waits before generating the next value. If the intervalue time value is not a number, the simulation terminates. If the value is less than 0, the Value Generator logs a warning and uses a value of 0. After the Value Generator has a valid intervalue time value, it pulls a value from its InValue port and passes it out the OutValue port. If there are no connections to the InValue port, the value specified in the Default Value field is passed out the OutValue port. You can specify the maximum number of values the Value Generator can generate in addition to the start and end times (in terms of the simulation clock) for controlling the operation of the block. You can also specify when the first value is created. Properties Dialog Box Controls Values The Maximum Number of Values Generated field specifies the maximum number of values this Value Generator is permitted to generate. Selecting the Infinite check box supersedes the value of the Maximum Number of Values Generated field. The Default Value field specifies the value to use when the InValue port has no connections. Timing The Start Time field designates the simulation time at which the first value is generated by this Value Generator. This value must be greater than 0. Similarly, the End Time field specifies the simulation time when no more values can be generated by the Value Generator. The End Time must be greater than or equal to the Start Time. Selecting the Infinite check box supersedes the value of the End Time field. First Value Determines when the first value is created by the Value Generator. Select Start Time to cause the first value to be created at the time specified in the Start Time field. If you select First Intervalue Time, the Value Generator pulls the first intervalue time value from the InterValueTime port and schedules the first value to be created at that time. 80 F Appendix A: Basic Template Candidates for Design of Experiments Factors StartTime (double), EndTime (double), MaxValues (integer), DefaultValue (double) Responses None Clone Block F 81 Clone Block Description The Clone block creates copies (clones) of entities that pass through it. A clone is a new entity with all the same attributes as the original entity. When an entity enters a Clone block, the block first determines whether anything is connected to its NumClonesPerPort port. If it finds a connection, the Clone block attempts to pull a value from the NumClonesPerPort port. This value represents the number of clones of the original entity that the Clone block generates for each clone output port. If there are no connections to the NumClonesPerPort port, the Clone block uses its default value for the number of clones to generate per clone output port. You can set the number of clone output ports. If no clone output ports exist, the new clone entities are pushed to the OutEntity port. The original entity is always the first entity to exit the Clone block, and it exits via the OutEntity port. Properties Dialog Box Controls Clones Per Port Specifies how many clones are generated for each clone output port. This value is used only if there are no connections to the NumClonesPerPort port. Cloning Ports Specifies how many clone output ports are available on this block. Candidates for Design of Experiments Factors ClonesPerPort (integer) Responses None 82 F Appendix A: Basic Template Numeric Source Block Description The Numeric Source block uses a pseudo-random number generator to provide a source of random variation. It also provides the ability to read numbers from a SAS data set or JMP table. You can select from a collection of discrete and continuous distributions, or you can provide the pathname for the SAS data set or JMP table along with the numeric variable column name. Each time a value is pulled from the OutValue port of a Numeric Source block, the block generates a sample from its related distribution or reads a value from the data set, whichever is appropriate. If the last observation of a data set is reached, the process resets to the beginning of the column. Properties Dialog Box Controls Type Specifies the distribution to sample from. (See Appendix B, “Random Variation in a Model,” for a description of available distributions.) The Parameters area is updated to reflect the selected distribution. Parameters Provides fields for modifying the parameter values associated with the selected distribution. Each distribution has a Random Stream Seed entry field. You can specify a seed value in this field instead of allowing Simulation Studio to automatically assign a different seed for each source of randomness. The value in this field can be any integer in the range from 0 to the value of the Java constant Long.MAX_VALUE. For a SAS data set or JMP table, fields to enter the File Path and Variable Name are displayed. Candidates for Design of Experiments Factors DataStreamDescription (text) Responses None Text Source Block F 83 Text Source Block Description The Text Source block provides the ability to read strings from a SAS data set or JMP table. You supply the pathname for the SAS data set or JMP table along with the text variable column name. Each time a value is pulled from the OutValue port of a Text Source block, the block reads a value from the data set. If the last observation in the data set is reached, the process resets to the beginning of the column. Properties Dialog Box Controls FilePath Click this button to open a File Chooser dialog box for selecting the pathname for the SAS data set or JMP table. Column Name Specifies the column name from the SAS data set or JMP table. Candidates for Design of Experiments Factors DataStreamDescription (text) Responses None 84 F Appendix A: Basic Template Time Now Block Description Use the Time Now block to access the current simulation time while the model is running by pulling a value from the OutValue port. Candidates for Design of Experiments Factors None Responses None Queue Blocks F 85 Queue Blocks Description Common to All Queue Blocks All queue blocks are used for transient storage of entities. Three types of queue blocks are available: FIFO Queue, LIFO Queue, and Priority Queue. This section describes functionality that is common to all three types. Following sections describe any differences. When a request to send (or push) an entity arrives at a queue block, the queue block determines whether it has room to store the entity. If the queue is full, the queue block rejects the request to have the entity sent to it. If space is available in the queue, the queue block responds that it can accept the entity. When an entity arrives at a FIFO Queue or LIFO Queue block, the entity is stored at the appropriate end of the queue’s buffer. For Priority Queue blocks, the queue extracts the priority value from an attribute defined for the entity and uses that value to determine where to place the entity in the queue’s buffer. For more information, see “Priority Queue Block” on page 87. The queue then sequentially notifies each block connected to its EntityOut port to ask whether it is ready to receive an entity. The queue block selects an entity (based on the protocol of the queue block—FIFO, LIFO, or priority) to send to the first downstream block that responds affirmatively. When a queue is no longer full (due to an entity leaving the queue block or the queue block’s capacity being increased), the queue block attempts to pull entities from upstream until it is at capacity or no entities are available to pull. If the queue’s Reneging option is activated, after an entity enters the queue, the queue attempts to pull a numeric value from its InRenegeWait port. If the queue pulls a nonnegative number from the port, it schedules a time for the entity to exit the queue via the OutRenege port if the entity is still in the queue at that time. The InCapacity port dynamically sets the Capacity value of the queue. Any time an entity enters or exits the queue, the queue pushes the value of the queue’s length (the number of entities being held by the queue) to the queue’s OutLength port. Any time an entity exits the queue via its OutEntity port, the queue pushes a value that represents how long that entity waited in the queue to the queue’s OutWait port. If the capacity of a queue block is reduced dynamically during the simulation run, any excess entities are removed from the queue (using the block’s queueing protocol) and are sent out the OutBalk port. If there are no connections to the OutBalk port, the entities are destroyed. Properties Dialog Box Controls Capacity Specifies the maximum number of entities this queue is permitted to store. Selecting the Infinite check box supersedes any Capacity value. 86 F Appendix A: Basic Template Reneging Selecting this check box activates the queue’s automatic reneging functionality. Candidates for Design of Experiments Factors Capacity (integer) Responses AverageWait, MaximumWait, AverageLength, MaximumLength, BalkCount, RenegeCount FIFO Queue Block Description This queue uses a first-in-first-out protocol for determining the order of entities leaving the queue. LIFO Queue Block Description This queue uses a last-in-first-out protocol for determining the order of entities leaving the queue. Priority Queue Block F 87 Priority Queue Block Description This queue uses a priority protocol for determining the order of entities leaving the queue. This queue block differs from the other queue blocks as follows: When an entity arrives, the queue extracts the priority value from an attribute defined for the entity and uses that value to determine where to place the entity in the queue buffer. You can specify the name of the entity attribute that the queue looks for in the entity. You can also specify a default priority value to use when the queue block does not find a valid priority value in the entity. This queue block has additional properties dialog box controls named Priority Values as follows: Entity Attribute Specifies the name of the attribute to use when extracting the priority value from an entity. Default Priority Specifies the priority value to use for an entity when the queue cannot extract a valid priority value from the entity. Tie Breaking Specifies the algorithm to use for placing entities in the queue’s buffer when entities have the same priority value. Algorithm options include FIFO, LIFO, and random placement. This queue block offers the following factors in addition to the Capacity (integer) factor available for other queue block types: Factors DefaultPriorityValue (double), PriorityAttributeName (text) 88 F Appendix A: Basic Template Server Blocks Server Block Description The Server block models a resource used by an entity for a specified period of time. An entity can enter a Server only when the server is not busy. If an entity is sent to a Server when the Server is busy, the entity is immediately sent out the Server’s OutBalk port. After an entity enters the Server, the Server pulls a value from its InServiceTime port. If the service time value is not a number, the simulation terminates. If the value is less than 0, the Server logs a warning and uses a value of 0. The entity is held for the duration of the service time and then released out the OutEntity port. You can specify the number of servers available in a Server block (also known as the Server block’s capacity). This value represents the number of entities the Server can service simultaneously. Pushing an entity’s ID into the Server’s InPreempt port causes that entity (if it is still being serviced) to be immediately sent out the Server’s OutBalk port. If the value pushed to the InPreempt port is the value of the Java constant Integer.MAX_VALUE, all entities being serviced are preempted. The InCapacity port can be used to set the capacity for a Server block. Prior to the beginning of each experimental run, the server determines whether anything is connected to the InCapacity port. If a connection exists, the server attempts to pull a value from whatever is connected to the InCapacity port in order to initialize the capacity of the server. If it pulls a valid value, the server initializes its capacity to that value; otherwise, it ignores the pulled value and logs a warning message. Properties Dialog Box Controls Number of Servers The Value field specifies the capacity of this Server block. Candidates for Design of Experiments Factors Capacity (integer) Responses AvgUtilization, MaxUtilization Delay Block F 89 Delay Block Description The Delay block delays the progression of an entity through a simulation model. When an entity enters a Delay block via its InEntity port, the Delay block pulls a value (the delay time) from its InDelay port. If the delay time value is not a number, the simulation terminates. If the value is less than 0, the Delay block logs a warning and uses a value of 0. The Delay block holds the entity for the duration of the delay time and then releases it through its OutEntity port. If the push through the OutEntity port fails, the Delay block attempts to push the entity out the OutBalk port. If this is not successful, the entity is destroyed and a message is posted to the Tracer. Candidates for Design of Experiments Factors None Responses None 90 F Appendix A: Basic Template Attribute Blocks Modifier Block Description The Modifier block assigns attributes to an entity as it passes through the block. Each attribute has an input port associated with it. When an entity enters the block, values are pulled from the input ports and assigned to the associated attributes in the entity. Properties Dialog Box Controls Add Adds a new attribute with a default Name, Type, and Default value to the Attribute Table. You can change the Name, Type, and Default value of the attribute directly in the table. The attribute names in the Modifier block’s Attribute Table must be unique. You can change the attribute Type through a drop-down box on the cell in the table. (An attribute Type cannot be changed in the table after the Apply button is clicked. If you want to change an attribute Type after Apply has been clicked, you must remove the attribute, add it again, and then modify the Type of the newly added attribute before clicking Apply.) Remove Deletes an attribute that has been selected from the Attribute Table. Apply Updates all attributes in the Modifier block as specified in the Attribute Table, and creates or deletes value ports as needed. Candidates for Design of Experiments Factors None Responses None Extractor Block F 91 Extractor Block Description The Extractor block extracts attribute values from an entity as it passes through the block. Each attribute in the Extractor block’s Attribute Table has an output port associated with it. When an entity enters the block, entity attribute values are retrieved from the entity and pushed to their respective output ports. You can also use the Extractor block in conjunction with an input value port of another block without any connections to its InEntity port. For example, you can connect an attribute output port of an Extractor block to the InServiceTime port of a Server block. After an entity enters the Server block, it is passed to the Extractor block (via the InServiceTime port) to extract the appropriate entity attribute value to be used for the InServiceTime value. Properties Dialog Box Controls Add Adds a new attribute with a default Name and Type to the Attribute Table. You can change the Name and Type of the attribute directly in the table. The attribute names in the Extractor block’s Attribute Table must be unique. You can change the attribute Type through a drop-down box on the cell in the table. (An attribute Type cannot be changed in the table after the Apply button is clicked. If you want to change an attribute Type after Apply has been clicked, you must remove the attribute, add it again, and then modify the Type of the newly added attribute before clicking Apply.) Remove Deletes an attribute that has been selected from the Attribute Table. Apply Updates all attributes in the Extractor block as specified in the Attribute Table, and creates or deletes value ports as needed. Candidates for Design of Experiments Factors None Responses None 92 F Appendix A: Basic Template Gate Block Description The Gate block provides a facility to pull and push multiple values every time an entity enters the block. For each attribute defined on a Gate block, an input value port and an output value port is created on the block. When an entity enters a Gate block, the block steps through its list of attributes, first pulling from the input value port associated with the attribute and then pushing the value retrieved to the output value port associated with the attribute. If there are no connections to the input value port, the Gate block uses the Default value associated with that attribute. Properties Dialog Box Controls Add Adds a new attribute with a default Name, Type, and Default value to the Attribute Table. You can change the Name, Type, and Default value of the attribute directly in the table. The attribute names in the Gate block’s Attribute Table must be unique. You can change the attribute Type through a drop-down box on the cell in the table. (An attribute Type cannot be changed in the table after the Apply button is clicked. If you want to change an attribute Type after Apply has been clicked, you must remove the attribute, add it again, and then modify the Type of the newly added attribute before clicking Apply.) Remove Deletes an attribute that has been selected from the Attribute Table. Apply Updates all attributes in the Gate block as specified in the Attribute Table, and creates or deletes value ports as needed. Candidates for Design of Experiments Factors None Responses None Number Holder Block F 93 Display Blocks Number Holder Block Description The Number Holder block displays a number that represents some user-defined state information. Values can be pushed to or pulled from a Number Holder block via its InData and OutData ports. A Number Holder block automatically attempts to push any value received at its InData port out its OutData port. Similarly, when a request comes in to pull a value from the OutData port, a Number Holder block by default attempts to pull a value from upstream using its InData port. You can modify this default behavior by using the Propagation controls on a Number Holder block. By default a Number Holder block displays the last value to enter through its InData port. However, options are available to display the minimum value, maximum value, mean value, sum of all values, or a count of how many values have entered the block. A Number Holder block attempts to push the displayed value out its OutDisplayed port every time the value is updated. The data collection facility of the Number Holder block provides the capability of storing values that enter it. This data can be saved to a SAS data set or JMP table. Values (along with time stamps) are stored in a SimDataModel, and the SimDataModel can be accessed through the block’s OutCollected port. Display blocks, such as the Histogram block, are often connected to a Number Holder block’s OutCollected port to visualize the data. Any block using a SimDataModel is automatically notified when the data in the SimDataModel is modified. Properties Dialog Box Controls: Attributes Tab Current Specifies the last value to enter the Number Holder block. The value entered here is displayed in the block (if the Display option is set to Value) until a new value enters the block. Default Initializes the Current Value in the Number Holder block when it is created or when the block is reset. Display Controls which value is displayed on the Number Holder block. Options include the current Value, Minimum, Maximum, or Mean value, the 94 F Appendix A: Basic Template Sum of all values, or the Count of how many values have entered the block. Propagation The To Downstream check box controls propagation of values sent to the InData port of a Number Holder block. If the check box is selected, any values entering the InData port are automatically sent out the OutData port. Otherwise, the value propagation stops at the Number Holder block. If the From Upstream check box is selected, then any attempt to pull a value from the OutData port of a Number Holder block results in the Number Holder block attempting to pull a value from any blocks connected to its InData port. Data Collection The Collect Data check box turns data collection on or off. The value entered in the Capacity field determines how many values are saved in the SimDataModel. If the capacity is exceeded, a warning message is logged and values are overwritten in the SimDataModel. Properties Dialog Box Controls: Save Tab Automatic Save Turns on or off automatic saving of any collected data at the end of a model run. If automatic saving is turned on, data are saved to a file with the name specified in the Filename field. Save Now Forces the Number Holder block to attempt an immediate save of any collected data. Data are saved to a file with the name specified in the Filename field. Filename Names the SAS data set or JMP table that is used to save any collected data. Candidates for Design of Experiments Factors DefaultValue (double) Responses MeanValue, SumOfValues, MinimumValue, MaximumValue, Count String Holder Block F 95 String Holder Block Description The String Holder block displays a string that represents user-defined state information. Values can be pushed to or pulled from a String Holder block via its InData and OutData ports. A String Holder block displays the last value to enter through its InData port. Properties Dialog Box Controls Current Displays the last value to enter the String Holder block. The value entered here is displayed in the block until a new value enters the block. Default Initializes the Current value in the String Holder block when it is created or when the block is reset. Candidates for Design of Experiments Factors DefaultValue (text) Responses None 96 F Appendix A: Basic Template Logic Blocks Switch Block Description The Switch block directs the flow of an entity through a simulation model. You define switch cases on the Switch block. The case names must be unique, and each switch case must have an integer value (called the switch value) associated with it. When an entity enters a Switch block, the block calculates the switch value to be used for the entity. Depending on the Switch block options active in the block, the block either attempts to extract the switch value from an attribute in the entity or pulls it from the InSwitchValue port. After the switch value is acquired, the Switch block searches the cases in its Case Table until it finds a case with the same switch value. The entity is then pushed out the entity out port associated with the matching case. If a match is not found, the entity is sent out the OutBalk port. Properties Dialog Box Controls Add Adds a new switch case to the Case Table with a default Name and Value. You can edit the Name and Value of the switch case directly in the table. The case names and values used by a Switch block must be unique. Remove Deletes a switch case that has been selected from the Case Table. Switch Value If you select the Port option, the Switch block pulls the switch value from the InSwitchValue port. If you select the Entity option, you must also supply the name of the attribute in the Entity Attribute field. The Switch block attempts to extract the switch value from the appropriate attribute on the entity. Apply All values in the Case Table are pushed to the Switch block and any entity output ports are created or deleted as needed. Candidates for Design of Experiments None Bucket Block F 97 Data Collection and Analysis Blocks Bucket Block Description The Bucket block extracts and stores entity attribute values from entities that enter the block. Attributes to be extracted from the entity are identified in the Bucket block’s Attribute Table. When an entity enters the block, entity attribute values are retrieved from the entity and stored in a SimDataModel. By default, the Bucket block extracts the Time and Age attributes from each entity that passes through it. The age of the entity is calculated and pushed to the bucket’s OutLatestAge port. The SimDataModel can be accessed through the block’s OutData port. Display blocks, such as the Histogram block, are often connected to a Bucket block’s OutData port to visualize the data. Any block that uses a SimDataModel is automatically notified when the data in the SimDataModel is modified. The Bucket block can save values it extracts to a SAS data set or JMP table. Saving options are available on the Save tab of the Properties dialog box. Properties Dialog Box Controls: Attributes Tab Add Adds a new attribute with a default Name and Type to the Attribute Table. You can edit the Name and Type of the attribute directly in the table. The attribute names listed in the Bucket block’s Attribute Table must be unique. You can change the attribute type through a drop-down box on the cell in the table. (An attribute Type cannot be changed in the table after the Apply button is clicked. If you want to change an attribute Type after Apply has been clicked, you must remove the attribute, add it again, and then modify the Type of the newly added attribute before clicking Apply.) Remove Deletes an attribute that has been selected from the Attribute Table. Capacity Controls how many observations the Bucket block stores. If the capacity is exceeded, a warning is logged and observations are overwritten. 98 F Appendix A: Basic Template Properties Dialog Box Controls: Save Tab Automatic Save Turns on or off automatic saving of any collected data at the end of a model run. If automatic saving is turned on, data are saved to a file with the name specified in the Filename field. Save Now Forces the Bucket block to attempt an immediate save of any collected data. Data are saved to a file with the name specified in the Filename field. Filename Names the SAS data set or JMP table that is used to save any collected data. Candidates for Design of Experiments Factors Capacity (integer) Responses None Probe Block F 99 Probe Block Description The Probe block pulls and stores other block state information values at specified time intervals. Attributes to be pulled from other blocks are named in the Probe block’s Attribute Table. The names are arbitrary but must be unique within each Probe block. When values are pulled from other block ports, the values are stored in a SimDataModel. The SimDataModel can be accessed through the block’s OutData port. Display blocks, such as the Histogram block, are often connected to a Probe block’s OutData port to visualize the data. Any block that uses a SimDataModel is automatically notified when the data in the SimDataModel is modified. Each attribute in the Probe block’s Attribute Table has an input value port associated with it. At the specified time interval, the Probe block attempts to pull values from each of its attribute input ports and store those values in its SimDataModel instance. You can control the frequency with which the Probe block pulls values. The Probe block can save values it extracts to a SAS data set or JMP table. Properties Dialog Box Controls: Attributes Tab Add Adds a new attribute with a default Name and Type to the Attribute Table. You can edit the Name and Type of the attribute directly in the table. The attribute names listed in the Probe block’s Attribute Table must be unique. You can change the attribute type through a drop-down box on the cell in the table. (An attribute Type cannot be changed in the table after the Apply button is clicked. If you want to change an attribute Type after Apply has been clicked, you must remove the attribute, add it again, and then modify the Type of the newly added attribute before clicking Apply.) Remove Deletes an attribute that has been selected from the Attribute Table. Capacity Controls how many observations the Probe block stores. If the capacity is exceeded, a warning is logged and observations are overwritten. Poll Interval Selecting the Constant option and entering a valid value in the Interval field causes the Probe block to pull at a constant time interval. Selecting the Port option causes the Probe block to pull a value from the InPollInterval port to determine its next sampling time. If you select the Port option, a valid numeric 100 F Appendix A: Basic Template source, such as a Random Stream block, must be connected to the Probe block’s InPollInterval port. Properties Dialog Box Controls: Save Tab Automatic Save Turns on or off automatic saving of any collected data at the end of a model run. If automatic saving is turned on, data are saved to a file with the name specified in the Filename field. Save Now Forces the Probe block to attempt an immediate save of any collected data. Data are saved to a file with the name specified in the Filename field. Filename Names the SAS data set or JMP table that is used to save any collected data. Candidates for Design of Experiments Factors Capacity (integer), PollingInterval (double) Responses None Server Stats Collector Block F 101 Server Stats Collector Block Description The Server Stats Collector block accumulates statistics generated by blocks in your model that implement the ServerStatsGenerator interface. In the Properties dialog box associated with the Server Stats Collector block, you can select from a list of available blocks the ones you want to collect statistics from. By default, statistics are gathered from the selected blocks at the end of each simulation run. Options are provided to collect data on a continuous basis (whenever the data changes) or to force an instantaneous update of the data. The Server Stats Collector block can store values that it collects using its data collection facility. This data can be saved to a SAS data set or JMP table. Values are stored in a SimDataModel, and the SimDataModel can be accessed through the block’s OutCollected port. Display blocks, such as the BarChart block, are often connected to a Server Stats Collector block’s OutCollected port to visualize the data. Any block using a SimDataModel is automatically notified when the data in the SimDataModel is modified. Properties Dialog Box Controls: Attributes Tab Add Selects one or more blocks to collect statistics from. Remove Removes one or more blocks from the list of blocks to collect statistics from. Apply All blocks marked for collection are saved to the Server Stats Collector block. Continuous Collection Turns on or off statistics collection whenever a monitored block changes state. Now Forces the Server Stats Collector block to attempt an immediate collection update of any statistics. Properties Dialog Box Controls: Save Tab Automatic Save Turns on or off automatic saving of any collected data at the end of a model run. If automatic saving is turned on, data are saved to a file with the name specified in the Filename field. 102 F Appendix A: Basic Template Save Now Forces the Server Stats Collector block to attempt an immediate save of any collected data. Data are saved to a file with the name specified in the Filename field. Filename Names the SAS data set or JMP table that is used to save any collected data. Candidates for Design of Experiments Factors None Responses None Queue Stats Collector Block F 103 Queue Stats Collector Block Description The Queue Stats Collector block accumulates statistics generated by blocks in your model that implement the QueueStatsGenerator interface. In the Properties dialog box associated with the Queue Stats Collector block, you can select from a list of available blocks the ones you want to collect statistics from. By default, statistics are gathered from the selected blocks at the end of each simulation run. Options are provided to collect data on a continuous basis (whenever the data changes) or to force an instantaneous update of the data. The Queue Stats Collector block can store values that it collects using its data collection facility. This data can be saved to a SAS data set or JMP table. Values are stored in a SimDataModel, and the SimDataModel can be accessed through the block’s OutCollected port. Display blocks, such as the BarChart block, are often connected to a Queue Stats Collector block’s OutCollected port to visualize the data. Any block using a SimDataModel is automatically notified when the data in the SimDataModel is modified. Properties Dialog Box Controls: Attributes Tab Add Selects one or more blocks to collect statistics from. Remove Removes one or more blocks from the list of blocks to collect statistics from. Apply All blocks marked for collection are saved to the Queue Stats Collector block. Continuous Collection Turns on or off statistics collection whenever a monitored block changes state. Now Forces the Queue Stats Collector block to attempt an immediate collection update of any statistics. Properties Dialog Box Controls: Save Tab Automatic Save Turns on or off automatic saving of any collected data at the end of a model run. If automatic saving is turned on, data are saved to a file with the name specified in the Filename field. 104 F Appendix A: Basic Template Save Now Forces the Queue Stats Collector block to attempt an immediate save of any collected data. Data are saved to a file with the name specified in the Filename field. Filename Names the SAS data set or JMP table that is used to save any collected data. Candidates for Design of Experiments Factors None Responses None Counter Block F 105 Other Blocks Counter Block Description The Counter block counts the number of entities that pass through it. If the OutCount value port has any connections to it, the Counter block pushes its count value to the port every time it changes. After an entity enters the Counter block, the block determines whether any block downstream of the Counter block’s OutEntity port can accept the entity before pushing the entity out the OutEntity port. If this acceptance fails, the entity is either pushed out the OutBalk port or destroyed if there are no connections to the OutBalk port. Candidates for Design of Experiments Factors None Responses Count 106 F Appendix A: Basic Template Disposer Block Description The Disposer block disposes of entities after they are no longer needed in the model, reducing memory usage. Each simulation should have at least one Disposer block. Each time an entity enters a Disposer block, that entity is marked as free and available for reuse by the system. A count of the number of entities that have entered the disposer is kept in the block. If there are connections to the block’s OutCount port, the count is pushed out the port every time its value changes. Candidates for Design of Experiments Factors None Responses OutCount Formula Block F 107 Formula Block Description The Formula block can evaluate an equation based on state or model information. First you create variables to be used in the equation (called input variables), and then you formulate them into an expression that is evaluated every time a value is pulled from the Formula block. The value associated with an input variable can come either from an entity attribute or from an input value port. If the source for an input variable is designated to be a port, an input value port is created on the block and associated with the appropriate input variable. Whenever a value is requested from a Formula block, the Formula block first acquires values associated with its input variables and then attempts to evaluate its expression. The result of this evaluation is then pushed out the OutValue port. Properties Dialog Box Controls: Formula Tab Add Adds a new input variable with a default Name, Type, and Source to the Input Variables Table. You can edit the Name, Type, and Source of the variable directly in the table. The variable names listed in the Formula block’s Input Variables Table must be unique. You can change the Type through a drop-down box on the cell in the table. (A variable Type cannot be changed in the table after the Apply button is clicked. If you want to change a variable Type after Apply has been clicked, you must remove the variable, add it again, and then modify the Type of the newly added variable before clicking Apply.) Remove Deletes a variable that has been selected from the Input Variables Table. Expression Contains the equation to be evaluated each time a value is pulled from the block. Any variables used in the equation must be defined in the Input Variables Table. Operators available for use in this equation include boolean (&&, ||, !), arithmetic (+, -, *, /, %), and equality or inequality (<, >, <=, >=, ==, !=) operators. Functions available include trigonometric (sin, cos, tan, asin, acos, atan, sinh, cosh, tanh) and logarithmic (exp, log, ln) functions along with floor, ceil, round, min, max, and power functions. In addition, you can use conversion functions degrees and radians to convert between degrees and radians. You can 108 F Appendix A: Basic Template use the concat function to concatenate strings. Two logical functions, cond and switch are also provided. The format for the cond function is cond(boolean expression, true return value, false return value). The value returned by this function is determined by evaluating its boolean expression. The format for the switch function is switch(boolean expression1, value1, boolean expression2, value2, ..., default value). The value returned by the switch function is the value following the first boolean expression that evaluates to TRUE. The default value is returned if none of the boolean expressions is true. Expression Result Identifies the value type that results from evaluating the equation. The selected option generates the appropriate output port type for the Formula block. Apply Validates the Expression and saves the Input Variables, the Expression, and the Expression Result. Input ports are created or deleted as needed. Properties Dialog Box Controls: Advanced Tab This feature has not yet been implemented. In a future release of Simulation Studio you will be able to create Expression Variables that are functions of Input Variables. Expression Variables will be available for use in the formulation of the Formula Expression. Candidates for Design of Experiments Factors None Responses None Histogram Block F 109 Plot Blocks Histogram Block Description The Histogram block creates a visual estimate of the distribution of data from a continuous variable. The range of the variable is divided into a certain number of subintervals or bins. The height of the bar in each bin is proportional to the number of data points that have values in that bin. The Histogram block expects a SimDataModel as input via its InData port. Some examples of blocks that can produce SimDataModels as output are the Bucket, Number Holder, and the various Stats Collector blocks. You must supply the name of the variable from the SimDataModel to be used to construct the histogram bins or bars. Context-sensitive pop-up menus are available on the plot for manipulating various aspects of the plot such as axis scaling. Properties Dialog Box Controls Name Specifies the name of the variable from the SimDataModel to use to create the histogram. Candidates for Design of Experiments Factors None Responses None 110 F Appendix A: Basic Template BarChart Block Description The BarChart block graphically depicts the distribution of data from a discrete variable. The height of each bar represents the number of data points in each category. The BarChart block expects a SimDataModel as input via its InData port. Some examples of blocks that can produce SimDataModels as output are the Bucket, Number Holder, and the various Stats Collector blocks. You must supply the names of the X and Frequency variables from the SimDataModel to be used to construct the BarChart display. Context-sensitive pop-up menus are available on the plot for manipulating various aspects of the plot such as axis scaling. Properties Dialog Box Controls Variables Specifies the names of the X and Frequency variables from the SimDataModel to use to create the bar chart. Candidates for Design of Experiments Factors None Responses None Scatterplot Block F 111 Scatterplot Block Description A Scatterplot block displays a graphical representation of the relationship between two variables. The Scatterplot block expects a SimDataModel as input via its InData port. Some examples of blocks that can produce SimDataModels as output are the Bucket, Number Holder, and the various Stats Collector blocks. You must supply the names of the X and Y variables from the SimDataModel to be used to construct the scatter plot display. Context-sensitive pop-up menus are available on the plot for manipulating various aspects of the plot such as axis scaling. Properties Dialog Box Controls Variables Specifies the names of the X and Y variables from the SimDataModel to use to create the scatter plot. Candidates for Design of Experiments Factors None Responses None 112 F Appendix A: Basic Template Boxplot Block Description The Boxplot block is a schematic summary of the distribution of data from a continuous numeric variable. The central line in a box plot indicates the median of the data, and the bottom and top of the box indicate the first and third quartiles (that is, the 25th and 75th percentiles). Extending from the box are whiskers that represent data that are a certain distance from the median. Beyond the whiskers are outliers—observations that are relatively far from the median. The Boxplot block expects a SimDataModel as input via its InData port. Some examples of blocks that can produce SimDataModels as output are the Bucket, Number Holder, and the various Stats Collector blocks. You must supply the name of the Y variable from the SimDataModel to be used to construct the Boxplot display. Optionally, you can also provide the name of a variable to be used as a Group variable for producing individual box plots for each unique category found in the Group variable. Context-sensitive pop-up menus are available on the plot for manipulating various aspects of the plot such as axis scaling. Properties Dialog Box Controls Variables Specifies the name of the Y variable from the data model to use to create the box plot. Optionally, you can provide the name of the Group variable from the data model to use to create multiple box plots. Candidates for Design of Experiments Factors None Responses None Appendix B Random Variation in a Model Contents Overview of Random Variation . . . . . . . . . . . . Discrete Distributions . . . . . . . . . . . . . . . . . Binomial . . . . . . . . . . . . . . . . . . . . Discrete Uniform . . . . . . . . . . . . . . . . Geometric . . . . . . . . . . . . . . . . . . . Negative Binomial . . . . . . . . . . . . . . . Poisson . . . . . . . . . . . . . . . . . . . . . Continuous Distributions . . . . . . . . . . . . . . . Beta . . . . . . . . . . . . . . . . . . . . . . . Chi-Square . . . . . . . . . . . . . . . . . . . Erlang . . . . . . . . . . . . . . . . . . . . . Exponential . . . . . . . . . . . . . . . . . . . Gamma . . . . . . . . . . . . . . . . . . . . . Johnson Bounded Distribution (JohnsonSB) . Johnson Unbounded Distribution (JohnsonSU) Lognormal . . . . . . . . . . . . . . . . . . . Normal . . . . . . . . . . . . . . . . . . . . . Pearson Type V . . . . . . . . . . . . . . . . Pearson Type VI . . . . . . . . . . . . . . . . Triangular . . . . . . . . . . . . . . . . . . . Uniform . . . . . . . . . . . . . . . . . . . . Weibull . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 117 117 117 117 118 118 119 119 119 119 120 120 120 121 122 122 122 122 123 123 124 Overview of Random Variation Random and exogenous sources of variation play a central role in discrete event simulation. Blocks such as the Entity Generator, Value Generator, Server, and Delay blocks usually require a connection to a numeric source of variation in Simulation Studio models. The principal sources of variation are the Numeric Source and Formula blocks. The functionality of these blocks is described in Appendix A, “Basic Template,” but this section also provides a quick overview. Both the Numeric Source and Formula blocks provide an OutValue output port to which other blocks can connect to 114 F Appendix B: Random Variation in a Model pull numeric values. The values produced by these blocks are dependent on their parameter settings. Figure B.1 shows the Block Properties dialog box for a Numeric Source block with the default settings. The Type list box provides a list of the statistical distributions available in Simulation Studio for sampling purposes. You select a distribution from the Type list and then supply the desired parameters in the approripate fields for the distribution that you have chosen. (The details about the distributions available in Simulation Studio are presented later in this appendix.) When a request for a sample comes into the Numeric Source block, the block generates a value based on its parameter settings. Figure B.1 Sample Numeric Source Block Dialog Box The Type list also includes an option, SAS Data Column, to read values from a SAS data set or JMP data table as opposed to generating a value itself. You can use this feature when you have created or collected data from a source outside Simulation Studio that you now want to use as your source of variation. When using this option in the Numeric Source block, you must supply the file pathname along with the column or variable name in the data set. (See Figure B.2.) Simulation Studio uses the filename extension to determine whether the file is a SAS data set or JMP data table. If a filename extension is not specified, Simulation Studio assumes the file is of the type (SAS data set or JMP table) specified in the Default Data Format section of the SAS Simulation Configuration dialog box. Overview of Random Variation F 115 Figure B.2 Sample Numeric Source Block That Uses a SAS Data Set You can also use the Formula block to write a function that returns a number to be used as a sample. Figure B.3 shows a sample Block Properties dialog box for the Formula block. You define input variables in the Input Variables area and then use these variables to write an algebraic expression in the Expression area. The values associated with the input variables can come either from ports on the Formula block or from attributes defined on the incoming entity. You can formulate the expression to represent the source of variation that you require. Each time a value is pulled from the Formula block, its expression is evaluated and the resulting value is passed out the OutValue port. See the description of the Formula block in Appendix A, “Basic Template,” for additional details about this block. 116 F Appendix B: Random Variation in a Model Figure B.3 Sample Formula Block Dialog Box Discrete Distributions F 117 Discrete Distributions Binomial The probability mass function of the binomial distribution is p.x/ D nŠ p x .1 xŠ.n x/Š p/n x for x 2 Œ0; 1; : : : ; n. Parameters: n is a positive integer that represents the number of independent Bernoulli trials. p 2 Œ0; 1 is the probability of success on each trial. Discrete Uniform The probability mass function of the discrete uniform distribution is p.x/ D j 1 i C1 for x 2 Œi; i C 1; : : : ; j , where i and j are integers with i j . Parameters: i j is a location parameter. i is a scale parameter. Geometric The probability mass function of the geometric distribution is p.x/ D p.1 for x 2 f1; 2; : : : g. p/x 1 118 F Appendix B: Random Variation in a Model Parameter: p 2 .0; 1/ is the probability of success on each trial. Negative Binomial The probability mass function of the negative binomial distribution is p.x/ D .n C x 1/Š n p .1 xŠ.n 1/Š p/x for x 2 f0; 1; : : : g. Parameters: n is a positive integer 1 which represents the number of successes in a series of independent Bernoulli trials. p 2 .0; 1/ is the probability of success on each trial. Poisson The probability mass function of the Poisson distribution is p.x/ D e x xŠ for x 2 f0; 1; : : : g. Parameter: is the mean, > 0. Continuous Distributions F 119 Continuous Distributions Beta The density function of the beta distribution is f .x/ D .˛ C ˇ/ .˛/.ˇ/.b a/˛Cˇ 1 .x a/˛ 1 .b x/ˇ 1 for a x b. The gamma function .z/ is defined for any real number z > 0 as 1 Z .z/ D tz 1 e t dt 0 Parameters: a is the minimum value, a < b. b is the maximum value. ˛>0 is a shape parameter. ˇ>0 is a shape parameter. Chi-Square The chi-square distribution with k degrees of freedom is the same as the gamma distribution with ˛ D k2 and D 2. Parameter: k is an integer 1 which represents the degrees of freedom. Erlang The Erlang distribution is a special case of the gamma distribution. The density function of the Erlang distribution is f .x/ D 1 .k 1/Š k x k 1 e x 120 F Appendix B: Random Variation in a Model where x 0. Parameters: is a real number > 0. k is an integer 1. If X1 ; X2 ; : : : ; Xk are independent exponential random variables with mean , then X1 C X2 C C Xk has the k-Erlang distribution. Exponential The density function of the exponential distribution is f .x/ D 1 e x where x 0. Parameter: is the mean, > 0. Gamma The density function of the gamma distribution is f .x/ D ˛ x˛ 1e x .˛/ where x 0. The function .z/ is defined in the section “Beta” on page 119. Parameters: ˛ is the shape parameter, ˛ > 0. is the scale parameter, > 0. Johnson Bounded Distribution (JohnsonSB) The density function of the Johnson bounded distribution (JohnsonSB) is Johnson Unbounded Distribution (JohnsonSU) F 121 ı 0 x f .x/ D p g exp 2 ! 1 x 2 CıC 2 where g.y/ D ln g 0 .y/ D y 1 y 1 y.1 y/ and x 2 Œ; C . Parameters: ı (delta) is a shape parameter, ı > 0. (gamma) is a shape parameter. (xi) is the location parameter. (lambda) is the scale parameter, > 0. Johnson Unbounded Distribution (JohnsonSU) The density function of the Johnson unbounded distribution (JohnsonSU) is ı 0 x exp f .x/ D p g 2 ! 1 x 2 CıC 2 where h i p g.y/ D ln y C y 2 C 1 g 0 .y/ D p 1 y 2 C1 and x 2 . 1; 1/. Parameters: ı (delta) is a shape parameter, ı > 0. (gamma) is a shape parameter. (xi) is the location parameter. (lambda) is the scale parameter, > 0. 122 F Appendix B: Random Variation in a Model Lognormal The density function of the lognormal distribution is 1 f .x/ D p exp x 2 2 .ln.x/ /2 2 2 where x > 0. Parameters: is the mean of ln.x/ Normal.; 2 /. is the standard deviation of ln.x/ Normal.; 2 /, > 0. Normal The density function of the normal distribution is f .x/ D p 1 2 2 e .x /2 2 2 for all real values of x. Parameters: is the mean, 2 . 1; 1/. is the standard deviation, > 0. Pearson Type V The Pearson Type V distribution has the same density function as the gamma distribution with shape parameter ˛ and scale parameter D ˇ1 . Parameters: ˛ is the shape parameter, ˛ > 0. ˇ is the scale parameter, ˇ > 0. Pearson Type VI The density function of the Pearson Type VI distribution is Triangular F 123 ˛1 f .x/ D x ˇ 1 h i˛1 C˛2 ˇG.˛1 ; ˛2 / 1 C ˇx where x > 0 and G.˛1 ; ˛2 / D .˛1 /.˛2 / .˛1 C ˛2 / The function .z/ is defined in the section “Beta” on page 119. Parameters: ˛1 is a shape parameter, ˛1 > 0. ˛2 is a shape parameter, ˛2 > 0. ˇ is a scale parameter, ˇ > 0. If X1 and X2 are independent random variables with X1 Gamma.˛1 ; ˇ/ and X2 X1 Gamma.˛2 ; 1/, then Y D X PearsonTypeVI.˛1 ; ˛2 ; ˇ/. 2 Triangular The density function of the triangular distribution is ( f .x/ D 2.x a/ .m a/.b a/ 2.b x/ .b m/.b a/ axm m<xb where a, b, and m are real numbers with a < m < b. Parameters: a is the minimum. b is the maximum. m is the mode. Uniform The density function of the uniform distribution is 124 F Appendix B: Random Variation in a Model ( f .x/ D 1 b a axb 0 otherwise where a and b are real numbers with a < b. Parameters: a is the minimum. b is the maximum. Weibull The density function of the Weibull distribution is f .x/ D ˛ˇ ˛ ˛ 1 x e x ˛ .ˇ / for x > 0. Parameters: ˛ is the shape parameter, ˛ > 0. ˇ is the scale parameter, ˇ > 0. Appendix C Design of Experiments Contents Define Factors and Responses . . . . . Set Model Anchors . . . . . . . . . . . Set Up the Experiment Window . . . . Generate a Design Using JMP Software Run the Experiment . . . . . . . . . . . Analyze the Simulated Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 126 128 130 131 132 This chapter uses the repair shop example in Chapter 1, “Overview of SAS Simulation Studio,” to demonstrate how you can use JMP software to generate experimental designs for a Simulation Studio model. One of the goals in that example is to ease the bottleneck at the quality control station. Suppose you have the option of adding additional workers at the service desk, repair desk, and quality control station so that each station can have one, two, or three workers. These are the factors of your experiment. The responses you could monitor are the average utilizations at all three stations (to make sure workers are not idle or overworked), the number of fixed parts, and the average waiting time at each of the three stations. Since you now have three factors, each defined at three levels, you might want to generate an experimental design (such as a full or fractional factorial design) to guide your simulation runs. This is a more efficient way to explore the effects of different parameters on your model responses than just randomly selecting combinations of your factor values to try. You can do this with the Simulation Studio Experiment window and JMP software. Define Factors and Responses To set up your experimental design, first define three factors for the project: NumQC, NumRepair, and NumService to represent the number of workers at each of the three stations. See Chapter 4, “Experiments,” for more details about factors. To define the factors, first right-click the project name in the project window and select Factors to open the Factor Creation dialog box. Also define seven responses for the project by right-clicking the project name again and selecting Responses to open the Response Creation dialog box. Figure C.1 and Figure C.2 show the Factor Creation and Response Creation dialog boxes for the repair shop model. 126 F Appendix C: Design of Experiments Figure C.1 Factor Creation Dialog Box Figure C.2 Response Creation Dialog Box Set Model Anchors After you have established the database of factors and responses for the project, you need to link each factor and response to a specific block in the model. To do this, right-click in the Model window and select Anchors to open the Anchors dialog box. Click New to open the New Anchor dialog box where you can link a block in your model to your defined factor. For example, as shown in Figure C.3, the capacity of the Service Desk block is linked to the factor NumService. The Set Model Anchors F 127 responses are linked to blocks in a similar fashion, as shown in Figure C.4. You can also define new factors and responses for the project directly from the New Anchor window. Figure C.3 Factor Anchors 128 F Appendix C: Design of Experiments Figure C.4 Response Anchors Set Up the Experiment Window After all factors and responses have been linked to blocks in the model, you need to include them in the experiment. To include factors, right-click in the Experiment window and select Factor Inclusion. In the Factor Inclusion dialog box, you can select the factors defined for your project that you want to include in the experiment. See Figure C.5. Include responses in the experiment in similar fashion by right-clicking in the Experiment window and selecting Response Inclusion. See Figure C.6. The Experiment window with all factors and responses included is shown in Figure C.7. The end time for all design points has been changed to 2700 minutes, and the number of replications has been changed to 5 by right-clicking in the Experiment window and selecting Properties. The Properties dialog box for the Experiment window enables you to set default values for StartTime, EndTime, and Replicates. Each new design point has the default values for these parameters. Set Up the Experiment Window F 129 Figure C.5 Including Factors in the Experiment Figure C.6 Including Responses in the Experiment Figure C.7 Experiment Window with Factors and Responses Included 130 F Appendix C: Design of Experiments Generate a Design Using JMP Software Now you are ready to generate a JMP experimental design. First, ensure that the JMP server has been launched. See Chapter 2, “Introduction to SAS Simulation Studio.” Then, right-click in the Experiment window and select Make Design from the pop-up menu. To use the Make Design option, the Experiment window must include at least one factor and one response. The default design created by the JMP custom designer is automatically passed back to the Experiment window in Simulation Studio. You can alter the JMP design by adding additional design points, replicates, or interaction terms. See the JMP documentation for specific information about design of experiments. However, you must create all factors and responses in Simulation Studio since they must be linked to specific model blocks. If you create new factors or responses in the JMP program, they will not be passed back to Simulation Studio. If any changes are made to the JMP design, you must click the Commit button in the JMP Simulation Studio DOE window to automatically pass the new design back to Simulation Studio. Figure C.8 shows the JMP Simulation Studio DOE window with the Commit button in the top left corner. Run the Experiment F 131 Figure C.8 JMP Simulation Studio DOE Window for the Repair Shop Model Run the Experiment To run the experiment in Simulation Studio, highlight all the rows in the table by holding down the left mouse button on the first design point and dragging the mouse to highlight all the remaining design points. Now click the Play icon on the toolbar to run all replications of all the design points. Figure C.9 shows the Experiment window after running all 12 design points. By default, the value reported for each response is the average over all five replications. To view the minimum or maximum value over all replications, right-click in the column header for a response and select Summary. The resulting dialog box enables you to display the average, minimum, or maximum value for the selected response. You can view the individual response values for each of the five replications for each design point by clicking the blue arrow next to the number of replications within 132 F Appendix C: Design of Experiments a design point. Figure C.10 shows the five replications for design point 1. To hide the replication results, click the blue arrow again. Figure C.9 Experiment Window Showing Simulated Results Figure C.10 Experiment Window Showing Results for All Five Replications of Design Point 1 Analyze the Simulated Results From the results in Figure C.9, design point 6 (which represents three workers at quality control, one worker at the repair desk, and two workers at the service desk) seems to satisfy the goal of reducing the bottleneck at the quality control station while providing a reasonable balance between the waiting time and the utilization at all three stations. However, you can also use the JMP software to conduct a more formal statistical analysis of the results. For example, you can estimate a statistical model (or metamodel) that can be used for prediction purposes. To pass the simulated results in the Experiment window back to the JMP GUI, right-click in the Experiment window (be sure the Reset button has been pushed) and select the Analyze Results option. This automatically creates a JMP data table with the results for all replications of all the design points. The Experiment window must include at least one factor and one response in order to use the Analyze Results option. Note that the JMP table for this experiment has 60 rows, one for each of the five replicates for each design point. See Figure C.11. Analyze the Simulated Results F 133 To fit a model to the results, click Model and then Run Script in the JMP Simulation Studio DOE Analyzer window to open the Model Specification window. See the JMP documentation for specific details about how to estimate models. Figure C.11 JMP Simulation Studio DOE Analyzer Window From the JMP Simulation Studio DOE Analyzer window, you can also choose to augment the design. Select the Run Script option from the Augment This Design menu (in the upper left corner of Figure C.11) to open the JMP Augment Design window. See Figure C.12. See the JMP documentation for details about using the JMP augment design feature. If you make any changes in the Augment Design window, you can click Commit to pass the augmented design back to Simulation Studio. Figure C.13 shows the Experiment window in Simulation Studio after selecting the JMP default augmented design. Six design points are added, and one replication is added to design point 2. You can run the new design points by highlighting all rows in the Experiment window and then clicking Augment on the Run menu or the Augment icon on the toolbar. Only points with new or additional replications (such as point 2) are run. For example, one additional run of point 2 is made, and then the new points 13–18 are run. Notice that the design points in the Experiment window might now be in a different order than they were before augmenting the design. For example, design point 1 in Figure C.10 is now design point 4 in Figure C.13, but the results are the same. 134 F Appendix C: Design of Experiments Figure C.12 JMP Augment Design Window Figure C.13 Experiment Window after Using the JMP Augment Design Feature Appendix D Input Analysis Contents Overview of Input Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Input Analysis Using JMP Software . . . . . . . . . . . . . . . . . . . . . . . . . 135 135 Overview of Input Analysis When you build a simulation model of a system, part of the process is likely to include analyzing data in various formats so that they can be used as inputs to drive the simulation model. This data might be in the form of raw data sets that must be read directly by the simulation model or from which a statistical distribution must be estimated and then sampled in the model. In any case, extreme care must be taken to determine appropriate inputs for a simulation model because the accuracy of a model’s output data is directly dependent on how accurately the inputs are estimated. Input Analysis Using JMP Software In the case where data are available and you want to estimate a statistical distribution from them, you can use the JMP distribution fitting tool. From Simulation Studio, you can quickly access the JMP distribution fitting tool by selecting Input Analysis from the Analyze menu, as shown in Figure D.1. Before you select this option, make sure the JMP server has been launched. (See the section “Launching SAS and JMP Servers” on page 18 in Chapter 2, “Introduction to SAS Simulation Studio,” for details.) Figure D.1 Input Analysis Menu Entry 136 F Appendix D: Input Analysis After you select Input Analysis, Simulation Studio displays a message box to alert you that the JMP server is waiting for input from you. (See Figure D.2.) Figure D.2 JMP Request Message After you click OK in this message box, change focus to your JMP window where you are directed to an Open Data File dialog box. In this dialog box, select the location of the data file that you want to analyze. After you open the data file, the JMP distribution fitting tool opens and you then select appropriate variables from your data set. Figure D.3 shows an example of this step for a data set that contains one variable labeled bvar. Figure D.3 JMP Distribution Fitting Dialog After you have selected the data set and variables, you can use the JMP distribution fitting tool to estimate an appropriate statistical distribution for the data. See the JMP documentation for specific information about fitting distributions to data. After you have decided on the distribution you want to use to approximate your data, you select the entry for that distribution in the appropriate Numeric Source Block Properties dialog box in your Simulation Studio model. You then manually enter Input Analysis Using JMP Software F 137 the parameters for that distribution into the appropriate fields in the dialog box. Note that the JMP definition for some distributions might be different from the Simulation Studio definition, so be careful when mapping distribution parameters from a JMP distribution to a Simulation Studio distribution. It is also possible that JMP software provides support for distributions that Simulation Studio does not, and vice versa. 138 Appendix E Examples of Simulation Studio Models Contents Overview of Simulation Studio Model Examples A Simple M/M/1 Queueing Model . . . . . . . . Routing to Shortest Queue . . . . . . . . . . . . Reneging from a Queue . . . . . . . . . . . . . . Repair Shop Model . . . . . . . . . . . . . . . . PERT Network Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 139 141 144 147 149 Overview of Simulation Studio Model Examples This chapter provides examples of several modeling structures, and it illustrates uses and combinations of various blocks. The examples are meant only to show how you can use Simulation Studio to model various applications. They are not meant to show how you would analyze or evaluate these models or identify optimal parameterizations. The actual model contruction process is not included in these example descriptions. A Simple M/M/1 Queueing Model Chapter 1, “Overview of SAS Simulation Studio,” first introduced this example, and it is discussed here because of its wide applicability. An M/M/1 queueing model is used for many different reallife situations such as customers checking out at a supermarket, customers at a bank, and so on. This model illustrates the basic concepts involved in building models in Simulation Studio, and it is a good starting point for constructing more sophisticated models. In some ways this example is analogous to the “hello, world” introductory example used to illustrate many programming languages. 140 F Appendix E: Examples of Simulation Studio Models Figure E.1 An M/M/1 Queueing Model The details for building and running the M/M/1 queueing model depicted in Figure E.1 are provided in Chapter 1, “Overview of SAS Simulation Studio”; rather than repeating them here, this section provides suggestions for experimenting with this model to familiarize yourself with various features and functionality in Simulation Studio. This model provides a good vehicle for acquainting yourself with the Log and Trace features in Simulation Studio. If you delete the link between the blocks labeled Interarrival Time and Arriving Customers and then attempt to run the model, a SEVERE level message is posted to the log with the description “Arriving Customers has no inter-arrival time connections.” The model does not run. SEVERE log messages always halt the execution of the simulation model. Reconnect the Interarrival Time and Arriving Customer blocks and change the distribution associated with the Interarrival Time block with one that is likely to produce negative numbers. When you run the model now, you will probably eventually see a WARNING message posted to log with the message “Arriving Customers inter-arrival time value is negative; using 0.0 instead.” The simulation continues to run after WARNING messages are posted. If you enable the Tracer facility (Chapter 8, “Log and Trace”) and then run the model, trace messages are generated by the various blocks and displayed in the Trace window. Each line in the Trace window contains the name of the block that creates the message and a short description of the event. An example trace message here might be “Numeric Source: Sampling, value = 0.136.” The Tracer facility can generate many, many trace messages. You can also use this model to practice defining factors, responses, and anchors and then use them to set up a simple experiment. The details about defining factors, responses, and anchors are found in Chapter 4, “Experiments.” For this example you can define a factor for changing the capacity of Routing to Shortest Queue F 141 the Teller block and a response for recording the average wait time at the FIFO Queue block. After you create anchors between the new factor and response to the appropriate blocks in the model, you can include the factor and response in an Experiment window. Once the factor and response are included in an Experiment window, you can create multiple design points with different values for the capacity factor and run the experiment and compare the results. It is easy to extend this M/M/1 model to incorporate many other Simulation Studio blocks and features such as data collection, plots, and so on to familiarize yourself with these capabilities so you can apply them later in more sophistocated models. Routing to Shortest Queue This example demonstrates how to use Switch and Formula blocks to route entities to the queue that has the shortest length when multiple queues are available. It also illustrates statistics collection and visualization using the Queue Stats Collector block, the Bucket block, and various Plot blocks. Entities are created according to an exponential distribution with a mean of 1. Figure E.2 shows three queues in which entities wait for a single server. Entities are routed to the queue with the shortest length. If all three queues have the same length, the entity routes to Queue1. The time it takes for each entity to be served is sampled from an exponential distribution with a mean of 1. The simulation is run for 5,000 time units, and the Entity Generator block shuts down after 4,970 time units to make sure that entities are being pulled from all three queues. (By default, the server checks Queue1 first to determine whether any entities are waiting, and then Queue2, and then Queue3. So entities move out of Queue3 only if Queue1 and Queue2 are empty.) Figure E.2 Routing Example 142 F Appendix E: Examples of Simulation Studio Models After the Entity Generator block creates an entity, the entity flows to the Switch block for routing to the desired queue. When an entity arrives at the Switch block, the Switch block pulls a value from the Formula block attached to the Switch block’s InData port. Figure E.3 shows the Formula block’s expression. The Formula block pulls the queue length from each of the queues in the model and then returns a value of 1, 2, or 3 to the Switch block based on the comparison of the queue lengths. Figure E.3 Routing Formula The Switch block attempts to match the value returned by the Formula block with the cases defined on the Swtich block. (See Figure E.4.) The entity is then pushed out the port associated with the matched case. Figure E.4 Routing Switch Cases When the Server block becomes available, it attempts to pull an entity from a link connected to its InEntity port. In this example, three links are connected to the Server block’s InEntity port. By convention in Simulation Studio, the pull is attempted from the first link connected to the Server block’s InEntity port during the model construction process. If this is unsuccessful, the Switch Routing to Shortest Queue F 143 block attempts to pull from the second link, and so on. In this example, the link from Queue1 to the Server block was created first, followed by the link from Queue2 to the Server block, and finally from Queue3 to the Server block. Figure E.5 shows the model in Figure E.2 extended to use the Queue Stats Collector block and the Bucket block to collect statistics and data. Figure E.5 Sample Routing Example Results The Bucket block is configured to collect the age attribute of every entity that passes through it and store the value in a SimDataModel. The SimDataModel is passed to a Histogram block where the user has selected to display a histogram of the age variable from the incoming SimDataModel. The Queue Stats Collector block in the model has been configured to collect data on all three queues. (See Figure E.6.) 144 F Appendix E: Examples of Simulation Studio Models Figure E.6 Queue Stats Collector Dialog Box By default, the Queue Stats Collector block saves the following information for each queue it monitors: Time the time the statistic was recorded BlockName name of the queue BlockId numeric ID of the queue InCount number of entities that enter the queue OutCount number of entities that exit the queue via the OutEntity port BalkCount number of entities that exit the queue via the OutBalk port RenegeCount number of entities that exit the queue via the OutRenege port QLength length of the queue at time Time AvgQLength average length of the queue MaxQLength maximum length of the queue AvgWait average wait time in the queue MaxWait maximum wait time in the queue The data is saved in a SimDataModel that is accessible through the OutData port of the Queue Stats Collector block. For this example the Queue Stats Collector block sends its SimDataModel to a Bar Chart block, where the AvgQLength is displayed for each queue. (See Figure E.5.) Reneging from a Queue This model demonstrates the reneging feature of a Queue block along with the use of the Modifier, Extractor, and Gate blocks. Two very different applications of the Extractor block are depicted in Reneging from a Queue F 145 this example. A special feature of the Number Holder block is also illustrated here. This example assumes a queueing system in which customers arrive randomly over time with one server to process customers. Individual customers wait in the queue for service on a first-in-first-out basis. After waiting 5 minutes in the queue, a customer reneges (that is, leaves the queue and the system) if that customer’s service time exceeds 3.5 minutes. The goal is to estimate the average time between reneging customers. Figure E.7 Reneging Example The arrival of customers is modeled using an Entity Generator block with a Numeric Source block attached to its InterArrivalTime port. In the Numeric Source block, an exponential distribution with a mean of 5 is specified. After entities are generated, they are sent to a Modifier block where an attribute called servicetime is assigned. The servicetime for each entity is sampled from an exponential distribution with a mean of 4.651. (The Extractor block immediately following the first Modifier block is used only to verify that the value is set in the Modifier block; it serves no other purpose in this model.) Next the entities are sent into the FIFO Queue block. As each entity enters the queue, a renege time is computed and assigned using a Formula block. Figure E.8 shows the properties dialog box for the Formula block connected to the FIFO Queue block. In the Formula block, the servicetime attribute for the entity is compared to the value 3.5. If the servicetime is greater than 3.5, then a renege time of 5 is returned. Otherwise, a very large renege time (specifically, 5,000,000) is returned. For those 146 F Appendix E: Examples of Simulation Studio Models entities with a servicetime less than 3.5, their renege time is set sufficiently large to ensure that they wait until they can be serviced and they do not leave the system. The reneging option in the FIFO Queue block properties dialog box must be selected for reneging to be used by the queue. Figure E.8 Renege Time Formula Dialog Entities that do not renege are processed in the Server block. The InServiceTime port of the Server block is connected to an Extractor block. When an entity arrives at the Server block, the Server block passes the entity to the Extractor block. The Extractor block extracts the servicetime attribute from the entity and passes the value to the Server block for use as the server processing time. Note that use of the Extractor block here does not require connections to its InEntity or OutEntity ports. Entities that do renege from the FIFO Queue block are sent out the OutRenege port of the queue, and the time at which they renege is stored in the entity by using a Modifier block. In this Modifier block, the entity attribute renegetime is assigned the value Time Now. The entity is then sent into a Count block to determine whether it is the first entity to renege. The value of Count is passed into a Switch block. If the entity is the first entity to renege, the Switch block returns a value of 1 and the entity is sent into an Extractor block where the renegetime attribute value is extracted and passed into the Number Holder block labeled Last Renege Time. If the entity is not the first entity to renege, it is sent into a Gate block, and a Formula block computes the time between reneging entities by subtracting the previous entity’s renegetime from the current entity’s renegetime. The renegetime for the previous entity is stored in the Number Holder block labeled LastRenegeTime. In order for this computation to work, the From Upstream option in the LastRenegeTime Number Holder block properties dialog box must be unchecked, as shown in Figure E.9. If the From Upstream option is selected, then the Number Holder block pulls a value from upstream, which in this case means it pulls the value from the Extractor block. If this happens, the value of the previous entity’s renegetime is replaced with the current entity’s renegetime, resulting in a value of zero for the time between reneging customers. Repair Shop Model F 147 Figure E.9 LastRenegeTime Number Holder Dialog After the time between reneging entites is computed, the value is passed from the Gate block into the Number Holder block labeled AvgTimeBetweenRenegingEntities. The entity is then sent into the Extractor block. The renegetime attribute for the entity is extracted and sent to the Number Holder block LastRenegeTime, to be used when the next entity reneges from the system. The entity is then destroyed. Repair Shop Model Like the M/M/1 Queueing Model example discussed earlier, this model was also first introduced in Chapter 1, “Overview of SAS Simulation Studio,” and the details and motivation for the model are found there. This section presents several possible enhancements to the original Repair Shop Model shown in Figure E.10. 148 F Appendix E: Examples of Simulation Studio Models Figure E.10 The Repair Shop Model One change to this model might be to add an attribute (named PartType) to the Part entities and then use this attribute to dynamically generate a service time for a particular Part entity at each of the Server blocks in this model. To accomplish this, you insert a Modifier block between the first Arrivals block and the first Delay block and assign a PartyType attribute to each passing Part entity. This attribute could be a numeric or character code that uniquely identifies the various part types. You could then replace any or all of the Numeric Source blocks linked to the Server blocks (for example, Service Desk) with a Formula block and create an expression in the Formula block to generate a numeric value for the service time based on the PartType attribute in the incoming entity. Another possible enhancement to the model might be to reroute some Part entities back to the RepairDeskQ block after the Quality Control block to simulate failures at Quality Control that require repairing the part again. Adding another Chance compound block between the Quality Control Server block and the Fixed block and configuring it to reroute some Part entities back to the RepairDeskQ block could achieve this functionality. The Repair Shop model also provides an appropriately sized model for exploring the Simulation Studio linkage with the JMP routines for design of experiments. You could define factors for the capacity values for each of the Server blocks (Sevice Desk, Repair Men, Quality Control) and define responses for the waiting times at each of the Queue blocks (ServiceDeskQ, RepairDeskQ, QualityControlQ) and also utilization rates at each of the Server blocks. (Details for defining factors and responses are found in Chapter 4, “Experiments.”) After you include these factors and responses in an Experiment window associated with the model, you can select Make Design from the Experiment window pop-up menu to retrieve the default experimental design for these factors from the PERT Network Model F 149 JMP software. (This assumes you have previously launched the JMP server to establish the connection to Simulation Studio.) After running the experiment you can pass the recorded experimental results back to the JMP package for analysis by selecting Analyze Results from the Experiment window pop-up menu. See the JMP software documentation for more information about using JMP software to analyze data. PERT Network Model This example is a Program Evaluation and Review Technique (PERT) network model of a repair and retrofit project. All activity times are assumed to be triangularly distributed. The activities relate to power units, instrumentation, and a new assembly, and they involve standard types of operations. At the beginning of the project, three parallel activities can be performed: the disassembly of power units and instrumentation (Activity 1), the installation of a new assembly (Activity 2), and the preparation for a retrofit check (Activity 3). Cleaning, inspecting, and repairing the power units (Activity 4) and calibrating the instrumentation (Activity 5) can be done only after the power units and instrumentation have been disassembled. Thus, Activities 4 and 5 must follow Activity 1 in the network. Following the installation of the new assembly (Activity 2) and after the instruments have been calibrated (Activity 5), a check of interfaces (Activity 6) and a check of the new assembly (Activity 7) can be made. The retrofit check (Activity 9) can be made after the assembly is checked (Activity 7) and the preparation for the retrofit check (Activity 3) has been completed. The assembly and test of power units (Activity 8) can be performed following the cleaning and maintenance of power units (Activity 4). The project is considered completed when all nine activities are completed. Since Activities 6, 8, and 9 require the other activities to precede them, their completion signifies the end of the project. The goal is to estimate the project completion time. 150 F Appendix E: Examples of Simulation Studio Models Figure E.11 PERT Network Model This model uses a common compound block (which consists of a Numeric Source block and a Delay block) to model the individual activities. Figure E.12 shows the structure of this compound block. Figure E.12 PERT Model Activity Compound Block As was mentioned earlier, a triangular distribution is associated with each Numeric Source block. The distributional parameters for each of the activities is shown in Figure E.13. PERT Network Model F 151 Figure E.13 PERT Model Activity Compound Block A Clone block is used to initiate parallel activities. When an entity enters a Clone block, the Clone block makes copies of the original entity and sends them out its various ports, depending on the cloning directives in Clone block. Figure E.14 shows the cloning directives for the first Clone block an entity encounters in this model. This Clone block has two additional output ports and sends out one cloned entity on each port. This simulates the initiation of the disassembly of power units and instrumentation (Activity 1), the installation of a new assembly (Activity 2), and the preparation for a retrofit check (Activity 3) from the intial entity. Figure E.14 PERT Network Cloning Directives The combination of a Counter block with a Switch block is also used in multiple places in the model. The Counter block simply counts how many entities have flowed through it and makes this count available via its OutCount port. Every time an entity enters a Switch block, the Switch block 152 F Appendix E: Examples of Simulation Studio Models pulls the count value from its associated Counter block and then routes the entity accordingly. Each Switch block is essentially waiting until N entities have reached it before intiating the next activity in the model. Each execution of the simulation model results in one estimate of how long it might take to complete the project. A large number of replications of the model execution are needed to produce enough data to construct a valid estimate for project completion time. Your Turn We welcome your feedback. If you have comments about this book, please send them to [email protected]. Include the full title and page numbers (if applicable). If you have comments about the software, please send them to [email protected]. SAS Publishing Delivers! ® Whether you are new to the work force or an experienced professional, you need to distinguish yourself in this rapidly changing and competitive job market. SAS Publishing provides you with a wide range of resources to help you set yourself apart. Visit us online at support.sas.com/bookstore. ® SAS Press ® Need to learn the basics? Struggling with a programming problem? You’ll find the expert answers that you need in example-rich books from SAS Press. Written by experienced SAS professionals from around the world, SAS Press books deliver real-world insights on a broad range of topics for all skill levels. SAS Documentation support.sas.com/saspress ® To successfully implement applications using SAS software, companies in every industry and on every continent all turn to the one source for accurate, timely, and reliable information: SAS documentation. We currently produce the following types of reference documentation to improve your work experience: • Online help that is built into the software. • Tutorials that are integrated into the product. • Reference documentation delivered in HTML and PDF – free on the Web. • Hard-copy books. support.sas.com/publishing SAS Publishing News ® Subscribe to SAS Publishing News to receive up-to-date information about all new SAS titles, author podcasts, and new Web site features via e-mail. Complete instructions on how to subscribe, as well as access to past issues, are available at our Web site. support.sas.com/spn SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Other brand and product names are trademarks of their respective companies. © 2009 SAS Institute Inc. All rights reserved. 518177_1US.0109 ">
Download
Advertisement
Key features
Graphical user interface (GUI)
Batch Interface
Advanced statistical analysis
Experiment window
Input analysis
Customizable models
Frequently asked questions
SAS Simulation Studio is a SAS application that uses discrete-event simulation to model and analyze systems.
It provides a graphical user interface that requires no programming and a programmatic interface that enables you to run models in batch.
Sensitivity analysis, comparison of two or more systems, and an experimental design for a system.
Analyzing output from discrete-event simulations often requires advanced statistical methods. Input analysis can be facilitated by using JMP distribution estimation capabilities.