SansGUI 1.1 Features and Enhancements

This section describes new features and enhancements, which have been introduced since the official release of SansGUI version 1.0. All the examples that are referred to in this section can be downloaded from ProtoDesign's web site and on the software distribution compact disc.

Dynamic Charting without Programming

In version 1.0, you have to pause or stop a simulation run and then switch to the Result View in the Bottom Pane in order to activate the Plot Results button. With this new version, the Plot Results button is activated under the following two conditions:

You can click on the Plot Results button any time when it is activated, even when no data have been logged in the Result View yet. The Plot Results Dialog will be displayed with its X and Y axes set as you specified. When you start or resume a simulation run, SansGUI will detect the presence of the Plot Results Dialog and update it as the simulator is crunching out numbers and pumping them into the Result View. The effect is, dynamic charting without extra programming effort from you, the simulation developer and user. All the details are handled by the SansGUI Run-Time Environment.

Plotting Strip Charts

With the new dynamic charting capability, plotting strip charts is not only possible but very simple. The width of the plot frame, which is the number of data points to be plotted along the X-axis, is governed by the Maximum Number of Rows in the Result Views parameter (default 1000). You can set it by selecting Tools>Options... from the pull-down menu. You can also set the Ending Cycle Number to zero in the Default cycle simulation control object to indicate that you intend to run the simulation forever with endless loops. In such cases, you control the end of the simulation by either clicking on the Stop button in the Run toolbar, or relying on the SG_R_STOP value returned by the simulator when a termination condition is reached programmatically.

All the SansGUI examples can be used to demonstrate this new feature. The SineTest Project Model in the Visual Calculator for SansGUI example is particularly good to learn and explore this new facility.

Simulation Execution Enhancements

There have been four major simulation execution enhancements since SansGUI 1.0:

Cycle Simulation Sequence Change

Originally, the Resize for Initialization (SG_xInitSize) functions of all reference objects are executed before the same functions of all the parts in a Project Model are called. Since version 1.0, we have found that the dynamic sizes of reference objects, derived from Matrix or Table classes, may depend on the number of parts in the model in many applications. Therefore, the calling sequence of SG_xInitSize is changed to looping through all the parts before all the reference objects. This provides simulators with an opportunity to know how many parts have been created by the user in a Project Model in order to specify the sizes of certain reference objects for dynamic memory allocation. The cycle simulation sequences of the other functions remain the same as documented.

The Mixer Application Example demonstrates how to resize matrices and tables according to the number of mixers in a Project Model during run-time.

Stopping Simulation Cleanly

In version 1.0, when the user clicks on the Stop button in the Run toolbar, SansGUI terminates the running thread right away without giving the simulator any chance to clean up or release resources. Version 1.1 has been enhanced in that the SG_xEndRun cycle will be triggered when the user clicks on the Stop button; therefore, the simulator can reliably perform final clean up before the simulation is ended.

When the simulation is stopped by the user, rather than running normally through the end, SansGUI will set a SG_STAT_STOP flag in the iStatus member of the SG_OBJ data structure associated with the simulation control object simCtrl in the SG_xEndRun calls. The SG_STAT_STOP flag is defined in SGdll.h for C/C++ and SGdllf.h for Fortran. The simulation developer can check this status bit to know if this SG_xEndRun cycle is triggered by the user or is called from a normal ending sequence.

In very rare occasions, you may want to bypass the end run routines and stop the simulation immediately. You can select Tools>Terminate Simulation from the pull-down menu to accomplish the same effect as in version 1.0. However, please use this option with great care.

Executing Simulation Forever

The Ending Cycle Number in the Cycle simulation control object can be set to zero (0) to indicate that no check of ending cycle condition is requested. This effectively allows a simulator to run forever with endless loops. To stop a simulation when the Ending Cycle Number is set to 0:

You can use any Project Model in the SansGUI examples to try out this new feature.

Running External and In-Process Simulators in Concert

The External Process Simulator mechanism is SansGUI's primary support of legacy programs. With it, an external process program can treat SansGUI as its graphical model editor that generates textual model files as its input files, according to the model configurations created by the simulation users. In version 1.0, although a simulator can be defined to incorporate both external process and in-process simulation controls, they cannot be executed at the same time. The result is that the external program is executed without being able to communicate with SansGUI; therefore, the users cannot take advantage of the highly interactive environment to monitor the simulation process during simulation runs.

In SansGUI version 1.1, we have added the capability of simultaneous execution of both external and in-process simulators so that they can work in coordination. The external process simulator can be any console-based application, an application with its own GUI, a control process or a simulated process of a real machine, etc., written in any programming language and, to a greater extent, running on a different machine. The potential is endless. A simple in-process simulator can be developed to communicate with the external process simulator to fetch a certain set of data for monitoring, further manipulation, analysis, or charting in the interactive SansGUI environment.

To demonstrate this new capability and also for some fun, we have developed a MIDI Player for SansGUI example which contains a console-based MIDI music player that sends MIDI event data, via Win32 shared memory, to an in-process simulator for channel data distribution and charting. The user can hear the MIDI music being played in the background while SansGUI displays the pitch data from different channels. While you are enjoying the music, please be reminded that the external process simulators are not limited to music playing.

New Reset Data Button

A new Reset Data button has been added to the Run toolbar. It can be used to remove the overriding values in the attributes of In/Out, Output, and Hidden scopes in all parts and links, except for explicit {parameter} values. This is the same as the Edit>Clear Override Values operation from the pull-down menu. In addition to removing overriding values, all numerical fields with In/Out, Output, and Hidden scopes in the simulation control object will be reset to default values, if defined by the simulation developer.

The Current Time field of the simulation control object in the Cool Example will not be reset because it does not have a default value defined. In the Feel Example, however, the same field will be reset to 0 every time when the Reset Data button is clicked because the default value 0 is supplied.

EMF Support in Canvas View

If you only need a static picture of a Canvas View to be incorporated in a document with another application, you can export the Canvas View to the Windows Clipboard (in memory) or to an external file in the Windows Enhanced Metafile (EMF) format. Once exported, you can insert it into any document with any Windows program that supports EMF.

Please see the modified Incorporating Canvas Views section for more details.

Enhanced Printing Capability

All SansGUI views and data grids can be printed, even when they are in Properties dialogs. Simply right click on the view or data grid to obtain a context menu and select Print... or Print Preview (the latter is only available to views) from the context menu.

Enhanced New File Dialogs

The dialogs invoked by the File>New pull-down menu operation have been enhanced to incorporate some on-line instructions for beginners. As in the other dialogs, the big icon button can be clicked to access on-line, context-sensitive manual pages, regarding SansGUI or installed simulators.

Dumping SG_OBJ Data in Fortran or C/C++

Two example source files, SGdump.cpp in C/C++ and SGdump.f in Fortran are included in the inc subdirectory of your SansGUI installation directory. You may incorporate the source file into your programming project, open an output file, and call the SG_dumpDataObject routine as needed. It is good for debugging purposes. You can also use it to learn how to access all the data members in SG_OBJ and SG_VALU data structures.

Dynamic typing means that the type of a variable, such as integer, double precision floating point, character string, etc., is decided by the type of its binding value at run-time. In contrast, static typing means the type of a variable is defined during the development process and implemented in the code, which will never be changed at run-time. Although the dumping routine demonstrates the dynamic typing feature of SG_OBJ and SG_VALU, the types of most variables in your simulator may be static by nature, defined in the Schema Definition. When the variables are statically typed, you don't need to perform run-time type checking, as in the SG_dumpDataObject routine, for better performance in your simulator code.

Most attributes/variables in the SansGUI examples are statically typed.


C:\FH_Suite\htmlgifs\home.gif SansGUI 1.2 Features and Enhancements Bug Fixes

SansGUI Modeling and Simulation Environment Version 1.2

Copyright 2000-2003 ProtoDesign, Inc. All rights reserved.