Skip to content

Add parsing for element_sections in LongClass #494

@AntoineGautier

Description

@AntoineGautier

Currently the parser only handles element_list in LongClass:

export class LongClass extends Element {
// ...
    this.elementList =
      specifier.composition.element_list
        ?.map((e: any) => {
//...

However, if elements are declared in a public or protected section, they are not included in the element_list array but in the public_element_list or protected_element_list array, inside the element_sections array. Note that there may be multiple public_element_list and protected_element_list arrays, for example when parsing the following Modelica code.

model MultipleSections
  parameter Real p;
protected 
  parameter Real q;
public 
  parameter Real r;
protected 
  parameter Real s;
public 
  parameter Real t;
end MultipleSections;

This ticket is to add support for parsing these sections in the LongClass constructor.

  • Protected elements must be included in templates.json as they may be used to enable/disable public elements.
  • The existing visible property (static flag baked into templates.json) must be false for protected elements so they are not rendered in the parameter dialogs by the client.

⚠️ This change is expected to significantly increase the runtime of npm run parseTemplateJSON. The impact must be evaluated when addressing the issue.

  • Parsing time for VAV & HP plant templates w/ that change: 17' ❌
  • Parsing time for VAV & HP plant templates w/o that change: 2'

Considering the impact, and the fact that protected elements can only be accessed within their own class, we restrict the parsing of protected_element_list to the classes within the templates root package – annotated with __ctrlFlow(routing="root").

  • Parsing time for VAV & HP plant templates w/ that change and w/ restricting protected sections parsing to the classes within the Templates package: 2' ✅

Metadata

Metadata

Labels

Top PriorityTop of the Priority ListbugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions