Table of Contents

DoeCommand

The DoeCommand abstract base class serves as the foundation for all DOE-2 command objects in InpLab. Each command represents a block in an INP file with the structure:

"Unique Name" = COMMAND_TYPE
   KEYWORD = VALUE
   ..

Key Features

  • Uname: Unique identifier for the command instance
  • Command: The DOE-2 command type (e.g., "SPACE", "WINDOW", "SYSTEM")
  • Keywords: Dictionary of property key-value pairs
  • Parent/Children: Hierarchical relationships between objects
  • Model: Reference to the containing model

Type-Safe Operations with Enums

InpLab provides extension methods that allow you to work with DOE-2 commands using strongly-typed enums instead of string keys. This provides IntelliSense support, reduces errors, and makes your code more maintainable.

Enum-Based Keywords

Each command type has an associated enum for its keywords. For example, the Space command uses SpaceKeyWords:

public enum SpaceKeyWords
{
    Azimuth,
    X,
    Y,
    Z,
    Volume,
    Area,
    AreaPerPerson,
    LightingSchedul,
    EquipSchedule,
    SourceSchedule,
    PeopleSchedule,
    InfSchedule,
    LightingWPerArea,
    LightingKw,
    EquipmentWPerArea,
    EquipmentKw,
    EquipSensible,
    EquipLatent,
    SourceType,
    SourcePower,
    SourceSensible,
    SourceLatent,
    NumberOfPeople,
    PeopleHgSens,
    PeopleHgLat,
    InfMethod,
    InfFlowPerArea,
    AirChangesPerHr,
    ZoneType,
    LtgSpecMethod,
    CActivityDesc,
    Daylighting,
    LightCtrlType1,
    LightCtrlType2,
    LtgCtrlMethod1,
    LtgCtrlMethod2,
    ZoneFraction1,
    ZoneFraction2
}

Setting Values with Enums

The DoeCommandSetExtensions class provides several overloads of the Set method for different value types:

Setting Enum Values

Use when the DOE-2 keyword expects an enum value (like system types or options):

space.Set(SpaceKeyWords.ZoneType, ZoneTypeOptions.Plenum);
system.Set(DoeSystemKeywords.Type, DoeSystemType.Vav);

Setting Numeric Values

For double-precision floating point values:

space.Set(SpaceKeyWords.LightingWPerArea, 1.2);
space.Set(SpaceKeyWords.Area, 1000.0);

Setting String Values

For custom strings or text values:

space.Set(SpaceKeyWords.CActivityDesc, "Office Space");

Setting Boolean Values

Automatically converts to DOE-2's "YES"/"NO" format:

system.Set(DoeSystemKeywords.RecoverExhaust, true);
erv.Set(ErvKeywords.FrostControl, false);

Setting Lists of Strings

For keywords that accept multiple values in parentheses:

boiler.Set(BoilerKeywords.BoilerNames, "Main Boiler", "Backup Boiler");
// Results in: BOILER-NAMES = ( "Main Boiler", "Backup Boiler" )

Getting Values

You can also retrieve values using enums:

string lightingSchedule = space.Get(SpaceKeyWords.LightingSchedul);
double area = double.Parse(space.Get(SpaceKeyWords.Area) ?? "0");

Benefits of Enum-Based Operations

  • Type Safety: Compile-time checking prevents typos in keyword names
  • IntelliSense: Auto-completion shows available keywords and values
  • Maintainability: Refactoring enum names updates all usage
  • Documentation: Enums can include XML comments for better IDE support
  • Consistency: Standardized value conversion (e.g., bool to YES/NO)

These extension methods work with any DoeCommand subclass, making your InpLab code more robust and developer-friendly.

Command Types

All DOE-2 command types in InpLab inherit from DoeCommand. The following is the complete list of supported command types:

Building Components