comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: SI Units Checked and Unchecked
Date: Sat, 11 Aug 2018 23:01:50 +0200
Date: 2018-08-11T23:01:50+02:00	[thread overview]
Message-ID: <pkniru$1kt4$1@gioia.aioe.org> (raw)
In-Reply-To: 877ekw1xsi.fsf@nightsong.com

On 2018-08-11 21:57, Paul Rubin wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>>>> No language change can make dynamic cases static.
>>> I think the idea is to allow constraints on generic instantiation
>>> precise enough to use them for unit checking.
>> Dynamic is not static.
> 
> Well the idea is to check the constraints statically.

The constraints are not static.

> Obviously in
> cases where values can be introduced at runtime, there must be a way to
> connect them up with units, through protected methods or whatever.
> Once they are in the system, the types track them.

Tracking is a run-time action. If you know units statically you don't 
need to track them. In most cases as a value propagates the system it 
crosses barriers when one or another side does not know the unit. 
Reading a measurement value is only the first such barrier.

> I don't understand why there is even a desire in a scientific-style
> program to track quantities in more than one dimensionally equivalent
> unit (e.g. liters vs gallons).

Because it is a requirement. When designing an automation and control 
system, you have an HMI, which must show gallons because the operator 
wants to see gallons. The fuel flow measurement system may use liters 
per hour. The network protocol to transport measurement data will use a 
SI unit etc. No installation I ever saw used strictly SI units. Even in 
Europe temperature is reported in Celsius degree, speed is in km/s, 
inclination is in crazy percents of tangent. Who ever used ks instead of 
hour?

> Just convert everything to a uniform set
> of units (probably SI) when they come into the system, and then do all
> internal calculations with that unit set.

What calculations you mean? The calculations used in the controlling 
loop is well under 5% of all code and this is the only part that could 
have statically known units. Even that is not fully true because things 
like restbus simulation, computable user-defined channels do not have 
statically known units. Any other calculations used in logging, 
databases, interfacing the ERP, reporting, health monitoring, 
plausibility checking and hell knows other components deal with dynamic 
units. And all the non-calculating rest is dynamic too.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2018-08-11 21:01 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09 12:44 SI Units Checked and Unchecked AdaMagica
2018-08-09 13:47 ` Dan'l Miller
2018-08-09 14:07   ` Dmitry A. Kazakov
2018-08-09 15:03     ` Dan'l Miller
2018-08-09 15:51       ` Dmitry A. Kazakov
2018-08-09 17:32         ` Dan'l Miller
2018-08-09 19:42           ` Dmitry A. Kazakov
2018-08-09 22:12             ` Dan'l Miller
2018-08-10  6:45               ` Dmitry A. Kazakov
2018-08-10 13:59                 ` Dan'l Miller
2018-08-10 14:50                   ` Dmitry A. Kazakov
2018-08-10 17:04                     ` Dan'l Miller
2018-08-10 17:34                       ` Dmitry A. Kazakov
2018-08-11  4:42                         ` Paul Rubin
2018-08-11  5:46                           ` Dmitry A. Kazakov
2018-08-11 19:57                             ` Paul Rubin
2018-08-11 21:01                               ` Dmitry A. Kazakov [this message]
2018-08-09 18:47       ` Paul Rubin
2018-08-09 19:13         ` Dan'l Miller
2018-08-09 14:31   ` AdaMagica
2018-08-09 15:19     ` Dan'l Miller
2018-08-09 16:07 ` Jeffrey R. Carter
2018-08-09 17:41   ` AdaMagica
2018-08-09 20:34     ` Jeffrey R. Carter
2018-08-10  9:13       ` AdaMagica
2018-08-10 20:20         ` Jeffrey R. Carter
2018-08-13  8:57           ` AdaMagica
2018-08-20 17:55             ` AdaMagica
2019-09-04 14:20 ` Shark8
2019-09-04 17:11   ` AdaMagica
2019-09-06 21:01     ` Shark8
2020-08-13 12:24       ` SI Units Checked and Unchecked - Completela overhauled version AdaMagica
  -- strict thread matches above, loose matches on Subject: below --
2003-02-05  7:03 SI Units Checked and Unchecked Grein, Christoph
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox