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

BOPTEST: bestest_air, white space and sematic model missing annotations #251

Open
EttoreZ opened this issue Oct 16, 2024 · 3 comments
Open

Comments

@EttoreZ
Copy link

EttoreZ commented Oct 16, 2024

This issue reports problems found when trying to postprocess BOPTEST bestest_air model using modelica-json to extrapolate semantic model from Modelica annotations. Two issues were found:

  1. When white space is removed from extrapolated model metadataLanguage line, modelica-json throws an error
  2. The extrapolated semantic model is incomplete, since not all annotations are extracted

To reproduce both errors go BOPTEST folder in terminal project1-boptest/testcases/bestest_air/models and run node $MODELICAJSONPATH/app.js -f BESTESTAir/TestCases/TestCase_Ideal.mo -o semantic -m modelica -d m2j_output. BOPTEST reference branch issue591

For error 1. Before running command remove white space in ‘BESTESTAir.TestCases.TestCase_Ideal.mo’ metadataLanguage declaration (see screenshot)
image
This is the resulting error:
image

For error 2. When .ttl file is generate two annotations are missing, one for the zone temperature BESTESTAir.BaseClasses.Case600FF.reaTRooAir and one for the zone CO2 BESTESTAir.BaseClasses.Case600FF.reaCO2RooAir. Reason unclear, only difference from other annotations is the level of nesting (Annotation is 2 levels deep instead of 1 level deep compared to starting model).

@anandkp92
Copy link
Member

@EttoreZ This is a bit weird, but I tried replicating this on my machine and with/without whitespaces I did not get any error and I was able to generate the semantic model. Can you give some more details about your environment?

@anandkp92
Copy link
Member

Adding similar issues faced by Lazlo:

Having a similar error with multizone_simple_office_air on fork: https://github.com/anandkp92/project1-boptest/tree/issue591_semantics/testcases/multizone_office_simple_air

The error is:

error:   *** Error when parsing /home/lazlo/volttron-simulated-digital-twin/simulated-digital-twin/project1-boptest/testcases/multizone_office_simple_air/models/MultiZoneOfficeSimpleAir/BaseClasses/Floor.mo: "line 1:0 token recognition error at: ''
".
/home/lazlo/Desktop/modelica-json/lib/modelicaToJSON.js:35
    throw new Error(msg)
          ^

Error: *** Error when parsing /home/lazlo/volttron-simulated-digital-twin/simulated-digital-twin/project1-boptest/testcases/multizone_office_simple_air/models/MultiZoneOfficeSimpleAir/BaseClasses/Floor.mo: "line 1:0 token recognition error at: ''
".
    at Object.toJSON (/home/lazlo/Desktop/modelica-json/lib/modelicaToJSON.js:35:11)
    at getRawJson (/home/lazlo/Desktop/modelica-json/lib/parser.js:63:22)
    at getSimpleJson (/home/lazlo/Desktop/modelica-json/lib/parser.js:96:19)
    at /home/lazlo/Desktop/modelica-json/lib/parser.js:114:25
    at Array.forEach (<anonymous>)
    at getSimpleJson (/home/lazlo/Desktop/modelica-json/lib/parser.js:112:22)
    at Object.getJsons (/home/lazlo/Desktop/modelica-json/lib/parser.js:47:24)
    at /home/lazlo/Desktop/modelica-json/app.js:101:10
    at new Promise (<anonymous>)
    at Object.<anonymous> (/home/lazlo/Desktop/modelica-json/app.js:97:35)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.11.1

After changing to the directory testcases/multizone_simple_office_air/models run the following command

node $MODELICAJSONPATH/app.js -f MultiZoneOfficeSimpleAir/TestCases/TestCase.mo -o semantic -m modelica -d m2j_output

@EttoreZ
Copy link
Author

EttoreZ commented Jan 13, 2025

@EttoreZ This is a bit weird, but I tried replicating this on my machine and with/without whitespaces I did not get any error and I was able to generate the semantic model. Can you give some more details about your environment?

Hey Anand. Sorry I did not see this reply before, sure:

  • I am using the latest commit of [BOPTEST issue591_addSemanticTags](https://github.com/ibpsa/project1-boptest/tree/issue591_addSemanticTags)
  • Ubuntu 22
  • This is the modelicajson commit I am using 39f60b6

Let me know if you want me to test anything with a different version of modelica-json

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

2 participants