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' ✅
Currently the parser only handles
element_listinLongClass:However, if elements are declared in a
publicorprotectedsection, they are not included in theelement_listarray but in thepublic_element_listorprotected_element_listarray, inside theelement_sectionsarray. Note that there may be multiplepublic_element_listandprotected_element_listarrays, for example when parsing the following Modelica code.This ticket is to add support for parsing these sections in the
LongClassconstructor.templates.jsonas they may be used to enable/disable public elements.visibleproperty (static flag baked intotemplates.json) must be false for protected elements so they are not rendered in the parameter dialogs by the client.npm run parseTemplateJSON. The impact must be evaluated when addressing the issue.Considering the impact, and the fact that protected elements can only be accessed within their own class, we restrict the parsing of
protected_element_listto the classes within the templates root package – annotated with__ctrlFlow(routing="root").Templatespackage: 2' ✅