From: ldries46 <bertus.dries@planet.nl>
Subject: Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?
Date: Mon, 6 Sep 2021 15:06:17 +0200 [thread overview]
Message-ID: <nnd$563ecd8c$31afcc12@91591a5cbc3e1e9a> (raw)
In-Reply-To: <sh4o48$1ria$1@gioia.aioe.org>
Op 6-9-2021 om 11:47 schreef Dmitry A. Kazakov:
> On 2021-09-06 09:20, ldries46 wrote:
>> Op 5-9-2021 om 9:27 schreef Dmitry A. Kazakov:
>>> On 2021-09-05 08:56, reinert wrote:
>>>> Anybody with good ideas on how (in a simplest possible way) to
>>>> avoid to confuse between representation of time as seconds,
>>>> minutes, hours and days in an Ada program?
>>>
>>> Just use the standard type Duration.
>>>
>>>> It is somewhere in my program natural/human to think in seconds
>>>> whereas minutes or hours feels more natural at other places (so
>>>> the numerics is "human"). Example to illustrate: heart rate is
>>>> "natural" to give in number per minute (not in number per second,
>>>> hour or day). Time on work is normally given by hours (not seconds)
>>>> etc..
>>>
>>> The user interface is responsible to convert anything to Duration
>>> and back.
>>>
>> I agree with Dimitry but I think the problem is far bigger and not
>> only in Ada but in every computer language. You cannot use packages
>> written by others if you do not know the dimensions they use. For
>> instance in mechanical engineering in Europe there is a general use
>> of cm while in other countries they use inches and in aircraft
>> engineering they use in Europe mostly mm.
>
> Why do you need that? If written in Ada, the value is of some separate
> numeric type you could not mix with other types.
I do need that because you can use the same packages in different
trades. If you want to calculate the inertia of a construction dependent
on the location or the trade you are working in you use different
dimension systems. Indeed you can use SI but most mechanical engineers
use the cm as a basic unit while aeronautical engineers use the mm as
there basic unit and the result differ with 4 zero's. In the USA they
probably use inches which differ some incredible factors. if an American
uses a European standard HE100 element in his calculations he has first
to recalculate all inertia values. This will lead to greater error
possibilities.
>
>> In general the use of dimensioning system ( f.i. cgs -cm gram second)
>> is different for different countries and application area's. Some
>> factors used within calculations are even dependant in the
>> dimensioning system.
>> It would be a good idea if a package was developed that can solve all
>> these problems for instance by doing the calculations in one of the
>> possible dimensioning systems automagically presenting the results in
>> the dimension you choose.
>
> If calculations are involved, they are performed in SI, because
> otherwise you need factors in all formulae. And SI means no mm, but m,
> no km/h, but m/s etc.
Sorry but It should perhaps be so but it is not. Programs made primarily
for Aircraft engineering (f.i. CATIA 5/6) do use mm and your velocity
clock in your car shows km/h and it registers the distance in km (in
England and the USA mph and miles) In aircraft the Speed is often still
measured in Knots (Nautical miles per hour). Maybe French aircraft will
possibly show km/h. It is to hazardous to change this
>
>
>> Such a system must exist of a record for every value, that exist of
>> at least real values for the standard dimensioning system and the
>> value in the dimensioning system you want, the factor between the two
>> systems and the string containing the dimension, perhaps even more.
>> There should be functions for "+", "-", "*", "/" and sqrt.
>
> http://www.dmitry-kazakov.de/ada/units.htm
>
next prev parent reply other threads:[~2021-09-06 13:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-05 6:56 Trivial question: how to avoid confusing sec, min, hour and day in a program? reinert
2021-09-05 7:27 ` Dmitry A. Kazakov
2021-09-05 12:42 ` Niklas Holsti
2021-09-06 7:20 ` ldries46
2021-09-06 9:47 ` Dmitry A. Kazakov
2021-09-06 13:06 ` ldries46 [this message]
2021-09-06 13:43 ` J-P. Rosen
2021-09-06 14:13 ` ldries46
2021-09-06 15:10 ` Dennis Lee Bieber
2021-09-06 15:55 ` AdaMagica
2021-09-08 22:00 ` Shark8
2021-10-24 6:52 ` reinert
2021-10-24 7:24 ` J-P. Rosen
2021-10-24 10:39 ` Jeffrey R.Carter
2021-10-24 10:08 ` G.B.
2021-10-24 10:48 ` Simon Wright
2021-10-24 12:09 ` Björn Lundin
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox