All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Spinler <mspinler@linux.ibm.com>
To: Vijay Khemka <vijaykhemkalinux@gmail.com>
Cc: OpenBMC Maillist <openbmc@lists.ozlabs.org>
Subject: Re: hardcoded median function in phosphor-virtual-sensor
Date: Mon, 4 Jan 2021 16:57:51 -0600	[thread overview]
Message-ID: <c4ced4dd-0b20-9c22-6dfe-99b22e51d0ab@linux.ibm.com> (raw)
In-Reply-To: <CAJTGxZG36whmooeOvMcwkhj5aQtvr=s8QFCGXYNSX6Up6WMJhg@mail.gmail.com>



On 1/4/2021 2:54 PM, Vijay Khemka wrote:
> On Mon, Jan 4, 2021 at 9:49 AM Matt Spinler ...
> This Message Is From an External Sender
> This message came from outside your organization.
>
>
>
> On Mon, Jan 4, 2021 at 9:49 AM Matt Spinler <mspinler@linux.ibm.com 
> <mailto:mspinler@linux.ibm.com>> wrote:
>
>     Hi,
>
>     Just putting on the list what was decided after some lengthy
>     discussions
>     on discord.
>
>     I need a median of some sensor values, where this median sensor has
>     threshold interfaces
>     whose values must be defined in entity-manager.  Since exprtk
>     expressions are not allowed in
>     entity-manager, I cannot just port the PVS's JSON config into an
>     entity-manager config.
>
> I missed this discussion but why can't we simply use virtual sensor as
> expertk provides median function and we have threshold support for
> each virtual sensor. Please help, if I am missing anything.

If you're asking why can't we just have PVS get its exprtk expression to
use from entity-manager, and encode the median there, it's because Ed
doesn't want exprtk in entity-manager config files (I'll defer to him on 
the reasons).

If you're asking now that the median function is hardcoded, why write it in
C++ instead of exprtk, it's because the exprtk code would be so similar to
C++ code (skip the bad values, put the sensors in a vector,  call 
nth_element)
that writing it in exprtk doesn't really buy us anything, and using C++ lets
me skip making the symbol table.

>     Instead, I will make a new entity-manager config that will have the
>     component sensors
>     along  with the thresholds to use, with a subtype of median, vaguely
>     something like:
>
>     {
>
>     Type: "VirtualSensor"
>
>     Name: "MySensorName"
>
>     Subtype: "Median"
>
>     Sensors: [ "Sensor1", "Sensor2", .... ]
>
>     ThresholdsWithHysteresis [ ]
>
>     minInput: 0
>
>     maxInput: 100
>
>     }
>
>
>     The minInput/maxInput are needed so we don't use garbage sensor
>     readings
>     in the median
>     algorithm.  PVS will look for this config to be provided on D-Bus by
>     entity-manager, and if
>     it's there it will calculate the median (in C++, not exprtk) and
>     use it
>     as the virtual sensor value.
>
>     Thanks,
>     Matt
>


  reply	other threads:[~2021-01-04 22:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 17:48 hardcoded median function in phosphor-virtual-sensor Matt Spinler
2021-01-04 20:54 ` Vijay Khemka
2021-01-04 22:57   ` Matt Spinler [this message]
2021-01-05  2:34     ` Lei Yu
2021-01-05 14:18       ` Matt Spinler
2021-01-05 14:27     ` Patrick Williams
2021-01-05 15:56       ` Matt Spinler
2021-01-05 17:18         ` Vijay Khemka
2021-01-05 17:28           ` Matt Spinler
2021-01-05 17:38         ` Ed Tanous
2021-01-05 20:23           ` Patrick Williams
2021-01-05 20:20         ` Patrick Williams
2021-01-05 17:31   ` Ed Tanous
2021-01-05 17:30 ` Ed Tanous

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4ced4dd-0b20-9c22-6dfe-99b22e51d0ab@linux.ibm.com \
    --to=mspinler@linux.ibm.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=vijaykhemkalinux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.