lbl-srg / modelica-json

Modelica to JSON Parser
Other
21 stars 17 forks source link

TypeError: Cannot read property 'replace' of null #106

Closed mwetter closed 3 years ago

mwetter commented 4 years ago

The following commands fail

git clone git@github.com:lbl-srg/modelica-buildings.git
cd modelica-buildings
git checkout 067b6e41640a5813fad108b61196402ff5d82da8
cd -

git clone git@github.com:lbl-srg/modelica-json.git
cd modelica-json/
make install
make compile
node app.js -f ../modelica-buildings/Buildings/Examples/Tutorial/CDL -o docx -m modelica -d out

The error message is

warn:    Instance "vol" has no comment. Check Buildings.Examples.Tutorial.CDL.BaseClasses.PartialOpenLoop
warn:    Instance "spl2" has no comment. Check Buildings.Examples.Tutorial.CDL.BaseClasses.PartialOpenLoop
warn:    Instance "weaBus" has no comment. Check Buildings.Examples.Tutorial.CDL.BaseClasses.PartialOpenLoop
warn:    Instance "conEquSta" has no comment. Check Buildings.Examples.Tutorial.CDL.Controls.Validation.EquipmentOnOff
warn:    Instance "conRadSup" has no comment. Check Buildings.Examples.Tutorial.CDL.Controls.Validation.RadiatorSupply
warn:    Instance "conSysSta" has no comment. Check Buildings.Examples.Tutorial.CDL.Controls.Validation.SystemOnOff
/home/mwetter/test/modelica-json/lib/jsonquery.js:118
    'comment': getComment(model).replace(/"/g, ''),
                                ^

TypeError: Cannot read property 'replace' of null
    at Object.simplifyModelicaJSON (/home/mwetter/test/modelica-json/lib/jsonquery.js:118:33)
    at getJsons (/home/mwetter/test/modelica-json/lib/parser.js:180:19)
    at Object.getJSON (/home/mwetter/test/modelica-json/lib/parser.js:147:21)
    at Object.<anonymous> (/home/mwetter/test/modelica-json/app.js:76:15)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
mwetter commented 4 years ago

@JayHuLBL : Can you please correct this. It it still broken on my system.

JayHuLBL commented 4 years ago

To do: