UDC 004.434:51+519.673+53.02
V.F. OCHKOV, V.I. LEHENKYI, K.O. MINAEVA
PHYSICAL QUANTITIES, DIMENSIONS AND UNITS OF MEASUREMENT IN MATHEMATICAL PACKAGES
Abstract: There are described problems and solutions when working with valid dimensions in the medium of mathematical program (engineer calculator) Mathcad.
Key words: physical quantities, analysis dimenscons, units of measurement, mathematical modeling, Mathcad.
Анотація: Описано проблеми та рішення під час роботи з розмірними величинами в середовищі математичної програми (інженерного калькулятора) Mathcad.
Ключові слова: фізичні величини, аналіз розмірностей, одиниці вимірювань, математичне моделювання, Mathcad.
Аннотация: Описаны проблемы и решения при работе с размерными величинами в среде математической программы (инженерного калькулятора) Mathcad.
Ключевые слова: физические величины, анализ размерностей, единицы измерений, математическое моделирование, Mathcad.
1. Introduction
Programming languages and electronic worksheets which are used for the solution of physical tasks
operates with simple dimensions (numbers), but not with physical dimensions - mass, rate, energy etc.,
which, firstly, decreases the readability of calculation, and, secondly, causes mistakes.
Mistakes connected with the use of invalid measurement units attended all spheres of human
relations since olden times. For example, Russian Tsar Peter the Great reproached duke Kurakin in a
letter (1714, [1, p.9]): “... you've sent a list by a hired ship, where proportion is written with Amsterdam
pound, but I had always written to you, that there must be English pounds, and I am wondering - why did
you disregard it, because now there is a shortage of 10 feet at length and also breadthways”. In our time
of anthropogenic catastrophes the consequences and detriment can be more considerable.
Thus, the New York Times newspaper reports [2] that a Boeing airplane, which belonged to
Canada Airlines, flew from Montreal to Edmonton in 1983, 23 of July. Halfway through the trip at a height
of 12500 meters the airliner had to make an emergency landing at Gimli because of total fuel
consumption. The reason for the fuel shortage was a mistake of the captain, who calculated fuel mass
inaccurately. At the time Canada had changed its metric system from British (in this system volume
measure is gallon, mass measure is pound) to International SI system (liters and kilograms respectively).
For recalculation of the required fuel mass it was necessary to multiply fuel gage readings (liters) by the
respective value of density. The mistake was that the captain used an invalid value of density
(pound/gallon) instead of correct one (kg/l). Consequently the tank of the airplane was filled up with only
one half of the required fuel, which resulted in the emergency landing.
Another such a mistake [3] caused the failure of flight of the American satellite Mars Climate
Orbiter (MCO). The Mars Climate Orbiter was launched in 1998, 11 of December aboard launch vehicle
Delta-2. The apparatus arrived at Mars in 9 months on 23 of September 1999. At a preselected time the
apparatus turned on the engine for braking at a height of 193 km. In 5 minutes MCO departed to Mars and
there were no any signals from it. Data analysis from a tracking station revealed that the apparatus had
flown over the surface at a height of 57 km only instead of the calculated 140 km and was just burned up
in the atmosphere (the cost of the apparatus was 125 million $). Such a big deviation was caused by a
mistake of mission specialists: When calculating the braking impulse one of the groups used British units of measurement (pound - force), and another one used metric ones (newton).
Today every specialist in every field of science and technique can exemplify a lot of mistakes connected with erroneous handling with physical quantities, dimensions or units of measurement. Conversion from manual calculations to computer programming languages have not solved this problem completely.
2. The approaches and methods of work with valid dimensions
Mathematical software packages which are equipped with means of operating with physical quantities (Mathcad, Maple, Derive etc.) accelerate the process of creation of computer calculation programs through automatic recalculation of units of measurement and control of dimensions of variables and functions. This thesis is illustrated on Fig. 1 by the concrete example for the solution of the task for a power of the pump transmitting an incompressible liquid in Mathcad.
Fig. 1. Calculation of pump power in Mathcad
Units of measurement in computer calculations can also functions as comments, which indicates the contents of a variable to the user. Together with other capabilities of Mathcad to contain superscripts and subscripts, Greek and Cyrillic alphabetic characteristics and special symbols, this function appreciably improves the readability of calculations, approximating its form to handwritten sources of information such as handbooks or manuals...
Without built-in toolbox of physical quantities in Mathcad the calculation shown on Fig.1 would have to be supplemented with operators, which recalculate auxiliary but popular units of measurement (L/hr1, atm, hp) to basic units of one or another system, for example, to International System of Units SI: not liters (L) but cubic meter (m3), not hours (hr) but seconds (s), not standard atmosphere (atm) but pascal (Pa), not horsepower but watt (W) etc.
In addition, as it was already noted, there is a control of dimension concordance (not physical quantities but dimensions, and we will talk about it below) during calculations in Mathcad. Thus, Fig. 2 shows as error in the calculation for the pump power in the case of a mistake in input data - variable p was assigned as mass but not as pressure.
Q := 30000— p-i := 1kg po := 20atm
hr ' z
G ■ (p 2 - P.1 ) = ..hp
This value has units: Massj but must have units: Pressure,
Fig. 2. Emergency stop of calculation of pump power But it is possible to avoid the emergency stop of the calculation (fig. 1) not only by correction of the introduced error p1 := 1 kg, but also by input of new p2:= 20 kg (fig.3).
Fig. 3. Incorrect but error free calculation of the pump power Emergency stop, when calculation of power, will also not occur also when all variables are dimensionless - fig. 4.
Fig. 4. Dimensionless calculation of pump power
1 In the task shown in fig. 1 we use international (Latin) units of measurement. But it is possible to operate with users, for example, national units, when connecting it with built-in dimensions.
In principle, the complete mechanism of dimension control must imply that formulas can contain a quantity of concrete dimension - examples shown on fig. 3 and fig. 4 must be finished not just with incorrect answers2 (“not-power” on fig. 3 or dimensionless number on fig. 4), but with the emergency stop of calculation, as it is shown on fig. 2. Also Mathcad controls the conformity of dimensions and won't let us summarize mass and length, but it does not control the total conformity of physical quantities. And, as it is generally known, different physical quantities can have similar dimensions, which can be the cause of mistakes in calculations in Mathcad and other mathematical packages.
The content of this problem, its partial and probable complete solution is illustrated by more general and understandable tasks - creation and evocation of the function which recovers volume of cylinder.
Fig. 5 represents this operation in Mathcad.
Fig. 5. Conventional creation and “dimensional” evocation of the user's function
Fig. 5 shows that if variables d and h have dimension of length then the function recovers value with dimension “cubed length” (volume) without emergency stop. But the same function will failsafely posses the value of its arguments with units of any other dimensions3 and dimensionless units - fig. 6.
Fig. 6. Evocation of the cylinder volume function with different dimensions of the argument And it is not important that the function in this case (fig. 6) generates a value with a dimension which is not equal to cubic length (consequence!). The important object is the reason of such an abnormal situation4. For solving this problem, let's remember the remarkable principle which was formulated by Fourier in his classical work “Analytical heat theory”, which was published in 1822 [4]. This principle now is famous as the “principle of dimensional uniformity” and it says that any physical equation (which is a sum of two ore more terms, as a rule) must contain terms of one dimension only. For illustration of the difference between the algebraic and “physical” equation let's use an example which was used in
2 Everybody, especially programmers, knows that wrong answer is much worse than just a lack of answer.
3 Question concerning possibility of having not only integer-valued but also fractional powers (m013, s'12 etc.) in Mathcad is still not solved. Different versions of Mathcad have different reaction on using such units.
4
Situation when function’s arguments are dimensionless can be considered (with some stipulation - below in the text) as a normal situation.
Bridgman's basic work [5]. Analyzing the task about the fall of a body under the influence of gravity, Bridgman notices that there are at least two equalities which connect traversed distance (s), velocity (v), time (t) and acceleration of gravity (g):
v = gt, ^ = gt2/2 .
Now if we will summarize these two equalities, there will appear an equation:
v + S = gT + gt2 / 2 ,
which seems to be very similar, but is erroneous - it is impossible to summarize velocity and traversed distance! If we have an available instrument for control of the dimensions which is built into Mathcad we can control the dimension of input value by addition of “dimensional zero”, notably by summation and subtraction of a certain value of given dimension. Fig. 7 illustrates the way of creating a user's function which accepts values with dimensions given by the user as an argument.
Fig. 7. Creation and activation of user's dimensional function
Fig. 7 shows that anew created function which recovers cinder volume possesses the value of arguments of length dimension only. And this function produces values of cubed length dimension (volume) only.
The following example shows that Mathcad controls the compliance of dimension of physical quantities but not the physical quantities proper.
Fig. 8 shows that when invocating function which produces the cylinder volume there can appear an error if we will swap the function's arguments - put the height of cylinder in place of its base and put the base in place of height. This error can be avoided by strengthening of control: to aim it not to dimensions but to physical quantities.
82
ISSN 1028-9763. MaTeMaTM4Hi MawMHM i CMCTeMM, 2009, № 1
w , . ., 7T-(d - m + m) ,, ,
Vc(d,h) := —-----------------— (h-m + m)
ci := 20cm h := 15cm
VC(M) = 3534.3 cm"
Fig. 8. Error when evocation of the user's function The enquiry is that the units of measurement in Mathcad should be concatenated not to dimensions (length - meters, feet, miles etc., mass - kilograms, pounds etc.) but to physical quantities. For the first time in the most complete execution this idea was effectively outlined in work by G. Hantley [6], who in particular offered to use “vectorial dimensions” that means to assign different dimension symbols to the multidirectional quantity.
At that, it is necessary to accept that meters of our cylinder base and meters of its height are the different quantities, and this difference must be evidenced, for example, by impossibility of its summation: there will appear an error as in case of summation or subtraction of pressure and mass (fig. 2).
There are eight dimensions in Mathad - length, time, mass, current strength, temperature, luminous intensity, amount of matter (“the magnificent seven” of SI) and cost (in 14th Mathcad version, the latest at the time of writing this paper). If it is necessary to input another dimension, for example, amount of information with dimensions of bit, byte etc., or cost (in the previous 13 versions of Mathcad) we have to reserve one of the free dimensions. Fig. 9 illustrates how to divide two identical dimensions into two different physical quantities and to assign to it two different units of length.
3
m-d := m m-h := cd
3
d + m-d ^i2 m-d J fh + m-h _ ^ m3 4 \ m-h /
d := 0.2m-d h := 0.15m-h Vc(d,h) = 4712.4cm3
VC(M) = ii
This value has units: Luminous Intensity, but must have units: Length.__
Fig. 9. Calculation of cylinder volume with diameters of base (the first physical quantity) and height (the second physical quantity)
Now (fig. 9) with intentional or unintentional swapping of arguments of the function, which produces the cylinder volume, will be stopped with an error report, which can be deciphered in this way: “Wrong physical quantity - cylinder height instead of its base!”
Actually the error report says (fig. 9) that “There must be length but not luminous intensity5?!” But if we will remember that “free” candela in this calculation was assigned as a wanting physical quantity and everything is logical.
All the foregoing reasonings can be taken as a certain “exotica6” in the field of theory for dimensional (physical) quantities and as an attempt of application of this theory to the computer technologies. But here is a real thermodynamic task, and with its solution in Mathcad it will be necessary (or al least it will be advisable) to operate with different physical quantities which have the same dimension (in this case it is mass).
We need to calculate the coefficient of thermal efficiency of a steam-to-gas heat-and-power engineering cycle. For this purpose it is necessary to operate with recover which recover thermodynamic behaviors of a working substance. These functions can be provided with the help of the WaterSteamPro program package - fig. 10.
Fig. 10. Functions of WaterSteamPro package in Mathcad
Fig. 10 illustrates the method of calculation of water boiling temperature at given pressure by calling one of the functions from WaterSteamPro - the wspTSP function. Meanwhile all quantities still are dimensionless, it is purported that pressure is expressed in pascal, temperature is gauged by the Kelvin scale (expressed in kelvin). All functions of the WaterSteamPro package operate with dimensionless
5 Unit of luminous intensity candela cd, as a rule, is used for imitation of unit of an absent measurement.
6 If we accept the diameter and height of the cylinder as different physical quantities and “report” it to the computer to secure against errors, we should admit that the cylinder volume must be measured not in m3, but in m2m, and these two meters are related to the different quantities.
arguments and call dimensionless quantities7, which conforms to the basic units of measurement in SI: meters, kilograms, joules (but not kilojoules), pascals (but not megapascals) etc.
But, as it was said in the commencement of this text, the mathematical program Mathcad is equipped with instruments for operating with dimensional units, and this mechanism must be used in the solution of our task about a steam-to-gas cycle and generally in heat-and-power engineering calculations.
For performing the functions of the WaterSteamPro package as a dimensional functions it is necessary to make a link in concrete Mathcad document (Reference) to the watersteampro.mcd file which is built-in WaterSteamPro package - fig. 11.
@ Reference:D:\EXTMA.DOC\watersteampro.mcd
Fig. 11. “Dimensional” functions of WaterSteamPro package in Mathcad
What does file watersteampro.mcd contain?!
First, it contains operators which implement the national dimensions into the calculation and different constants which are required for heat-and-power engineering calculations (universal gas constant, temperature and pressure of triple and critical points of water and water steam etc.). Second, and mainly, watersteampro.mcd file contains operators which turn dimensionless functions of WaterSteamPro package into dimensional ones in the Mathcad.
But there is another way - not to create a link to the file watersteampro.mcd which redefines all functions of the package, but to insert operators which redefine only some of the functions which are necessary for the concrete thermotechnical calculation, taking into consideration the thesis which says that certain different physical units have the same dimension. Particularly, in our task about thermodynamic efficiency of a steam-to-gas cycle there will be two different physical units - mass of gas and mass of water / water steam, which have the same dimension of mass.
When calculating we will need the following functions which are “dimensionally” and “physically8” are redefined in the Mathcad-document - fig. 12.
For gas (in our calculation - for air):
• wspgHGST: enthalpy (H) of gas depending on its specification (GS)9 and temperature (T);
• wspgSGSPT: entropy (S) of a gas depending on its specification(GS) and pressure (P);
• wppgTGSPT: temperature (T) of a gas depending on its specification (GS), pressure (P) and entropy (S).
7These functions are programmed on “dimensionless” programming language C.
8 “Physically” it means that kilogram of gas (kgg) and kilogram of water/steam (kgws) are related to the different dimensions: kgg=cd (also fig. 9) and kgws=kg which, as it is shown below, intensifies control of correct calculations.
9 Specification of the gas depends on its' chemical composition. In our case it is air (GS:=”air”), but it can be any other gas - natural gas, domestic gas etc.
Fig. 12. Overloading of certain functions of WaterSteamPro package For water and water steam:
• wspHPT: enthalpy (Н) of water and steam depending on pressure (Р) and temperature (Т);
• wspSPT: entropy (S) of water and steam depending on pressure (Р) and temperature (Т);
• wspPST: pressure (Р) of water on the water saturation line ( here S - saturation) depending on tempetature (Т);
• wspXSTS: dryness factor (X) of wet steam (S - см. выше) depending on temperature (Т) and entropy (S);
• wspHSTX: enthalpy (Н) of wet steam (S) depending on temperature (Т) and dryness factor (X);
• wspHSWT: enthalpy (Н) of water (W) on the water saturation line (S) depending on temperature
(Т);
• wspHSST: enthalpy (Н) of steam (S) on the saturation line (S) depending on temperature (Т);
• wspSSWT: entropy (S) of water (W on the saturation line (S) depending on temperature.
Fig. 13. Calculation of steam-to-gas cycle
Fig. 12 shows the twelve functions of the WaterSteamPro package (and there are more than 300 of them in common) which are necessary for the coefficient of thermal efficiency of the steam-to-gas cycle which are not redefined but newly created. In the calculation there will be pairs of functions: wspXXX[USER] - initial dimensionless functions and wspXXX (without any subscript) - newly created functions on the basis of previous “dimensional” functions and in these latter functions will have control of the argument’s dimensions (in the place of temperature there can be only temperature, in the place of
pressure - only pressure etc.) and will output dimensional quantities - enthalpy (kJ/kg10), entropy (kJ/(kgK)), and there will not be just “divide by kilogram” but “divide by kilogram of gas” or “divide by kilogram of water / water steam”.
Now there are all necessary functions with wspg and wsp subscripts for our thermotechnical calculations in the Mathcad and it is easy to realize the calculation of our steam-to-gas cycle - fig. 13.
In the calculation which is shown on fig. 13 there is not only concretization of kilogram (kgg and kgws) but control of correct work with physical quantities (enthalpy, entropy). Thus at the end of the calculation there are two emergency stops (difference of enthalpy of work cycle in point 1 and point 6 and sum of specific work of gas and steam turbines).
In the absence of physical quantities with mass dimension (fig. 12) there would not be any emergency stops in these operators, which could cause errors in calculations with different consequences (examples are described at the beginning of the text).
In a real combined-cycle plant (but not ideal as in our task) there are more than two working substances. Alongside with steam and air it is necessary to take into account thermodynamic properties of fuel which is directed to the combustion chamber of a gas turbine (natural gas of different chemical composition, combustion products etc.). Therefore it is better to use more than two (kgg and kdws) units of mass and the other units of measurement. With the dialog box in the right lower corner (fig. 13) is our wish to creators of the following versions of engineering calculators.
One of the aspect for solving the problem of different physical quantities with identical dimensions in Mathcad can be provided by a complementary inlay Quality in dialog window Properties which appears when press right mouse bottun on the name of newly created function. In this inlay, the user can write or -even better - paste the required dimension (basic - mass,..., amount of matter11 or composite one force, power etc.) from Dimension window. And it is possible to supplement the name of the unit with number 1,
2, 3 etc., which differs one physical quantity from another with the same dimension. This technology is illustrated in fig. 14.
In the calculation (fig. 13) dimensionless variable m (quotient of mass flow of gas in the gas turbine to mass flow of steam in the steam turbine) turned into dimensional one. And, as we showed, it is good, because the less dimensionless units in the calculation the wider will be the scope for instruments of dimensional control. But there are the other dimensionless units - dryness factor of steam (quotient of mass of dry vapor to mass of moisture (drops) in it) in unit of volume and three values of coefficient of thermal efficiency (nt - quotient of effective work to the spent heat). If we will describe numerator and denominator in these fractions (quotient) as identical physical quantities, these fractions will be dimensionless too. If we will describe numerator and denominator in these fractions as different physical quantities (kg of water and kg of steam, joule of work and joule of heat12), these quantities (x and nt) will have not just a dimension but different dimensions and it will be impossible to sum it (for example)
10 It is more easy and short to write J/g (divide joule by gram), but we are accustomed to “kilo” in numerator and denominator and it is difficult to strike it off.
11 This “magnificent seven” of SI in 14 version of Mathcad is turned into “eight” - package has units of cost a, and users can relate it to their national currency (€, $) or. use it for another purpose as we used candela (cd) for designation of “another” kilograms.
12 This differentiation of work and heat returns us to the base c thermodynamic conception which intertwines these two physical quantities to the equal dimensional unit: kgsm (work), al (heat), J (work and heat).
88
ISSN 1028-9763. MaTeMaTM4Hi MawMHM i CMCTeMM, 2009, № 1
intentionally or accidentally in Mathcad or any other mathematical package which provides the mechanism of dimensional quantities not partially (as it is now) but completely (as it is shown on fig. 14).
Fig. 14. Proposal for development of instruments “Physical quantity - Dimension - Unit
of measurement” in Mathcad
3. Conclusions
In conclusion we will remember about such a base physical quantity as plane angle or solid angle. This quantity, as a rule, starts the list of dimensions which are described in SI: first - angles, second - the magnificent seven of SI, after this - units which are comprised by the base units for force, facility etc. Though it is declared that angles are a dimensionless unit, it is remarked that its dimension is m/m (plane angle, radian). We will not go into the theory, but let's ask ourselves if it is possible to sum radian and steradian?! In the old versions of Mathcad such summation used to be stopped with an error message because radian was a dimensionless unit (rad = 1) and steradian was dimensional (sr = sr). Later
programmers of the package understood that it is illogical and in 13 and 14 versions of Mathcad they have
2 2
made... steradian dimensionless too (sr = 1), decided, evidently, that m /m can be canceled as it was
done13 for m/m for plant angle. But imagine what if plant angle would be dimensional (rad = rad)?! In this case sines, cosines and the other trigonometric functions would depend on dimensional values. And sinus would have dimension m/m or ratio of new meters (cathetus length) to new meters (hypotenuse length). This absolute insanity should be stopped! And it was done by built-in only partial control of dimensions in the mathematic packages, purporting that this control has no concrete limits.
REFERENCES
1. Russian metrology of XI - XIX century. Written lectures / NWTU - SPb., 2002. - 17 p. (electronic version http://window.edu.ru/window catalog/files/r25228/nwpi326.pdf).
2. Jet's Fuel Ran Out After Metric Conversion Errors. - New York Times, 1983. - July 30.
3. Karpenko S., Lisov I. Climate Orbiter was burned before it launched // Cosmonautics news. - 1999. - № 11 (also
http://ru.wikipedia.org/wiki/Mars Climate Orbiter).
4. Fourier J.B. J. La Theorie Analytique de la Chaleur. - 1822. - Ch. 2, Sec. 9.
5. Bridgman P. Analysis of dimensions. - Izhevsk: the research centre “Regular and chaotic dynamic”, 2001. - 148 p.
6. Hantley G. Analysis of dimensions. - М.: Mir, 1970. - 176 p.
7. Ochkov V.F. Physical and economical dimensions in Mathcad and Maple. - М.: Finance and statistics, 2002. -192 p. (http://twt.mpei.ac.ru/ochkov/Units/Forword book.htm).
Стаття надійшла до редакції 07.10.2008
13 Question about shortening in compound units of measurement is rather tangled. Thus, in Mathcad, when type-out, specific work and specific energy have dimension m2/s2 which has to be changed on more readable kJ/kg, returning mass into dimension. Such shortening bereaves quantities of its physical meaning and this mistake is made not only by “silly” computer but by “clever” user. Here is one of the examples. In all manuals thermal conductivity material is presented with W/(mK) dimension (length is canceled), but the right form is Wm/(m2K). In this case there are different meters (thickness and surface) and it should not be canceled.