-
Notifications
You must be signed in to change notification settings - Fork 298
/
AnnotationsBuiltin_3_x.mo
374 lines (322 loc) · 12.9 KB
/
AnnotationsBuiltin_3_x.mo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-2014, Open Source Modelica Consortium (OSMC),
* c/o Linköpings universitet, Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR
* THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2.
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
* RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3,
* ACCORDING TO RECIPIENTS CHOICE.
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from OSMC, either from the above address,
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or
* http://www.openmodelica.org, and in the OpenModelica distribution.
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
*
* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
*
* See the full OSMC Public License conditions for more details.
*
*/
package GraphicalAnnotationsProgram____
end GraphicalAnnotationsProgram____;
// type DrawingUnit = Real/*(final unit=\"mm\")*/;
// type Point = DrawingUnit[2] \"{x, y}\";
// type Extent = Point[2] \"Defines a rectangular area {{x1, y1}, {x2, y2}}\";
//partial
record GraphicItem
Boolean visible = true;
Real origin[2]/*(each final unit="mm")*/ = {0.0, 0.0};
Real rotation(quantity="angle", unit="deg")=0;
end GraphicItem;
record CoordinateSystem
Real extent[2,2]/*(each final unit="mm")*/;
Boolean preserveAspectRatio;
Real initialScale;
Real grid[2]/*(each final unit="mm")*/;
end CoordinateSystem;
// example
// CoordinateSystem(extent = {{-10, -10}, {10, 10}});
// i.e. a coordinate system with width 20 units and height 20 units.
record Icon "Representation of the icon layer"
CoordinateSystem coordinateSystem;
//GraphicItem[:] graphics;
end Icon;
record Diagram "Representation of the diagram layer"
CoordinateSystem coordinateSystem;
//GraphicItem[:] graphics;
end Diagram;
type Color = Integer[3](each min=0, each max=255) "RGB representation";
// constant Color Black = {0, 0, 0}; // zeros(3);
type LinePattern = enumeration(None, Solid, Dash, Dot, DashDot, DashDotDot);
type FillPattern = enumeration(None, Solid, Horizontal, Vertical, Cross, Forward, Backward, CrossDiag, HorizontalCylinder, VerticalCylinder, Sphere);
type BorderPattern = enumeration(None, Raised, Sunken, Engraved);
type Smooth = enumeration(None, Bezier);
type EllipseClosure = enumeration(None, Chord, Radial); // added in Modelica 3.4
type Arrow = enumeration(None, Open, Filled, Half);
type TextStyle = enumeration(Bold, Italic, UnderLine);
type TextAlignment = enumeration(Left, Center, Right);
// Filled shapes have the following attributes for the border and interior.
record FilledShape "Style attributes for filled shapes"
Integer lineColor[3] = {0, 0, 0} "Color of border line";
Integer fillColor[3] = {0, 0, 0} "Interior fill color";
LinePattern pattern = LinePattern.Solid "Border line pattern";
FillPattern fillPattern = FillPattern.None "Interior fill pattern";
Real lineThickness = 0.25 "Line thickness";
end FilledShape;
record Transformation
Real origin[2]/*(each final unit="mm")*/;
Real extent[2,2]/*(each final unit="mm")*/;
Real rotation/*(quantity="angle", unit="deg")*/;
end Transformation;
record Placement
Boolean visible = true;
Transformation transformation "Placement in the dagram layer";
Transformation iconTransformation "Placement in the icon layer";
end Placement;
record IconMap
Real extent[2,2]/*(each final unit="mm")*/ = {{0, 0}, {0, 0}};
Boolean primitivesVisible = true;
end IconMap;
record DiagramMap
Real extent[2,2]/*(each final unit="mm")*/ = {{0, 0}, {0, 0}};
Boolean primitivesVisible = true;
end DiagramMap;
record Line
//extends GraphicItem;
Boolean visible = true;
Real origin[2]/*(each final unit="mm")*/ = {0.0, 0.0};
Real rotation/*(quantity="angle", unit="deg")*/ = 0;
// end GraphicItem
Real points[:, 2]/*(each final unit="mm")*/;
Integer color[3] = {0, 0, 0};
LinePattern pattern = LinePattern.Solid;
Real thickness/*(final unit="mm")*/ = 0.25;
Arrow arrow[2] = {Arrow.None, Arrow.None} "{start arrow, end arrow}";
Real arrowSize/*(final unit="mm")*/ = 3;
Smooth smooth = Smooth.None "Spline";
end Line;
record Polygon
//extends GraphicItem;
Boolean visible = true;
Real origin[2]/*(each final unit="mm")*/ = {0.0, 0.0};
Real rotation/*(quantity="angle", unit="deg")*/ = 0;
// end GraphicItem
//extends FilledShape;
Integer lineColor[3] = {0, 0, 0} "Color of border line";
Integer fillColor[3] = {0, 0, 0} "Interior fill color";
LinePattern pattern = LinePattern.Solid "Border line pattern";
FillPattern fillPattern = FillPattern.None "Interior fill pattern";
Real lineThickness = 0.25 "Line thickness";
// end FilledShape
Real points[:,2]/*(each final unit="mm")*/;
Smooth smooth = Smooth.None "Spline outline";
end Polygon;
record Rectangle
//extends GraphicItem;
Boolean visible = true;
Real origin[2]/*(each final unit="mm")*/ = {0.0, 0.0};
Real rotation/*(quantity="angle", unit="deg")*/ = 0;
// end GraphicItem
//extends FilledShape;
Integer lineColor[3] = {0, 0, 0} "Color of border line";
Integer fillColor[3] = {0, 0, 0} "Interior fill color";
LinePattern pattern = LinePattern.Solid "Border line pattern";
FillPattern fillPattern = FillPattern.None "Interior fill pattern";
Real lineThickness = 0.25 "Line thickness";
// end FilledShape
BorderPattern borderPattern = BorderPattern.None;
Real extent[2,2]/*(each final unit="mm")*/;
Real radius/*(final unit="mm")*/ = 0 "Corner radius";
end Rectangle;
record Ellipse
//extends GraphicItem;
Boolean visible = true;
Real origin[2]/*(each final unit="mm")*/ = {0.0, 0.0};
Real rotation/*(quantity="angle", unit="deg")*/=0;
// end GraphicItem
//extends FilledShape;
Integer lineColor[3] = {0, 0, 0} "Color of border line";
Integer fillColor[3] = {0, 0, 0} "Interior fill color";
LinePattern pattern = LinePattern.Solid "Border line pattern";
FillPattern fillPattern = FillPattern.None "Interior fill pattern";
Real lineThickness = 0.25 "Line thickness";
// end FilledShape
Real extent[2,2]/*(each final unit="mm")*/;
Real startAngle/*(quantity="angle", unit="deg")*/ = 0;
Real endAngle/*(quantity="angle", unit="deg")*/ = 360;
EllipseClosure closure = if startAngle == 0 and endAngle == 360 then EllipseClosure.Chord else EllipseClosure.Radial; // added in Modelica 3.4
end Ellipse;
record Text
//extends GraphicItem;
Boolean visible = true;
Real origin[2]/*(each final unit="mm")*/ = {0.0, 0.0};
Real rotation/*(quantity="angle", unit="deg")*/ = 0;
// end GraphicItem
//extends FilledShape;
Integer lineColor[3] = {0, 0, 0} "Color of border line";
Integer fillColor[3] = {0, 0, 0} "Interior fill color";
LinePattern pattern = LinePattern.Solid "Border line pattern";
FillPattern fillPattern = FillPattern.None "Interior fill pattern";
Real lineThickness = 0.25 "Line thickness";
// end FilledShape
Real extent[2,2]/*(each final unit="mm")*/ = {{-10, -10}, {10, 10}};
String textString = "";
Real fontSize = 0 "unit pt";
Integer textColor[3] = {-1, -1, -1} "defaults to fillColor";
String fontName = "";
TextStyle textStyle[:] = fill(TextStyle.Bold, 0);
TextAlignment horizontalAlignment = TextAlignment.Center;
end Text;
record Bitmap
//extends GraphicItem;
Boolean visible = true;
Real origin[2]/*(each final unit="mm")*/ = {0.0, 0.0};
Real rotation/*(quantity="angle", unit="deg")*/=0;
// end GraphicItem
Real extent[2,2]/*(each final unit="mm")*/;
String fileName = "" "Name of bitmap file";
String imageSource = "" "Base64 representation of bitmap";
end Bitmap;
// dynamic annotations
// annotation (
// Icon(graphics={Rectangle(
// extent=DynamicSelect({{0,0},{20,20}},{{0,0},{20,level}}),
// fillColor=DynamicSelect({0,0,255},
// if overflow then {255,0,0} else {0,0,255}))}
// );
// events & interaction
record OnMouseDownSetBoolean
Boolean variable "Name of variable to change when mouse button pressed";
Boolean value "Assigned value";
end OnMouseDownSetBoolean;
// interaction={OnMouseDown(on, true), OnMouseUp(on, false)};
record OnMouseMoveXSetReal
Real xVariable "Name of variable to change when cursor moved in x direction";
Real minValue;
Real maxValue;
end OnMouseMoveXSetReal;
//
record OnMouseMoveYSetReal
Real yVariable "Name of variable to change when cursor moved in y direction";
Real minValue;
Real maxValue;
end OnMouseMoveYSetReal;
record OnMouseDownEditInteger
Integer variable "Name of variable to change";
end OnMouseDownEditInteger;
record OnMouseDownEditReal
Real variable "Name of variable to change";
end OnMouseDownEditReal;
//
record OnMouseDownEditString
String variable "Name of variable to change";
end OnMouseDownEditString;
//
// annotation(defaultComponentName = "name")
// annotation(missingInnerMessage = "message")
//
// model World
// annotation(defaultComponentName = "world",
// defaultComponentPrefixes = "inner replaceable",
// missingInnerMessage = "The World object is missing");
// ...
// end World;
//
// inner replaceable World world;
//
// annotation(unassignedMessage = "message");
//
// annotation(Dialog(enable = parameter-expression, tab = "tab", group = "group"));
//
record Dialog
parameter String tab = "General";
parameter String group = "Parameters";
parameter Boolean enable = true;
parameter Boolean showStartAttribute = false;
parameter Boolean colorSelector = false;
parameter Selector loadSelector;
parameter Selector saveSelector;
parameter String groupImage = "";
parameter Boolean connectorSizing = false;
end Dialog;
record Selector
parameter String filter;
parameter String caption;
end Selector;
// Annotations for Version Handling
record Version
String version "The version number of the released library.";
String versionDate "The date in UTC format (according to ISO 8601) when the library was released.";
Integer versionBuild "The optional build number of the library.";
String dateModified "The UTC date and time (according to ISO 8601) of the last modification of the package.";
String revisionId "A tool specific revision identifier possibly generated by a source code management system (e.g. Subversion or CVS).";
end Version;
//record uses "A list of dependent classes."
//end uses;
// Annotations for Access Control to Protect Intellectual Property
type Access = enumeration(hide, icon, documentation, diagram, nonPackageText, nonPackageDuplicate, packageText, packageDuplicate);
record Protection "Protection of class"
Access access "Defines what parts of a class are visible.";
String features[:] = fill("", 0) "Required license features";
record License
String libraryKey;
String licenseFile = "" "Optional, default mapping if empty";
end License;
end Protection;
record Authorization
String licensor = "" "Optional string to show information about the licensor";
String libraryKey "Matching the key in the class. Must be encrypted and not visible";
License license[:] "Definition of the license options and of the access rights";
end Authorization;
record License
String licensee = "" "Optional string to show information about the licensee";
String id[:] "Unique machine identifications, e.g. MAC addresses";
String features[:] = fill("", 0) "Activated library license features";
String startDate = "" "Optional start date in UTCformat YYYY-MM-DD";
String expirationDate = "" "Optional expiration date in UTCformat YYYY-MM-DD";
String operations[:] = fill("",0) "Library usage conditions";
end License;
// TODO: Function Derivative Annotations
// Inverse Function Annotation
//record inverse
//end inverse;
record choices
Boolean checkBox = false;
Boolean __Dymola_checkBox = false;
String choice[:] = fill("", 0) "the choices as string";
end choices;
//
// connector Frame "Frame of a mechanical system"
// ...
// flow Modelica.SIunits.Force f[3] annotation(unassignedMessage =
// "All Forces cannot be uniquely calculated. The reason could be that the
// mechanism contains a planar loop or that joints constrain the same motion.
// For planar loops, use in one revolute joint per loop the option
// PlanarCutJoint=true in the Advanced menu.");
// end Frame;
//
// model BodyShape
// ...
// parameter Boolean animation = true;
// parameter SI.Length length "Length of shape"
// annotation(Dialog(enable = animation, tab = "Animation",
// group = "Shape definition"));
// ...
// end BodyShape;
record Documentation
String info = "" "Description of the class";
String revisions = "" "Revision history";
// Spec 3.5 Figure[:] figures = {}; "Simulation result figures";
end Documentation;
type TearingSelect = enumeration(never, avoid, default, prefer, always);