Building Models

From Support

Jump to: navigation, search

Contents

Building Models, Verifying Simulations, and Sharing the Results of Simulation Experiments

Three objects must be defined in order for a SIGMA simulation to run: vertices, edges connecting the vertices, and state variables. In this section you will learn how to create and define these objects and how to make changes to them. Moreover, you will learn how to edit and build models while they are running. SIGMA’s ability to let you interact with a simulation as it is processing is a valuable logic checking and model enrichment feature. Also valuable for logic checking is the Translate to English feature. This feature and others help those not familiar with your model better understand it.

Creating and Editing an Event Graph

Use the mouse and the SIGMA toolbar to create and edit an event graph.

Further information: Creating and Editing an Event Graph

Dynamic Run-Time Model Building and Analysis

SIGMA lets you interact with a model during a simulation. You can alter your model in virtually any way you wish while it is running! For example, with a running model, you can change an edge condition or delay time expression by double-clicking on the edge and making the necessary changes in the dialog box. If you do the same to a vertex, you can modify the state changes or displayed variables. You can change the run mode by making changes in the Run Options dialog box during a run. You can even add and delete edges or event vertices during a run.

Changing a simulation during execution is simple: just make the changes as if the model were not
running!
Further information: Dynamic Run-Time Model Building and Analysis

Model Enrichment and Logic Checking

SIGMA has very powerful simulation model enrichment and logic checking features.

Setting up the Logic Checking Environment

One of the most important things to check before you start to verify a simulation model is to insure that all the edges have enough attribute expressions for each of the parameters of the scheduled vertex. The most common error is not to have enough "initial attributes" in the Run Options dialog box for the parameters of the first vertex.

A model verification session will go as follows. Start a SIGMA session and open the model to be checked. (Here we will again use CARWASH.MOD.) Open the Run Options dialog box in the Run menu and set the Run Mode to Single Step. Next, make the run very short by setting the Stop Time to a small number (10 will do). This is to initialize data tracking. Start the run by clicking OK & Run. Press [Enter] several times or click on the Single Step tool to execute some events. Press the End Run tool to stop the run. Click Yes when asked to view the output file.

At this point you should have three windows tiled in your SIGMA session: a numerical output window for the output file listed in your Run Options dialog box (UNTITLED.OUT), the simulation graph, and the simulation plot.

Click once on the simulation graph window to activate it. Next, click on View Output/Text File under the File menu and then click on CARWASH.MOD; this will open the ASCII text file for your model. (If you don't see CARWASH.MOD, press the drop down list under List Files of Types and click Other Files.) Under the Window menu select Tile. You should now have four windows showing: a simulation graph, a simulation plot, an output file, and a model text file. Activate the simulation graph window and set the Stop Time in the Run Options dialog box to a very large number, so your model will continue to run as you verify its logic.

Starting a Logic Checking Run

Press OK & Run to start the run. Make sure you are again in Single Step mode and step through your model by pressing [Enter] or clicking on the Single Step tool in the Single Step Window. Every time the "Refresh" arrow (near the upper left corner of UNTITLED.OUT) is pressed during the run, the output trace will be updated and added to the output file.

If you have an edge that is not scheduling a vertex as you expected, click on the scheduling vertex (while the model is running) to open the Edit Vertex dialog box and set some Display Variables that are tested on the bothersome edge. (Enter the names of the variables separated by commas).

If you activate the simulation plot window and click on the New command under the File menu, you can open a copy of the simulation plot. This plot can be double-clicked to change its plot type. In this manner, you can view several plots at once. For example, one could show a histogram and another a scatter plot. Only one plot will be updated during a run; the other can used to record the run history.

The PAUSE{} function can be used to debug long runs. If you find a logic error at time 1000, you can trap this error by scheduling a dummy event with the state change X=PAUSE{} at time 999. Run the simulation in High Speed mode until PAUSE is hit, then change the run mode to Single Step, and continue logic checking.

Automatic Translation of SIGMA Model

SIGMA automatically translates a SIGMA model into both English and C code.

Further Information: Automatic Translation of SIGMA Model

Capturing a Simulation and Its Results

The ease of exporting data to word processors makes it much easier to develop reports for simulation experiments. Not only can the event graph be included in the summary reports, graphical plots, numerical output, and even an English translation of the model can be added to a written report.

Printing Event Graphs, Simulation Plots, and Output Files

It is very easy to print event graphs, graphical simulation plots, and numerical output files from models created in SIGMA. To print a graph, plot, or output file, just activate the appropriate window, click the Print command in the File menu, and respond to the Print dialog box.

Using Spreadsheets and Word Processors

SIGMA graphs, plots, and output can be incorporated into modern Windows spreadsheets and word processors. If you copy [Ctrl-c], an event graph and then paste [Ctrl-v]. it into a word processing file, you may be surprised at the results. Rather than the event graph, you will see the textual description of your event graph (the simulation model data). If, on the other hand, you activate the simulation graph, press [Alt-Print Screen], open a word processing file, and then click Edit, the event graph image will appear in your file.

SIGMA also allows you to copy, cut, or paste dialog box text between a modeling session and another application. This feature is particularly useful when entering lengthy, but similar, edge conditions. For example, you could write the text using Word for Windows, highlight the text and copy it using [Ctrl-c], then paste it into a SIGMA dialog box using [Ctrl-v].

To move output data from SIGMA into a spreadsheet: activate the simulation plot window in SIGMA, click on the Edit/Copy Data command, open the spreadsheet program, and click the Edit/Paste command. To export a simulation plot to a word processor: activate the simulation plot window, click on the Copy Plot command in the Edit menu, open a word processing file, and click on the Paste command in the Edit menu.


Back to Main Page

Personal tools
Navigation