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

Failing to find some Modelica files with util.searchPath #246

Open
AntoineGautier opened this issue Sep 3, 2024 · 2 comments
Open

Failing to find some Modelica files with util.searchPath #246

AntoineGautier opened this issue Sep 3, 2024 · 2 comments

Comments

@AntoineGautier
Copy link
Contributor

AntoineGautier commented Sep 3, 2024

Classes from MSL

The function searchPath from util.js fails to find the path to the Modelica files of various types from the MSL.

console.log(process.env.MODELICAPATH) // returns /home/reituag/gitrepo/modelica-buildings:/opt/dymola-2024xRefresh1-x86_64/Modelica/Library/

fs.lstatSync('/opt/dymola-2024xRefresh1-x86_64/Modelica/Library/Modelica 4.0.0/package.mo').isFile() // returns true

utilM2j.searchPath( // returns []
    ['Modelica.Units.SI.Time'], 
    'Buildings.Templates.Plants.Controls.HeatPumps', 
    '/home/reituag/gitrepo/modelica-buildings/Buildings/Templates/Plants/Controls/HeatPumps/AirToWater.mo')

utilM2j.searchPath( // returns []
    ['Modelica.StateGraph.InitialStepWithSignal', 'Modelica.StateGraph.StepWithSignal'], 
    'Buildings.Templates.Plants.Controls.Utilities', 
    '/home/reituag/gitrepo/modelica-buildings/Buildings/Templates/Plants/Controls/Utilities/StageIndex.mo')

These types have in common that they are part of packages using the Single File Mapping rules.

Classes instantiated using simple names

The class name lookup also fails for some classes from MBL which are instantiated with their simple name (not composed using dot notation).

utilM2j.searchPath( // returns [ "/Users/reituag/python/notebooks/js/Enable.mo" ] instead of [ "/home/reituag/gitrepo/modelica-buildings/Buildings/Templates/Plants/Controls/HeatRecoveryChillers/Enable.mo" ]
    ['Enable'], 
    'Buildings.Templates.Plants.Controls.HeatRecoveryChillers', 
    '/home/reituag/gitrepo/modelica-buildings/Buildings/Templates/Plants/Controls/HeatRecoveryChillers/Controller.mo')
@AntoineGautier
Copy link
Contributor Author

I can confirm this issue from the command line:

$ echo $MODELICAPATH
/home/reituag/gitrepo/modelica-buildings:/opt/dymola-2024xRefresh1-x86_64/Modelica/Library/
$ rm -rf json
$ node ../modelica-json/app.js -f Buildings/Fluid/Actuators/BaseClasses/PartialDamperExponential.mo
...
$ tree json
json
└── Buildings
    └── Fluid
        ├── Actuators
        │   └── BaseClasses
        │       ├── ActuatorSignal.json
        │       └── PartialDamperExponential.json
        ├── BaseClasses
        │   ├── ActuatorFilter.json
        │   └── PartialResistance.json
        └── Interfaces
            ├── PartialTwoPortInterface.json
            └── PartialTwoPort.json

6 directories, 6 files

The classes from MSL (such as Modelica.Units.SI.*) are not parsed.
This is with the master branch of modelica-json, commit f0b714b

@JayHuLBL Can you reproduce it on your system?

@AntoineGautier AntoineGautier changed the title Failing to find some Modelica files from MSL with util.searchPath Failing to find some Modelica files with util.searchPath Sep 26, 2024
@AntoineGautier
Copy link
Contributor Author

@anandkp92 Let me know if I can help on this one: it's a blocker for other developments.

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