Skip to content

Support multiple libraries and library versions #431

@AntoineGautier

Description

@AntoineGautier

Context

The tool is hard-coded to only work with the Modelica Buildings Library, preventing use with other libraries.

This contrasts with the original requirements:

The template package of the Modelica Buildings Library is preloaded. The tool provides the option to load additional template packages from third-party libraries.

Library version management: If a loaded class contains the Modelica annotation uses (e.g., uses(Buildings(version="6.0.0")) the software checks the version number of the stored library. If the version number does not match, the tool simply alerts the user of version incompatibility.

Objective

This ticket is to provide support for multiple libraries, and multiple library versions.

A configuration file should enable specifying the libraries to be loaded and also support customized installations:

installation:
    name: "LBL-ctrl-flow"
    version: "1.0.0"
    maintainer: "LBL"
    description: "LBL maintained installation of ctrl-flow"

libraries:
    - name: "Buildings" # Only entry point libraries - other library dependencies will be detected through 'uses' annotations
      git_url: "https://github.com/lbl-srg/modelica-buildings.git" # Valid URL for git clone
      git_ref: "v11.0.0" # Optional branch, commit or tag to check out, otherwise the repo HEAD branch e.g. master is used
      exclude_packages:
        - "Buildings.Templates.Plants" # Modelica fully qualified package name to be excluded from install

To Do

The following needs to be refactored (non exhaustive list).

In https://github.com/lbl-srg/ctrl-flow-dev/blob/main/server/bin/install-modelica-dependencies.sh:

MODELICA_BUILDINGS_COMMIT=b399379315641da39b231033b0660100fd6489a5
...
git clone -b v3.2.3+build.4 --single-branch --depth 1 https://github.com/modelica/ModelicaStandardLibrary.git
  • A configuration file should be created to specify the library names and tag or commit number to be loaded.

  • The library dependencies (here Modelica Standard Library) should be identified based on the Modelica uses annotation from the libraries to be loaded, see Fetch MSL version from uses annotation #412.

    • [EDIT on 5/12/25] Further specification is needed regarding how to resolve a uses annotation such as uses(Modelica(version="4.0.0")) into a git URL.

In https://github.com/lbl-srg/ctrl-flow-dev/blob/main/server/Dockerfile:

ENV MODELICAPATH=/dependencies/ModelicaStandardLibrary:/dependencies/modelica-buildings
...
RUN node modelica-json/app.js -f modelica-buildings/Buildings/Templates -o json -d template-json

In https://github.com/lbl-srg/ctrl-flow-dev/blob/main/server/scripts/parse-template-package.ts:

loadPackage("Buildings.Templates");
  • See above for how to detect the root package where templates are stored.
  • The templates should be parsed separately for each loaded library.

In https://github.com/lbl-srg/ctrl-flow-dev/tree/main/server/scripts/sequence-doc/src:

  • The source documents to create the sequence documentation should be organized by {library, version}.
  • The DEFAULT_DOC_VERSION variable should depend on {library, version}.

In the React frontend:

  • The left navigation panel should be organized to display the tree-structure of the templates package for each loaded library.
├── Library 1
│   └── Air handlers and fans
│   └── Plants
└── Library 2
    └── Air handlers and fans
    └── Zone equipment
  • The payload sent to the server to create the documentation should include the information about the library and version of the configured templates.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions