Searching for a concept like 'verbosity' in Modelica
Asked Answered
H

5

5

I'm struggling with the size of output files for large Modelica models. Off course, I can protect some objects in order to remove them completely from the result file. However, that gives rise to two problems:

  1. it's not possible to redeclare protected objects
  2. if i want to test my model in detail (eg for a short time period), i need to declare those objects publicly again in order to see their variables

I wonder if there's a trick to set the 'verbosity' of a Modelica model. Maybe what I would like is a third keyword next to public, protected, eg. transparent. Then, when setting up a simulation, I want be able to set the verbosity level to 1, or 2 with the following effect:

1--> consider all transparentelements as protected

2--> consider all transparentelements as public

This effect would propagate to all models and submodels.
I don't think this already exists. But is there an easy workaround?

Thanks, Roel

Higginbotham answered 28/9, 2011 at 12:55 Comment(0)
C
3

Roel,

I know several people wrestling with this issue. At the moment, all of this depends on the tool being used. I don't know how other tools handle filtering of results, but in Dymola you control it (as you point out) by giving the signals special qualifiers (e.g. protected).

One thing I've done in the past is to extend from a model and then add a bunch of output signals for things I'm interested in. Then you can select "Outputs" in Dymola to make sure those get in the results file. This is far from perfect because a) listing everything you want can get tedious and b) referencing protected variables is not strictly allowed (although Dymola lets you get away with it but issues a warning).

At Dassault, we are actively discussing this idea and hope to provide some better functionality along these lines. It isn't clear whether such functionality will be strictly tool specific or whether it will involve the language somehow. But if it is language related, we will (of course) work with the design group to formulate a specification that other tool vendors can support as well.

Concrete answered 29/9, 2011 at 10:11 Comment(1)
Thanks for your answer. Protecting as much as possible and adding outputs is what I did indeed, but I agree with both your a) and b). I hope a language standard solution will come out, as tool specific solutions are reducing the cross-tool advantage Modelica clearly has.Higginbotham
S
6

As Michael Tiller wrote above, this is not handled the same way in all Modelica tools and there is no definite answer. To give an OpenModelica-specific answer, it's possible to use simulate(ModelName,outputFilter="regex"), to store only the variables that fully match the given regex (default is .*, matching any variable).

Snippet answered 3/10, 2011 at 9:33 Comment(2)
thanks for the tip. So to use this feature effectively you'd have to add a specific 'marker' like _o to all the variables that you would get in the output of a long simulation. It would be great if the modelica community could come to a language specification that is cross-tool though.Higginbotham
It's not necessary to tag the variables. With regular expressions you could match a|b|c (a or b or c), or a\.b\.c\[.*\].x (a.b.c[1].x .. a.b.c[n].x). It's very annoying to write the patterns, but they are versatile and easy for tools to implement. While I do agree that it would be good if a cross-tool solution was found, the Modelica specification only touches the issue of simulations in a few places.Snippet
C
3

Roel,

I know several people wrestling with this issue. At the moment, all of this depends on the tool being used. I don't know how other tools handle filtering of results, but in Dymola you control it (as you point out) by giving the signals special qualifiers (e.g. protected).

One thing I've done in the past is to extend from a model and then add a bunch of output signals for things I'm interested in. Then you can select "Outputs" in Dymola to make sure those get in the results file. This is far from perfect because a) listing everything you want can get tedious and b) referencing protected variables is not strictly allowed (although Dymola lets you get away with it but issues a warning).

At Dassault, we are actively discussing this idea and hope to provide some better functionality along these lines. It isn't clear whether such functionality will be strictly tool specific or whether it will involve the language somehow. But if it is language related, we will (of course) work with the design group to formulate a specification that other tool vendors can support as well.

Concrete answered 29/9, 2011 at 10:11 Comment(1)
Thanks for your answer. Protecting as much as possible and adding outputs is what I did indeed, but I agree with both your a) and b). I hope a language standard solution will come out, as tool specific solutions are reducing the cross-tool advantage Modelica clearly has.Higginbotham
C
3

In SystemModeler, you go to the Settings tab in the Experiment Browswer in Simulation Center. Click on Output on the bottom and select which variables to store.

(The options are state variables, derivatives, algebraic variables, parameters, protected variables and if you mark the Store simulation log-option, you'll get some interesting statistics on events over time and function evaluations, opening another possibility to track down parts of the simulation and model that creates more evaluations)

Continue answered 7/1, 2014 at 16:45 Comment(0)
W
2

I am not sure if this helps you, but in Dymola you can go to Simulation->Setup->Output and mark a checkbox saying "Store Protected variables". That way it is possible to declare most variables as protected: during normal simulation they are not stored, but when debugging your model, you just mark that checkbox and they are stored. Of course that is not the same as your suggested keyword transparent, but maybe it helps a little...

Webber answered 30/9, 2011 at 9:3 Comment(1)
Thanks for your answer, this indeed helps because now i can protect everything I don't need for a long simulation, and in 1 click get everything back for a debugging run. But making almost everything protected still obliges me to break the rules (which Dymola accepts) and reference to protected variables.Higginbotham
D
1

A bit late, but in Dymola 2013 FD01 and later you can select which variables to store based on names (and model names) using the annotation __Dymola_selections, and even filter on user-defined tags - so you could create a tag name "transparent" in the model. See "Matching and variable selections" in the manual.

Disloyal answered 8/12, 2016 at 10:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.