Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple libraries and library versions #431

Open
AntoineGautier opened this issue Feb 11, 2025 · 3 comments
Open

Support multiple libraries and library versions #431

AntoineGautier opened this issue Feb 11, 2025 · 3 comments
Labels
enhancement Top Priority Top of the Priority List

Comments

@AntoineGautier
Copy link
Collaborator

AntoineGautier commented Feb 11, 2025

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.

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.
@AntoineGautier AntoineGautier changed the title Support multiple libraries and version Support multiple libraries and library versions Feb 11, 2025
@AntoineGautier AntoineGautier added Top Priority Top of the Priority List enhancement labels Feb 11, 2025
@mwetter
Copy link
Member

mwetter commented Feb 11, 2025

@AntoineGautier : While we are working on adding this support, I wonder if we should also add some kind of a configuration. A use cases is that there are two ctrl-flow installations, say one is managed by LBL and one by CERL (or one is the stable release and one is a nightly release). Now, assume CERL does not want to include Zone equipment, perhaps because it has not reviewed them. How would ctrl-flow be configured to exclude the export of certain packages?

@AntoineGautier
Copy link
Collaborator Author

@mwetter Good point. What about the configuration file I propose in #431 (comment)?

@mwetter
Copy link
Member

mwetter commented Feb 12, 2025

@AntoineGautier : The configuration looks good but this point could be considered: Now it has entries

      url: "https://github.com/lbl-srg/modelica-buildings.git"
      tag: "v11.0.0" # One of tag or commit must be specified
      commit: # One of tag or commit must be specified

This makes it cumbersome to use the head of a branch, such as for CI testing using the latest version of the library (or a branch). It also raises the issue of what happens if both, tag and commit are specified (probably an error).
An alternate specification could be a full url to the head, tag, branch, with valid entries being one of these:

   url: "https://github.com/lbl-srg/modelica-buildings/tree/v11.0.0"
   url: "https://github.com/lbl-srg/modelica-buildings/" # head of the master
   url: "https://github.com/lbl-srg/modelica-buildings/tree/issue4110_cdlInDHC"  # head of that branch
   url: "https://github.com/lbl-srg/modelica-buildings/commit/8712af7d680d5daa8a559e56f789346201306776"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Top Priority Top of the Priority List
Projects
None yet
Development

No branches or pull requests

2 participants