概念

From Senfi Docs
Revision as of 14:07, 17 October 2019 by Huiyan (talk | contribs) (Created page with "=== 传感器 === 与Prometheus或InfluxDB之类,仅处理时间序列中的时间数据的应用程序不同,Senfi将此类数据与现实世界中的真实物件相关...")
Jump to: navigation, search

此页面概述了Senfi概念。

测量,参数,标签

测量

Senfi处理时间序列中的数据。此时间序列中的每个记录包括:

  • 指示何时采样数据的时间戳(以毫秒为单位)
  • 一组固定的标签
  • 一组固定的参数

所有这些记录都保存在称为测量的数据集中。

参数

参数指的是离散的读数或数据单位。它可以由传感器,设备或复杂的系统诞生/测量。参数的一个示例是温度(例如37度)。参数不一定要有关联的单位(例如摄氏度)。

标签

标签是样本的属性。标签通常被用作标识参数从何处获取的方法(例如,设备ID)。这对于标记正在发送的数据也很有用,以便稍后对数据执行操作,例如过滤。

案例

假设您家里有一个智能秤。表示设备时间序列数据的一种可能方法如下:

测量
智能秤
测量码
iot_weighingscale_v1
数据
tm_source weight_kg
xxxxxxxxxxxxx 70.1
xxxxxxxxxxxxx 70.4
xxxxxxxxxxxxx 69.4

tm_source 表示何时读取读数。在这情况下,weight_kg是在每次获取重量读数所发送的参数

如果有另一个人在使用同一个秤,那该怎么分辨读数?区分读数的一种方法是添加一个称为person的附加字段或标签

tm_source person weight_kg
xxxxxxxxxxxxx Sam 70.1
xxxxxxxxxxxxx Susan 55.2
xxxxxxxxxxxxx Sam 70.4

如果屋内再添加了多个秤,那该如何分辨读数?我们可以通过添加另一个标签来区分读数:

tm_source room person weight_kg
xxxxxxxxxxxxx bathroom Sam 70.1
xxxxxxxxxxxxx kitchen Susan 55.2
xxxxxxxxxxxxx kitchen Sam 70.4

由此一来,我们最终得到的测量具有两个标签(room, person)和一个参数(weight_kg)。

一个更完整的示例如下:

tm_source site_id room person weight_kg bodyfat battery_level
xxxxxxxxxxxxx 1547 bathroom Sam 70.1 19.1 99
xxxxxxxxxxxxx 1547 kitchen Susan 55.2 15.3 54
xxxxxxxxxxxxx 1547 kitchen Sam 70.4 19.2 49

公认该示例是人为设计的,但它展示了数据是如何在Senfi中建模的。

注意: site_id 是必填标签,并将在下面的站点章节进行说明

传感器

与Prometheus或InfluxDB之类,仅处理时间序列中的时间数据的应用程序不同,Senfi将此类数据与现实世界中的真实物件相关联。

A sensor in Senfi represents a physical object/system of interest. A sensor may produce one or more measurements, or it may not produce any measurements. There are 3 types of sensors in Senfi:

Managed sensors
Sensors that produces at least one measurement
Specialized sensors
Sensors with special behaviour, eg. lift controller
Unmanaged sensors
Sensors that does not produce measurement

Site

A site represents a place whereby sensors are physically located. A site usually comprise of one or more buildings. A site in Senfi has a geographical location and usually a 3D representation. Users may choose to use the CMS to trace out the building outline and generate a quick 3D building, or they can also upload a 3D building modelled using modelling software such as Autodesk 3DS Max, SketchUp etc.

Sample building generated from building outline
Sample building modelled using 3D software

site_id is a unique integer associated with a particular site. It is used as a tag when sending measurements to Senfi, so that Senfi can tell which site the incoming measurement is meant for.

Rule, Alert

In an operating environment such as a smart building, it is important that organizations are able to keep track and be aware of what is going on in and around their assets. The way to do that is through monitoring and alerting.

Sensors produce measurements which contain data in the form of metrics and tags. Senfi provides multiple ways for users to monitor metric and tag values for conditions which require attention - such as abnormally high values, or when a combination of values indicates something is down - and to take action when it happens.

Rule

User can make use of Senfi's flexible rule engine to be alerted of abnormality in the system they are monitoring.

A rule in Senfi comprises of:

  • Inputs
  • Conditions
  • Output
  • Actions
  • Rule execution options

Example

Using our Smart Weighing Scale measurement from earlier, we can form one simple rule as follows:

  • Input: iot_weighingscale_v1.battery_level
  • Condition: < 20
  • Action: Email reminder to replace battery
  • Rule execution option: Immediately (means evaluate this rule whenever there is any incoming measurement)

Computed measurement

Frequently, incoming metrics represent raw values that are read from the sensing device (eg. door open status, door closed status). To be able to derive better insights and to formulate more complex rules, it is useful to be able to calculate new metrics that are derived from the raw metrics. We refer to these metrics as derived metrics. The set of derived metrics and associated tags form the computed measurement.

Similar to measurement, a computed measurement comprises of:

  • timestamp
  • tags
  • metrics (derived)

Following from the above example, a computed measurement could compute the duration that a door remains opened by taking the timestamp between a door open and door closed metric.

Organization, User, Access Group

An organization represents the entity (eg. company, individual) that is responsible for managing the account that uses Senfi. An organization comprises at least one user with Administrator role. Users with Administrator role are able to manage other users, including user account creation/deletion, user roles etc.

Think of access group as a subset of the assets under the organization. Users can be placed into access groups to have access to those assets. Currently assets that can be assigned to an access group are:

  • user
  • site
  • rule

Next: Getting Started