From GridLAB-D Wiki
Jump to: navigation, search

REQUIREMENT  Proposed for review  --Dchassin 14:09, 6 August 2012 (UTC)

Req:debug module - Debug module requirements

As of Hassayampa (Version 3.0) debugging is no longer supported directly in the core. Instead it is implemented by the debug module, which functions much like the assert module but provides a mechanism for users to input commands and alter the behavior of the debugging objects while the simulation is running. By default this user interface is the command line, but an API is provided to hook in graphical user interfaces as well.

Application Concept

The debug module allows modelers to include debugging object in models. Debugging objects allow inspection of properties and global while the simulation is running. Some illustrative examples are

Break on a global variable
The following illustrates stopping the simulation when the clock reaches a specified date and time
// Examples:debug_clock.glm
module debug {
  break "clock == '2001-01-01 00:00:00';
  action "prompt";
The following behavior occurs
host% gridlabd --debugger debug_clock.glm
DEBUG: break on clock == '2001-01-01 00:00:00';
DEBUG> quit

 TODO:  provide more examples taken from integrated debugger


A breakpoint defines a condition that causes the debugger to stop when the condition is satisfied.
Debug command 
A debug command is a command that is interpreted by a debug object.
Debug context 
The debug context determines the scope within which command are interpreted.
Debug object 
A debug object is an object that is capable of accepting debug commands.
A watchpoint defines a value that causes the debugger to stop when the value changes.

General requirements


Objects defined in the debug module shall be active only when the global variable debug is set to a non-zero value.


Debug objects shall establish the context in which debug commands are interpreted.


Global context
Debug object with no parent shall use the global context.


Local context
Debug objects with a parent shall use the parent object's context.


Debug objects shall stop and accept commands when a breakpoint condition is satisfied.


Debug objects shall stop and accept commands when a watchpoint variable is modified.


The debug module is supported as of Hassayampa (Version 3.0).

See also