Skip to content

Improve Dialog.enable annotation handling #599

Description

@AntoineGautier

Follow-up to #492 (see the summary comment there for the full behavior audit).

Current behavior

Dialog(enable=...) is parsed in setUIInfo() (parser.ts:767-778) into instance.enable. In
Component.getInputs(), a literal enable=false blanks the component's childInputs
(parser.ts:896-899: this.enable === false || this.deadEnd), making its compositional elements
unreachable in the instance tree — while an enable expression that evaluates to false does not
(the check is strict === false). Note the component's type is already fully and recursively parsed
either way (parser.ts:893, 935-938); only the inputs reference lists are severed.

This breaks the recommended templates pattern
(https://lbl-srg.github.io/modelica-buildings-templates/guide/#subrecord-with-configuration-parameters),
where the cfg instance inside each parameter record is annotated Dialog(enable=false) and its
parameters are referenced by enable expressions and bindings throughout the record (e.g. 101
cfg.* references in Plants/HeatPumps/Components/Data/Controller). Client-side resolution walks
the inputs/options arrays (client interpreter.ts:147-155, 274-276), so severed lists mean those
expressions resolve to null.

Proposed change

Make Dialog(enable=...) a pure UI feature, consistent for literals and expressions:

  • Parser: stop blanking childInputs on enable === false (parser.ts:897). The class instantiated
    with this annotation is fully parsed (already the case today) and childInputs fully populated.
    Keep enable on the emitted entry.
  • Client: implement display propagation in the instance tree — if any parent instance is disabled,
    its children must not be displayed. Today getOptionInstance (interpreter.ts:1225-1236) computes
    display per option in isolation; without the propagation rule, previously hidden parameters
    (e.g. record cfg members) would start rendering. This is a prerequisite for the parser change,
    not a follow-up.
    It must operate on the instance tree, since the same class can be reachable via
    both a disabled and an enabled instance path.
  • schedule.ts keeps reading component.enable into the schedule attributes (schedule.ts:446-453) —
    unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions