From 92d089e1a9e3931320ddb8ea2e75d8736cd0a392 Mon Sep 17 00:00:00 2001 From: mkr7 Date: Thu, 9 Apr 2020 18:01:34 +0200 Subject: [PATCH] Add basic doc for Duration --- Modelica/Utilities/Time.mo | 76 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/Modelica/Utilities/Time.mo b/Modelica/Utilities/Time.mo index 23f611edc6f..5d8dd52aefd 100644 --- a/Modelica/Utilities/Time.mo +++ b/Modelica/Utilities/Time.mo @@ -1277,6 +1277,82 @@ String(d, format=\"%%days\") // Should give \"%days\", but gives \"1\" instead end normalize; + annotation (Documentation(info=" + +

Syntax

+
+
+Time.Duration();
+Time.Duration(days=0, hours=0, minutes=0, seconds=0, milliseconds=0);
+Time.Duration(dt1, dt2);
+Time.Duration(totalSeconds);
+
+
+ +

Description

+

+ The operator record Duration is used for elapsed time. + This can be the time between given by DateTime records + (i.e. by subtracting them) or a manually specified duration. +

+

+ There are multiple constructors provided to create a Duration element. + See the examples below for details. +

+ +

Here is a brief summary, what the Duration operator record is capable of:

+ + +

Example

+ +The examples below demonstrate the different methods to create a Duration record. + +
+
+import Modelica.Utilities.Time.Duration;
+
+// Create Duration records from direct input
+Duration();                                      // create Duration record using default constructor, which is fromInput
+Duration.'constructor'.fromInput(hours=10);      // explicit call of constructor
+Duration(days=1, seconds=100);                   // automatic selection of constructor fromInput
+
+// Create Duration records from two DateTimes
+import Modelica.Utilities.Time.DateTime;
+dt1 = DateTime.now();
+dt2 = DateTime.now();
+Duration.'constructor'.fromDateTimes(dt1, dt2);  // explicit call of constructor
+Duration(dt1, dt2);                              // automatic selection of constructor via data type
+Duration(dt1=dt1, dt2=dt2);                      // automatic selection of constructor via names
+
+// Create Duration records manually using the elapsed seconds since the given epoch year
+Duration.'constructor'.fromSeconds(1);           // explicit call of constructor
+Duration(totalSeconds=1.5);                      // automatic selection of constructor via name
+
+
+")); end Duration; annotation ( Documentation(info="