Smart Pump Station Solution

Content

  • Introduction

  • Setup Advantech EdgeX software package

  • Install Required Software

  • Deploy

  • Setup the Rule Engine

  • Setup the Alert & Notification

  • Setup the WISE-PaaS APP Service

  • Setup the Video AI Service

Introduction

WISE-PaaS M2I/Pump Unite is cloud –based smart pump station solution. It leverages EdgeX for edge solution. EdgeX provides:

  • Pump data collection

  • Automatic pump control when water level is low

  • Person intrusion alarm integration with Intel OpenVINO AI engine

  • Upload pump data and alarm to WISE-PaaS cloud

This solution also won 2021 the EdgeX China Challenge Competition - The First Award.

Setup Advantech EdgeX software package

  1. Uncompressed the software package, the directory tree is like this:

2. Install the required software.

3. Deploy.

Install Required Software

  1. To install the required software. E.g. Docker, curl, mosquitto-clients…, which will take some time.

adv@ubuntu:/usr/local/2021-edgex-china-challenge $ ./preinstall.sh

2. If the original file still exists, then the installer asks you before overwrites it.

Answer ‘y’ then continue.

File '/usr/share/keyrings/docker-archive-keyring.gpg' exists. Overwrite? (y/N)

Deploy

  1. Before the deployment, we may modify the Modbus device service according to physical hardware configuration.

./modbus/configuration.toml

./modbus/WISE-4012.yaml

./modbus/FATEKPLC.yaml

2. Option: To remove all Docker containers on the host.

adv@ubuntu:/usr/local/2021-edgex-china-challenge$ sudo ./stop-dockers.sh ; sudo ./reset-dockers.sh

3. To deploy that will be finished tasks:

  • Start all Edge microservice that including EdgeX, video AI service, SMTP server...

  • Setup the rule engine.

  • Setup the alert & notification.

  • Setup the WISE-PaaS APP service.

  • Setup the video AI service.

adv@ubuntu:/usr/local/2021-edgex-china-challenge$ ./deploy.sh

4. Option: List Docker image ID by command for checking.

adv@ubuntu:/usr/local/2021-edgex-china-challenge$ sudo docker images

Setup the Rule Engine

  1. The default rule definition is as below. Rules #2, #3, and #4 all use a 5-second sliding window.

Item

Rule Name

Event Source

Trigger Threshold

Actions

1

Turn-on Pump Control

Water level

<= 20%

1. Open pump switch

2. Send MQTT topic with debugging:

/edgex/pump_control_on

2

Turn-off Pump Control

Water level

=50%

1. Close pump switch

2. Send MQTT topic with debugging:

/edgex/pump_control_off

3

Person Detection

REST device service

Get intrusion image in base64 format from the REST endpoint

1. Send an email with an intrusion image

2. Send MQTT topic for debugging:

/edgex/person_detection

4

Water Level Alert

Water level

< 20%

1. Send an event to EdgeX message bus: {"device":"Alert","readings":[{"device":"Alert","name":"Message_ID","value":"2"}

2. Send MQTT topic for debugging:

/edgex/water_level_alert

5

Person Detection Alert

Edge AI data

connector

Received specific MQTT message that topic is AnalyticsData

1. Send an event to EdgeX message bus: {"device":"Alert","readings":[{"device":"Alert","name":"Message_ID","value":"1"}

2. Send MQTT topic for debugging:

/edgex/person_detection_alert

2. You can find them through edgex-ui-go. Visit http://127.0.0.1:4000 for more details.

3. You can modify the trigger threshold value of the water level for your case. To edit the ./ruleengine/create_rules.sh file. If any values changed, you should reload the rule engine.

adv@ubuntu:/usr/local/2021-edgex-china-challenge$ ./ruleengine/create_rules.sh

Setup the Alert & Notification

1. When anyone into the area of water pumps, you will get an email that includes intrusion images through the EdgeX alert and notifications device service. For easier and quicker to demo, we built an SMTP server MailHog on port 80 that is open source and supports a Web UI.

2. Visit Web UI on http://127.0.0.1.

3. Option: we have a simulation script for the quick test without video inference. To execute it for testing.

adv@ubuntu:/usr/local/2021-edgex-china-challenge$ ./video-inference/test/send_person_detection_pic1.sh

You should get an email to check the mailbox through Web UI

Setup the WISE-PaaS APP Service

  1. WISE-PaaS APP service collects EdgeX data (including sensor data and alerts) to report to cloud platform: WISE-PaaS data hub.

  2. WISE-PaaS data hub portal: https://portal-datahub-tso-eks010.hz.wise-paas.com.cn/#/

3. The default data connection settings are:

NodeID

45316a9a-014e-49b3-8471-f16ae5922524

AccessKey

64abf2de2910644da62456f0470bealb

APIURL

DeviceNames

WISE-4012, FATEKPLC, Alert

ResourceWritable

FATEKPLC=Pump

4. NodeID, AccessKey, and APIURL are credentials of WISE-PaaS data hub that could find it here.

5. DeviceNames is a comma-separated list of device names for filtering (also known as a whitelist). If it is not empty means only allows the message of the specific device of EdgeX to report.

6. ResourceWritable is a comma-separated list of device/resource names for writable on the data hub. It is formatted as deviceName=resourceName

7. The default settings in below.

DeviceNames

WISE-4012

DeviceNames

FATEKPLC

DeviceNames

Alert

ResourceWritable

FATEKPLC=Pump

Upload frequency

Every 3 seconds. It has been defined in the modbus/configuration.toml

8. If any settings changed, you should reload the WISE-PaaS APP service.

adv@ubuntu:/usr/local/2021-edgex-china-challenge$ ./wise-export/create_wise_datahub_edgex_fuji.sh

Setup the Video AI Service

1. The video AI service (VAS) has two parts: a server, and a client. The server runs in the background, but the client runs in the foreground of the terminal.

2. Check if the server of VAS is running.

adv@ubuntu:/usr/local/2021-edgex-china-challenge$ sudo docker logs -f video-analytics-serving-gstreamer

2. Open the URL in the web browser to test the video: http://127.0.0.1:7880

3. When an intrusion event has triggered, VAS sends an MQTT message and intrusion image to EdgeX.

Then EdgeX rule engine triggers the actuation of the two things.

(1) Trigger rule #2: EdgeX alert & notification microservice sends an Email to the SMTP server.

(2) Trigger rule #4: Generate an EdgeX event to message bus. WISE-PaaS APP service sends the event (Message_ID=1) to the data hub.

4. Press Ctrl+C to cancel the client of VAS in progress if quit.

Last updated