-
Notifications
You must be signed in to change notification settings - Fork 72
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
Read Modelica MATv4 files #181
Conversation
We now have the |
OpenModelica v4 and Dymola v4 use Matlab v4 format, but have the variables and values stored in a particular format as mentioned by @bc0n above. DyMat or buildingspy can read these in python. The above work by @bc0n, reads OpenModelica v4 files, and with slight fixes reads Dymola v4 format with this. My only concern is whether there would be some repetition in some code, as Modelica .mat is also a matalb v4 files. Ideally (according to me) the function reading the Modelica .mat file should be using the matlab v4 read function, to return variables or values. Practically I would love to have this functionality as it is, and and issue could be create to potentially use |
If we can autovdetect the Matlabv4 and the Modelicav4, I think that would be great. I think this PR certainly needs two things in the interim:
|
Added support for Dymola .mat files, merged the latest JuliaIO repo
Thanks @qnikil7 et all, can you also simulate the FallingBodyBox model under Dymola2021 so that we have some coverage into the Modelica Standard Library? |
author Steve Kelly <[email protected]> 1686172667 -0400 committer Ben Conrad <[email protected]> 1688421797 -0500 parent 61648d7 author Steve Kelly <[email protected]> 1686172667 -0400 committer Ben Conrad <[email protected]> 1688421721 -0500 parent 61648d7 author Steve Kelly <[email protected]> 1686172667 -0400 committer Ben Conrad <[email protected]> 1688421288 -0500 Update make.jl
readAllVarialbes requires all data to be Vector
* initial read support * v4 write support * add tests for v4 * move check routine * edit docs * added functionality to write into v4 mat files using keyword argument * Reset version number * Updated readme * Updated readme --------- Co-authored-by: vsaase <[email protected]> Co-authored-by: Quadras <[email protected]>
* Add documentation * Tweak docstring * Add urls to readme --------- Co-authored-by: Steve Kelly <[email protected]>
author Ben Conrad <[email protected]> 1675804063 -0600 committer Ben Conrad <[email protected]> 1688437150 -0500 started reader write
@sjkelly the rebase was a bit rough but is much clearer now, let me know if you'd like me to open a new pr in place of this one. |
Looks like the _mecpy error has gone away; again let me know if there's anything I can do to get this to merge. Or if it's not a fit I'll put it elsewhere. |
Given the size of this commit, wouldn't it be better to have a separate package? |
That's fine, @ViralBShah, moving to https://github.com/mechanomy/ModelicaMAT |
@bc0n Thanks! If you'd like to have that package in this org (naturally with ownership permissions), please let me know. |
This adds support for reading v4 MAT files written by OpenModelica, according to the format detailed here. This Modelica format is not readable by either #132 or #164.
At this point I'm not exporting any of the operations into MAT.jl. As in test/runtests_modelica.jl they can be accessed directly by
MAT.MAT_v4_Modelica.readAclass("matfile.mat")
. The function design is very literal right now and will be condensed into all-in-one accessors at some point.Given the size of MAT files, read operations are atomic. This differs from the MAT.jl interface, as the file pointer is never given to the user. And right now, there is now ability to write files, mostly because I have no workflow requirement for this. Also my development only included files authored by OpenModelica; Dymola appears to write a slightly different format.
Stepping back, I'd appreciate comments on the design and whether and how the operations for reading OpenModelica MATv4 files can be added to MAT.jl. I was not able to use MAT.jl's basic accessors to read these files because of the explicit v4 test.