Global variables


Detailed Description

The GridLAB-D core maintains a group of global variables that can be accessed by both core functions and runtime modules using the core API.

GLOBAL bool global_xmlstrict INIT (false)
 Causes XML I/O to use strict XML data structures.
GLOBAL bool global_strictnames INIT (true)
 Enforce strict global naming (prevents globals from being implicitly created by assignment).
GLOBAL int global_profiler INIT (0)
 Flags the profiler to process class performance data.

Enumerations

enum  DATEFORMAT
 flag to allow skipping of safe syncs (see OF_SKIPSAFE)

Functions

GLOBALVAR * global_create (char *name,...)
 Creates a user-defined global variable.
GLOBALVAR * global_find (char *name)
 Find a global variable.
GLOBALVAR * global_getnext (GLOBALVAR *previous)
 Get global variable list.
char * global_getvar (char *name, char *buffer, int size)
 Get the value of a global variable in a safer fashion.
STATUS global_init (void)
 Register global variables.
STATUS global_setvar (char *def,...)
 Sets a user-defined global variable.
GLOBAL char global_platform[8] INIT ("LINUX")
 < the host operating platform
GLOBAL int global_maximum_synctime INIT (60)
 the maximum time allotted to any single sync call
GLOBAL char global_object_scan[32] INIT ("%[^:]:%d")
 the format to use when scanning for object ids
GLOBAL char
global_complex_format[256] 
INIT ("%+lg%+lg%c")
 the format to use when processing complex numbers
GLOBAL char
global_double_format[32] 
INIT ("%+lg")
 the format to use when processing real numbers
GLOBAL TIMESTAMP global_stoptime INIT (TS_NEVER)
 The simulation stop time.
GLOBAL TIMESTAMP global_clock INIT (TS_ZERO)
 date format (ISO=0, US=1, EURO=2)
GLOBAL char global_tmp[1024] INIT ("/tmp")
 < location for temp files
GLOBAL char global_include[1024] INIT ("/usr/etc/gridlabd")
 include path for models and code headers
GLOBAL char global_urlbase[1024] INIT ("http://www.gridlabd.org/")
 < default urlbase used for online resources
GLOBAL int global_xml_encoding INIT (8)
 Specifies XML encoding (default is 8).
GLOBAL char
global_testoutputfile[1024] 
INIT ("test.txt")
 Specifies the test output file.
GLOBAL int global_threadcount INIT (1)
 the maximum thread limit, zero means automagically determine best thread count
GLOBAL char global_savefile[1024] INIT ("")
 The save file name.
GLOBAL char global_dumpfile[1024] INIT ("gridlabd.xml")
 The dump file name.
GLOBAL char global_workdir[1024] INIT (".")
 The current working directory.
GLOBAL unsigned
global_iteration_limit 
INIT (100)
 The global iteration limit.
GLOBAL int global_warn_mode INIT (TRUE)
 The warning mode flag.
GLOBAL int global_quiet_mode INIT (FALSE)
 The quiet mode flag.
GLOBAL char global_environment[1024] INIT ("batch")
 The processing environment in use.
GLOBAL unsigned
global_version_minor 
INIT (REV_MINOR)
 The software's minor version.
GLOBAL unsigned
global_version_major 
INIT (REV_MAJOR)
 The software's major version.

Variables

GLOBAL char global_command_line [1024]
 The current command-line.


Function Documentation

GLOBALVAR * global_create ( char *  name,
  ... 
)

Creates a user-defined global variable.

Returns:
a pointer to GLOBALVAR struct or NULL is failed
User defined variables can be created using a syntax similar to that of class_define_map(). However
  • addresses are absolute rather than relative to the object
  • size specifies the number of instances of the type located at the address

Todo:
this does not support module globals but needs to (no ticket)

Definition at line 162 of file globals.c.

References global_find(), int64, output_error(), output_warning(), PA_PRIVATE, PA_PROTECTED, PA_PUBLIC, PA_REFERENCE, PF_DEPRECATED, property_size(), PT_enumeration, PT_set, throw_exception(), and unit_find().

Referenced by cmex_global(), global_init(), and global_setvar().

GLOBALVAR * global_find ( char *  name  ) 

Find a global variable.

Returns:
a pointer to the GLOBALVAR struct if found, NULL if not found
Parameters:
name  name of global variable to find

Definition at line 123 of file globals.c.

References global_getnext().

Referenced by cmdarg_load(), cmex_get(), global_create(), global_getvar(), and global_setvar().

GLOBALVAR * global_getnext ( GLOBALVAR *  previous  ) 

Get global variable list.

This function retrieves global variable names. The first time it should be called with a NULL pointer to retrieve the first variable name. Subsequent calls should return the pointer to the previous variable name (and not a pointer to a copy).

Returns:
a pointer to the first character in the next variable name, or NULL of none found.

Definition at line 142 of file globals.c.

Referenced by cmdarg_load(), exec_debug_cmd(), and global_find().

char * global_getvar ( char *  name,
char *  buffer,
int  size 
)

Get the value of a global variable in a safer fashion.

Returns:
a char * pointer to the buffer holding the buffer where we wrote the data, NULL if insufficient buffer space or if the name was not found.
This function searches global, user-defined, and module variables for a match.

Definition at line 403 of file globals.c.

References class_property_to_string(), and global_find().

Referenced by cmdarg_load(), exec_debug_cmd(), and output_test().

STATUS global_init ( void   ) 

Register global variables.

Returns:
SUCCESS or FAILED

Definition at line 98 of file globals.c.

References global_create(), and output_error().

Referenced by exec_init().

STATUS global_setvar ( char *  def,
  ... 
)

Sets a user-defined global variable.

Returns:
STATUS value
User defined global variables can be set using a syntax similar to that of putenv(). The definition must be of the form "NAME=VALUE". If there is no '=' in the first argument, then it is used as a name and the second argument is read as a pointer to a string the contains the new value.

Definition at line 330 of file globals.c.

References class_string_to_property(), global_create(), global_find(), output_error(), PA_PUBLIC, and PT_char1024.

Referenced by cmdarg_load(), cmex_set(), and exec_debug_cmd().

GLOBAL TIMESTAMP global_clock INIT ( TS_ZERO   ) 

date format (ISO=0, US=1, EURO=2)

The main clock timestamp

GLOBAL bool require_voltage_control INIT ( false   ) 

Causes XML I/O to use strict XML data structures.

flag to enable voltage control source requirement

flag to enable dumping matrix calculations as they occur

GLOBAL bool NR_admit_change INIT ( true   ) 

Enforce strict global naming (prevents globals from being implicitly created by assignment).

Newton-Raphson admittance matrix change detector - used to prevent complete recalculation of admittance at every timestep.

GLOBAL unsigned int NR_branch_count INIT (  ) 

Flags the profiler to process class performance data.

Newton-Raphson branch count - used for determining size of branch vector.

flag to enable compile-only option (does not actually start the simulation)

flag to enable nondeterminism warning (use of rand when multithreading

flag to enable compact streams instead of XML or GLM

flag to force simulator into realtime mode

flag to suppress output notice of deprecated properties usage

The simulation starting time.

flag to disable multiple GLM file loads

flag to disable memory locking

flag to force recompile of GLM file even when up to date

the main process id

start gdb in a separate window

select gdb debugger

random number seed (default 0 means true randomization, non-zero means deterministic random state)

Causes the error to relax to a warning when object names start with numbers or special characters.

Enable a pause for user input after exit.

GLOBAL int global_suppress_repeat_messages INIT (  ) 

the maximum thread limit, zero means automagically determine best thread count

flag that allows repeated messages to be suppressed

the minimum timestep allowed

Todo:
Set the threadcount to zero to automatically use the maximum system resources (tickets 180)

GLOBAL char global_savefile [1024] INIT ( ""   ) 

The save file name.

the main program full path

comma separate list of runtime calls that will be traced

Path to folder containing installed application files.

Name of the current model.

Specifies KML file to dump.

Specifies that a process id file should be created.

GLOBAL unsigned char global_no_balance INIT ( FALSE   ) 

The quiet mode flag.

Flags module check code to be called after initialization.

Flags all modules to dump data after run complete.

Flag to keep progress reports.

Enables debug output.

The verbose mode flag.

The test mode flag.

Enables the debugger.


GridLAB-DTM Version 2.0
An open-source project initiated by the US Department of Energy