@@ -16,29 +16,23 @@ partial package PartialModelicaServices
1616 parameter Types.ShapeType shapeType= "box"
1717 "Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, spring, <external shape>)" ;
1818 input Frames.Orientation R= Frames.nullRotation()
19- "Orientation object to rotate the world frame into the object frame"
20- annotation(Dialog);
19+ "Orientation object to rotate the world frame into the object frame" annotation(Dialog);
2120 input SI.Position r[3 ]= {0 ,0 ,0 }
22- "Position vector from origin of world frame to origin of object frame, resolved in world frame"
23- annotation(Dialog);
21+ "Position vector from origin of world frame to origin of object frame, resolved in world frame" annotation(Dialog);
2422 input SI.Position r_shape[3 ]= {0 ,0 ,0 }
25- "Position vector from origin of object frame to shape origin, resolved in object frame"
26- annotation(Dialog);
23+ "Position vector from origin of object frame to shape origin, resolved in object frame" annotation(Dialog);
2724 input Real lengthDirection[3 ](each final unit= "1" )= {1 ,0 ,0 }
28- "Vector in length direction, resolved in object frame"
29- annotation(Dialog);
25+ "Vector in length direction, resolved in object frame" annotation(Dialog);
3026 input Real widthDirection[3 ](each final unit= "1" )= {0 ,1 ,0 }
31- "Vector in width direction, resolved in object frame"
32- annotation(Dialog);
27+ "Vector in width direction, resolved in object frame" annotation(Dialog);
3328 input SI.Length length= 0 "Length of visual object" annotation(Dialog);
3429 input SI.Length width= 0 "Width of visual object" annotation(Dialog);
3530 input SI.Length height= 0 "Height of visual object" annotation(Dialog);
3631 input Types.ShapeExtra extra= 0.0
3732 "Additional size data for some of the shape types" annotation(Dialog);
3833 input Real color[3 ]= {255 ,0 ,0 } "Color of shape" annotation(Dialog(colorSelector=true));
3934 input Types.SpecularCoefficient specularCoefficient = 0.7
40- "Reflection of ambient light (= 0: light is completely absorbed)"
41- annotation(Dialog);
35+ "Reflection of ambient light (= 0: light is completely absorbed)" annotation(Dialog);
4236 annotation (
4337 Documentation(info="<html>
4438
@@ -245,8 +239,7 @@ end FileSystem;
245239 output Integer year "Year" ;
246240 external "C" ModelicaInternal_getTime(ms,sec,min ,hour,day,mon,year)
247241 annotation(Library="ModelicaExternalC" );
248- annotation (__ModelicaAssociation_Impure=true,
249- Documentation(info="<html>
242+ annotation (__ModelicaAssociation_Impure=true, Documentation(info="<html>
250243<h4>Syntax</h4>
251244<blockquote><pre>
252245(ms, sec, min, hour, day, mon, year) = Internal.Time.<strong>getTime</strong>();
@@ -314,21 +307,25 @@ All returned values are of type Integer and have the following meaning:
314307</html>" ));
315308 end getTime;
316309
317- function dayOfWeek "Return day of week for given date"
318- extends Modelica.Icons.Function;
319- input Integer year "Year" ;
320- input Integer mon= 1 "Month" ;
321- input Integer day= 1 "Day of month" ;
322- output Integer dow "Day of week: 0 = Sunday, ..., 6 = Saturday" ;
323- protected
324- constant Integer t[:] = {0 , 3 , 2 , 5 , 0 , 3 , 5 , 1 , 4 , 6 , 2 , 4 };
325- Integer y = year;
326- algorithm
327- assert (mon > = 1 and mon < = 12 , "Month is out of range." );
328- if mon < 3 then
329- y := y - 1 ;
330- end if ;
331- dow := mod (y + div (y, 4 ) - div (y, 100 ) + div (y, 400 ) + t[mon] + day, 7 );
310+ function dayOfWeek "Return day of week for given date"
311+ extends Modelica.Icons.Function;
312+ input Integer year "Year" ;
313+ input Integer mon= 1 "Month" ;
314+ input Integer day= 1 "Day of month" ;
315+ output Integer dow(min = 1 , max = 7 ) "Day of week: 1 = Monday, ..., 6 = Saturday, 7 = Sunday" ;
316+ protected
317+ constant Integer t[:] = {0 , 3 , 2 , 5 , 0 , 3 , 5 , 1 , 4 , 6 , 2 , 4 };
318+ Integer y = year;
319+ algorithm
320+ assert (mon > = 1 and mon < = 12 , "Month is out of range." );
321+ if mon < 3 then
322+ y := y - 1 ;
323+ end if ;
324+ dow := mod (y + div (y, 4 ) - div (y, 100 ) + div (y, 400 ) + t[mon] + day, 7 );
325+ // One-based indexing: Sunday is 7
326+ if dow == 0 then
327+ dow := 7 ;
328+ end if ;
332329 annotation (Documentation(info="<html>
333330<h4>Syntax</h4>
334331<blockquote><pre>
@@ -338,16 +335,14 @@ dow = Internal.Time.<strong>dayOfWeek</strong>(year, mon, day);
338335<p>
339336<p>
340337Returns the day of the week for a given date using Tomohiko Sakamoto's algorithm.
341- The returned Integer number of <code>dow</dow > has the following meaning:
338+ The returned Integer number of <code>dow</code > has the following meaning:
342339</p>
343340
344341<blockquote>
345342<table border=1 cellspacing=0 cellpadding=2>
346343<tr><th>Day of week</th>
347344 <th>Number</th></tr>
348345
349- <tr><td>Sunday</td> <td>0</td></tr>
350-
351346<tr><td>Monday</td> <td>1</td></tr>
352347
353348<tr><td>Tuesday</td> <td>2</td></tr>
@@ -359,6 +354,9 @@ The returned Integer number of <code>dow</dow> has the following meaning:
359354<tr><td>Friday</td> <td>5</td></tr>
360355
361356<tr><td>Saturday</td> <td>6</td></tr>
357+
358+ <tr><td>Sunday</td> <td>7</td></tr>
359+
362360</table>
363361</blockquote>
364362
@@ -370,7 +368,7 @@ dow = dayOfWeek(2020) // = 3
370368 // Jan. 01, 2020 (New Year's Day) is a Wednesday
371369</pre></blockquote>
372370</html>" ));
373- end dayOfWeek;
371+ end dayOfWeek;
374372
375373 annotation (
376374Documentation(info="<html>
0 commit comments