From GridLAB-D Wiki
Jump to: navigation, search

gl_* Output Functions

Sometimes, the model doesn’t work, and extra output is needed, since “domain error” is often the only output message and it doesn’t explain very much. At others time, something just breaks, or the values within the model are needed for reality checking a prototype. To print something to the screen, there are a series of callbacks reaching into output.c. All of the following functions behave much in the same way that printf() does, with variable arguments being concatenated into a null-terminated string.

gl_error(char *, …)

Matches output_error(). Prefaces a formatted string with “ERROR:” and prints it to stderr. Indicates a situation where the simulation is in an inconsistent state and will not produce valid answers, but can continue processing. The model frequently diverges shortly after an error message in the existing modules. The --quiet flag suppresses this stream.

gl_output(char *, …)

Matches output_message(). It will print an informative statement to stdout.

gl_warning(char *, …)

Matches output_warning(). Prefaces a warning message with “WARNING:” and prints it to stderr if --warn is enabled, or if the global “warn” is nonzero. Used for alerting the user that a state is outside its “intended” range, though the results should still be reasonable.

gl_verbose(char *, …)

Matches output_verbose(). Used for printing extraneous information when the --verbose flag is enabled. Verbose output displays a great deal of data about the inner working of the core in practice.

gl_testmsg(char *, …)

Matches output_test(). This function opens a file with the string in the global testoutputfile, which is “test.txt” by default, prints a header, and prints any test output to that file. Primarily used with test and check functions to ensure the accuracy of the test or model results.

gl_debug(char *, …)

Matches output_debug(). Prints a string prefaced with “DEBUG:” if --debug' or --debugger are enabled. Using this function is only recommended while running the build-in GridLAB-D debugger.