WO2023231837A1 - Data processing method and apparatus, and device, storage medium and system - Google Patents

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

Info

Publication number
WO2023231837A1
WO2023231837A1 PCT/CN2023/095783 CN2023095783W WO2023231837A1 WO 2023231837 A1 WO2023231837 A1 WO 2023231837A1 CN 2023095783 W CN2023095783 W CN 2023095783W WO 2023231837 A1 WO2023231837 A1 WO 2023231837A1
Authority
WO
WIPO (PCT)
Prior art keywords
target sensor
working state
subscription
sensor
measurement
Prior art date
Application number
PCT/CN2023/095783
Other languages
French (fr)
Chinese (zh)
Inventor
代贝
吴正
王元发
郑文文
韩霞光
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023231837A1 publication Critical patent/WO2023231837A1/en

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

Definitions

  • This application relates to the technical field of industrial security monitoring, and specifically to a data processing method, device, equipment, storage medium and system.
  • existing safety monitoring systems usually include various sensors and substations.
  • various sensors are set at locations where parameter monitoring is required to monitor corresponding environmental parameters and production parameters.
  • a temperature sensor is used to monitor the temperature in the production environment
  • a methane sensor is used to monitor the concentration of methane in the production environment
  • a wind speed sensor is used to monitor the wind speed in the production environment.
  • the sensor uses a battery to power it, and the sensor remains active as long as it is turned on. When the equipment that the sensor needs to test stops running and is not working, the sensor is still in normal working condition and consumes more power, which reduces the working time of the battery and increases the cost of industrial production.
  • this application provides a data processing method, device, equipment, storage medium and system to help solve the problem of high industrial production costs in the existing technology.
  • embodiments of the present application provide a data processing method, which is applied to a proxy device.
  • the method includes:
  • the subscription cancellation message carries identification information of the target sensor
  • the first measurement period is a working state in which data measurement is performed; the second working state is a working 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. cycle.
  • the method before sending the second working state switching instruction to the target sensor, the method further includes:
  • the subscription number of the target sensor When the subscription number of the target sensor is equal to or less than the preset threshold, obtain the subscription status of the target sensor, and update the subscription status of the target sensor from the subscribed status to the unsubscribed status;
  • Sending a second working state switching instruction to the target sensor includes:
  • a possible implementation method of the first aspect also includes:
  • the subscription message carries identification information of the target sensor
  • the subscription state of the target sensor is an unsubscribed state
  • the subscription state of the target sensor is updated from an unsubscribed state to a subscribed state
  • the subscription number of the target sensor is increased by a second preset value
  • the target sensor sends a first working state switching instruction; the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state.
  • a possible implementation method of the first aspect also includes:
  • the subscription number of the target sensor is increased by a second preset value.
  • a possible implementation method of the first aspect also includes:
  • the measurement data is sent to at least one subscribing device of the target sensor.
  • a possible implementation of the first aspect is to send a working state switching instruction to the target sensor, where the working state switching instruction includes a first working state switching instruction or a second working state switching instruction, including:
  • a working state switching instruction is sent to the target sensor respectively.
  • sending a working state switching instruction to each target sensor according to the connection mode of each target sensor includes:
  • the target sensor When the target sensor and the agent device are connected through the field bus, the The target sensor sends a working state switching instruction; or,
  • obtaining the measurement data of the target sensor includes:
  • the agent device queries the target sensor through the field bus and obtains the measurement data of the target sensor; or,
  • the measurement data sent by the target sensor is received through the network connection.
  • the network connection includes: an Ethernet network connection or a wireless network connection.
  • embodiments of the present application provide a data processing method, applied to sensors, and the method includes:
  • the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state;
  • the first working state is that the target sensor performs a first measurement cycle The working state of data measurement;
  • the second working state is a working 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;
  • the current working state is switched to the second working state, and when the second working state is the working state of performing data measurement with the second measurement cycle, the data is measured according to the second measurement cycle. Measurement.
  • a possible implementation method of the second aspect also includes:
  • the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state;
  • the current working state is switched to the first working state, and when the first working state is a working state in which data measurement is performed with the first measurement cycle, data is measured according to the first measurement cycle. Measurement.
  • a possible implementation method of the second aspect also includes:
  • a proxy device including:
  • a subscription publishing service module configured to receive a subscription cancellation message and send the subscription cancellation message to the subscription management module; the subscription cancellation message carries the identification information of the target sensor;
  • a subscription management module configured to determine the target sensor according to the subscription cancellation message
  • the first measurement period is a working state in which data measurement is performed; the second working state is a working 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.
  • the subscription management module is configured to obtain the subscription number of the target sensor and reduce the subscription number of the target sensor by a first preset value
  • the subscription number of the target sensor When the subscription number of the target sensor is equal to or less than the preset threshold, obtain the subscription status of the target sensor, and update the subscription status of the target sensor from the subscribed status to the unsubscribed status;
  • 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.
  • the subscription publishing service module is configured to receive a subscription message and send the subscription message to a subscription management module; the subscription message carries identification information of the target sensor;
  • the subscription management module is used to determine the target sensor according to the subscription message
  • the subscription state of the target sensor is an unsubscribed state
  • the subscription state of the target sensor is updated from an unsubscribed state to a subscribed state
  • the subscription number of the target sensor is increased by a second preset value
  • the target sensor sends a first working state switching instruction; the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state.
  • the subscription management module is configured to increase the subscription number of the target sensor by a second preset value when the subscription status of the target sensor is subscribed.
  • a possible implementation method of the third aspect also includes:
  • the subscription publishing client module is used to obtain the measurement data of the target sensor and send the measurement data sent by the target sensor to the subscription publishing service module;
  • the subscription publishing service module is used to obtain the identification information of the target sensor, and determine at least one subscription device of the target sensor based on the identification information of the target sensor;
  • the measurement data is sent to at least one subscribing device of the target sensor.
  • the subscription management module is configured to determine the connection mode of each target sensor when there are at least two target sensors;
  • a working state switching instruction is sent to the target sensor respectively;
  • the working state switching instruction includes: a first working state switching instruction or a second working state switching instruction.
  • the subscription management module is configured to send a working state switching instruction to the target sensor through the field bus when the target sensor and the agent device are connected through a field bus; or ,
  • the subscription publishing client module is configured to query the target sensor through the field bus and obtain the information of the target sensor when the target sensor and the agent device are connected through a field bus. measurement data; or,
  • the measurement data sent by the target sensor is received through the network connection.
  • the subscription publishing client module is configured to query the target sensor through the field bus and obtain the information of the target sensor when the target sensor and the agent device are connected through a field bus. measurement data; or,
  • the measurement data sent by the target sensor is received through the network connection.
  • the network connection includes: an Ethernet network connection or a wireless network connection.
  • a sensor including:
  • a receiving module configured to receive a second working state switching instruction; the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state; the first working state is when the target sensor
  • the first measurement period is a working state in which data measurement is performed; the second working state is a working 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;
  • a processing module configured to switch the current working state to the second working state according to the second working state switching instruction, and when the second working state is the working state of performing data measurement with the second measurement cycle, perform the processing according to the second working state.
  • Data measurement is performed in two measurement cycles.
  • the receiving module is used to receive a first working state switching instruction; the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state;
  • the processing module is configured to switch the current working state to the first working state according to the first working state switching instruction, and when the first working state is the working state of performing data measurement with the first measurement cycle, Data measurement is performed according to the first measurement cycle.
  • a possible implementation method of the fourth aspect also includes:
  • the sending module is used to send measurement data to the agent device.
  • embodiments of the present application provide a data processing system, including: an agent device, at least one sensor and at least one subscription device;
  • the agent device is connected to at least one sensor and at least one subscription device;
  • At least one subscription device configured to send a subscription cancellation message to the agent device; the subscription cancellation message carries identification information of the target sensor;
  • the proxy device includes the proxy device described in any one of the above third aspects; the at least one sensor includes the sensor described in any one of the above fourth aspects.
  • embodiments of the present application provide an electronic device, including a processor and a memory.
  • the memory stores a computer program.
  • the electronic device causes the electronic device to execute any one of the above first aspects.
  • inventions of the present application provide a storage medium.
  • the storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute any one of the steps described in the first aspect. method, or perform the method described in any one of the above second aspects.
  • the solution provided by the embodiment of this application is used to receive the subscription cancellation message; the subscription cancellation message carries the identification information of the target sensor; determine the target sensor according to the subscription cancellation message; and send a second working state switching instruction to the target sensor.
  • the subscribing device pauses to obtain the measurement data of the target sensor, it sends a subscription cancellation message to the first device.
  • the first device can determine the target sensor based on the subscription cancellation message and send a message to the target sensor.
  • Send a second working state switching command so that the target sensor Switch from the first working state to the second working state.
  • the data measurement frequency of the target sensor in the second working state is lower than the data measurement frequency of the target sensor in the first working state.
  • the target sensor when receiving the subscription cancellation message, can be controlled to switch to the second working state with a longer measurement period, so that when the target sensor is not needed for monitoring, the monitoring period of the target sensor can be extended, or the data measurement can be stopped, reducing the The power consumption of the target sensor when data monitoring is not required extends the battery life of the target sensor and reduces industrial production costs.
  • Figure 1 is a schematic diagram of a scene where a sensor is connected to a substation according to an embodiment of the present application
  • Figure 2 is a schematic flow chart of a data processing method provided by an embodiment of the present application.
  • Figure 3 is a schematic flow chart of another data processing method provided by an embodiment of the present application.
  • Figure 4 is a schematic flow chart of another data processing method provided by an embodiment of the present application.
  • Figure 5a is a schematic scenario diagram of a data processing method provided by an embodiment of the present application.
  • Figure 5b is a schematic diagram of a scenario of another data processing method provided by an embodiment of the present application.
  • Figure 6 is a schematic flow chart of another data processing method provided by an embodiment of the present application.
  • Figure 7 is a schematic diagram of a scenario of another data processing method provided by an embodiment of the present application.
  • Figure 8 is a schematic flow chart of another data processing method provided by an embodiment of the present application.
  • Figure 9 is a schematic structural diagram of a proxy device provided by an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of another proxy device provided by an embodiment of the present application.
  • Figure 11 is a schematic structural diagram of a sensor provided by an embodiment of the present application.
  • Figure 12 is a schematic structural diagram of another sensor provided by an embodiment of the present application.
  • Figure 13 is a schematic structural diagram of a data processing system provided by an embodiment of the present application.
  • Figure 14 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • a sensor (English name: transducer/sensor) is a detection device that can sense the measured information and convert the sensed information into electrical signals or other required forms of information output according to certain rules to meet the needs of the information Requirements for transmission, processing, storage, display, recording and control.
  • existing safety monitoring systems usually include various sensors, substations and data service equipment, as shown in Figure 1.
  • various sensors are set at locations where parameter monitoring is required to monitor corresponding environmental parameters and production parameters.
  • a temperature sensor is used to monitor the temperature in the production environment
  • a methane sensor is used to monitor the concentration of methane in the production environment
  • a wind speed sensor is used to monitor the wind speed in the production environment.
  • the sensor uses a battery to power it, and the sensor remains active as long as it is turned on. When the sensor's measurement data is not subscribed, the sensor is still in normal working condition, consuming more power, reducing the battery's working time, and increasing industrial production costs.
  • the data transmission methods between different sensors and substations are not exactly the same.
  • some sensors and substations are connected through fieldbus to realize data transmission.
  • the temperature sensor and substation are connected through fieldbus.
  • Some sensors and sub-stations realize data transmission through Ethernet or wireless network connections.
  • the methane sensor and the sub-station are connected through the Ethernet network, and the wind speed sensor and the sub-station are connected through the wireless network.
  • a sub-station corresponding to the connection mode is set for each connection mode sensor, so that the sensor can transmit data to the sub-station through the connection mode it supports. As a result, a larger number of substations need to be set up, further increasing the cost of industrial production.
  • embodiments of the present application provide a data processing method, device, equipment, storage medium and system to receive a subscription cancellation message; the subscription cancellation message carries the identification information of the target sensor; according to the subscription cancellation message, the target sensor is determined ;Send the second working state switching instruction to the target sensor.
  • the subscribing device pauses to obtain the measurement data of the target sensor, it sends a subscription cancellation message to the first device.
  • the first device can determine the target sensor based on the subscription cancellation message and send a message to the target sensor. Send a second working state switching instruction so that the target sensor switches from the first working state to the second working state.
  • the data measurement frequency of the target sensor in the second working state is lower than the data measurement frequency of the target sensor in the first working state. That is, when receiving the subscription cancellation message, the target sensor can be controlled to switch to the second working state with a longer measurement period, so that when the target sensor is not needed for monitoring, the monitoring period of the target sensor can be extended, or the data measurement can be stopped, reducing the The power consumption of the target sensor when data monitoring is not required extends the battery life of the target sensor and reduces industrial production costs. The details are explained below.
  • FIG 2 is a schematic flow chart of a data processing method provided by an embodiment of the present application. This method is applied to the proxy device, as shown in Figure 2.
  • the method includes:
  • Step S201 Receive a subscription cancellation message.
  • the subscription cancellation message carries the identification information of the target sensor.
  • the proxy device in order to improve the safety of industrial production during the industrial production process, it is necessary to periodically measure parameters of the surrounding environment or the operating status of important equipment in the production process through sensors. Due to the simple structure of the sensor, its function is single, its computing power is poor, and it generally does not have storage function. Therefore, it is necessary to Transmit the measurement data of periodic measurements to other devices for processing.
  • the proxy device establishes connections with different sensors, so that the sensors can transmit their periodically measured measurement data to the proxy device.
  • Other data service devices can subscribe to the proxy device for the measurement data of the sensors they require. At this time, the other data service devices can be called subscribing devices.
  • the proxy device When the proxy device obtains the measurement data of different sensors periodically measured, it can send the corresponding sensor periodic measurement measurement data to each subscribing device based on the measurement data of the required sensors subscribed by each subscribing device. If due to production needs, it is necessary to stop the operation of certain devices or no longer pay attention to certain parameters in the environment, etc., the relevant subscription device can stop obtaining the measurement data measured by the relevant sensors. At this time, the subscription device can send a subscription cancellation message to the agent device. .
  • the subscription cancellation message carries the identification information of the target sensor.
  • the target sensor is a sensor for which the subscribing device no longer obtains measurement data.
  • the proxy device can receive subscription cancellation messages sent by the subscribing device.
  • the identification information of the target sensor is information used to identify the target sensor.
  • it can be the identification number (Identity document, ID) of the target sensor, or the name of the target sensor, or it can also have a mapping relationship with the sensor.
  • Other information for example, when there is a mapping relationship between the subscription topic information and the sensor, the identification information of the target sensor can also be the subscription topic information, etc.
  • the mapping relationship between other information and the sensor can be set in advance. This application does not limit the identification information of the target sensor.
  • Subscribing device 1 needs to obtain the ambient temperature during the coal mine production process in order to monitor whether the temperature is too high or too low during the coal mine production process.
  • Subscription 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 exceeds the standard during the coal mine production process.
  • Subscribing device 3 needs to obtain the wind speed during the coal mine production process in order to monitor whether the wind speed is too high or too low during the coal mine production process. Based on this, the subscribing device 1 can subscribe to the proxy device for the measurement data of the temperature sensor.
  • the subscribing device 2 may subscribe to the proxy device for measurement data of the methane sensor.
  • the subscribing device 3 may subscribe to the proxy device for measurement data of the wind speed sensor.
  • the temperature sensor periodically measures the temperature of the environment in the coal mine production process, it can transmit its measured measurement data to the agent device, and the agent device can send the measurement data transmitted by the temperature sensor to the subscribing device 1.
  • the methane sensor periodically measures the methane concentration in the air during the coal mine production process, it can transmit its measurement data to the agent device, and the agent device can send the measurement data transmitted by the temperature sensor to the subscribing device 2.
  • the wind speed sensor After the wind speed sensor periodically measures the wind speed of the environment in the coal mine production process, it can transmit its measured measurement data to the agent device, and the agent device can send the measurement data transmitted by the temperature sensor to the subscribing device 3. If due to the improvement of the production environment or other reasons, it is assumed that the subscription device 3 no longer needs to monitor the wind speed in the environment. At this time, the subscription device 3 may send a subscription cancellation message to the agent device, and the subscription cancellation message carries the identification information of the wind speed sensor. The proxy device receives the subscription cancellation message sent by the subscribing device 3.
  • Step S202 Determine the target sensor according to the subscription cancellation message.
  • the proxy device can parse the subscription cancellation message to obtain the identification information of the target sensor carried in the subscription cancellation message, thereby determining the target sensor corresponding to the subscription device based on the identification information of the target sensor.
  • Step S203 Send a second working state switching instruction to the target sensor.
  • the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state.
  • the first working state is a working state in which the target sensor performs data measurement in a first measurement period.
  • the second working state is a working 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.
  • the proxy device after the proxy device receives the subscription cancellation message sent by the subscribing device and determines the target sensor, since the subscribing device cancels the subscription to the target sensor, it means that the measurement data measured by the target sensor does not need to be transmitted to other devices. , at this time, the period of measurement data of the target sensor can be extended 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 in which data measurement is performed in a first measurement cycle. When the target sensor performs normal data measurement, it usually works in the first working state.
  • the second working state is a working state in which the target sensor stops data measurement or performs data measurement in a second measurement period.
  • the target sensor can switch to the second working state to stop data measurement or extend the period of data measurement to reduce battery consumption and extend the working time of the battery in the target sensor.
  • the proxy device can send a second working state switching instruction to the target sensor, so that the target sensor can switch from the first working state to the second working state after receiving the second working state switching instruction.
  • the first working state and the second working state may be preset in the sensor.
  • the setting can be made according to whether the sensor needs to work for a long time. If the sensor needs to work for a long time, the second working state of this type of sensor can be set to the working state of performing data measurement in the second measurement cycle. That is, even if this type of sensor does not subscribe to a device for data subscription, it must monitor parameters for a long time to ensure the safety of industrial production.
  • the methane concentration sensor needs to obtain the methane concentration when there is no subscription equipment. In order to improve the life safety of workers in industrial production, it is also necessary to monitor the methane concentration in the production environment.
  • the methane sensor is a type that requires long-term operation. At this time, the second working state of the methane sensor can be set to the working state of performing data measurement in the second measurement period.
  • the second working state of this type of sensor can be set to a working state that stops data measurement. That is, this type of sensor does not need to perform parameter monitoring when there is no subscribing device for data subscription.
  • the target sensor is a sensor that detects the operating status of the equipment.
  • the relevant subscribing device stops obtaining data on the running status of the device. Since the device has stopped running, the target sensor does not need to continue to monitor relevant parameters of its working status. Therefore, its second working state can be set to a working state that stops data measurement.
  • the target sensor is of a type that requires long-term operation can be set by relevant personnel according to actual needs, and based on whether it is of a type that requires long-term operation, its second working state can be set.
  • first measurement period and the second measurement period can be set by those skilled in the art based on actual experience, or obtained based on the results of big data analysis, which are not limited in the embodiments of the present application.
  • the proxy device may support multiple connection methods to connect to the sensor.
  • the agent device can connect to such sensors via fieldbus.
  • the agent device can connect to such sensors through a network connection.
  • the network connection includes an Ethernet connection or a wireless network connection.
  • the proxy device sending the second working state switching instruction to the target sensor includes: determining the connection mode of the target sensor; and sending the second working state switching instruction to the target sensor according to the connection mode of the target sensor.
  • the connection between the target sensor and the agent device may be a fieldbus or a network connection.
  • the agent device 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 agent device are connected through a network, assuming an Ethernet connection, the second working state switching instruction can be sent to the target sensor through the Ethernet connection.
  • the agent device can send the second working state switching instruction of the target sensor through the field bus.
  • all devices connected to the field bus can receive the second working state switching command.
  • other devices except the target sensor detect that the command is not sent to themselves and do not respond to the command. command to respond.
  • the target sensor can perform corresponding working state switching.
  • 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.
  • the proxy device can determine at least two target sensors based on the received subscription cancellation message, and the proxy device needs to send a second working state switching instruction to at least two target sensors.
  • the agent device sending the second working state switching instruction to the target sensor includes: when there are at least two target sensors, determining the connection mode of each target sensor; according to the connection mode of each target sensor, sending the third working state switching instruction to the target sensor respectively. 2.
  • Working state switching instructions includes: when there are at least two target sensors, determining the connection mode of each target sensor; according to the connection mode of each target sensor, sending the third working state switching instruction to the target sensor respectively. 2.
  • the proxy device when the proxy device determines that there are at least two target sensors, the proxy device can determine the connection mode with each target sensor, and send the second working status to each target sensor according to the connection mode with each target sensor. Switch command.
  • the subscribing device when it pauses to obtain the measurement data of the target sensor, it sends a subscription cancellation message to the agent device. After receiving the subscription cancellation message, the agent device can determine the target sensor based on the subscription cancellation message and send the third message to the target sensor.
  • the second working state switching instruction is to switch the target sensor from the first working state to the second working state.
  • the data measurement frequency of the target sensor in the second working state is lower than the data measurement frequency of the target sensor in the first working state.
  • the target sensor when receiving the subscription cancellation message, can be controlled to switch to the second working state with a longer measurement period, so that when the target sensor is not needed for monitoring, the monitoring period of the target sensor can be extended, or the data measurement can be stopped, reducing the The power consumption of the target sensor when data monitoring is not required extends the battery life of the target sensor and reduces industrial production costs.
  • FIG 3 is a schematic flow chart of a data processing method provided by an embodiment of the present application. This method is applied to the sensor, as shown in Figure 3.
  • the method includes:
  • Step S301 Receive a second working state switching instruction.
  • the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state.
  • the first working state is a working state in which the target sensor performs data measurement in the first measurement period.
  • the second working state is a working state in which the target sensor does not perform data measurement or performs data measurement in a second measurement cycle. Wherein, the second measurement period is greater than the first measurement period.
  • the target sensor can transmit measurement data through a connection with the proxy device. And can receive the instructions sent by the agent device to the target sensor through its connection with the agent device.
  • the proxy device sends a second working state switching instruction to the target sensor through the connection with the target sensor
  • the target sensor may receive the second working state switching instruction sent by the proxy device.
  • Step S302 Switch the current working state to the second working state according to the second working state switching instruction. state, and when the second working state is the working state of performing data measurement with the second measurement cycle, perform data measurement according to the second measurement cycle.
  • the target sensor after receiving the second working state switching instruction, can switch the current working state from the first working state to the second working state when its current working state is the first working state. That is, after receiving the second working state, the target sensor learns that the measurement cycle needs to be extended. At this time, if the target sensor performs data measurement in the first measurement cycle, it can switch the current working state to the second working state when receiving the second working state switching instruction. For example, when the second working state is the working state of stopping data measurement, the target sensor stops data measurement when receiving the second working state switching instruction.
  • the target sensor When the second working state is to perform data measurement with the second measurement cycle, when the target sensor receives the second working state switching instruction, it switches the measurement cycle from the first measurement cycle to the second measurement cycle, and uses the second measurement cycle to perform data measurement. Data measurements are performed period by period. Since 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 extended and the frequency of data measurement is reduced, thereby reducing the consumption of the target sensor. power and increase production costs.
  • the target sensor performs data measurement in the second measurement period
  • the measurement data measured by the target sensor is not obtained by the subscribing device. Therefore, the measurement data measured by the target sensor may no longer be transmitted to the proxy device, or it may be transmitted to the proxy device in the second measurement period. The measurement data measured during the second measurement cycle continue to be transmitted to the agent device.
  • the proxy device can store the received measurement data in the storage device or delete the received measurement data. The proxy device no longer sends measurement data transmitted by this target sensor to the subscribing device.
  • FIG 4 is a schematic flow chart of another data processing method provided by an embodiment of the present application. This embodiment describes a scenario in which a subscribing device subscribes to a sensor from a proxy device. As shown in Figure 4, the method includes:
  • Step S401 The subscribing device sends a subscription message to the proxy device.
  • the proxy device receives subscription messages.
  • the subscription message carries identification information of the target sensor.
  • the subscribing device when the subscribing device needs to obtain the measurement data measured by the sensor, it can inform the agent device of the measurement data of the sensor it needs to obtain. At this time, the subscribing device sends a subscription message to the agent device, and the subscription message contains The identification information of the target sensor, where the measurement data measured by the target sensor is the measurement data that the subscribing device needs to obtain.
  • subscribing device 1 needs to obtain the measurement data measured by sensor 1 and sensor 2, and subscribing device 2 needs to obtain the measurement data measured by sensor 3. Then subscribing device 1 sends a subscription message to the proxy device, and the subscription message sent by subscribing device 1 carries There is identification information of sensor 1 and identification information of sensor 2.
  • the subscribing device 2 sends a subscription message to the proxy device, and the subscription message sent by the subscribing device carries the identification information of the sensor 3 .
  • the proxy device can receive the subscription message sent by the subscribing device 1 and the subscription message sent by the subscribing device 2.
  • Step S402 The agent device determines the target sensor according to the subscription message.
  • the proxy device after receiving the subscription message, can parse the subscription message to obtain the identification information of the target sensor carried in the subscription message, and determine the target sensor corresponding to the subscription device based on the obtained identification information of the target sensor.
  • the proxy device can record the correspondence between the subscribing device and the target sensor. In this way, the agent device can learn which targets the subscribing device needs to obtain based on the recorded correspondence. Sensor measurement data.
  • the subscribing device corresponding to the target sensor can be determined by recording the information, and the measurement data can be sent to the subscribing device.
  • the proxy device may be configured with a subscription list for each sensor. The identification information of the subscribing device that subscribes to the sensor is recorded in the subscription list.
  • the subscription list of the target sensor can be found based on the identification information of the target sensor, and the identification information of the subscribing device is added to the target in the sensor's subscription list.
  • the proxy device can also record the correspondence between the sensor and the subscribing device in other ways, and this application does not limit this.
  • the proxy device can parse the subscription message sent by the subscribing device 1 and obtain the identification information of sensor 1 and the identification information of sensor 2 carried in it.
  • the proxy device can determine sensor 1 and sensor 2 as the target sensors corresponding to the subscribing device 1 based on the identification information of sensor 1 and the identification information of sensor 2.
  • the proxy device can determine sensor 3 as the target sensor corresponding to subscribing device 2 based on the identification information of sensor 3.
  • Step S403 The proxy device obtains the subscription status of the target sensor.
  • the proxy device after receiving the subscription message sent by the subscribing device, can determine the target sensor through the identification information of the target sensor carried in the subscription message, thereby knowing that the subscribing device needs to subscribe to the measurement data measured by the target sensor. , that is, to know that the subscribing device needs to obtain the measurement data measured by the target sensor. Since the data of a sensor can be subscribed and obtained by multiple subscribing devices; when the sensor is not subscribed by any subscribing device, the proxy device records the sensor's subscription status as unsubscribed, and needs to control the sensor to work in the second job status, so that the sensor stops measuring data or reduces the frequency of measuring data.
  • the proxy device When a sensor is subscribed by at least one subscribing device, the proxy device records the subscription status of the sensor as a subscribed status, and the proxy device controls the sensor to work in the first working state so that the sensor can perform data measurement normally. Therefore, when the agent device receives the subscription message and determines the target sensor, it needs to detect the current subscription status of the target sensor, so as to control the target sensor to switch working status when the current subscription status is unsubscribed. Based on this, when the proxy device determines a target sensor, it can check the recorded current subscription status of the target sensor to learn whether the target sensor is in an unsubscribed state.
  • the subscription status is the status information of the proxy device that records whether the sensor is subscribed by the subscribing device. It is recorded by the proxy device to obtain measurement data based on whether each sensor is subscribed by the subscribing device. For example, when a sensor is not subscribed by any subscribing device to obtain measurement data, the subscription status of the sensor is recorded as unsubscribed. When a sensor is subscribed by at least one subscribing device to obtain measurement data, the subscription status of the sensor is recorded as a subscribed status.
  • the agent device may determine one or more target sensors based on the subscription message.
  • the subscription message received by the proxy device may carry identification information of at least one target sensor.
  • the agent device can determine at least one target sensor based on the subscription message.
  • the proxy device receives a subscription message sent by at least one subscribing device.
  • the agent device may determine at least one target sensor based on at least one subscription message received.
  • the agent device needs to obtain the subscription status of each target sensor in at least one target sensor.
  • subscribing device 1 needs to obtain the measurement data measured by sensor 1
  • subscribing device 2 needs to obtain the measurement data measured by sensor 2.
  • subscription device 1 and subscription device 2 send subscription messages to the proxy device.
  • the subscription message sent by the subscribing device 1 to the agent device carries the identification of the sensor 1 information.
  • the subscription message sent by the subscribing device 2 to the agent device carries the identification information of the sensor 2 .
  • the agent device can learn the identification information of the sensor 1 by parsing the subscription message, and then determine that the subscribing device 1 needs to obtain the measurement data measured by the sensor 1.
  • the agent device can determine that the target sensor is Sensor 1 based on the identification information of Sensor 1 .
  • the agent device can obtain the recorded subscription status of sensor 1.
  • the proxy device can learn the identification information of the sensor 2 by parsing the subscription message, and then determine that the subscribing device 2 needs to obtain the measurement data measured by the sensor 2.
  • the proxy device determines that the target sensor is sensor 2 based on the identification information of sensor 2, and can obtain the recorded subscription status of sensor 2.
  • the proxy device determines that the subscription status of the target sensor is the unsubscribed status, it executes the following steps S404a-S405a and steps S406-S408.
  • the proxy device determines that the subscription status of the target sensor is the subscribed status, the following steps S404b and S406-S408 are executed.
  • Step S404a When detecting that the subscription status of the target sensor is the unsubscribed status, the proxy device updates the subscription status of the target sensor from the unsubscribed status to the subscribed status, increases the subscription number of the target sensor by the second preset value, and adds The target sensor sends a first working state switching instruction. The target sensor receives the first working state switching instruction.
  • the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state.
  • the proxy device when the proxy device obtains the subscription status of the target sensor, it can detect the subscription status of the target sensor. When it detects that the subscription status of the target sensor is unsubscribed, it means that the target sensor has not been subscribed by other subscribing devices. Measurement data, its working state is the second working state. Since the subscribing device needs to obtain the measurement data measured by the target sensor, the proxy device can update the subscription status of the target sensor from the unsubscribed status to the subscribed status, and increase the subscription number of the target sensor by the second preset value, so that It is recorded that several subscribing devices subscribe to obtain the measurement data measured by the target sensor.
  • the agent device can send a first working state switching instruction to the target sensor, so that the working state of the target sensor switches from the second working state to the first working state, so that the target sensor is in a normal data measurement cycle and performs corresponding data measurement.
  • the target sensor can receive the first working state switching instruction sent by the proxy device.
  • the second preset value is a preset change amount each time the subscription quantity is changed.
  • the second preset value can be set by those skilled in the art based on actual experience, or obtained based on the results of big data analysis, which is not limited in the embodiments of the present application. As a possible implementation, the second preset value is 1.
  • the agent device when the agent device sends the first working state switching instruction to the target sensor, it sends the working state switching instruction to the target sensor according to the connection mode between the agent device and the target sensor.
  • the connection method between the agent device and the target sensor can be a fieldbus connection, a network connection, or other ways of connection.
  • the agent device may send the first working state switching instruction according to the connection mode with the target sensor. For example, when the agent device and the target sensor are connected through a field bus, the agent device sends the first working state switching instruction of the target sensor to the field bus, and the target sensor can receive the first working state switching instruction through the field bus.
  • the proxy device is connected to the target sensor through a network, such as an Ethernet connection or a wireless network connection , the agent device can send the first working state switching instruction to the target sensor through the Ethernet network connection or the wireless network connection.
  • agent device and the target sensor are connected through the field bus
  • agent device when the agent device sends the first working state switching instruction of the target sensor through the field bus, other devices connected on the field bus can also receive the instruction, because the first The working state switching instruction is sent to the target sensor, so when other devices receive the first working state switching instruction, they do not perform corresponding processing.
  • the proxy device after determining at least one target sensor, the proxy device needs to obtain the subscription status of at least one target sensor, and then when the subscription status of at least one target sensor is unsubscribed, send the first message to the at least one target sensor.
  • Working status switching instructions after determining at least one target sensor, the proxy device needs to obtain the subscription status of at least one target sensor, and then when the subscription status of at least one target sensor is unsubscribed, send the first message to the at least one target sensor.
  • the agent device when the target sensor contains at least two, sends the first working state switching instruction to the target sensor including: when there are at least two target sensors, determining the connection mode of each target sensor; according to The connection mode of each target sensor sends a first working state switching instruction to the target sensor respectively.
  • the connection method between each target sensor and the proxy device may be different.
  • the proxy device can send a first working state switching instruction to each target sensor according to the connection mode of each target sensor.
  • the proxy device after the proxy device obtains the subscription status of sensor 1, assuming that the proxy device detects that the subscription status of sensor 1 is unsubscribed, and the sensor 1 and the proxy device are connected through a field bus, then The agent device can send the first working state switching instruction to the sensor 1 through the field bus. Sensor 1 receives the first working state switching instruction through the field bus.
  • the proxy device after the proxy device obtains the subscription status of sensor 2, assuming that the proxy device detects that the subscription status of sensor 2 is unsubscribed, and the sensor 2 and the proxy device are connected through the Ethernet network, the proxy device can connect to the sensor through the Ethernet network. Sensor 2 sends a first working state switching instruction. Sensor 2 receives the first working state switching instruction through the Ethernet network.
  • Step S404b When the subscription status of the target sensor is subscribed, the proxy device increases the subscription number of the target sensor by the second preset value.
  • the proxy device when the proxy device obtains the subscription status of the target sensor, it can detect the subscription status of the target sensor. When it detects that the subscription status of the target sensor is the subscribed status, it means that the target sensor has been subscribed by other subscribing devices. Obtain measurement data, and its working state is the first working state. At this time, the proxy device no longer needs to send the first working state switching instruction to the target sensor, and only needs to increase the subscription number of the target sensor by the second preset value.
  • the proxy device obtains the subscription status of sensor 1, assuming that the proxy device detects that the subscription status of sensor 1 is unsubscribed, and the sensor 1 and the proxy device are connected through a field bus, then The agent device can send the first working state switching instruction to the sensor 1 through the field bus. Sensor 1 receives the first working state switching instruction through the fieldbus.
  • the proxy device obtains the subscription status of sensor 2, assuming that the proxy device detects that the subscription status of sensor 2 is the subscribed status, and the sensor 2 and the proxy device are connected through the Ethernet network, the proxy device does not need to send the first working status to sensor 2.
  • Switching instruction assuming that the second preset value is 1, the agent device increases the subscription number of sensor 2 by 1.
  • Step S405a The target sensor switches the current working state to the first working state according to the first working state switching instruction, and when the first working state is the working state of performing data measurement with the first measurement period, according to Data measurement is performed in the first measurement cycle.
  • the target sensor after the target sensor receives the first working state switching instruction, when it works in the second working state, that is, when the target sensor stops data measurement or performs data measurement in the second measurement cycle, the target sensor After receiving the first working state switching instruction, it is learned that the working state needs to be switched from the second working state to the first working state. At this time, the target sensor can switch its working state to the first working state. That is, the target sensor adjusts its working state to a working state in which the data is measured with the first measurement cycle as a cycle, and the data is measured according to the first measurement cycle.
  • the sensor 1 switches its own working state from the second working state to the first working state. Assuming that the second working state of sensor 1 is to stop data measurement, after receiving the first working state switching instruction, sensor 1 switches from stopping data measurement to the working state of performing data measurement with the first measurement cycle as the cycle. According to the second A measurement cycle performs data measurement periodically.
  • Step S406 The agent device obtains the measurement data of the target sensor.
  • the target sensor after the target sensor periodically performs data measurement in the first measurement period, it can transmit its measured measurement data to the proxy device, so that the proxy device transmits the measurement data to the corresponding subscribing device.
  • the target sensor can send measured measurement data directly to the proxy device, and the proxy device can obtain the measurement data of the target sensor from the target sensor.
  • the target sensor when the target sensor sends measurement data to the proxy device, the target sensor can add the identification information of the target sensor to the measurement data and send it to the proxy device.
  • the proxy device obtains measurement data in different ways depending on its connection method to the target sensor.
  • the specific agent device obtains the measurement data sent by the target sensor including:
  • the proxy device When the target sensor and the proxy device are connected through the fieldbus, the proxy device queries the target sensor through the fieldbus to obtain the measurement data sent by the target sensor. Alternatively, when the target sensor and the proxy device are connected through a network, the proxy device receives the measurement data sent by the target sensor through the network connection.
  • the target sensor and the proxy device are connected through a fieldbus or a network. Therefore, when the target sensor sends measurement data to the proxy device, if the target sensor and the proxy device are connected through a fieldbus, the proxy device queries the target through the fieldbus. Sensor measurement data, obtain the measurement data of the target sensor. At this time, the agent device can determine the identification information of the target sensor while querying the measurement data of the target sensor.
  • the target sensor When the target sensor and the proxy device are connected through a network, the target sensor sends measurement data to the proxy device through the network connection, and the proxy device receives the measurement data sent by the target sensor through the network connection.
  • the agent device needs to query the measurement data of sensor 1 through the fieldbus. At this point sensor 1 can transmit its measured measurement data to the agent device through the fieldbus. Sensor 2 can transmit the measurement data it acquires to the agent device via an Ethernet connection. The agent device can receive the measurement data sent by sensor 1 through the fieldbus with sensor 1, and can receive the measurement data sent by sensor 2 through the Ethernet connection with sensor 2.
  • Step S407 The proxy device obtains the identification information of the target sensor, and determines at least one subscribing device of the target sensor based on the identification information of the target sensor.
  • the proxy device when receiving the subscription message sent by the subscribing device, may determine When subscribing to the target sensor corresponding to the device, the corresponding relationship between the subscribing device and the target sensor can be recorded. After obtaining the measurement data of the target sensor, the proxy device can determine the identification information of the target sensor based on the received measurement data, so that it can find the corresponding relationship between the recorded subscription device and the target sensor based on the identification information of the target sensor, and determine the At least one subscribing device corresponding to this target sensor.
  • the measurement data carries the identification information of the target sensor.
  • the proxy device After the proxy device receives the measurement data, it can parse the measurement data and obtain the identification information of the target sensor.
  • the proxy device can also obtain the identification information of the target sensor through its own method. For example, when a proxy device establishes a connection with a sensor, it can also record the identification information of the sensor corresponding to the connection. At this time, when the proxy device receives measurement data through a connection with the target sensor, it can record the identification information of the sensor corresponding to the connection and determine the identification information of the target sensor.
  • the identification information of the target sensor can also be obtained in other ways, and this application does not limit this.
  • Step S408 The proxy device sends measurement data to at least one subscribing device of the target sensor. At least one subscribing device receives measurement data.
  • the proxy device when it determines at least one subscribing device of the target sensor, it can send the measurement data of the target sensor to the at least one subscribing device, so that the at least one subscribing device obtains the measurement data of the target sensor and performs corresponding processing. processing.
  • the subscribing device can send a subscription message to the proxy device, and the proxy device can determine the target sensor based on the subscription message, and control the target sensor to perform data measurement in the first working state.
  • the agent device can support multiple connection methods at the same time to connect to sensors with different connection methods, so that measurement data of sensors with multiple connection methods can be obtained, reducing the number of sub-stations used and greatly reducing industrial costs.
  • Figure 6 is a schematic flow chart of another data processing method provided by an embodiment of the present application. Compared with the above-mentioned embodiment described in FIG. 4 , this embodiment adds the relevant steps of unsubscribing from the sensor. As shown in Figure 6, the method includes:
  • Step S601 The subscribing device sends a subscription message to the proxy device.
  • the proxy device receives subscription messages.
  • step S401 which will not be described again here.
  • Step S602 The agent device determines the target sensor according to the subscription message.
  • step S402 Please refer to step S402, which will not be described again here.
  • Step S603 The proxy device obtains the subscription status of the target sensor.
  • step S403 Please refer to step S403, which will not be described again here.
  • the subscription state includes two states: subscribed state and unsubscribed state
  • the following steps performed by the proxy device are different depending on the obtained subscription state of the target sensor.
  • the proxy device determines that the subscription status of the target sensor is the unsubscribed status, it executes the following steps S604a-S605a and steps S606-S608.
  • the proxy device determines that the subscription state of the target sensor is the subscription state, the following steps S604b and S606-S608 are executed.
  • Step S604a When the subscription status of the target sensor is an unsubscribed status, update the subscription status of the target sensor from the unsubscribed status to the subscribed status, increase the subscription number of the target sensor by a second preset value, and send the third preset value to the target sensor. A working state switching command.
  • the target sensor receives the first working state switching instruction.
  • the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state. operating status.
  • step S404a For details, please refer to step S404a, which will not be described again here.
  • Step S604b When the subscription status of the target sensor is subscribed, increase the subscription number of the target sensor by a second preset value.
  • step S404b which will not be described again here.
  • Step S605a The target sensor switches the current working state to the first working state according to the first working state switching instruction, and when the first working state is the working state of performing data measurement with the first measurement cycle, performs the measurement according to the first measurement cycle. Data measurement.
  • step S405a For details, please refer to step S405a, which will not be described again here.
  • Step S606 The agent device obtains the measurement data of the target sensor.
  • step S406 Please refer to step S406, which will not be described again here.
  • Step S607 The proxy device obtains the identification information of the target sensor, and determines at least one subscribing device of the target sensor based on the identification information of the target sensor.
  • step S407 Please refer to step S407, which will not be described again here.
  • Step S608 The proxy device sends measurement data to at least one subscribing device of the target sensor. At least one subscribing device receives measurement data.
  • step S408 Please refer to step S408, which will not be described again here.
  • Step S609 The subscribing device sends a subscription cancellation message to the proxy device.
  • the proxy device receives the subscription cancellation message.
  • the subscription cancellation message carries the identification information of the target sensor.
  • step S201 Please refer to step S201, which will not be described again here.
  • Step S610 The agent device determines the target sensor according to the subscription cancellation message.
  • step S202 Please refer to step S202, which will not be described again here.
  • the proxy device when the proxy device determines the target sensor, since the subscribing device no longer needs to obtain the measurement data of the target sensor, the proxy device can delete the recorded correspondence between the subscribing device and the target sensor, thereby Measurement data from the target sensor is no longer sent for subscribing devices. For example, delete the identification information of the subscribing device recorded in the subscription list of the target sensor.
  • 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.
  • the proxy device can parse the subscription message to obtain the identification information of the target sensor carried in the subscription message, and then determine the target sensor whose measurement data needs to be canceled by the subscribing device. Since the target sensor may be subscribed by multiple subscribing devices at the same time, that is, multiple subscribing devices need to obtain the measurement data of the target sensor at the same time. When one of the subscribing devices unsubscribes from the measurement data of the target sensor, there are other subscribing devices that need to subscribe. The target sensor measures data, so the target sensor still works in the first working state.
  • the target sensor When the target sensor is subscribed to only one subscribing device and the subscribing device unsubscribes the measurement data of the target sensor, that is, when no subscribing device subscribes to the measurement data of the target sensor, the working state of the target sensor needs to be switched to the second state. working status to reduce the power consumption of the target sensor. Therefore, it is necessary to record the number of subscriptions of the target sensor. Every time a subscription device is added to subscribe to the test data of the target sensor, the subscription number is increased by the second preset value. Every time a subscription device is reduced to subscribe to the test data of the target sensor, When testing data, the number of subscriptions is reduced by the first preset value. Based on this, after receiving the subscription cancellation message sent by the subscribing device and determining the target sensor, the proxy device may obtain the subscription number of the target sensor and reduce the subscription number of the target sensor by the first preset value.
  • the first preset value and the second preset value are equal.
  • the first preset value is 1.
  • Step S612 When the number of subscriptions to the target sensor is equal to or less than the preset threshold, the proxy device obtains the subscription status of the target sensor and updates the subscription status of the target sensor from the subscribed status to the unsubscribed status.
  • the proxy device after the proxy device reduces the subscription number of the target sensor by the first threshold, that is, after updating the subscription number of the target sensor, the proxy device can compare the updated subscription number of the target sensor with the preset threshold. When the number of subscriptions to the target sensor is less than or equal to the preset threshold, it means that no subscribing device subscribes to the measurement data of the target sensor. At this time, the proxy device can obtain the recorded subscription status of the target sensor and change the subscription status of the target sensor from the subscribed status. Updated to unsubscribed status.
  • step S607 can be re-executed until the subscription data of the target sensor is less than or equal to the preset threshold.
  • the preset threshold is a threshold set in advance for determining whether no subscribing device subscribes to the measurement data of the target sensor.
  • 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 the second working state switching instruction.
  • the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state.
  • the first working state is a working state in which the target sensor performs data measurement in a first measurement cycle.
  • the second working state is a working 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.
  • the proxy device can send a second working state switching instruction to the target sensor so that the target sensor is replaced by the first The working state is switched to the second working state.
  • the target sensor receives the second working state switching instruction.
  • Step S614 The target sensor switches the current working state to the second working state according to the second working state switching instruction, and when the second working state is the working state of performing data measurement with the second measurement cycle, performs the measurement according to the second measurement cycle. Data measurement.
  • step S302 Please refer to step S302, which will not be described again here.
  • subscribing device 1 needs to obtain the measurement data of sensor 1, and subscribing device 2 needs to obtain sensor data. Measurement data of device 1 and sensor 2.
  • Subscribing device 3 has subscribed to the measurement data of sensor 3 and needs to unsubscribe from the measurement data of sensor 3.
  • the subscribing device 1 sends a subscription message to the agent device, and the subscription message carries the identification information of the sensor 1 .
  • the proxy device can parse the identification information of sensor 1 based on the subscription message and determine that the subscribing device 1 needs to subscribe to the measurement data of sensor 1. At this time, the proxy device can record the correspondence between the subscribing device 1 and its target sensor.
  • the agent device obtains the subscription status of sensor 1. Assume that the subscription status of sensor 1 is unsubscribed at this time.
  • the proxy device detects that the subscription status of sensor 1 is unsubscribed, it updates the subscription status of sensor 1 from the unsubscribed status to the subscribed status, and changes the subscription status of sensor 1 to the subscribed status.
  • the number of subscriptions is increased by 1, and a first working state switching instruction is sent to sensor 1, as shown in Figure 7. Assume that in this example, the sensor 1 and the agent device are connected through a field bus. When the agent device sends the first working state switching instruction to the sensor 1, it can be sent through the field bus.
  • the sensor 1 receives the first working state switching instruction through the field bus. After receiving the first working state switching instruction, the sensor 1 learns that the working state needs to be switched to the first working state. At this time, the sensor 1 can switch the second working state to the first working state, that is, the sensor 1 switches the measurement cycle to the first measurement cycle, and starts to perform data measurement based on the first measurement cycle.
  • the agent device can query the measurement data of sensor 1 through the field bus and obtain the measurement data of sensor 1. Since the agent device queries the measurement data of sensor 1 through the field bus, it can learn that the identification information of the target sensor corresponding to the measurement data is the identification information of sensor 1.
  • the agent device can search for the recorded correspondence between sensor 1 and the subscribing device based on the identification information of sensor 1, and determine that the subscribing device of sensor 1 is subscribing device 1. At this time, the proxy device can send the measurement data of sensor 1 to subscribing device 1.
  • subscription device 2 sends a subscription message to the proxy device.
  • the subscription message carries the identification information of sensor 1 and sensor 2.
  • the proxy device can parse the identification information of sensor 1 and the identification information of sensor 2 based on the subscription message, and determine that the subscribing device 2 needs to subscribe to the measurement data of sensor 1 and sensor 2.
  • the proxy device can record the correspondence between the subscribing device 2 and its target sensor. That is, the correspondence between the subscribing device 2 and the sensor 1 and the sensor 2 is recorded.
  • the agent device obtains the subscription status of sensor 1 and sensor 2. At this time, the subscription status of sensor 1 is the subscribed status.
  • the agent device When the agent device detects that the subscription status of sensor 1 is the subscribed status, it increases the subscription number of sensor 1 by 1. Assume that the subscription status of sensor 2 is unsubscribed. When the agent device detects that the subscription status of sensor 2 is unsubscribed, it updates the subscription status of sensor 2 from the unsubscribed status to the subscribed status and increases the number of subscriptions of sensor 2. 1. Send a first working state switching command to sensor 2 at the same time, as shown in Figure 7. Assume that in this example, the sensor 2 and the proxy device are connected through a wireless network. When the proxy device sends the first working state switching instruction to the sensor 2, it can be sent through the wireless network connection. The sensor 2 receives the first working state switching instruction through the wireless network connection.
  • the sensor 2 learns that the working state needs to be switched to the first working state.
  • the sensor 2 can switch the second working state to the first working state, that is, the sensor 2 switches the measurement cycle to the first measurement cycle, and starts measuring data with the first measurement cycle as the cycle.
  • the agent device can query the measurement data measured by sensor 1 through the field bus, obtain the measurement data of sensor 1, and determine the identification information of sensor 1.
  • Sensor 2 uploads its measured measurement data to the agent device via a wireless network connection.
  • the measurement data sent by the sensor 2 may carry the identification information of the sensor 2 .
  • the proxy device can parse the measurement data sent by sensor 2 to obtain the identification information of sensor 2.
  • the agent device searches for the recorded correspondence between sensor 1 and the subscribing device based on the identification information of sensor 1 and the identification information of sensor 2. According to the corresponding relationship, and the corresponding relationship between the remaining subscribing devices of sensor 2, it is determined that the subscribing device of sensor 1 is subscribing device 1 and subscribing device 2, and the subscribing device of sensor 2 is subscribing device 2. At this time, the proxy device can send the measurement data of sensor 1 to subscribing device 1 and subscribing device 2, and send the measurement data of sensor 2 to subscribing device 2.
  • the proxy device Since the subscribing device 3 has subscribed to the measurement data of the target sensor 3, when the proxy device obtains the measurement data of the subscribing device 3, it can send it to the subscribing device 3. When the subscribing device 3 does not need to obtain the measurement data of the sensor 3, a subscription cancellation message is sent to the agent device. At this time, the proxy device receives the subscription cancellation message, in which the subscription cancellation message carries the identification information of sensor 3. The proxy device can learn the identification information of sensor 3 by parsing the subscription cancellation message, that is, to determine that subscribing device 3 needs to unsubscribe from sensor 3. test data. The agent device can delete the recorded correspondence between the sensor 3 and the subscribing device 3 . Get the number of subscriptions for sensor 3.
  • the agent device decreases the subscription quantity of sensor 3 by 1. At this time, the subscription quantity of sensor 3 is 0.
  • the agent device learns that sensor 3 has no subscription device to subscribe to its measurement data. At this time, it updates the subscription status of sensor 3 from the subscribed status to the unsubscribed status, and sends a second message to sensor 3.
  • Working status switching instructions After receiving the second working state switching instruction, the sensor 3 can switch its working state to the second working state, that is, stop data measurement.
  • the first measurement periods of different sensors may be different or the same, and this application does not impose a limitation on this.
  • the second measurement periods of different sensors may be the same or different, and this application does not limit this.
  • the subscribing device when it pauses to obtain the measurement data of the target sensor, it sends a subscription cancellation message to the first device.
  • the first device After receiving the subscription cancellation message, the first device can determine the target sensor based on the subscription cancellation message and add the target sensor's measurement data to the first device.
  • the subscription state 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 switches from the first working state to the second working state.
  • the data measurement frequency of the target sensor in the second working state is lower than the data measurement frequency of the target sensor in the first working state.
  • the target sensor when receiving the subscription cancellation message, can be controlled to switch to the second working state with a longer measurement period, so that when the target sensor is not needed for monitoring, the monitoring period of the target sensor can be extended, or the data measurement can be stopped, reducing the The power consumption of the target sensor when data monitoring is not required extends the battery life of the target sensor and reduces industrial production costs.
  • the agent device supports multiple connection methods to connect to the sensor, and there is no need to set up multiple agent devices for sensors with different connection methods, thereby greatly reducing the number of agent devices used and further reducing industrial production costs.
  • FIG 8 is a schematic flow chart of another data processing method provided by an embodiment of the present application.
  • This embodiment describes a scenario in which the subscription device and the proxy device use MQTT (Message Queuing Telemetry Transport Protocol) to subscribe to and publish messages.
  • MQTT Message Queuing Telemetry Transport Protocol
  • the subscription device and the proxy device can also implement message subscription and publishing in other ways, and this application does not limit this.
  • the method includes:
  • Step S801 The subscribing device sends a subscription message in MQTT format to the agent device.
  • the broker device receives subscription messages in MQTT format.
  • the subscribing device subscribes to the measurement data of the sensor and can send the subscription to the proxy device. Read the news.
  • the subscription message sent by the subscribing device to the agent device is in MQTT format.
  • the identification information of the target sensor carried in the subscription message is the target subscription topic information.
  • the corresponding relationship between each sensor and the subscription topic information can be preset on the subscribing device side, so that the subscribing device can determine the corresponding subscription topic information when it needs to obtain the measurement data of which sensor.
  • step S401 which will not be described again here.
  • Step S802 The agent device determines the target sensor according to the subscription message in MQTT format.
  • the subscription message received by the proxy device is in MQTT format.
  • the identification information of the target sensor carried in the subscription message is the target subscription topic information of the subscribing device.
  • the proxy device obtains the mapping information between the preset sensor and the subscription topic information; and determines the target sensor based on the target subscription topic information and the mapping information between the preset sensor and the subscription topic information.
  • the mapping information between the sensor and the subscription topic information is preset in the proxy device.
  • the proxy device After the proxy device obtains the target subscription topic information, it can search for the mapping information between the preset sensor and the subscription topic information, so as to determine the target. Subscribe to the target sensor corresponding to the topic information.
  • the proxy device can record the correspondence between the subscription device that carries the target subscription topic information and the target subscription topic information in the sent subscription message.
  • each sensor is set with corresponding subscription topic information, which can be the same or different. It can be set according to actual needs, and this application does not impose restrictions on this.
  • Step S803 The proxy device obtains the subscription status of the target sensor.
  • step S403 Please refer to step S403, which will not be described again here.
  • the subscription state includes two states: subscribed state and unsubscribed state
  • the following steps performed by the proxy device are different depending on the obtained subscription state of the target sensor.
  • the proxy device determines that the subscription status of the target sensor is the unsubscribed status, it executes the following steps S604a-S605a and steps S606-S608.
  • the proxy device determines that the subscription state of the target sensor is the subscription state, the following steps S604b and S606-S608 are executed.
  • Step S804a When the subscription status of the target sensor is an unsubscribed status, update the subscription status of the target sensor from the unsubscribed status to the subscribed status, increase the subscription number of the target sensor by a second preset value, and send the third preset value to the target sensor. A working state switching command.
  • the target sensor receives the first working state switching instruction.
  • the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state.
  • step S404a For details, please refer to step S404a, which will not be described again here.
  • Step S804b When the subscription status of the target sensor is subscribed, increase the subscription number of the target sensor by a second preset value.
  • step S404b which will not be described again here.
  • Step S805a The target sensor switches the current working state to the first working state according to the first working state switching instruction, and when the first working state is the working state of performing data measurement with the first measurement cycle, the target sensor performs data measurement according to the first measurement cycle. Data measurement.
  • step S405a For details, please refer to step S405a, which will not be described again here.
  • Step S806 The agent device obtains the measurement data of the target sensor.
  • step S406 Please refer to step S406, which will not be described again here.
  • Step S807 The proxy device obtains the identification information of the target sensor, and determines at least one subscribing device of the target sensor based on the identification information of the target sensor.
  • the proxy device after receiving the measurement data sent by the target sensor, the proxy device needs to send the measurement data to the corresponding subscribing device. At this time, the proxy device determines the target subscription topic information based on the target sensor and the mapping information between the preset sensor and the subscription topic information; and determines at least one subscription device based on the target subscription topic information.
  • the proxy device can learn which target sensor sent the measurement data, find the mapping information between the preset sensor and the subscription topic information, and thereby determine the target subscription subject information corresponding to the target sensor.
  • the proxy device may determine at least one subscription device corresponding to the target subscription topic information based on the recorded correspondence between the subscription topic information and the subscription device.
  • Step S808 The proxy device sends measurement data to at least one subscribing device of the target sensor. At least one subscribing device receives measurement data.
  • the proxy device may convert the received measurement data of the target sensor into an MQTT format message and send it to the at least one subscribing device.
  • the proxy device sending measurement data to at least one subscribing device of the target sensor includes: generating a target publishing message based on the target subscription topic information and the measurement data sent by the target sensor; and sending the target publishing message to at least one subscribing device. .
  • the agent device can generate a target publication message from the target subscription topic information and the measurement data sent by the target sensor, and the target publication message is a message in MQTT format. Send this target publish message to at least one subscribing device.
  • the target publication message After at least one subscription device receives the target publication message, it can parse the target publication message and obtain the target subscription topic information and measurement data in it, so as to know which target subscription topic information the received measurement data comes from, and then perform corresponding deal with.
  • Step S809 The subscribing device sends a subscription cancellation message in MQTT format to the agent device.
  • the broker device receives subscription cancellation messages in MQTT format.
  • the subscription cancellation message carries the identification information of the target sensor.
  • the subscription cancellation message is a message in MQTT format
  • the identification information of the target sensor is the target subscription topic information. That is, when the subscribing device does not need to obtain relevant data of the target subscription topic information, it sends a subscription cancellation message to the proxy device.
  • the subscription cancellation message carries target subscription topic information.
  • the proxy device receives the subscription cancellation message.
  • Step S810 The agent device determines the target sensor according to the subscription cancellation message in MQTT format.
  • the proxy device after receiving the subscription cancellation message, can parse the subscription cancellation message, and then obtain the target subscription topic information.
  • the agent device can obtain the 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.
  • the proxy device when the proxy device determines the target sensor, since the subscribing device no longer It is necessary to obtain the measurement data of the target sensor. At this time, the proxy device can delete the recorded correspondence between the subscription device and the target subscription topic information, so that the measurement data of the target sensor is no longer sent to the subscribing device.
  • Step S811 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.
  • step S611 Please refer to step S611, which will not be described again here.
  • Step S812 When the number of subscriptions to the target sensor is equal to or less than the preset threshold, the proxy device obtains the subscription status of the target sensor and updates the subscription status of the target sensor from the subscribed status to the unsubscribed status.
  • step S612 Please refer to step S612, which will not be described again here.
  • Step S813 When the subscription state of the target sensor is updated from the subscribed state to the unsubscribed state, the proxy device sends a second working state switching instruction to the target sensor. The target sensor receives the second working state switching instruction.
  • step S613 Please refer to step S613, which will not be described again here.
  • Step S814 The target sensor switches the current working state to the second working state according to the second working state switching instruction, and when the second working state is the working state of performing data measurement with the second measurement cycle, performs the measurement according to the second measurement cycle. Data measurement.
  • step S302 Please refer to step S302, which will not be described again here.
  • FIG 9 shows a schematic structural diagram of a proxy device provided by an embodiment of the present application.
  • 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 the identification information of the target sensor
  • the subscription management module 902 is configured to determine the target sensor according to the subscription cancellation message; and send a second working state switching instruction to the target sensor.
  • the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state.
  • the first working state is a working state in which the target sensor performs data measurement in a first measurement period.
  • the second working state is a working 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.
  • the subscription management module 902 is configured to determine the connection mode of each target sensor when there are at least two target sensors; and send the second job to the target sensor according to the connection mode of each target sensor. State switching instructions.
  • sending working state switching instructions to the target sensor includes:
  • the working state switching instruction is sent to the target sensor through the field bus; or, when the target sensor and the agent device are connected through the network, the working state switching instruction is sent to the target sensor through the network connection.
  • the network connection includes an Ethernet network connection or a wireless network connection.
  • the subscription management module 902 is used to obtain the 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 sensor is equal to or less than When the preset threshold is reached, the subscription status of the target sensor is obtained, and the subscription status of the target sensor is updated from the subscribed status to the unsubscribed status.
  • a second working state switching instruction is sent to the target sensor.
  • the subscription publishing service module 901 is used to receive subscription messages. And send the subscription message to the subscription management module 902.
  • the subscription message carries identification information of the target sensor.
  • the subscription management module 902 is used to determine the target sensor according to the subscription message. Get the subscription status of the target sensor. When the subscription status of the target sensor is unsubscribed, update the subscription status of the target sensor from the unsubscribed status to the subscribed status, increase the subscription number of the target sensor by a second preset value, and send the first working status to the target sensor. Switch command.
  • the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state.
  • the subscription management module 902 is configured to determine the connection mode of each target sensor when there are at least two target sensors; and send the first work to the target sensor according to the connection mode of each target sensor. State switching instructions.
  • sending working state switching instructions to the target sensor includes:
  • the working state switching instruction is sent to the target sensor through the field bus; or, when the target sensor and the agent device are connected through the network, the working state switching instruction is sent to the target sensor through the network connection.
  • the subscription management module 902 is configured to increase the subscription number of the target sensor by a second preset value when the subscription status of the target sensor is subscribed.
  • the above proxy device also includes:
  • the subscription publishing client module 903 is used to obtain the measurement data of the target sensor and send the measurement data to the subscription publishing service module 901.
  • the subscription publishing service module 901 is used to obtain the identification information of the target sensor, determine at least one subscribing device of the target sensor based on the identification information of the target sensor, and send measurement data to at least one subscribing device of the target sensor.
  • the subscription publishing client module 903 is used to query the target sensor through the field bus when the target sensor and the agent device are connected through the field bus, and obtain the measurement data of the target sensor; or, when the target sensor and the agent device are connected, When connected through the network, the measurement data sent by the target sensor is received through the network connection.
  • the above-mentioned proxy device implements the subscription function of the subscribing device to the sensor measurement data through the MQTT protocol.
  • the above-mentioned subscription publishing service module 901 integrates the function of the MQTT server.
  • the subscription publishing client module 903 integrates the functions of the MQTT client.
  • the identification information of the target sensor includes target subscription topic information.
  • the above subscription messages and subscription cancellation messages are all messages in MQTT format.
  • the subscription management module 902 is used to obtain the mapping information between the preset sensor and the subscription topic information; determine the target sensor according to the target subscription topic information and the mapping information between the preset sensor and the subscription topic information. device.
  • the subscription publishing service module 901 is configured to determine the target subscription topic information based on the mapping information between the target sensor and the preset sensor and the subscription topic information; determine at least one subscription device based on the target subscription topic information; The target subscribes to the topic information and the measurement data sent by the target sensor to generate a target publishing message; and sends the target publishing message to at least one subscribing device.
  • the target publishing message includes the message queue telemetry transmission MQTT format message.
  • Figure 11 shows a schematic structural diagram of a sensor provided by an embodiment of the present application. As shown in Figure 11, the sensor includes:
  • the receiving module 1101 is used to receive the second working state switching instruction.
  • the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state.
  • the first working state is a working state in which the target sensor performs data measurement in a first measurement cycle.
  • the second working state is a working state in which the target sensor does not perform data measurement or performs data measurement in a second measurement cycle. Wherein, the second measurement period is greater than the first measurement period.
  • the processing module 1102 is configured to switch the current working state to the second working state according to the second working state switching instruction, and when the second working state is the working state of performing data measurement with the second measurement cycle, perform the data measurement according to the second measurement cycle. Perform data measurements.
  • the receiving module 1101 is configured to receive a first working state switching instruction.
  • the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state.
  • the processing module 1102 is configured to switch the current working state to the first working state according to the first working state switching instruction, and when the first working state is the working state of performing data measurement with the first measurement cycle, perform the data measurement according to the first measurement cycle. Perform data measurements.
  • the above sensors also include:
  • the sending module 1103 is used to send measurement data to the proxy device.
  • Figure 13 shows a schematic structural diagram of a data processing system provided by an embodiment of the present application.
  • the data processing system includes an agent device 1301, at least one sensor 1302 and at least one subscription device 1303.
  • the proxy device 1301 is connected to at least one sensor 1302 and at least one subscription device 1303.
  • At least one subscription device 1303 is used to send a subscription cancellation message to the proxy device 1301.
  • the subscription cancellation message carries the identification information of the target sensor.
  • the agent device 1301 includes the agent device described in the above embodiment; at least one sensor includes the sensor described in the above embodiment.
  • At least one subscription device 1303 is also used to send a subscription message to the proxy device 1301.
  • the subscription message carries identification information of the target sensor.
  • FIG. 14 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.
  • the electronic device 1400 may include: a processor 1401, a memory 1402, and a communication unit 1403. These components communicate through one or more buses.
  • Those skilled in the art can understand that the structure of the server shown in the figure does not constitute a limitation on the embodiment of the present invention. It can be either a bus structure or a star structure. , may also include more or fewer parts than shown, or combine certain components, or different arrangements of components.
  • the communication unit 1403 is used to establish a communication channel so that the storage device can communicate with other devices. Receive user data from other devices or send user data to other devices.
  • the processor 1401 is the control center of the storage device, using various interfaces and lines to connect various parts of the entire electronic device, by running or executing software programs and/or modules stored in the memory 1402, and calling the software programs stored in the memory 1402. data to perform various functions of the electronic device and/or process data.
  • the processor may be composed of an integrated circuit (IC), for example, it may be composed of a single packaged IC, or it may be composed of multiple packaged ICs connected with the same function or different functions.
  • the processor 1401 may only include a central processing unit (CPU).
  • the CPU may be a single computing core or may include multiple computing cores.
  • the memory 1402 is used to store execution instructions of the processor 1401.
  • the memory 1402 can be implemented by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM). 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.
  • SRAM static random access memory
  • EEPROM Erasable programmable read-only memory
  • EPROM erasable programmable read-only memory
  • PROM programmable read-only memory
  • ROM read-only memory
  • magnetic memory flash memory
  • flash memory magnetic disk or optical disk.
  • the electronic device 1400 When the execution instructions in the memory 1402 are executed by the processor 1401, the electronic device 1400 is enabled to execute some or all of the steps in the embodiment shown in Figure 2 or Figure 3.
  • the present invention also provides a storage medium, wherein the storage medium can store a program, and when executed, the program can include some or all of the steps in each embodiment of the data processing method provided by the present invention.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
  • the technology in the embodiments of the present invention can be implemented by means of software plus the necessary general hardware platform. Based on this understanding, the technical solutions in the embodiments of the present invention can be embodied in the form of software products in essence or those that contribute to the existing technology.
  • the computer software products can be stored in storage media, such as ROM/RAM. , magnetic disk, optical disk, etc., including a number of instructions to cause a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or certain parts of the embodiments of the present invention.

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

Provided in the embodiments of the present application are a data processing method and apparatus, and a device, a storage medium and a system. The method comprises: receiving a subscription cancellation message, wherein the subscription cancellation message carries identification information of a target sensor; determining the target sensor according to the subscription cancellation message; and sending a second operating state switching instruction to the target sensor, wherein the second operating state switching instruction is used for instructing the target sensor to perform switching from a first operating state to a second operating state, the first operating state is an operating state in which the target sensor performs data measurement in a first measurement period, and 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, the second measurement period being greater than the first measurement period. Therefore, the industrial production cost is reduced.

Description

一种数据处理方法、装置、设备、存储介质及系统A data processing method, device, equipment, storage medium and system
本申请要求于2022年5月31日提交中国专利局、申请号为202210610499.2、申请名称为“一种数据处理方法、装置、设备、存储介质及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requests the priority of the Chinese patent application submitted to the China Patent Office on May 31, 2022, with the application number 202210610499.2 and the application title "A data processing method, device, equipment, storage medium and system", and its entire content incorporated herein by reference.
技术领域Technical field
本申请涉及工业安全监控技术领域,具体地涉及一种数据处理方法、装置、设备、存储介质及系统。This application relates to the technical field of industrial security monitoring, and specifically to a data processing method, device, equipment, storage medium and system.
背景技术Background technique
在工业生产中,安全问题保障工业生产的基础。为了保证生产的安全,通常需要对工业生产时的生产环境及生产参数进行监测。在对生产环境进行监控时,可以监控环境中的温度、有害气体浓度、风速等参数。在对生产过程进行监控时,可以监测设备的运行状态、每个生产环节中的生产参数等进行检测。例如,在进行煤矿安全监控时,一方面需要进行煤矿井下各种有毒气体的浓度、温度、风速、温度等的环境参数监测。另一方面,还需要进行煤仓煤位、水仓水位、采煤机的运行状态等的生产参数进行检测。In industrial production, safety issues ensure the foundation of industrial production. In order to ensure the safety of production, it is usually necessary to monitor the production environment and production parameters during industrial production. When monitoring the production environment, parameters such as temperature, harmful gas concentration, and wind speed in the environment can be monitored. When monitoring the production process, the operating status of the equipment and the production parameters in each production link can be monitored for detection. For example, when conducting coal mine safety monitoring, on the one hand, it is necessary to monitor environmental parameters such as the concentration, temperature, wind speed, and temperature of various toxic gases underground in coal mines. On the other hand, it is also necessary to detect production parameters such as the coal level in the coal bunker, the water level in the water bunker, and the operating status of the shearer.
目前,现有的安全监测系统中,通常包含有各种传感器及分站。其中,各种传感器分别设置在需要进行参数监测的位置,进行相应的环境参数及生产参数的监测。例如,通过温度传感器监测生产环境中的温度,通过甲烷传感器监测生产环境中甲烷的浓度,通过风速传感器监测生产环境中的风速等。不同传感器在监测到数据后,可以将监测的数据传输至分站,经分站将监测的数据发送至其他设备以便进行后续处理。一些技术中,传感器使用电池为其供电,并且传感器开启后一直处于工作状态。当传感器需测试的设备停止运行处于不工作状态时,传感器仍处于正常工作状态,耗电较多,降低了电池的工作时间,增加了工业生产成本。At present, existing safety monitoring systems usually include various sensors and substations. Among them, various sensors are set at locations where parameter monitoring is required to monitor corresponding environmental parameters and production parameters. For example, a temperature sensor is used to monitor the temperature in the production environment, a methane sensor is used to monitor the concentration of methane in the production environment, and a wind speed sensor is used to monitor the wind speed in the production environment. After different sensors detect data, they can transmit the monitored data to the substation, and then send the monitored data to other devices for subsequent processing. In some technologies, the sensor uses a battery to power it, and the sensor remains active as long as it is turned on. When the equipment that the sensor needs to test stops running and is not working, the sensor is still in normal working condition and consumes more power, which reduces the working time of the battery and increases the cost of industrial production.
发明内容Contents of the invention
有鉴于此,本申请提供一种数据处理方法、装置、设备、存储介质及系统,以利于解决现有技术中工业生产成本高的问题。In view of this, this application provides a data processing method, device, equipment, storage medium and system to help solve the problem of high industrial production costs in the existing technology.
第一方面,本申请实施例提供了一种数据处理方法,应用于代理设备,所述方法包括:In the first aspect, embodiments of the present application provide a data processing method, which is applied to a proxy device. The method includes:
接收订阅取消消息;所述订阅取消消息中携带有目标传感器的标识信息;Receive a subscription cancellation message; the subscription cancellation message carries identification information of the target sensor;
根据所述订阅取消消息,确定目标传感器; Determine the target sensor according to the subscription cancellation message;
向所述目标传感器发送第二工作状态切换指令;所述第二工作状态切换指令用于指示目标传感器由第一工作状态切换为第二工作状态;所述第一工作状态是所述目标传感器以第一测量周期进行数据测量的工作状态;所述第二工作状态是所述目标传感器停止数据测量或者以第二测量周期进行数据测量的工作状态;其中,所述第二测量周期大于第一测量周期。Send a second working state switching instruction to the target sensor; the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state; the first working state is when the target sensor The first measurement period is a working state in which data measurement is performed; the second working state is a working 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. cycle.
第一方面的一种可能实现方式,在所述向所述目标传感器发送第二工作状态切换指令之前,所述方法还包括:In a possible implementation of the first aspect, before sending the second working state switching instruction to the target sensor, the method further includes:
获取所述目标传感器的订阅数量,并将所述目标传感器的订阅数量减少第一预设值;Obtain the 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 sensor is equal to or less than the preset threshold, obtain the subscription status of the target sensor, and update the subscription status of the target sensor from the subscribed status to the unsubscribed status;
所述向所述目标传感器发送第二工作状态切换指令包括:Sending a second working state switching instruction to the target sensor includes:
在所述目标传感器的订阅状态由已订阅状态更新为未订阅状态时,向所述目标传感器发送第二工作状态切换指令。When the subscription state of the target sensor is updated from the subscribed state to the unsubscribed state, a second working state switching instruction is sent to the target sensor.
第一方面的一种可能实现方式,还包括:A possible implementation method of the first aspect also includes:
接收订阅消息;所述订阅消息中携带有所述目标传感器的标识信息;Receive a subscription message; the subscription message carries identification information of the target sensor;
根据所述订阅消息,确定所述目标传感器;Determine the target sensor according to the subscription message;
获取所述目标传感器的订阅状态;Obtain the subscription status of the target sensor;
在所述目标传感器的订阅状态为未订阅状态时,将所述目标传感器的订阅状态由未订阅状态更新为已订阅状态,将所述目标传感器的订阅数量增加第二预设值,并向所述目标传感器发送第一工作状态切换指令;所述第一工作状态切换指令用于指示目标传感器由第二工作状态切换为第一工作状态。When the subscription state of the target sensor is an unsubscribed state, the subscription state of the target sensor is updated from an unsubscribed state to a subscribed state, the subscription number of the target sensor is increased by a second preset value, and The target sensor sends a first working state switching instruction; the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state.
第一方面的一种可能实现方式,还包括:A possible implementation method of the first aspect also includes:
在所述目标传感器的订阅状态为已订阅时,将所述目标传感器的订阅数量增加第二预设值。When the subscription status of the target sensor is subscribed, the subscription number of the target sensor is increased by a second preset value.
第一方面的一种可能实现方式,还包括:A possible implementation method of the first aspect also includes:
获取目标传感器的测量数据;Obtain the measurement data of the target sensor;
获取所述目标传感器的标识信息,并根据所述目标传感器的标识信息确定所述目标传感器的至少一个订阅设备;Obtain the identification information of the target sensor, and determine at least one subscribing device of the target sensor based on the identification information of the target sensor;
向所述目标传感器的至少一个订阅设备发送所述测量数据。The measurement data is sent to at least one subscribing device of the target sensor.
第一方面的一种可能实现方式,向所述目标传感器发送工作状态切换指令,其中所述工作状态切换指令包括第一工作状态切换指令或者第二工作状态切换指令,包括:A possible implementation of the first aspect is to send a working state switching instruction to the target sensor, where the working state switching instruction includes a first working state switching instruction or a second working state switching instruction, including:
在所述目标传感器有至少两个时,确定每个目标传感器的连接方式;When there are at least two target sensors, determine the connection method of each target sensor;
按照每个目标传感器的连接方式,分别向所述目标传感器发送工作状态切换指令。According to the connection mode of each target sensor, a working state switching instruction is sent to the target sensor respectively.
第一方面的一种可能实现方式,所述按照每个目标传感器的连接方式,分别向所述目标传感器发送工作状态切换指令包括:In a possible implementation of the first aspect, sending a working state switching instruction to each target sensor according to the connection mode of each target sensor includes:
在所述目标传感器与所述代理设备通过现场总线连接时,则通过现场总线向所述 目标传感器发送工作状态切换指令;或者,When the target sensor and the agent device are connected through the field bus, the The target sensor sends a working state switching instruction; or,
在所述目标传感器与所述代理设备通过网络连接时,则通过网络连接向所述目标传感器发送工作状态切换指令。When the target sensor and the proxy device are connected through the network, a working state switching instruction is sent to the target sensor through the network connection.
第一方面的一种可能实现方式,所述获取目标传感器的测量数据包括:In a possible implementation of the first aspect, obtaining the measurement data of the target sensor includes:
在所述目标传感器与所述代理设备通过现场总线连接时,则所述代理设备通过现场总线查询所述目标传感器,获取所述目标传感器的测量数据;或者,When the target sensor and the agent device are connected through the field bus, the agent device queries the target sensor through the field bus and obtains the measurement data of the target sensor; or,
在所述目标传感器与所述代理设备通过网络连接时,则通过网络连接接收目标传感器发送的测量数据。When the target sensor and the proxy device are connected through the network, the measurement data sent by the target sensor is received through the network connection.
第一方面的一种可能实现方式,所述网络连接包括:以太网络连接或者无线网络连接。In a possible implementation manner of the first aspect, the network connection includes: an Ethernet network connection or a wireless network connection.
第二方面,本申请实施例提供了一种数据处理方法,应用于传感器,所述方法包括:In the second aspect, embodiments of the present application provide a data processing method, applied to sensors, and the method includes:
接收第二工作状态切换指令;所述第二工作状态切换指令用于指示目标传感器由第一工作状态切换为第二工作状态;所述第一工作状态是所述目标传感器以第一测量周期进行数据测量的工作状态;所述第二工作状态是所述目标传感器不进行数据测量或者以第二测量周期进行数据测量的工作状态;其中,所述第二测量周期大于第一测量周期;Receive a second working state switching instruction; the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state; the first working state is that the target sensor performs a first measurement cycle The working state of data measurement; the second working state is a working 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;
根据所述第二工作状态切换指令,将当前工作状态切换为第二工作状态,并在所述第二工作状态为以第二测量周期进行数据测量的工作状态时,按照第二测量周期进行数据测量。According to the second working state switching instruction, the current working state is switched to the second working state, and when the second working state is the working state of performing data measurement with the second measurement cycle, the data is measured according to the second measurement cycle. Measurement.
第二方面的一种可能实现方式,还包括:A possible implementation method of the second aspect also includes:
接收第一工作状态切换指令;所述第一工作状态切换指令用于指示目标传感器由第二工作状态切换为第一工作状态;Receive a first working state switching instruction; the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state;
根据所述第一工作状态切换指令,将当前工作状态切换为第一工作状态,并在所述第一工作状态为以第一测量周期进行数据测量的工作状态时,按照第一测量周期进行数据测量。According to the first working state switching instruction, the current working state is switched to the first working state, and when the first working state is a working state in which data measurement is performed with the first measurement cycle, data is measured according to the first measurement cycle. Measurement.
第二方面的一种可能实现方式,还包括:A possible implementation method of the second aspect also includes:
向代理设备发送测量数据。Send measurement data to the agent device.
第三方面,本申请实施例提供了一种代理设备,包括:In the third aspect, embodiments of the present application provide a proxy device, including:
订阅发布服务模块,用于接收订阅取消消息,并将所述订阅取消消息发送至订阅管理模块;所述订阅取消消息中携带有目标传感器的标识信息;A subscription publishing service module, configured to receive a subscription cancellation message and send the subscription cancellation message to the subscription management module; the subscription cancellation message carries the identification information of the target sensor;
订阅管理模块,用于根据所述订阅取消消息,确定目标传感器;A subscription management module, configured to determine the target sensor according to the subscription cancellation message;
向所述目标传感器发送第二工作状态切换指令;所述第二工作状态切换指令用于指示目标传感器由第一工作状态切换为第二工作状态;所述第一工作状态是所述目标传感器以第一测量周期进行数据测量的工作状态;所述第二工作状态是所述目标传感器不进行数据测量或者以第二测量周期进行数据测量的工作状态;其中,所述第二测量周期大于第一测量周期。Send a second working state switching instruction to the target sensor; the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state; the first working state is when the target sensor The first measurement period is a working state in which data measurement is performed; the second working state is a working 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 a possible implementation of the third aspect, the subscription management module is configured to obtain the 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 sensor is equal to or less than the preset threshold, obtain the subscription status of the target sensor, and update the subscription status of the target sensor from the subscribed status to the unsubscribed status;
所述订阅管理模块,用于在所述目标传感器的订阅状态由已订阅状态更新为未订阅状态时,向所述目标传感器发送第二工作状态切换指令。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.
第三方面的一种可能实现方式,所述订阅发布服务模块,用于接收订阅消息,并将订阅消息发送至订阅管理模块;所述订阅消息中携带有所述目标传感器的标识信息;In a possible implementation 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 message carries identification information of the target sensor;
所述订阅管理模块,用于根据所述订阅消息,确定所述目标传感器;The subscription management module is used to determine the target sensor according to the subscription message;
获取所述目标传感器的订阅状态;Obtain the subscription status of the target sensor;
在所述目标传感器的订阅状态为未订阅状态时,将所述目标传感器的订阅状态由未订阅状态更新为已订阅状态,将所述目标传感器的订阅数量增加第二预设值,并向所述目标传感器发送第一工作状态切换指令;所述第一工作状态切换指令用于指示目标传感器由第二工作状态切换为第一工作状态。When the subscription state of the target sensor is an unsubscribed state, the subscription state of the target sensor is updated from an unsubscribed state to a subscribed state, the subscription number of the target sensor is increased by a second preset value, and The target sensor sends a first working state switching instruction; the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state.
第三方面的一种可能实现方式,所述订阅管理模块,用于在所述目标传感器的订阅状态为已订阅时,将所述目标传感器的订阅数量增加第二预设值。In a possible implementation of the third aspect, the subscription management module is configured to increase the subscription number of the target sensor by a second preset value when the subscription status of the target sensor is subscribed.
第三方面的一种可能实现方式,还包括:A possible implementation method of the third aspect also includes:
订阅发布客户模块,用于获取目标传感器的测量数据,向所述订阅发布服务模块发送所述目标传感器发送的测量数据;The subscription publishing client module is used to obtain the measurement data of the target sensor and send the measurement data sent by the target sensor to the subscription publishing service module;
所述订阅发布服务模块,用于获取所述目标传感器的标识信息,并根据所述目标传感器的标识信息确定所述目标传感器的至少一个订阅设备;The subscription publishing service module is used to obtain the identification information of the target sensor, and determine at least one subscription device of the target sensor based on the identification information of the target sensor;
向所述目标传感器的至少一个订阅设备发送所述测量数据。The measurement data is sent to at least one subscribing device of the target sensor.
第三方面的一种可能实现方式,所述订阅管理模块,用于在所述目标传感器有至少两个时,确定每个目标传感器的连接方式;In a possible implementation of the third aspect, the subscription management module is configured to determine the connection mode of each target sensor when there are at least two target sensors;
按照每个目标传感器的连接方式,分别向所述目标传感器发送工作状态切换指令;所述工作状态切换指令包括:第一工作状态切换指令或者第二工作状态切换指令。According to the connection mode of each target sensor, a working state switching instruction is sent to the target sensor respectively; the working state switching instruction includes: a first working state switching instruction or a second working state switching instruction.
第三方面的一种可能实现方式,所述订阅管理模块,用于在所述目标传感器与所述代理设备通过现场总线连接时,则通过现场总线向所述目标传感器发送工作状态切换指令;或者,In a possible implementation of the third aspect, the subscription management module is configured to send a working state switching instruction to the target sensor through the field bus when the target sensor and the agent device are connected through a field bus; or ,
在所述目标传感器与所述代理设备通过网络连接时,则通过网络连接向所述目标传感器发送工作状态切换指令。When the target sensor and the proxy device are connected through the network, a working state switching instruction is sent to the target sensor through the network connection.
第三方面的一种可能实现方式,所述订阅发布客户模块,用于在所述目标传感器与所述代理设备通过现场总线连接时,通过现场总线查询所述目标传感器,获取所述目标传感器的测量数据;或者,In a possible implementation of the third aspect, the subscription publishing client module is configured to query the target sensor through the field bus and obtain the information of the target sensor when the target sensor and the agent device are connected through a field bus. measurement data; or,
在所述目标传感器与所述代理设备通过网络连接时,则通过网络连接接收目标传感器发送的测量数据。When the target sensor and the proxy device are connected through the network, the measurement data sent by the target sensor is received through the network connection.
第三方面的一种可能实现方式,所述订阅发布客户模块,用于在所述目标传感器与所述代理设备通过现场总线连接时,通过现场总线查询所述目标传感器,获取所述目标传感器的测量数据;或者, In a possible implementation of the third aspect, the subscription publishing client module is configured to query the target sensor through the field bus and obtain the information of the target sensor when the target sensor and the agent device are connected through a field bus. measurement data; or,
在所述目标传感器与所述代理设备通过网络连接时,则通过网络连接接收目标传感器发送的测量数据。When the target sensor and the proxy device are connected through the network, the measurement data sent by the target sensor is received through the network connection.
第三方面的一种可能实现方式,所述网络连接包括:以太网络连接或者无线网络连接。In a possible implementation of the third aspect, the network connection includes: an Ethernet network connection or a wireless network connection.
第四方面,本申请实施例提供了一种传感器,包括:In a fourth aspect, embodiments of the present application provide a sensor, including:
接收模块,用于接收第二工作状态切换指令;所述第二工作状态切换指令用于指示目标传感器由第一工作状态切换为第二工作状态;所述第一工作状态是所述目标传感器以第一测量周期进行数据测量的工作状态;所述第二工作状态是所述目标传感器不进行数据测量或者以第二测量周期进行数据测量的工作状态;其中,所述第二测量周期大于第一测量周期;A receiving module, configured to receive a second working state switching instruction; the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state; the first working state is when the target sensor The first measurement period is a working state in which data measurement is performed; the second working state is a working 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;
处理模块,用于根据所述第二工作状态切换指令,将当前工作状态切换为第二工作状态,并在所述第二工作状态为以第二测量周期进行数据测量的工作状态时,按照第二测量周期进行数据测量。A processing module configured to switch the current working state to the second working state according to the second working state switching instruction, and when the second working state is the working state of performing data measurement with the second measurement cycle, perform the processing according to the second working state. Data measurement is performed in two measurement cycles.
第四方面的一种可能实现方式,所述接收模块,用于接收第一工作状态切换指令;所述第一工作状态切换指令用于指示目标传感器由第二工作状态切换为第一工作状态;In a possible implementation of the fourth aspect, the receiving module is used to receive a first working state switching instruction; the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state;
所述处理模块,用于根据所述第一工作状态切换指令,将当前工作状态切换为第一工作状态,并在所述第一工作状态为以第一测量周期进行数据测量的工作状态时,按照第一测量周期进行数据测量。The processing module is configured to switch the current working state to the first working state according to the first working state switching instruction, and when the first working state is the working state of performing data measurement with the first measurement cycle, Data measurement is performed according to the first measurement cycle.
第四方面的一种可能实现方式,还包括:A possible implementation method of the fourth aspect also includes:
发送模块,用于向代理设备发送测量数据。The sending module is used to send measurement data to the agent device.
第五方面,本申请实施例提供了一种数据处理系统,包括:代理设备,至少一个传感器及至少一个订阅设备;In the fifth aspect, embodiments of the present application provide a data processing system, including: an agent device, at least one sensor and at least one subscription device;
其中,代理设备与至少一个传感器及至少一个订阅设备连接;Wherein, the agent device is connected to at least one sensor and at least one subscription device;
至少一个订阅设备,用于向代理设备发送订阅取消消息;所述订阅取消消息中携带有目标传感器的标识信息;At least one subscription device, configured to send a subscription cancellation message to the agent device; the subscription cancellation message carries identification information of the target sensor;
所述代理设备包括上述第三方面任一项所述的代理设备;所述至少一个传感器包括上述第四方面任一项所述的传感器。The proxy device includes the proxy device described in any one of the above third aspects; the at least one sensor includes the sensor described in any one of the above fourth aspects.
第六方面,本申请实施例提供了一种电子设备,包括处理器和存储器,所述存储器存储有计算机程序,当所述计算机程序被执行时,使得所述电子设备执行上述第一方面任一项所述的方法,或者执行上述第二方面任一项所述的方法。In a sixth aspect, embodiments of the present application provide an electronic device, including a processor and a memory. The memory stores a computer program. When the computer program is executed, the electronic device causes the electronic device to execute any one of the above first aspects. The method described in the above item, or perform the method described in any one of the above second aspects.
第七方面,本申请实施例提供了一种存储介质,所述存储介质包括存储的程序,其中,在所述程序运行时控制所述存储介质所在设备执行上述第一方面任一项所述的方法,或者执行上述第二方面任一项所述的方法。In a seventh aspect, embodiments of the present application provide a storage medium. The storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute any one of the steps described in the first aspect. method, or perform the method described in any one of the above second aspects.
采用本申请实施例所提供的方案,接收订阅取消消息;订阅取消消息中携带有目标传感器的标识信息;根据订阅取消消息,确定目标传感器;向目标传感器发送第二工作状态切换指令。这样一来,在订阅设备暂停获取目标传感器的测量数据时,向第一设备发送订阅取消消息,第一设备接收到订阅取消消息后,可以根据该订阅取消消息确定出目标传感器,并向目标传感器发送第二工作状态切换指令,以便目标传感器 由第一工作状态切换为第二工作状态。目标传感器在第二工作状态时的数据测量频率低于目标传感器在第一工作状态时的数据测量频率。即为,在接收到订阅取消消息时,可以控制目标传感器切换为测量周期更长的第二工作状态,从而可以在无需目标传感器进行监测时,延长目标传感器的监测周期,或者停止数据测量,降低目标传感器在无需进行数据监测时的耗电量,延长目标传感器的电池使用时间,降低工业生产成本。The solution provided by the embodiment of this application is used to receive the subscription cancellation message; the subscription cancellation message carries the identification information of the target sensor; determine the target sensor according to the subscription cancellation message; and send a second working state switching instruction to the target sensor. In this way, when the subscribing device pauses to obtain the measurement data of the target sensor, it sends a subscription cancellation message to the first device. After receiving the subscription cancellation message, the first device can determine the target sensor based on the subscription cancellation message and send a message to the target sensor. Send a second working state switching command so that the target sensor Switch from the first working state to the second working state. The data measurement frequency of the target sensor in the second working state is lower than the data measurement frequency of the target sensor in the first working state. That is, when receiving the subscription cancellation message, the target sensor can be controlled to switch to the second working state with a longer measurement period, so that when the target sensor is not needed for monitoring, the monitoring period of the target sensor can be extended, or the data measurement can be stopped, reducing the The power consumption of the target sensor when data monitoring is not required extends the battery life of the target sensor and reduces industrial production costs.
附图说明Description of the drawings
为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required to be used in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without exerting any creative effort.
图1为本申请实施例提供的一种传感器与分站连接的场景示意图;Figure 1 is a schematic diagram of a scene where a sensor is connected to a substation according to an embodiment of the present application;
图2为本申请实施例提供的一种数据处理方法的流程示意图;Figure 2 is a schematic flow chart of a data processing method provided by an embodiment of the present application;
图3为本申请实施例提供的另一种数据处理方法的流程示意图;Figure 3 is a schematic flow chart of another data processing method provided by an embodiment of the present application;
图4为本申请实施例提供的另一种数据处理方法的流程示意图;Figure 4 is a schematic flow chart of another data processing method provided by an embodiment of the present application;
图5a为本申请实施例提供的一种数据处理方法的场景示意图;Figure 5a is a schematic scenario diagram of a data processing method provided by an embodiment of the present application;
图5b为本申请实施例提供的另一种数据处理方法的场景示意图;Figure 5b is a schematic diagram of a scenario of another data processing method provided by an embodiment of the present application;
图6为本申请实施例提供的另一种数据处理方法的流程示意图;Figure 6 is a schematic flow chart of another data processing method provided by an embodiment of the present application;
图7为本申请实施例提供的另一种数据处理方法的场景示意图;Figure 7 is a schematic diagram of a scenario of another data processing method provided by an embodiment of the present application;
图8为本申请实施例提供的另一种数据处理方法的流程示意图;Figure 8 is a schematic flow chart of another data processing method provided by an embodiment of the present application;
图9为本申请实施例提供的一种代理设备的结构示意图;Figure 9 is a schematic structural diagram of a proxy device provided by an embodiment of the present application;
图10为本申请实施例提供的另一种代理设备的结构示意图;Figure 10 is a schematic structural diagram of another proxy device provided by an embodiment of the present application;
图11为本申请实施例提供的一种传感器的结构示意图;Figure 11 is a schematic structural diagram of a sensor provided by an embodiment of the present application;
图12为本申请实施例提供的另一种传感器的结构示意图;Figure 12 is a schematic structural diagram of another sensor provided by an embodiment of the present application;
图13为本申请实施例提供的一种数据处理系统的结构示意图;Figure 13 is a schematic structural diagram of a data processing system provided by an embodiment of the present application;
图14为本申请实施例提供的一种电子设备的结构示意图。Figure 14 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
为了更好的理解本申请的技术方案,下面结合附图对本申请实施例进行详细描述。In order to better understand the technical solution of the present application, the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
应当明确,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。It should be clear that the described embodiments are only some of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of this application.
在本申请实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。The terminology used in the embodiments of the present application is only for the purpose of describing specific embodiments and is not intended to limit the present application. As used in the embodiments and the appended claims, the singular forms "a," "the" and "the" are intended to include the plural forms as well, unless the context clearly dictates otherwise.
应当理解,本文中使用的术语“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,甲和/或乙,可以表示:单独存在甲,同时存在甲和乙,单独存在乙这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一 种“或”的关系。It should be understood that the term "and/or" used in this article is only an association relationship describing related objects, indicating that there can be three relationships, for example, A and/or B, which can mean: A alone exists, and A and A exist simultaneously. B, there are three situations of B alone. In addition, the character "/" in this article generally indicates that the related object is a An "or" relationship.
在对本申请实施例进行具体介绍之前,首先对本申请实施例应用或可能应用的术语进行解释。Before giving a detailed introduction to the embodiments of the present application, terminology that is or may be applied in the embodiments of the present application is first explained.
传感器(英文名称:transducer/sensor)是一种检测装置,能感受到被测量的信息,并能将感受到的信息,按一定规律变换成为电信号或其他所需形式的信息输出,以满足信息的传输、处理、存储、显示、记录和控制等要求。A sensor (English name: transducer/sensor) is a detection device that can sense the measured information and convert the sensed information into electrical signals or other required forms of information output according to certain rules to meet the needs of the information Requirements for transmission, processing, storage, display, recording and control.
目前,在现有的安全监测系统中,通常包含有各种传感器、分站及数据服务设备,如图1所示。其中,各种传感器分别设置在需要进行参数监测的位置,进行相应的环境参数及生产参数的监测。例如,通过温度传感器监测生产环境中的温度,通过甲烷传感器监测生产环境中甲烷的浓度,通过风速传感器监测生产环境中的风速等。不同传感器在监测到数据后,可以将监测的数据传输至分站,经分站将监测的数据发送至数据服务设备以便进行后续处理。一些技术中,传感器使用电池为其供电,并且传感器开启后一直处于工作状态。当未订阅该传感器的测量数据时,传感器仍处于正常工作状态,耗电较多,降低了电池的工作时间,增加了工业生产成本。At present, existing safety monitoring systems usually include various sensors, substations and data service equipment, as shown in Figure 1. Among them, various sensors are set at locations where parameter monitoring is required to monitor corresponding environmental parameters and production parameters. For example, a temperature sensor is used to monitor the temperature in the production environment, a methane sensor is used to monitor the concentration of methane in the production environment, and a wind speed sensor is used to monitor the wind speed in the production environment. After different sensors detect data, they can transmit the monitored data to the substation, and then send the monitored data to the data service equipment through the substation for subsequent processing. In some technologies, the sensor uses a battery to power it, and the sensor remains active as long as it is turned on. When the sensor's measurement data is not subscribed, the sensor is still in normal working condition, consuming more power, reducing the battery's working time, and increasing industrial production costs.
并且,不同传感器与分站间的数据传输方式不完全相同,参考图1所示,有的传感器与分站间通过现场总线连接实现数据传输,例如,温度传感器与分站之间通过现场总线连接。有的传感器与分站之间通过以太网络连接或者无线网络连接实现数据传输,如图甲烷传感器与分站之间通过以太网络连接,风速传感器与分站之间通过无线网络连接。在一些技术中,针对每种连接方式的传感器设置对应连接方式的分站,以实现传感器通过其支持的连接方式将数据传输至分站。这样一来,需要设置的分站个数较多,进一步增加了工业生产的成本。Moreover, the data transmission methods between different sensors and substations are not exactly the same. As shown in Figure 1, some sensors and substations are connected through fieldbus to realize data transmission. For example, the temperature sensor and substation are connected through fieldbus. . Some sensors and sub-stations realize data transmission through Ethernet or wireless network connections. For example, in the figure, the methane sensor and the sub-station are connected through the Ethernet network, and the wind speed sensor and the sub-station are connected through the wireless network. In some technologies, a sub-station corresponding to the connection mode is set for each connection mode sensor, so that the sensor can transmit data to the sub-station through the connection mode it supports. As a result, a larger number of substations need to be set up, further increasing the cost of industrial production.
针对上述问题,本申请实施例提供了一种数据处理方法、装置、设备、存储介质及系统,接收订阅取消消息;订阅取消消息中携带有目标传感器的标识信息;根据订阅取消消息,确定目标传感器;向目标传感器发送第二工作状态切换指令。这样一来,在订阅设备暂停获取目标传感器的测量数据时,向第一设备发送订阅取消消息,第一设备接收到订阅取消消息后,可以根据该订阅取消消息确定出目标传感器,并向目标传感器发送第二工作状态切换指令,以便目标传感器由第一工作状态切换为第二工作状态。目标传感器在第二工作状态时的数据测量频率低于目标传感器在第一工作状态时的数据测量频率。即为,在接收到订阅取消消息时,可以控制目标传感器切换为测量周期更长的第二工作状态,从而可以在无需目标传感器进行监测时,延长目标传感器的监测周期,或者停止数据测量,降低目标传感器在无需进行数据监测时的耗电量,延长目标传感器的电池使用时间,降低工业生产成本。以下进行详细说明。In response to the above problems, embodiments of the present application provide a data processing method, device, equipment, storage medium and system to receive a subscription cancellation message; the subscription cancellation message carries the identification information of the target sensor; according to the subscription cancellation message, the target sensor is determined ;Send the second working state switching instruction to the target sensor. In this way, when the subscribing device pauses to obtain the measurement data of the target sensor, it sends a subscription cancellation message to the first device. After receiving the subscription cancellation message, the first device can determine the target sensor based on the subscription cancellation message and send a message to the target sensor. Send a second working state switching instruction so that the target sensor switches from the first working state to the second working state. The data measurement frequency of the target sensor in the second working state is lower than the data measurement frequency of the target sensor in the first working state. That is, when receiving the subscription cancellation message, the target sensor can be controlled to switch to the second working state with a longer measurement period, so that when the target sensor is not needed for monitoring, the monitoring period of the target sensor can be extended, or the data measurement can be stopped, reducing the The power consumption of the target sensor when data monitoring is not required extends the battery life of the target sensor and reduces industrial production costs. The details are explained below.
参见图2,为本申请实施例提供的一种数据处理方法的流程示意图。该方法应用于代理设备,如图2所示,所述方法包括:Refer to Figure 2, which is a schematic flow chart of a data processing method provided by an embodiment of the present application. This method is applied to the proxy device, as shown in Figure 2. The method includes:
步骤S201、接收订阅取消消息。Step S201: Receive a subscription cancellation message.
其中,订阅取消消息中携带有目标传感器的标识信息。The subscription cancellation message carries the identification information of the target sensor.
在本申请实施例中,在工业生产过程中,为了提高工业生产的安全,需要通过传感器周期性的测量周围环境或者生产过程中重要设备的运行状态等的参数。由于传感器的结构简单导致其功能单一,其计算能力较差,一般不具备存储功能,因此,需要 将周期性测量的测量数据传输至其他设备中进行处理。在本申请实施例中,代理设备与不同的传感器建立连接,从而传感器可以将其周期性测量的测量数据传输至代理设备。其他数据服务设备可以向代理设备订阅其所需的传感器的测量数据,此时,其他数据服务设备可以称为订阅设备。代理设备在获取到不同的传感器周期性测量的测量数据时,可以根据每个订阅设备订阅的所需传感器的测量数据,向每个订阅设备发送相应的传感器周期性测量的测量数据。若由于生产需要,需要停止某些设备的运行或者不再关注环境中的某些参数等,相关的订阅设备可以停止获取相关传感器测量的测量数据,此时订阅设备可以向代理设备发送订阅取消消息。该订阅取消消息中携带有目标传感器的标识信息。该目标传感器是订阅设备不再获取其测量数据的传感器。代理设备可以接收订阅设备发送的订阅取消消息。In the embodiment of the present application, in order to improve the safety of industrial production during the industrial production process, it is necessary to periodically measure parameters of the surrounding environment or the operating status of important equipment in the production process through sensors. Due to the simple structure of the sensor, its function is single, its computing power is poor, and it generally does not have storage function. Therefore, it is necessary to Transmit the measurement data of periodic measurements to other devices for processing. In this embodiment of the present application, the proxy device establishes connections with different sensors, so that the sensors can transmit their periodically measured measurement data to the proxy device. Other data service devices can subscribe to the proxy device for the measurement data of the sensors they require. At this time, the other data service devices can be called subscribing devices. When the proxy device obtains the measurement data of different sensors periodically measured, it can send the corresponding sensor periodic measurement measurement data to each subscribing device based on the measurement data of the required sensors subscribed by each subscribing device. If due to production needs, it is necessary to stop the operation of certain devices or no longer pay attention to certain parameters in the environment, etc., the relevant subscription device can stop obtaining the measurement data measured by the relevant sensors. At this time, the subscription device can send a subscription cancellation message to the agent device. . The subscription cancellation message carries the identification information of the target sensor. The target sensor is a sensor for which the subscribing device no longer obtains measurement data. The proxy device can receive subscription cancellation messages sent by the subscribing device.
其中,目标传感器的标识信息是用于标识出目标传感器的信息,例如可以是目标传感器的身份标识号(Identity document,ID),或者是目标传感器的名称等信息,还可以是与传感器具有映射关系的其他信息,例如,订阅主题信息与传感器间有映射关系时,目标传感器的标识信息还可以是订阅主题信息等。其中,可以预先设置其他信息与传感器间的映射关系,本申请对目标传感器的标识信息不作限制。Among them, the identification information of the target sensor is information used to identify the target sensor. For example, it can be the identification number (Identity document, ID) of the target sensor, or the name of the target sensor, or it can also have a mapping relationship with the sensor. Other information, for example, when there is a mapping relationship between the subscription topic information and the sensor, the identification information of the target sensor can also be the subscription topic information, etc. Among them, the mapping relationship between other information and the sensor can be set in advance. This application does not limit the identification information of the target sensor.
例如,在煤矿生产过程中,设置有温度传感器,甲烷传感器及风速传感器。订阅设备1需要获取煤矿生产过程中的环境温度以便监测煤矿生产过程中温度是否过高或者过低。订阅设备2需要获取煤矿生产过程中的甲烷浓度,以便监测煤矿生产过程中空气中的甲烷含量是否超标。订阅设备3需要获取煤矿生产过程中的风速,以便监测煤矿生产过程中风速是否过大或过小。基于此,订阅设备1可以向代理设备订阅温度传感器的测量数据。订阅设备2可以向代理设备订阅甲烷传感器的测量数据。订阅设备3可以向代理设备订阅风速传感器的测量数据。这样一来,温度传感器在周期性测量到煤矿生产过程中环境的温度后,可以将其测量的测量数据传输至代理设备,代理设备可以将该温度传感器传输的测量数据发送至订阅设备1。同理,甲烷传感器在周期性测量到煤矿生产过程中空气内的甲烷浓度后,可以将其测量的测量数据传输至代理设备,代理设备可以将该温度传感器传输的测量数据发送至订阅设备2。风速传感器在周期性测量到煤矿生产过程中环境的风速后,可以将其测量的测量数据传输至代理设备,代理设备可以将该温度传感器传输的测量数据发送至订阅设备3。若由于生产环境的改善或其他原因,假设订阅设备3无需再监测环境中的风速。此时,订阅设备3可以向代理设备发送订阅取消消息,且该订阅取消消息中携带有风速传感器的标识信息。代理设备接收订阅设备3发送的订阅取消消息。For example, in the coal mine production process, temperature sensors, methane sensors and wind speed sensors are installed. Subscribing device 1 needs to obtain the ambient temperature during the coal mine production process in order to monitor whether the temperature is too high or too low during the coal mine production process. Subscription 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 exceeds the standard during the coal mine production process. Subscribing device 3 needs to obtain the wind speed during the coal mine production process in order to monitor whether the wind speed is too high or too low during the coal mine production process. Based on this, the subscribing device 1 can subscribe to the proxy device for the measurement data of the temperature sensor. The subscribing device 2 may subscribe to the proxy device for measurement data of the methane sensor. The subscribing device 3 may subscribe to the proxy device for measurement data of the wind speed sensor. In this way, after the temperature sensor periodically measures the temperature of the environment in the coal mine production process, it can transmit its measured measurement data to the agent device, and the agent device can send the measurement data transmitted by the temperature sensor to the subscribing device 1. Similarly, after the methane sensor periodically measures the methane concentration in the air during the coal mine production process, it can transmit its measurement data to the agent device, and the agent device can send the measurement data transmitted by the temperature sensor to the subscribing device 2. After the wind speed sensor periodically measures the wind speed of the environment in the coal mine production process, it can transmit its measured measurement data to the agent device, and the agent device can send the measurement data transmitted by the temperature sensor to the subscribing device 3. If due to the improvement of the production environment or other reasons, it is assumed that the subscription device 3 no longer needs to monitor the wind speed in the environment. At this time, the subscription device 3 may send a subscription cancellation message to the agent device, and the subscription cancellation message carries the identification information of the wind speed sensor. The proxy device receives the subscription cancellation message sent by the subscribing device 3.
步骤S202、根据订阅取消消息,确定目标传感器。Step S202: Determine the target sensor according to the subscription cancellation message.
在本申请实施例中,代理设备在获取到订阅取消消息后,可以解析订阅取消消息获取其内携带的目标传感器的标识信息,从而根据目标传感器的标识信息确定出该订阅设备对应的目标传感器。In this embodiment of the present application, after obtaining the subscription cancellation message, the proxy device can parse the subscription cancellation message to obtain the identification information of the target sensor carried in the subscription cancellation message, thereby determining the target sensor corresponding to the subscription device based on the identification information of the target sensor.
步骤S203、向目标传感器发送第二工作状态切换指令。Step S203: Send a second working state switching instruction to the target sensor.
其中,第二工作状态切换指令用于指示目标传感器由第一工作状态切换为第二工作状态。第一工作状态是目标传感器以第一测量周期进行数据测量的工作状态。第二工作状态是目标传感器停止数据测量或者以第二测量周期进行数据测量的工作状态。 其中,第二测量周期大于第一测量周期。The second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state. The first working state is a working state in which the target sensor performs data measurement in a first measurement period. The second working state is a working 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 this application, after the proxy device receives the subscription cancellation message sent by the subscribing device and determines the target sensor, since the subscribing device cancels the subscription to the target sensor, it means that the measurement data measured by the target sensor does not need to be transmitted to other devices. , at this time, the period of measurement data of the target sensor can be extended 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 in which data measurement is performed in a first measurement cycle. When the target sensor performs normal data measurement, it usually works in the first working state. The second working state is a working state in which the target sensor stops data measurement or performs data measurement in a second measurement period. When the subscribing device stops subscribing to the measurement data measured by the target sensor, the target sensor can switch to the second working state to stop data measurement or extend the period of data measurement to reduce battery consumption and extend the working time of the battery in the target sensor. Based on this, the proxy device can send a second working state switching instruction to the target sensor, so that the target sensor can switch from the first working state to the second working state after 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. Moreover, when setting the second working state, the setting can be made according to whether the sensor needs to work for a long time. If the sensor needs to work for a long time, the second working state of this type of sensor can be set to the working state of performing data measurement in the second measurement cycle. That is, even if this type of sensor does not subscribe to a device for data subscription, it must monitor parameters for a long time to ensure the safety of industrial production. For example, the methane concentration sensor needs to obtain the methane concentration when there is no subscription equipment. In order to improve the life safety of workers in industrial production, it is also necessary to monitor the methane concentration in the production environment. The methane sensor is a type that requires long-term operation. At this time, the second working state of the methane sensor can be set to the working state of performing data measurement in the second measurement period.
如果传感器无需进行长期工作,则可以将该类传感器的第二工作状态设置为停止数据测量的工作状态。即为,此类传感器在没有订阅设备进行数据订阅时,无需进行参数监测。例如,目标传感器为检测设备运行状态的传感器。在一些实施例中该设备停止运行时,且相关订阅设备停止获取该设备的运行状态的数据。由于该设备已经停止运行,目标传感器无需在继续监测其工作状态的相关参数。因此,可以将其第二工作状态设置为停止数据测量的工作状态。If the sensor does not need to work for a long time, the second working state of this type of sensor can be set to a working state that stops data measurement. That is, this type of sensor does not need to perform parameter monitoring when there is no subscribing device for data subscription. For example, the target sensor is a sensor that detects the operating status of the equipment. In some embodiments, when the device stops running, the relevant subscribing device stops obtaining data on the running status of the device. Since the device has stopped running, the target sensor does not need to continue to monitor relevant parameters of its working status. Therefore, its second working state can be set to a working state that stops data measurement.
应理解的是,目标传感器是否属性需要长期工作的类型,则可以根据实际需要有相关人员进行设定,并基于其是否属于需要长期工作的类型,可以设定其第二工作状态。It should be understood that whether the target sensor is of a type that requires long-term operation can be set by relevant personnel according to actual needs, and based on whether it is of a type that requires long-term operation, its second working state can be set.
需要说明的是,第一测量周期及第二测量周期可以由本领域技术人员根据实际经验设定,或者,根据大数据分析的结果而得到,本申请实施例对此不作限制。It should be noted that the first measurement period and the second measurement period can be set by those skilled in the art based on actual experience, or obtained based on the results of big data analysis, which are not limited in the embodiments of the present application.
在一些实施例中,代理设备可以支持多种连接方式与传感器进行连接。针对需要通过现场总线连接的传感器,则代理设备可以通过现场总线与此类传感器连接。针对需要通过网络连接的传感器,则代理设备可以通过网络连接与此类传感器进行连接。其中,网络连接包括以太网络连接或者无线网络连接。代理设备向目标传感器发送第二工作状态切换指令包括:确定目标传感器的连接方式;按照目标传感器的连接方式,向目标传感器发送第二工作状态切换指令。In some embodiments, the proxy device may support multiple connection methods to connect to the sensor. For sensors that need to be connected via fieldbus, the agent device can connect to such sensors via fieldbus. For sensors that require a network connection, the agent device can connect to such sensors through a network connection. The network connection includes an Ethernet connection or a wireless network connection. The proxy device sending the second working state switching instruction to the target sensor includes: determining the connection mode of the target sensor; and sending the second working state switching instruction to the target sensor according to the connection mode of the target sensor.
也就是说,目标传感器与代理设备间可能是现场总线连接,也可能是网络连接。 代理设备在向目标传感器发送第二工作状态切换指令前,确定该目标传感器的连接方式,按照目标传感器的连接方式,向目标传感器发送第二工作状态切换指令。例如,在目标传感器与代理设备间通过网络连接时,假设为以太网络连接时,可以通过以太网络连接向目标传感器发送第二工作状态切换指令。在目标传感器与代理设备间通过现场总线连接时,则代理设备可以通过现场总线发送目标传感器的第二工作状态切换指令。此时,现场总线上连接的所有设备均可接收到该第二工作状态切换指令,除目标传感器的其他设备接收到第二工作状态切换指令后,检测出该指令不是发送给自身时,不对该指令进行响应。而目标传感器接收到该第二工作状态切换指令后,可以进行相应的工作状态切换。In other words, the connection between the target sensor and the agent device may be a fieldbus or a network connection. Before sending the second working state switching instruction to the target sensor, the agent device 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 agent device are connected through a network, assuming an Ethernet connection, the second working state switching instruction can be sent to the target sensor through the Ethernet connection. When the target sensor and the agent device are connected through a field bus, the agent device can send the second working state switching instruction of the target sensor through the field bus. At this time, all devices connected to the field bus can receive the second working state switching command. After receiving the second working state switching command, other devices except the target sensor detect that the command is not sent to themselves and do not respond to the command. command to respond. 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 can determine at least two target sensors based on the received subscription cancellation message, and the proxy device needs to send a second working state switching instruction to at least two target sensors. Based on this, the agent device sending the second working state switching instruction to the target sensor includes: when there are at least two target sensors, determining the connection mode of each target sensor; according to the connection mode of each target sensor, sending the third working state switching instruction to the target sensor respectively. 2. Working state switching instructions.
即为,在代理设备确定出目标传感器有至少两个时,代理设备可以确定与每个目标传感器的连接方式,根据与每个目标传感器的连接方式,分别向每个目标传感器发送第二工作状态切换指令。That is, when the proxy device determines that there are at least two target sensors, the proxy device can determine the connection mode with each target sensor, and send the second working status to each target sensor according to the connection mode with each target sensor. Switch command.
这样一来,在订阅设备暂停获取目标传感器的测量数据时,向代理设备发送订阅取消消息,代理设备接收到订阅取消消息后,可以根据该订阅取消消息确定出目标传感器,并向目标传感器发送第二工作状态切换指令,以便目标传感器由第一工作状态切换为第二工作状态。目标传感器在第二工作状态时的数据测量频率低于目标传感器在第一工作状态时的数据测量频率。即为,在接收到订阅取消消息时,可以控制目标传感器切换为测量周期更长的第二工作状态,从而可以在无需目标传感器进行监测时,延长目标传感器的监测周期,或者停止数据测量,降低目标传感器在无需进行数据监测时的耗电量,延长目标传感器的电池使用时间,降低工业生产成本。In this way, when the subscribing device pauses to obtain the measurement data of the target sensor, it sends a subscription cancellation message to the agent device. After receiving the subscription cancellation message, the agent device can determine the target sensor based on the subscription cancellation message and send the third message to the target sensor. The second working state switching instruction is to switch the target sensor from the first working state to the second working state. The data measurement frequency of the target sensor in the second working state is lower than the data measurement frequency of the target sensor in the first working state. That is, when receiving the subscription cancellation message, the target sensor can be controlled to switch to the second working state with a longer measurement period, so that when the target sensor is not needed for monitoring, the monitoring period of the target sensor can be extended, or the data measurement can be stopped, reducing the The power consumption of the target sensor when data monitoring is not required extends the battery life of the target sensor and reduces industrial production costs.
参见图3,为本申请实施例提供的一种数据处理方法的流程示意图。该方法应用于传感器,如图3所示,所述方法包括:Refer to Figure 3, which is a schematic flow chart of a data processing method provided by an embodiment of the present application. This method is applied to the sensor, as shown in Figure 3. The method includes:
步骤S301、接收第二工作状态切换指令。Step S301: Receive a second working state switching instruction.
其中,第二工作状态切换指令用于指示目标传感器由第一工作状态切换为第二工作状态第一工作状态是目标传感器以第一测量周期进行数据测量的工作状态。第二工作状态是目标传感器不进行数据测量或者以第二测量周期进行数据测量的工作状态。其中,第二测量周期大于第一测量周期。The second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state. The first working state is a working state in which the target sensor performs data measurement in the first measurement period. The second working state is a working state in which the target sensor does not perform data measurement or performs data measurement in a second measurement cycle. Wherein, the second measurement period is greater than the first measurement period.
在本申请实施例中,目标传感器可以通过与代理设备间的连接进行测量数据的传输。并可以通过其与代理设备间的连接接收到代理设备向目标传感器发送的指令。在代理设备通过与目标传感器间的连接向目标传感器发送第二工作状态切换指令时,目标传感器可以接收到代理设备发送的第二工作状态切换指令。In this embodiment of the present application, the target sensor can transmit measurement data through a connection with the proxy device. And can receive the instructions sent by the agent device to the target sensor through its connection with the agent device. When the proxy device sends a second working state switching instruction to the target sensor through the connection with the target sensor, the target sensor may receive the second working state switching instruction sent by the proxy device.
步骤S302、根据第二工作状态切换指令,将当前工作状态切换为第二工作状 态,并在第二工作状态为以第二测量周期进行数据测量的工作状态时,按照第二测量周期进行数据测量。Step S302: Switch the current working state to the second working state according to the second working state switching instruction. state, and when the second working state is the working state of performing data measurement with the second measurement cycle, perform data measurement according to the second measurement cycle.
在本申请实施例中,目标传感器在接收到第二工作状态切换指令后,在其当前工作状态为第一工作状态时,则可以将当前工作状态由第一工作状态切换为第二工作状态。即为,目标传感器在接收到第二工作状态后,获知需要延长测量周期。此时,若目标传感器在以第一测量周期进行数据测量情况下,可以在接收到第二工作状态切换指令时,将当前工作状态切换至第二工作状态。例如,在第二工作状态为停止数据测量的工作状态时,则目标传感器在接收到第二工作状态切换指令时,停止数据测量。在第二工作状态为以第二测量周期进行数据测量时,则目标传感器在接收到第二工作状态切换指令时,则将测量周期由第一测量周期切换为第二测量周期,以第二测量周期为周期进行数据测量。由于第二测量周期大于第一测量周期,因此,在目标传感器将当前工作状态切换为第二工作状态时,延长了数据测量的测量周期,降低了数据测量的频率,从而可以降低目标传感器的耗电量,提高生产成本。In the embodiment of the present 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 its current working state is the first working state. That is, after receiving the second working state, the target sensor learns that the measurement cycle needs to be extended. At this time, if the target sensor performs data measurement in the first measurement cycle, it can switch the current working state to the second working state when receiving the second working state switching instruction. For example, when the second working state is the working state of stopping data measurement, the target sensor stops data measurement when receiving the second working state switching instruction. When the second working state is to perform data measurement with the second measurement cycle, when the target sensor receives the second working state switching instruction, it switches the measurement cycle from the first measurement cycle to the second measurement cycle, and uses the second measurement cycle to perform data measurement. Data measurements are performed period by period. Since 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 extended and the frequency of data measurement is reduced, thereby reducing the consumption of the target sensor. power and increase production costs.
需要说明的是,目标传感器在以第二测量周期进行数据测量时,其测量的测量数据由于没有订阅设备获取,因此目标传感器测量的测量数据可以不再传输至代理设备,也可以将其以第二测量周期测量的测量数据继续传输至代理设备。此时,代理设备接收到目标传感器传输的测量数据后,由于没有订阅设备需要获取该目标传感器测量的测量数据,因此代理设备可以将接收的测量数据存储至存储设备或者将接收的测量数据删除,代理设备不再向订阅设备发送该目标传感器传输的测量数据。It should be noted that when the target sensor performs data measurement in the second measurement period, the measurement data measured by the target sensor is not obtained by the subscribing device. Therefore, the measurement data measured by the target sensor may no longer be transmitted to the proxy device, or it may be transmitted to the proxy device in the second measurement period. The measurement data measured during the second measurement cycle continue to be transmitted to the agent device. At this time, after the proxy device receives the measurement data transmitted by the target sensor, since there is no subscribing device that needs to obtain the measurement data measured by the target sensor, the proxy device can store the received measurement data in the storage device or delete the received measurement data. The proxy device no longer sends measurement data transmitted by this target sensor to the subscribing device.
参见图4,为本申请实施例提供的另一种数据处理方法的流程示意图。本实施例针对订阅设备向代理设备订阅传感器的场景进行说明。如图4所示,所述方法包括:Refer to Figure 4, which is a schematic flow chart of another data processing method provided by an embodiment of the present application. This embodiment describes a scenario in which a subscribing device subscribes to a sensor from a proxy device. As shown in Figure 4, the method includes:
步骤S401、订阅设备向代理设备发送订阅消息。代理设备接收订阅消息。Step S401: The subscribing device sends a subscription message to the proxy device. The proxy device receives subscription messages.
其中,订阅消息中携带有目标传感器的标识信息。The subscription message carries identification information of the target sensor.
在本申请实施例中,订阅设备在需要获取传感器测量的测量数据时,可以告知代理设备其所需获取的传感器的测量数据,此时订阅设备向代理设备发送订阅消息,且订阅消息中包含有目标传感器的标识信息,其中该目标传感器测量的测量数据是订阅设备需获取的测量数据。In the embodiment of this application, when the subscribing device needs to obtain the measurement data measured by the sensor, it can inform the agent device of the measurement data of the sensor it needs to obtain. At this time, the subscribing device sends a subscription message to the agent device, and the subscription message contains The identification information of the target sensor, where the measurement data measured by the target sensor is the measurement data that the subscribing device needs to obtain.
例如,订阅设备1需要获取传感器1及传感器2测量的测量数据,订阅设备2需要获取传感器3测量的测量数据,则订阅设备1向代理设备发送订阅消息,且订阅设备1发送的订阅消息中携带有传感器1的标识信息及传感器2的标识信息。订阅设备2向代理设备发送订阅消息,且订阅设备发送的订阅消息中携带有传感器3的标识信息。代理设备可以接收订阅设备1发送的订阅消息,接收订阅设备2发送的订阅消息。For example, subscribing device 1 needs to obtain the measurement data measured by sensor 1 and sensor 2, and subscribing device 2 needs to obtain the measurement data measured by sensor 3. Then subscribing device 1 sends a subscription message to the proxy device, and the subscription message sent by subscribing device 1 carries There is identification information of sensor 1 and identification information of sensor 2. The subscribing device 2 sends a subscription message to the proxy device, and the subscription message sent by the subscribing device carries the identification information of the sensor 3 . The proxy device can receive the subscription message sent by the subscribing device 1 and the subscription message sent by the subscribing device 2.
步骤S402、代理设备根据订阅消息,确定目标传感器。Step S402: The agent device determines the target sensor according to the subscription message.
在本申请实施例中,代理设备在接收到订阅消息后,可以解析订阅消息获取到其内携带的目标传感器的标识信息,根据获取的目标传感器的标识信息,确定该订阅设备对应的目标传感器。In this embodiment of the present application, after receiving the subscription message, the proxy device can parse the subscription message to obtain the identification information of the target sensor carried in the subscription message, and determine the target sensor corresponding to the subscription device based on the obtained identification information of the target sensor.
作为一种可能的实现方式,代理设备可以记录订阅设备与目标传感器间的对应关系。这样一来,代理设备可以根据记录的对应关系,获知订阅设备需要获取哪些目标 传感器的测量数据。在获取到目标传感器传输的测量数据时,可以通过记录信息,确定出目标传感器对应的订阅设备,将测量数据发送至订阅设备。例如,代理设备可以针对每个传感器设置有该传感器的订阅列表。在订阅列表中记录有订阅了该传感器的订阅设备的标识信息。这样一来,在接收到订阅设备发送的订阅消息,解析出目标传感器的标识信息后,可以根据该目标传感器的标识信息查找出目标传感器的订阅列表,并将订阅设备的标识信息添加至该目标传感器的订阅列表中。当然,代理设备还可以通过其他方式记录传感器与订阅设备间的对应关系,本申请对此不作限制。As a possible implementation, the proxy device can record the correspondence between the subscribing device and the target sensor. In this way, the agent device can learn which targets the subscribing device needs to obtain based on the recorded correspondence. Sensor measurement data. When the measurement data transmitted by the target sensor is obtained, the subscribing device corresponding to the target sensor can be determined by recording the information, and the measurement data can be sent to the subscribing device. For example, the proxy device may be configured with a subscription list for each sensor. The identification information of the subscribing device that subscribes to the sensor is recorded in the subscription list. In this way, after receiving the subscription message sent by the subscribing device and parsing the identification information of the target sensor, the subscription list of the target sensor can be found based on the identification information of the target sensor, and the identification information of the subscribing device is added to the target in the sensor's subscription list. Of course, the proxy device can also record the correspondence between the sensor and the subscribing device in other ways, and this application does not limit this.
如上述示例,代理设备在接收到订阅设备1发送的订阅消息后,可以解析订阅设备1发送的订阅消息,获取到其内携带的传感器1的标识信息及传感器2的标识信息。代理设备可以根据传感器1的标识信息及传感器2的标识信息,将传感器1及传感器2确定为订阅设备1对应的目标传感器。代理设备可以根据传感器3的标识信息,将传感器3确定为订阅设备2对应的目标传感器。As in the above example, after receiving the subscription message sent by the subscribing device 1, the proxy device can parse the subscription message sent by the subscribing device 1 and obtain the identification information of sensor 1 and the identification information of sensor 2 carried in it. The proxy device can determine sensor 1 and sensor 2 as the target sensors corresponding to the subscribing device 1 based on the identification information of sensor 1 and the identification information of sensor 2. The proxy device can determine sensor 3 as the target sensor corresponding to subscribing device 2 based on the identification information of sensor 3.
步骤S403、代理设备获取目标传感器的订阅状态。Step S403: The proxy device obtains the subscription status of the target sensor.
在本申请实施例中,代理设备在接收到订阅设备发送的订阅消息后,通过订阅消息中携带的目标传感器的标识信息可以确定出目标传感器,从而可以获知订阅设备需要订阅目标传感器测量的测量数据,即为获知订阅设备需要获取目标传感器测量的测量数据。由于一个传感器的数据可以被多个订阅设备进行订阅获取;当传感器未被任何一个订阅设备订阅时,则代理设备记录该传感器的订阅状态为未订阅状态,且需控制该传感器工作在第二工作状态,以使得传感器停止测量数据或者降低测量数据的频率。当传感器被至少一个订阅设备订阅时,则代理设备记录该传感器的订阅状态为已订阅状态,代理设备控制该传感器工作在第一工作状态,以使得该传感器正常进行数据测量。因此,代理设备在接收到订阅消息,确定出目标传感器时,需要检测该目标传感器的当前订阅状态,以便在当前订阅状态为未订阅状态时,控制目标传感器切换工作状态。基于此,在代理设备确定出目标传感器时,可以查看记录的该目标传感器的当前订阅状态,以获知目标传感器是否处于未订阅状态。In this embodiment of the present application, after receiving the subscription message sent by the subscribing device, the proxy device can determine the target sensor through the identification information of the target sensor carried in the subscription message, thereby knowing that the subscribing device needs to subscribe to the measurement data measured by the target sensor. , that is, to know that the subscribing device needs to obtain the measurement data measured by the target sensor. Since the data of a sensor can be subscribed and obtained by multiple subscribing devices; when the sensor is not subscribed by any subscribing device, the proxy device records the sensor's subscription status as unsubscribed, and needs to control the sensor to work in the second job status, so that the sensor stops measuring data or reduces the frequency of measuring data. When a sensor is subscribed by at least one subscribing device, the proxy device records the subscription status of the sensor as a subscribed status, and the proxy device controls the sensor to work in the first working state so that the sensor can perform data measurement normally. Therefore, when the agent device receives the subscription message and determines the target sensor, it needs to detect the current subscription status of the target sensor, so as to control the target sensor to switch working status when the current subscription status is unsubscribed. Based on this, when the proxy device determines a target sensor, it can check the recorded current subscription status of the target sensor to learn whether the target sensor is in an unsubscribed state.
需要说明的是,订阅状态是代理设备记录传感器是否被订阅设备订阅的状态信息,是代理设备根据每个传感器是否被订阅设备订阅以获取测量数据而记录的。例如,在传感器未被任何订阅设备订阅以获取测量数据时,则记录该传感器的订阅状态为未订阅状态。在传感器被至少一个订阅设备订阅以获取测量数据时,则记录该传感器的订阅状态为已订阅状态。It should be noted that the subscription status is the status information of the proxy device that records whether the sensor is subscribed by the subscribing device. It is recorded by the proxy device to obtain measurement data based on whether each sensor is subscribed by the subscribing device. For example, when a sensor is not subscribed by any subscribing device to obtain measurement data, the subscription status of the sensor is recorded as unsubscribed. When a sensor is subscribed by at least one subscribing device to obtain measurement data, the subscription status of the sensor is recorded as a subscribed status.
作为一种可能的实现方式,代理设备根据订阅消息可能确定出一个或多个目标传感器。例如,代理设备接收的订阅消息中可能携带有至少一个目标传感器的标识信息。代理设备可以根据订阅消息确定出至少一个目标传感器。或者,代理设备接收至少一个订阅设备发送的订阅消息。代理设备可以根据接收的至少一个订阅消息,确定出至少一个目标传感器。代理设备需要获取至少一个目标传感器中每个目标传感器的订阅状态。As a possible implementation, the agent device may determine one or more target sensors based on the subscription message. For example, the subscription message received by the proxy device may carry identification information of at least one target sensor. The agent device can determine at least one target sensor based on the subscription message. Alternatively, the proxy device receives a subscription message sent by at least one subscribing device. The agent device may determine at least one target sensor based on at least one subscription message received. The agent device needs to obtain the subscription status of each target sensor in at least one target sensor.
例如,订阅设备1需要获取传感器1测量的测量数据,订阅设备2需要获取传感器2测量的测量数据。如图5a及图5b所示,订阅设备1及订阅设备2向代理设备发送订阅消息。其中,订阅设备1向代理设备发送的订阅消息中携带有传感器1的标识 信息。订阅设备2向代理设备发送的订阅消息中携带有传感器2的标识信息。代理设备接收到订阅设备1发送的订阅消息后,可以通过解析订阅消息获知传感器1的标识信息,进而可以确定订阅设备1需要获取传感器1测量的测量数据。代理设备可以根据传感器1的标识信息,确定目标传感器为传感器1。代理设备可以获取记录的传感器1的订阅状态。同理,代理设备接收到订阅设备2发送的订阅消息后,可以通过解析订阅消息获知传感器2的标识信息,进而可以确定订阅设备2需要获取传感器2测量的测量数据。代理设备根据传感器2的标识信息确定目标传感器为传感器2,可以获取记录的传感器2的订阅状态。For example, subscribing device 1 needs to obtain the measurement data measured by sensor 1, and subscribing device 2 needs to obtain the measurement data measured by sensor 2. As shown in Figure 5a and Figure 5b, subscription device 1 and subscription device 2 send subscription messages to the proxy device. Among them, the subscription message sent by the subscribing device 1 to the agent device carries the identification of the sensor 1 information. The subscription message sent by the subscribing device 2 to the agent device carries the identification information of the sensor 2 . After receiving the subscription message sent by the subscribing device 1, the agent device can learn the identification information of the sensor 1 by parsing the subscription message, and then determine that the subscribing device 1 needs to obtain the measurement data measured by the sensor 1. The agent device can determine that the target sensor is Sensor 1 based on the identification information of Sensor 1 . The agent device can obtain the recorded subscription status of sensor 1. Similarly, after receiving the subscription message sent by the subscribing device 2, the proxy device can learn the identification information of the sensor 2 by parsing the subscription message, and then determine that the subscribing device 2 needs to obtain the measurement data measured by the sensor 2. The proxy device determines that the target sensor is sensor 2 based on the identification information of sensor 2, and can obtain the recorded subscription status of sensor 2.
应理解的,由于订阅状态包括已订阅状态及未订阅状态两种状态,因此代理设备根据获取的目标传感器的订阅状态不同,下面执行的步骤也不同。在代理设备确定目标传感器的订阅状态为未订阅状态时,则执行下述步骤S404a-S405a,步骤S406-S408。在代理设备确定目标传感器的订阅状态为已订阅状态时,则执行下述步骤S404b,步骤S406-S408。It should be understood that since the subscription state includes two states: subscribed state and unsubscribed state, the following steps performed by the proxy device are different depending on the obtained subscription state of the target sensor. When the proxy device determines that the subscription status of the target sensor is the unsubscribed status, it executes the following steps S404a-S405a and steps S406-S408. When the proxy device determines that the subscription status of the target sensor is the subscribed status, the following steps S404b and S406-S408 are executed.
步骤S404a、代理设备在检测出目标传感器的订阅状态为未订阅状态时,将目标传感器的订阅状态由未订阅状态更新为已订阅状态,将目标传感器的订阅数量增加第二预设值,并向目标传感器发送第一工作状态切换指令。目标传感器接收第一工作状态切换指令。Step S404a: When detecting that the subscription status of the target sensor is the unsubscribed status, the proxy device updates the subscription status of the target sensor from the unsubscribed status to the subscribed status, increases the subscription number of the target sensor by the second preset value, and adds The target sensor sends a first working state switching instruction. The target sensor receives the first working state switching instruction.
其中,第一工作状态切换指令用于指示目标传感器由第二工作状态切换为第一工作状态。The first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state.
在本申请实施例中,代理设备在获取了目标传感器的订阅状态时,可以检测目标传感器的订阅状态,在检测出目标传感器的订阅状态为未订阅时,说明目标传感器未被其他订阅设备订阅获取测量数据,其工作状态为第二工作状态。由于订阅设备需要对目标传感器测量的测量数据进行获取,因此,代理设备可以将目标传感器的订阅状态由未订阅状态更新为已订阅状态,并将目标传感器的订阅数量增加第二预设值,以便记录有几个订阅设备对目标传感器测量的测量数据进行订阅获取。代理设备可以向目标传感器发送第一工作状态切换指令,以便目标传感器的工作状态由第二工作状态切换为第一工作状态,使目标传感器处于正常的数据测量周期,进行相应的数据测量。此时,目标传感器可以接收到代理设备发送的第一工作状态切换指令。In the embodiment of this application, when the proxy device obtains the subscription status of the target sensor, it can detect the subscription status of the target sensor. When it detects that the subscription status of the target sensor is unsubscribed, it means that the target sensor has not been subscribed by other subscribing devices. Measurement data, its working state is the second working state. Since the subscribing device needs to obtain the measurement data measured by the target sensor, the proxy device can update the subscription status of the target sensor from the unsubscribed status to the subscribed status, and increase the subscription number of the target sensor by the second preset value, so that It is recorded that several subscribing devices subscribe to obtain the measurement data measured by the target sensor. The agent device can send a first working state switching instruction to the target sensor, so that the working state of the target sensor switches from the second working state to the first working state, so that the target sensor is in a normal data measurement cycle and performs corresponding data measurement. At this time, the target sensor can receive the first working state switching instruction sent by the proxy device.
需要说明的是,第二预设值是预先设置的每次改变订阅数量的改变量。第二预设值可以由本领域技术人员根据实际经验设定,或者,根据大数据分析的结果而得到,本申请实施例对此不作限制。作为一种可能的实现方式,第二预设值为1。It should be noted that the second preset value is a preset change amount each time the subscription quantity is changed. The second preset value can be set by those skilled in the art based on actual experience, or obtained based on the results of big data analysis, which is not limited in the embodiments of the present application. As a possible implementation, the second preset value is 1.
作为一种可能的实现方式,代理设备向目标传感器发送第一工作状态切换指令时,按照代理设备与目标传感器的连接方式,向目标传感器发送工作状态切换指令。As a possible implementation manner, when the agent device sends the first working state switching instruction to the target sensor, it sends the working state switching instruction to the target sensor according to the connection mode between the agent device and the target sensor.
即为,代理设备与目标传感器间的连接方式可以是现场总线连接,也可以是网络连接,还可以是其他方式连接。代理设备在向目标传感器发送第一工作状态切换指令时,可以根据与目标传感器间的连接方式发送第一工作状态切换指令。例如,代理设备与目标传感器通过现场总线连接时,则代理设备向现场总线发送目标传感器的第一工作状态切换指令,目标传感器可以通过现场总线接收第一工作状态切换指令。代理设备通过目标传感器间通过网络连接时,例如通过以太网络连接或者无线网络连接 时,则代理设备可以通过以太网络连接或无线网络连接向目标传感器发送第一工作状态切换指令。That is, the connection method between the agent device and the target sensor can be a fieldbus connection, a network connection, or other ways of connection. When the agent device sends the first working state switching instruction to the target sensor, the agent device may send the first working state switching instruction according to the connection mode with the target sensor. For example, when the agent device and the target sensor are connected through a field bus, the agent device sends the first working state switching instruction of the target sensor to the field bus, and the target sensor can receive the first working state switching instruction through the field bus. When the proxy device is connected to the target sensor through a network, such as an Ethernet connection or a wireless network connection , the agent device can send the first working state switching instruction to the target sensor through the Ethernet network connection or the wireless network connection.
需要说明的是,代理设备与目标传感器通过现场总线连接时,代理设备通过现场总线发送目标传感器的第一工作状态切换指令时,现场总线上连接的其他设备也可以接收到该指令,由于第一工作状态切换指令是发送给目标传感器的,因此其他设备接收到该第一工作状态切换指令时,并不进行相应处理。It should be noted that when the agent device and the target sensor are connected through the field bus, when the agent device sends the first working state switching instruction of the target sensor through the field bus, other devices connected on the field bus can also receive the instruction, because the first The working state switching instruction is sent to the target sensor, so when other devices receive the first working state switching instruction, they do not perform corresponding processing.
作为一种可能的实现方式,代理设备在确定出至少一个目标传感器后需要获取至少一个目标传感器的订阅状态,进而在至少一个目标传感器的订阅状态为未订阅时,向至少一个目标传感器发送第一工作状态切换指令。As a possible implementation manner, after determining at least one target sensor, the proxy device needs to obtain the subscription status of at least one target sensor, and then when the subscription status of at least one target sensor is unsubscribed, send the first message to the at least one target sensor. Working status switching instructions.
作为一种可能的实现方式,在目标传感器包含至少两个时,代理设备向目标传感器发送第一工作状态切换指令包括:在目标传感器有至少两个时,确定每个目标传感器的连接方式;按照每个目标传感器的连接方式,分别向目标传感器发送第一工作状态切换指令。As a possible implementation manner, when the target sensor contains at least two, the agent device sends the first working state switching instruction to the target sensor including: when there are at least two target sensors, determining the connection mode of each target sensor; according to The connection mode of each target sensor sends a first working state switching instruction to the target sensor respectively.
也就是说,在目标传感器包含至少两个时,则每个目标传感器与代理设备间的连接方式可以不相同。此时,代理设备可以根据每个目标传感器的连接方式向每个目标传感器发送第一工作状态切换指令。That is to say, when there are at least two target sensors, the connection method between each target sensor and the proxy device may be different. At this time, the proxy device can send a first working state switching instruction to each target sensor according to the connection mode of each target sensor.
如上例所示,参考图5a所示,代理设备获取到传感器1的订阅状态后,假设代理设备检测到传感器1的订阅状态为未订阅状态,且传感器1与代理设备间通过现场总线连接,则代理设备可以通过现场总线向传感器1发送第一工作状态切换指令。传感器1通过现场总线接收第一工作状态切换指令。同理,代理设备获取到传感器2的订阅状态后,假设代理设备检测都传感器2的订阅状态为未订阅状态,且传感器2与代理设备间通过以太网络连接,则代理设备可以通过以太网络连接向传感器2发送第一工作状态切换指令。传感器2通过以太网络接收第一工作状态切换指令。As shown in the above example, refer to Figure 5a, after the proxy device obtains the subscription status of sensor 1, assuming that the proxy device detects that the subscription status of sensor 1 is unsubscribed, and the sensor 1 and the proxy device are connected through a field bus, then The agent device can send the first working state switching instruction to the sensor 1 through the field bus. Sensor 1 receives the first working state switching instruction through the field bus. Similarly, after the proxy device obtains the subscription status of sensor 2, assuming that the proxy device detects that the subscription status of sensor 2 is unsubscribed, and the sensor 2 and the proxy device are connected through the Ethernet network, the proxy device can connect to the sensor through the Ethernet network. Sensor 2 sends a first working state switching instruction. Sensor 2 receives the first working state switching instruction through the Ethernet network.
步骤S404b、代理设备在目标传感器的订阅状态为已订阅时,将目标传感器的订阅数量增加第二预设值。Step S404b: When the subscription status of the target sensor is subscribed, the proxy device increases the subscription number of the target sensor by the second preset value.
在本申请实施例中,代理设备在获取了目标传感器的订阅状态时,可以检测目标传感器的订阅状态,在检测出目标传感器的订阅状态为已订阅状态时,说明目标传感器已被其他订阅设备订阅获取测量数据,其工作状态为第一工作状态。此时,代理设备无需再向目标传感器发送第一工作状态切换指令,只需将目标传感器的订阅数量增加第二预设值。In the embodiment of this application, when the proxy device obtains the subscription status of the target sensor, it can detect the subscription status of the target sensor. When it detects that the subscription status of the target sensor is the subscribed status, it means that the target sensor has been subscribed by other subscribing devices. Obtain measurement data, and its working state is the first working state. At this time, the proxy device no longer needs to send the first working state switching instruction to the target sensor, and only needs to increase the subscription number of the target sensor by the second preset value.
如上例所示,参考图5b所示,代理设备获取到传感器1的订阅状态后,假设代理设备检测到传感器1的订阅状态为未订阅状态,且传感器1与代理设备间通过现场总线连接,则代理设备可以通过现场总线向传感器1发送第一工作状态切换指令。传感器1通过现场总线接收第一工作状态切换指令。代理设备获取到传感器2的订阅状态后,假设代理设备检测都传感器2的订阅状态为已订阅状态,且传感器2与代理设备间通过以太网络连接,则代理设备无需向传感器2发送第一工作状态切换指令,假设第二预设值为1,则代理设备将传感器2的订阅数量增加1。As shown in the above example, refer to Figure 5b, after the proxy device obtains the subscription status of sensor 1, assuming that the proxy device detects that the subscription status of sensor 1 is unsubscribed, and the sensor 1 and the proxy device are connected through a field bus, then The agent device can send the first working state switching instruction to the sensor 1 through the field bus. Sensor 1 receives the first working state switching instruction through the fieldbus. After the proxy device obtains the subscription status of sensor 2, assuming that the proxy device detects that the subscription status of sensor 2 is the subscribed status, and the sensor 2 and the proxy device are connected through the Ethernet network, the proxy device does not need to send the first working status to sensor 2. Switching instruction, assuming that the second preset value is 1, the agent device increases the subscription number of sensor 2 by 1.
步骤S405a、目标传感器根据第一工作状态切换指令,将当前工作状态切换为第一工作状态,并在第一工作状态为以第一测量周期进行数据测量的工作状态时,按照 第一测量周期进行数据测量。Step S405a: The target sensor switches the current working state to the first working state according to the first working state switching instruction, and when the first working state is the working state of performing data measurement with the first measurement period, according to Data measurement is performed in the first measurement cycle.
在本申请实施例中,目标传感器接收到第一工作状态切换指令后,在其工作在第二工作状态时,即为在目标传感器停止数据测量或者以第二测量周期进行数据测量时,目标传感器接收到第一工作状态切换指令后,获知需要将工作状态由第二工作状态切换为第一工作状态,此时,目标传感器可以将其工作状态切换为第一工作状态。即为,目标传感器将其工作状态调整为以第一测量周期为周期进行数据测量的工作状态,并按照第一测量周期进行数据的测量。In the embodiment of the present application, after the target sensor receives the first working state switching instruction, when it works in the second working state, that is, when the target sensor stops data measurement or performs data measurement in the second measurement cycle, the target sensor After receiving the first working state switching instruction, it is learned that the working state needs to be switched from the second working state to the first working state. At this time, the target sensor can switch its working state to the first working state. That is, the target sensor adjusts its working state to a working state in which the data is measured with the first measurement cycle as a cycle, and the data is measured according to the first measurement cycle.
例如,传感器1接收到代理设备发送的第一工作状态切换指令后,将自身的工作状态由第二工作状态切换为第一工作状态。假设传感器1的第二工作状态为停止数据测量,则传感器1在接收到第一工作状态切换指令后,由停止进行数据测量切换为以第一测量周期为周期进行数据测量的工作状态,按照第一测量周期周期性的进行数据测量。For example, after receiving the first working state switching instruction sent by the agent device, the sensor 1 switches its own working state from the second working state to the first working state. Assuming that the second working state of sensor 1 is to stop data measurement, after receiving the first working state switching instruction, sensor 1 switches from stopping data measurement to the working state of performing data measurement with the first measurement cycle as the cycle. According to the second A measurement cycle performs data measurement periodically.
步骤S406、代理设备获取目标传感器的测量数据。Step S406: The agent device obtains the measurement data of the target sensor.
在本申请实施例中,目标传感器在以第一测量周期周期性进行数据测量后,可以将其测量的测量数据传输至代理设备,以便代理设备将该测量数据传输至相应的订阅设备。例如。目标传感器可以将测量的测量数据直接发送至代理设备,可以由代理设备从目标传感器中获取该目标传感器的测量数据。In the embodiment of the present application, after the target sensor periodically performs data measurement in the first measurement period, it can transmit its measured measurement data to the proxy device, so that the proxy device transmits the measurement data to the corresponding subscribing device. For example. The target sensor can send measured measurement data directly to the proxy device, and the proxy device can 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 target sensor can add the identification information of the target sensor to the measurement data and send it to the proxy device.
作为一种可能的实现方式,代理设备根据其与目标传感器的连接方式不同,获取测量数据的方式不同。具体代理设备获取目标传感器发送的测量数据包括:As a possible implementation, the proxy device obtains measurement data in different ways depending on its connection method to the target sensor. The specific agent device obtains the measurement data sent by the target sensor including:
在目标传感器与代理设备通过现场总线连接时,则代理设备通过现场总线查询目标传感器以获取目标传感器发送的测量数据。或者,在目标传感器与代理设备通过网络连接时,则代理设备通过网络连接接收目标传感器发送的测量数据。When the target sensor and the proxy device are connected through the fieldbus, the proxy device queries the target sensor through the fieldbus to obtain the measurement data sent by the target sensor. Alternatively, when the target sensor and the proxy device are connected through a network, the proxy device receives the measurement data sent by the target sensor through the network connection.
即为,目标传感器与代理设备通过现场总线连接或者通过网络连接,因此目标传感器在向代理设备发送测量数据时,若目标传感器与代理设备间通过现场总线连接时,则代理设备通过现场总线查询目标传感器的测量数据,获取该目标传感器的测量数据。此时,代理设备可以在查询目标传感器的测量数据时,同时可以确定出目标传感器的标识信息。That is, the target sensor and the proxy device are connected through a fieldbus or a network. Therefore, when the target sensor sends measurement data to the proxy device, if the target sensor and the proxy device are connected through a fieldbus, the proxy device queries the target through the fieldbus. Sensor measurement data, obtain the measurement data of the target sensor. At this time, the agent device can determine the identification information of the target sensor while querying the measurement data of the target sensor.
在目标传感器与代理设备间通过网络连接时,则目标传感器通过网络连接向代理设备发送测量数据,代理设备通过网络连接接收目标传感器发送的测量数据。When the target sensor and the proxy device are connected through a network, the target sensor sends measurement data to the proxy device through the network connection, and the proxy device receives the measurement data sent by the target sensor through the network connection.
如上例所述,代理设备需通过现场总线查询传感器1的测量数据。此时传感器1可以将其测量的测量数据通过现场总线传输至代理设备。传感器2可以将其获取的测量数据通过以太网络连接传输至代理设备。代理设备可以通过与传感器1间的现场总线接收到传感器1发送的测量数据,通过与传感器2间的以太网络连接接收到传感器2发送的测量数据。As mentioned in the above example, the agent device needs to query the measurement data of sensor 1 through the fieldbus. At this point sensor 1 can transmit its measured measurement data to the agent device through the fieldbus. Sensor 2 can transmit the measurement data it acquires to the agent device via an Ethernet connection. The agent device can receive the measurement data sent by sensor 1 through the fieldbus with sensor 1, and can receive the measurement data sent by sensor 2 through the Ethernet connection with sensor 2.
步骤S407、代理设备获取目标传感器的标识信息,并根据目标传感器的标识信息确定目标传感器的至少一个订阅设备。Step S407: The proxy device obtains the identification information of the target sensor, and determines at least one subscribing device of the target sensor based on the identification information of the target sensor.
在本申请实施例中,代理设备在接收订阅设备发送的订阅消息时,可以在确定出 该订阅设备对应的目标传感器时,可以记录订阅设备与目标传感器间的对应关系。代理设备在获取到目标传感器的测量数据后,可以根据接收的测量数据确定出目标传感器的标识信息,从而可以根据目标传感器的标识信息,查找记录的订阅设备与目标传感器间的对应关系,确定出该目标传感器对应的至少一个订阅设备。In this embodiment of the present application, when receiving the subscription message sent by the subscribing device, the proxy device may determine When subscribing to the target sensor corresponding to the device, the corresponding relationship between the subscribing device and the target sensor can be recorded. After obtaining the measurement data of the target sensor, the proxy device can determine the identification information of the target sensor based on the received measurement data, so that it can find the corresponding relationship between the recorded subscription device and the target sensor based on the identification information of the target sensor, and determine the At least one subscribing device corresponding to this target sensor.
作为一种可能的实现方式,测量数据中携带有目标传感器的标识信息,此时代理设备接收的测量数据后,可以解析测量数据,获取目标传感器的标识信息。As a possible implementation method, the measurement data carries the identification information of the target sensor. At this time, after the proxy device receives the measurement data, it can parse the measurement data and obtain the identification information of the target sensor.
当然,代理设备还可以通过其方式获取目标传感器的标识信息。例如,代理设备与传感器建立连接时,可以同时记录该连接对应的传感器的标识信息。此时,代理设备在通过与目标传感器的连接接收到测量数据时,可以记录的该连接对应的传感器的标识信息,确定出目标传感器的标识信息。当然,还可以是其他方式获取目标传感器的标识信息,本申请对此不作限制。Of course, the proxy device can also obtain the identification information of the target sensor through its own method. For example, when a proxy device establishes a connection with a sensor, it can also record the identification information of the sensor corresponding to the connection. At this time, when the proxy device receives measurement data through a connection with the target sensor, it 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 can also be obtained in other ways, and this application does not limit this.
步骤S408、代理设备向目标传感器的至少一个订阅设备发送测量数据。至少一个订阅设备接收测量数据。Step S408: The proxy device sends measurement data to at least one subscribing device of the target sensor. At least one subscribing device receives measurement data.
在本申请实施例中,代理设备在确定出目标传感器的至少一个订阅设备时,可以向至少一个订阅设备发送目标传感器的测量数据,以便至少一个订阅设备获取到目标传感器的测量数据,并进行相应的处理。In this embodiment of the present application, when the proxy device determines at least one subscribing device of the target sensor, it can send the measurement data of the target sensor to the at least one subscribing device, so that the at least one subscribing device obtains the measurement data of the target sensor and performs corresponding processing. processing.
这样一来,在本申请实施例中,订阅设备可以向代理设备发送订阅消息,代理设备可以根据订阅消息确定目标传感器,并控制目标传感器以第一工作状态进行数据测量。并且,代理设备可以同时支持多种连接方式,以实现与不同连接方式的传感器进行连接,从而可以获取多种连接方式的传感器的测量数据,减少了分站的使用数量,大大降低了工业成本。In this way, in this embodiment of the present application, the subscribing device can send a subscription message to the proxy device, and the proxy device can determine the target sensor based on the subscription message, and control the target sensor to perform data measurement in the first working state. In addition, the agent device can support multiple connection methods at the same time to connect to sensors with different connection methods, so that measurement data of sensors with multiple connection methods can be obtained, reducing the number of sub-stations used and greatly reducing industrial costs.
参见图6,为本申请实施例提供的另一种数据处理方法的流程示意图。本实施例相对于上述图4所述的实施例增加了取消订阅传感器的相关步骤。如图6所示,所述方法包括:Refer to Figure 6, which is a schematic flow chart of another data processing method provided by an embodiment of the present application. Compared with the above-mentioned embodiment described in FIG. 4 , this embodiment adds the relevant steps of unsubscribing from the sensor. As shown in Figure 6, the method includes:
步骤S601、订阅设备向代理设备发送订阅消息。代理设备接收订阅消息。Step S601: The subscribing device sends a subscription message to the proxy device. The proxy device receives subscription messages.
具体可参考步骤S401在此不再赘述。For details, please refer to step S401, which will not be described again here.
步骤S602、代理设备根据订阅消息,确定目标传感器。Step S602: The agent device determines the target sensor according to the subscription message.
具体可参考步骤S402在此不再赘述。For details, please refer to step S402, which will not be described again here.
步骤S603、代理设备获取目标传感器的订阅状态。Step S603: The proxy device obtains the subscription status of the target sensor.
具体可参考步骤S403在此不再赘述。For details, please refer to step S403, which will not be described again here.
应理解的,由于订阅状态包括已订阅状态及未订阅状态两种状态,因此代理设备根据获取的目标传感器的订阅状态不同,下面执行的步骤也不同。在代理设备确定目标传感器的订阅状态为未订阅状态时,则执行下述步骤S604a-S605a,步骤S606-S608。在代理设备确定目标传感器的订阅状态为订阅状态时,则执行下述步骤S604b,步骤S606-S608。It should be understood that since the subscription state includes two states: subscribed state and unsubscribed state, the following steps performed by the proxy device are different depending on the obtained subscription state of the target sensor. When the proxy device determines that the subscription status of the target sensor is the unsubscribed status, it executes the following steps S604a-S605a and steps S606-S608. When the proxy device determines that the subscription state of the target sensor is the subscription state, the following steps S604b and S606-S608 are executed.
步骤S604a、在目标传感器的订阅状态为未订阅状态时,将目标传感器的订阅状态由未订阅状态更新为已订阅状态,将目标传感器的订阅数量增加第二预设值,并向目标传感器发送第一工作状态切换指令。目标传感器接收第一工作状态切换指令。Step S604a: When the subscription status of the target sensor is an unsubscribed status, update the subscription status of the target sensor from the unsubscribed status to the subscribed status, increase the subscription number of the target sensor by a second preset value, and send the third preset value to the target sensor. A working state switching command. The target sensor receives the first working state switching instruction.
其中,第一工作状态切换指令用于指示目标传感器由第二工作状态切换为第一工 作状态。Wherein, the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state. operating status.
具体可参考步骤S404a在此不再赘述。For details, please refer to step S404a, which will not be described again here.
步骤S604b、在目标传感器的订阅状态为已订阅时,将目标传感器的订阅数量增加第二预设值。Step S604b: When the subscription status of the target sensor is subscribed, increase the subscription number of the target sensor by a second preset value.
具体可参考步骤S404b在此不再赘述。For details, please refer to step S404b, which will not be described again here.
步骤S605a、目标传感器根据第一工作状态切换指令,将当前工作状态切换为第一工作状态,并在第一工作状态为以第一测量周期进行数据测量的工作状态时,按照第一测量周期进行数据测量。Step S605a: The target sensor switches the current working state to the first working state according to the first working state switching instruction, and when the first working state is the working state of performing data measurement with the first measurement cycle, performs the measurement according to the first measurement cycle. Data measurement.
具体可参考步骤S405a在此不再赘述。For details, please refer to step S405a, which will not be described again here.
步骤S606、代理设备获取目标传感器的测量数据。Step S606: The agent device obtains the measurement data of the target sensor.
具体可参考步骤S406在此不再赘述。For details, please refer to step S406, which will not be described again here.
步骤S607、代理设备获取目标传感器的标识信息,并根据目标传感器的标识信息确定目标传感器的至少一个订阅设备。Step S607: The proxy device obtains the identification information of the target sensor, and determines at least one subscribing device of the target sensor based on the identification information of the target sensor.
具体可参考步骤S407在此不再赘述。For details, please refer to step S407, which will not be described again here.
步骤S608、代理设备向目标传感器的至少一个订阅设备发送测量数据。至少一个订阅设备接收测量数据。Step S608: The proxy device sends measurement data to at least one subscribing device of the target sensor. At least one subscribing device receives measurement data.
具体可参考步骤S408在此不再赘述。For details, please refer to step S408, which will not be described again here.
步骤S609、订阅设备向代理设备发送订阅取消消息。代理设备接收订阅取消消息。Step S609: The subscribing device sends a subscription cancellation message to the proxy device. The proxy device receives the subscription cancellation message.
其中,订阅取消消息中携带有目标传感器的标识信息。The subscription cancellation message carries the identification information of the target sensor.
具体可参考步骤S201在此不再赘述。For details, please refer to step S201, which will not be described again here.
步骤S610、代理设备根据订阅取消消息,确定目标传感器。Step S610: The agent device determines the target sensor according to the subscription cancellation message.
具体可参考步骤S202在此不再赘述。For details, please refer to step S202, which will not be described again here.
作为一种可能的实现方式,代理设备在确定出目标传感器时,由于订阅设备不再需要获取目标传感器的测量数据,此时代理设备可以将记录的订阅设备与目标传感器间的对应关系删除,从而不再为订阅设备发送目标传感器的测量数据。例如,将目标传感器的订阅列表中记录的该订阅设备的标识信息删除。As a possible implementation method, when the proxy device determines the target sensor, since the subscribing device no longer needs to obtain the measurement data of the target sensor, the proxy device can delete the recorded correspondence between the subscribing device and the target sensor, thereby Measurement data from the target sensor is no longer sent for subscribing devices. For example, delete the identification information of the subscribing device recorded in the subscription list of the target sensor.
步骤S611、代理设备获取目标传感器的订阅数量,并将目标传感器的订阅数量减少第一预设值。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 this embodiment of the present application, after receiving the subscription cancellation message, the proxy device can parse the subscription message to obtain the identification information of the target sensor carried in the subscription message, and then determine the target sensor whose measurement data needs to be canceled by the subscribing device. Since the target sensor may be subscribed by multiple subscribing devices at the same time, that is, multiple subscribing devices need to obtain the measurement data of the target sensor at the same time. When one of the subscribing devices unsubscribes from the measurement data of the target sensor, there are other subscribing devices that need to subscribe. The target sensor measures data, so the target sensor still works in the first working state. When the target sensor is subscribed to only one subscribing device and the subscribing device unsubscribes the measurement data of the target sensor, that is, when no subscribing device subscribes to the measurement data of the target sensor, the working state of the target sensor needs to be switched to the second state. working status to reduce the power consumption of the target sensor. Therefore, it is necessary to record the number of subscriptions of the target sensor. Every time a subscription device is added to subscribe to the test data of the target sensor, the subscription number is increased by the second preset value. Every time a subscription device is reduced to subscribe to the test data of the target sensor, When testing data, the number of subscriptions is reduced by the first preset value. Based on this, after receiving the subscription cancellation message sent by the subscribing device and determining the target sensor, the proxy device may obtain the subscription number of the target sensor and reduce the subscription number of the target sensor by the first preset value.
作为一种可能的实现方式,第一预设值与第二预设值相等。As a possible implementation manner, the first preset value and the second preset value are equal.
作为一种可能的实现方式,第一预设值为1。As a possible implementation, the first preset value is 1.
步骤S612、代理设备在目标传感器的订阅数量等于或小于预设阈值时,获取将目标传感器的订阅状态,并将目标传感器的订阅状态由已订阅状态更新为未订阅状态。Step S612: When the number of subscriptions to the target sensor is equal to or less than the preset threshold, the proxy device obtains the subscription status of the target sensor and updates the subscription status of the target sensor from the subscribed status to the unsubscribed status.
在本申请实施例中,代理设备在将目标传感器的订阅数量减少第一阈值,即为更新了目标传感器的订阅数量后,可以将更新后的目标传感器的订阅数量与预设阈值进行比较。在目标传感器的订阅数量小于或等于预设阈值时,则说明没有订阅设备订阅目标传感器的测量数据,此时代理设备可以获取记录的目标传感器的订阅状态,将目标传感器的订阅状态由已订阅状态更新为未订阅状态。In this embodiment of the present application, after the proxy device reduces the subscription number of the target sensor by the first threshold, that is, after updating the subscription number of the target sensor, the proxy device can compare the updated subscription number of the target sensor with the preset threshold. When the number of subscriptions to the target sensor is less than or equal to the preset threshold, it means that no subscribing device subscribes to the measurement data of the target sensor. At this time, the proxy device can obtain the recorded subscription status of the target sensor and change the subscription status of the target sensor from the subscribed status. Updated to unsubscribed status.
需要说明的是,当目标传感器的订阅数据数量大于预设阈值时,说明还有其他订阅设备需获取该目标传感器的测量数据。此时,可以重新执行步骤S607,直至该目标传感器的订阅数据小于或等于预设阈值。It should be noted that when the number of subscription data of the target sensor is greater than the preset threshold, it means that there are other subscription devices that need to obtain the measurement data of the target sensor. At this time, step S607 can be re-executed until the subscription data of the target sensor is less than or equal to the preset threshold.
应理解的是,预设阈值是预先设置的用于判定是否没有订阅设备订阅目标传感器的测量数据的阈值。在目标传感器的订阅数量大于预设阈值时,则认为有订阅设备订阅目标传感器的测量数据。在目标传感器的订阅数量小于或等于预设阈值时,则认为没有订阅设备订阅目标传感器的测量数据。作为一种可能的实现方式,预设阈值取值为0。It should be understood that the preset threshold is a threshold set in advance for determining whether no subscribing device subscribes to the measurement data of the target sensor. When the number of subscriptions to the target sensor is greater than the preset threshold, it is considered that there is a subscribing device that subscribes to the measurement data of the target sensor. When the number of subscriptions to the target sensor is less than or equal to the preset threshold, it is considered that no subscribing device has subscribed to the measurement data of the target sensor. As a possible implementation method, the preset threshold value is 0.
步骤S613、在目标传感器的订阅状态由已订阅状态更新为未订阅状态时,代理设备向目标传感器发送第二工作状态切换指令。目标传感器接收第二工作状态切换指令。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 the second working state switching instruction.
其中,第二工作状态切换指令用于指示目标传感器由第一工作状态切换为第二工作状态。第一工作状态是目标传感器以第一测量周期进行数据测量的工作状态。第二工作状态是目标传感器不进行数据测量或者以第二测量周期进行数据测量的工作状态。其中,第二测量周期大于第一测量周期。The second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state. The first working state is a working state in which the target sensor performs data measurement in a first measurement cycle. The second working state is a working 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.
在本申请实施例中,在更新后的目标传感器的订阅数量小于或等于预设阈值时,将目标传感器的订阅状态由已订阅状态更新为未订阅状态。此时,由于订阅设备取消了目标传感器的测量数据的订阅,并且没有其他订阅设备订阅该目标传感器的测量数据,代理设备可以向目标传感器发送第二工作状态切换指令,以使得目标传感器由第一工作状态切换为第二工作状态。目标传感器接收第二工作状态切换指令。具体可参考步骤S203及步骤S301在此不再赘述。In this embodiment of the present application, when the updated subscription number of the target sensor is less than or equal to the preset threshold, the subscription status of the target sensor is updated from the subscribed status to the unsubscribed status. At this time, since the subscribing device cancels the subscription to the measurement data of the target sensor and no other subscribing device subscribes to the measurement data of the target sensor, the proxy device can send a second working state switching instruction to the target sensor so that the target sensor is replaced by the first The working state is switched to the second working state. The target sensor receives the second working state switching instruction. For details, please refer to step S203 and step S301, which will not be described again here.
步骤S614、目标传感器根据第二工作状态切换指令,将当前工作状态切换为第二工作状态,并在第二工作状态为以第二测量周期进行数据测量的工作状态时,按照第二测量周期进行数据测量。Step S614: The target sensor switches the current working state to the second working state according to the second working state switching instruction, and when the second working state is the working state of performing data measurement with the second measurement cycle, performs the measurement according to the second measurement cycle. Data measurement.
具体可参考步骤S302在此不再赘述。For details, please refer to step S302, which will not be described again here.
示例性的,订阅设备1需要获取传感器1的测量数据,订阅设备2需要获取传感 器1及传感器2的测量数据。订阅设备3已经订阅了传感器3的测量数据,需要取消订阅传感器3的测量数据。此时,订阅设备1向代理设备发送订阅消息,该订阅消息中携带有传感器1的标识信息。代理设备接收到订阅消息后,可以根据该订阅消息解析出传感器1的标识信息,确定订阅设备1需要订阅传感器1的测量数据。此时,代理设备可以记录订阅设备1与其目标传感器间的对应关系。即为,记录订阅设备1与传感器1间的对应关系。代理设备获取传感器1的订阅状态。假设此时传感器1的订阅状态为未订阅状态,则代理设备在检测出传感器1的订阅状态为未订阅状态时,将传感器1的订阅状态由未订阅状态更新为已订阅状态,将传感器1的订阅数量增加1,同时向传感器1发送第一工作状态切换指令,如图7所示。假设在本例中,传感器1与代理设备间通过现场总线连接,则代理设备向传感器1发送第一工作状态切换指令时,可以通过现场总线发送。传感器1通过现场总线接收第一工作状态切换指令,传感器1接收到第一工作状态切换指令后,获知需要将工作状态切换为第一工作状态。此时,传感器1可以将第二工作状态切换为第一工作状态,即为,传感器1将测量周期切换为第一测量周期,并开始以第一测量周期为周期进行数据测量。代理设备可以通过现场总线查询传感器1的测量数据,获取传感器1的测量数据。代理设备由于通过现场总线查询传感器1的测量数据,因此可以获知测量数据对应的目标传感器的标识信息为传感器1的标识信息。代理设备可以根据传感器1的标识信息查找记录的传感器1与订阅设备间的对应关系,确定传感器1的订阅设备为订阅设备1。此时,代理设备可以将传感器1的测量数据发送至订阅设备1。For example, subscribing device 1 needs to obtain the measurement data of sensor 1, and subscribing device 2 needs to obtain sensor data. Measurement data of device 1 and sensor 2. Subscribing device 3 has subscribed to the measurement data of sensor 3 and needs to unsubscribe from the measurement data of sensor 3. At this time, the subscribing device 1 sends a subscription message to the agent device, and the subscription message carries the identification information of the sensor 1 . After receiving the subscription message, the proxy device can parse the identification information of sensor 1 based on the subscription message and determine that the subscribing device 1 needs to subscribe to the measurement data of sensor 1. At this time, the proxy device can record the correspondence between the subscribing device 1 and its target sensor. That is, the correspondence between the subscribing device 1 and the sensor 1 is recorded. The agent device obtains the subscription status of sensor 1. Assume that the subscription status of sensor 1 is unsubscribed at this time. When the proxy device detects that the subscription status of sensor 1 is unsubscribed, it updates the subscription status of sensor 1 from the unsubscribed status to the subscribed status, and changes the subscription status of sensor 1 to the subscribed status. The number of subscriptions is increased by 1, and a first working state switching instruction is sent to sensor 1, as shown in Figure 7. Assume that in this example, the sensor 1 and the agent device are connected through a field bus. When the agent device sends the first working state switching instruction to the sensor 1, it can be sent through the field bus. The sensor 1 receives the first working state switching instruction through the field bus. After receiving the first working state switching instruction, the sensor 1 learns that the working state needs to be switched to the first working state. At this time, the sensor 1 can switch the second working state to the first working state, that is, the sensor 1 switches the measurement cycle to the first measurement cycle, and starts to perform data measurement based on the first measurement cycle. The agent device can query the measurement data of sensor 1 through the field bus and obtain the measurement data of sensor 1. Since the agent device queries the measurement data of sensor 1 through the field bus, it can learn that the identification information of the target sensor corresponding to the measurement data is the identification information of sensor 1. The agent device can search for the recorded correspondence between sensor 1 and the subscribing device based on the identification information of sensor 1, and determine that the subscribing device of sensor 1 is subscribing device 1. At this time, the proxy device can send the measurement data of sensor 1 to subscribing device 1.
同理,订阅设备2向代理设备发送订阅消息。该订阅消息中携带有传感器1及传感器2的标识信息。代理设备接收到订阅消息后,可以根据该订阅消息解析出传感器1的标识信息及传感器2的标识信息,确定订阅设备2需要订阅传感器1及传感器2的测量数据。此时,代理设备可以记录订阅设备2与其目标传感器间的对应关系。即为,记录订阅设备2与传感器1及传感器2间的对应关系。代理设备获取传感器1及传感器2的订阅状态。此时传感器1的订阅状态为已订阅状态,则代理设备在检测出传感器1的订阅状态为已订阅状态时,将传感器1的订阅数量增加1。假设传感器2的订阅状态为未订阅,则代理设备在检测出传感器2的订阅状态为未订阅状态时,将传感器2的订阅状态由未订阅状态更新为已订阅状态,将传感器2的订阅数量增加1,同时向传感器2发送第一工作状态切换指令,参考图7所示。假设在本例中,传感器2与代理设备间通过无线网络连接,则代理设备向传感器2发送第一工作状态切换指令时,可以通过无线网络连接发送。传感器2通过无线网络连接接收第一工作状态切换指令,传感器2接收到第一工作状态切换指令后,获知需要将工作状态切换为第一工作状态。此时,传感器2可以将第二工作状态切换为第一工作状态,即为,传感器2将测量周期切换为第一测量周期,并开始以第一测量周期为周期进行数据测量。代理设备可以通过现场总线查询传感器1测量的测量数据,获取传感器1的测量数据,并确定传感器1的标识信息。传感器2将其测量的测量数据通过无线网络连接上传至代理设备。此时,传感器2发送的测量数据中可以携带传感器2的标识信息。代理设备可以解析传感器2发送的测量数据获取到传感器2的标识信息。代理设备根据传感器1的标识信息及传感器2的标识信息查找记录的传感器1与订阅设备间的对 应关系,及传感器2余订阅设备间的对应关系,确定传感器1的订阅设备为订阅设备1及订阅设备2,传感器2的订阅设备为订阅设备2。此时,代理设备可以将传感器1的测量数据发送至订阅设备1及订阅设备2,将传感器2的测量数据发送至订阅设备2。In the same way, subscription device 2 sends a subscription message to the proxy device. The subscription message carries the identification information of sensor 1 and sensor 2. After receiving the subscription message, the proxy device can parse the identification information of sensor 1 and the identification information of sensor 2 based on the subscription message, and determine that the subscribing device 2 needs to subscribe to the measurement data of sensor 1 and sensor 2. At this time, the proxy device can record the correspondence between the subscribing device 2 and its target sensor. That is, the correspondence between the subscribing device 2 and the sensor 1 and the sensor 2 is recorded. The agent device obtains the subscription status of sensor 1 and sensor 2. At this time, the subscription status of sensor 1 is the subscribed status. When the agent device detects that the subscription status of sensor 1 is the subscribed status, it increases the subscription number of sensor 1 by 1. Assume that the subscription status of sensor 2 is unsubscribed. When the agent device detects that the subscription status of sensor 2 is unsubscribed, it updates the subscription status of sensor 2 from the unsubscribed status to the subscribed status and increases the number of subscriptions of sensor 2. 1. Send a first working state switching command to sensor 2 at the same time, as shown in Figure 7. Assume that in this example, the sensor 2 and the proxy device are connected through a wireless network. When the proxy device sends the first working state switching instruction to the sensor 2, it can be sent through the wireless network connection. The sensor 2 receives the first working state switching instruction through the wireless network connection. After receiving the first working state switching instruction, the sensor 2 learns that the working state needs to be switched to the first working state. At this time, the sensor 2 can switch the second working state to the first working state, that is, the sensor 2 switches the measurement cycle to the first measurement cycle, and starts measuring data with the first measurement cycle as the cycle. The agent device can query the measurement data measured by sensor 1 through the field bus, obtain the measurement data of sensor 1, and determine the identification information of sensor 1. Sensor 2 uploads its measured measurement data to the agent device via a wireless network connection. At this time, the measurement data sent by the sensor 2 may carry the identification information of the sensor 2 . The proxy device can parse the measurement data sent by sensor 2 to obtain the identification information of sensor 2. The agent device searches for the recorded correspondence between sensor 1 and the subscribing device based on the identification information of sensor 1 and the identification information of sensor 2. According to the corresponding relationship, and the corresponding relationship between the remaining subscribing devices of sensor 2, it is determined that the subscribing device of sensor 1 is subscribing device 1 and subscribing device 2, and the subscribing device of sensor 2 is subscribing device 2. At this time, the proxy device can send the measurement data of sensor 1 to subscribing device 1 and subscribing device 2, and send the measurement data of sensor 2 to subscribing device 2.
由于订阅设备3已经订阅目标传感器3的测量数据,因此代理设备在获取到订阅设备3的测量数据时,可以发送至订阅设备3。在订阅设备3无需获取传感器3的测量数据时,向代理设备发送订阅取消消息。此时,代理设备接收订阅取消消息,其中订阅取消消息中携带有传感器3的标识信息,代理设备可以通过解析订阅取消消息,获知传感器3的标识信息,即为确定订阅设备3需要取消订阅传感器3的测试数据。代理设备可以将记录的传感器3与订阅设备3间的对应关系删除。获取传感器3的订阅数量。假设传感器3的订阅数量为1,代理设备将传感器3的订阅数量减1,此时,传感器3的订阅数量为0。代理设备在检测传感器3的订阅数量为0后,获知传感器3没有订阅设备订阅其测量数据,此时,将传感器3的订阅状态由已订阅状态更新为未订阅状态,并向传感器3发送第二工作状态切换指令。传感器3接收到第二工作状态切换指令后,可以将其工作状态切换为第二工作状态,即为停止数据测量。Since the subscribing device 3 has subscribed to the measurement data of the target sensor 3, when the proxy device obtains the measurement data of the subscribing device 3, it can send it to the subscribing device 3. When the subscribing device 3 does not need to obtain the measurement data of the sensor 3, a subscription cancellation message is sent to the agent device. At this time, the proxy device receives the subscription cancellation message, in which the subscription cancellation message carries the identification information of sensor 3. The proxy device can learn the identification information of sensor 3 by parsing the subscription cancellation message, that is, to determine that subscribing device 3 needs to unsubscribe from sensor 3. test data. The agent device can delete the recorded correspondence between the sensor 3 and the subscribing device 3 . Get the number of subscriptions for sensor 3. Assume that the subscription quantity of sensor 3 is 1, and the agent device decreases the subscription quantity of sensor 3 by 1. At this time, the subscription quantity of sensor 3 is 0. After detecting that the subscription number of sensor 3 is 0, the agent device learns that sensor 3 has no subscription device to subscribe to its measurement data. At this time, it updates the subscription status of sensor 3 from the subscribed status to the unsubscribed status, and sends a second message to sensor 3. Working status switching instructions. After receiving the second working state switching instruction, the sensor 3 can switch its working state to the second working state, that is, 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, and this application does not impose a limitation on this. The second measurement periods of different sensors may be the same or different, and this application does not limit this.
这样一来,在订阅设备暂停获取目标传感器的测量数据时,向第一设备发送订阅取消消息,第一设备接收到订阅取消消息后,可以根据该订阅取消消息确定出目标传感器,将目标传感器的订阅状态由已订阅状态更改为未订阅状态,并向目标传感器发送第二工作状态切换指令,以便目标传感器由第一工作状态切换为第二工作状态。目标传感器在第二工作状态时的数据测量频率低于目标传感器在第一工作状态时的数据测量频率。即为,在接收到订阅取消消息时,可以控制目标传感器切换为测量周期更长的第二工作状态,从而可以在无需目标传感器进行监测时,延长目标传感器的监测周期,或者停止数据测量,降低目标传感器在无需进行数据监测时的耗电量,延长目标传感器的电池使用时间,降低工业生产成本。In this way, when the subscribing device pauses to obtain the measurement data of the target sensor, it sends a subscription cancellation message to the first device. After receiving the subscription cancellation message, the first device can determine the target sensor based on the subscription cancellation message and add the target sensor's measurement data to the first device. The subscription state 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 switches from the first working state to the second working state. The data measurement frequency of the target sensor in the second working state is lower than the data measurement frequency of the target sensor in the first working state. That is, when receiving the subscription cancellation message, the target sensor can be controlled to switch to the second working state with a longer measurement period, so that when the target sensor is not needed for monitoring, the monitoring period of the target sensor can be extended, or the data measurement can be stopped, reducing the The power consumption of the target sensor when data monitoring is not required extends the battery life of the target sensor and reduces industrial production costs.
并且在本申请中,代理设备支持多种连接方式与传感器连接,无需针对不同连接方式的传感器设置多个代理设备,从而大大降低了代理设备的使用数量,进一步降低了工业生产成本。And in this application, the agent device supports multiple connection methods to connect to the sensor, and there is no need to set up multiple agent devices for sensors with different connection methods, thereby greatly reducing the number of agent devices used and further reducing industrial production costs.
参见图8,为本申请实施例提供的另一种数据处理方法的流程示意图。本实施例针对订阅设备及代理设备采用MQTT(Message Queuing Telemetry Transport,消息队列遥测传输协议)实现消息的订阅及发布的场景进行说明。当然,订阅设备及代理设备还可以其他方式实现消息的订阅及发布,本申请对此不作限制。在本申请实施例中仅以采用MQTT的方式实现消息的订阅及发布为例进行说明。如图8所示,所述方法包括:Refer to Figure 8, which is a schematic flow chart of another data processing method provided by an embodiment of the present application. This embodiment describes a scenario in which the subscription device and the proxy device use MQTT (Message Queuing Telemetry Transport Protocol) to subscribe to and publish messages. Of course, the subscription device and the proxy device can also implement message subscription and publishing in other ways, and this application does not limit this. In the embodiment of this application, only the use of MQTT to implement message subscription and publishing is used as an example for explanation. As shown in Figure 8, the method includes:
步骤S801、订阅设备向代理设备发送MQTT格式的订阅消息。代理设备接收MQTT格式的订阅消息。Step S801: The subscribing device sends a subscription message in MQTT format to the agent device. The broker device receives subscription messages in MQTT format.
在本申请实施例中,订阅设备向订阅传感器的测量数据,可以向代理设备发送订 阅消息。此时,订阅设备向代理设备发送的订阅消息为MQTT格式的消息。其中,订阅消息中携带的目标传感器的标识信息为目标订阅主题信息。In this embodiment of the present application, the subscribing device subscribes to the measurement data of the sensor and can send the subscription to the proxy device. Read the news. At this time, the subscription message sent by the subscribing device to the agent device is in MQTT format. Among them, the identification information of the target sensor carried in the subscription message is the target subscription topic information.
需要说明的是,在订阅设备侧可以预先设置每个传感器与订阅主题信息间的对应关系,这样订阅设备在需要获取哪个传感器的测量数据时,即可确定出对应的订阅主题信息。It should be noted that the corresponding relationship between each sensor and the subscription topic information can be preset on the subscribing device side, so that the subscribing device can determine the corresponding subscription topic information when it needs to obtain the measurement data of which sensor.
具体可参考步骤S401在此不再赘述。For details, please refer to step S401, which will not be described again here.
步骤S802、代理设备根据MQTT格式的订阅消息,确定目标传感器。Step S802: The agent device determines the target sensor according to the subscription message in MQTT format.
在本申请实施例中,代理设备接收的订阅消息为MQTT格式的消息,此时订阅消息中携带的目标传感器的标识信息即为订阅设备的目标订阅主题信息。此时,代理设备获取预设传感器与订阅主题信息间的映射信息;根据目标订阅主题信息及预设传感器与订阅主题信息间的映射信息,确定目标传感器。In this embodiment of the present application, the subscription message received by the proxy device is in MQTT format. At this time, the identification information of the target sensor carried in the subscription message is the target subscription topic information of the subscribing device. At this time, the proxy device obtains the mapping information between the preset sensor and the subscription topic information; and determines the target sensor based on the target subscription topic information and the mapping information between the preset sensor and the subscription topic information.
即为,在代理设备中预先设置了传感器与订阅主题信息间的映射信息,代理设备在获取到目标订阅主题信息后,可以查找预设传感器与订阅主题信息间的映射信息,从而可以确定出目标订阅主题信息对应的目标传感器。That is, the mapping information between the sensor and the subscription topic information is preset in the proxy device. After the proxy device obtains the target subscription topic information, it can search for the mapping information between the preset sensor and the subscription topic information, so as to determine the target. Subscribe to the target sensor corresponding to the topic information.
作为一种可能的实现方式,代理设备在从订阅消息中解析出目标订阅主题信息后,可以记录发送的订阅消息中携带有目标订阅主题信息的订阅设备与目标订阅主题信息间的对应关系。As a possible implementation method, after parsing the target subscription topic information from the subscription message, the proxy device can record the correspondence between the subscription device that carries the target subscription topic information and the target subscription topic information in the sent subscription message.
需要说明的是,每个传感器均设置有对应的订阅主题信息,可以相同,也可以不同。可以根据实际需求设置,本申请对此不作限制。It should be noted that each sensor is set with corresponding subscription topic information, which can be the same or different. It can be set according to actual needs, and this application does not impose restrictions on this.
步骤S803、代理设备获取目标传感器的订阅状态。Step S803: The proxy device obtains the subscription status of the target sensor.
具体可参考步骤S403在此不再赘述。For details, please refer to step S403, which will not be described again here.
应理解的,由于订阅状态包括已订阅状态及未订阅状态两种状态,因此代理设备根据获取的目标传感器的订阅状态不同,下面执行的步骤也不同。在代理设备确定目标传感器的订阅状态为未订阅状态时,则执行下述步骤S604a-S605a,步骤S606-S608。在代理设备确定目标传感器的订阅状态为订阅状态时,则执行下述步骤S604b,步骤S606-S608。It should be understood that since the subscription state includes two states: subscribed state and unsubscribed state, the following steps performed by the proxy device are different depending on the obtained subscription state of the target sensor. When the proxy device determines that the subscription status of the target sensor is the unsubscribed status, it executes the following steps S604a-S605a and steps S606-S608. When the proxy device determines that the subscription state of the target sensor is the subscription state, the following steps S604b and S606-S608 are executed.
步骤S804a、在目标传感器的订阅状态为未订阅状态时,将目标传感器的订阅状态由未订阅状态更新为已订阅状态,将目标传感器的订阅数量增加第二预设值,并向目标传感器发送第一工作状态切换指令。目标传感器接收第一工作状态切换指令。Step S804a: When the subscription status of the target sensor is an unsubscribed status, update the subscription status of the target sensor from the unsubscribed status to the subscribed status, increase the subscription number of the target sensor by a second preset value, and send the third preset value to the target sensor. A working state switching command. The target sensor receives the first working state switching instruction.
其中,第一工作状态切换指令用于指示目标传感器由第二工作状态切换为第一工作状态。The first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state.
具体可参考步骤S404a在此不再赘述。For details, please refer to step S404a, which will not be described again here.
步骤S804b、在目标传感器的订阅状态为已订阅时,将目标传感器的订阅数量增加第二预设值。Step S804b: When the subscription status of the target sensor is subscribed, increase the subscription number of the target sensor by a second preset value.
具体可参考步骤S404b在此不再赘述。For details, please refer to step S404b, which will not be described again here.
步骤S805a、目标传感器根据第一工作状态切换指令,将当前工作状态切换为第一工作状态,并在第一工作状态为以第一测量周期进行数据测量的工作状态时,按照第一测量周期进行数据测量。Step S805a: The target sensor switches the current working state to the first working state according to the first working state switching instruction, and when the first working state is the working state of performing data measurement with the first measurement cycle, the target sensor performs data measurement according to the first measurement cycle. Data measurement.
具体可参考步骤S405a在此不再赘述。 For details, please refer to step S405a, which will not be described again here.
步骤S806、代理设备获取目标传感器的测量数据。Step S806: The agent device obtains the measurement data of the target sensor.
具体可参考步骤S406在此不再赘述。For details, please refer to step S406, which will not be described again here.
步骤S807、代理设备获取目标传感器的标识信息,并根据目标传感器的标识信息确定目标传感器的至少一个订阅设备。Step S807: The proxy device obtains the identification information of the target sensor, and determines at least one subscribing device of the target sensor based on the identification information of the target sensor.
在本申请实施例中,代理设备在接收到目标传感器发送的测量数据后,需要将测量数据发送至对应的订阅设备。此时,代理设备根据目标传感器及所述预设传感器与订阅主题信息间的映射信息,确定目标订阅主题信息;根据目标订阅主题信息确定至少一个订阅设备。In this embodiment of the present application, after receiving the measurement data sent by the target sensor, the proxy device needs to send the measurement data to the corresponding subscribing device. At this time, the proxy device determines the target subscription topic information based on the target sensor and the mapping information between the preset sensor and the subscription topic information; and determines at least one subscription device based on the target subscription topic information.
即为,代理设备可以在接收到测量数据后,获知是哪个目标传感器发送的测量数据,查找预设传感器与订阅主题信息间的映射信息,从而可以确定出该目标传感器对应的目标订阅主体信息。代理设备可以根据记录的订阅主题信息与订阅设备间的对应关系,确定出目标订阅主题信息对应的至少一个订阅设备。That is, after receiving the measurement data, the proxy device can learn which target sensor sent the measurement data, find the mapping information between the preset sensor and the subscription topic information, and thereby determine the target subscription subject information corresponding to the target sensor. The proxy device may determine at least one subscription device corresponding to the target subscription topic information based on the recorded correspondence between the subscription topic information and the subscription device.
步骤S808、代理设备向目标传感器的至少一个订阅设备发送测量数据。至少一个订阅设备接收测量数据。Step S808: The proxy device sends measurement data to at least one subscribing device of the target sensor. At least one subscribing device receives measurement data.
在本申请实施例中,代理设备在确定出目标订阅主题信息对应的至少一个订阅设备后,可以将接收的目标传感器的测量数据转换为MQTT格式的消息发送至至少一个订阅设备中。In this embodiment of the present application, after determining at least one subscribing device corresponding to the target subscription topic information, the proxy device may convert the received measurement data of the target sensor into an MQTT format message and send it to the at least one subscribing device.
作为一种可能的实现方式,代理设备向目标传感器的至少一个订阅设备发送测量数据包括:根据目标订阅主题信息及目标传感器发送的测量数据,生成目标发布消息;向至少一个订阅设备发送目标发布消息。As a possible implementation manner, the proxy device sending measurement data to at least one subscribing device of the target sensor includes: generating a target publishing message based on the target subscription topic information and the measurement data sent by the target sensor; and sending the target publishing message to at least one subscribing device. .
即为,代理设备在确定出目标订阅主题信息对应的至少一个订阅设备后,可以将目标订阅主题信息及目标传感器发送的测量数据生成目标发布消息,目标发布消息为MQTT格式的消息。向至少一个订阅设备发送该目标发布消息。至少一个订阅设备接收到目标发布消息后,可以解析目标发布消息,获取其内的目标订阅主题信息及测量数据,从而可以获知该接收的测量数据是哪个目标订阅主题信息的,进而可以进行相应的处理。That is, after determining at least one subscription device corresponding to the target subscription topic information, the agent device can generate a target publication message from the target subscription topic information and the measurement data sent by the target sensor, and the target publication message is a message in MQTT format. Send this target publish message to at least one subscribing device. After at least one subscription device receives the target publication message, it can parse the target publication message and obtain the target subscription topic information and measurement data in it, so as to know which target subscription topic information the received measurement data comes from, and then perform corresponding deal with.
步骤S809、订阅设备向代理设备发送MQTT格式的订阅取消消息。代理设备接收MQTT格式的订阅取消消息。Step S809: The subscribing device sends a subscription cancellation message in MQTT format to the agent device. The broker device receives subscription cancellation messages in MQTT format.
其中,订阅取消消息中携带有目标传感器的标识信息。The subscription cancellation message carries the identification information of the target sensor.
在本申请实施例总,订阅取消消息为MQTT格式的消息,目标传感器的标识信息为目标订阅主题信息。即为,订阅设备无需获取目标订阅主题信息的相关数据时,则向代理设备发送订阅取消消息。在订阅取消消息中携带有目标订阅主题信息。代理设备接收该订阅取消消息。In the embodiment of this application, the subscription cancellation message is a message in MQTT format, and the identification information of the target sensor is the target subscription topic information. That is, when the subscribing device does not need to obtain relevant data of the target subscription topic information, it sends a subscription cancellation message to the proxy device. The subscription cancellation message carries target subscription topic information. The proxy device receives the subscription cancellation message.
步骤S810、代理设备根据MQTT格式的订阅取消消息,确定目标传感器。Step S810: The agent device determines the target sensor according to the subscription cancellation message in MQTT format.
在本申请实施例中,代理设备接收到订阅取消消息后,可以解析订阅取消消息,进而可以获取到目标订阅主题信息。代理设备可以获取预设传感器与订阅主题信息间的映射信息,根据目标订阅主题信息查找预设传感器与订阅主题信息间的映射信息,确定出目标订阅主题信息对应的目标传感器。In this embodiment of the present application, after receiving the subscription cancellation message, the proxy device can parse the subscription cancellation message, and then obtain the target subscription topic information. The agent device can obtain the 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 method, when the proxy device determines the target sensor, since the subscribing device no longer It is necessary to obtain the measurement data of the target sensor. At this time, the proxy device can delete the recorded correspondence between the subscription device and the target subscription topic information, so that the measurement data of the target sensor is no longer sent to the subscribing device.
步骤S811、代理设备获取目标传感器的订阅数量,并将目标传感器的订阅数量减少第一预设值。Step S811: 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.
具体可参考步骤S611在此不再赘述。For details, please refer to step S611, which will not be described again here.
步骤S812、在目标传感器的订阅数量等于或小于预设阈值时,则代理设备获取将目标传感器的订阅状态,并将目标传感器的订阅状态由已订阅状态更新为未订阅状态。Step S812: When the number of subscriptions to the target sensor is equal to or less than the preset threshold, the proxy device obtains the subscription status of the target sensor and updates the subscription status of the target sensor from the subscribed status to the unsubscribed status.
具体可参考步骤S612在此不再赘述。For details, please refer to step S612, which will not be described again here.
步骤S813、代理设备在目标传感器的订阅状态由已订阅状态更新为未订阅状态时,向目标传感器发送第二工作状态切换指令。目标传感器接收第二工作状态切换指令。Step S813: When the subscription state of the target sensor is updated from the subscribed state to the unsubscribed state, the proxy device sends a second working state switching instruction to the target sensor. The target sensor receives the second working state switching instruction.
具体可参考步骤S613在此不再赘述。For details, please refer to step S613, which will not be described again here.
步骤S814、目标传感器根据第二工作状态切换指令,将当前工作状态切换为第二工作状态,并在第二工作状态为以第二测量周期进行数据测量的工作状态时,按照第二测量周期进行数据测量。Step S814: The target sensor switches the current working state to the second working state according to the second working state switching instruction, and when the second working state is the working state of performing data measurement with the second measurement cycle, performs the measurement according to the second measurement cycle. Data measurement.
具体可参考步骤S302在此不再赘述。For details, please refer to step S302, which will not be described again here.
图9所示为本申请实施例提供的一种代理设备的结构示意图。如图9所示,所述代理设备包括:Figure 9 shows a schematic structural diagram of a proxy device provided by an embodiment of the present application. As shown in Figure 9, the proxy device includes:
订阅发布服务模块901,用于接收订阅取消消息,并将订阅取消消息发送至订阅管理模块902。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.
其中,订阅取消消息中携带有目标传感器的标识信息;Among them, the subscription cancellation message carries the identification information of the target sensor;
订阅管理模块902,用于根据订阅取消消息,确定目标传感器;向目标传感器发送第二工作状态切换指令。The subscription management module 902 is configured to determine the target sensor according to the subscription cancellation message; and send a second working state switching instruction to the target sensor.
其中,第二工作状态切换指令用于指示目标传感器由第一工作状态切换为第二工作状态。第一工作状态是目标传感器以第一测量周期进行数据测量的工作状态。第二工作状态是目标传感器不进行数据测量或者以第二测量周期进行数据测量的工作状态。其中,第二测量周期大于第一测量周期。The second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state. The first working state is a working state in which the target sensor performs data measurement in a first measurement period. The second working state is a working 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.
作为一种可能的实现方式,订阅管理模块902,用于在目标传感器有至少两个时,确定每个目标传感器的连接方式;按照每个目标传感器的连接方式,分别向目标传感器发送第二工作状态切换指令。As a possible implementation, the subscription management module 902 is configured to determine the connection mode of each target sensor when there are at least two target sensors; and send the second job to the target sensor according to the connection mode of each target sensor. State switching instructions.
其中,按照每个目标传感器的连接方式,分别向目标传感器发送工作状态切换指令包括:Among them, according to the connection mode of each target sensor, sending working state switching instructions to the target sensor includes:
在目标传感器与代理设备通过现场总线连接时,则通过现场总线向目标传感器发送工作状态切换指令;或者,在目标传感器与代理设备通过网络连接时,则通过网络连接向目标传感器发送工作状态切换指令。When the target sensor and the agent device are connected through the field bus, the working state switching instruction is sent to the target sensor through the field bus; or, when the target sensor and the agent device are connected through the network, the working state switching instruction is sent to the target sensor through the network connection. .
作为一种可能的实现方式,网络连接包括以太网络连接或者无线网络连接。As a possible implementation manner, the network connection includes an Ethernet network connection or a wireless network connection.
作为一种可能的实现方式,订阅管理模块902,用于获取目标传感器的订阅数量,并将目标传感器的订阅数量减少第一预设值;在目标传感器的订阅数量等于或小 于预设阈值时,则获取将目标传感器的订阅状态,并将目标传感器的订阅状态由已订阅状态更新为未订阅状态。在目标传感器的订阅状态由已订阅状态更新为未订阅状态时,向目标传感器发送第二工作状态切换指令。As a possible implementation, the subscription management module 902 is used to obtain the 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 sensor is equal to or less than When the preset threshold is reached, the subscription status of the target sensor is obtained, and the subscription status of the target sensor is updated from the subscribed status to the unsubscribed status. When the subscription state of the target sensor is updated from the subscribed state to the unsubscribed state, a second working state switching instruction is sent to the target sensor.
作为一种可能的实现方式,订阅发布服务模块901,用于接收订阅消息。并将订阅消息发送至订阅管理模块902。As a possible implementation, the subscription publishing service module 901 is used to receive subscription messages. And send the subscription message to the subscription management module 902.
其中,订阅消息中携带有目标传感器的标识信息。The subscription message carries identification information of the target sensor.
订阅管理模块902,用于根据订阅消息,确定目标传感器。获取目标传感器的订阅状态。在目标传感器的订阅状态为未订阅状态时,将目标传感器的订阅状态由未订阅状态更新为已订阅状态,将目标传感器的订阅数量增加第二预设值,并向目标传感器发送第一工作状态切换指令。The subscription management module 902 is used to determine the target sensor according to the subscription message. Get the subscription status of the target sensor. When the subscription status of the target sensor is unsubscribed, update the subscription status of the target sensor from the unsubscribed status to the subscribed status, increase the subscription number of the target sensor by a second preset value, and send the first working status to the target sensor. Switch command.
其中,第一工作状态切换指令用于指示目标传感器由第二工作状态切换为第一工作状态。The first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state.
作为一种可能的实现方式,订阅管理模块902,用于在目标传感器有至少两个时,确定每个目标传感器的连接方式;按照每个目标传感器的连接方式,分别向目标传感器发送第一工作状态切换指令。As a possible implementation, the subscription management module 902 is configured to determine the connection mode of each target sensor when there are at least two target sensors; and send the first work to the target sensor according to the connection mode of each target sensor. State switching instructions.
其中,按照每个目标传感器的连接方式,分别向目标传感器发送工作状态切换指令包括:Among them, according to the connection mode of each target sensor, sending working state switching instructions to the target sensor includes:
在目标传感器与代理设备通过现场总线连接时,则通过现场总线向目标传感器发送工作状态切换指令;或者,在目标传感器与代理设备通过网络连接时,则通过网络连接向目标传感器发送工作状态切换指令。When the target sensor and the agent device are connected through the field bus, the working state switching instruction is sent to the target sensor through the field bus; or, when the target sensor and the agent device are connected through the network, the working state switching instruction is sent to the target sensor through the network connection. .
作为一种可能的实现方式,订阅管理模块902,用于在目标传感器的订阅状态为已订阅时,将目标传感器的订阅数量增加第二预设值。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 status of the target sensor is subscribed.
作为一种可能的实现方式,如图10所示,上述代理设备还包括:As a possible implementation, as shown in Figure 10, the above proxy device also includes:
订阅发布客户模块903,用于获取目标传感器的测量数据,并向订阅发布服务模块901发送测量数据。The subscription publishing client module 903 is used to obtain the measurement data of the target sensor and send the measurement data to the subscription publishing service module 901.
订阅发布服务模块901,用于获取目标传感器的标识信息,并根据目标传感器的标识信息确定目标传感器的至少一个订阅设备;向目标传感器的至少一个订阅设备发送测量数据。The subscription publishing service module 901 is used to obtain the identification information of the target sensor, determine at least one subscribing device of the target sensor based on the identification information of the target sensor, and send measurement data to at least one subscribing device of the target sensor.
作为一种可能的实现方式,订阅发布客户模块903,用于在目标传感器与代理设备通过现场总线连接时,通过现场总线查询目标传感器,获取目标传感器的测量数据;或者,在目标传感器与代理设备通过网络连接时,则通过网络连接接收目标传感器发送的测量数据。As a possible implementation method, the subscription publishing client module 903 is used to query the target sensor through the field bus when the target sensor and the agent device are connected through the field bus, and obtain the measurement data of the target sensor; or, when the target sensor and the agent device are connected, When connected through the network, the measurement data sent by the target sensor is received through the network connection.
作为一种可能的实现方式,上述代理设备通过MQTT协议实现订阅设备对传感器测量数据的订阅功能。此时,上述订阅发布服务模块901集成有MQTT服务端的功能。订阅发布客户模块903集成有MQTT客服端的功能。目标传感器的标识信息包括目标订阅主题信息。As a possible implementation method, the above-mentioned proxy device implements the subscription function of the subscribing device to the sensor measurement data through the MQTT protocol. At this time, the above-mentioned subscription publishing service module 901 integrates the function of the MQTT server. The subscription publishing client module 903 integrates the functions of the MQTT client. The identification information of the target sensor includes target subscription topic information.
上述订阅消息及订阅取消消息均为MQTT格式的消息。The above subscription messages and subscription cancellation messages are all messages in MQTT format.
此时,订阅管理模块902,用于获取预设传感器与订阅主题信息间的映射信息;根据目标订阅主题信息及预设传感器与订阅主题信息间的映射信息,确定目标传感 器。At this time, the subscription management module 902 is used to obtain the mapping information between the preset sensor and the subscription topic information; determine the target sensor according to the target subscription topic information and the mapping information between the preset sensor and the subscription topic information. device.
作为一种可能的实现方式,订阅发布服务模块901,用于根据目标传感器及预设传感器与订阅主题信息间的映射信息,确定目标订阅主题信息;根据目标订阅主题信息确定至少一个订阅设备;根据目标订阅主题信息及目标传感器发送的测量数据,生成目标发布消息;向至少一个订阅设备发送目标发布消息。As a possible implementation, the subscription publishing service module 901 is configured to determine the target subscription topic information based on the mapping information between the target sensor and the preset sensor and the subscription topic information; determine at least one subscription device based on the target subscription topic information; The target subscribes to the topic information and the measurement data sent by the target sensor to generate a target publishing message; and sends the target publishing message to at least one subscribing device.
其中,目标发布消息包括消息队列遥测传输MQTT格式的消息。Among them, the target publishing message includes the message queue telemetry transmission MQTT format message.
图11所示为本申请实施例提供的一种传感器的结构示意图。如图11所示,所述传感器包括:Figure 11 shows a schematic structural diagram of a sensor provided by an embodiment of the present application. As shown in Figure 11, the sensor includes:
接收模块1101,用于接收第二工作状态切换指令。The receiving module 1101 is used to receive the second working state switching instruction.
其中,第二工作状态切换指令用于指示目标传感器由第一工作状态切换为第二工作状态。第一工作状态是目标传感器以第一测量周期进行数据测量的工作状态。第二工作状态是目标传感器不进行数据测量或者以第二测量周期进行数据测量的工作状态。其中,第二测量周期大于第一测量周期。The second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state. The first working state is a working state in which the target sensor performs data measurement in a first measurement cycle. The second working state is a working state in which the target sensor does not perform data measurement or performs data measurement in a second measurement cycle. Wherein, the second measurement period is greater than the first measurement period.
处理模块1102,用于根据第二工作状态切换指令,将当前工作状态切换为第二工作状态,并在第二工作状态为以第二测量周期进行数据测量的工作状态时,按照第二测量周期进行数据测量。The processing module 1102 is configured to switch the current working state to the second working state according to the second working state switching instruction, and when the second working state is the working state of performing data measurement with the second measurement cycle, perform the data measurement according to the second measurement cycle. Perform data measurements.
作为一种可能的实现方式,接收模块1101,用于接收第一工作状态切换指令。As a possible implementation, the receiving module 1101 is configured to receive a first working state switching instruction.
其中,第一工作状态切换指令用于指示目标传感器由第二工作状态切换为第一工作状态。The first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state.
处理模块1102,用于根据第一工作状态切换指令,将当前工作状态切换为第一工作状态,并在第一工作状态为以第一测量周期进行数据测量的工作状态时,按照第一测量周期进行数据测量。The processing module 1102 is configured to switch the current working state to the first working state according to the first working state switching instruction, and when the first working state is the working state of performing data measurement with the first measurement cycle, perform the data measurement according to the first measurement cycle. Perform data measurements.
作为一种可能的实现方式,如图12所示,上述传感器还包括:As a possible implementation, as shown in Figure 12, the above sensors also include:
发送模块1103,用于向代理设备发送测量数据。The sending module 1103 is used to send measurement data to the proxy device.
图13所示为本申请实施例提供的一种数据处理系统的结构示意图。如图13所示,数据处理系统包括代理设备1301,至少一个传感器1302及至少一个订阅设备1303。Figure 13 shows a schematic structural diagram of a data processing system provided by an embodiment of the present application. As shown in Figure 13, the data processing system includes an agent device 1301, at least one sensor 1302 and at least one subscription device 1303.
其中,代理设备1301与至少一个传感器1302及至少一个订阅设备1303连接。Among them, the proxy device 1301 is connected to at least one sensor 1302 and at least one subscription device 1303.
至少一个订阅设备1303,用于向代理设备1301发送订阅取消消息。其中,订阅取消消息中携带有目标传感器的标识信息。At least one subscription device 1303 is used to send a subscription cancellation message to the proxy device 1301. The subscription cancellation message carries the identification information of the target sensor.
代理设备1301包括上述实施例所述的代理设备;至少一个传感器包括所述上述实施例所述的传感器。The agent device 1301 includes the agent device described in the above embodiment; at least one sensor includes the sensor described in the above embodiment.
作为一种可能的实现方式,至少一个订阅设备1303,还用于向代理设备1301发送请阅消息。其中,订阅消息中携带有目标传感器的标识信息。As a possible implementation, at least one subscription device 1303 is also used to send a subscription message to the proxy device 1301. The subscription message carries identification information of the target sensor.
与上述实施例相对应,本申请还提供了一种电子设备。图14为本发明实施例提供的一种电子设备的结构示意图,所述电子设备1400可以包括:处理器1401、存储器1402及通信单元1403。这些组件通过一条或多条总线进行通信,本领域技术人员可以理解,图中示出的服务器的结构并不构成对本发明实施例的限定,它既可以是总线形结构,也可以是星型结构,还可以包括比图示更多或更少的部件,或者组合某些 部件,或者不同的部件布置。Corresponding to the above embodiments, this application also provides an electronic device. FIG. 14 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. The electronic device 1400 may include: a processor 1401, a memory 1402, and a communication unit 1403. These components communicate through one or more buses. Those skilled in the art can understand that the structure of the server shown in the figure does not constitute a limitation on the embodiment of the present invention. It can be either a bus structure or a star structure. , may also include more or fewer parts than shown, or combine certain components, or different arrangements of components.
其中,所述通信单元1403,用于建立通信信道,从而使所述存储设备可以与其它设备进行通信。接收其他设备发是的用户数据或者向其他设备发送用户数据。The communication unit 1403 is used to establish a communication channel so that the storage device can communicate with other devices. Receive user data from other devices or send user data to other devices.
所述处理器1401,为存储设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器1402内的软件程序和/或模块,以及调用存储在存储器内的数据,以执行电子设备的各种功能和/或处理数据。所述处理器可以由集成电路(integrated circuit,IC)组成,例如可以由单颗封装的IC所组成,也可以由连接多颗相同功能或不同功能的封装IC而组成。举例来说,处理器1401可以仅包括中央处理器(central processing unit,CPU)。在本发明实施方式中,CPU可以是单运算核心,也可以包括多运算核心。The processor 1401 is the control center of the storage device, using various interfaces and lines to connect various parts of the entire electronic device, by running or executing software programs and/or modules stored in the memory 1402, and calling the software programs stored in the memory 1402. data to perform various functions of the electronic device and/or process data. The processor may be composed of an integrated circuit (IC), for example, it may be composed of a single packaged IC, or it may be composed of multiple packaged ICs connected with the same function or different functions. For example, the processor 1401 may only include a central processing unit (CPU). In the embodiment of the present invention, the CPU may be a single computing core or may include multiple computing cores.
所述存储器1402,用于存储处理器1401的执行指令,存储器1402可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。The memory 1402 is used to store execution instructions of the processor 1401. The memory 1402 can be implemented by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM). 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.
当存储器1402中的执行指令由处理器1401执行时,使得电子设备1400能够执行图2或图3所示实施例中的部分或全部步骤。When the execution instructions in the memory 1402 are executed by the processor 1401, the electronic device 1400 is enabled to execute some or all of the steps in the embodiment shown in Figure 2 or Figure 3.
具体实现中,本发明还提供一种存储介质,其中,该存储介质可存储有程序,该程序执行时可包括本发明提供的数据处理方法的各实施例中的部分或全部步骤。所述的存储介质可为磁碟、光盘、只读存储记忆体(read-only memory,ROM)或随机存储记忆体(random access memory,RAM)等。In specific implementation, the present invention also provides a storage medium, wherein the storage medium can store a program, and when executed, the program can include some or all of the steps in each embodiment of the data processing method provided by the present invention. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
本领域的技术人员可以清楚地了解到本发明实施例中的技术可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本发明实施例中的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例或者实施例的某些部分所述的方法。Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus the necessary general hardware platform. Based on this understanding, the technical solutions in the embodiments of the present invention can be embodied in the form of software products in essence or those that contribute to the existing technology. The computer software products can be stored in storage media, such as ROM/RAM. , magnetic disk, optical disk, etc., including a number of instructions to cause a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or certain parts of the embodiments of the present invention.
本说明书中各个实施例之间相同相似的部分互相参见即可。尤其,对于装置实施例和终端实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例中的说明即可。 The same and similar parts among the various embodiments in this specification can be referred to each other. In particular, for the device embodiment and the terminal embodiment, since they are basically similar to the method embodiment, the description is relatively simple. For relevant details, please refer to the description in the method embodiment.

Claims (27)

  1. 一种数据处理方法,其特征在于,应用于代理设备,所述方法包括:A data processing method, characterized in that it is applied to a proxy device, and the method includes:
    接收订阅取消消息;所述订阅取消消息中携带有目标传感器的标识信息;Receive a subscription cancellation message; the subscription cancellation message carries identification information of the target sensor;
    根据所述订阅取消消息,确定目标传感器;Determine the target sensor according to the subscription cancellation message;
    向所述目标传感器发送第二工作状态切换指令;所述第二工作状态切换指令用于指示目标传感器由第一工作状态切换为第二工作状态;所述第一工作状态是所述目标传感器以第一测量周期进行数据测量的工作状态;所述第二工作状态是所述目标传感器停止数据测量或者以第二测量周期进行数据测量的工作状态;其中,所述第二测量周期大于第一测量周期。Send a second working state switching instruction to the target sensor; the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state; the first working state is when the target sensor The first measurement period is a working state in which data measurement is performed; the second working state is a working 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. cycle.
  2. 根据权利要求1所述的方法,其特征在于,在所述向所述目标传感器发送第二工作状态切换指令之前,所述方法还包括:The method according to claim 1, characterized in that, before sending the second working state switching instruction to the target sensor, the method further includes:
    获取所述目标传感器的订阅数量,并将所述目标传感器的订阅数量减少第一预设值;Obtain the 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 sensor is equal to or less than the preset threshold, obtain the subscription status of the target sensor, and update the subscription status of the target sensor from the subscribed status to the unsubscribed status;
    所述向所述目标传感器发送第二工作状态切换指令包括:Sending a second working state switching instruction to the target sensor includes:
    在所述目标传感器的订阅状态由已订阅状态更新为未订阅状态时,向所述目标传感器发送第二工作状态切换指令。When the subscription state of the target sensor is updated from the subscribed state to the unsubscribed state, a second working state switching instruction is sent to the target sensor.
  3. 根据权利要求2所述的方法,其特征在于,还包括:The method according to claim 2, further comprising:
    接收订阅消息;所述订阅消息中携带有所述目标传感器的标识信息;Receive a subscription message; the subscription message carries identification information of the target sensor;
    根据所述订阅消息,确定所述目标传感器;Determine the target sensor according to the subscription message;
    获取所述目标传感器的订阅状态;Obtain the subscription status of the target sensor;
    在所述目标传感器的订阅状态为未订阅状态时,将所述目标传感器的订阅状态由未订阅状态更新为已订阅状态,将所述目标传感器的订阅数量增加第二预设值,并向所述目标传感器发送第一工作状态切换指令;所述第一工作状态切换指令用于指示目标传感器由第二工作状态切换为第一工作状态。When the subscription state of the target sensor is an unsubscribed state, the subscription state of the target sensor is updated from an unsubscribed state to a subscribed state, the subscription number of the target sensor is increased by a second preset value, and The target sensor sends a first working state switching instruction; the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state.
  4. 根据权利要求3所述的方法,其特征在于,还包括:The method according to claim 3, further comprising:
    在所述目标传感器的订阅状态为已订阅时,将所述目标传感器的订阅数量增加第二预设值。When the subscription status of the target sensor is subscribed, the subscription number of the target sensor is increased by a second preset value.
  5. 根据权利要求4所述的方法,其特征在于,还包括:The method according to claim 4, further comprising:
    获取目标传感器的测量数据;Obtain the measurement data of the target sensor;
    获取所述目标传感器的标识信息,并根据所述目标传感器的标识信息确定所述目标传感器的至少一个订阅设备;Obtain the identification information of the target sensor, and determine at least one subscribing device of the target sensor based on the identification information of the target sensor;
    向所述目标传感器的至少一个订阅设备发送所述测量数据。The measurement data is sent to at least one subscribing device of the target sensor.
  6. 根据权利要求5所述的方法,其特征在于,向所述目标传感器发送工作状态切换指令,其中所述工作状态切换指令包括第一工作状态切换指令或者第二工作状态切换指令,包括:The method according to claim 5, characterized in that sending a working state switching instruction to the target sensor, wherein the working state switching instruction includes a first working state switching instruction or a second working state switching instruction, including:
    在所述目标传感器有至少两个时,确定每个目标传感器的连接方式;When there are at least two target sensors, determine the connection method of each target sensor;
    按照每个目标传感器的连接方式,分别向所述目标传感器发送工作状态切换指 令。According to the connection mode of each target sensor, the working state switching instruction is sent to the target sensor respectively. make.
  7. 根据权利要求6所述的方法,其特征在于,所述按照每个目标传感器的连接方式,分别向所述目标传感器发送工作状态切换指令包括:The method according to claim 6, wherein sending a working state switching instruction to the target sensor according to the connection mode of each target sensor includes:
    在所述目标传感器与所述代理设备通过现场总线连接时,则通过现场总线向所述目标传感器发送工作状态切换指令;或者,When the target sensor and the agent device are connected through the field bus, a working state switching instruction is sent to the target sensor through the field bus; or,
    在所述目标传感器与所述代理设备通过网络连接时,则通过网络连接向所述目标传感器发送工作状态切换指令。When the target sensor and the proxy device are connected through the network, a working state switching instruction is sent to the target sensor through the network connection.
  8. 根据权利要求7所述的方法,其特征在于,所述获取目标传感器的测量数据包括:The method according to claim 7, characterized in that obtaining the measurement data of the target sensor includes:
    在所述目标传感器与所述代理设备通过现场总线连接时,则所述代理设备通过现场总线查询所述目标传感器,获取所述目标传感器的测量数据;或者,When the target sensor and the agent device are connected through the field bus, the agent device queries the target sensor through the field bus and obtains the measurement data of the target sensor; or,
    在所述目标传感器与所述代理设备通过网络连接时,则通过网络连接接收目标传感器发送的测量数据。When the target sensor and the proxy device are connected through the network, the measurement data sent by the target sensor is received through the network connection.
  9. 根据权利要求7或8所述的方法,其特征在于,所述网络连接包括:以太网络连接或者无线网络连接。The method according to claim 7 or 8, characterized in that the network connection includes: an Ethernet connection or a wireless network connection.
  10. 一种数据处理方法,其特征在于,应用于传感器,所述方法包括:A data processing method, characterized in that it is applied to sensors, and the method includes:
    接收第二工作状态切换指令;所述第二工作状态切换指令用于指示目标传感器由第一工作状态切换为第二工作状态;所述第一工作状态是所述目标传感器以第一测量周期进行数据测量的工作状态;所述第二工作状态是所述目标传感器不进行数据测量或者以第二测量周期进行数据测量的工作状态;其中,所述第二测量周期大于第一测量周期;Receive a second working state switching instruction; the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state; the first working state is that the target sensor performs a first measurement cycle The working state of data measurement; the second working state is a working 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;
    根据所述第二工作状态切换指令,将当前工作状态切换为第二工作状态,并在所述第二工作状态为以第二测量周期进行数据测量的工作状态时,按照第二测量周期进行数据测量。According to the second working state switching instruction, the current working state is switched to the second working state, and when the second working state is the working state of performing data measurement with the second measurement cycle, the data is measured according to the second measurement cycle. Measurement.
  11. 根据权利要求10所述的方法,其特征在于,还包括:The method according to claim 10, further comprising:
    接收第一工作状态切换指令;所述第一工作状态切换指令用于指示目标传感器由第二工作状态切换为第一工作状态;Receive a first working state switching instruction; the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state;
    根据所述第一工作状态切换指令,将当前工作状态切换为第一工作状态,并在所述第一工作状态为以第一测量周期进行数据测量的工作状态时,按照第一测量周期进行数据测量。According to the first working state switching instruction, the current working state is switched to the first working state, and when the first working state is a working state in which data measurement is performed with the first measurement cycle, data is measured according to the first measurement cycle. Measurement.
  12. 根据权利要求10或11所述的方法,其特征在于,还包括:The method according to claim 10 or 11, further comprising:
    向代理设备发送测量数据。Send measurement data to the agent device.
  13. 一种代理设备,其特征在于,包括:A proxy device, characterized by including:
    订阅发布服务模块,用于接收订阅取消消息,并将所述订阅取消消息发送至订阅管理模块;所述订阅取消消息中携带有目标传感器的标识信息;A subscription publishing service module, configured to receive a subscription cancellation message and send the subscription cancellation message to the subscription management module; the subscription cancellation message carries the identification information of the target sensor;
    订阅管理模块,用于根据所述订阅取消消息,确定目标传感器;A subscription management module, configured to determine the target sensor according to the subscription cancellation message;
    向所述目标传感器发送第二工作状态切换指令;所述第二工作状态切换指令用于指示目标传感器由第一工作状态切换为第二工作状态;所述第一工作状态是所述目标传感器以第一测量周期进行数据测量的工作状态;所述第二工作状态是所述目标传感 器不进行数据测量或者以第二测量周期进行数据测量的工作状态;其中,所述第二测量周期大于第一测量周期。Send a second working state switching instruction to the target sensor; the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state; the first working state is when the target sensor The working state of performing data measurement in the first measurement cycle; the second working state is the target sensing The device 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. 根据权利要求13所述的代理设备,其特征在于,The proxy device according to claim 13, characterized in that:
    所述订阅管理模块,用于获取所述目标传感器的订阅数量,并将所述目标传感器的订阅数量减少第一预设值;The subscription management module is used to obtain the 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 sensor is equal to or less than the preset threshold, obtain the subscription status of the target sensor, and update the subscription status of the target sensor from the subscribed status to the unsubscribed status;
    所述订阅管理模块,用于在所述目标传感器的订阅状态由已订阅状态更新为未订阅状态时,向所述目标传感器发送第二工作状态切换指令。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. 根据权利要求14所述的代理设备,其特征在于,The proxy device according to claim 14, characterized in that:
    所述订阅发布服务模块,用于接收订阅消息,并将订阅消息发送至订阅管理模块;所述订阅消息中携带有所述目标传感器的标识信息;The subscription publishing service module is used to receive subscription messages and send the subscription messages to the subscription management module; the subscription messages carry identification information of the target sensor;
    所述订阅管理模块,用于根据所述订阅消息,确定所述目标传感器;The subscription management module is used to determine the target sensor according to the subscription message;
    获取所述目标传感器的订阅状态;Obtain the subscription status of the target sensor;
    在所述目标传感器的订阅状态为未订阅状态时,将所述目标传感器的订阅状态由未订阅状态更新为已订阅状态,将所述目标传感器的订阅数量增加第二预设值,并向所述目标传感器发送第一工作状态切换指令;所述第一工作状态切换指令用于指示目标传感器由第二工作状态切换为第一工作状态。When the subscription state of the target sensor is an unsubscribed state, the subscription state of the target sensor is updated from an unsubscribed state to a subscribed state, the subscription number of the target sensor is increased by a second preset value, and The target sensor sends a first working state switching instruction; the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state.
  16. 根据权利要求15所述的代理设备,其特征在于,The proxy device according to claim 15, characterized in that:
    所述订阅管理模块,用于在所述目标传感器的订阅状态为已订阅时,将所述目标传感器的订阅数量增加第二预设值。The subscription management module is configured to increase the subscription number of the target sensor by a second preset value when the subscription status of the target sensor is subscribed.
  17. 根据权利要求16所述的代理设备,其特征在于,还包括:The proxy device according to claim 16, further comprising:
    订阅发布客户模块,用于获取目标传感器的测量数据,向所述订阅发布服务模块发送所述目标传感器发送的测量数据;The subscription publishing client module is used to obtain the measurement data of the target sensor and send the measurement data sent by the target sensor to the subscription publishing service module;
    所述订阅发布服务模块,用于获取所述目标传感器的标识信息,并根据所述目标传感器的标识信息确定所述目标传感器的至少一个订阅设备;The subscription publishing service module is used to obtain the identification information of the target sensor, and determine at least one subscription device of the target sensor based on the identification information of the target sensor;
    向所述目标传感器的至少一个订阅设备发送所述测量数据。The measurement data is sent to at least one subscribing device of the target sensor.
  18. 根据权利要求17所述的代理设备,其特征在于,The proxy device according to claim 17, characterized in that:
    所述订阅管理模块,用于在所述目标传感器有至少两个时,确定每个目标传感器的连接方式;The subscription management module is configured to determine the connection mode of each target sensor when there are at least two target sensors;
    按照每个目标传感器的连接方式,分别向所述目标传感器发送工作状态切换指令;所述工作状态切换指令包括:第一工作状态切换指令或者第二工作状态切换指令。According to the connection mode of each target sensor, a working state switching instruction is sent to the target sensor respectively; the working state switching instruction includes: a first working state switching instruction or a second working state switching instruction.
  19. 根据权利要求18所述的代理设备,其特征在于,The proxy device according to claim 18, characterized in that:
    所述订阅管理模块,用于在所述目标传感器与所述代理设备通过现场总线连接时,则通过现场总线向所述目标传感器发送工作状态切换指令;或者,The subscription management module is configured to send a working state switching instruction to the target sensor through the field bus when the target sensor and the agent device are connected through the field bus; or,
    在所述目标传感器与所述代理设备通过网络连接时,则通过网络连接向所述目标传感器发送工作状态切换指令。When the target sensor and the proxy device are connected through the network, a working state switching instruction is sent to the target sensor through the network connection.
  20. 根据权利要求19所述的代理设备,其特征在于, The proxy device according to claim 19, characterized in that:
    所述订阅发布客户模块,用于在所述目标传感器与所述代理设备通过现场总线连接时,通过现场总线查询所述目标传感器,获取所述目标传感器的测量数据;或者,The subscription publishing client module is used to query the target sensor through the field bus and obtain the measurement data of the target sensor when the target sensor and the agent device are connected through the field bus; or,
    在所述目标传感器与所述代理设备通过网络连接时,则通过网络连接接收目标传感器发送的测量数据。When the target sensor and the proxy device are connected through the network, the measurement data sent by the target sensor is received through the network connection.
  21. 根据权利要求19或20所述的代理设备,其特征在于,所述网络连接包括:以太网络连接或者无线网络连接。The agent device according to claim 19 or 20, characterized in that the network connection includes: an Ethernet network connection or a wireless network connection.
  22. 一种传感器,其特征在于,包括:A sensor, characterized in that it includes:
    接收模块,用于接收第二工作状态切换指令;所述第二工作状态切换指令用于指示目标传感器由第一工作状态切换为第二工作状态;所述第一工作状态是所述目标传感器以第一测量周期进行数据测量的工作状态;所述第二工作状态是所述目标传感器不进行数据测量或者以第二测量周期进行数据测量的工作状态;其中,所述第二测量周期大于第一测量周期;A receiving module, configured to receive a second working state switching instruction; the second working state switching instruction is used to instruct the target sensor to switch from the first working state to the second working state; the first working state is when the target sensor The first measurement period is a working state in which data measurement is performed; the second working state is a working 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;
    处理模块,用于根据所述第二工作状态切换指令,将当前工作状态切换为第二工作状态,并在所述第二工作状态为以第二测量周期进行数据测量的工作状态时,按照第二测量周期进行数据测量。A processing module configured to switch the current working state to the second working state according to the second working state switching instruction, and when the second working state is the working state of performing data measurement with the second measurement cycle, perform the processing according to the second working state. Data measurement is performed in two measurement cycles.
  23. 根据权利要求22所述的传感器,其特征在于,The sensor according to claim 22, characterized in that:
    所述接收模块,用于接收第一工作状态切换指令;所述第一工作状态切换指令用于指示目标传感器由第二工作状态切换为第一工作状态;The receiving module is used to receive a first working state switching instruction; the first working state switching instruction is used to instruct the target sensor to switch from the second working state to the first working state;
    所述处理模块,用于根据所述第一工作状态切换指令,将当前工作状态切换为第一工作状态,并在所述第一工作状态为以第一测量周期进行数据测量的工作状态时,按照第一测量周期进行数据测量。The processing module is configured to switch the current working state to the first working state according to the first working state switching instruction, and when the first working state is the working state of performing data measurement with the first measurement cycle, Data measurement is performed according to the first measurement cycle.
  24. 根据权利要求22或23所述的传感器,其特征在于,还包括:The sensor according to claim 22 or 23, further comprising:
    发送模块,用于向代理设备发送测量数据。The sending module is used to send measurement data to the agent device.
  25. 一种数据处理系统,其特征在于,包括:代理设备,至少一个传感器及至少一个订阅设备;A data processing system, characterized by including: an agent device, at least one sensor and at least one subscription device;
    其中,代理设备与至少一个传感器及至少一个订阅设备连接;Wherein, the agent device is connected to at least one sensor and at least one subscription device;
    至少一个订阅设备,用于向代理设备发送订阅取消消息;所述订阅取消消息中携带有目标传感器的标识信息;At least one subscription device, configured to send a subscription cancellation message to the agent device; the subscription cancellation message carries the identification information of the target sensor;
    所述代理设备包括权利要求13-21任一项所述的代理设备;所述至少一个传感器包括权利要求22-24任一项所述的传感器。The agent device includes the agent device according to any one of claims 13-21; the at least one sensor includes the sensor according to any one of claims 22-24.
  26. 一种电子设备,其特征在于,包括处理器和存储器,所述存储器存储有计算机程序,当所述计算机程序被执行时,使得所述电子设备执行权利要求1-9任一项所述的方法或执行权利要求10-12任一项所述的方法。An electronic device, characterized in that it includes a processor and a memory, and the memory stores a computer program. When the computer program is executed, the electronic device performs the method described in any one of claims 1-9. Or perform the method described in any one of claims 10-12.
  27. 一种存储介质,其特征在于,所述存储介质包括存储的程序,其中,在所述程序运行时控制所述存储介质所在设备执行权利要求1-9任一项所述的方法或执行权利要求10-12任一项所述的方法。 A storage medium, characterized in that the storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the method described in any one of claims 1-9 or to execute the claim The method described in any one of 10-12.
PCT/CN2023/095783 2022-05-31 2023-05-23 Data processing method and apparatus, and device, storage medium and system WO2023231837A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210610499.2 2022-05-31
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
WO2023231837A1 true WO2023231837A1 (en) 2023-12-07

Family

ID=88983758

Family Applications (1)

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

Country Status (2)

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

Cited By (1)

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

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107340014A (en) * 2017-08-31 2017-11-10 广东美的制冷设备有限公司 Detection method, device and the computer-readable recording medium of multisensor
CN108475100A (en) * 2016-03-15 2018-08-31 深圳迈瑞生物医疗电子股份有限公司 Working mode switching method, wireless sensor and system
CN109788536A (en) * 2019-01-24 2019-05-21 深圳绿米联创科技有限公司 Sensor control method, sensor control, sensor and storage medium
JP2019185297A (en) * 2018-04-06 2019-10-24 株式会社東芝 Sensor system
CN113971045A (en) * 2021-09-13 2022-01-25 北京小米移动软件有限公司 Control method, control device and storage medium
CN114237921A (en) * 2020-09-09 2022-03-25 华为终端有限公司 Sensor monitoring method and device and terminal equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108475100A (en) * 2016-03-15 2018-08-31 深圳迈瑞生物医疗电子股份有限公司 Working mode switching method, wireless sensor and system
CN107340014A (en) * 2017-08-31 2017-11-10 广东美的制冷设备有限公司 Detection method, device and the computer-readable recording medium of multisensor
JP2019185297A (en) * 2018-04-06 2019-10-24 株式会社東芝 Sensor system
CN109788536A (en) * 2019-01-24 2019-05-21 深圳绿米联创科技有限公司 Sensor control method, sensor control, sensor and storage medium
CN114237921A (en) * 2020-09-09 2022-03-25 华为终端有限公司 Sensor monitoring method and device and terminal equipment
CN113971045A (en) * 2021-09-13 2022-01-25 北京小米移动软件有限公司 Control method, control device and storage medium

Cited By (2)

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

Also Published As

Publication number Publication date
CN117201525A (en) 2023-12-08

Similar Documents

Publication Publication Date Title
CN108803552B (en) Monitoring system and monitoring method for equipment fault
CN103117879B (en) A kind of computer hardware operational factor network monitoring system
WO2023231837A1 (en) Data processing method and apparatus, and device, storage medium and system
US11461037B2 (en) Data collection system and data collection method
WO2000021252A1 (en) Method and system for efficient packet data transport
KR20080058454A (en) A distributed monitoring method
US8102271B2 (en) Apparatus and method for asset tracking based on ubiquitous sensor network using motion sensing
CN111813699B (en) Data routing test method and device based on intelligent electric meter and computer equipment
KR102112233B1 (en) Method and apparatus for monitoring of retractable structure using wireless data transmission device and gateway
US20080056160A1 (en) Information processing system, information processing apparatus, information processing method and program
CN106557362B (en) Task migration method and system applied to intelligent robot
CN110913362A (en) Method and device for realizing wireless signal test through client and test equipment
US20190230531A1 (en) Cellular base station monitoring
KR102576610B1 (en) AI Breaker Remote Monitoring Control System and Method thereof
CN111343700A (en) Wireless sensor network communication method
CN100349420C (en) Network supervisory control system and network supervisory control method
WO2022068564A1 (en) Device abnormality monitoring method and device
CN105578122A (en) Monitoring prompt method based on router, apparatus and electronic equipment thereof
KR101754210B1 (en) Module based energy storage system that can extend dynamic function in real time and method thereof
CN114301857A (en) Water meter communication method and device based on Internet of things
CN111371618A (en) Data processing method and gateway
CN111431285A (en) Direct current power supply monitoring system and method
CN114301941B (en) Management method and device of power equipment and storage medium
CN117097635B (en) Method, device, storage medium and equipment for calling link sampling
CN209659326U (en) One kind being used for network communication operation management equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23815021

Country of ref document: EP

Kind code of ref document: A1