CN109683494B - Internet of things equipment linkage control system - Google Patents

Internet of things equipment linkage control system Download PDF

Info

Publication number
CN109683494B
CN109683494B CN201811460143.5A CN201811460143A CN109683494B CN 109683494 B CN109683494 B CN 109683494B CN 201811460143 A CN201811460143 A CN 201811460143A CN 109683494 B CN109683494 B CN 109683494B
Authority
CN
China
Prior art keywords
module
condition
rule
data
conditions
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811460143.5A
Other languages
Chinese (zh)
Other versions
CN109683494A (en
Inventor
向逸尘
吕丹
武琼
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Wuling Shengtong Information Technology Co ltd
Original Assignee
Shanghai Wuling Shengtong Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Wuling Shengtong Information Technology Co ltd filed Critical Shanghai Wuling Shengtong Information Technology Co ltd
Priority to CN201811460143.5A priority Critical patent/CN109683494B/en
Publication of CN109683494A publication Critical patent/CN109683494A/en
Application granted granted Critical
Publication of CN109683494B publication Critical patent/CN109683494B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention provides a linkage control system of Internet of things equipment, which comprises: a WEB configuration module and a linkage service module; and the linkage service module utilizes the data stored in the database by the WEB configuration module to carry out rule screening, and completes the action of the equipment needing to be operated. The invention can link various Internet of things devices, including but not limited to a single lamp, a charging pile, wifi, a camera, emergency help, well lid monitoring, broadcasting, parking space monitoring and an LED large screen. Wherein, the single lamp, fill electric pile, wifi, promptly seek help, parking stall control, well lid control can be as trigger condition, and single lamp, camera, broadcast and large-size screen can be triggered and carry out the operation. The invention realizes complete user personalized configuration, all trigger conditions and trigger actions are configuration items, and the Internet of things equipment in the smart city is organically combined.

Description

物联网设备联动控制系统IoT device linkage control system

技术领域technical field

本发明涉及智慧城市,物联网领域,具体地,涉及物联网设备联动控制系统。The invention relates to the field of smart cities and the Internet of Things, and in particular, to a linkage control system for Internet of Things equipment.

背景技术Background technique

现有技术文献“节水灌溉联动控制系统”载于《农业工程学报》2011年第8期,其为了节约农田灌溉用水,提高水资源利用效率,实现自动灌溉控制,该文采用自主设计的灌溉控制设备和墒情监测设备,通过GSM网络传输数据,设计了一套集墒情监测、灌溉控制和专家决策支持的节水灌溉联动控制系统。该系统由就地控制柜、数据采集系统和自动控制软件三部分组成,实现了土壤墒情实时监测、专家知识管理及根据不同作物、不同生育期需水参数等进行自动灌溉控制等功能。在示范区的应用证明,该系统稳定可靠、操作方便、可广泛应用于规模化种植、温室大棚、精细农业等领域,对节水农业的实施具有重要的现实意义。但是灌溉系统只是土壤监测和灌溉设备之间的联动。The prior art document "Water-Saving Irrigation Linkage Control System" was published in "Chinese Journal of Agricultural Engineering", No. 8, 2011. In order to save farmland irrigation water, improve water resources utilization efficiency, and realize automatic irrigation control, this paper adopts self-designed irrigation system. Control equipment and moisture monitoring equipment transmit data through GSM network, and design a set of water-saving irrigation linkage control system integrating moisture monitoring, irrigation control and expert decision support. The system consists of three parts: local control cabinet, data acquisition system and automatic control software. It realizes the functions of real-time monitoring of soil moisture, expert knowledge management, and automatic irrigation control according to different crops and water demand parameters in different growth periods. The application in the demonstration area proves that the system is stable and reliable, easy to operate, and can be widely used in large-scale planting, greenhouses, precision agriculture and other fields, and has important practical significance for the implementation of water-saving agriculture. But the irrigation system is just a linkage between soil monitoring and irrigation equipment.

现有技术文献“浅谈照明控制及智能照明控制系统”载于《低压电器》2008年第6期,其简要介绍了照明控制的基本原则、主要实现方式,以及不同场合对照明控制的基本要求。重点对智能照明控制系统实现的主要功能进行了阐述,同时给出了智能照明控制系统的应用案例。从设计、安装以及使用等几方面介绍了DALI智能照明控制系统的优越性。但是该文献只是通过固定的DALI系统来控制照明实现了光照度传感器与灯具的联动,然而灯杆这种城市资源应该成为智慧城市的一部分,而不简简单单是照明这么简单,因此其不能适用于尤其是可以采用光照度等多种设备之间的联动进行开关灯、亮度调节的智慧型控制。The prior art document "On Lighting Control and Intelligent Lighting Control System" is published in "Low Voltage Electrical Appliances", Issue 6, 2008, which briefly introduces the basic principles of lighting control, the main implementation methods, and the basic requirements for lighting control in different occasions . The main functions realized by the intelligent lighting control system are expounded, and the application cases of the intelligent lighting control system are given. The advantages of DALI intelligent lighting control system are introduced from the aspects of design, installation and use. However, this document only controls the lighting through a fixed DALI system to realize the linkage between the illuminance sensor and the lamps. However, the urban resource such as light poles should become part of the smart city, not as simple as lighting, so it cannot be applied to In particular, the linkage between various devices such as illuminance can be used for intelligent control of switching lights and brightness adjustment.

发明内容SUMMARY OF THE INVENTION

针对现有技术中的缺陷,本发明的目的是提供一种物联网设备联动控制系统。Aiming at the defects in the prior art, the purpose of the present invention is to provide a linkage control system for IoT devices.

根据本发明提供的一种物联网设备联动控制系统,包括:WEB配置模块、联动服务模块;A linkage control system for IoT devices provided according to the present invention includes: a WEB configuration module and a linkage service module;

联动服务模块利用WEB配置模块存储到数据库中的数据进行规则的筛选,完成设备需要操作的动作。The linkage service module uses the data stored in the database by the WEB configuration module to filter the rules and complete the actions that the device needs to operate.

优选地,所述WEB配置模块包括Web模块;Preferably, the WEB configuration module includes a Web module;

新建条件模块:配置触发条件,New Condition Module: Configure trigger conditions,

新建操作模块:配置触发操作;New operation module: configure trigger operation;

规则生成模块:根据所述触发条件、触发操作,生成规则,其中,所述规则包括优先级、被触发后执行操作、被触发后执行操作的时间;Rule generation module: according to the trigger condition and trigger operation, generate a rule, wherein the rule includes a priority, an operation performed after being triggered, and the time of performing an operation after being triggered;

其中,所述触发条件包括如下信息:Wherein, the trigger condition includes the following information:

Figure BDA0001888480040000021
Figure BDA0001888480040000021

其中,所述被触发后执行操作包括如下信息:The operation performed after being triggered includes the following information:

Figure BDA0001888480040000022
Figure BDA0001888480040000022

优选地,组件类型的触发配置为:Preferably, the trigger configuration of the component type is:

Figure BDA0001888480040000023
Figure BDA0001888480040000023

Figure BDA0001888480040000031
Figure BDA0001888480040000031

优选地,所述联动服务模块包括如下模块:Preferably, the linkage service module includes the following modules:

数据接收模块:对于硬件设备发过来的消息,通过RocketMQ进行处理,在接收到RocketMQ的消息以后,对其中Json格式的数据进行解析,将解析到的数据传给条件筛选模块进行逻辑处理;Data receiving module: For the message sent by the hardware device, it is processed through RocketMQ. After receiving the message from RocketMQ, it parses the data in Json format, and transmits the parsed data to the conditional filtering module for logical processing;

条件筛选模块:根据不同的类型的设备进行不同的逻辑处理,得到规则ID,设备的类型包括单灯、充电桩、AP、紧急求助、停车位监控、井盖监控、LED广告屏;Condition screening module: perform different logic processing according to different types of equipment to obtain rule IDs. The types of equipment include single lamp, charging pile, AP, emergency assistance, parking space monitoring, manhole cover monitoring, and LED advertising screen;

动作筛选模块:根据规则ID,对规则中的动作进行优先级的判断,得到需要操作的动作;Action screening module: According to the rule ID, the priority of the actions in the rules is judged, and the actions that need to be operated are obtained;

执行动作模块:将需要操作的动作包装为相应的数据格式,发送给RocketMQ,经过RocketMQ通过网关发送给各个设备进行相应的动作;Execution action module: package the action that needs to be operated into the corresponding data format, send it to RocketMQ, and send it to each device through RocketMQ through the gateway to perform the corresponding action;

其中,所述逻辑处理流程如下:Wherein, the logic processing flow is as follows:

第一步:根据数据接收模块传过来的数据判断是哪种设备传过来的数据,然后找相应的逻辑进行处理;Step 1: According to the data sent by the data receiving module, determine which device is sending the data, and then find the corresponding logic for processing;

第二步:去Redis的数据库db中判断是否有这个设备的编码作为条件key的列表list,如果存在则进行第三步,不存在则结束逻辑处理流程;Step 2: Go to the Redis database db to determine whether the code of this device is used as a list of condition keys. If it exists, go to the third step. If it does not exist, end the logic processing flow;

第三步:根据第二步中找到的列表list,找到该设备下面所有的条件key,根据条件key找到条件具体的值,循环判断这些条件,对于条件符合的值,记录下该值对应的规则ID,对于条件不符合的值,则不记录该值对应的规则ID;The third step: According to the list found in the second step, find all the condition keys under the device, find the specific values of the conditions according to the condition keys, and judge these conditions in a loop. For the values that meet the conditions, record the rules corresponding to the values. ID, for the value that does not meet the conditions, the rule ID corresponding to the value is not recorded;

第四步:从第三步中得到了一个规则ID的清单List,根据规则ID在Redis中找到这个规则下面所有的条件,判断这些条件是否满足,若全部满足则记录下这个规则ID;Step 4: Obtain a list of rule IDs from the third step, find all the conditions under the rule in Redis according to the rule ID, and judge whether these conditions are satisfied. If all are satisfied, record the rule ID;

第五步:根据第四步获取到一个最终符合条件的规则ID的清单List,传给动作筛选模块进行逻辑处理。Step 5: Obtain a list of rule IDs that finally meet the conditions according to Step 4, and pass it to the action screening module for logical processing.

第六步:在经过条件筛选以后,将符合条件的规则ID传到动作筛选模块进行处理。Step 6: After the conditional screening, pass the rule IDs that meet the conditions to the action screening module for processing.

优选地,采用的Redis存储结构为:Preferably, the adopted Redis storage structure is:

在Redis的db0中存储的是每个条件具体的值,使用的数据结构是hash,hash的子key和value对应mysql数据库中条件表的各个字段和对应的值,父key为CondigCondition加上这个条件在条件表里面的ID组成的字符串,如果ID为1,则父key为CondigCondition1;The specific value of each condition is stored in db0 of Redis. The data structure used is hash. The child key and value of the hash correspond to the fields and corresponding values of the condition table in the mysql database. The parent key is CondigCondition plus this condition. A string composed of IDs in the condition table, if the ID is 1, the parent key is CondigCondition1;

在Redis的db1中存储的是每个规则下面包含哪些条件,使用的数据结构是List;规则下面条件的key为ConfigRule加上规则在mysql规则表里面的ID,List的key的值为这个规则下面所有条件的key;What is stored in db1 of Redis is which conditions are included under each rule, and the data structure used is List; the key of the conditions under the rule is ConfigRule plus the ID of the rule in the mysql rule table, and the value of the key of List is the following rule key for all conditions;

Redis的db3中存储的是所有的条件key,用作遍历使用,条件key使用的数据结构是List;Db3中只有一个key,就是ConfigCoditionList,ConfigCoditionList的值是所有出现在db0中的条件key;All condition keys are stored in db3 of Redis, which is used for traversal. The data structure used by condition keys is List; there is only one key in Db3, which is ConfigCoditionList, and the value of ConfigCoditionList is all the condition keys that appear in db0;

Redis的db4中存储的是所有拥有条件的设备的Code,用作遍历使用,这里使用的存储结构也是List;拥有条件的设备的Code的里面也只有一个key,为EquipmentCodeList;Redis's db4 stores the codes of all devices with conditions, which are used for traversal. The storage structure used here is also List; there is only one key in the Code of devices with conditions, which is EquipmentCodeList;

Redis的db5中存储的是每个设备所拥有的条件,使用的数据结构为List;设备所拥有的条件的key就是该设备的14位编码,这个key的值就是该设备所拥有的条件key;Redis db5 stores the conditions owned by each device, and the data structure used is List; the key of the conditions owned by the device is the 14-bit code of the device, and the value of this key is the condition key owned by the device;

Redis存储键key与不同类型的值value之间的映射mapping,将存储在内存的键值对数据持久化到硬盘,使用复制特性来扩展读性能;其中:O(1)的命令是安全的,O(N)命令在使用时如果N的数量级不可预知,则避免使用;设置fsync函数,每秒执行fsync函数一次;查看固有延迟,在物理机上直接部署Redis。Redis stores the mapping between keys and different types of values, persists the key-value pair data stored in memory to the hard disk, and uses the replication feature to expand the read performance; where: O(1) commands are safe, When the O(N) command is used, if the magnitude of N is unpredictable, avoid using it; set the fsync function and execute the fsync function once per second; check the inherent delay and deploy Redis directly on the physical machine.

优选地,WEB配置模块、联动服务模块两者中,一者出现异常状态不会影响另一者的运行;Preferably, among the WEB configuration module and the linkage service module, an abnormal state of one will not affect the operation of the other;

WEB配置模块用于存储触发条件,触发操作,生成触发规则,并且对触发规则进行管理;WEB配置模块主要分为表现层、业务逻辑层、数据访问层、数据库层,采用SSM框架进行开发,用MySQL进行数据持久化;The WEB configuration module is used to store trigger conditions, trigger operations, generate trigger rules, and manage trigger rules; the WEB configuration module is mainly divided into presentation layer, business logic layer, data access layer, and database layer. MySQL for data persistence;

联动服务模块主要分为逻辑处理层、数据持久层;在逻辑处理层中,设置有数据接收模块、条件筛选模块、动作筛选模块、执行动作模块;The linkage service module is mainly divided into a logic processing layer and a data persistence layer; in the logic processing layer, there are a data receiving module, a condition screening module, an action screening module, and an execution action module;

数据持久层,联动服务模块中选用了Redis数据库和Mysql配合使用的实现方式。For the data persistence layer, the linkage service module adopts the implementation method of Redis database and Mysql.

与现有技术相比,本发明具有如下的有益效果:Compared with the prior art, the present invention has the following beneficial effects:

1、针对多设备,多响应的联动控制进行开发。实时过滤大量设备上报的信息,筛选并触发相应的操作。1. Developed for multi-device, multi-response linkage control. Filter information reported by a large number of devices in real time, filter and trigger corresponding actions.

2、将智慧城市中的各种物联网设备有机联动起来,不拘泥于农业或者消防系统的设备,实现了完全的用户个性化配置,可扩展性极高。2. The various IoT devices in the smart city are organically linked, which is not limited to the equipment of agriculture or fire protection system, and realizes complete user-specific configuration, with high scalability.

3、对智慧灯杆上的摄像头,广播,一键报警,井盖等设备进行联动控制,设置规则后,当某个设备答到一个条件的时候就可以触发另一个设备的动作。可以接入多种设备,扩展性高。3. Perform linkage control on the cameras, broadcasts, one-key alarms, manhole covers and other equipment on the smart light pole. After setting the rules, when a device answers a condition, it can trigger the action of another device. It can be connected to a variety of devices and has high expansibility.

4、展现智慧灯杆当中的“智慧”,每个灯杆上都绑定摄像头,当触发某个报警之后,摄像头将自动转到响应位置。也可能人群过于密集后,广播自动播放警告语音。真正的将智慧灯杆服务于城市。4. Show the "wisdom" in the smart light poles. Each light pole is bound with a camera. When an alarm is triggered, the camera will automatically turn to the response position. It is also possible that the radio will automatically play a warning voice when the crowd is too dense. Really serve the smart light pole to the city.

5、将联动多种物联网设备,包括但不限于单灯、充电桩、wifi、摄像头、紧急求助、井盖监控、广播、停车位监控和LED大屏。其中,单灯、充电桩、wifi、紧急求助、停车位监控、井盖监控可以作为触发条件,单灯、摄像头、广播和大屏可以被触发执行操作。本发明实现了完全的用户个性化配置,所有触发条件和触发动作均为配置项,将智慧城市中的物联网设备有机结合了起来。5. A variety of IoT devices will be linked, including but not limited to single lights, charging piles, wifi, cameras, emergency help, manhole cover monitoring, broadcasting, parking space monitoring and large LED screens. Among them, single light, charging pile, wifi, emergency help, parking space monitoring, manhole cover monitoring can be used as trigger conditions, and single light, camera, broadcast and large screen can be triggered to perform operations. The invention realizes complete user personalized configuration, all trigger conditions and trigger actions are configuration items, and the Internet of Things devices in the smart city are organically combined.

附图说明Description of drawings

通过阅读参照以下附图对非限制性实施例所作的详细描述,本发明的其它特征、目的和优点将会变得更明显:Other features, objects and advantages of the present invention will become more apparent by reading the detailed description of non-limiting embodiments with reference to the following drawings:

图1为系统架构图。Figure 1 is a system architecture diagram.

图2为系统功能图。Figure 2 is a system function diagram.

图3为网络拓扑图。Figure 3 is a network topology diagram.

图4为数据库ER图。Figure 4 is the database ER diagram.

图5为新建条件页面界面截图。Figure 5 is a screenshot of the new condition page interface.

图6为新建操作页面界面截图。Figure 6 is a screenshot of the new operation page interface.

图7为规则管理页面界面截图。Figure 7 is a screenshot of the rule management page interface.

具体实施方式Detailed ways

下面结合具体实施例对本发明进行详细说明。以下实施例将有助于本领域的技术人员进一步理解本发明,但不以任何形式限制本发明。应当指出的是,对本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变化和改进。这些都属于本发明的保护范围。The present invention will be described in detail below with reference to specific embodiments. The following examples will help those skilled in the art to further understand the present invention, but do not limit the present invention in any form. It should be noted that, for those skilled in the art, several changes and improvements can be made without departing from the inventive concept. These all belong to the protection scope of the present invention.

根据本发明提供的一种物联网设备联动控制系统,涉及到的表格如下:According to an IoT device linkage control system provided by the present invention, the related tables are as follows:

表1触发类功能分析表Table 1 Trigger function analysis table

Figure BDA0001888480040000061
Figure BDA0001888480040000061

表2触发时可用条件分析Table 2 Analysis of available conditions when triggered

Figure BDA0001888480040000071
Figure BDA0001888480040000071

表3被触发时可用条件分析Table 3 Analysis of available conditions when triggered

Figure BDA0001888480040000072
Figure BDA0001888480040000072

根据本发明提供的一种物联网设备联动控制系统,包括:WEB配置模块、联动服务模块;A linkage control system for IoT devices provided according to the present invention includes: a WEB configuration module and a linkage service module;

WEB配置模块、联动服务模块两者中,一者出现异常状态不会影响另一者的运行;联动服务模块利用WEB配置模块存储到数据库中的数据进行规则的筛选,完成设备需要操作的动作。In both the WEB configuration module and the linkage service module, the abnormal state of one will not affect the operation of the other; the linkage service module uses the data stored in the database by the WEB configuration module to filter the rules and complete the actions that the device needs to operate.

WEB配置模块:存储触发条件,触发操作,生成触发规则,并且对触发规则进行管理;WEB配置模块主要分为表现层、业务逻辑层、数据访问层、数据库层,采用SSM框架进行开发,用MySQL进行数据持久化。WEB configuration module: store trigger conditions, trigger operations, generate trigger rules, and manage trigger rules; the WEB configuration module is mainly divided into presentation layer, business logic layer, data access layer, and database layer, which is developed using SSM framework and MySQL Data persistence.

联动服务模块主要分为逻辑处理层、数据持久层;在逻辑处理层中,设置有数据接收模块、条件筛选模块、动作筛选模块、执行动作模块。数据持久层由于需要快速的进行查询,所以联动服务模块中选用了Redis数据库和Mysql配合使用的实现方式。The linkage service module is mainly divided into a logic processing layer and a data persistence layer; in the logic processing layer, there are a data receiving module, a condition screening module, an action screening module, and an execution action module. Since the data persistence layer needs to be queried quickly, the linkage service module uses the combination of Redis database and Mysql.

本发明的系统架构图如图1所示,系统功能图如图2所示。如图3所示,本发明提供的系统,当系统从MQ消息队列获取到消息时,第一步会将其进行解析,获取到有用的信息以后会经过条件筛选和动作筛选两块的逻辑处理,利用WEB配置模块已经存入Redis和Mysql数据库中的信息,来筛选出最后的需要做的动作;最后将这个动作进行封装发送给MQ,最后通过网关让相应的硬件去执行动作。本发明中的程序部分可可部署在windows系统或linux系统上。The system architecture diagram of the present invention is shown in FIG. 1 , and the system function diagram is shown in FIG. 2 . As shown in Figure 3, in the system provided by the present invention, when the system obtains a message from the MQ message queue, the first step will be to parse it, and after obtaining useful information, it will undergo two logical processing of condition screening and action screening. , use the information that the WEB configuration module has stored in the Redis and Mysql databases to filter out the last action to be done; finally, the action is encapsulated and sent to MQ, and finally the corresponding hardware is used to execute the action through the gateway. The program part in the present invention can be deployed on the windows system or the linux system.

Web模块主要包括新建条件,新建操作,生成规则并管理和日志管理等功能。其中,新建条件→操作→规则为一个流程,可以进行上一步,下一步,并对已经选择的条件和操作进行删除,添加等操作。The Web module mainly includes functions such as creating conditions, creating operations, generating rules and managing and managing logs. Among them, New Condition→Operation→Rule is a process, you can go to the previous step, the next step, and delete or add the selected conditions and operations.

新建条件,通过上部选择框选择灯杆设备或者非灯杆设备,再选择设备,组件,功能等生成一条触发条件。选择灯杆设备后点击确定,会弹出灯杆选择的模态框,选择非灯杆设备直接在设备栏刷新。选择设备后点击左侧问号图标,弹出模态框显示当前设备已经被哪些规则占用和每条规则的优先级。如图5所示。Create a new condition, select the pole device or non-light pole device through the upper selection box, and then select the device, component, function, etc. to generate a trigger condition. After selecting a light pole device, click OK, and a modal box for light pole selection will pop up. Select a non-light pole device to refresh directly in the device bar. After selecting a device, click the question mark icon on the left, and a modal box will pop up to display which rules the current device has been occupied and the priority of each rule. As shown in Figure 5.

新建操作,通过上部选择框选择灯杆设备或者非灯杆设备,再选择设备,组件,功能等生成一条触发操作。选择灯杆设备后点击确定,会弹出灯杆选择的模态框,选择非灯杆设备直接在设备栏刷新。如图6所示。To create a new operation, select a light pole device or a non-light pole device through the upper selection box, and then select a device, component, function, etc. to generate a trigger operation. After selecting a light pole device, click OK, and a modal box for light pole selection will pop up. Select a non-light pole device to refresh directly in the device bar. As shown in Figure 6.

最后生成规则,条件和操作添加好后进入生成规则界面,填写优先级和触发后执行操作的时间,点击完成。如图7所示。Finally, generate rules. After adding conditions and operations, enter the generation rules interface, fill in the priority and the time to execute the operation after triggering, and click Finish. As shown in Figure 7.

在联动服务模块的服务逻辑上,整体可分为四个部分,分别为数据接收、条件筛选、动作筛选和执行动作。In the service logic of the linkage service module, the whole can be divided into four parts, namely data reception, condition screening, action screening and execution action.

(1)数据接收(1) Data reception

硬件设备发过来的消息如报警消息和通知类的消息,系统通过RocketMQ去进行处理,我们的服务端在接收到RocketMQ的消息以后,会对这个Json格式的数据进行解析,通过解析到的数据传给条件筛选模块处理逻辑进行处理。Messages sent by hardware devices, such as alarm messages and notification messages, are processed by the system through RocketMQ. After our server receives the message from RocketMQ, it will parse the data in Json format, and transmit the parsed data to the system. Process the processing logic of the conditional filtering module.

(2)在条件筛选模块,根据不同的设备进行不同的逻辑处理,包括单灯、充电桩、AP、紧急求助、停车位监控、井盖监控、LED广告屏等。逻辑处理流程如下:(2) In the condition screening module, different logic processing is performed according to different equipment, including single lamp, charging pile, AP, emergency assistance, parking space monitoring, manhole cover monitoring, LED advertising screen, etc. The logical processing flow is as follows:

1)根据数据接收模块传过来的数据判断是哪种设备传过来的数据,然后找相应的逻辑进行处理。1) According to the data sent by the data receiving module, determine which device is sending the data, and then find the corresponding logic for processing.

2)第二步去Redis的某个db中(本系统时db5,这个可以自己选择,但是选择后就不可更改,分库可以一定程度上避免key的重复,也可以让逻辑更加的清楚,下同)判断是否有这个设备的编码作为key的list,如果存在则进行第三步,不存在就直接跳过逻辑判断不再往下执行。2) The second step is to go to a db in Redis (db5 in this system, which can be selected by yourself, but cannot be changed after selection. The sub-library can avoid the duplication of keys to a certain extent, and can also make the logic more clear. Same as) to judge whether there is the code of this device as the key list, if it exists, go to the third step, if it does not exist, skip the logical judgment and do not proceed further.

3)根据第二步中找到的list,找到该设备下面所有的条件key,根据条件key找到条件具体的值,循环判断这些条件,如果某条条件符合,记录下其规则ID,如果不符合则直接跳过判断逻辑不再往下执行。3) According to the list found in the second step, find all the condition keys under the device, find the specific values of the conditions according to the condition keys, and judge these conditions in a loop. If a condition is met, record its rule ID, if not, then Skip the judgment logic directly and no longer execute it.

4)从第三步中得到了一个规则ID的List,根据规则ID在Redis中找到这个规则下面所有的条件,判断这些条件是否满足,若全部满足则记录下这个规则ID。4) A list of rule IDs is obtained from the third step. According to the rule ID, all the conditions under the rule are found in Redis, and it is judged whether these conditions are satisfied. If all are satisfied, the rule ID is recorded.

5)根据第四步获取到一个最终符合条件的规则ID的List,传给动作筛选模块进行逻辑处理。5) Obtain a list of rule IDs that finally meet the conditions according to the fourth step, and pass it to the action screening module for logical processing.

6)在经过条件筛选以后,将符合条件的规则ID传到动作筛选模块进行处理。这部分主要是对规则中的动作进行优先级的判断。6) After the conditional screening, pass the rule IDs that meet the conditions to the action screening module for processing. This part is mainly to judge the priority of the actions in the rules.

7)经过动作筛选以后,将需要做的动作包装好相应的数据格式,发送给RocketMQ,经过RocketMQ通过网关发送给各个设备进行相应的动作。7) After the action screening, package the action to be done in the corresponding data format, send it to RocketMQ, and send it to each device through RocketMQ through the gateway to perform the corresponding action.

下面对Redis存储结构设计进行说明。The following describes the design of the Redis storage structure.

Redis是一个nosql的高性能Key-Value内存数据库,支持网络,亦可本地持久化。3.0.0Beta版已支持集群。要想很好的使用Redis,就要根据实际的业务场景设计Redis的存储结构,key的构建规则也是非常重要的。在本系统中用到了Redis的db0到db5,每一部分都有自己的存储结构。Redis is a high-performance key-value in-memory database of nosql, which supports network and can also be persisted locally. Clustering is already supported in version 3.0.0Beta. To use Redis well, it is necessary to design the storage structure of Redis according to the actual business scenario, and the construction rules of keys are also very important. In this system, db0 to db5 of Redis are used, and each part has its own storage structure.

在db0中存储是每个条件里面具体的值,在这里使用的数据结构是hash,它的子key和value对应mysql数据库中条件表的各个字段和对应的值,父key为“CondigCondition”加上这个条件再条件表里面的ID组成的字符串,如果ID为1,则父key为CondigCondition1。The specific value in each condition is stored in db0. The data structure used here is hash. Its child key and value correspond to the fields and corresponding values of the condition table in the mysql database. The parent key is "CondigCondition" plus This condition is a string composed of IDs in the condition table. If the ID is 1, the parent key is CondigCondition1.

在db1中存储的是每个规则下面包含哪些条件,使用的数据结构是List。它的key为“ConfigRule”加上规则在mysql规则表里面的ID,它的值为这个规则下面所有条件的key,如这个规则ID为1,它包含的条件的ID是1,则在db1中的表现就是key为ConfigRule1,值为CondigCondition1的List。What is stored in db1 is which conditions are included under each rule, and the data structure used is List. Its key is "ConfigRule" plus the ID of the rule in the mysql rule table, and its value is the key of all conditions under this rule. If the rule ID is 1, and the ID of the condition it contains is 1, then in db1 The performance is that the key is ConfigRule1 and the value is a List of CondigCondition1.

db2现阶段没有使用留作以后补充。db2 is not used at this stage and is reserved for future supplementation.

db3中存储的是所有的条件key,用作遍历使用,它使用的数据结构是List。Db3中只有一个key,就是ConfigCoditionList,它的值是所有出现在db0中的条件key。All condition keys are stored in db3, which is used for traversal, and the data structure it uses is List. There is only one key in Db3, which is ConfigCoditionList, and its value is all the condition keys that appear in db0.

db4中存储的是所有拥有条件的设备的Code,用作遍历使用,这里使用的存储结构也是List。它的里面也只有一个key,为EquipmentCodeList。The code of all devices with conditions is stored in db4, which is used for traversal. The storage structure used here is also List. It also has only one key in it, which is EquipmentCodeList.

db5中存储的是每个设备所拥有的条件,使用的数据结构为List。它的key就是该设备的14位编码,这个key的值就是该设备所拥有的条件key。比如编号为01070000000001的AP拥有条件key为CondigCondition2,则在db中会有一个key为01070000000001,值为CondigCondition2的List。What is stored in db5 is the conditions owned by each device, and the data structure used is List. Its key is the 14-bit code of the device, and the value of this key is the condition key owned by the device. For example, if the AP numbered 01070000000001 has the condition key CondigCondition2, there will be a List in the db with the key 01070000000001 and the value CondigCondition2.

下面对关键技术及解决途径进行说明。The key technologies and solutions are described below.

Redis是一个速度非常快的非关系数据库,它可以存储键(key)与5种不同类型的值(value)之间的映射(mapping),可以将存储在内存的键值对数据持久化到硬盘,可以使用复制特性来扩展读性能,尽管Redis是一个非常快速的内存数据存储媒介,但是不代表Redis不会产生性能问题。所以在使用的时候要注意一些问题已保证Redis的性能。Redis is a very fast non-relational database that can store mappings between keys and 5 different types of values, and can persist the key-value pair data stored in memory to hard disk , you can use the replication feature to expand read performance. Although Redis is a very fast in-memory data storage medium, it does not mean that Redis will not cause performance problems. So pay attention to some issues when using it to ensure the performance of Redis.

应避免长耗时命令。Redis绝大多数读写命令的时间复杂度都在O(1)到O(N)之间,在文本和官方文档中均对每个命令的时间复杂度有说明。通常来说,O(1)的命令是安全的,O(N)命令在使用时需要注意,如果N的数量级不可预知,则应避免使用。例如对一个field数未知的Hash数据执行HGETALL/HKEYS/HVALS命令,通常来说这些命令执行的很快,但如果这个Hash中的field数量极多,耗时就会成倍增长。Redis提供了Slow Log功能,可以自动记录耗时较长的命令。我们可以查出是哪些命令耗时过长然后做相应的优化。Long time-consuming commands should be avoided. The time complexity of most Redis read and write commands is between O(1) and O(N). The time complexity of each command is described in the text and official documents. Generally speaking, O(1) commands are safe, O(N) commands need to be used with care and should be avoided if the magnitude of N is unpredictable. For example, executing HGETALL/HKEYS/HVALS commands on a Hash data with an unknown number of fields. Generally speaking, these commands are executed quickly, but if the number of fields in the Hash is extremely large, the time-consuming will increase exponentially. Redis provides the Slow Log function, which can automatically record commands that take a long time. We can find out which commands are taking too long and optimize accordingly.

数据持久化引发的延迟。Redis的数据持久化工作本身就会带来延迟,需要根据数据的安全级别和性能要求制定合理的持久化策略。本系统采用的是AOF持久化策略,设置fsync every second,每秒fsync一次,既能很大程度的保持持久化的正确性,又考虑到了对性能的影响。Latency caused by data persistence. The data persistence work of Redis itself will bring delay, and a reasonable persistence strategy needs to be formulated according to the security level and performance requirements of the data. This system adopts the AOF persistence strategy, setting fsync every second and fsyncing once per second, which not only maintains the correctness of persistence to a large extent, but also takes into account the impact on performance.

虚拟机引发的延迟。现在联动配置子系统部署在虚拟机上,Redis也部署在同一个地方,可能天然就有虚拟机环境带来的固有延迟。可以通过./redis-cli--intrinsic-latency 100命令查看固有延迟。同时如果对Redis的性能有较高要求的话,应尽可能在物理机上直接部署Redis。Latency caused by the virtual machine. Now that the linkage configuration subsystem is deployed on the virtual machine, and Redis is also deployed in the same place, there may be inherent delays caused by the virtual machine environment. Intrinsic latency can be viewed with the ./redis-cli --intrinsic-latency 100 command. At the same time, if there are high requirements for the performance of Redis, you should deploy Redis directly on the physical machine as much as possible.

本领域技术人员知道,除了以纯计算机可读程序代码方式实现本发明提供的系统、装置及其各个模块以外,完全可以通过将方法步骤进行逻辑编程来使得本发明提供的系统、装置及其各个模块以逻辑门、开关、专用集成电路、可编程逻辑控制器以及嵌入式微控制器等的形式来实现相同程序。所以,本发明提供的系统、装置及其各个模块可以被认为是一种硬件部件,而对其内包括的用于实现各种程序的模块也可以视为硬件部件内的结构;也可以将用于实现各种功能的模块视为既可以是实现方法的软件程序又可以是硬件部件内的结构。Those skilled in the art know that, in addition to implementing the system, device and each module provided by the present invention in the form of pure computer readable program code, the system, device and each module provided by the present invention can be completely implemented by logically programming the method steps. The same program is implemented in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, and embedded microcontrollers, among others. Therefore, the system, device and each module provided by the present invention can be regarded as a kind of hardware component, and the modules used for realizing various programs included in it can also be regarded as the structure in the hardware component; A module for realizing various functions can be regarded as either a software program for realizing a method or a structure within a hardware component.

以上对本发明的具体实施例进行了描述。需要理解的是,本发明并不局限于上述特定实施方式,本领域技术人员可以在权利要求的范围内做出各种变化或修改,这并不影响本发明的实质内容。在不冲突的情况下,本申请的实施例和实施例中的特征可以任意相互组合。Specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the above-mentioned specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which do not affect the essential content of the present invention. The embodiments of the present application and features in the embodiments may be combined with each other arbitrarily, provided that there is no conflict.

Claims (3)

1. The utility model provides a thing networking device coordinated control system which characterized in that includes: a WEB configuration module and a linkage service module;
the linkage service module utilizes the data stored in the database by the WEB configuration module to carry out rule screening to complete the action of the equipment needing to be operated;
the WEB configuration module comprises a Web module;
newly building a condition module: the trigger condition is configured to be set up,
newly building an operation module: configuring a trigger operation;
a rule generation module: generating a rule according to the trigger condition and the trigger operation, wherein the rule comprises a priority, an operation executed after being triggered and an operation execution time after being triggered;
wherein the trigger condition includes the following information:
Figure FDA0002567280990000011
wherein, the execution operation after being triggered comprises the following information:
Figure FDA0002567280990000012
Figure FDA0002567280990000021
the triggering of the component type is configured as:
Figure FDA0002567280990000022
the linkage service module comprises the following modules:
a data receiving module: processing the message sent by the hardware equipment through a RocketMQ, after receiving the message of the RocketMQ, analyzing the data in the Json format, and transmitting the analyzed data to a condition screening module for logic processing;
a condition screening module: performing different logic processing according to different types of equipment to obtain a rule ID, wherein the types of the equipment comprise a single lamp, a charging pile, an AP, emergency help, parking space monitoring, well lid monitoring and an LED advertising screen;
an action screening module: judging the priority of the actions in the rule according to the rule ID to obtain the actions needing to be operated;
an execution action module: packaging the action to be operated into a corresponding data format, sending the data format to a RocketMQ, and sending the data format to each device through a gateway through the RocketMQ to perform corresponding action;
wherein the logic processing flow is as follows:
the first step is as follows: judging which kind of equipment transmitted data according to the data transmitted by the data receiving module, and then finding corresponding logic for processing;
the second step is that: judging whether the code of the equipment is used as a list of condition keys or not in a database db without Redis, if so, performing the third step, and if not, ending the logic processing flow;
the third step: finding all condition keys below the equipment according to the list found in the second step, finding specific values of the conditions according to the condition keys, circularly judging the conditions, recording rule IDs corresponding to the values if the conditions are in accordance, and not recording the rule IDs corresponding to the values if the conditions are not in accordance;
the fourth step: obtaining a List List of rule IDs from the third step, finding all conditions under the rule in Redis according to the rule IDs, judging whether the conditions are met, and recording the rule ID if the conditions are met;
the fifth step: according to the fourth step, a List of the rule IDs which finally meet the conditions is obtained and is transmitted to an action screening module for logic processing;
and a sixth step: after condition screening, the rule ID meeting the conditions is transmitted to an action screening module for processing.
2. The internet of things device linkage control system according to claim 1, wherein the adopted Redis storage structure is as follows:
specific values of each condition are stored in db0 of Redis, the used data structure is hash, child keys and values of the hash correspond to fields and corresponding values of a condition table in a mysql database, a parent key is a character string formed by CondigCondition and an ID of the condition in the condition table, and if the ID is 1, the parent key is CondigCondigCondition 1;
stored in db1 of Redis is which conditions are contained under each rule, and the data structure used is a List; the key of the condition under the rule is Configresults plus the ID of the rule in the mysql rule table, and the value of the key of the List is the key of all the conditions under the rule;
all condition keys are stored in db3 of Redis and used as traversal uses, and the data structure used by the condition keys is List; only one key in Db3 is the ConfigCoditionList, whose value is all conditional keys present in Db 0;
stored in db4 of Redis are codes of all devices having a condition, used for traversal, and the storage structure used here is also a List; there is also only one key inside the Code of the device with the condition, which is equal to EquipmentCodeList;
stored in db5 of Redis are the conditions owned by each device, using a List data structure; the key of the condition owned by the equipment is the 14-bit code of the equipment, and the value of the key is the key of the condition owned by the equipment;
mapping between the Redis storage key and different types of value values, persisting key value pair data stored in a memory to a hard disk, and expanding the reading performance by using a copying characteristic; wherein: the command of O (1) is safe, and the command of O (N) is used if the order of N is unpredictable, so that the command is avoided; setting a fsync function, and executing the fsync function once every second; looking at the inherent delays, Redis is deployed directly on the physical machine.
3. The Internet of things equipment linkage control system according to claim 1, wherein one of the WEB configuration module and the linkage service module is in an abnormal state, so that the operation of the other one cannot be influenced;
the WEB configuration module is used for storing the trigger conditions, triggering operation, generating trigger rules and managing the trigger rules; the WEB configuration module is divided into a presentation layer, a business logic layer, a data access layer and a database layer, an SSM framework is adopted for development, and MySQL is used for data persistence;
the linkage service module is divided into a logic processing layer and a data persistence layer; the logic processing layer is provided with a data receiving module, a condition screening module, an action screening module and an action executing module;
and a data persistence layer and a linkage service module adopt an implementation mode that a Redis database and Mysql are matched for use.
CN201811460143.5A 2018-11-30 2018-11-30 Internet of things equipment linkage control system Active CN109683494B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811460143.5A CN109683494B (en) 2018-11-30 2018-11-30 Internet of things equipment linkage control system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811460143.5A CN109683494B (en) 2018-11-30 2018-11-30 Internet of things equipment linkage control system

Publications (2)

Publication Number Publication Date
CN109683494A CN109683494A (en) 2019-04-26
CN109683494B true CN109683494B (en) 2020-09-08

Family

ID=66185185

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811460143.5A Active CN109683494B (en) 2018-11-30 2018-11-30 Internet of things equipment linkage control system

Country Status (1)

Country Link
CN (1) CN109683494B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111381582B (en) * 2020-03-11 2021-07-23 杭州涂鸦信息技术有限公司 Linkage rule testing method and device
CN114846415B (en) * 2020-03-20 2024-12-27 Oppo广东移动通信有限公司 A rule processing method and device, and electronic equipment
CN112583925B (en) * 2020-12-23 2023-05-23 佳讯飞鸿(北京)智能科技研究院有限公司 Control system and method for Internet of things service, readable storage medium and electronic equipment
CN112835968A (en) * 2021-02-01 2021-05-25 浪潮云信息技术股份公司 Intelligent equipment linkage method based on Internet of things
CN113886190B (en) * 2021-10-22 2023-07-14 苏州浪潮智能科技有限公司 Device management system, method, device and storage medium for server
CN114301953A (en) * 2021-12-13 2022-04-08 北京首奥置业有限公司 Internet of things equipment linkage control method and device, storage medium and electronic device
CN114513389A (en) * 2021-12-31 2022-05-17 佛山市瑞德物联科技有限公司 A linkage method and linkage device based on edge computing gateway
CN114710535A (en) * 2022-01-11 2022-07-05 福建超智集团有限公司 Scene linkage method and system based on intelligent rod Internet of things equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101848237A (en) * 2010-05-10 2010-09-29 秦野 Intelligent household information system of internet of things
CN106127379A (en) * 2016-06-22 2016-11-16 中智城信息科技(苏州)有限公司 A kind of based on lamp networked sensor group with the smart city construction method of cloud computing
CN106453368A (en) * 2016-10-27 2017-02-22 深圳市欧瑞博电子有限公司 Control method and apparatus of intelligent device

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150019353A1 (en) * 2012-02-06 2015-01-15 Adstruc, Inc. System for managing the utilization of a plurality of outdoor advertising units
CN104601665B (en) * 2014-12-22 2017-11-03 西安电子科技大学 A kind of system and method that high in the clouds real-time simulation is carried out to Internet of Things awareness apparatus
CN105337828B (en) * 2015-09-29 2019-01-01 深圳市安冠科技有限公司 A kind of network-based equipment collaboration processing system and method
CN105550818A (en) * 2015-12-28 2016-05-04 上海五零盛同信息科技有限公司 Road illumination facility comprehensive utilization based information management platform
KR101869233B1 (en) * 2016-03-08 2018-06-20 주식회사 로제타텍 Operating method of process management system for distributed programmable logic controllers adopting internet-of-things configuration
CN105872075B (en) * 2016-05-06 2018-08-31 东莞中科智城软件有限公司 Method for mapping Internet of things equipment to smart city resource model
US9894159B2 (en) * 2016-06-13 2018-02-13 Verizon Patent And Licensing Inc. Generating consumer internet-of-things data products
CN107065616A (en) * 2017-05-08 2017-08-18 浙江风向标科技有限公司 Inter-linked controlling method and device, computer-readable recording medium
CN107864174B (en) * 2017-07-03 2021-07-20 华南理工大学 A rule-based linkage method for IoT devices
CN107272535B (en) * 2017-07-11 2019-06-25 武汉虹信技术服务有限责任公司 A kind of linkage and interlock method of intelligent building management system
CN107272437B (en) * 2017-08-01 2021-06-04 中国联合网络通信集团有限公司 Intelligent device, control method and control platform thereof, and intelligent device system
CN107770282A (en) * 2017-11-02 2018-03-06 湖北科技学院 A kind of fire-fighting life-saving rescue system under city complex environment
CN108182241B (en) * 2017-12-28 2021-03-26 深圳市博实结科技有限公司 Data interaction optimization method and device, server and storage medium
CN107944059A (en) * 2017-12-29 2018-04-20 深圳市中润四方信息技术有限公司西安分公司 A kind of user behavior analysis method and system based on stream calculation

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101848237A (en) * 2010-05-10 2010-09-29 秦野 Intelligent household information system of internet of things
CN106127379A (en) * 2016-06-22 2016-11-16 中智城信息科技(苏州)有限公司 A kind of based on lamp networked sensor group with the smart city construction method of cloud computing
CN106453368A (en) * 2016-10-27 2017-02-22 深圳市欧瑞博电子有限公司 Control method and apparatus of intelligent device

Also Published As

Publication number Publication date
CN109683494A (en) 2019-04-26

Similar Documents

Publication Publication Date Title
CN109683494B (en) Internet of things equipment linkage control system
CN103336813B (en) A kind of Internet of Things data integrated management scheme based on middleware framework
CN108809972B (en) Internet of things comprehensive experiment and application development platform based on open source ecosystem
CN108011768B (en) Construction method of aop interception type HBase data storage micro-service architecture
CN106899638A (en) A kind of fusions networking relationships system for solving Heterogeneous data and method
CN104410568B (en) A kind of design method of the semantic gateway of smart home
CN108681488B (en) Internet of things platform terminal data reporting method
US20240119026A1 (en) Entity Snapshots Partitioning And Combining
CN111801655A (en) Reconfigurable embedded rules engine for internet of things (IOT) devices
CN107528864A (en) Heterogeneous network data processing method and system
CN105872075B (en) Method for mapping Internet of things equipment to smart city resource model
CN112256927A (en) Method and device for processing knowledge graph data based on attribute graph
CN103886508A (en) Mass farmland data monitoring method and system
CN105446724A (en) Method and device for managing software parameters
CN108234299A (en) The information processing method of configurable protocol data gateway and gateway based on model
CN111414228A (en) Method and related device for managing storage space based on Kubernetes
CN110706125A (en) Water conservancy big data analysis information service system and platform service system
Shen Construction of a Wireless Sensing Network System for Leisure Agriculture for Cloud‐Based Agricultural Internet of Things
Chi et al. Smart home control and management based on big data analysis
US10671411B2 (en) Cloning for object-oriented environment
Sánchez et al. On the energy savings achieved through an internet of things enabled smart city trial
CN106599241A (en) Big data visual management method for GIS software
CN114528270A (en) System and method for automatically associating real-time stream data with service dimension information in cloud environment
CN201332402Y (en) House download server based on embedded Linux
Xu et al. An optimization framework for cloud-sensor systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: IoT device linkage control system

Granted publication date: 20200908

Pledgee: China Construction Bank Corporation Shanghai Putuo Branch

Pledgor: SHANGHAI WULING SHENGTONG INFORMATION TECHNOLOGY Co.,Ltd.

Registration number: Y2024310001090