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

JSON output directory structure varying with the directory where app is run #256

Open
AntoineGautier opened this issue Nov 21, 2024 · 2 comments

Comments

@AntoineGautier
Copy link
Contributor

AntoineGautier commented Nov 21, 2024

With

  • modelica-json commit f0b714b (current master)
  • MBL commit 07dfbd56db (current master)

it seems that the structure of the directory where the JSON output is saved varies with the location where the app is run from.

Executing

rm -rf json && node ../modelica-json/app.js -f Buildings/Controls/OBC/ASHRAE/G36/AHUs/MultiZone/ -o json

from within modelica-buildings yields the following output directory.

 1.4M           ┌── Reals
 2.2M         ┌─┴ CDL
1016K         │     ┌── AirEconomizerHighLimits.json
 1.3M         │   ┌─┴ Generic
 1.1M         │   │     ┌── Controller.json
 1.2M         │   │     │   ┌── Limits
 2.0M         │   │     │ ┌─┴ Subsequences
 2.7M         │   │     ├─┴ Economizers
 672K         │   │     │ ┌── Validation
 744K         │   │     │ ├── OutdoorAirFlow
 860K         │   │     │ ├── FreezeProtection.json
 4.1M         │   │     ├─┴ SetPoints
 8.3M         │   │   ┌─┴ VAV
 8.3M         │   │ ┌─┴ MultiZone
 8.3M         │   ├─┴ AHUs
 9.6M         │ ┌─┴ G36
 9.6M         ├─┴ ASHRAE
  11M       ┌─┴ OBC
  11M     ┌─┴ Controls
  11M   ┌─┴ Buildings
  11M ┌─┴ json

In contrast, executing

rm -rf json && node modelica-json/app.js -f modelica-buildings/Buildings/Controls/OBC/ASHRAE/G36/AHUs/MultiZone/ -o json

from the directory just above modelica-buildings yields the following output directory.

2.7M                     ┌── Economizers
4.1M                     ├── SetPoints
8.3M                   ┌─┴ VAV
8.3M                 ┌─┴ MultiZone
8.3M               ┌─┴ AHUs
8.3M             ┌─┴ G36
8.3M           ┌─┴ ASHRAE
8.3M         ┌─┴ OBC
8.3M       ┌─┴ Controls
8.3M     ┌─┴ Buildings
8.3M   ┌─┴ modelica-buildings
3.3M   │               ┌── SetPoints
6.2M   │             ┌─┴ VAV
6.2M   │           ┌─┴ MultiZone
6.2M   │         ┌─┴ AHUs
7.5M   │       ┌─┴ G36
7.5M   │     ┌─┴ ASHRAE
9.7M   │   ┌─┴ OBC
9.7M   │ ┌─┴ Controls
9.7M   ├─┴ Buildings
 18M ┌─┴ json

This seems to be a regression as ctrl-flow invokes modelica-json (commit a46a361) from outside MBL and produces a correct output directory.

The bug seems to have been introduced with #202 — as revealed by tests before and after this commit.

@JayHuLBL @anandkp92 Can you reproduce it? Any idea what may cause this issue?

@AntoineGautier
Copy link
Contributor Author

Closed with #257

@AntoineGautier
Copy link
Contributor Author

AntoineGautier commented Jan 7, 2025

Reopening this issue.
Doing some tests locally it seems that we still get an incorrect structure when invoking modelica-json from outside the MBL directory.

1.2M           ┌── Components
1.2M           │ ┌── HeatPumps
2.2M           │ ├── Controls
3.4M           ├─┴ Plants
5.6M         ┌─┴ Templates
5.6M       ┌─┴ Buildings
5.6M     ┌─┴ modelica-buildings
1.1M     │ ┌── Templates
956K     │ │ ┌── Chillers
3.0M     │ ├─┴ Fluid
976K     │ │   ┌── CDL
1.3M     │ │   │       ┌── VAV
1.3M     │ │   │     ┌─┴ MultiZone
1.3M     │ │   │   ┌─┴ AHUs
3.3M     │ │   │ ┌─┴ G36
3.3M     │ │   ├─┴ ASHRAE
4.2M     │ │ ┌─┴ OBC
4.2M     │ ├─┴ Controls
8.8M     ├─┴ Buildings
 14M   ┌─┴ json
 14M ┌─┴ template-json

[EDIT] This happens in a very specific case where MODELICAPATH contains the path to another installation of the library and does not contain the path to the installation that we want to parse, which is located under the current working directory.
In this case, the library path in MODELICAPATH will shadow any file found in both installations during the class name lookup.
However, this can be considered as an improper use of modelica-json, see README.md. We may therefore close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant