Re: [T2TRG] [Asdf] [One Data Model Group] Representation issues and protocol bindings

David Kemp <dk190a@gmail.com> Tue, 01 September 2020 13:33 UTC

Return-Path: <dk190a@gmail.com>
X-Original-To: t2trg@ietfa.amsl.com
Delivered-To: t2trg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 09E623A0814 for <t2trg@ietfa.amsl.com>; Tue, 1 Sep 2020 06:33:34 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.097
X-Spam-Level:
X-Spam-Status: No, score=-2.097 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8HvPkPKe92Mv for <t2trg@ietfa.amsl.com>; Tue, 1 Sep 2020 06:33:32 -0700 (PDT)
Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2ECD33A0854 for <t2trg@irtf.org>; Tue, 1 Sep 2020 06:33:28 -0700 (PDT)
Received: by mail-ot1-x329.google.com with SMTP id y5so1157450otg.5 for <t2trg@irtf.org>; Tue, 01 Sep 2020 06:33:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=kzYNl6pcc1dTXJjeW+/XbFvh/yJK6OmS3fly/vLLR1w=; b=MUFdnt1OLjqOBBGWaTV7Zj1qCGlce5r256wtuXC7k44Zl98aqYfDubDBuT3F318Hyz 67H/ipwye0eD1mzp4MJUbCmfME1C71w/sTU1eG2DjOKjZbLBrowPNfqGKLKb+3VNtSvw PNFXyadZ1uli/BuxSfAO8tbUiyZ+whp/ICGoOuEtWSHnT6idlNZMPiiLyO7HQPXVtgf0 c2+9RJGDpsGBsXoXuHkQmwW+PcILaUBmI2bI3h2a9FT6IF8yNXzVSC74ZZB4fK5pixrc 1P8c3sHwhU20WRlv1ugIkoQqNtohYew3fyIOBHAgOcs9in8O3me7nwm3CGvJbK1dXvqv Ge6A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=kzYNl6pcc1dTXJjeW+/XbFvh/yJK6OmS3fly/vLLR1w=; b=uNARSpgDKfS3isDZc2SG7sXQSncdwbN16DDjqNKqkQnADE7JburxjMhxCUStMHum1R C8+LnmcWsgtY3dl5FqzHAFqq9i1U3J1/JUvTq0gBUxrYV4kt8axxykCrpwokeKNz73+X Z/R9FP+TfJxMlZ1qJW/Q65IdPWkikPn5zAZ3sK4gGF0DxkvtyZZhVn7BcAiLrB8zQCQc 5HOqVrSi9gfL2QRipT9mVaqB3dvjjvr1jccUDi6SxW3nzJ79SJcs8Bvh1FA1vfDa8iWi VZu5wPUpXMABGZedk3Ag3SOs6d0mKASReF534/VqOt3QWY4CMomKKO3cWodP+snTu4zQ vrow==
X-Gm-Message-State: AOAM532UYtZinBCda7xIm7IFkqY3kAQyhFlYVxuapQad/lifyB3m7Plo VIZep9GIZqCYGlwhYwFfDPBaTgRy7wtAjcPAu1LlL8fYigje1A==
X-Google-Smtp-Source: ABdhPJwEl9Iu6jlfowpCROd/yBdOcg3rLfS1DHK3h0aDNdtEXDbG3naoRvedZl+zwS25//TmA5oL1pDCANJe/waA6QQ=
X-Received: by 2002:a9d:185:: with SMTP id e5mr1449680ote.135.1598967207411; Tue, 01 Sep 2020 06:33:27 -0700 (PDT)
MIME-Version: 1.0
References: <2ED86F4F-2926-4FBB-91A7-39F32FE7A970@tzi.org> <MWHPR11MB1838A7BB2F9D868DBF59B962D2510@MWHPR11MB1838.namprd11.prod.outlook.com> <BYAPR18MB2536E401A07C0F5DFF3376B6CE510@BYAPR18MB2536.namprd18.prod.outlook.com> <CAE5tNmoYSNPjndwo12O+RE+BdYG2bpadM1L6fAb+KKgairxkcw@mail.gmail.com> <A4218763-14BE-44DF-BB13-C248911CE84C@tzi.org>
In-Reply-To: <A4218763-14BE-44DF-BB13-C248911CE84C@tzi.org>
From: David Kemp <dk190a@gmail.com>
Date: Tue, 01 Sep 2020 09:33:15 -0400
Message-ID: <CAE5tNmqJ=h2WvBf9Y8Z91as18_mtgO1crQG7S2+dgnigUSURbQ@mail.gmail.com>
To: One Data Model Group <onedm@iotliaison.org>, "t2trg@irtf.org" <t2trg@irtf.org>, "asdf@ietf.org" <asdf@ietf.org>
Content-Type: multipart/alternative; boundary="00000000000067c43105ae4090bc"
Archived-At: <https://mailarchive.ietf.org/arch/msg/t2trg/giWe1-Td-aIaz2ZiLc3TERwNz28>
Subject: Re: [T2TRG] [Asdf] [One Data Model Group] Representation issues and protocol bindings
X-BeenThere: t2trg@irtf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: IRTF Thing-to-Thing Research Group <t2trg.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/t2trg>, <mailto:t2trg-request@irtf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/t2trg/>
List-Post: <mailto:t2trg@irtf.org>
List-Help: <mailto:t2trg-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/t2trg>, <mailto:t2trg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Tue, 01 Sep 2020 13:33:34 -0000

On Mon, Aug 31, 2020 at 4:19 PM Carsten Bormann <cabo@tzi.org> wrote:

> I think it is already relatively easy to find the right level of
> abstraction for information that can be expressed in SI units.
> (Units can be specified in SDF 1.0.)
>
> SenML (RFC 8428) got that right, so I think we can follow that example in
> SDF.
> We did have to make a little bit of a compromise (adding scaling prefixes
> in RFC 8798) in areas where the natural units are habitually scaled (there
> aren’t many electricity meters indicating J — it’s always kWh), but even
> here it should be easy to agree on a natural unit between domain experts.
>

 SenML's primary units and secondary (scaled) units did get that right,
with nomenclature and values that make sense to subject matter experts:

{"u":"%RH", "v":20},

{"u":"lon", "v":24.30621},

{"u":"lat", "v":60.07965},

{"n":"temperature","u":"Cel","v":25.2},

{"n":"EGT", "u":"Fahr", "v":1374}


(I made the last one up - the U.S. should have gone metric back in the
1970's, but it didn't.  In this backward part of the world subject
matter experts

might appreciate a familiar secondary unit of temperature.  "F" was
already taken for farad, so ...)


But the problem remains how the ecosystem specifications can relate to the
> converged model if that had to abstract some more.  And that’s where the
> binding comes in.  To make ecosystem experts feel at home, we probably need
> to make this rather accessible.

For information that is a ratio to a reference value (e.g., a lamp an
> undefined metric of which can be set to a value between 0 to 100 %), SenML
> has “/”  (the dimensionless unit).  So we would normally not use
> percentages (or permille, or ppm, …), but a number that is typically
> clamped between 0 and 1.  Of course, most ecosystems will scale this to get
> an integer representation, and that is probably the largest source of
> variation (*).
>

Are there separate problems to be solved?
1) Devices that could but for some reason don't send/receive data in
meaningful units (e.g., uint8 values from 0 .. 255 or 0..100) instead of 38
%RH?
2) Devices for which it is impossible to use absolute units (3.7 volts on a
10v dimmer circuit -> uint8 37 on a scale of 0-100 -> 0,37 dimensionless ->
some level of room illumination that architects and occupational health
people need to measure but consumers don't care about and the controller
can't know)
3) Devices for which meaningful units haven't been defined?


> Also, RFC 8798 is limited to linear scales (scale/offset).  For sound and
> RF power levels we can cheat with dB.  For lighting, the models are more
> complicated (which led to gamma and all that).  If different ecosystems use
> different models here, there may be no straightforward way to do the
> conversions.  So we have to be prepared to express these anyway.
>

A parametric model might be useful for problems 1 and 2.  Linear scales
define min and max values for data (transmitted bits) and information
(subject-meaningful values):

-128  ->  -40.0 Cel
 127 -> 300.0 Cel

or

  0 -> -40.0 Cel
65,536 -> 300.0 Cel

But for SDF that could be generalized to allow calibration points, the way
gradients in an image editor specify at least start and end colors, but may
also add intermediate values.  The domain of the transfer function is
scalar and integer or real, but the range is always real and could be
non-linear and multi-dimensional:

0 -> (0.4, 0.8, 0.25)           min domain value
25 -> (0.5, 0.8, 0.9)           intermediate control point(s)
100 -> (0.0, 0.0, 0.1)         max domain value

After doing linear interpolation to get the range values between control
points, an output function selected from a list could be applied.  The
initial list of output functions might be quite small - I can't think of
any good examples other than linear and log:

1: linear: y = x
2: exponential: y = e^x

The parametric model of a mapping table followed by an optional output
curve might cover 95% of use cases instead of 80%.  Is it simple enough for
an SDF description?

Regards,
Dave