- Index
- » Developer
- » OpenModelica development
- » Loading modelica file using JavaOMCApis
Loading modelica file using JavaOMCApis
Loading modelica file using JavaOMCApis
Dear all,
I am new to Modelica and JavaOMC Apis. I have two modelica files and I am able to load one file successfully, but not the second. First file starts with
package ABC***
and second has:
within Modelica.Fluid.Examples;
package ABC*** extends Modelica.Icons.ExamplesPackage;
I would like to know, if I have to make any specific method calls/ environment setup before I should parse the second. My brief code is as below
JavaOMCAPI omc = new JavaOMCApi()
omc.getStandardLibrary();
File file = new File(fileName);
if(file.exists() {
boolean result = omc.loadFile(file.getPath()); //loadFile returns zero for second file
if(result) {
String[] packages = omc.getPackages();
}
}
Please help.
Thanks in advance.
Kind regards,
Yogi
Re: Loading modelica file using JavaOMCApis
Call omc.getErrorString() when result is false so that compiler can giev you error that occurred while loading the file.
Code:
boolean result = omc.loadFile(file.getPath()); //loadFile returns zero for second file
if(result) {
String[] packages = omc.getPackages();
} else {
print(omc.getErrorString());
}
Adeel.
- adeas
- 454 Posts
Re: Loading modelica file using JavaOMCApis
Thanks Adeas,
I have sorted this problem now. There were few issues:
1. Not using fully qualified domain names for package
2. Package name was not referred correctly in the .mo file and
3. It helps a lot when you use default directory as I think JavaOMC apis has some issues in parsing windows absolute paths.
Kind regards,
Yogi
- Index
- » Developer
- » OpenModelica development
- » Loading modelica file using JavaOMCApis