Abstract:
Process duration data are generated that are independent of a reference calendar date, by conversion of a given duration data set, comprised within a process description data set, in a converted duration data set, the given data set being first converted into an intermediary data set that is compliant to a data format specified in the international standard ISO 8601 and includes the following consecutive fields: a first delimiter, a years value, a years value field identifier, a months value, a months value field identifier, a days value, a days value field identifier, a second delimiter, an hours value, an hours value field identifier, a minutes value, a minutes value field identifier, a seconds value, a seconds value field identifier. A target data set is first created with a first placeholder for a converted months value and a second placeholder for a converted seconds value, a first equation is solved by applying the years value and the month value as parameters to the equation; a second equation is solved by applying the days value, the hours value, the minutes value and the seconds value as parameters to the equation. The first and the second placeholders are replaced with the converted months value and the converted seconds value respectively and the target data set is stored as the converted duration data set in the process description data set.

Description:
CROSS-REFERENCE TO RELATED APPLICATION 
       [0001]    This application claims the priority, under 35 U.S.C. §119, of European patent application EP 08 008 643.2, filed May 8, 2008; the prior application is herewith incorporated by reference in its entirety. 
       BACKGROUND OF THE INVENTION 
       [0002]    1. Field of the Invention 
         [0003]    The invention relates to a method for generating process duration data which is independent of a reference calendar date, especially by converting process durations from a format as specified in the ISO 8601 international standard for date and time representation to a modified format expressing durations solely in months and seconds. 
         [0004]    Modeling production systems and specifying and/or altering process parameters associated with the production systems require taking into consideration durations, periodicities and differences between dates, meant as differences between a start date and an end date. Throughout this document, expressions such as “2 minutes,” “1 day,” “1 month and two days” will be referred to as durations. 
         [0005]    For example, in a production system, an operator needs to configure a parameter specifying that a production phase must last 1 hour. The operator may not know a start date or an end date of the production phase. In another case, the operator needs to schedule the production phase such that it starts from a precise date and time and it lasts a certain amount of time. In yet another case, recurring production phases have to be configured such that they are started at regular points in time, like for example every day at noon. 
         [0006]    In order to unify concepts like durations, time intervals and dates, the ISO 8601 standard, for example described in ISO 8601—Wikipedia, the free encyclopedia, has been created, which advises formats of dates and time on an internationally agreed basis. In particular, the ISO 8601 standard, compared to the international standard ISO/IEC 11404:1996, which deals with durations as time intervals, describes durations as strings in one of the formats: P[y]Y[m]M[d]DT[h]H[m]M[s]S for month format or P[y]Y[w]W[d]DT[h]H[m]M[s]S for week format, e.g. “PT2M” stands for 2 minutes, “P1D” stands for 1 day and “P1M2D” stands for 1 month and 2 days. The capital letters in the formats mentioned above are used as they are, and not replaced, whereas the terms in brackets are used as placeholders for values. The detailed signification of the formats is as follows: a first delimiter P, a years value y, a years value field identifier Y, a months value m, a months value field identifier M, a weeks value w, a weeks value field identifier W, a days value d, a days value field identifier D, a second delimiter T, an hours value h, an hours value field identifier H, a minutes value m, a minutes value field identifier M, a seconds value s, a seconds value field identifier S. 
         [0007]    For reasons of clarity, this document will use a different notation for months and minutes, being as follows: a months value m, a months value field identifier Ma, a minutes value n, a minutes value field identifier Mb. 
         [0008]    The field of usage of the ISO 8601 format covers interoperability between systems. As an example, the markup language XML supports the ISO 8601 standard as indicated in Part 2: Data types, of the W3C Recommendation about XML schema of 2 May 2001, thus, systems using XML have to adapt to the ISO 8601 standard as well. 
         [0009]    Database systems do not provide a native data type which conveniently translates durations in a format able to handle primitive operations in a field of durations and between dates and durations. Such operations are:
       Summation of a date and a duration   Subtraction of one date from another date   Summation between a first duration and a second duration   Subtraction of one duration from another duration       
 
         [0014]    Thus, the database systems have to combine existing native data types like strings and numbers to form complex combinations. A consequence is that the native data types mentioned above have to be converted into one another every time one of the primitive operations is performed. Applications using the database systems usually use non-string data formats in order to perform the primitive operations, for example:
       Fields containing a number and a unit of measurement, e.g. (2, minutes), (1, day), (32.4, day);   A number of seconds, e.g. 120 (seconds), 86400 (seconds in a day), 2802582 (average number of seconds in a month+number of seconds in 2 days);   A date obtained as end time, after having taken as a start date a conventional date, e.g. using the start date of 01/01/1970 00:00, a duration of 2 minutes yields 01/01/1970 00:02.       
 
         [0018]    Thus, parsing or conversions to a fixed unit are needed in order to perform operations between two durations or between a duration and a date. Conversions often imply arbitrary approximations. Different kinds of anomalies are present in prior solutions. 
         [0019]    Using numbers and units, one problem is an ambiguous approximation, meaning that a same duration can be converted into the fixed unit using different conversion types, for example, a typical format of P2Ma1D can either be (32.4373, “d”) or (32, “d”). Another problem is an ambiguous unit of measurement, meaning that the same duration can be converted into different units of measurement. Taking the example above, typical formats for P2Ma1D can either be (32.4 “d”) or (2802582, “s”) or (1.066, “mon”). Yet another problem is a non reversibility, meaning that a number and a unit of measurement of seconds can be converted into a duration which is often different from the original, for example, (32.4, “d”) can be P32.4D. 
         [0020]    Using numbers of seconds, one problem is again the ambiguous approximation, meaning that the same duration can be converted into seconds using different conventions. A month and a year have a variable equivalent in seconds, which makes it necessary to use an average number of seconds per year or seconds per month. The average number of seconds per year is usually calculated on a 1, 4, 100 or 400 years basis. Obviously, depending on the calculation basis, different precisions are reached. For example, typical representations for P2M1D can either be 2802582 seconds or 2764800 seconds. Another problem is again the non reversibility, meaning in this case that a number of seconds can be converted into different durations which may differ from the original, for example, 2802582 seconds can either be P32.4373D or PT2802582S. 
         [0021]    Using dates, one problem is an ambiguous system or referencing, meaning that the same duration can be represented with different dates, depending on the referencing. Typical representations for P1M2D can either be 1900-02-01 or 1970-02-03. Another problem is again the non reversibility, meaning that a date can be converted into different durations, for example 1900-02-01 can be converted into P33D or P1M2D. 
         [0022]    Thus, given the conversion problems described above and taking into account that conversions have to be carried out every time duration and date related computations have to be carried out to data set members of a database, errors cumulate, making a precise modeling of production processes and of dependencies of processes upon one another very difficult in terms of their durations and, as a consequence, their synchronization. 
       SUMMARY OF THE INVENTION 
       [0023]    It is accordingly one object of the invention to provide method for representing duration information which overcomes the above-mentioned disadvantages of the heretofore-known devices and methods of this general type and which provides for the presentment of duration information in a concise and usable format from within a database and offers an ability to perform the primitive operations in a reliable way, such that the operations have predictable behaviors. 
         [0024]    With the foregoing and other objects in view there is provided, in accordance with the invention, a method of generating process duration data that are independent of a reference calendar date, by conversion of a given duration data set, formed within a process description data set, in a converted duration data set, the given data set being first converted into an intermediary data set, the intermediary data set being compliant with a data format specified in international standard ISO 8601 and including the following consecutive fields: a first delimiter, a years value, a years value field identifier, a months value, a months value field identifier, a days value, a days value field identifier, a second delimiter, an hours value, an hours value field identifier, a minutes value, a minutes value field identifier, a seconds value, a seconds value field identifier, the method which comprises the following steps: 
         [0025]    creating a target data set formed with a first placeholder for a converted months value and a second placeholder for a converted seconds value; 
         [0026]    solving a first equation by applying the years value and the months value as parameters to the equation, a result of the first equation yielding the converted months value; 
         [0027]    solving a second equation by applying the days value, the hours value, the minutes value and the seconds value as parameters to the equation, a result of the second equation yielding the converted seconds value; 
         [0028]    replacing the first placeholder with the converted months value and replacing the second placeholder with the converted seconds value; and 
         [0029]    storing the target data set as the converted duration data set in the process description data set. 
         [0030]    In other words, one way the goal is achieved is by providing a method for generating process duration data which is independent of a reference calendar date, by conversion of a given duration data set, comprised within a process description data set, in a converted duration data set, the given data set being first converted into an intermediary data set, the intermediary data set being compliant to a data format specified in the international standard ISO 8601 and comprising the following consecutive fields: a first delimiter, a years value, a years value field identifier, a months value, a months value field identifier, a days value, a days value field identifier, a second delimiter, an hours value, an hours value field identifier, a minutes value, a minutes value field identifier, a seconds value, a seconds value field identifier. The method comprises the steps of: 
         [0031]    creating a target data set comprising a first placeholder for a converted months value and a second placeholder for a converted seconds value, 
         [0032]    solving a first equation by applying the years value and the months value as parameters to the equation, a result of the first equation yielding the converted months value, 
         [0033]    solving a second equation by applying the days value, the hours value, the minutes value and the seconds value as parameters to the equation, a result of the second equation yielding the converted seconds value, 
         [0034]    replacing the first and the second placeholder with the converted months value and the converted seconds value respectively; and 
         [0035]    storing the target data set as the converted duration data set in the process description data set. 
         [0036]    Thus, in order to host duration, a tuples is used, comprising one field containing a number of months and another field containing a number of seconds. 
         [0037]    The main advantage of the present solution is that various ambiguities, which have been presented further above in this document, related to conversions of dates and durations, are avoided. 
         [0038]    For reasons of clarity, throughout the description of the invention, parentheses will only be used for tuples of values, in order to point out that values or variables are to be understood as pairs in the respective context. 
         [0039]    Other features which are considered as characteristic for the invention are set forth in the appended claims. 
         [0040]    Although the invention is illustrated and described herein as embodied in a method for generating process duration data which is independent of a reference calendar date, it is nevertheless not intended to be limited to the details shown, since various modifications and structural changes may be made therein without departing from the spirit of the invention and within the scope and range of equivalents of the claims. 
         [0041]    The construction and method of operation of the invention, however, together with additional objects and advantages thereof will be best understood from the following description of specific embodiments when read in connection with the accompanying drawings. 
     
    
     
       BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWING 
         [0042]      FIG. 1  is a diagrammatic flowchart illustrating a conversion principle from a given duration data set to a target data set (_m,_s); 
           [0043]      FIG. 2  is a diagrammatic flowchart of conversion principle from a target duration data set (_m,_s) to an intermediary ISO 8601 duration data set; and 
           [0044]      FIG. 3  is a flowchart of a conversion example from a target duration data set (_m,_s) to an intermediary ISO 8601 duration data set. 
       
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
       [0045]    Referring now to the figures of the drawing in detail and first, particularly, to  FIG. 1  thereof, there is shown a flowchart of conversion principle from a given duration data set to a target data set (_m,_s). First, the given duration data set is retrieved in step  1   a  from the database and converted to the ISO 8601 format in step  2   a,  yielding the intermediary data set whose data set members are then applied to the first and the second equation, yielding the converted duration data set formed by a tuples of months and seconds values. The converted duration data set is then stored back into the database or into a memory device for immediate usage. 
         [0046]      FIG. 2  shows a flowchart of conversion principle from a converted duration data set (_m,_s) to an intermediary ISO 8601 duration data set. In step  1   b,  the converted duration data set (_m, _s) is retrieved from the database. In step  2   b  the converted months value _m is compared to a value of 12. If the converted months value is less than 12, the months value m is set to the converted months value _m, the years value is set to 0 in step  3   b   1  and step  3   b   2  is skipped. If the converted months value _m is higher than or equal to 12, then a first integer division of _m by 12 is performed, whereby the months value m is set to a remainder and the years value y is set to an answer of the first integer division in step  3   b   2 . In step  4   b,  a second integer division of the converted seconds value _s by a value of 60 is performed, whereby the seconds value s is set to a remainder of the second integer division. In step  5   b,  an answer of the second integer division is compared to 60. If the answer (x) of the second integer division is less than 60, in step  6   b   1  the hours value is set to a value of 0, the minutes value is set to the answer of the second integer division and step  6   b   2  is skipped. If the answer of the second integer division is higher or equal to 60, a third integer division of the answer of the second integer division by 60 is performed and the minutes value is set to a remainder of the third integer division in step  6   b   2 . In step  7   b,  a fourth integer division of the answer of the third integer division by a value of 24 is performed, whereby the hours value is set to a remainder of the fourth integer division and the days value is set to an answer of the fourth integer division. In step  8   b,  all results, meaning the years value y, the months value m, the days value d, the hours value h, the minutes value n and the seconds value s are converted, in other words organized, into the standard ISO 8601 format, yielding the intermediary duration data set, which, in step  9   b,  is stored back into the database or in a memory entity for further processing. 
         [0047]      FIG. 3  shows a flowchart of a conversion example for a target duration data set (_m,_s) to an intermediary ISO 8601 duration data set. In this example, a duration expressed in a format of the target duration data set of (1, 172920) is converted into the standard ISO 8601 duration data set format, thus, the converted months value is _m=1 month and the converted seconds value is _s=172920 seconds. After the set (1, 172920) has been retrieved from the database and _m is found to be less than 12, the month value is set to 1 month and the years value is set to 0. Then _s is divided by 60, yielding an answer of 2882 and a remainder of 0. Thus, the seconds value equals 0. The answer 2882 is compared to 60 and found to be less. In a next step, the answer 2882 is divided by 60 and yields an answer of 48 and a remainder of 2. Thus, the minutes value equals 2. The answer 48 is then divided by 24 and yields an answer of 2 and a remainder of 0. Thus, the days value equals 2 and the hours value equals 0. Now, all the results are converted into the standard ISO 8601 format, yielding the intermediary duration data set P0Y1Ma1DT0H2Mb0S, in other words one month, one day and two minutes. The intermediary data set is then stored into memory, optionally in a short form of the standard ISO 8601, containing only relevant, non-zero values, thus P1Ma1DT2Mb. 
         [0048]    According to a preferred method, the result of the first equation f1(y, m), being the converted months value _m, is computed by adding the months value m to a factor 12 of the years value y. In other words, in a first step, the equation f1(y,m)=_m=12*y+m is solved by extracting the years value y and the months value m from the intermediary data set and inserting the two values into the equation f1(y,m), the result of the first equation f1(y,m) yielding the converted months value. 
         [0049]    In a second step, the result of the second equation f2(d, h, n, s), being the converted seconds value _s, is computed according to following steps: 
         [0050]    adding the hours value h to a factor 24 of the days value d, yielding a first interim solution, 
         [0051]    adding the minutes value n to a factor 60 of the first interim solution, yielding a second interim solution, 
         [0052]    adding the seconds value s to a factor 60 of the second interim solution, yielding the result of the second equation f2(d, h, n, s). In other words, the equation 
         [0000]        f 2( d, h, n, s )= —   s= 60*(60*(24* d+h )+ n )+ s    
         [0053]    is solved by extracting the days value d, the hours value h, the minutes value m and the seconds value s from the intermediary data set and inserting the four values into the equation f2(d, h, n, s), the result of the second equation f2(d, h, n, s) yielding the converted months value. The first and the second step are further explained below by an example 1. 
         [0054]    Example 1 shows a conversion from intermediary ISO 8601 duration data sets to a target data set. 
         [0055]    Conversion of a given data set PT2Mb. A conversion to the intermediary data set is performed, yielding P0Y0Ma0DT0H2Mb0S. This step is not shown in the example. Having the intermediary data set, following associations are performed and inserted in a pair of the two equations, the first equation f1(y,m) and f2(d, h, n, s): 
         [0056]    y=0; m=0; d=0, h=0; n=2; s=0; if we insert this in the two equations, we obtain: 
         [0000]        f 1(0,0)= —   m= 12*0+0=0; 
         [0000]        f 2(0,0,2,0)= —   s= 60*(60*(24*0+0)+2)+0=120 
         [0057]    Thus, the result is a target data set (_m,_s)=(0, 120). As can be seen, the minutes value of 2 is expressed in the target data set (0, 120) in seconds. 
         [0058]    conversion of a given data set P1D. A conversion to the intermediary data set is performed, yielding P0Y0Ma1DT0H0Mb0S. This step is not shown in the example. Having the intermediary data set, following associations are performed and inserted in a pair of the two equations, the first equation f1(y,m) and f2(d, h, n, s): 
         [0059]    y=0; m=0; d=1, h=0; n=0; s=0; if we insert this into the two equations, we obtain: 
         [0000]        f 1(0,0)= —   m= 12*0+0=0; 
         [0000]        f 2(0,0,2,0)= —   s= 60*(60*(24*1+0)+0)+0=86400 
         [0060]    Thus, the result is a target data set (_m,_s)=(0, 86400). As can be seen, the days value of 1 is expressed in the target data set (0, 86400) in seconds. 
         [0061]    conversion of a given data set P1Y1Ma2D. A conversion to the intermediary data set is performed, yielding P0Y1Ma2DT0H0Mb0S. This step is not shown in the example. Having the intermediary data set, following associations are performed and inserted in a pair of the two equations, the first equation f1(y,m) and f2(d, h, n, s): 
         [0062]    y=1; m=1; d=2, h=0; n=0; s=0; if we insert this into the two equations, we obtain: 
         [0000]        f 1(0,0)= —   m= 12*1+1=13; 
         [0000]        f 2(0,0,2,0)= —   s= 60*(60*(24*2+0)+0)+0=172800 
         [0063]    Thus, the result is a target data set (_m,_s)=(13, 172800). The days value of 2 is expressed in the target data set (13, 172800) in seconds and the years value is expressed in months. 
         [0064]    According to a preferred method, the converted duration data set is adapted to be used in a database management system for at least following operations: a summation of the converted months value _m and the converted seconds value _s to a date, a summation of a first converted months value _m 1  and a first converted seconds value _s 1  belonging to a first converted duration data set _m 1 ,_s 1  to a second converted months value _m 2  and a second converted seconds value _s 2  belonging to a second converted duration data set _m 2 ,_s 2  respectively, a subtraction of the first converted months value _m 1  and the first converted seconds value _s 1  from the second converted months value _m 2  and the second converted seconds value _s 2  respectively. The summation of the first converted duration data set _m 1 ,_s 1  to the second converted duration data set _m 2 ,_s 2  as well as the subtraction of the first a first converted duration data set _m 1 ,_s 1  from the second converted duration data set _m 2 ,_s 2  are further explained below by an example 2. 
         [0065]    A summation of two converted data sets is performed as follows: 
         [0000]      ( —   m 1,  —   s 1)+( —   m 2,  —   s 2)=( —   m 1+ —   m 2,  —   s 1+ —   s 2) 
         [0066]    A subtraction between two converted data sets is performed as follows: 
         [0000]      ( —   m 2,  —   s 2)−( —   m 1,  —   s 1)=( —   m 2− —   m 1,  —   s 2− —   s 1) 
       EXAMPLE 2 
       [0067]    A summation of (0, 120) to (1, 172800) yields 
         [0000]      (0+1, 172800+120)=(1, 172920) 
         [0000]    A subtraction of (1, 172800)−(0, 86400) yields 
         [0000]      (1−0,172800−86400)=(1, 86400) 
         [0068]    As example 2 shows, an advantage of the present method is that arithmetic operations are simple, thus increasing speed of computations in systems implementing the method, as opposed to the prior art, wherein all variables like y, m, d, etc. had each to first be converted in order to be used in arithmetic operations. 
         [0069]    According to a preferred method, the converted months value _m is stored in an integer data format and the converted seconds value _s is stored in a floating point data format. The target month value, as it is restricted to describe either months or years, only needs integral numbers because smaller time portions than a month are described in days, hours, minutes and seconds. The converted seconds value however uses a floating point type in order to advantageously account for time sensitive processes, requiring sub-second accuracies. 
         [0070]    According to a preferred method, the converted months value _m and the converted seconds value _s of the converted duration data set _m,_s comprised in the process description data set is converted to the intermediary data set by following the steps of: 
         [0071]    a1) performing a first integer division, whereby the converted months value _m is divided by 12, 
         [0072]    a2) an answer of the first integer division is stored as the years value y and a remainder of the first integer division is stored as the months value m, 
         [0073]    a3) performing a second integer division, whereby the converted seconds value _s is divided by 60, 
         [0074]    a4) an answer of the second integer division is stored as a minutes subtotal and a remainder of the second integer division is stored as the seconds value s, 
         [0075]    a5) performing a third integer division, whereby the minutes subtotal is divided by 60, 
         [0076]    a6) an answer of the third integer division is stored as an hours subtotal and a remainder of the second integer division is stored as the minutes value n, 
         [0077]    a7) performing a fourth integer division, whereby the hours subtotal is divided by 60, 
         [0078]    a8) an answer of the fourth integer division is stored as the days value d and a remainder of the second integer division is stored as the hours value h, 
         [0079]    a9) creating the intermediary data set by writing the first delimiter P and appending the years value y, the years value field identifier Y, the months value m, the months value field identifier Ma, the days value d, the days value field identifier D, the second delimiter T, the hours value h, the hours value field identifier H, the minutes value n, the minutes value field identifier Mb, the seconds value s and the seconds value field identifier S. 
         [0080]    This advantageously allows interoperability to higher layer applications, such as graphical user interfaces used for configuration of product chains and product processes, by providing process duration data in a format compatible to the said higher layer applications. 
         [0081]    A module for implementing the method comprises software code, the software code being adapted to be used as a plug-in, the plug-in being importable into database software systems. Advantageously, a flexible possibility of using the method described herein is to incorporate the method in a plug in, the plug in being loadable by a data management system and/or a process modeling software whenever it is needed without having to recompile the said software systems. 
         [0082]    Another module for implementing the method comprises a software library, the software library being adapted to be included into a code base of database software systems. Typically, an implementation of the method in a computer program is realized by using for example a dynamic link library which is included into the code of a database management system and compiled together with the said code 
         [0083]    The present invention makes it possible to handle durations in a precise, reproducible way. It eliminates overhead and approximation problems, as well as allows fast arithmetical operations like summation without having to perform conversions every time an operation has to be carried out. This aspect has the further advantage that it avoids accumulation of conversion errors and/or approximations which, in prior art systems, occur due to numerous back and forth conversions. Another advantage lies in storage size reduction, as each converted data set only requires and integer and a floating point storage place, whereas intermediary data sets require several character and variable storage places, this aspect further having the advantage that database access is optimized in terms of speed. 
         [0084]    The following list of references and abbreviations may aid the reader in understanding the foregoing specification:
       P=first delimiter   y=years value   Y=years value field identifier   m=months value   Ma=months value field identifier   d=days value   D=days value field identifier   T=second delimiter   h=hours value   H=hours value field identifier   n=minutes value   Mb=minutes value field identifier   s=seconds value   S=seconds value field identifier   (_m,_s)=target duration data set   _m=converted months value   _S=converted seconds value   f1(y, m)=first equation   f2(d, h, n, s)=second equation     1   a =retrieve given duration data set     2   a =convert given duration data set to ISO form PyYmMdDThHnMsS     3   a =apply the first and the second equation     4   a =store the converted duration data set     1   b =retrieve the converted duration data set     2   b =is m less than 12?     3   b   1 =set m=_m     3   b   2 =first integer division of _m by 12. set m to the remainder of the first integer division and y to the answer of the first integer division     4   b =second integer division of _s by 60. set s to the remainder of the second integer division     5   b =is the answer of the second integer division less than 60?     6   b   1 =set h to zero, set the minutes value to the answer of the second integer division     6   b   2 =third integer division of the answer of the second integer division by 60. set n to the remainder of the third integer division     7   b =fourth integer division of the answer of the third integer division by 24. set h to the remainder of the fourth integer division and d to the answer of the fourth integer division.     8   b =convert y, m, d, h, n, s to the ISO 8601 standard     9   b =store result of conversion to the ISO 8601 standard PyYmMdDThHnMsS.