Example Use Case - 案例

原创
2022/04/16 14:54
阅读数 43

目录:https://my.oschina.net/zgldh/blog/5514606
原文:https://docs.edgexfoundry.org/2.1/walk-through/Ch-WalkthroughUseCase/

Example Use Case 案例

In order to explore EdgeX, its services and APIs and to generally understand how it works, it helps to see EdgeX under the context of a real use case. While you exercise the APIs under a hypothetical situation in order to demonstrate how EdgeX works, the use case is very much a valid example of how EdgeX can be used to collect data from devices and actuate control of the sensed environment it monitors. People (and animal) counting camera technology as highlighted in this walk through does exist and has been connected to EdgeX before.
为了探索 EdgeX 的各项服务和API,并大致了解其工作原理,有必要在一个实际应用中对 EdgeX 进行观察。从一个假象环境案例中练习API的使用,来模拟 EdgeX 的工作,这种案例对学习 EdgeX 如何收集数据、如何执行其监控的环境的驱动命令很有用处。本案例中提到的计数摄像机在市面上的确存在,并且之前已经成功接入过 EdgeX。

Object Counting Camera 物体计数摄像机

Suppose you had a new device that you wanted to connect to EdgeX. The device was a camera that took a picture and then had an on-board chip that analyzed the picture and reported the number of humans and canines (dogs) it saw.
假设你有一个新的设比想要接入 EdgeX。该设备是一个摄像机,把拍摄的图片通过板载芯片进行分析,来得知它看到的人和狗的数量。

How often the camera takes a picture and reports its findings can be configured. In fact, the camera device could be sent two actuation commands - that is sent two requests for which it must respond and do something. You could send a request to set its time, in seconds, between picture snapshots (and then calculating the number of humans and dogs it finds in that resulting image). You could also request it to set the scan depth, in feet, of the camera - that is set how far out the camera looks. The farther out it looks, the less accurate the count of humans and dogs becomes, so this is something the manufacturer wants to allow the user to set based on use case needs.
摄像机每隔多久拍一张图片进行处理是可以配置的,实际上摄像机可以接受两个驱动命令——摄像机必须执行且返回响应的两个命令请求。你可以发送一个请求来配置每隔几秒拍一张图片(然后计算图片上人和狗的数量)。你也可以发送一个请求来配置摄像机的扫描深度有多少米——即该摄像机能看多远。摄像机看得越远,统计人和狗的数量的能力越不精确,所以生产厂家希望让用户根据实际需求来配置。

EdgeX Device Representation 如何表示设备

In EdgeX, the camera must be represented by a Device. Each Device is managed by a device service. The device service communicates with the underlying hardware - in this case the camera - in the protocol of choice for that Device. The device service collects the data from the devices it manages and passes that data into the rest of EdgeX.
在 EdgeX 中,摄像机被表示为一个设备。每个设备由设备服务进行管理。设备服务和底层硬件——本案例中指的是摄像机——按照其约定的协议进行数据通信。设备服务会收集旗下设备发出的数据然后传递给 EdgeX 其他服务中。

EdgeX 2.0
As of the Ireland release, a device service will, by default, publish data into a message bus which can be subscribed to by core data and/or application services. You'll learn more about these later in this walkthrough. Alternately, a device service can send data directly to core data.
在 Ireland 发布版中,一个设备服务会默认的将数据发布到一个数据总线中。该数据总线可以被核心数据服务和应用服务订阅分别或同时订阅。稍后你将学到更多关于数据总线的事情。设备服务也可以不通过总线,直接向核心数据服务发送数据。

In this case, the device service would be collecting the count of humans and dogs that the camera sees. The device service also serves to translate the request for actuation from EdgeX and the rest of the world into protocol requests that the physical device would understand. So in this example, the device service would take requests to set the duration between snapshots and to set the scan depth and translate those requests into protocol commands that the camera understood.
在本案例中,设备服务将会收集摄像机看到的人和狗的数量。设备服务也会将 EdgeX 或外部世界发出的命令,根据协议翻译成该物理设备能理解的请求。所以在这个例子中,设备服务会接受请求来设置拍摄图片的间隔时间和扫描深度,并将这些请求根据协议转换为相机可以理解的命令。

Exactly how this camera physically connects to the host machine running EdgeX and how the device service works under the covers to communicate with the camera Device is immaterial for the point of this demonstration.
摄像机和EdgeX主机的具体的物理链接方式、数据是如何在两者之间通信的原理对于本演示来说并不重要。

上一篇:Setup up your environment - 环境配置
下一篇:Defining your device - 定义设备

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
返回顶部
顶部