To understand how to create and use IF_Blocks, you should understand the terminology that was developed related to IF_Blocks. Below are some important terms and their definitions:

  • IF_Blocka feature that you can add to a zone in which you can define one or more conditional expressions that, when evaluated to a value of TRUE, activates one or more operation rules. An IF_Block contains an ordered list of conditional blocks.
    A complex (or compound) conditional expression strings together two or more simple conditional expressions using the logical operators: AND and OR.
    • Conditional Blockan object made up of a conditional expression and a rule set that will be activated when the conditional expression evaluates to true.
      IF, ELSE IF, and ELSE are the three types of conditional blocks that may be members of an IF_Block in ResSim. By default, all IF_Blocks are created with an IF in their list of conditional blocks; you can add one ELSE and one or more ELSE IFs to the IF_Block list.
    • Conditional Expression—a logical or comparative statement that can be evaluated to TRUE or FALSE. A simple conditional expression compares two objects or values using one of the comparison (or Boolean) operators: =, >=, >, <=, <, and !=.
    • IF—one of the three types of conditional blocks that may be found in an IF_Block.

      For simplicity, an IF conditional block will usually be referred to in this document as an IF. The feature that an IF is contained in will always be referred to as an IF_Block.
      And, for consistency, the ELSE and ELSE IF conditional blocks will also be referred to as just ELSE and ELSE IFs.


      An IF conditional block is always created as part of an IF_Block; it cannot be deleted nor can another IF be added. The IF is always first in the list of conditional blocks that belongs to an IF_Block and, as such, its conditional expression is always evaluated first. If the IF block's conditional expression evaluates to true, the IF's rule set will be added to the zone's set of active rules and the conditional expressions for the remaining conditional blocks contained in the parent IF_Block will be evaluated; however, if there are any nested IF_Blocks in the IF block's rule set, the conditional expression evaluation will move into the nested IF_Block(s).

  • ELSE IFone of the three types of conditional blocks that may be found in an IF_Block. If an ELSE IF has been added to an IF_Block, the ELSE IF is evaluated only when the conditional expression of the preceding IF evaluated to FALSE. If more than one ELSE IF has been added to the IF_Block, the ELSE IFs will form an ordered list between the IF block and the ELSE block (if there is one); the conditional expressions of the ELSE IF blocks will be evaluated in order, from top down, until one of them evaluates to TRUE, at which point the evaluation of the conditional expressions will cease and the rule set of the TRUE ELSE IF block will be added to the current zone's list of active rules. If the conditional expressions of all the ELSE IF blocks evaluate to FALSE, the rules in the ELSE block (if there is one) will be added to the current zone's list of active rules.

  • ELSEone of the three types of conditional blocks that may be found in an IF_Block. Only one ELSE may be added to an IF_Block. When added, the ELSE will always be placed at the bottom of the ordered list of conditional blocks in the IF_Block. Although an ELSE does not have a conditional expression that you can specify, think of it as having a conditional expression that is always TRUE. As a result, an ELSE's rule set will be activated when the conditional expressions of the IF and all the ELSE IFs that precede it evaluate to FALSE.

  • Nested IF_Block—this is an IF_Block that is added to the rule set of a conditional block belonging to a higher-level (or parent) IF_Block.

    A ResSim Truth: wherever you can add a rule, you can add an IF_Block.

    Nested IF_Blocks can be useful, especially when you need to conditionally activate the same rule set in multiple conditional blocks of a single IF_Block or in multiple other IF_Blocks. However, do not use a nested IF_Block as a way to avoid defining a conditional block with a compound or complex conditional expression and/or using multiple ELSE IF blocks.

  • Rule Setthe prioritized list of rules and IF_Blocks belonging to a zone or conditional block.
    During the compute of each timestep and after the current zone has been determined, ResSim needs to assemble the zone's list of active rules before it can evaluate those rules. To do so, ResSim processes each member of the zone's rule set, from top to bottom—if a member of the rule set is a…

    • Rule—the rule is added to (the bottom of) the active rule list.

      • IF_Block—ResSim evaluates the conditional expression of each conditional block in the IF_Block until it encounters one that evaluates to TRUE, at which point ResSim processes the members of the conditional block's rule set, adding its rules to the zone's active rule list and evaluating its IF_Blocks.