modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
471 stars 168 forks source link

Add annotation "unbounded" to 1D mechanical sources #3635

Open markusandres3DS opened 3 years ago

markusandres3DS commented 3 years ago

I did some investigation on the unbounded annotation in Dymola and found that it would likely be a good addition for some MSL components.

The tests were carried out using Modelica.Mechanics.Rotational.Sources.Speed, with focus on the behavior when angles get relatively big (but still reasonable). This results in numerical issues pretty quickly, as shown below:

Result_BasicTest

There are three variables plotted:

Due to the above observations, I think it would be good to add the annotation to the MSL. Of the top of my head, I think this should be done for a couple of elements in the MSL:

The results can be reproduced using Dymola 2021 with this package. A quick test done with MSL 4.0.0 shows that there is no change regarding this property.

beutlich commented 3 years ago

Duplicate of #3545 and also mentioned in #2946.

markusandres3DS commented 3 years ago

@beutlich seems my search wasn't very successful. So this basically adds an example to https://github.com/modelica/ModelicaStandardLibrary/issues/3545.

MartinOtter commented 3 years ago

unbounded=true means to switch relative error control off. This is meaningful, if the variable is a state variable and grows forever, or in other words, if it is not possible to define a meaningful nominal value.

Whether or not this is the case, depends heavily on the application: If in a library component unbounded=true is set, then it is highly likely that there are usages of the component, where unbounded=false yields better simulation results. Note, the same holds for nominal, where it seems also not possible to provide a meaningful value for all applications in a library component.

So to summarize, nominal and unbounded should be set by the user of a library component and should not be defined in the library component.

markusandres3DS commented 3 years ago

@MartinOtter I fully agree.

Therefore, the question to me is: Would it make sense to have parameters for both unbounded and nominal, probably in an "Advanced" tab? Currently they can only be set manually using modifiers for the components from the Standard Library, which is not very comfortable...