- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » How can I use a converion script
How can I use a converion script
How can I use a converion script
Consider following example
Code:
package myLib
package Archive
end Archive
package subPacakge
model myModel
end myModel;
end subPacakge;
annotation(version="1.0.0"
and myLib;
and a newer version of it
Code:
package myLib
package Archive
model myModel
end myModel;
end Archive
package subPacakge
model myModel_v2
end myModel_v2;
end subPacakge;
annotation(version="1.0.1",
conversion(from(version={"1.0.0"}, script="modelica://oldLib/Resources/convertingScript.mos")));
and myLib;
with mos script inside Resources
Code:
convertClass("oldLib.subPackage.model_v1",
"oldLib.Arcihve.model_v1")
how can I convert a model/package using convert script in OMEdit, if my library was not in HOME/.openmodelica/library ?
Code:
package testPackage
model testModel
oldLib.subPackage.model_v1 model_v1;
end testModel;
annotation(uses(oldLIb(version="1.0.0")));
I've tried running [code}OpenModelica.Scripting.convertPackageToLibrary(testPackage, oldLib, "1.0.1")
Code:
[1] 12:24:43 Translation Error
JSON expected value, got <EOF>...
[2] 12:24:43 Scripting Error
[C:/Users/~/AppData/Roaming/.openmodelica/libraries/index.json: 0:0-0:0]: The package index C:/Users/~/AppData/Roaming/.openmodelica/libraries/index.json could not be parsed.
What did i missed?
Edit: I got it working by pre-loading the testPackage whe OM is open. But this does not change the original source code of testPackage. If one want to "update" the source code of testPackage, than one have to make a new copy of testPackage with save_as
Edit 2: right-click on myModel on Library Browser and right click up update binding seems to solve my problem. But it will be awful if you have multiple models that need to be updated
- Arinomo23
- 120 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » How can I use a converion script