GLIDER: Simulation Language 
 WINDOWS Users Guide
Win95/98/NT 
IEAC/FACES - CESIMO/FAI

Project CDCHT  I-524-95-02-AA
Universidad de Los Andes. Mérida, Venezuela. 

September 2003

GLIDER Development Group

 

Contents


GLIDER WINDOWS version

This is a quick guide for users of the WINDOWS version of the GLIDER Simulation Language [1]. This version requires the use of BORLAND Delphi version 4, 5 or 6, that has to be installed prior first use of GLIDER. BORLAND Delphi [4] is also the development tool of GLIDER.

To install GLIDER unzip the distribution file (dGLIDER.zip for Delphi4, dGLIDER5.zip for Delphi 5, dGLIDER6.zip for Delphi 6) into hard drive. Make a shortcut to the executable WinGli.exe located in the installation directory (dGLIDER, dGLIDER5 or dGLIDER6). Change the icon to the icon file WinGli.ico located in that directory.

Refer to the GLIDER Reference Manual for language syntax and model programming examples. A web version of that Manual can be seen in http://afrodita.faces.ula.ve/Glider/gliweb

IMPORTANT NOTE: Do NOT install GLIDER nor GLIDER programs into directories or subdirectories whose names contain blank characters, like Program Files. Current versions of GLIDER will not recognize them and errors will occur.
This problem will be corrected in future versions.


Quick Guide
Double click for execution upon the shortcut to WinGli, or click the Windows Start Button, select Run and enter the command:
<drive>:<path>\dGLIDER\WinGli
(dGLIDER5 or dGLIDER6, according to your Delphi installation)

GLIDER programs must have extension .gld. Select the program name with the options File|Open in the Main Menu of WinGli. Select Compile to compile the program. The compilation process opens two Console type windows in sequence. Ignore any message of the type "File not Found", press any key when asked for and close manually the last window in case it does not close automatically. If the compilation was successful, a corresponding .exe file must have been created. To run the executable select Run in the Main Menu, or run it outside WinGli as any other WINDOWS executable.

The option Complete Compilation is the default selection in the menu Options of the Main Menu. If there were GLIDER compilation errors you can edit the program with the WinGli editor. If there were Delphi compilation errors or in case you can not find the problem in your gld file, change the Compilation mode to Partial Compilation in the Options menu and compile again. With this compilation mode selected, the Glider compiler only generates the ObjectPascal files (<program>.dpr, Pru.pas and Unid1.pas (Unid2...)). Use your Delphi installation to edit the project, using the options File|Open to open the corresponding .dpr project file that was created by WinGli. You can compile and run the project directly in the Delphi IDE, after adding the dGLIDER directory (dGLIDER5 or dGLIDER6) to the Search path list (Project|Options|Directories|Conditional Search path)


Creating and editing a GLIDER program

Users of the WINDOWS version have to create and edit their programs using any WINDOWS or MSDOS text editor program, as Notepad or MS Word or WordPad (saving the file as ASCII text with line breaks, with extension .gld) or also using the WinGli editor. GLIDER syntax is case insensitive. Refer to the GLIDER Reference Manual for language syntax and model programming examples. A web version of that Manual can be seen in http://afrodita.faces.ula.ve/Glider/gliweb

GLIDER program file names must have extension gld, as myexample.gld

NOTE: For very large programs do not use the WinGli Editor, but WordPad instead, as directed.



Compiling a GLIDER program

Complete Compilation

Use the program WinGli to compile a GLIDER program, for example myexample.gld, selecting its name with the File|Open option in the main menu.

In case that GLIDER precompiler  finds any  syntax error, an error message is given,  indicating line and column numbers where the error was detected and the compilation process ends. Use your text editor for correcting the errors and compile again until successful. If you can not find the error cause, please, contact us via e-mail to the address shown at the end of this section.

If no errors were detected, in the program folder, besides the program source file, must be the executable program with the same name but with extension .exe. For example, after selecting the Compile option, the Windows Explorer will show the names myexample.gld and myexample.exe.

The GLIDER precompiler must generate correct Delphi ObjectPascal programs, so the Delphi compilation must not give any error message. If any error message happens to come and you cannot find the problem using Delphi as directed in the section Quick guide and also in the next section, please, send us an  e-mail reporting the case and include if possible the source program to one of the following addresses: sananes@.ula.ve


Partial Compilation

If you have any concern about the Delphi ObjectPascal modules that the GLIDER precompiler generates, select the Partial Compilation mode in the Options menu in Main Menu. In this mode, WinGLI only generates the ObjectPascal modules and leaves them in the program folder. Open the following generated files in the Delphi IDE:

<name-prog>.dpr, with Open Project
  pru.pas and unid1.pas, with Open File
If the GLIDER program defines one or more additional modules  (MODULE instructions), files with names unid<x>.pas will also be generated for each additional module, x=2,3....

In the Delphi IDE you can compile the corresponding project (<name-prog>.dpr file) using the option Project/Build in the Delphi main menu that completes the process producing the executable file <name-prog>.exe. Before the Delphi compilation you have to add the dGLIDER directory to the Search path list (Project|Options|Directories|Conditional Search path) in the Delphi IDE, so Delphi can find the GLIDER libreries. (dGLIDER5 or dGLIDER6 for Delphi5, Delphi6)

The user is responsible for deleting the intermediate files.


Running a GLIDER program

After successful compilation you can run the program. Select the option Run in the Main Menu of WinGli, or enter the program name as a command, with the Run option of the Windows Start Button or open Windows Explorer and double click in the program name (myexample in the example).

GLIDER programs start presenting this Control window:

During execution follow the directives given in the Message box -the first one to the left- and then press the next OK button. At the beginning the Message Box shows the Start directive. After clicking the OK button, the GLIDER Main Menu pops allowing for selection of next action, like initialize and run a experiment (model run) or setting options for the experiment.

For details about menus, operation and run options, consult the GLIDER Language Reference Manual [2]
http://afrodita.faces.ula.ve/Glider/gliweb/

Use the Interrupt button if you want to interrupt normal execution and go into Trace mode.

Console Application

If your program contains any read instruction from standard Input (Read or Readln) or write to standard Output (Write or Writeln),  you must select Console Application in the Options menu in Main Menu. Otherwise, the program will raise a Exception condition when attempting to execute the first read from or write to Console.

[Note: During Trace mode you can interrupt again to go to the main menu and then to end the run. Trying to return to normal mode is not working properly]


Running programs with graphics

GRAPH Instructions

GLIDER programs may have up to 100 GRAPH instructions, each one displays a graphic window. A standard graphic window size is assigned depending on the graphic type. For time graphics, the standard window width is as wide as the width of the screen. But you can customize the graphic windows size by placing assignment instruction for both predefined variables: WindowWidth and WindowHeight in the Init section of a GLIDER program. Example:

WindowWidth:=400; WindowHeight:=400;

When the simulation run ends, you can choose the option Close Graphics in the main menu. The closing process grants focus to each graphic window in creation reverse order. For each activated window, the system places a Continue message in the Messages Box of the Control window and then waits until the user press the next OK button. In the meanwhile, the user can save the graphic to a bitmap graphic selecting the File option in the graphic window menu. If any variable data value were outside the graphic limits, the system shows a warning with the message "Graphic Scale was changed" and then the graphic is redraw using the system changed scales.

Any way, the closing graphics process is also executed when the user choose the Quit option.

FILE Instructions Files generated by FILE instructions in a program, with extension .txt, can be used to create and save graphics selecting the Graphic option in the main menu after the end of the simulation run. An Open dialog form allows to selected the FILE generated file with variables definitions and data. [Note: A File exception error will occur is the file doesn't have the expected FILE format, and the program aborts]. I f no errors then the Graphic dialog form appears:


 

First of all, a set of dependent variables (no more than 14) has to be selected from the left list box, which shows the names of all variables in the selected file. Make the selection using the Windows modes (pressing the Shift key at the last for contiguous variables or with the Crtl key pressed for scattered ones). Then use the arrow button to place them in the right list box. From the right list box you can drop unwanted variables using the Drop button bellow the arrow (the one with the circle crossed off).

The independent variable may be reselected from the combo list bellow the dependent variables list box. The graphic caption may be changed as well. After pressing the Accept button, the system displays configuration data in the rightmost table, including pre-selected colors for each variable in the list of dependent variables chosen. Similar data for the independent variable are displayed bellow. The user can change all those values at will. Color may be changed by clicking in the corresponding colored square.

Window size (height and width) may be changed before or after accepting the variable selection.

When the Apply button is pressed, the graphic window is shown with the size, caption, scales and color chosen. At that point, the user may choose to define a new graphic from the same file, by pressing the now enabled button New Graphic or quit the graphic dialog, pressing the Finish button.

After quitting the Graphic dialog, all defined graphics are displayed and then the message Closing Graphics appear in the Message box of the Control window. The system performs the closing process, as described in the previous section (Graph Instructions).

When the Main Menu comes back, you can select the Graphic option again to define others graphics from another or the same FILE generated file.

INTI Graph instructions The GLIDER instruction INTI when applied to a GFUNCTIONS identifier, generates an interactive graphic window. Using the mouse buttons, the user can add or modify points to the function. The redefined function replaces the original program definition for the current simulation. On exiting the graphic window, the redefined function may be saved to a file for later use.

In either case, GRAPH or FILE generated graphics, if there is enough room in the screen, the system tries to arrange the graphic windows in tile mode, otherwise in cascade mode.

Examples of GLIDER programs

A collection of examples of GLIDER programs is available in the dGLIDER/DEMOS Folder. (dGLIDER5 or dGLIDER6)

The file names of the examples have the form  EXE<x>.gld, x = 1,2,3,..20


Differences of implementation with MSDOS version

Some characteristics of GLIDER have been implemented differently from the MSDOS version  or have not been fully tested. Some are new to the Windows version.

Differences on implementation are:

  • Modes of operation: TP/MSDOS version offers two modes of operation: Normal and Trace. In both modes the program is interruptible. In the WINDOWS version there are the same modes, the program is interruptible using the Interrupt button in the control window.
But in the Windows version the trace is always recorded in a file. When the program ends or the user stops the tracing, the file content is shown in a text window, if it fits. If the file is too large, as usually is, a warning message pops and then the user is asked to save the file and see it with the WordPad editor.
  • Delphi ObjectPascal requires every for-loop-control variable to be a local variable to the module being compiled. In the Windows version for-loop-control variables used in node code (method) must be declared local to that node, using the syntax:
<node-name> (<type>) [<list-of-successors> ,] var <var-declarations> ::
  • The predefined Delphi ObjectPascal files Input and Output are implemented following the standard Pascal definition, without the TurboPascal [3] facilities, like GoToXY or ClrScr, included in the Crt Unit that Delphi does not support. Programs that write to Output or read from Input have to be compiled with the option Console Application checked in the Options menu of WinGli (WinGLIDER) main Menu. This option allows the program to open a console window for use of files Input and Output. Working directly in the Delphi IDE, this option is activated using the main menu option Project/Options/Linker/Generate Console Application or placing the special commentary {$APPTYPE CONSOLE} after the initial program line in the .dpr file (main file of Delphi projects) .
  • First parameter in instruction FILE may be a variable name of text type or a constant file name within single quotes.
  • The  database features have not been tested in the WINDOWS version.
New features in Windows version:
  • USES instruction: A GLIDER program may contain one USES instruction, if so, it must be the first instruction in the DECL section. Same syntax as ObjectPascal. This feature allows the Delphi compiler to compile programs that include types, variables and routines defined in external Units, thought the GLIDER precompiler does not recognizes them. To avoid GLIDER compilation errors, the next second feature was added
  • Marking instructions: Placing a '#' character as the first character of a line tells the GLIDER precompiler to ignore that line and pass the rest of it as it is to the generated ObjectPascal file. All instruction lines that contain references to identifiers belonging to external Units must be marked. The user is responsible for the proper syntax, otherwise, the Delphi compiler will report compilation errors. You can correct them using the GLIDER IDE (WinGli) or the Delphi IDE.
  • Use of Delphi Unit Dialogs: The Dialogs Unit is always included in the system generated USES list. The windowed communication routines that this Unit contain, like ShowMessage, InputBox, etc., may be used, but in lines marked with '#' to avoid GLIDER compilation errors. In many cases, that may be a suitable substitute to the use of read or write instructions to Console.
  • WDGRAPH Unit is also always included. WDGRAPH is the Windows Delphi emulation of the GRAPH TurboPascal Unit, with some additions [5]. It was developed for the GLIDER Windows version, but it may be distributed independently by the GLIDER Development Group.
  • Multiple Graphics: GLIDER Windows version support multiple GRAPH instructions, each one generating a graphic window for display. Graphics may be saved in BMP format.


References

1 Domingo C., Hernández M., Sananes M, Tonella G.: Lenguaje de Simulación GLIDER: Guía de Referencia CESIMO-IEAC, Universidad de Los Andes, Mérida, Venezuela, 1994.
2 GLIDER Development Group: GLIDER Reference Manual IEAC-CESIMO/ULA, Venezuela & Interdisciplinary Research Center, Department of Mathematical Sciences, SDSU, August, 1996. Financiamiento: CDCHT-ULA. http://afrodita.faces.ula.ve/Glider/gliweb/
3 BORLAND International, Inc.: Turbo Pascal version 6.0
4Inprise BORLAND Delphi, versions 4, 5 and 6
5 Sananes, M., Sayago, F. Transporte de Programas por Emulación de Bibliotecas. (Parte 2: Caso GLIDER a Plataforma Windows 95/98/NT). IEAC/FACES, CESIMO/FAI. Presentado en las II Jornadas de Estudios Estadísticos. Abril 1999. Financiamiento: CDCHT-ULA.
 

GLIDER DEVELOPMENT GROUP
Carlos Domingo, Marisela Hernández (Language design and feasibility) Renato del Canto, Cristina Zoltan (Advisers) Carlos Domingo, José G. Silva, Giorgio Tonella (Extended language design) Carlos Domingo (Development) Marta Sananes, José G. Silva, Giorgio Tonella (Advisers) Cruz Acosta, Herbert Hoeger, Luis Fuentes, Tania Jiménez, Francisco Palm, Segundo Quiroz, Oswaldo Terán, Kay Tucci (Collaborators) Versión UNIX/LINUX: Carlos Domingo, Marta Sananes (Development) Milton Quero, Niandry Moreno (Collaborators). Librería Emulación TPEX: Marta Sananes, Rafael Tineo (Development) Solveig Maldonado (Collaborator). Versión Windows: Carlos Domingo, Marta Sananes, Fernando Sayago (Desarrollo), Francisco Palm, Vicente Ramírez (Collaborators).

MSDOS is registered trademark of Microsoft Corporation. All Borland products are trademarks or registered trademarks of Borland International, Inc.

GLIDER:  Simulation Language
WINDOWS User Guide
IEAC/FACES - CESIMO/FAI

Financiamiento: Consejo de Desarrollo Científico y Humanístico CDCHT
Universidad de Los Andes. Mérida, Venezuela

May 2001/September 2003.