Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#6287 closed defect (fixed)

Handling of parameter records is a nightmare

Reported by: ahaumer@… Owned by: adrpo
Priority: high Milestone: 1.16.2
Component: Interactive Environment Version: 1.16.0
Keywords: Cc:

Description

OM 1.16.1 (64 bit) on Windows 10 pro
I'm using parameter records to keep parameters belongig to a drive together. Parameters are structured in sub-records (MachineData and ControllerData), both are instantiated in DriveData. DriveData is instantiated in Examples.

  1. You can't access driveData.machineData via the grahical user interface, only textually.
  2. You can't redeclare driveData.machineData to another dataset (e.g. Std48V) by drop-down menue in the graphical user interface.
  3. Text views shows "redeclare DC_Drive.DataRecords.MachineDataSets.Std48V machineData", diagram view shows "redeclare DC_Drive.DataRecords.MachineDataSets.MachineData machineData".
  4. The compilation fails.

All these things work fine in other modeling and simulation environments.
It is impossible to use OM for teaching and training!

Attachments (2)

DC_Drive.mo (10.8 KB) - added by ahaumer@… 3 years ago.
DC_Drive.2.mo (17.7 KB) - added by ahaumer@… 3 years ago.
New version of the test library

Download all attachments as: .zip

Change History (17)

Changed 3 years ago by ahaumer@…

comment:1 Changed 3 years ago by ahaumer@…

With OM 1.13.2:

  1. the same
  2. the same
  3. at least, the diagram view shows nothing - better than a horrible wrong information!
  4. It compiles and simulates!

Since 1.13.2, the versions are getting worse.
I'll stick to 1.13.2 and decrease the usage of OM dramatically.

comment:2 in reply to: ↑ description Changed 3 years ago by casella

Replying to ahaumer@…:

Since 1.13.2, the versions are getting worse.

I'm sorry if you get this impression with your use cases.

In general, OM has dramatically improved, not worsened, since 1.13.2. We fixed 480 issues since then, dramatically improved the compilation speed and the coverage rates with many libraries. The user experience with OMEdit has also been improved on many fronts.

I'll stick to 1.13.2 and decrease the usage of OM dramatically.

This doesn't seem to me a good strategy. You could rather get more involved in improving the upcoming release, by using the latest one (or even nightly builds) and reporting issues you are facing, so we can fix them.

All these things work fine in other modeling and simulation environments.

All other existing Modelica tools are commercial and developed by for-profit companies with far larger resources than the Open Source Modelica Consortium. They don't charge educational institutions much for licenses, because they want to get students used to their tools, but then they charge subsantial license fees to professional users afterwards. We don't have sponsors and we do not collect license fees, only consortium membership fees from those organizations that want to contribute to the development effort more actively, and/or need to use the source code beyond what GPL v3 allows them to do.

For us the involvement of the user community is essential. We need end-users to report issues and requirements, so we have a chance to fix the former and implement the latter. From this point of view, your report in this ticket is very valuable for us.

If you want to use OpenModelica for teaching or research on a dependable basis, you should share your models with us on a continued basis, so we know what your requirements are, and we can work with you to get them to work fine. If you can put your libraries on github.com as open source, we can automatically test them and look for regressions, see, e.g., Christian Kral's HanserModelica library. Regarding OMEdit, unfortunately we don't have automated testing in place yet, although this is in our todo list, see #5394. So, we need end users to report issues in tickets, as you just did.

My colleague Massimo Ceraolo from University of Pisa has been using OpenModelica to teach electrical systems for many years. Over the years, he provided over 250 tickets. Over 200 have been addressed already. His contribution has been invaluable in getting OpenModelica a better tool.

Last, but not least, if you use OpenModelica for your daily work and would like to get more involved in getting it better, you could join the Open Source Modelica Consortium, as more than 25 other higher education institutions, including Massimo's, already did.

comment:3 in reply to: ↑ description ; follow-ups: Changed 3 years ago by casella

Replying to ahaumer@…:

Coming to your specific issues:

  1. You can't access driveData.machineData via the grahical user interface, only textually.

Yes, you can. Please go to Tools | Options | General | Optional Features, and tick the Enable Replaceable Support checkbox. This setting will be remembered even if you install later versions of the OpenModelica.

Unfortunately the drop-down menu is not correct for some reason, we'll investigate that, see #6288.

  1. You can't redeclare driveData.machineData to another dataset (e.g. Std48V) by drop-down menue in the graphical user interface.

There is no Std48V record in your package. Dymola only reports MachineData and M48V.

  1. Text views shows "redeclare DC_Drive.DataRecords.MachineDataSets.Std48V machineData", diagram view shows "redeclare DC_Drive.DataRecords.MachineDataSets.MachineData machineData".

I'm not sure what happens with 1.16.1, I'm trying this with the latest nightly, and I see "Error" in the diagram view, see #6288

  1. The compilation fails.

The model compiles and runs fine with the latest 1.17.0 nightly build. I guess some other issues may have been fixed in the meantime. If you provide some publicly available testsuites, as with HanserModelica, we can monitor them with regression reports and spot when something gets broken either because of OM codebase changes, or because of library codebase changes, see e.g. this report.

It is impossible to use OM for teaching and training!

I can testify that OM has been used for teaching at Politecnico di Milano by myself and Gianni Ferretti, as well as at University of Pisa by Massimo Ceraolo for several years. Sometimes it's not easy, but with a bit of patience everything can be sorted out. Please help us doing that!

comment:4 in reply to: ↑ 3 Changed 3 years ago by sjoelund.se

Replying to casella:

  1. The compilation fails.

The model compiles and runs fine with the latest 1.17.0 nightly build. I guess some other issues may have been fixed in the meantime. If you provide some publicly available testsuites, as with HanserModelica, we can monitor them with regression reports and spot when something gets broken either because of OM codebase changes, or because of library codebase changes, see e.g. this report.

It's probably because at some point he clicked to switch to the old frontend for translation. (I don't have 1.16.1 OMEdit, but I think it's under Options->Simulation)

martin@ws:~/tmp$ docker run -it -e HOME=/home/martin -v /home:/home --user $UID -w $PWD openmodelica/openmodelica:v1.16.1-minimal omc b.mos -d=newInst
true
true
record SimulationResult
    resultFile = "/home/martin/tmp/DC_Drive.Examples.DCPMCurrentControlled_res.mat",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 10000, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'DC_Drive.Examples.DCPMCurrentControlled', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
    messages = "LOG_SUCCESS       | info    | The initialization finished successfully without homotopy method.
LOG_SUCCESS       | info    | The simulation finished successfully.
",
    timeFrontend = 0.066107688,
    timeBackend = 0.016465762,
    timeSimCode = 0.003601743,
    timeTemplates = 0.007677555000000001,
    timeCompile = 0.324316386,
    timeSimulation = 0.024158108,
    timeTotal = 0.442422452
end SimulationResult;
"Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions(\"-d=initialization\").
"
martin@ws:~/tmp$ cat b.mos
installPackage(Modelica, "3.2.3+maint.om");
loadFile("DC_Drive.mo");
simulate(DC_Drive.Examples.DCPMCurrentControlled);getErrorString();

comment:5 Changed 3 years ago by ahaumer@…

Sorry for mixing up "Std48V" and "M48V".

You'll find 2 slightly modified test exmaples in PR #3689 fpr ModelicaTest.

Did I misunderstand Martin's comment?
I never changed the frontend. 1.13.2 compiles, 1.16.1 fails.
So it's time to debug the new frontend, isn't it?

I need a stable working environment to concentrate on online lectures.
1.13.2 has some drawbacks, but it works.

comment:6 Changed 3 years ago by sjoelund.se

I never changed the frontend. 1.13.2 compiles, 1.16.1 fails.
So it's time to debug the new frontend, isn't it?

No, you must have changed it. Or you had an old config and it kept the old default.
Go check the setting and update it to use the new frontend.

comment:7 in reply to: ↑ 3 ; follow-up: Changed 3 years ago by ceraolo

I can testify that OM has been used for teaching at Politecnico di Milano by myself and Gianni Ferretti, as well as at University of Pisa by Massimo Ceraolo for several years. Sometimes it's not easy, but with a bit of patience everything can be sorted out.

Quite true.
I appreciate very much teaching using free tools. After all, I'm from a public University and, whenever possible, I don't want to bias people towards a commercial tool or another.

Sometimes I have displeasing experiences with some OM versions. For instance this academic year I started with 1.16.0-dev-648, but, after several important issues we had were fixed, switched to 1.17.0-dev-141. Usually, I keep a version stable for one year or so.

I use also Dymola for several research projects, and I know the big difference between the two tools. For instance, whenever I need heavy use of complex numbers, Dymola for me is a must (but I opened tickets for the main issues). As another example, I'm not satisfied with OM FMUs and must resort to Dymola for them (but opened tickets as well).

However, for teaching, if the teacher makes some preliminary effort to select their models and avoid those critical with OM, using it works.
I also grant marks to students that are able to report an issue in a repetitive way. This gives students a feeling that they can contribute to the knowledge advance. A student of mine this year did this twice, and both issues have already been fixed (#6239 and #6270).

My tickets tend to be more often devoted to usability, which mostly impacts newbies and students. There are many things to be done, but the situation now is much better than, say five years ago.

Some missing features are nasty but, if we guide our students, can be tolerated. For instance you cannot rename a model through the GUI. But if you explain to your students how to do this in text mode, they learn and accept.

comment:8 in reply to: ↑ 7 Changed 3 years ago by casella

Replying to ahaumer@…:

Sorry for mixing up "Std48V" and "M48V".

No problem. You will see M48V once you enable replaceable support.

I need a stable working environment to concentrate on online lectures.
1.13.2 has some drawbacks, but it works.

If you want a stable environment right away, I would suggest to use 1.16.2, which will be released at the end of this week.

For the best user experience, it is essential that set Tools | Options | General | Enable Replaceable Support and that you unset Tools | Options | Simulation | Enable old front end for code generation. These settings will be retained between sessions and also when you eventually install 1.17.0, available Feb 2021.

If you want a stable environment, there's no need to follow the nightly builds, unless you need some critical bug fix right away. However, I would strongly suggest that you update the stable releases every 6 months, there are so many fixes you can take advantage of with each release. If you can give us open access to some of your libraries, we can make sure there are no regressions.

Changed 3 years ago by ahaumer@…

New version of the test library

comment:9 follow-up: Changed 3 years ago by ahaumer@…

Many thanks to Martin Sjoelund and Francesco Casella!
I didn't know the settings Francesco mentioned. With these, redeclaration of records works via the user interface (dropdown), and my example compiles and simulates.
I've included the small test library for which I have PR 3689 at ModelicaTest.
Have a Happy Christmas and a healthy New Year!

Two points that should/could be improved in the GUI:

  • why is "ERROR" displayed in the drop-down (see #6288)?
  • editing of sub-records (clicking on a button right of the parameter record)

comment:10 Changed 3 years ago by adrpo

Thank you for reporting this, we didn't play too much with replaceable components, mostly only with replaceable classes.
Partial fix for "Error" issue via PR: https://github.com/OpenModelica/OpenModelica/pull/7056

Editing of sub-records will come in 1.18.

comment:11 Changed 3 years ago by adrpo

  • Component changed from *unknown* to Interactive Environment
  • Milestone changed from NeedsInput to 1.16.2
  • Owner changed from somebody to adrpo

comment:12 follow-up: Changed 3 years ago by adrpo

My feeling is that we should close this ticket and open a new one with editing of redeclare parameters (if we don't already have one).

comment:13 in reply to: ↑ 9 Changed 3 years ago by casella

  • Resolution set to fixed
  • Status changed from new to closed

Replying to ahaumer@…:

Many thanks to Martin Sjoelund and Francesco Casella!
I didn't know the settings Francesco mentioned.

We're still not 100% sure that this feature always works well, so we made it optional. It's in the release notes, but unfortunately nobody actually reads them :)

I hope with 1.18.0 this feature is reliable enough that we can always enable it and remove this option outright.

I've included the small test library for which I have PR 3689 at ModelicaTest.

Thanks! If you already have it there, we'll get it in the testsuite as soon as it is merged into master.

Have a Happy Christmas and a healthy New Year!

Same to you!

Two points that should/could be improved in the GUI:

  • why is "ERROR" displayed in the drop-down (see #6288)?

Looks like it's been fixed already, you'll have that in 1.16.2.

  • editing of sub-records (clicking on a button right of the parameter record)

If you mean you'd like to be able to change the bindings of the redeclared records, please follow #6142. I'll add this example there.

comment:14 in reply to: ↑ 12 Changed 3 years ago by casella

Replying to adrpo:

My feeling is that we should close this ticket and open a new one with editing of redeclare parameters (if we don't already have one).

Agreed, see #6142

comment:15 Changed 3 years ago by casella

Ported to master in PR 7057

Note: See TracTickets for help on using tickets.