Checking of units and dimensional homogeneity of expressions...

Data processing: software development – installation – and managem – Software program development tool – Translation of code

Reexamination Certificate

Rate now

  [ 0.00 ] – not rated yet Voters 0   Comments 0

Details

C717S143000, C717S126000

Reexamination Certificate

active

06578196

ABSTRACT:

TECHNICAL FIELD OF THE INVENTION
The present invention relates to the checking of units and dimensional homogeneity of expressions, and in particular to checking of the correctness and consistency of units and dimensions of variables and constants used in expressions, such as those used in computer programs. The present invention relates particularly to a method and apparatus for performing such checking.
BACKGROUND ART
Algebraic expressions are typically used in computer programs to assign values to variables. These algebraic expressions may include operations with various measurement units and dimensions. Examples of such units and dimensions include meters, seconds, cubic meters, inches, kilograms, meters per second, and many more.
Prior methods of software testing of computer programs do not check for correctness and consistency of units and dimensions of variables and constants used in expressions. A failure to correctly do so may lead to serious miscalculations. A simple example of this would be if an algebraic expression containing a variable or constant having units of metres per second is added to another variable or constant with units of centimetres per second or inches per second.
According to the article “NASA Reworks its Sums after Mars Fiasco” by Reichhardt, T., published in Nature, Vol. 401, Oct. 7, 1999, p. 517, the loss of NASA's Mars Climate Orbitor on Sep. 23, 1999, as it was about to enter orbit, has been attributed to a confusion between imperial and metric units.
DISCLOSURE OF THE INVENTION
It is an object of the present invention to provide a method of checking units and dimensional homogeneity of expressions.
According to a first aspect of the invention, there is provided a method of checking a computer program for unit or dimensional homogeneity, the computer program including expressions, and the method comprising the steps of:
accepting as input corresponding strings for variables used in the expressions;
identifying and substituting instances of the variables with the corresponding strings;
recasting the expressions into a form of one or more token pairs arranged sequentially in a string, each said token pair comprising an operator followed by an operand;
reducing the strings in accordance with a set of predetermined simplifying rules; and
checking the reduced strings for unit or dimensional homogeneity in accordance with a set of predetermined conditions.
The computer program may include assignment statements where the right hand sides of the assignment statements constitute expressions.
The computer program may also include functions, in which case the method comprises the further steps of checking for unit or dimensional homogeneity of the functions by:
accepting as input corresponding strings for the functions and function parameters used in the expressions;
creating an assignment statement for each of the function parameters;
identifying and substituting instances of variables on right hand side of the assignment statements with the corresponding strings;
substituting the function parameters with the corresponding strings;
recasting sides of the assignment statements into the form of one or more token pairs arranged sequentially in a string;
reducing the strings in accordance with the set of predetermined simplifying rules; and
checking the reduced strings for unit or dimensional homogeneity in accordance with the set of predetermined conditions.
Preferably, the simplifying rules comprise performing the steps of:
arranging token pairs into subgroups;
arranging operand tokens in an arranged subgroup in order;
reducing the ordered operands by consolidating one or more constants and eliminating variables of opposite effect to form reduced subgroups; and
consolidating one or more multiple instances of similar subgroups, to produce a reduced string.
Preferably, the set of predetermined conditions for expressions comprise performing the step of:
testing whether the reduced string reduces to a single term; or
testing whether the reduced string reduces to the zero string.
The set of predetermined conditions for assignment statements preferably comprise performing the steps of:
testing whether the reduced string reduces to a single term; or
testing whether the reduced string reduces to the zero string; and
testing by comparison whether the sides of the assignment statements have corresponding unit-groups.
According to a further aspect of the invention, there is provided an apparatus for checking a computer program for unit or dimensional homogeneity, the computer program including expressions, the apparatus comprising:
means for accepting as input corresponding strings for variables used in the expressions;
means for identifying and substituting instances of the variables with the corresponding strings;
means for recasting the expressions into a form of one or more token pairs arranged sequentially in a string, each said token pair comprising an operator followed by an operand;
means for reducing the strings in accordance with a set of predetermined simplifying rules; and
means for checking the reduced strings for unit or dimensional homogeneity in accordance with a set of predetermined conditions.
When the computer program includes functions, the apparatus comprising an additional means for checking for unit or dimensional homogeneity of the functions, this additional means comprising:
means for accepting as input corresponding strings for the functions and function parameters used in the expressions;
means for creating an assignment statement for each of the function parameters;
means for identifying and substituting instances of variables on right hand side of the assignment statements with the corresponding strings;
means for substituting the function parameters with the corresponding strings;
means for recasting sides of the assignment statements into the form of one or more token pairs arranged sequentially in a string;
means for reducing the strings in accordance with the set of predetermined simplifying rules; and
means for checking the reduced strings for unit or dimensional homogeneity in accordance with the set of predetermined conditions.


REFERENCES:
patent: 5159552 (1992-10-01), van Gasteren et al.
patent: 5216627 (1993-06-01), McClellan et al.
patent: 5274812 (1993-12-01), Inoue
patent: 5905892 (1999-05-01), Nielsen et al.
patent: 6009267 (1999-12-01), Ogawa
patent: 6237139 (2001-05-01), Hotta et al.
Cmelik et al. Dimensional Analysis with C++. IEEE. 1998. pp. 21-27.*
Novak. Conversion of Units of Measurement. IEEE. 1995. pp. 651-661.

LandOfFree

Say what you really think

Search LandOfFree.com for the USA inventors and patents. Rate them and share your experience with other people.

Rating

Checking of units and dimensional homogeneity of expressions... does not yet have a rating. At this time, there are no reviews or comments for this patent.

If you have personal experience with Checking of units and dimensional homogeneity of expressions..., we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Checking of units and dimensional homogeneity of expressions... will most certainly appreciate the feedback.

Rate now

     

Profile ID: LFUS-PAI-O-3153596

  Search
All data on this website is collected from public sources. Our data reflects the most accurate information available at the time of publication.