Modelica annotation Window - annotations

What does the Modelica annotation(Window()) do and where does it come from?
Here is an example:
annotation (
Window(
x=0.15,
y=0.16,
width=0.63,
height=0.59));
It is not described in the Modelica Specification and when checking with Dymola 2015 and Advanced.PedanticModelica=true I get an error.
Can I safely delete the annotation? Where did it come from?

Those are old Dymola annotations that can be safely removed (ttws -clean does this actually)

Related

how can i fix this error for drumboiler example

How can I fix this error for drumboiler example?
It's kind of hard to answer questions without the model code, but based on the error with Cv.from_bar my guess is that you copied some code containing that from MSL (Modelica Standard Library - shown to the left in your package browser) for the boiler.
The likely corrections are:
Replace Cv.from_bar by Modelica.Units.Conversions.from_bar in the parameter-dialog of some component (sink?).
In Modelica text for this model add import Cv=Modelica.Units.Conversions;
If the models aren't directly from MSL they may contain errors.

Modelica Evaluate=true

From the Modelica documentation, it seems annotation Evaluate only has an effect on parameters:
https://build.openmodelica.org/Documentation/ModelicaReference.Annotations.Evaluate.html
Using the Dymola variable editor, I can conveniently set the annotation on any variable/instance, see screenshot below. Does this have any effect or is the annotation just ignored?
If applied to the instance of a class, will the parameters in that class be evaluated, to the value set by the modifier (in the example screenshot, e.g. parameter yMax)?
The parameters of the class will be evaluated, https://specification.modelica.org/master/annotations.html#modelica:Evaluate
This was added in Modelica 3.5 (and supported earlier in Dymola with some minor differences that don't appear if you only use Evaluate=true - see https://github.com/modelica/ModelicaSpecification/pull/2771 for details).

Library Startup Skript in Dymola

Using Dymola, I'm looking for a way to automatically execute a script when loading a library. The intention is to define additional displayUnits using the defineUnitConversion() command, which are specific to the library that is loaded. Still I think there are quite some other cases where this could be helpful.
What I figured out in this regard:
I know that it is possible to add conversions to the file in DymolaInstallDir/insert/displayUnits.mos but this comes with the disadvantage that is has to be done again on every new computer or after an update of Dymola. I would like to avoid this.
Other than that I only found the libraryinfo.mos file, which seems to be read during the start-up of Dymola. Therefore I assume it is not the right place to put the conversions, as it contains general information about the library and should only contain the respective functions.
Dymola 2022 has a new (tool-specific) feature that covers exactly this use-case. It is mentioned in the Dymola 2022 release notes in the section "Library startup script" on page 24.
It basically introduces the a new annotation, which allows to specify a path to a .mos script, which is executed, when the respective library is loaded. Here is the example from the release notes:
package ThisPack
annotation(__Dymola_startup =
"modelica://ThisPack/Resources/Scripts/Dymola/startup.mos");
end ThisPack;
The annotation can also be set via the UI...

Removing annotations from a Modelica model

I'm developing a Modelica library and need to produce a document with source code listings. I'd like to be able to include the source of the Modelica models without annotations.
I could manually edit them out, but I'm looking for a more automated strategy. I'm guessing the most convenient and straightforward approach is to use some tool to save .mo files with no annotations and include those in my document (I'm using \lstinputlisting in LaTeX).
Is it possible to do this? I have access to Dymola, OpenModelica and JModelica. Dymola is obviously capable of producing such a listing, as it's able to include it in the automatically generated documentation (File > Export > HTML...). I've been looking into scripting with Dymola and OpenModelica, but haven't found a way to do this either.
JModelica seems like it could be a good option, but I don't have experience working with Python. If this is possible and someone gives me some pointers, I'm willing to look into it myself. I found a mention to a prettyprint function that might do the job, but I'm not sure where to start. I can't even find reference to that function in the latest documentation.
It would also be more convenient for me to find a way of doing it with Dymola/OpenModelica (whether through the UI or by using a script). Have I missed something?
I think you could use saveTotalModel("total.mo", MyModelName) in OpenModelica. This will strip most annotations (not ones used for code generation if I remember correctly) and pretty-print the source code including all dependencies. Then you just copy-paste the models/packages that you want to include in the listing. Or if you prefer, you can do something like the following to only include code for a particular model:
loadModel(Modelica);
loadFile("MyModel.mo");
saveTotalModel("total.mo", MyModel.A.B);
clear();
loadFile(MyModel);
str := list(MyModel.A.B);
writeFile("MyModel.A.B.listing", str);

Does Eclipse IDE complain duplicate entries for handlers in plugin.xml?

I mistakenly have duplicate entries in my plugin.xml. But the eclipse IDE didn't complain. Shouldn't it?
Semantics for extension points vary. Eclipse only performs basic data type validation on the extension data at design time. The extension point handlers typically perform further validation at runtime, but the depth of that validation varies from one extension point to another. Problems detected at runtime will be reported in the error log.