CN117201525A - Data processing method, device, equipment, storage medium and system - Google Patents

Data processing method, device, equipment, storage medium and system Download PDF

Info

Publication number
CN117201525A
CN117201525A CN202210610499.2A CN202210610499A CN117201525A CN 117201525 A CN117201525 A CN 117201525A CN 202210610499 A CN202210610499 A CN 202210610499A CN 117201525 A CN117201525 A CN 117201525A
Authority
CN
China
Prior art keywords
target sensor
subscription
working state
sensor
target
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.)
Pending
Application number
CN202210610499.2A
Other languages
Chinese (zh)
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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202210610499.2A priority Critical patent/CN117201525A/en
Priority to PCT/CN2023/095783 priority patent/WO2023231837A1/en
Publication of CN117201525A publication Critical patent/CN117201525A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/55Push-based network services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/12Messaging; Mailboxes; Announcements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/30Services specially adapted for particular environments, situations or purposes
    • H04W4/38Services specially adapted for particular environments, situations or purposes for collecting sensor information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. TPC [Transmission Power Control], power saving or power classes
    • H04W52/02Power saving arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/18Self-organising networks, e.g. ad-hoc networks or sensor networks
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Arrangements For Transmission Of Measured Signals (AREA)

Abstract

The embodiment of the application provides a data processing method, a device, equipment, a storage medium and a system, wherein the method comprises the steps of receiving a subscription cancellation message; the subscription cancellation message carries identification information of the target sensor; determining a target sensor according to the subscription cancellation message; sending a second working state switching instruction to the target sensor; the second working state switching instruction is used for indicating the target sensor to be switched from the first working state to the second working state; the first working state is a working state that the target sensor performs data measurement in a first measurement period; the second working state is a working state that the target sensor stops data measurement or performs data measurement in a second measurement period; wherein the second measurement period is greater than the first measurement period. Is used for reducing the industrial production cost.

Description

Data processing method, device, equipment, storage medium and system
Technical Field
The application relates to the technical field of industrial safety monitoring, in particular to a data processing method, a device, equipment, a storage medium and a system.
Background
In industrial production, the safety problem ensures the basis of industrial production. In order to ensure the production safety, the production environment and the production parameters during industrial production are generally required to be monitored. When the production environment is monitored, parameters such as temperature, harmful gas concentration, wind speed and the like in the environment can be monitored. When monitoring the production process, the operation state of the equipment, the production parameters in each production link and the like can be monitored for detection. For example, in the case of coal mine safety monitoring, on the one hand, it is necessary to monitor environmental parameters such as concentration, temperature, wind speed, temperature, etc. of various toxic gases in the coal mine. On the other hand, production parameters such as a coal bunker coal level, a water bunker water level, an operation state of the coal mining machine and the like are required to be detected.
Currently, existing safety monitoring systems typically include various sensors and substations. The sensors are respectively arranged at positions needing parameter monitoring to monitor corresponding environmental parameters and production parameters. For example, the temperature in the production environment is monitored by a temperature sensor, the concentration of methane in the production environment is monitored by a methane sensor, the wind speed in the production environment is monitored by a wind speed sensor, and the like. After the different sensors monitor the data, the monitored data can be transmitted to the substation, and the monitored data can be sent to other equipment through the substation for subsequent processing. In some technologies, the sensor uses a battery to supply power to the sensor, and the sensor is always in an operating state after being turned on. When the equipment to be tested of the sensor stops running and is in a non-working state, the sensor is still in a normal working state, more power is consumed, the working time of the battery is reduced, and the industrial production cost is increased.
Disclosure of Invention
In view of the above, the present application provides a data processing method, apparatus, device, storage medium and system, so as to solve the problem of high industrial production cost in the prior art.
In a first aspect, an embodiment of the present application provides a data processing method, applied to a proxy device, where the method includes:
receiving a subscription cancellation message; the subscription cancellation message carries identification information of the target sensor;
determining a target sensor according to the subscription cancellation message;
sending a second working state switching instruction to the target sensor; the second working state switching instruction is used for indicating the target sensor to be switched from the first working state to the second working state; the first working state is a working state that the target sensor performs data measurement in a first measurement period; the second working state is a working state that the target sensor stops data measurement or performs data measurement in a second measurement period; wherein the second measurement period is greater than the first measurement period.
In one possible implementation manner of the first aspect, before the sending the second operation state switching instruction to the target sensor, the method further includes:
Acquiring the subscription number of the target sensor, and reducing the subscription number of the target sensor by a first preset value;
when the subscription number of the target sensors is equal to or smaller than a preset threshold value, acquiring subscription states of the target sensors, and updating the subscription states of the target sensors from subscribed states to unsubscribed states;
the sending the second working state switching instruction to the target sensor comprises the following steps:
and when the subscription state of the target sensor is updated from the subscribed state to the unsubscribed state, sending a second working state switching instruction to the target sensor.
One possible implementation manner of the first aspect further includes:
receiving a subscription message; the subscription information carries the identification information of the target sensor;
determining the target sensor according to the subscription message;
acquiring a subscription state of the target sensor;
when the subscription state of the target sensor is an unsubscribed state, updating the subscription state of the target sensor from the unsubscribed state to a subscribed state, increasing the subscription number of the target sensor by a second preset value, and sending a first working state switching instruction to the target sensor; the first working state switching instruction is used for indicating the target sensor to be switched from the second working state to the first working state.
One possible implementation manner of the first aspect further includes:
and when the subscription state of the target sensor is subscribed, increasing the subscription number of the target sensor by a second preset value.
One possible implementation manner of the first aspect further includes:
acquiring measurement data of a target sensor;
acquiring identification information of the target sensor, and determining at least one subscription device of the target sensor according to the identification information of the target sensor;
the measurement data is sent to at least one subscribing device of the target sensor.
In one possible implementation manner of the first aspect, the sending an operating state switching instruction to the target sensor, where the operating state switching instruction includes a first operating state switching instruction or a second operating state switching instruction, includes:
when at least two target sensors exist, determining a connection mode of each target sensor;
and respectively sending working state switching instructions to the target sensors according to the connection mode of each target sensor.
In one possible implementation manner of the first aspect, the sending, according to a connection manner of each target sensor, an operating state switching instruction to the target sensor includes:
When the target sensor is connected with the proxy equipment through a field bus, sending a working state switching instruction to the target sensor through the field bus; or,
when the target sensor is connected with the proxy equipment through a network, a working state switching instruction is sent to the target sensor through the network connection.
In one possible implementation manner of the first aspect, the acquiring measurement data of the target sensor includes:
when the target sensor is connected with the proxy equipment through a field bus, the proxy equipment inquires the target sensor through the field bus to acquire measurement data of the target sensor; or,
and when the target sensor is connected with the proxy equipment through a network, receiving measurement data sent by the target sensor through the network connection.
A possible implementation manner of the first aspect, the network connection includes: an ethernet connection or a wireless network connection.
In a second aspect, an embodiment of the present application provides a data processing method, applied to a sensor, where the method includes:
receiving a second working state switching instruction; the second working state switching instruction is used for indicating the target sensor to be switched from the first working state to the second working state; the first working state is a working state that the target sensor performs data measurement in a first measurement period; the second working state is a working state that the target sensor does not perform data measurement or performs data measurement in a second measurement period; wherein the second measurement period is greater than the first measurement period;
And switching the current working state into a second working state according to the second working state switching instruction, and carrying out data measurement according to a second measurement period when the second working state is a working state for carrying out data measurement according to the second measurement period.
One possible implementation manner of the second aspect further includes:
receiving a first working state switching instruction; the first working state switching instruction is used for indicating the target sensor to be switched from the second working state to the first working state;
and switching the current working state into a first working state according to the first working state switching instruction, and carrying out data measurement according to a first measurement period when the first working state is a working state for carrying out data measurement according to the first measurement period.
One possible implementation manner of the second aspect further includes:
the measurement data is sent to the proxy device.
In a third aspect, an embodiment of the present application provides a proxy device, including:
the subscription publishing service module is used for receiving the subscription cancellation message and sending the subscription cancellation message to the subscription management module; the subscription cancellation message carries identification information of the target sensor;
The subscription management module is used for determining a target sensor according to the subscription cancellation message;
sending a second working state switching instruction to the target sensor; the second working state switching instruction is used for indicating the target sensor to be switched from the first working state to the second working state; the first working state is a working state that the target sensor performs data measurement in a first measurement period; the second working state is a working state that the target sensor does not perform data measurement or performs data measurement in a second measurement period; wherein the second measurement period is greater than the first measurement period.
In one possible implementation manner of the third aspect, the subscription management module is configured to obtain a subscription number of the target sensor, and reduce the subscription number of the target sensor by a first preset value;
when the subscription number of the target sensors is equal to or smaller than a preset threshold value, acquiring subscription states of the target sensors, and updating the subscription states of the target sensors from subscribed states to unsubscribed states;
the subscription management module is configured to send a second working state switching instruction to the target sensor when the subscription state of the target sensor is updated from the subscribed state to the unsubscribed state.
A possible implementation manner of the third aspect, the subscription publishing service module is configured to receive a subscription message and send the subscription message to a subscription management module; the subscription information carries the identification information of the target sensor;
the subscription management module is used for determining the target sensor according to the subscription information;
acquiring a subscription state of the target sensor;
when the subscription state of the target sensor is an unsubscribed state, updating the subscription state of the target sensor from the unsubscribed state to a subscribed state, increasing the subscription number of the target sensor by a second preset value, and sending a first working state switching instruction to the target sensor; the first working state switching instruction is used for indicating the target sensor to be switched from the second working state to the first working state.
In one possible implementation manner of the third aspect, the subscription management module is configured to increase, when the subscription status of the target sensor is subscribed, the subscription number of the target sensor by a second preset value.
A possible implementation manner of the third aspect further includes:
the subscription and release client module is used for acquiring the measurement data of the target sensor and sending the measurement data sent by the target sensor to the subscription and release service module;
The subscription and release service module is used for acquiring the identification information of the target sensor and determining at least one subscription device of the target sensor according to the identification information of the target sensor;
the measurement data is sent to at least one subscribing device of the target sensor.
In one possible implementation manner of the third aspect, the subscription management module is configured to determine, when there are at least two target sensors, a connection manner of each target sensor;
according to the connection mode of each target sensor, respectively sending a working state switching instruction to the target sensor; the working state switching instruction comprises: a first operating state switching instruction or a second operating state switching instruction.
In a possible implementation manner of the third aspect, the subscription management module is configured to send, when the target sensor is connected to the proxy device through a fieldbus, an operating state switching instruction to the target sensor through the fieldbus; or,
when the target sensor is connected with the proxy equipment through a network, a working state switching instruction is sent to the target sensor through the network connection.
In one possible implementation manner of the third aspect, the subscription publishing client module is configured to query, when the target sensor is connected to the proxy device through a fieldbus, the target sensor through the fieldbus, and obtain measurement data of the target sensor; or,
and when the target sensor is connected with the proxy equipment through a network, receiving measurement data sent by the target sensor through the network connection.
In one possible implementation manner of the third aspect, the subscription publishing client module is configured to query, when the target sensor is connected to the proxy device through a fieldbus, the target sensor through the fieldbus, and obtain measurement data of the target sensor; or,
and when the target sensor is connected with the proxy equipment through a network, receiving measurement data sent by the target sensor through the network connection.
A possible implementation manner of the third aspect, the network connection includes: an ethernet connection or a wireless network connection.
In a fourth aspect, an embodiment of the present application provides a sensor, including:
the receiving module is used for receiving a second working state switching instruction; the second working state switching instruction is used for indicating the target sensor to be switched from the first working state to the second working state; the first working state is a working state that the target sensor performs data measurement in a first measurement period; the second working state is a working state that the target sensor does not perform data measurement or performs data measurement in a second measurement period; wherein the second measurement period is greater than the first measurement period;
And the processing module is used for switching the current working state into a second working state according to the second working state switching instruction, and carrying out data measurement according to a second measurement period when the second working state is the working state for carrying out data measurement according to the second measurement period.
A possible implementation manner of the fourth aspect, the receiving module is configured to receive a first operating state switching instruction; the first working state switching instruction is used for indicating the target sensor to be switched from the second working state to the first working state;
the processing module is used for switching the current working state into a first working state according to the first working state switching instruction, and carrying out data measurement according to a first measurement period when the first working state is the working state for carrying out data measurement according to the first measurement period.
One possible implementation manner of the fourth aspect further includes:
and the sending module is used for sending the measurement data to the proxy equipment.
In a fifth aspect, an embodiment of the present application provides a data processing system, including: proxy device, at least one sensor and at least one subscription device;
the proxy equipment is connected with at least one sensor and at least one subscription equipment;
At least one subscribing device for sending a subscription cancellation message to the proxy device; the subscription cancellation message carries identification information of the target sensor;
the proxy device comprising the proxy device of any of the above third aspects; the at least one sensor comprises the sensor of any one of the fourth aspects above.
In a sixth aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, the memory storing a computer program, which when executed, causes the electronic device to perform the method according to any one of the first aspect or the second aspect.
In a seventh aspect, an embodiment of the present application provides a storage medium, where the storage medium includes a stored program, where the program, when executed, controls a device in which the storage medium is located to perform the method of any one of the first aspect or perform the method of any one of the second aspect.
By adopting the scheme provided by the embodiment of the application, the subscription cancellation message is received; the subscription cancellation message carries the identification information of the target sensor; determining a target sensor according to the subscription cancellation message; and sending a second working state switching instruction to the target sensor. In this way, when the subscribing device pauses to acquire the measurement data of the target sensor, the subscribing device sends a subscribing cancel message to the first device, and after the first device receives the subscribing cancel message, the first device can determine the target sensor according to the subscribing cancel message and send a second working state switching instruction to the target sensor so that the target sensor is switched from the first working state to the second working state. The data measurement frequency of the target sensor in the second operating state is lower than the data measurement frequency of the target sensor in the first operating state. That is, when the subscription cancellation message is received, the target sensor can be controlled to switch to the second working state with a longer measurement period, so that the monitoring period of the target sensor can be prolonged when the target sensor is not required to monitor, or the data measurement can be stopped, the power consumption of the target sensor when the target sensor is not required to monitor data can be reduced, the battery service time of the target sensor can be prolonged, and the industrial production cost can be reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic view of a scenario in which a sensor is connected to a substation according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of a data processing method according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating another data processing method according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating another data processing method according to an embodiment of the present application;
fig. 5a is a schematic view of a scenario of a data processing method according to an embodiment of the present application;
FIG. 5b is a schematic diagram of a scenario of another data processing method according to an embodiment of the present application;
FIG. 6 is a flowchart illustrating another data processing method according to an embodiment of the present application;
fig. 7 is a schematic view of a scenario of another data processing method according to an embodiment of the present application;
FIG. 8 is a flowchart illustrating another data processing method according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a proxy device according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of another proxy device according to an embodiment of the present application;
FIG. 11 is a schematic diagram of a sensor according to an embodiment of the present application;
FIG. 12 is a schematic diagram of another sensor according to an embodiment of the present application;
FIG. 13 is a schematic diagram of a data processing system according to an embodiment of the present application;
fig. 14 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For a better understanding of the technical solution of the present application, the following detailed description of the embodiments of the present application refers to the accompanying drawings.
It should be understood that the described embodiments are merely some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The terminology used in the embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be understood that the term "and/or" as used herein is merely one way of describing an association of associated objects, meaning that there may be three relationships, e.g., a and/or b, which may represent: the first and second cases exist separately, and the first and second cases exist separately. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship.
Before describing embodiments of the present application in detail, terms applied or likely to be applied to the embodiments of the present application will be explained first.
The sensor is a detecting device, which can sense the measured information and convert the sensed information into electric signals or other information output in the required form according to a certain rule, so as to meet the requirements of information transmission, processing, storage, display, recording, control and the like.
Currently, in existing security monitoring systems, various sensors, substations, and data service devices are typically included, as shown in fig. 1. The sensors are respectively arranged at positions needing parameter monitoring to monitor corresponding environmental parameters and production parameters. For example, the temperature in the production environment is monitored by a temperature sensor, the concentration of methane in the production environment is monitored by a methane sensor, the wind speed in the production environment is monitored by a wind speed sensor, and the like. After the different sensors monitor the data, the monitored data can be transmitted to the substation, and the monitored data is sent to the data service equipment through the substation for subsequent processing. In some technologies, the sensor uses a battery to supply power to the sensor, and the sensor is always in an operating state after being turned on. When the measurement data of the sensor is not subscribed, the sensor is still in a normal working state, more power is consumed, the working time of the battery is reduced, and the industrial production cost is increased.
The data transmission modes between the different sensors and the substations are not completely the same, and referring to fig. 1, some sensors and substations are connected by a field bus to realize data transmission, for example, the temperature sensor and the substations are connected by the field bus. The sensors and the substations are connected through an Ethernet or a wireless network to realize data transmission, for example, the methane sensor and the substations are connected through the Ethernet, and the wind speed sensor and the substations are connected through the wireless network. In some techniques, a substation corresponding to each connection is provided for each connection sensor to enable the sensor to transmit data to the substation via the connection that it supports. Therefore, the number of substations to be arranged is large, and the cost of industrial production is further increased.
In view of the above problems, embodiments of the present application provide a data processing method, apparatus, device, storage medium, and system, for receiving a subscription cancellation message; the subscription cancellation message carries the identification information of the target sensor; determining a target sensor according to the subscription cancellation message; and sending a second working state switching instruction to the target sensor. In this way, when the subscribing device pauses to acquire the measurement data of the target sensor, the subscribing device sends a subscribing cancel message to the first device, and after the first device receives the subscribing cancel message, the first device can determine the target sensor according to the subscribing cancel message and send a second working state switching instruction to the target sensor so that the target sensor is switched from the first working state to the second working state. The data measurement frequency of the target sensor in the second operating state is lower than the data measurement frequency of the target sensor in the first operating state. That is, when the subscription cancellation message is received, the target sensor can be controlled to switch to the second working state with a longer measurement period, so that the monitoring period of the target sensor can be prolonged when the target sensor is not required to monitor, or the data measurement can be stopped, the power consumption of the target sensor when the target sensor is not required to monitor data can be reduced, the battery service time of the target sensor can be prolonged, and the industrial production cost can be reduced. The following is a detailed description.
Referring to fig. 2, a flow chart of a data processing method according to an embodiment of the present application is shown. The method is applied to the proxy device, as shown in fig. 2, and comprises the following steps:
step S201, receiving a subscription cancellation message.
The subscription cancellation message carries identification information of the target sensor.
In the embodiment of the application, in the industrial production process, in order to improve the safety of the industrial production, parameters such as the surrounding environment or the running state of important equipment in the production process are required to be periodically measured through a sensor. Because the sensor has a simple structure, so that the sensor has a single function and poor calculation capability, and generally does not have a storage function, measurement data of periodic measurement needs to be transmitted to other devices for processing. In the embodiment of the application, the proxy equipment is connected with different sensors, so that the sensors can transmit the periodically measured measurement data to the proxy equipment. Other data service devices may subscribe to the proxy device for measurement data of its required sensors, at which point the other data service devices may be referred to as subscribing devices. When the proxy device acquires the measurement data periodically measured by different sensors, the proxy device can send the measurement data periodically measured by the corresponding sensors to each subscribing device according to the measurement data of the required sensor subscribed by each subscribing device. If, due to production needs, it is necessary to stop the operation of some devices or not pay attention to some parameters in the environment, etc., the relevant subscribing device may stop acquiring the measurement data measured by the relevant sensor, at which time the subscribing device may send a subscription cancellation message to the proxy device. The subscription cancellation message carries identification information of the target sensor. The target sensor is a sensor whose measurement data is no longer acquired by the subscribing device. The proxy device may receive a subscription cancellation message sent by the subscribing device.
The identification information of the target sensor is information for identifying the target sensor, for example, may be an identification number (Identity document, ID) of the target sensor, or information such as a name of the target sensor, or other information having a mapping relationship with the sensor, for example, when subscription subject information has a mapping relationship with the sensor, the identification information of the target sensor may also be subscription subject information, or the like. The mapping relation between other information and the sensor can be preset, and the identification information of the target sensor is not limited.
For example, in the coal mine production process, a temperature sensor, a methane sensor and a wind speed sensor are provided. The subscribing device 1 needs to acquire the ambient temperature during the production of the coal mine in order to monitor whether the temperature during the production of the coal mine is too high or too low. The subscribing device 2 needs to obtain the methane concentration during the coal mine production process in order to monitor whether the methane content in the air during the coal mine production process exceeds the standard. The subscribing device 3 needs to acquire the wind speed during the production of the coal mine in order to monitor whether the wind speed is too high or too low during the production of the coal mine. Based on this, the subscribing device 1 can subscribe the proxy device to the measurement data of the temperature sensor. The subscribing device 2 may subscribe the proxy device to the measurement data of the methane sensor. The subscribing device 3 may subscribe the proxy device to the measurement data of the wind speed sensor. In this way, after periodically measuring the temperature of the environment in the coal mine production process, the temperature sensor can transmit the measured measurement data to the proxy device, and the proxy device can send the measurement data transmitted by the temperature sensor to the subscribing device 1. Similarly, after periodically measuring the methane concentration in the air during the coal mine production process, the methane sensor can transmit the measured measurement data to the proxy device, and the proxy device can send the measurement data transmitted by the temperature sensor to the subscription device 2. The wind speed sensor can transmit measured data to the proxy device after periodically measuring the wind speed of the environment in the coal mine production process, and the proxy device can transmit the measured data transmitted by the temperature sensor to the subscribing device 3. If, for reasons of improvement of the production environment or other reasons, it is assumed that the subscribing device 3 does not need to monitor the wind speed in the environment any more. At this time, the subscription device 3 may send a subscription cancel message to the proxy device, where the subscription cancel message carries identification information of the wind speed sensor. The proxy device receives the subscription cancellation message sent by the subscribing device 3.
Step S202, determining the target sensor according to the subscription cancellation message.
In the embodiment of the application, after the agent equipment acquires the subscription cancellation message, the agent equipment can analyze the subscription cancellation message to acquire the identification information of the target sensor carried in the subscription cancellation message, so that the target sensor corresponding to the subscription equipment is determined according to the identification information of the target sensor.
Step S203, a second operating state switching command is sent to the target sensor.
The second working state switching instruction is used for indicating that the target sensor is switched from the first working state to the second working state. The first operating state is an operating state in which the target sensor performs data measurement in a first measurement period. The second operating state is an operating state in which the target sensor stops data measurement or performs data measurement in a second measurement period. Wherein the second measurement period is greater than the first measurement period.
In the embodiment of the application, after the proxy device receives the subscription cancellation message sent by the subscription device and determines the target sensor, the subscription device cancels the subscription to the target sensor, which indicates that the measured data measured by the target sensor does not need to be transmitted to other devices, and at the moment, the period of the measured data of the target sensor can be prolonged or the target sensor can be controlled to stop measuring data. The target sensor is preset with a first working state and a second working state. The first working state is a working state for carrying out data measurement in a first measurement period. The target sensor is normally operated in a first operating state when it is normally taking data measurements. The second operating state is an operating state in which the target sensor stops data measurement or performs data measurement in a second measurement period. When the subscribing device stops subscribing the measurement data measured by the target sensor, the target sensor can be switched to a second working state so as to stop data measurement or prolong the period of data measurement, thereby reducing the battery loss and prolonging the working time of the battery in the target sensor. Based on the above, the proxy device may send the second working state switching instruction to the target sensor, so that the target sensor may switch from the first working state to the second working state when receiving the second working state switching instruction.
It should be noted that, in the embodiment of the present application, the first working state and the second working state may be preset in the sensor. And, in setting the second operating state, the setting may be made according to whether the sensor needs to operate for a long period of time. If the sensor needs to operate for a long period of time, the second operating state of the sensor may be set to an operating state in which data measurements are taken in a second measurement period. That is, the sensor monitors parameters for a long time even if no subscription equipment performs data subscription, so as to ensure the safety of industrial production. For example, when no subscription equipment is required to obtain the methane concentration, the methane concentration in the production environment is also monitored in order to improve the life safety of operators in industrial production, and the methane sensor is of a type that requires long-term operation. At this time, the second operating state of the methane sensor may be set to an operating state in which data measurement is performed in the second measurement period.
If the sensor does not need to operate for a long period of time, the second operating state of the sensor may be set to an operating state in which data measurement is stopped. That is, such sensors do not require parameter monitoring when no subscribing device is subscribed to data. For example, the target sensor is a sensor that detects the operating state of the apparatus. In some embodiments, the device ceases to operate and the associated subscribing device ceases to acquire data of the operating state of the device. Since the device has stopped functioning, the object sensor does not need to continue to monitor its relevant parameters of the operating state. Thus, the second operation state thereof can be set to an operation state in which data measurement is stopped.
It should be understood that if the target sensor is of a type requiring long-term operation, then it may be set by the relevant personnel according to the actual need, and the second operating state may be set based on whether it is of a type requiring long-term operation.
It should be noted that the first measurement period and the second measurement period may be set by those skilled in the art according to actual experience, or may be obtained according to a result of big data analysis, which is not limited in the embodiment of the present application.
In some embodiments, the proxy device may support multiple connection modes for connecting with the sensor. For sensors that need to be connected via a fieldbus, the proxy device may be connected to such sensors via the fieldbus. For sensors that need to be connected over a network, the proxy device may connect to such sensors over a network connection. Wherein the network connection comprises an ethernet network connection or a wireless network connection. The proxy device sending a second working state switching instruction to the target sensor comprises: determining a connection mode of the target sensor; and sending a second working state switching instruction to the target sensor according to the connection mode of the target sensor.
That is, the target sensor may be connected to the proxy device via a field bus or a network. Before sending a second working state switching instruction to the target sensor, the proxy equipment determines the connection mode of the target sensor, and sends the second working state switching instruction to the target sensor according to the connection mode of the target sensor. For example, when the target sensor and the proxy device are connected through the network, if the connection is ethernet, the second operation state switching instruction may be sent to the target sensor through the ethernet connection. When the target sensor is connected with the proxy equipment through the field bus, the proxy equipment can send a second working state switching instruction of the target sensor through the field bus. At this time, all devices connected on the field bus can receive the second working state switching instruction, and when detecting that the instruction is not sent to the device, other devices except the target sensor do not respond to the instruction after receiving the second working state switching instruction. And after receiving the second working state switching instruction, the target sensor can perform corresponding working state switching.
In some embodiments, the proxy device may receive at least two subscription cancellation messages, and the identification information of the target sensor carried in the at least two subscription cancellation messages may be the same or different. At this time, the proxy device may determine at least two target sensors according to the received subscription cancellation message, and the proxy device needs to send a second working state switching instruction to the at least two target sensors. Based on this, the proxy device sending a second operating state switching instruction to the target sensor includes: when at least two target sensors exist, determining a connection mode of each target sensor; and respectively sending a second working state switching instruction to the target sensors according to the connection mode of each target sensor.
That is, when the proxy device determines that there are at least two target sensors, the proxy device may determine a connection manner with each target sensor, and send a second working state switching instruction to each target sensor according to the connection manner with each target sensor.
In this way, when the subscription device pauses to acquire the measurement data of the target sensor, the subscription cancellation message is sent to the proxy device, and after the proxy device receives the subscription cancellation message, the target sensor can be determined according to the subscription cancellation message, and a second working state switching instruction is sent to the target sensor, so that the target sensor is switched from the first working state to the second working state. The data measurement frequency of the target sensor in the second operating state is lower than the data measurement frequency of the target sensor in the first operating state. That is, when the subscription cancellation message is received, the target sensor can be controlled to switch to the second working state with a longer measurement period, so that the monitoring period of the target sensor can be prolonged when the target sensor is not required to monitor, or the data measurement can be stopped, the power consumption of the target sensor when the target sensor is not required to monitor data can be reduced, the battery service time of the target sensor can be prolonged, and the industrial production cost can be reduced.
Referring to fig. 3, a flow chart of a data processing method according to an embodiment of the present application is shown. The method is applied to a sensor, as shown in fig. 3, and comprises the following steps:
step S301, a second operating state switching instruction is received.
The second working state switching instruction is used for indicating that the target sensor is switched from a first working state to a second working state, and the first working state is a working state of the target sensor for data measurement in a first measurement period. The second operating state is an operating state in which the target sensor does not perform data measurement or performs data measurement in a second measurement period. Wherein the second measurement period is greater than the first measurement period.
In the embodiment of the application, the target sensor can transmit measurement data through the connection with the proxy equipment. And may receive instructions sent by the proxy device to the target sensor over its connection with the proxy device. When the proxy device sends a second working state switching instruction to the target sensor through connection with the target sensor, the target sensor can receive the second working state switching instruction sent by the proxy device.
Step S302, switching the current working state to a second working state according to a second working state switching instruction, and performing data measurement according to a second measurement period when the second working state is a working state in which data measurement is performed in the second measurement period.
In the embodiment of the application, after receiving the second working state switching instruction, the target sensor can switch the current working state from the first working state to the second working state when the current working state is the first working state. That is, the target sensor knows that the measurement period needs to be prolonged after receiving the second working state. At this time, if the target sensor performs data measurement in the first measurement period, the current operating state may be switched to the second operating state when the second operating state switching instruction is received. For example, when the second operation state is an operation state in which data measurement is stopped, the target sensor stops data measurement when receiving a second operation state switching instruction. When the second working state is data measurement in the second measurement period, the target sensor switches the measurement period from the first measurement period to the second measurement period when receiving a second working state switching instruction, and data measurement is performed in the second measurement period as the period. Because the second measurement period is greater than the first measurement period, when the target sensor switches the current working state to the second working state, the measurement period of data measurement is prolonged, the frequency of data measurement is reduced, the power consumption of the target sensor can be reduced, and the production cost is increased.
When the target sensor performs data measurement in the second measurement period, the measured data of the target sensor is not acquired by the subscription device, so that the measured data measured by the target sensor may not be transmitted to the proxy device any more, or may be continuously transmitted to the proxy device. At this time, after the proxy device receives the measurement data transmitted by the target sensor, since no subscription device needs to acquire the measurement data measured by the target sensor, the proxy device may store the received measurement data in the storage device or delete the received measurement data, and the proxy device does not send the measurement data transmitted by the target sensor to the subscription device.
Referring to fig. 4, a flow chart of another data processing method according to an embodiment of the present application is shown. The present embodiment is described with respect to a scenario in which a subscribing device subscribes a proxy device for a sensor. As shown in fig. 4, the method includes:
step S401, the subscribing device sends a subscribing message to the proxy device. The proxy device receives the subscription message.
The subscription message carries identification information of the target sensor.
In the embodiment of the application, when the subscription equipment needs to acquire the measurement data measured by the sensor, the subscription equipment can inform the proxy equipment of the measurement data of the sensor which needs to be acquired, at the moment, the subscription equipment sends a subscription message to the proxy equipment, and the subscription message contains the identification information of the target sensor, wherein the measurement data measured by the target sensor is the measurement data which needs to be acquired by the subscription equipment.
For example, when the subscription device 1 needs to acquire the measurement data measured by the sensor 1 and the sensor 2, and the subscription device 2 needs to acquire the measurement data measured by the sensor 3, the subscription device 1 sends a subscription message to the proxy device, and the subscription message sent by the subscription device 1 carries the identification information of the sensor 1 and the identification information of the sensor 2. The subscription device 2 sends a subscription message to the proxy device, and the subscription message sent by the subscription device carries the identification information of the sensor 3. The proxy device may receive the subscription message sent by the subscription device 1 and receive the subscription message sent by the subscription device 2.
Step S402, the proxy equipment determines the target sensor according to the subscription information.
In the embodiment of the application, after receiving the subscription information, the proxy equipment can analyze the subscription information to acquire the identification information of the target sensor carried in the subscription information, and determine the target sensor corresponding to the subscription equipment according to the acquired identification information of the target sensor.
As one possible implementation, the proxy device may record the correspondence between the subscribing device and the target sensor. In this way, the proxy device can learn which target sensors the subscribing device needs to acquire measurement data according to the recorded corresponding relationship. When the measurement data transmitted by the target sensor is obtained, the subscription equipment corresponding to the target sensor can be determined through recording information, and the measurement data is sent to the subscription equipment. For example, the proxy device may be provided with a subscription list for each sensor for that sensor. Identification information of subscribing devices subscribed to the sensor is recorded in the subscription list. In this way, after receiving the subscription message sent by the subscription device and analyzing the identification information of the target sensor, the subscription list of the target sensor can be searched according to the identification information of the target sensor, and the identification information of the subscription device is added into the subscription list of the target sensor. Of course, the proxy device may record the correspondence between the sensor and the subscription device in other manners, which is not limited by the present application.
As shown in the above example, after receiving the subscription message sent by the subscription device 1, the proxy device may parse the subscription message sent by the subscription device 1 to obtain the identification information of the sensor 1 and the identification information of the sensor 2 carried in the subscription message. The proxy device may determine the sensor 1 and the sensor 2 as the target sensor corresponding to the subscribing device 1 according to the identification information of the sensor 1 and the identification information of the sensor 2. The proxy device may determine the sensor 3 as the target sensor corresponding to the subscribing device 2 according to the identification information of the sensor 3.
Step S403, the proxy device acquires the subscription status of the target sensor.
In the embodiment of the application, after receiving the subscription information sent by the subscription equipment, the proxy equipment can determine the target sensor through the identification information of the target sensor carried in the subscription information, so that the measurement data of the subscription equipment, which is measured by the target sensor, can be obtained, namely the measurement data of the subscription equipment, which is measured by the target sensor, can be obtained. Since data of one sensor can be subscribed and acquired by a plurality of subscribing devices; when the sensor is not subscribed by any subscription device, the proxy device records that the subscription state of the sensor is an unsubscribed state, and the sensor needs to be controlled to work in a second working state, so that the sensor stops measuring data or reduces the frequency of measuring data. When the sensor is subscribed by at least one subscription device, the proxy device records that the subscription state of the sensor is the subscribed state, and the proxy device controls the sensor to work in a first working state so that the sensor normally performs data measurement. Therefore, when the proxy device receives the subscription message and determines the target sensor, the proxy device needs to detect the current subscription state of the target sensor, so as to control the target sensor to switch the working state when the current subscription state is the unsubscribed state. Based on this, when the proxy device determines the target sensor, the recorded current subscription state of the target sensor can be checked to know whether the target sensor is in an unsubscribed state.
It should be noted that the subscription status is status information that the proxy device records whether the sensors are subscribed by the subscription device, and is recorded by the proxy device according to whether each sensor is subscribed by the subscription device to obtain measurement data. For example, when a sensor is not subscribed to any subscribing device to obtain measurement data, then the subscription status of the sensor is recorded as an unsubscribed status. When a sensor is subscribed by at least one subscribing device to acquire measurement data, the subscribing state of the sensor is recorded as the subscribed state.
As one possible implementation, the proxy device may determine one or more target sensors from the subscription message. For example, the subscription message received by the proxy device may carry identification information of at least one target sensor. The proxy device may determine at least one target sensor from the subscription message. Or the proxy device receives the subscription message sent by the at least one subscription device. The proxy device may determine at least one target sensor based on the received at least one subscription message. The proxy device needs to obtain the subscription status of each of the at least one target sensor.
For example, the subscribing device 1 needs to acquire measurement data measured by the sensor 1, and the subscribing device 2 needs to acquire measurement data measured by the sensor 2. As shown in fig. 5a and 5b, the subscribing device 1 and subscribing device 2 send subscription messages to the proxy device. The subscription information sent by the subscription device 1 to the proxy device carries the identification information of the sensor 1. The subscription information sent by the subscription device 2 to the proxy device carries the identification information of the sensor 2. After receiving the subscription message sent by the subscription device 1, the proxy device can acquire the identification information of the sensor 1 by analyzing the subscription message, so as to determine that the subscription device 1 needs to acquire the measurement data measured by the sensor 1. The proxy device may determine that the target sensor is the sensor 1 based on the identification information of the sensor 1. The proxy device may obtain the recorded subscription status of the sensor 1. Similarly, after receiving the subscription message sent by the subscription device 2, the proxy device can acquire the identification information of the sensor 2 by analyzing the subscription message, so as to determine that the subscription device 2 needs to acquire the measurement data measured by the sensor 2. The proxy device determines that the target sensor is the sensor 2 according to the identification information of the sensor 2, and can acquire the recorded subscription state of the sensor 2.
It should be understood that, since the subscription status includes two statuses, that is, a subscribed status and an unsubscribed status, the proxy device performs different steps according to the acquired subscription status of the target sensor. When the proxy device determines that the subscription status of the target sensor is an unsubscribed status, the following steps S404a-S405a, and steps S406-S408 are performed. When the proxy device determines that the subscription status of the target sensor is the subscribed status, the following step S404b, steps S406 to S408 are performed.
In step S404a, when detecting that the subscription state of the target sensor is an unsubscribed state, the proxy device updates the subscription state of the target sensor from the unsubscribed state to the subscribed state, increases the subscription number of the target sensor by a second preset value, and sends a first working state switching instruction to the target sensor. The target sensor receives a first working state switching instruction.
The first working state switching instruction is used for indicating the target sensor to be switched from the second working state to the first working state.
In the embodiment of the application, when the proxy equipment acquires the subscription state of the target sensor, the proxy equipment can detect the subscription state of the target sensor, and when the subscription state of the target sensor is detected to be unsubscribed, the proxy equipment indicates that the target sensor is not subscribed by other subscription equipment to acquire the measurement data, and the working state of the proxy equipment is the second working state. Since the subscription device needs to acquire the measurement data measured by the target sensor, the proxy device can update the subscription state of the target sensor from the unsubscribed state to the subscribed state, and increase the subscription number of the target sensor by a second preset value, so that several subscription devices are recorded to acquire the measurement data measured by the target sensor. The proxy device may send a first working state switching instruction to the target sensor, so that the working state of the target sensor is switched from the second working state to the first working state, so that the target sensor is in a normal data measurement period, and corresponding data measurement is performed. At this time, the target sensor may receive a first operating state switching instruction sent by the proxy device.
It should be noted that the second preset value is a preset change amount that changes the subscription number each time. The second preset value may be set by those skilled in the art based on actual experience or may be obtained based on the result of big data analysis, which is not limited in the embodiment of the present application. As a possible implementation, the second preset value is 1.
As a possible implementation manner, when the proxy device sends the first working state switching instruction to the target sensor, the working state switching instruction is sent to the target sensor according to the connection mode of the proxy device and the target sensor.
That is, the proxy device and the target sensor may be connected by a field bus, a network, or other means. When the proxy device sends the first working state switching instruction to the target sensor, the proxy device can send the first working state switching instruction according to a connection mode between the proxy device and the target sensor. For example, when the proxy device is connected to the target sensor through the fieldbus, the proxy device sends a first operating state switching instruction of the target sensor to the fieldbus, and the target sensor may receive the first operating state switching instruction through the fieldbus. When the proxy device is connected through a network between the target sensors, for example, through an ethernet network connection or a wireless network connection, the proxy device may send a first operating state switching instruction to the target sensors through the ethernet network connection or the wireless network connection.
When the proxy device is connected with the target sensor through the field bus, the proxy device may receive the first working state switching instruction of the target sensor through the field bus, and the other devices connected to the field bus may not perform corresponding processing when receiving the first working state switching instruction because the first working state switching instruction is sent to the target sensor.
As a possible implementation manner, the proxy device needs to acquire the subscription state of the at least one target sensor after determining the at least one target sensor, and then sends a first working state switching instruction to the at least one target sensor when the subscription state of the at least one target sensor is not subscribed.
As one possible implementation manner, when the target sensor includes at least two, the proxy device sending the first operating state switching instruction to the target sensor includes: when at least two target sensors exist, determining a connection mode of each target sensor; and respectively sending a first working state switching instruction to the target sensors according to the connection mode of each target sensor.
That is, when the object sensor includes at least two, the connection manner between each object sensor and the proxy device may be different. At this time, the proxy device may send a first operation state switching instruction to each target sensor according to the connection manner of each target sensor.
As shown in the above example, referring to fig. 5a, after the proxy device acquires the subscription status of the sensor 1, if the proxy device detects that the subscription status of the sensor 1 is an unsubscribed status and the sensor 1 is connected to the proxy device through a fieldbus, the proxy device may send a first working status switching instruction to the sensor 1 through the fieldbus. The sensor 1 receives a first operating state switching command via the fieldbus. Similarly, after the proxy device acquires the subscription state of the sensor 2, if the proxy device detects that the subscription states of the sensor 2 are all unsubscribed states and the sensor 2 is connected with the proxy device through an ethernet, the proxy device may send a first working state switching instruction to the sensor 2 through the ethernet connection. The sensor 2 receives a first operating state switching instruction through the ethernet.
Step S404b, when the subscription state of the target sensor is subscribed, the proxy device increases the subscription number of the target sensor by a second preset value.
In the embodiment of the application, when the proxy equipment acquires the subscription state of the target sensor, the proxy equipment can detect the subscription state of the target sensor, and when the subscription state of the target sensor is detected to be the subscribed state, the proxy equipment indicates that the target sensor is subscribed by other subscription equipment to acquire measurement data, and the working state of the proxy equipment is the first working state. At this time, the proxy device does not need to send the first working state switching instruction to the target sensor any more, and only needs to increase the subscription number of the target sensor by a second preset value.
As shown in the above example, referring to fig. 5b, after the proxy device acquires the subscription status of the sensor 1, if the proxy device detects that the subscription status of the sensor 1 is an unsubscribed status and the sensor 1 is connected to the proxy device through a fieldbus, the proxy device may send a first working status switching instruction to the sensor 1 through the fieldbus. The sensor 1 receives a first operating state switching command via the fieldbus. After the proxy device acquires the subscription state of the sensor 2, the proxy device detects that the subscription states of the sensor 2 are subscribed states, and the sensor 2 is connected with the proxy device through an Ethernet, so that the proxy device does not need to send a first working state switching instruction to the sensor 2, and increases the subscription number of the sensor 2 by 1 if the second preset value is 1.
Step S405a, the target sensor switches the current working state to the first working state according to the first working state switching command, and performs data measurement according to the first measurement period when the first working state is the working state in which the data measurement is performed in the first measurement period.
In the embodiment of the application, after receiving the first working state switching instruction, the target sensor acquires that the working state is required to be switched from the second working state to the first working state when the target sensor works in the second working state, namely when the target sensor stops data measurement or performs data measurement in the second measurement period, and at the moment, the target sensor can switch the working state to the first working state. That is, the target sensor adjusts its operation state to an operation state in which data measurement is performed with the first measurement period as a period, and performs data measurement in accordance with the first measurement period.
For example, after receiving a first operation state switching instruction sent by the proxy device, the sensor 1 switches its own operation state from the second operation state to the first operation state. Assuming that the second operation state of the sensor 1 is to stop data measurement, after receiving the first operation state switching command, the sensor 1 switches from stopping data measurement to an operation state in which data measurement is performed with the first measurement period as a period, and periodically performs data measurement according to the first measurement period.
Step S406, the proxy device acquires measurement data of the target sensor.
In the embodiment of the application, after the target sensor periodically performs data measurement in the first measurement period, the measured measurement data can be transmitted to the proxy device by the target sensor, so that the proxy device transmits the measurement data to the corresponding subscription device. For example. The target sensor may send the measured measurement data directly to the proxy device, which may obtain the measurement data of the target sensor from the target sensor.
As a possible implementation manner, when the target sensor sends measurement data to the proxy device, the identification information of the target sensor may be added to the measurement data and sent to the proxy device.
As a possible implementation, the proxy device obtains measurement data in different manners according to the connection manner of the proxy device and the target sensor. The specific proxy device obtaining measurement data sent by the target sensor comprises the following steps:
when the target sensor is connected with the proxy device through the field bus, the proxy device queries the target sensor through the field bus to acquire measurement data sent by the target sensor. Or when the target sensor is connected with the proxy device through the network, the proxy device receives measurement data sent by the target sensor through the network connection.
That is, the target sensor and the proxy device are connected through the field bus or through the network, so when the target sensor sends measurement data to the proxy device, if the target sensor and the proxy device are connected through the field bus, the proxy device queries the measurement data of the target sensor through the field bus, and acquires the measurement data of the target sensor. At this time, the proxy device may determine the identification information of the target sensor at the same time when inquiring the measurement data of the target sensor.
When the target sensor is connected with the proxy equipment through the network, the target sensor sends measurement data to the proxy equipment through the network connection, and the proxy equipment receives the measurement data sent by the target sensor through the network connection.
As described above for example, the proxy device needs to query the measurement data of the sensor 1 via the fieldbus. The sensor 1 can then transmit its measured measurement data to the proxy device via the field bus. The sensor 2 may transmit its acquired measurement data to the proxy device via an ethernet connection. The proxy device may receive the measurement data sent by the sensor 1 via a field bus with the sensor 1 and receive the measurement data sent by the sensor 2 via an ethernet connection with the sensor 2.
Step S407, the proxy equipment acquires the identification information of the target sensor, and determines at least one subscription equipment of the target sensor according to the identification information of the target sensor.
In the embodiment of the application, when receiving the subscription information sent by the subscription device, the proxy device can record the corresponding relation between the subscription device and the target sensor when determining the target sensor corresponding to the subscription device. After the proxy device acquires the measurement data of the target sensor, the proxy device can determine the identification information of the target sensor according to the received measurement data, so that the proxy device can search the corresponding relation between the recorded subscription device and the target sensor according to the identification information of the target sensor, and determine at least one subscription device corresponding to the target sensor.
As a possible implementation manner, the measurement data carries the identification information of the target sensor, and after the proxy device receives the measurement data, the measurement data can be analyzed to obtain the identification information of the target sensor.
Of course, the proxy device may also acquire the identification information of the target sensor in this way. For example, when the proxy device establishes a connection with a sensor, identification information of the sensor corresponding to the connection may be recorded at the same time. At this time, when the proxy device receives the measurement data through the connection with the target sensor, the proxy device can record the identification information of the sensor corresponding to the connection, and determine the identification information of the target sensor. Of course, the identification information of the target sensor may be obtained in other manners, which is not limited by the present application.
Step S408, the proxy device sends measurement data to at least one subscription device of the target sensor. At least one subscribing device receives measurement data.
In the embodiment of the application, when the proxy equipment determines at least one subscription equipment of the target sensor, the proxy equipment can send the measurement data of the target sensor to the at least one subscription equipment so that the at least one subscription equipment can acquire the measurement data of the target sensor and perform corresponding processing.
Thus, in the embodiment of the application, the subscription device may send the subscription message to the proxy device, and the proxy device may determine the target sensor according to the subscription message and control the target sensor to perform data measurement in the first working state. And the proxy equipment can support multiple connection modes simultaneously so as to realize connection with the sensors in different connection modes, thereby acquiring the measurement data of the sensors in multiple connection modes, reducing the number of substations and greatly reducing the industrial cost.
Referring to fig. 6, a flowchart of another data processing method according to an embodiment of the present application is shown. This embodiment adds the relevant steps of unsubscribing from the sensor relative to the embodiment described above with respect to fig. 4. As shown in fig. 6, the method includes:
Step S601, the subscribing device sends a subscribing message to the proxy device. The proxy device receives the subscription message.
The details of step S401 are not described herein.
Step S602, the proxy equipment determines the target sensor according to the subscription information.
The details of step S402 are not described herein.
Step S603, the proxy device acquires the subscription status of the target sensor.
The details of step S403 are not described herein.
It should be understood that, since the subscription status includes two statuses, that is, a subscribed status and an unsubscribed status, the proxy device performs different steps according to the acquired subscription status of the target sensor. When the proxy device determines that the subscription status of the target sensor is an unsubscribed status, the following steps S604a-S605a, steps S606-S608 are performed. When the proxy device determines that the subscription status of the target sensor is the subscription status, the following step S604b is performed, steps S606-S608.
Step S604a, when the subscription status of the target sensor is an unsubscribed status, updating the subscription status of the target sensor from the unsubscribed status to a subscribed status, increasing the subscription number of the target sensor by a second preset value, and sending a first working status switching instruction to the target sensor. The target sensor receives a first working state switching instruction.
The first working state switching instruction is used for indicating the target sensor to be switched from the second working state to the first working state.
The details of step S404a are not described herein.
Step S604b, when the subscription state of the target sensor is subscribed, increasing the subscription number of the target sensor by a second preset value.
The details of step S404b are not described herein.
Step S605a, the target sensor switches the current working state to the first working state according to the first working state switching command, and performs data measurement according to the first measurement period when the first working state is the working state in which the data measurement is performed in the first measurement period.
The specific reference to step S405a is not described herein.
Step S606, the proxy device acquires measurement data of the target sensor.
The details of step S406 are not described herein.
Step S607, the proxy device acquires the identification information of the target sensor, and determines at least one subscription device of the target sensor according to the identification information of the target sensor.
The details of step S407 are not described herein.
Step S608, the proxy device sends measurement data to at least one subscription device of the target sensor. At least one subscribing device receives measurement data.
Specific reference to step S408 is omitted herein.
Step S609, the subscribing device sends a subscribing cancel message to the proxy device. The proxy device receives the subscription cancellation message.
The subscription cancellation message carries identification information of the target sensor.
Specific details of step S201 are not described herein.
Step S610, the proxy equipment determines the target sensor according to the subscription cancellation message.
The details of step S202 are not described herein.
As a possible implementation manner, when the proxy device determines the target sensor, since the subscription device no longer needs to acquire the measurement data of the target sensor, the proxy device may delete the recorded correspondence between the subscription device and the target sensor, so that the subscription device does not send the measurement data of the target sensor. For example, the identification information of the subscribing device recorded in the subscription list of the target sensor is deleted.
In step S611, the proxy device obtains the subscription number of the target sensor, and reduces the subscription number of the target sensor by a first preset value.
In the embodiment of the application, after receiving the subscription cancellation message, the proxy device can analyze the subscription message to acquire the identification information of the target sensor carried in the subscription message, so as to determine that the subscription device needs to cancel acquiring the target sensor of the measurement data. Because the target sensor may be subscribed by multiple subscribing devices at the same time, that is, there are multiple subscribing devices that need to acquire measurement data of the target sensor at the same time, when one subscribing device cancels subscribing to measurement data of the target sensor, other subscribing devices need to subscribe to measurement data of the target sensor, so that the target sensor still works in the first working state. When the subscription device is not subscribed to the measurement data of the target sensor, namely when the subscription device is not subscribed to the measurement data of the target sensor, the working state of the target sensor needs to be switched to a second working state so as to reduce the power consumption of the target sensor. Therefore, the subscription number of the target sensor needs to be recorded, when one subscription device is added to subscribe to the test data of the target sensor, the subscription number is increased by a second preset value, and when one subscription device is reduced to subscribe to the test data of the target sensor, the subscription number is reduced by a first preset value. Based on the above, after the proxy device receives the subscription cancellation message sent by the subscription device and determines the target sensor, the proxy device may acquire the subscription number of the target sensor and reduce the subscription number of the target sensor by a first preset value.
As a possible implementation, the first preset value is equal to the second preset value.
As a possible implementation, the first preset value is 1.
Step S612, when the subscription number of the target sensor is equal to or smaller than a preset threshold, the proxy device acquires the subscription state of the target sensor, and updates the subscription state of the target sensor from the subscribed state to an unsubscribed state.
In the embodiment of the application, after the subscription number of the target sensor is reduced by the first threshold, that is, after the subscription number of the target sensor is updated, the proxy device can compare the updated subscription number of the target sensor with the preset threshold. When the subscription number of the target sensor is smaller than or equal to a preset threshold value, the fact that no subscription equipment subscribes to the measurement data of the target sensor is indicated, at this time, the proxy equipment can acquire the recorded subscription state of the target sensor, and the subscription state of the target sensor is updated from the subscribed state to the unsubscribed state.
It should be noted that, when the number of subscription data of the target sensor is greater than the preset threshold, it is indicated that other subscription devices need to acquire measurement data of the target sensor. At this time, step S607 may be re-performed until the subscription data of the target sensor is less than or equal to the preset threshold.
It should be understood that the preset threshold is a threshold set in advance for determining whether or not the subscribing device subscribes to the measurement data of the target sensor. And when the subscription number of the target sensors is larger than a preset threshold value, the subscription equipment is considered to subscribe the measurement data of the target sensors. And when the subscription number of the target sensor is smaller than or equal to a preset threshold value, no subscribing device is considered to subscribe to the measurement data of the target sensor. As a possible implementation, the preset threshold value is 0.
Step S613, when the subscription status of the target sensor is updated from the subscribed status to the unsubscribed status, the proxy device sends a second working status switching instruction to the target sensor. The target sensor receives a second working state switching instruction.
The second working state switching instruction is used for indicating that the target sensor is switched from the first working state to the second working state. The first operating state is an operating state in which the target sensor performs data measurement in a first measurement period. The second operating state is an operating state in which the target sensor does not perform data measurement or performs data measurement in a second measurement period. Wherein the second measurement period is greater than the first measurement period.
In the embodiment of the application, when the updated subscription number of the target sensor is smaller than or equal to the preset threshold value, the subscription state of the target sensor is updated from the subscribed state to the unsubscribed state. At this time, since the subscribing device cancels the subscription of the measurement data of the target sensor and no other subscribing device subscribes to the measurement data of the target sensor, the proxy device may send a second operation state switching instruction to the target sensor, so that the target sensor is switched from the first operation state to the second operation state. The target sensor receives a second working state switching instruction. Specific reference may be made to step S203 and step S301, which are not described herein.
Step S614, the target sensor switches the current working state to the second working state according to the second working state switching instruction, and performs data measurement according to the second measurement period when the second working state is the working state for performing data measurement in the second measurement period.
Specific details of step S302 are not described herein.
Illustratively, the subscribing device 1 needs to obtain the measurement data of the sensor 1, and the subscribing device 2 needs to obtain the measurement data of the sensor 1 and the sensor 2. The subscribing device 3 has subscribed to the measurement data of the sensor 3 and needs to unsubscribe from the measurement data of the sensor 3. At this time, the subscribing device 1 sends a subscription message to the proxy device, the subscription message carrying the identification information of the sensor 1. After receiving the subscription message, the proxy device may parse the identification information of the sensor 1 according to the subscription message, and determine that the subscription device 1 needs to subscribe to the measurement data of the sensor 1. At this time, the proxy device may record the correspondence between the subscribing device 1 and its target sensor. That is, the correspondence relationship between the subscribing device 1 and the sensor 1 is recorded. The proxy device obtains the subscription status of the sensor 1. Assuming that the subscription state of the sensor 1 is an unsubscribed state at this time, when detecting that the subscription state of the sensor 1 is an unsubscribed state, the proxy device updates the subscription state of the sensor 1 from the unsubscribed state to the subscribed state, increases the number of subscriptions of the sensor 1 by 1, and simultaneously sends a first operation state switching instruction to the sensor 1, as shown in fig. 7. It is assumed that in this example, the sensor 1 and the proxy device are connected by a fieldbus, and the proxy device may transmit the first operation state switching command to the sensor 1 via the fieldbus. The sensor 1 receives the first working state switching instruction through the field bus, and the sensor 1 knows that the working state needs to be switched to the first working state after receiving the first working state switching instruction. At this time, the sensor 1 may switch the second operation state to the first operation state, that is, the sensor 1 switches the measurement period to the first measurement period, and starts to perform data measurement with the first measurement period as the period. The proxy device may query the measurement data of the sensor 1 via the fieldbus to obtain the measurement data of the sensor 1. The proxy device can acquire the identification information of the target sensor corresponding to the measurement data as the identification information of the sensor 1 because the proxy device inquires the measurement data of the sensor 1 through the field bus. The proxy device may find the corresponding relationship between the recorded sensor 1 and the subscription device according to the identification information of the sensor 1, and determine that the subscription device of the sensor 1 is the subscription device 1. At this time, the proxy device may transmit the measurement data of the sensor 1 to the subscribing device 1.
Similarly, the subscribing device 2 sends a subscription message to the proxy device. The subscription message carries identification information of the sensor 1 and the sensor 2. After receiving the subscription message, the proxy device may parse the identification information of the sensor 1 and the identification information of the sensor 2 according to the subscription message, and determine that the subscription device 2 needs to subscribe to the measurement data of the sensor 1 and the sensor 2. At this time, the proxy device may record the correspondence between the subscribing device 2 and its target sensor. That is, the correspondence relationship between the subscribing device 2 and the sensor 1 and the sensor 2 is recorded. The proxy device obtains the subscription status of sensor 1 and sensor 2. When the subscription state of the sensor 1 is the subscribed state, the proxy device increases the subscription number of the sensor 1 by 1 when detecting that the subscription state of the sensor 1 is the subscribed state. Assuming that the subscription state of the sensor 2 is not subscribed, when detecting that the subscription state of the sensor 2 is not subscribed, the proxy device updates the subscription state of the sensor 2 from the not subscribed state to the subscribed state, increases the number of subscriptions of the sensor 2 by 1, and simultaneously sends a first operation state switching instruction to the sensor 2, as shown in fig. 7. It is assumed that in this example, the sensor 2 and the proxy device are connected through a wireless network, and the proxy device may transmit the first operation state switching instruction to the sensor 2 through the wireless network connection. The sensor 2 receives the first working state switching instruction through wireless network connection, and the sensor 2 knows that the working state needs to be switched to the first working state after receiving the first working state switching instruction. At this time, the sensor 2 may switch the second operation state to the first operation state, that is, the sensor 2 switches the measurement period to the first measurement period, and starts to perform data measurement with the first measurement period as the period. The proxy device may query the measurement data measured by the sensor 1 through the fieldbus, acquire the measurement data of the sensor 1, and determine the identification information of the sensor 1. The sensor 2 uploads its measured measurement data to the proxy device via a wireless network connection. At this time, the measurement data transmitted from the sensor 2 may carry identification information of the sensor 2. The proxy device may parse the measurement data sent by the sensor 2 to obtain identification information of the sensor 2. The proxy equipment searches the recorded corresponding relation between the sensor 1 and the subscribing equipment according to the identification information of the sensor 1 and the identification information of the sensor 2, and the corresponding relation between the rest of the subscribing equipment of the sensor 2, and determines that the subscribing equipment of the sensor 1 is the subscribing equipment 1 and the subscribing equipment 2, and the subscribing equipment of the sensor 2 is the subscribing equipment 2. At this time, the proxy device may transmit the measurement data of the sensor 1 to the subscribing device 1 and the subscribing device 2, and transmit the measurement data of the sensor 2 to the subscribing device 2.
Since the subscribing device 3 has subscribed to the measurement data of the target sensor 3, the proxy device may send to the subscribing device 3 when acquiring the measurement data of the subscribing device 3. When the subscribing device 3 does not need to acquire the measurement data of the sensor 3, a subscription cancel message is sent to the proxy device. At this time, the proxy device receives the subscription cancellation message, where the subscription cancellation message carries the identification information of the sensor 3, and the proxy device may learn the identification information of the sensor 3 by parsing the subscription cancellation message, that is, to determine that the subscription device 3 needs to cancel the test data of the subscription sensor 3. The proxy device may delete the recorded correspondence between the sensor 3 and the subscribing device 3. The number of subscriptions of the sensor 3 is acquired. Assuming that the number of subscriptions of the sensor 3 is 1, the proxy device decreases the number of subscriptions of the sensor 3 by 1, and at this time, the number of subscriptions of the sensor 3 is 0. After detecting that the subscription number of the sensor 3 is 0, the proxy device knows that the sensor 3 does not subscribe to the measurement data of the sensor 3, updates the subscription state of the sensor 3 from the subscribed state to the unsubscribed state, and sends a second working state switching instruction to the sensor 3. After receiving the second working state switching instruction, the sensor 3 can switch the working state into the second working state, namely, stop data measurement.
It should be noted that, in all embodiments of the present application, the first measurement periods of different sensors may be different or the same, which is not limited by the present application. The second measurement periods of the different sensors may be the same or different, and the application is not limited in this regard.
In this way, when the subscribing device pauses to acquire the measurement data of the target sensor, a subscription cancel message is sent to the first device, after the first device receives the subscription cancel message, the target sensor can be determined according to the subscription cancel message, the subscription state of the target sensor is changed from the subscribed state to the unsubscribed state, and a second working state switching instruction is sent to the target sensor, so that the target sensor is switched from the first working state to the second working state. The data measurement frequency of the target sensor in the second operating state is lower than the data measurement frequency of the target sensor in the first operating state. That is, when the subscription cancellation message is received, the target sensor can be controlled to switch to the second working state with a longer measurement period, so that the monitoring period of the target sensor can be prolonged when the target sensor is not required to monitor, or the data measurement can be stopped, the power consumption of the target sensor when the target sensor is not required to monitor data can be reduced, the battery service time of the target sensor can be prolonged, and the industrial production cost can be reduced.
In the application, the proxy equipment supports the connection of various connection modes with the sensor, and a plurality of proxy equipment is not required to be arranged aiming at the sensors with different connection modes, thereby greatly reducing the use quantity of the proxy equipment and further reducing the industrial production cost.
Referring to fig. 8, a flowchart of another data processing method according to an embodiment of the present application is shown. The embodiment describes a scenario in which subscription and publishing of messages are achieved by subscription devices and proxy devices using MQTT (Message Queuing Telemetry Transport, message queue telemetry transport protocol). Of course, the subscription device and the proxy device may also implement subscription and publishing of the message in other manners, which the present application is not limited to. In the embodiment of the application, the subscription and the release of the information are only realized by adopting the mode of MQTT. As shown in fig. 8, the method includes:
step S801, the subscription device sends subscription information in MQTT format to the proxy device. The proxy device receives subscription messages in MQTT format.
In the embodiment of the application, the subscription device sends the subscription message to the proxy device according to the measurement data of the subscription sensor. At this time, the subscription message sent by the subscription device to the proxy device is a message in MQTT format. The identification information of the target sensor carried in the subscription message is target subscription subject information.
It should be noted that, the corresponding relationship between each sensor and the subscription topic information may be preset at the subscription device side, so that when the subscription device needs to acquire the measurement data of which sensor, the corresponding subscription topic information may be determined.
The details of step S401 are not described herein.
Step S802, the proxy equipment determines the target sensor according to the subscription information in the MQTT format.
In the embodiment of the application, the subscription message received by the proxy equipment is a message in the MQTT format, and the identification information of the target sensor carried in the subscription message is the target subscription subject information of the subscription equipment. At this time, the proxy equipment acquires mapping information between a preset sensor and subscription subject information; and determining the target sensor according to the target subscription topic information and the mapping information between the preset sensor and the subscription topic information.
That is, mapping information between the sensor and the subscription topic information is preset in the proxy device, and after the proxy device acquires the target subscription topic information, the proxy device can search the mapping information between the preset sensor and the subscription topic information, so that the target sensor corresponding to the target subscription topic information can be determined.
As a possible implementation manner, after the proxy device parses the target subscription topic information from the subscription message, the proxy device may record a correspondence between the subscription device carrying the target subscription topic information in the sent subscription message and the target subscription topic information.
It should be noted that, each sensor is provided with corresponding subscription topic information, which may be the same or different. Can be set according to actual requirements, and the application is not limited to this.
Step 803, the proxy device acquires the subscription status of the target sensor.
The details of step S403 are not described herein.
It should be understood that, since the subscription status includes two statuses, that is, a subscribed status and an unsubscribed status, the proxy device performs different steps according to the acquired subscription status of the target sensor. When the proxy device determines that the subscription status of the target sensor is an unsubscribed status, the following steps S604a-S605a, steps S606-S608 are performed. When the proxy device determines that the subscription status of the target sensor is the subscription status, the following step S604b is performed, steps S606-S608.
Step S804a, when the subscription status of the target sensor is an unsubscribed status, updating the subscription status of the target sensor from the unsubscribed status to a subscribed status, increasing the subscription number of the target sensor by a second preset value, and sending a first working status switching instruction to the target sensor. The target sensor receives a first working state switching instruction.
The first working state switching instruction is used for indicating the target sensor to be switched from the second working state to the first working state.
The details of step S404a are not described herein.
Step S804b, when the subscription status of the target sensor is subscribed, increasing the subscription number of the target sensor by a second preset value.
The details of step S404b are not described herein.
Step S805a, the target sensor switches the current working state to the first working state according to the first working state switching instruction, and performs data measurement according to the first measurement period when the first working state is the working state in which the data measurement is performed in the first measurement period.
The specific reference to step S405a is not described herein.
Step S806, the proxy device acquires measurement data of the target sensor.
The details of step S406 are not described herein.
Step S807, the proxy device acquires the identification information of the target sensor, and determines at least one subscription device of the target sensor according to the identification information of the target sensor.
In the embodiment of the application, after receiving the measurement data sent by the target sensor, the proxy device needs to send the measurement data to the corresponding subscription device. At this time, the proxy equipment determines target subscription topic information according to the target sensor and the mapping information between the preset sensor and the subscription topic information; at least one subscribing device is determined based on the target subscription topic information.
That is, the proxy device may acquire the measurement data sent by which target sensor after receiving the measurement data, and find mapping information between the preset sensor and the subscription subject information, so as to determine target subscription subject information corresponding to the target sensor. The proxy device can determine at least one subscription device corresponding to the target subscription topic information according to the corresponding relation between the recorded subscription topic information and the subscription devices.
Step S808, the proxy device transmits measurement data to at least one subscription device of the target sensor. At least one subscribing device receives measurement data.
In the embodiment of the application, after determining at least one subscription device corresponding to the target subscription topic information, the proxy device can convert the received measurement data of the target sensor into the message in the MQTT format and send the message to the at least one subscription device.
As one possible implementation, the proxy device sending measurement data to at least one subscribing device of the target sensor includes: generating a target release message according to the target subscription subject information and the measurement data sent by the target sensor; the targeted publication message is sent to at least one subscribing device.
That is, after determining at least one subscription device corresponding to the target subscription topic information, the proxy device may generate a target publishing message with the MQTT format from the target subscription topic information and the measurement data sent by the target sensor. The targeted publication message is sent to at least one subscribing device. After at least one subscription device receives the target release message, the target release message can be analyzed to obtain target subscription subject information and measurement data in the target release message, so that the received measurement data can be obtained as to which target subscription subject information is, and corresponding processing can be performed.
Step S809, the subscription device sends a subscription cancellation message in MQTT format to the proxy device. The proxy device receives the MQTT formatted subscription cancellation message.
The subscription cancellation message carries identification information of the target sensor.
In the embodiment of the application, the subscription cancellation message is a message in the MQTT format, and the identification information of the target sensor is target subscription subject information. That is, when the subscription device does not need to acquire the related data of the target subscription topic information, the subscription cancellation message is sent to the proxy device. The subscription cancellation message carries the target subscription topic information. The proxy device receives the subscription cancellation message.
And step 810, the proxy equipment determines the target sensor according to the subscription cancellation message in the MQTT format.
In the embodiment of the application, after receiving the subscription cancellation message, the proxy equipment can analyze the subscription cancellation message, and further can acquire the target subscription topic information. The proxy equipment can acquire mapping information between the preset sensor and the subscription topic information, search the mapping information between the preset sensor and the subscription topic information according to the target subscription topic information, and determine the target sensor corresponding to the target subscription topic information.
As a possible implementation manner, when the proxy device determines the target sensor, since the subscription device no longer needs to acquire the measurement data of the target sensor, the proxy device may delete the recorded correspondence between the subscription device and the target subscription topic information, so that the measurement data of the target sensor is not transmitted to the subscription device.
In step S811, the proxy device acquires the subscription number of the target sensor, and reduces the subscription number of the target sensor by a first preset value.
Specific reference to step S611 is omitted here.
In step S812, when the subscription number of the target sensor is equal to or less than the preset threshold, the proxy device acquires the subscription state of the target sensor, and updates the subscription state of the target sensor from the subscribed state to the unsubscribed state.
Specific reference to step S612 is omitted herein.
Step S813, when the subscription status of the target sensor is updated from the subscribed status to the unsubscribed status, the proxy device sends a second operation status switching instruction to the target sensor. The target sensor receives a second working state switching instruction.
The details of step S613 are not described herein.
Step S814, the target sensor switches the current working state to the second working state according to the second working state switching command, and performs data measurement according to the second measurement period when the second working state is the working state in which the data measurement is performed in the second measurement period.
Specific details of step S302 are not described herein.
Fig. 9 is a schematic structural diagram of a proxy device according to an embodiment of the present application. As shown in fig. 9, the proxy device includes:
the subscription publishing service module 901 is configured to receive the subscription cancellation message and send the subscription cancellation message to the subscription management module 902.
The subscription cancellation message carries identification information of the target sensor;
a subscription management module 902, configured to determine a target sensor according to the subscription cancellation message; and sending a second working state switching instruction to the target sensor.
The second working state switching instruction is used for indicating that the target sensor is switched from the first working state to the second working state. The first operating state is an operating state in which the target sensor performs data measurement in a first measurement period. The second operating state is an operating state in which the target sensor does not perform data measurement or performs data measurement in a second measurement period. Wherein the second measurement period is greater than the first measurement period.
As a possible implementation manner, the subscription management module 902 is configured to determine, when there are at least two target sensors, a connection manner of each target sensor; and respectively sending a second working state switching instruction to the target sensors according to the connection mode of each target sensor.
The method for respectively sending the working state switching instruction to the target sensors according to the connection mode of each target sensor comprises the following steps:
when the target sensor is connected with the proxy equipment through the field bus, a working state switching instruction is sent to the target sensor through the field bus; or when the target sensor is connected with the proxy equipment through the network, sending a working state switching instruction to the target sensor through the network connection.
As one possible implementation, the network connection comprises an ethernet network connection or a wireless network connection.
As a possible implementation manner, the subscription management module 902 is configured to obtain a subscription number of the target sensor, and reduce the subscription number of the target sensor by a first preset value; and when the subscription number of the target sensor is equal to or smaller than a preset threshold value, acquiring the subscription state of the target sensor, and updating the subscription state of the target sensor from the subscribed state to the unsubscribed state. And when the subscription state of the target sensor is updated from the subscribed state to the unsubscribed state, sending a second working state switching instruction to the target sensor.
As a possible implementation, the subscription publishing service module 901 is configured to receive a subscription message. And sends a subscription message to subscription management module 902.
The subscription message carries identification information of the target sensor.
The subscription management module 902 is configured to determine the target sensor according to the subscription message. And acquiring the subscription state of the target sensor. When the subscription state of the target sensor is an unsubscribed state, updating the subscription state of the target sensor from the unsubscribed state to a subscribed state, increasing the subscription number of the target sensor by a second preset value, and sending a first working state switching instruction to the target sensor.
The first working state switching instruction is used for indicating the target sensor to be switched from the second working state to the first working state.
As a possible implementation manner, the subscription management module 902 is configured to determine, when there are at least two target sensors, a connection manner of each target sensor; and respectively sending a first working state switching instruction to the target sensors according to the connection mode of each target sensor.
The method for respectively sending the working state switching instruction to the target sensors according to the connection mode of each target sensor comprises the following steps:
when the target sensor is connected with the proxy equipment through the field bus, a working state switching instruction is sent to the target sensor through the field bus; or when the target sensor is connected with the proxy equipment through the network, sending a working state switching instruction to the target sensor through the network connection.
As a possible implementation manner, the subscription management module 902 is configured to increase the subscription number of the target sensor by a second preset value when the subscription state of the target sensor is subscribed.
As a possible implementation manner, as shown in fig. 10, the proxy device further includes:
The subscription publishing client module 903 is configured to obtain measurement data of the target sensor, and send the measurement data to the subscription publishing service module 901.
The subscription and release service module 901 is configured to obtain identification information of a target sensor, and determine at least one subscription device of the target sensor according to the identification information of the target sensor; the measurement data is sent to at least one subscribing device of the target sensor.
As a possible implementation manner, the subscription publishing client module 903 is configured to query the target sensor through the fieldbus when the target sensor is connected to the proxy device through the fieldbus, and obtain measurement data of the target sensor; or when the target sensor is connected with the proxy equipment through the network, the measurement data sent by the target sensor is received through the network connection.
As a possible implementation manner, the proxy device implements a subscription function of the subscription device to sensor measurement data through an MQTT protocol. At this time, the subscription publishing service module 901 integrates the functions of the MQTT service end. The subscription publishing client module 903 integrates the function of the MQTT client. The identification information of the target sensor includes target subscription topic information.
The subscription information and the subscription cancellation information are all information in the MQTT format.
At this time, the subscription management module 902 is configured to obtain mapping information between a preset sensor and subscription topic information; and determining the target sensor according to the target subscription topic information and the mapping information between the preset sensor and the subscription topic information.
As a possible implementation manner, the subscription publishing service module 901 is configured to determine target subscription topic information according to the target sensor and mapping information between the preset sensor and the subscription topic information; determining at least one subscribing device according to the target subscription topic information; generating a target release message according to the target subscription subject information and the measurement data sent by the target sensor; the targeted publication message is sent to at least one subscribing device.
Wherein the target published message comprises a message in message queue telemetry transport MQTT format.
Fig. 11 is a schematic structural diagram of a sensor according to an embodiment of the present application. As shown in fig. 11, the sensor includes:
the receiving module 1101 is configured to receive a second operating state switching instruction.
The second working state switching instruction is used for indicating that the target sensor is switched from the first working state to the second working state. The first operating state is an operating state in which the target sensor performs data measurement in a first measurement period. The second operating state is an operating state in which the target sensor does not perform data measurement or performs data measurement in a second measurement period. Wherein the second measurement period is greater than the first measurement period.
And the processing module 1102 is configured to switch the current working state to a second working state according to a second working state switching instruction, and perform data measurement according to a second measurement period when the second working state is a working state in which data measurement is performed in the second measurement period.
As a possible implementation manner, the receiving module 1101 is configured to receive a first operating state switching instruction.
The first working state switching instruction is used for indicating the target sensor to be switched from the second working state to the first working state.
The processing module 1102 is configured to switch the current working state to a first working state according to the first working state switching instruction, and perform data measurement according to the first measurement period when the first working state is a working state in which data measurement is performed in the first measurement period.
As a possible implementation, as shown in fig. 12, the sensor further includes:
a sending module 1103, configured to send the measurement data to the proxy device.
FIG. 13 is a schematic diagram illustrating a data processing system according to an embodiment of the present application. As shown in fig. 13, the data processing system includes a proxy device 1301, at least one sensor 1302, and at least one subscribing device 1303.
Wherein the proxy device 1301 is connected to at least one sensor 1302 and at least one subscribing device 1303.
At least one subscribing device 1303 for sending a subscribe cancellation message to proxy device 1301. The subscription cancellation message carries identification information of the target sensor.
The proxy device 1301 includes the proxy device described in the above embodiment; the at least one sensor comprises the sensor described in the above embodiments.
As a possible implementation, the at least one subscribing device 1303 is further configured to send a request message to the proxy device 1301. The subscription message carries identification information of the target sensor.
Corresponding to the embodiment, the application also provides electronic equipment. Fig. 14 is a schematic structural diagram of an electronic device according to an embodiment of the present application, where the electronic device 1400 may include: processor 1401, memory 1402, and communication unit 1403. The components may communicate via one or more buses, and it will be appreciated by those skilled in the art that the configuration of the server as shown in the drawings is not limiting of the embodiments of the application, and that it may be a bus-like structure, a star-like structure, or include more or fewer components than shown, or may be a combination of certain components or a different arrangement of components.
Wherein the communication unit 1403 is configured to establish a communication channel, so that the storage device may communicate with other devices. Receiving user data sent by other devices or sending user data to other devices.
The processor 1401 is a control center of the storage device, connects various parts of the entire electronic device using various interfaces and lines, and performs various functions of the electronic device and/or processes data by running or executing software programs and/or modules stored in the memory 1402, and invoking data stored in the memory. The processor may be comprised of integrated circuits (integrated circuit, ICs), such as a single packaged IC, or may be comprised of packaged ICs that connect multiple identical or different functions. For example, the processor 1401 may include only a central processing unit (central processing unit, CPU). In the embodiment of the invention, the CPU can be a single operation core or can comprise multiple operation cores.
The memory 1402 for storing the execution instructions of the processor 1401, the memory 1402 may be implemented by any type of volatile or non-volatile memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
The execution of the instructions in memory 1402, when executed by processor 1401, enables electronic device 1400 to perform some or all of the steps of the embodiments illustrated in fig. 2 or 3.
In a specific implementation, the present invention further provides a storage medium, where the storage medium may store a program, where the program may include some or all of the steps in each embodiment of the data processing method provided by the present invention when the program is executed. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (random access memory, RAM), or the like.
It will be apparent to those skilled in the art that the techniques of embodiments of the present invention may be implemented in software plus a necessary general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be embodied in essence or what contributes to the prior art in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the embodiments or some parts of the embodiments of the present invention.
The same or similar parts between the various embodiments in this specification are referred to each other. In particular, for the device embodiment and the terminal embodiment, since they are substantially similar to the method embodiment, the description is relatively simple, and reference should be made to the description in the method embodiment for relevant points.

Claims (27)

1. A data processing method, applied to a proxy device, the method comprising:
receiving a subscription cancellation message; the subscription cancellation message carries identification information of the target sensor;
determining a target sensor according to the subscription cancellation message;
sending a second working state switching instruction to the target sensor; the second working state switching instruction is used for indicating the target sensor to be switched from the first working state to the second working state; the first working state is a working state that the target sensor performs data measurement in a first measurement period; the second working state is a working state that the target sensor stops data measurement or performs data measurement in a second measurement period; wherein the second measurement period is greater than the first measurement period.
2. The method of claim 1, wherein prior to said sending a second operating state switching instruction to said target sensor, said method further comprises:
Acquiring the subscription number of the target sensor, and reducing the subscription number of the target sensor by a first preset value;
when the subscription number of the target sensors is equal to or smaller than a preset threshold value, acquiring subscription states of the target sensors, and updating the subscription states of the target sensors from subscribed states to unsubscribed states;
the sending the second working state switching instruction to the target sensor comprises the following steps:
and when the subscription state of the target sensor is updated from the subscribed state to the unsubscribed state, sending a second working state switching instruction to the target sensor.
3. The method as recited in claim 2, further comprising:
receiving a subscription message; the subscription information carries the identification information of the target sensor;
determining the target sensor according to the subscription message;
acquiring a subscription state of the target sensor;
when the subscription state of the target sensor is an unsubscribed state, updating the subscription state of the target sensor from the unsubscribed state to a subscribed state, increasing the subscription number of the target sensor by a second preset value, and sending a first working state switching instruction to the target sensor; the first working state switching instruction is used for indicating the target sensor to be switched from the second working state to the first working state.
4. A method according to claim 3, further comprising:
and when the subscription state of the target sensor is subscribed, increasing the subscription number of the target sensor by a second preset value.
5. The method as recited in claim 4, further comprising:
acquiring measurement data of a target sensor;
acquiring identification information of the target sensor, and determining at least one subscription device of the target sensor according to the identification information of the target sensor;
the measurement data is sent to at least one subscribing device of the target sensor.
6. The method of claim 5, wherein sending an operating state switching instruction to the target sensor, wherein the operating state switching instruction comprises a first operating state switching instruction or a second operating state switching instruction, comprising:
when at least two target sensors exist, determining a connection mode of each target sensor;
and respectively sending working state switching instructions to the target sensors according to the connection mode of each target sensor.
7. The method of claim 6, wherein the sending the operating state switching command to each of the target sensors according to the connection mode of the target sensor includes:
When the target sensor is connected with the proxy equipment through a field bus, sending a working state switching instruction to the target sensor through the field bus; or,
when the target sensor is connected with the proxy equipment through a network, a working state switching instruction is sent to the target sensor through the network connection.
8. The method of claim 7, wherein the acquiring measurement data of the target sensor comprises:
when the target sensor is connected with the proxy equipment through a field bus, the proxy equipment inquires the target sensor through the field bus to acquire measurement data of the target sensor; or,
and when the target sensor is connected with the proxy equipment through a network, receiving measurement data sent by the target sensor through the network connection.
9. The method according to claim 7 or 8, wherein the network connection comprises: an ethernet connection or a wireless network connection.
10. A data processing method, applied to a sensor, the method comprising:
receiving a second working state switching instruction; the second working state switching instruction is used for indicating the target sensor to be switched from the first working state to the second working state; the first working state is a working state that the target sensor performs data measurement in a first measurement period; the second working state is a working state that the target sensor does not perform data measurement or performs data measurement in a second measurement period; wherein the second measurement period is greater than the first measurement period;
And switching the current working state into a second working state according to the second working state switching instruction, and carrying out data measurement according to a second measurement period when the second working state is a working state for carrying out data measurement according to the second measurement period.
11. The method as recited in claim 10, further comprising:
receiving a first working state switching instruction; the first working state switching instruction is used for indicating the target sensor to be switched from the second working state to the first working state;
and switching the current working state into a first working state according to the first working state switching instruction, and carrying out data measurement according to a first measurement period when the first working state is a working state for carrying out data measurement according to the first measurement period.
12. The method according to claim 10 or 11, further comprising:
the measurement data is sent to the proxy device.
13. A proxy device, comprising:
the subscription publishing service module is used for receiving the subscription cancellation message and sending the subscription cancellation message to the subscription management module; the subscription cancellation message carries identification information of the target sensor;
The subscription management module is used for determining a target sensor according to the subscription cancellation message;
sending a second working state switching instruction to the target sensor; the second working state switching instruction is used for indicating the target sensor to be switched from the first working state to the second working state; the first working state is a working state that the target sensor performs data measurement in a first measurement period; the second working state is a working state that the target sensor does not perform data measurement or performs data measurement in a second measurement period; wherein the second measurement period is greater than the first measurement period.
14. The proxy device of claim 13, wherein,
the subscription management module is used for acquiring the subscription number of the target sensor and reducing the subscription number of the target sensor by a first preset value;
when the subscription number of the target sensors is equal to or smaller than a preset threshold value, acquiring subscription states of the target sensors, and updating the subscription states of the target sensors from subscribed states to unsubscribed states;
the subscription management module is configured to send a second working state switching instruction to the target sensor when the subscription state of the target sensor is updated from the subscribed state to the unsubscribed state.
15. The proxy device of claim 14, wherein,
the subscription publishing service module is used for receiving the subscription information and sending the subscription information to the subscription management module; the subscription information carries the identification information of the target sensor;
the subscription management module is used for determining the target sensor according to the subscription information;
acquiring a subscription state of the target sensor;
when the subscription state of the target sensor is an unsubscribed state, updating the subscription state of the target sensor from the unsubscribed state to a subscribed state, increasing the subscription number of the target sensor by a second preset value, and sending a first working state switching instruction to the target sensor; the first working state switching instruction is used for indicating the target sensor to be switched from the second working state to the first working state.
16. The proxy device of claim 15, wherein,
the subscription management module is configured to increase the subscription number of the target sensor by a second preset value when the subscription state of the target sensor is subscribed.
17. The proxy device of claim 16, further comprising:
The subscription and release client module is used for acquiring the measurement data of the target sensor and sending the measurement data sent by the target sensor to the subscription and release service module;
the subscription and release service module is used for acquiring the identification information of the target sensor and determining at least one subscription device of the target sensor according to the identification information of the target sensor;
the measurement data is sent to at least one subscribing device of the target sensor.
18. The proxy device of claim 17, wherein,
the subscription management module is used for determining the connection mode of each target sensor when at least two target sensors exist;
according to the connection mode of each target sensor, respectively sending a working state switching instruction to the target sensor; the working state switching instruction comprises: a first operating state switching instruction or a second operating state switching instruction.
19. The proxy device of claim 18, wherein,
the subscription management module is used for sending a working state switching instruction to the target sensor through a field bus when the target sensor is connected with the proxy equipment through the field bus; or,
When the target sensor is connected with the proxy equipment through a network, a working state switching instruction is sent to the target sensor through the network connection.
20. The proxy device of claim 19, wherein,
the subscription publishing client module is used for inquiring the target sensor through a field bus when the target sensor is connected with the proxy equipment through the field bus, and acquiring measurement data of the target sensor; or,
and when the target sensor is connected with the proxy equipment through a network, receiving measurement data sent by the target sensor through the network connection.
21. A proxy device according to claim 19 or 20, wherein the network connection comprises: an ethernet connection or a wireless network connection.
22. A sensor, comprising:
the receiving module is used for receiving a second working state switching instruction; the second working state switching instruction is used for indicating the target sensor to be switched from the first working state to the second working state; the first working state is a working state that the target sensor performs data measurement in a first measurement period; the second working state is a working state that the target sensor does not perform data measurement or performs data measurement in a second measurement period; wherein the second measurement period is greater than the first measurement period;
And the processing module is used for switching the current working state into a second working state according to the second working state switching instruction, and carrying out data measurement according to a second measurement period when the second working state is the working state for carrying out data measurement according to the second measurement period.
23. The sensor of claim 22, wherein the sensor is configured to,
the receiving module is used for receiving a first working state switching instruction; the first working state switching instruction is used for indicating the target sensor to be switched from the second working state to the first working state;
the processing module is used for switching the current working state into a first working state according to the first working state switching instruction, and carrying out data measurement according to a first measurement period when the first working state is the working state for carrying out data measurement according to the first measurement period.
24. The sensor of claim 22 or 23, further comprising:
and the sending module is used for sending the measurement data to the proxy equipment.
25. A data processing system, comprising: proxy device, at least one sensor and at least one subscription device;
the proxy equipment is connected with at least one sensor and at least one subscription equipment;
At least one subscribing device for sending a subscription cancellation message to the proxy device; the subscription cancellation message carries identification information of the target sensor;
the proxy device comprising the proxy device of any one of claims 13-21; the at least one sensor comprising the sensor of any one of claims 22-24.
26. An electronic device comprising a processor and a memory, the memory storing a computer program that, when executed, causes the electronic device to perform the method of any one of claims 1-9 or to perform the method of any one of claims 10-12.
27. A storage medium comprising a stored program, wherein the program, when run, controls a device on which the storage medium is located to perform the method of any one of claims 1-9 or to perform the method of any one of claims 10-12.
CN202210610499.2A 2022-05-31 2022-05-31 Data processing method, device, equipment, storage medium and system Pending CN117201525A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202210610499.2A CN117201525A (en) 2022-05-31 2022-05-31 Data processing method, device, equipment, storage medium and system
PCT/CN2023/095783 WO2023231837A1 (en) 2022-05-31 2023-05-23 Data processing method and apparatus, and device, storage medium and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210610499.2A CN117201525A (en) 2022-05-31 2022-05-31 Data processing method, device, equipment, storage medium and system

Publications (1)

Publication Number Publication Date
CN117201525A true CN117201525A (en) 2023-12-08

Family

ID=88983758

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210610499.2A Pending CN117201525A (en) 2022-05-31 2022-05-31 Data processing method, device, equipment, storage medium and system

Country Status (2)

Country Link
CN (1) CN117201525A (en)
WO (1) WO2023231837A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117714528B (en) * 2024-02-01 2024-04-12 深圳市灰度科技有限公司 Device information acquisition method, system, device and medium based on UDP broadcast

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103853609A (en) * 2012-12-03 2014-06-11 联想(北京)有限公司 Signal processing method and device
CN104808522A (en) * 2015-03-02 2015-07-29 小米科技有限责任公司 State switching method and device
CN106933210A (en) * 2017-03-03 2017-07-07 联想(北京)有限公司 Apparatus control method, device, system and many equipment work systems
CN107340014A (en) * 2017-08-31 2017-11-10 广东美的制冷设备有限公司 Detection method, device and the computer-readable recording medium of multisensor
CN112911012A (en) * 2021-02-07 2021-06-04 珠海市一微半导体有限公司 Robot sensor data distribution and subscription system, chip and robot
CN113204219A (en) * 2021-04-20 2021-08-03 吉林师范大学 Industrial controller for intelligent manufacturing
CN113971045A (en) * 2021-09-13 2022-01-25 北京小米移动软件有限公司 Control method, control device and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017156718A1 (en) * 2016-03-15 2017-09-21 深圳迈瑞生物医疗电子股份有限公司 Operating mode switching method, wireless sensor and system
JP6910986B2 (en) * 2018-04-06 2021-07-28 株式会社東芝 Sensor system
CN109788536B (en) * 2019-01-24 2022-07-12 深圳绿米联创科技有限公司 Sensor control method, sensor control device, sensor, and storage medium
CN114741256B (en) * 2020-09-09 2022-11-25 华为终端有限公司 Sensor monitoring method and device and terminal equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103853609A (en) * 2012-12-03 2014-06-11 联想(北京)有限公司 Signal processing method and device
CN104808522A (en) * 2015-03-02 2015-07-29 小米科技有限责任公司 State switching method and device
CN106933210A (en) * 2017-03-03 2017-07-07 联想(北京)有限公司 Apparatus control method, device, system and many equipment work systems
CN107340014A (en) * 2017-08-31 2017-11-10 广东美的制冷设备有限公司 Detection method, device and the computer-readable recording medium of multisensor
CN112911012A (en) * 2021-02-07 2021-06-04 珠海市一微半导体有限公司 Robot sensor data distribution and subscription system, chip and robot
CN113204219A (en) * 2021-04-20 2021-08-03 吉林师范大学 Industrial controller for intelligent manufacturing
CN113971045A (en) * 2021-09-13 2022-01-25 北京小米移动软件有限公司 Control method, control device and storage medium

Also Published As

Publication number Publication date
WO2023231837A1 (en) 2023-12-07

Similar Documents

Publication Publication Date Title
CN108803552B (en) Monitoring system and monitoring method for equipment fault
US8718707B2 (en) Devices, systems, and methods for communicating with rooftop air handling units and other HVAC components
CN102549521A (en) Power management system, power management device, network management device, information processing device, program, power management method, and information processing method
CN104777762A (en) Vehicle-mounted system monitoring method and terminal thereof
CN111890933A (en) Battery management method and system for vehicle, vehicle and server
CN117201525A (en) Data processing method, device, equipment, storage medium and system
EP3771192A1 (en) State monitoring device, state monitoring system, state monitoring method, and recording medium
CN111813699B (en) Data routing test method and device based on intelligent electric meter and computer equipment
CN110913362A (en) Method and device for realizing wireless signal test through client and test equipment
CN105578122A (en) Monitoring prompt method based on router, apparatus and electronic equipment thereof
CN112804311A (en) Intelligent traffic operation and maintenance terminal, system and method based on Internet of things
KR102576610B1 (en) AI Breaker Remote Monitoring Control System and Method thereof
US20200227926A1 (en) Remote connectivity using a battery
JP2010067000A (en) System for replacing deteriorated or failed battery
CN111343700A (en) Wireless sensor network communication method
JP2020095362A (en) Remote monitoring system
KR101754210B1 (en) Module based energy storage system that can extend dynamic function in real time and method thereof
CN112070380B (en) Power consumption inspection management system and control method based on NB-IoT
US20210318383A1 (en) Lifetime battery tracking using a wireless interface
CN111371618A (en) Data processing method and gateway
CN114374889A (en) Water quality monitoring system
KR101263375B1 (en) Apparatus and method for power control
KR20090003983A (en) Method of transmitting screen for remote-monitoring of hmi system using opc
US20200412809A1 (en) Monitoring system with low power data acquisition
CN111504452A (en) Monitoring apparatus and vibration abnormality determination method

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