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
Evaluation of new OpenSourceTables #1067
Comments
Comment by sjoelund.se on 10 Apr 2013 15:03 UTC CTT.Test0 is partial but marked as an experiment. The other models are not marked partial but are not marked as experiments (you do not inherit annotations unless they say so, right?). The problems with the tests is that they cannot be run without a working (old) Tables implementation. And once the old tables are replaced, there are no more tests to run, right (so put the old functions under NewTables.Test.OldTables)? fileName = classDirectory() + "Data/test_v4.mat" - classDirectory() was never part of any Modelica standard. ModelicaServices has support for converting modelica:// URIs to filenames. I could get a few models to run using It is not quite there yet. There are very many I cannot test due to classDirectory() issues, etc. So there is probably more. Fix these first easy points and I will try again. |
Modified by sjoelund.se on 10 Apr 2013 15:06 UTC |
Comment by beutlich on 10 Apr 2013 15:38 UTC Yes and sorry, there is little Linux support here. I have no clue which system libraries I can assume to be installed. Do you have matio and hdf5 as system libraries? I would not have thought of openmpi. So best is to compile it all by yourself but I was to lazy to add a hdf Makefile. This is surely not my task. You may skip CCT.Test57 and CCT.Test58 for now. You should also know that OpenModelica support is not part of the implementation contract. You are right about double preprocessor macros -DHDF5 and -DMAT73 that only work if specified together. I will consider this. You may also remove old table implementation from CCT.Test0 to run the tests. I can change the experiment annotations of the test models of course. For now, you can manually replace classDirectory() by the table path in the files using search + replace. |
Comment by beutlich on 10 Apr 2013 15:47 UTC I did not add hdf5, zlib and szip sources by purpose but stated the download links. I wanted to keep it clean and simple. |
Comment by sjoelund.se on 10 Apr 2013 15:48 UTC
The main problem is even if we have the libraries installed, someone else might not. And yes, there are 3 different versions of hdf5 only on Ubuntu Linux. They all require different flags to run. And the libraries have to be in the Modelica annotation. The best way would be to include them in the .a-file like you do on Windows. All this needs is compiling the sources. Which means the sources for of the hd5 code (as well as libmatio) should be provided in the svn. If they are there I can compile the same version on all platforms and reduce the burden of maintenance. This is the common way to do it anyway - either as svn externals or actually in the svn repository. Then you can always checkout an old version of the tables and get the same library you used at the time. And yes, I can replace everything classDirectory() manually, but wouldn't all tool vendors need to do this? |
Comment by sjoelund.se on 10 Apr 2013 15:54 UTC
svn propedit svn:externals And the full source is automatically added (and can be disabled for users who prefer that). Then it is much easier to create Makefile targets to compile everything :) As for libmatio... You are right, I might have been wrong since I possibly used the wrong defines and got a bad library for some reason. I had to add it before, but don't now. |
Comment by beutlich on 10 Apr 2013 15:58 UTC |
Comment by choeger on 10 Apr 2013 18:24 UTC |
Comment by sjoelund.se on 10 Apr 2013 18:47 UTC I would not say the build system is the main priority though. Getting it written in standard Modelica should be !#1. I can always donate a sane build system for MA once we start to maintain it as part of MSL. I would have to implement one for OpenModelica anyway. I tested the library again without MAT73 or HDF5 and yes MATv4 still works, so I guess that is fine as long as it is not hard to enable the support manually. A good build system would still be nice to set CFLAGS, CPPFLAGS, LDFLAGS, enable/disable features, do feature tests, and so on. And as a sidenote, autoconf is much nicer than cmake; everyone who writes something in cmake always requires the latest version because the old versions did not have everything they need. And of course not everyone has access to the latest cmake (for example, the latest Debian release still does not have cmake 2.8.6 which FMIL requires). |
Comment by sjoelund.se on 10 Apr 2013 18:57 UTC |
Comment by beutlich on 10 Apr 2013 19:40 UTC
I did not know at my initial commit that is a non-public repository. I could attach the zipped sources but this would not help you here. Maybe the admin can change read access rights. |
Comment by sjoelund.se on 10 Apr 2013 20:13 UTC
Also tons of unused results from fread, probably in libmatio. I suppressed them. |
Comment by sjoelund.se on 11 Apr 2013 07:25 UTC
Feel free to use the OM autoconf diffs (or the relevant part of om:source:trunk/configure.in): om:r15784 om:r15785 |
Modified by beutlich on 11 Apr 2013 07:33 UTC |
Comment by beutlich on 11 Apr 2013 07:46 UTC |
Comment by sjoelund.se on 11 Apr 2013 09:58 UTC For now, this was the result of automatic testing with MSL 3.2.1 and the latest OpenModelica: http://dev.openmodelica.org/~marsj/testing/BuildModelRecursive.html |
Comment by sjoelund.se on 11 Apr 2013 14:34 UTC Now I'm just waiting for classDirectory() and experiment annotations. |
Comment by beutlich on 11 Apr 2013 15:07 UTC
Thanks. Fixed by r6235. |
Comment by sjoelund.se on 11 Apr 2013 15:31 UTC |
Comment by beutlich on 11 Apr 2013 15:39 UTC |
Comment by beutlich on 11 Apr 2013 15:54 UTC |
Comment by otter on 11 Apr 2013 16:01 UTC
In the trunk of MSL there is now a function: fileName = Modelica.Utilities.Files.loadResource(uri) that returns the file name of an uri (such as uri = "modelica://NewTables.Test/Data/test.txt"). This function is implemented with a new ModelicaServices function "ModelicaServices.[wiki:ExternalReferences].loadResource". In Dymola this ModelicaServices function is implemented with function "Dymola_ResolveURI" that existed in previous Dymola releases. I have just committed this updated ModelicaServices for Dymola and stored it as !https://svn.modelica.org/projects/Modelica/branches/development/OpenSourceTables/Modelica/ModelicaServices-Variants/Dymola/ModelicaServices 3.2.1 Therefore, you can replace classDirectory with loadResource and use this ModelicaServices for Dymola. |
Comment by sjoelund.se on 11 Apr 2013 16:02 UTC
So scanf into an unsigned long which you use to assign to the size_t. Or create a utility function that scans a size_t. Inline it if you are worried about performance. Replying to [comment:21 beutlich]:
Then you have a problem. classDirectory() is for sure not in the specification. I would just assume the vendors have implemented loadResource in their Services. |
Comment by otter on 11 Apr 2013 16:04 UTC
Use the just committed ModelicaServices for Dymola under and loadResource should be supported in Dymola |
Comment by beutlich on 11 Apr 2013 19:41 UTC
Yes, that was dangerous. It should be finally fixed by r6240. |
Comment by sjoelund.se on 11 Apr 2013 20:47 UTC |
Comment by beutlich on 12 Apr 2013 07:01 UTC
That is exactly the case under test. In SimulationX I can increase the solver tolerance or max. solver step size arbitrarily and the time event is always exactly met. Thus I guess there is a problem with event handling in OM. |
Comment by beutlich on 12 Apr 2013 07:17 UTC
By r6242 I removed calls to classDirectory() though Dymola 2013 FD01 then fails with
|
Comment by sjoelund.se on 12 Apr 2013 07:47 UTC
It is not really wrong. It just uses a numerical method since the trapezoid has a time event OM cannot optimize. The trapezoid expects I find time 1.5 (why the trapezoid block does not search for the exact time of the event using sampling and integer arithmetic is beyond me, but that is another matter... it will just skew a little if you have many periods). I do find the event at time 1.500000000000001, which is the limit of double precision (searching for the state event). That is with tolerance set to 1e-12. At this time I have a slight error of 1e-15 between the table and trapezoid, which is fine (the integrated error goes to 1e-12 from 1e-31). Just saying some of these models are very, very, dependent on what symbolic optimizations are performed by the tool and what kind of solver is used (rungekutta without root finding has a lower error than dassl in this test...). |
Comment by sjoelund.se on 12 Apr 2013 08:19 UTC |
Comment by otter on 12 Apr 2013 09:09 UTC
Strange: I tried with Dymola 2013 FD01, and for me it works. From the error message it seems that the right library is loaded since function Dymola_ResolveURI is called (but maybe you double check by clicking on the Info layer of package ModelicaServices and check the file name at the bottom of the info), but linking fails. If linking fails, it might be that for some (strange) reasons the compiler links to a library from another Dymola version. |
Comment by beutlich on 12 Apr 2013 09:26 UTC
|
Comment by hansolsson on 12 Apr 2013 09:40 UTC
There are restrictions on it that makes it unsuitable for a lib (although I could not find the problematic case in the Modelica-package): It can only resolve constant URIs; i.e. similarly as classDirectory it can handle ResolveURI("modelica://NewTables.Test/data4.mat") - but it cannot currently handle ResolveURI(a+b); unless a+b are string constants. If it fails for a string constant it must be that the string constant is not considered as constant - I cannot see why that would happen. If the data is stored in a data-base translation might also have to project the data to file - and then return the file-name. |
Comment by otter on 12 Apr 2013 10:03 UTC
Please, try in the command window of Dymola 2013 FD01 the following command: Modelica.Utilities.Files.loadResource("modelica://NewTables.Test/data/test.txt"); If this works, then this indicates that loadResource is supported in this Dymola version. In case of error it shows a possible reason (e.g. because wrong Modelica package was loaded). |
Comment by beutlich on 12 Apr 2013 10:57 UTC
I figured it out (see e.g. changes by r6244 in Now it is time to test the real thing like e.g. comment:30 started with. |
Comment by beutlich on 15 Apr 2013 20:20 UTC Beside dSPACE target compilers I also successfully checked MinGW (GCC 4.4.0 and GCC 4.7.2), Cygwin (GCC 4.3.0), OpenWatCom 1.3, LCC 2.x, Borland BCC 5.5 and MS compilers (VC6 and >= VS2005 (Win32 and x64)). |
Comment by beutlich on 15 Apr 2013 20:27 UTC
I am not satisfied with that situation, too. I used the test models as my own test suite to check compatibility with old tables implementation. What I could do now is to remove all references to old table implementation (and also the runtime assertion). This allows stand-alone simulation of the new tables (however without compatibility check) now and also after the merge. In the implementation contract it is said that there is a reference result for every test model. I could easily commit them (using SimulationX as Modelica tool). Please advise. Thanks. |
Comment by otter on 16 Apr 2013 07:10 UTC
Please, keep the current tests, because they are very useful for any tool vendor to quickly check its implementation with the new implementation. What would be additionally helpful is, as you proposed, to only have tests with the table blocks from Modelica.Blocks. These tests should be stored in ModelicaTest of the
As a result, the test models of the maintenance branch provide results of the vendor specific implementation of 3.2 and the test models in the trunk provide results of the new table implementation. Some tools (such as Dymola) can then make regression testing and can automatically test the differences between the two implementations. Test models of new table features for MSL 3.2.1 should be, of course, only be stored in the trunk.
Yes, please just store in one directory csv (ASCII) references files for SimulationX. Please, use the same format as sketched in the Call for a csv-file comparison (same format as the result csv file from the FMU compliance checker: comma separated values; first row are the variable names, first column is time with name “time”, time values must be monotonically increasing; two identical time values that follow each other signal an event instant). |
Comment by beutlich on 26 Apr 2013 08:29 UTC |
Reported by beutlich on 9 Apr 2013 14:38 UTC
According to the latest development request to implement open source tables for
ITI is currently working on it. Together with the MA board we decided to provided a pre-release for early and wide evaluation.
With r6216 I committed the current project to [source:/Modelica/branches/development/OpenSourceTables OpenSourceTables].
So far I did not commit any binaries of the external library but prepared Makefiles and Visual Studio project files for self-compilation:
Please evaluate code and performance thoroughly! Use this ticket for your comments. Any feedback is appreciated. In order to not postpone MSL 3.2.1 release any longer rapid checks are welcome. I am afraid I cannot consider changes or wishes after 04/25/13.
TODO:
This ticket addresses/fixes #129, #338, #628, #1022, #1028.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1067
The text was updated successfully, but these errors were encountered: