[go: up one dir, main page]

CN111162936B - Data acquisition method and device - Google Patents

Data acquisition method and device Download PDF

Info

Publication number
CN111162936B
CN111162936B CN201911300621.0A CN201911300621A CN111162936B CN 111162936 B CN111162936 B CN 111162936B CN 201911300621 A CN201911300621 A CN 201911300621A CN 111162936 B CN111162936 B CN 111162936B
Authority
CN
China
Prior art keywords
acquisition time
time
acquisition
current
current acquisition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911300621.0A
Other languages
Chinese (zh)
Other versions
CN111162936A (en
Inventor
章红春
白璐
张雄建
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Shougang Automation Information Technology Co Ltd
Original Assignee
Beijing Shougang Automation Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Shougang Automation Information Technology Co Ltd filed Critical Beijing Shougang Automation Information Technology Co Ltd
Priority to CN201911300621.0A priority Critical patent/CN111162936B/en
Publication of CN111162936A publication Critical patent/CN111162936A/en
Application granted granted Critical
Publication of CN111162936B publication Critical patent/CN111162936B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/06Generation of reports
    • H04L43/065Generation of reports related to network devices
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • 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
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Environmental & Geological Engineering (AREA)
  • Telephonic Communication Services (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention provides a data acquisition method and a data acquisition device, wherein the method comprises the following steps: receiving at least one piece of equipment information, configuring the equipment information according to a corresponding network protocol, and acquiring result information of a plurality of target equipment according to a monitoring request; determining the next acquisition time of the current acquisition time of the target equipment; judging whether the current acquisition time is expired or not, if the current acquisition time is determined to be expired, triggering an acquisition event corresponding to the current acquisition time, and acquiring data corresponding to the current acquisition time by using the acquisition event; after data acquisition is finished, judging whether the next acquisition time is due, if so, deleting the original acquisition data, triggering an acquisition event corresponding to the next acquisition time, and acquiring data again; in this way, a bridge is built between the server and the field device, and the bridge can be used for triggering the acquisition of a plurality of target devices at any time, so that the unified management of a plurality of devices is realized, and the data acquisition efficiency can be improved.

Description

Data acquisition method and device
Technical Field
The present invention relates to the field of network communication technologies, and in particular, to a data acquisition method and apparatus.
Background
In the field of industrial control, the control network technology is a networked automatic control technology in which an automatic control technology and a computer communication technology are developed and fused with each other, control networks of different architectures are generated in different automation fields, and even control networks of multiple architectures are generated in the same automation field. The distributed control system, the field bus control system and the industrial Ethernet are all based on control network data communication, the communication protocol in each control network is different, and the interface protocol of the field device interface is also different.
In the prior art, in order to implement data communication between control networks, the connection between the field device interface and the control network is mainly implemented by communication adapters and gateways supporting different protocols.
However, in actual production, the number of field devices is large, so that a plurality of communication adapters and gateways are needed, and the protocols of some adapters and gateways are proprietary protocols, so that the server cannot uniformly manage the plurality of adapters and gateways, and the efficiency of data acquisition is low when data is acquired.
Disclosure of Invention
Aiming at the problems in the prior art, the embodiments of the present invention provide a data acquisition method and apparatus, which are used to solve the technical problem in the prior art that a server cannot uniformly manage multiple adapters and gateways in an automation control network, so that the data acquisition efficiency is low when data is acquired.
The invention provides a data acquisition method, which is applied to a bridge communication network and comprises the following steps:
receiving at least one piece of equipment information, and configuring the equipment information according to a corresponding network protocol, wherein the equipment information comprises: device IP, device port, and device name;
receiving a monitoring request sent by a server, and obtaining result information of target equipment according to the monitoring request, wherein the monitoring request carries equipment information of the target equipment, and the result information comprises: the current acquisition time, the sampling interval time, the acquisition state and the attribute path of the target equipment; the target device comprises a plurality of devices;
determining the next acquisition time of the current acquisition time of the target equipment according to the result information of the target equipment, wherein the current acquisition time is any acquisition time;
judging whether the current acquisition time is expired or not by using a spinning thread, if the current acquisition time is determined to be expired, triggering an acquisition event corresponding to the current acquisition time, and acquiring data corresponding to the current acquisition time by using the acquisition event corresponding to the current acquisition time;
and after the data corresponding to the current acquisition time is acquired, judging whether the next acquisition time is due, if so, deleting the original acquisition data, triggering the acquisition event corresponding to the next acquisition time, and acquiring the data again by using the acquisition event corresponding to the next acquisition time.
Optionally, the determining, according to the result information of the target device, a next acquisition time of a current acquisition time of the target device includes:
acquiring the current acquisition time T1 and the sampling interval time T of the target equipment;
and determining the next acquisition time of the current acquisition time according to a formula T = T1+ T.
Optionally, the acquiring data corresponding to the current acquisition time by using the acquisition event corresponding to the current acquisition time includes:
acquiring a timestamp triggered by an acquisition event corresponding to the current acquisition time;
and starting to collect data from the time stamp until a preset sampling interval time is collected.
Optionally, the target device includes multiple parameters, and each parameter is preset with a corresponding acquisition time.
Optionally, after the data corresponding to the current collection time is collected by using the collection event, the method includes:
registering the parameter value of the data corresponding to the current acquisition moment to a parameter value register in a cache, judging whether the registration is successful, and if the registration is failed and abnormal, registering abnormal information to an abnormal register in the cache;
and updating the next acquisition time according to a preset extension time.
The present invention also provides a data acquisition apparatus, the apparatus comprising:
a configuration unit, configured to receive at least one piece of device information, and configure the device information according to a corresponding network protocol, where the device information includes: device IP, device port, and device name;
an obtaining unit, configured to receive a monitoring request sent by a server, and obtain result information of a target device according to the monitoring request, where the monitoring request carries device information of the target device, and the result information includes: the current acquisition time, the sampling interval time, the acquisition state and the attribute path of the target equipment; the target device comprises a plurality of devices;
the determining unit is used for determining the next acquisition time of the current acquisition time of the target equipment according to the result information of the target equipment;
the judging unit is used for judging whether the current acquisition time is expired by using a spin thread, and triggering an acquisition event corresponding to the current acquisition time if the current acquisition time is determined to be expired; collecting data corresponding to the current collecting time by using a collecting event corresponding to the current collecting time;
and after the data corresponding to the current acquisition time is acquired, judging whether the next acquisition time is due, if so, deleting the original acquisition data, triggering the acquisition event corresponding to the next acquisition time, and acquiring the data again by using the acquisition event corresponding to the next acquisition time.
Optionally, the determining unit is specifically configured to:
acquiring the current acquisition time T1 and the sampling interval time T of the target equipment;
determining a next acquisition time to the current acquisition time according to a formula T = T1+ T.
Optionally, the determining unit is specifically configured to:
acquiring a timestamp triggered by an acquisition event corresponding to the current acquisition time;
and starting to collect data from the timestamp until collecting the next collection time of the current collection time.
Optionally, the target device includes a plurality of parameters, and each parameter is preset with a corresponding acquisition time.
Optionally, the apparatus further comprises: a registration unit;
the registration unit is used for registering the parameter value of the data corresponding to the current acquisition moment to a parameter value register in a cache pool after the data corresponding to the current acquisition moment is acquired by using the acquisition event, judging whether the registration is successful or not, and registering abnormal information to an abnormal register in the cache pool if the registration is failed and abnormal;
and updating the next acquisition time according to a preset extension time.
The invention provides a data acquisition method and a data acquisition device, wherein the method comprises the following steps: receiving at least one piece of equipment information, and configuring the equipment information according to a corresponding network protocol, wherein the equipment information comprises: device IP, device port, and device name; receiving a monitoring request sent by a server, and obtaining result information of a target device according to the monitoring request, wherein the monitoring request carries device information of the target device, and the result information comprises: the current acquisition time, the sampling interval time, the acquisition state and the attribute path of the target equipment; the target device comprises a plurality of devices; determining the next acquisition time of the current acquisition time of the target equipment according to the result information of the target equipment; judging whether the current acquisition time is overdue or not by using a spinning thread, if the current acquisition time is determined to be expired, triggering an acquisition event corresponding to the current acquisition time, and acquiring data corresponding to the current acquisition time by using the acquisition event corresponding to the current acquisition time; after the data corresponding to the current acquisition time is acquired, judging whether the next acquisition time is due, if so, deleting the original acquisition data, triggering the acquisition event corresponding to the next acquisition time, and acquiring the data again by using the acquisition event corresponding to the next acquisition time; therefore, when the data acquired by the target equipment needs to be acquired, only the fact that whether each acquisition time of the target equipment is due is needed to be sequentially judged, if yes, the acquisition test piece is triggered, and the corresponding data is acquired according to the acquisition event; in this way, equivalently, a bridge is built between the server and the field device, the target devices can include a plurality of target devices, namely, the bridge can be used for triggering the acquisition moments of the target devices, so that the unified management of the target devices is realized, the server resources are prevented from being occupied in a large amount, and the data acquisition efficiency can be improved.
Drawings
Fig. 1 is a schematic flow chart of a data acquisition method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a data acquisition apparatus according to a second embodiment of the present invention.
Detailed Description
The technical problem that in an automatic control network in the prior art, a server cannot uniformly manage a plurality of adapters and gateways, and accordingly data acquisition efficiency is low when data are acquired is solved. The invention provides a data acquisition method and device.
The technical solution of the present invention is further described in detail by the accompanying drawings and the specific embodiments.
Example one
The present embodiment provides a data acquisition method, as shown in fig. 1, the method includes:
s110, receiving at least one piece of device information, configuring the device information according to a corresponding network protocol, where the device information includes: device IP, device port, and device name;
with the development of industrial automation, different sub-communication networks may be included in one control network, for example, a bus network may be used in some field areas, and an ethernet network may be used in other field areas with the development of technology in later period. Then the field devices in each network need to communicate with the server for centralized control.
However, because different control networks support different communication protocols, such as the ethernet protocol supported by the industrial ethernet, each bus control network supports a corresponding bus protocol, and therefore, a corresponding network adapter and a gateway are required to assist communication, and the network protocols used by the network adapter and the gateway are also different in different control networks.
Then, in this step, at least one piece of device information needs to be received, and the device information is configured according to a corresponding network protocol, where the device information corresponding to each network protocol includes: device IP, device port, and device name.
After the information is configured, a bridge communication network is equivalently established between the server and the field devices, the bridge communication network is provided with two ports, one port is communicated with the server, and the other port is communicated with all the field devices, so that the field devices can be uniformly managed.
S111, receiving a monitoring request sent by a server, and acquiring result information of target equipment according to the monitoring request, wherein the monitoring request carries equipment information of the target equipment;
however, in general, a field device includes many (thousands or even tens of thousands) and each device includes many parameters (for example, if the device is an air conditioner, the parameters may include a set temperature, a current room temperature, an on state, an operating state, real-time power consumption, an on time, an operating time, and the like), different devices include different parameters, and each parameter is preset with a corresponding acquisition time (for example, the set temperature, the current room temperature, and the on state may correspond to sampling times of 2, 00, 2. The concrete implementation is as follows:
after the device information is configured, if the server needs to acquire data of the field device, a monitoring request is sent, the monitoring request carries the device information of the target device, and a spinning thread in the bridge communication network acquires result information of the target device according to the monitoring request. The result information includes: the current acquisition time, the sampling interval time, the acquisition state (whether to start acquisition or not and whether to finish acquisition) and the attribute path of the target equipment; the target device may include a plurality of devices.
Here, after receiving the monitoring request, the device attribute information of all the target devices is acquired according to the configured information, and the device attribute information of the target devices is registered in batch through the acquisition registrar.
The device attribute information includes: equipment ID, parameter name, parameter value unit, parameter value timestamp, parameter path, read-write level (0 read-only, 1 read-write), acquisition frequency state (normal/abnormal) and parameter description.
For example, if the device is an air conditioner, the parameter name may be real-time temperature, the parameter value may be a specific degree, the parameter value may be in units of degrees, and the time stamp of the parameter value may be time for acquiring the parameter value.
Here, the bridge communication network is a spin-threading network comprising a plurality of spin threads, each spin thread being capable of obtaining result information for a field device, the spin threads having a shared spin lock, the server being capable of setting the shared number of spin locks. For example, if the number of sharing is 100, then the result information of 100 corresponding field devices can be obtained simultaneously, and then the number of target devices can be 100. The maximum value of the sharing number is determined according to hardware resources.
S112, determining the next acquisition time of the current acquisition time of the target equipment according to the result information of the target equipment;
after the result information of the target device is obtained, the next acquisition time of the current acquisition time of the target device can be determined according to the result information of the target device.
As an optional implementation, determining, according to the result information of the target device, a next acquisition time of a current acquisition time of the target device includes:
acquiring the current acquisition time T1 and the sampling interval time T of the target equipment;
determining the next preset acquisition time of the current acquisition time according to a formula (1), wherein n is an integer greater than 1:
T=T1+t (1)
in formula (1), T1 is a preset current acquisition time of the target device, and T is the sampling interval time.
When the next collection time is determined, the jedisPool can be utilized to store the next collection time in a preset cache, and the cache can be a redis database.
In the embodiment, the jedisPool is used for providing the pre-link, so that the phenomenon of thread blocking caused by thread exception is prevented. The situation of lacking connection resources in a high concurrency environment and a frequent connection and closing environment can be avoided.
S113, judging whether the current acquisition time is expired or not by using a spinning thread, if the current acquisition time is determined to be expired, triggering an acquisition event corresponding to the current acquisition time, and acquiring data corresponding to the current acquisition time by using the acquisition event corresponding to the current acquisition time;
here, after step S110, step S112 and step S113 are performed simultaneously. After the result information of the target device is acquired, the current acquisition time can be determined according to the result information, whether the current acquisition time is overdue or not is judged by using a spinning thread, if the current acquisition time is determined to be expired, data needs to be acquired at the moment, the acquisition state is further acquired, if the acquisition state is not started, an acquisition event corresponding to the current acquisition time is triggered, and the data corresponding to the current acquisition time is acquired by using the acquisition event corresponding to the current acquisition time.
As an optional embodiment, the acquiring data corresponding to the current acquisition time by using the acquisition event corresponding to the current acquisition time includes:
acquiring a timestamp triggered by an acquisition event corresponding to the current acquisition time;
and starting to collect data from the time stamp until a preset sampling time interval is collected.
For example, the current acquisition time is 9 am and 00 m, and the sampling interval time is 15s. But at 9.
Here, since there may be a delay in the current acquisition time (for example, 9.
However, if the current acquisition time is not acquired at 9.
Further, after the data corresponding to the current acquisition time is acquired, the data is sent to a message bus, and the master thread registers the parameter values of the data to a parameter value register in the cache. The parameter value register comprises method registration, and the information to be registered is as follows: the parameter value context includes a path, a parameter value, and a parameter value timestamp.
The message bus uses eventBus in a vert.x framework, which is based on events and asynchronizations, relies on fully asynchronous Java server Netty, and extends many other characteristics, and is favored by developers due to its light weight, high performance and support of multi-language development. event bus is the nervous system of vert.x. There is a single event bus instance for each vert.x instance. It is obtained using the vertx. Eventbus () method. And the event bus agrees to the communication of modules written in different languages in the program. Regardless of whether the module is the same vert.x example. Or a different vert.x instance. And can bridge Javascript communications executing in the browser. event buses enable point-to-point communication and multiple browsers among multiple server nodes in a distributed system. event bus supports publish/subscribe mode. Point-to-point mode, and request/response mode. The API of event bus is very easy. It mainly contains registration message processing event, cancel processing event, send and publish message.
Further, whether the parameter value is successfully registered is judged, if the parameter value is abnormally registered in failure, abnormal information needs to be registered to an abnormal register in the cache, and meanwhile, the next acquisition time of the current acquisition time needs to be updated.
The abnormal register comprises method registration, inquiry and cancellation; the abnormality information includes: collecting abnormal information, writing abnormal information and the like. The information to be registered includes: exception type, keywords, exception summary, exception time, and exception information.
Here, for each registration, if an exception occurs during a registration failure, the next time of the current acquisition time is delayed by a preset delay time, and therefore the next acquisition time needs to be updated.
And S114, after the data corresponding to the current acquisition time is acquired, judging whether the next acquisition time is due, if so, deleting the original acquisition data, triggering the acquisition event corresponding to the next acquisition time, and acquiring the data again by using the acquisition event corresponding to the next acquisition time.
And after the data corresponding to the current acquisition time is acquired, judging whether the next acquisition time of the target equipment expires, if so, deleting the original acquisition data, triggering the acquisition event corresponding to the next acquisition time, and acquiring the data again by using the acquisition event corresponding to the next acquisition time.
Here, when the next acquisition time expires, an acquisition event corresponding to the next acquisition time is triggered, and after 15 seconds of acquisition, the next acquisition time of the next acquisition time is determined.
It can be understood that when the next collection time is judged to be due, the next collection time is equivalent to another current time, so that whether the collection time corresponding to each attribute in the target device is due can be judged indefinitely without stopping the system, and whether the collection time corresponding to each attribute is due is sequentially judged in such a way, so that each attribute of each device can collect corresponding data.
In addition, the server can also perform unified management on a plurality of devices, so that occupied resources of the server are reduced, the processing efficiency of the server is improved, and the data acquisition efficiency is further improved.
Based on the same inventive concept, the invention also provides a data acquisition device, which is detailed in embodiment two.
Example two
The present embodiment provides a data acquisition apparatus, and referring to fig. 2, the apparatus includes: a configuration unit 21, an acquisition unit 22, a determination unit 23, a judgment unit 24, and a registration unit 25; wherein,
with the development of industrial automation, different sub-communication networks may be included in one control network, for example, a bus network may be used in some field areas, and an ethernet network may be used in other field areas with the development of technology. Then the field devices in each network need to communicate with the server for centralized control.
However, since different control networks support different communication protocols, such as an ethernet protocol supported by an industrial ethernet, each bus control network supports a corresponding bus protocol, and thus needs to use a corresponding network adapter and a corresponding gateway to facilitate communication.
The configuration unit 21 is configured to receive at least one piece of device information, and configure the device information according to a corresponding network protocol, where the device information corresponding to each network protocol includes: device IP, device port, and device name.
After the information is configured, a bridge communication network is equivalently established between the server and the field devices, the bridge communication network is provided with two ports, one port is communicated with the server, and the other port is communicated with all the field devices, so that the field devices can be uniformly managed.
However, in general, a field device includes many (thousands or even tens of thousands) and each device includes many parameters (for example, if the device is an air conditioner, the parameters may include a set temperature, a current room temperature, an on state, an operating state, real-time power consumption, an on time, an operating time, and the like), different devices include different parameters, and each parameter is preset with a corresponding acquisition time (for example, the set temperature, the current room temperature, and the on state may correspond to sampling times of 2, 00, 2. The concrete implementation is as follows:
after the device information is configured, if the server needs to acquire data of the field device, a monitoring request is sent, where the monitoring request carries the device information of the target device, and the acquiring unit 22 in the bridged communication network acquires result information of the target device according to the monitoring request. The result information includes: the current acquisition time, the sampling interval time, the acquisition state (whether to start acquisition or not and whether to finish acquisition) and the attribute path of the target equipment; the target device may include a plurality; the fetch unit 22 may be a spin thread.
Here, after receiving the listening request, the registering unit 25 obtains the device attribute information of all the target devices according to the configured information, and registers the device attribute information of the target devices in batch through the collection registrar.
The device attribute information includes: equipment ID, parameter name, parameter value unit, parameter value timestamp, parameter path, read-write level (0 read-only, 1 read-write), acquisition frequency state (normal/abnormal) and parameter description.
For example, if the device is an air conditioner, the parameter name may be real-time temperature, the parameter value may be a specific degree, the parameter value may be in units of degrees, and the time stamp of the parameter value may be time for acquiring the parameter value.
Here, the bridge communication network is a spin-threading network comprising a plurality of spin threads, each spin thread being capable of obtaining result information for a field device, the spin threads having a shared spin lock, the server being capable of setting the shared number of spin locks. For example, if the number of shares is 100, then the result information of 100 corresponding field devices can be obtained simultaneously, and then the number of target devices can be 100. The maximum value of the sharing number is determined according to hardware resources.
After the result information of the target device is obtained, the determining unit 23 may determine a next acquisition time of the current acquisition time of the target device according to the result information of the target device.
As an optional implementation, the determining unit 23 determines, according to the result information of the target device, a next acquisition time of a current acquisition time of the target device, including:
acquiring the current acquisition time T1 and the sampling interval time T of the target equipment;
determining the next preset acquisition time of the current acquisition time according to a formula (1), wherein n is an integer greater than 1:
T=T1+t (1)
in the formula (1), T1 is a preset current acquisition time of the target device, and T is the sampling interval time.
When the next collection time is determined, the jedisPool can be utilized to store the next collection time in a preset cache, and the cache can be a redis database.
In the embodiment, the jedisPool is used for providing the pre-link, so that the phenomenon of thread blocking caused by thread exception is prevented. The situation of lacking connection resources can be avoided in a high concurrency environment and in a frequent connection and closing environment.
After the result information of the target device is obtained, the determining unit 23 may determine a current acquisition time according to the result information, the determining unit 24 determines whether the current acquisition time is expired by using a spin thread, if it is determined that the current acquisition time is expired, it indicates that data needs to be acquired at this time, and further acquires an acquisition state, and if the acquisition state is not started, an acquisition event corresponding to the current acquisition time is triggered, and the data corresponding to the current acquisition time is acquired by using the acquisition event corresponding to the current acquisition time.
As an optional embodiment, the acquiring unit 24 acquires data corresponding to the current acquisition time by using the acquisition event corresponding to the current acquisition time, including:
acquiring a timestamp triggered by an acquisition event corresponding to the current acquisition time;
and starting to collect data from the time stamp until a preset sampling time interval is collected.
For example, the current acquisition time is 9 am and the sampling interval time is 15s. But at 9.
Here, because there may be a delay (for example, 9 to 00 is delayed to 9).
However, if the current acquisition time is not acquired at 9.
Further, after the data corresponding to the current acquisition time is acquired, the data is sent to a message bus, and the register unit 25 of the main thread registers the parameter value of the data to the parameter value register in the cache. The parameter value register comprises method registration, and the information to be registered is as follows: the parameter value context includes a path, a parameter value, and a parameter value timestamp.
The message bus uses eventBus in a vert.x framework, which is based on events and asynchronization, relies on fully asynchronous Java server Netty, and extends many other characteristics, and is favored by developers due to its light weight, high performance, and support of multi-language development. event bus is the nervous system of vert.x. There is a single event bus instance for each vert.x instance. It was obtained using the vertx. Eventbus () method. The event bus agrees to the communication of modules written in different languages in the program. Regardless of whether the module is the same vert.x example. Or a different vert.x instance. And can bridge Javascript communications executing in the browser. event buses enable point-to-point communication and multiple browsers among multiple server nodes in a distributed system. The event bus supports a publish/subscribe mode. Point-to-point mode, and request/response mode. The API of event bus is very easy. It mainly contains registration message processing event, cancellation processing event, sending and publishing message.
Further, the determining unit 24 is further configured to determine whether the parameter value is successfully registered, and if the registration failure is abnormal, the registering unit 25 needs to register the abnormal information in an abnormal register in the cache and needs to update the next acquisition time of the current acquisition time.
The abnormal register comprises method registration, inquiry and cancellation; the abnormality information includes: collecting abnormal information, writing abnormal information and the like. The information to be registered includes: exception type, keywords, exception summary, exception time, and exception information.
Here, if an exception occurs in the registration failure for each registration, the registration unit 25 delays the next time of the current acquisition time by a preset delay time, and thus the next acquisition time needs to be updated.
After the data corresponding to the current collection time is collected, the determining unit 24 is further configured to determine whether the next collection time of the target device expires, and if so, delete the original collection data, trigger the collection event corresponding to the next collection time, and re-collect the data by using the collection event corresponding to the next collection time.
Here, when the next acquisition time expires, an acquisition event corresponding to the next acquisition time is triggered, and after 15 seconds of acquisition, the next acquisition time of the next acquisition time is determined.
It can be understood that when the next collection time is judged to be due, the next collection time is equivalent to another current time, so that whether the collection time corresponding to each attribute in the target device is due can be judged indefinitely without stopping the system, and whether the collection time corresponding to each attribute is due is sequentially judged in such a way, so that each attribute of each device can collect corresponding data.
In addition, the server can also perform unified management on a plurality of devices, so that occupied resources of the server are reduced, the processing efficiency of the server is improved, and the data acquisition efficiency is further improved.
The data acquisition method and the data acquisition device provided by the invention have the beneficial effects that at least:
the invention provides a data acquisition method and a data acquisition device, wherein the method comprises the following steps: receiving at least one piece of equipment information, and configuring the equipment information according to a corresponding network protocol, wherein the equipment information comprises: device IP, device port, and device name; receiving a monitoring request sent by a server, and obtaining result information of target equipment according to the monitoring request, wherein the monitoring request carries equipment information of the target equipment, and the result information comprises: the current acquisition time, the sampling interval time, the acquisition state and the attribute path of the target equipment; the target device comprises a plurality of devices; determining the next acquisition time of the current acquisition time of the target equipment according to the result information of the target equipment; judging whether the current acquisition time is expired or not by using a spinning thread, if the current acquisition time is determined to be expired, triggering an acquisition event corresponding to the current acquisition time, and acquiring data corresponding to the current acquisition time by using the acquisition event corresponding to the current acquisition time; after the data corresponding to the current acquisition time is acquired, judging whether the next acquisition time is due, if so, deleting the original acquisition data, triggering the acquisition event corresponding to the next acquisition time, and acquiring the data again by using the acquisition event corresponding to the next acquisition time; therefore, when the data acquired by the target equipment needs to be acquired, only one-by-one judgment needs to be made to determine whether each acquisition time of the target equipment is due, if so, the acquisition test piece is triggered, and the corresponding data is acquired according to the acquisition event; therefore, a bridge is built between the server and the field device, the target devices can comprise a plurality of bridges, namely the bridges can be used for triggering the acquisition moments of the target devices, so that the unified management of the target devices is realized, the server resources are prevented from being largely occupied, and the data acquisition efficiency can be improved.
The above description is only exemplary of the present invention and should not be taken as limiting the scope of the present invention, and any modifications, equivalents, improvements, etc. that are within the spirit and principle of the present invention should be included in the present invention.

Claims (8)

1. A data acquisition method for use in a bridged communication network, the method comprising:
receiving at least one piece of equipment information, and configuring the equipment information according to a corresponding network protocol, wherein the equipment information comprises: device IP, device port, and device name; receiving a monitoring request sent by a server, and obtaining result information of a target device according to the monitoring request, wherein the monitoring request carries device information of the target device, and the result information comprises: the current acquisition time, the sampling interval time, the acquisition state and the attribute path of the target equipment; the target device comprises a plurality of devices;
determining the next acquisition time of the current acquisition time of the target equipment according to the result information of the target equipment, wherein the current acquisition time is any acquisition time;
judging whether the current acquisition time is expired or not by using a spinning thread, if the current acquisition time is determined to be expired, triggering an acquisition event corresponding to the current acquisition time, and acquiring data corresponding to the current acquisition time by using the acquisition event corresponding to the current acquisition time;
the acquiring the data corresponding to the current acquisition time by using the acquisition event corresponding to the current acquisition time comprises the following steps:
acquiring a timestamp triggered by an acquisition event corresponding to the current acquisition time;
starting to collect data from the timestamp until a preset sampling interval time is collected;
and after the data corresponding to the current acquisition time is acquired, judging whether the next acquisition time is due, if so, deleting the original acquisition data, triggering the acquisition event corresponding to the next acquisition time, and acquiring the data again by using the acquisition event corresponding to the next acquisition time.
2. The method of claim 1, wherein said determining a next acquisition time to a current acquisition time of the target device based on the result information of the target device comprises:
acquiring the current acquisition time T1 and the sampling interval time T of the target equipment;
determining a next acquisition time to the current acquisition time according to a formula T = T1+ T.
3. The method of claim 1, wherein the target device comprises a plurality of parameters, each preset with a corresponding acquisition time instant.
4. The method of claim 1, wherein said collecting data corresponding to the current collection time using the collection event comprises:
registering the parameter value of the data corresponding to the current acquisition moment to a parameter value register in a cache, judging whether the registration is successful, and if the registration is failed and abnormal, registering abnormal information to an abnormal register in the cache;
and updating the next acquisition time according to a preset extension time.
5. A data acquisition apparatus, characterized in that the apparatus comprises:
a configuration unit, configured to receive at least one piece of device information, and configure the device information according to a corresponding network protocol, where the device information includes: device IP, device port, and device name;
an obtaining unit, configured to receive a monitoring request sent by a server, and obtain result information of a target device according to the monitoring request, where the monitoring request carries device information of the target device, and the result information includes: the current acquisition time, the sampling interval time, the acquisition state and the attribute path of the target equipment; the target device comprises a plurality of devices;
the determining unit is used for determining the next acquisition time of the current acquisition time of the target equipment according to the result information of the target equipment;
the judging unit is used for judging whether the current acquisition time is expired by using a spin thread, and triggering an acquisition event corresponding to the current acquisition time if the current acquisition time is determined to be expired; acquiring data corresponding to the current acquisition time by using an acquisition event corresponding to the current acquisition time;
the judgment unit is specifically configured to:
acquiring a timestamp triggered by an acquisition event corresponding to the current acquisition time;
starting to collect data from the timestamp until the next collection time of the current collection time is collected;
and after the data corresponding to the current acquisition time is acquired, judging whether the next acquisition time is due, if so, deleting the original acquisition data, triggering the acquisition event corresponding to the next acquisition time, and acquiring the data again by using the acquisition event corresponding to the next acquisition time.
6. The apparatus as claimed in claim 5, wherein said determining unit is specifically configured to:
acquiring the current acquisition time T1 and the sampling interval time T of the target equipment;
determining a next acquisition time to the current acquisition time according to a formula T = T1+ T.
7. The apparatus of claim 5, wherein the target device comprises a plurality of parameters, each preset with a corresponding acquisition time instant.
8. The apparatus of claim 5, wherein the apparatus further comprises: a registration unit;
the registration unit is used for registering the parameter value of the data corresponding to the current acquisition moment to a parameter value register in a cache pool after the data corresponding to the current acquisition moment is acquired by using the acquisition event, judging whether the registration is successful or not, and registering abnormal information to an abnormal register in the cache pool if the registration is failed and abnormal;
and updating the next acquisition time according to a preset extension time.
CN201911300621.0A 2019-12-17 2019-12-17 Data acquisition method and device Active CN111162936B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911300621.0A CN111162936B (en) 2019-12-17 2019-12-17 Data acquisition method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911300621.0A CN111162936B (en) 2019-12-17 2019-12-17 Data acquisition method and device

Publications (2)

Publication Number Publication Date
CN111162936A CN111162936A (en) 2020-05-15
CN111162936B true CN111162936B (en) 2022-10-21

Family

ID=70557286

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911300621.0A Active CN111162936B (en) 2019-12-17 2019-12-17 Data acquisition method and device

Country Status (1)

Country Link
CN (1) CN111162936B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111918230B (en) * 2020-05-29 2022-09-09 北京寄云鼎城科技有限公司 Data acquisition method, data transmission method, gateway, equipment and storage medium
CN117176613B (en) * 2023-11-01 2024-01-26 建信金融科技有限责任公司 Data acquisition method and device

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016054992A1 (en) * 2014-10-10 2016-04-14 中兴通讯股份有限公司 Network data collection system and method

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102263704B (en) * 2011-09-01 2014-03-26 杭州华三通信技术有限公司 Topology construction method and device supporting layer 2 interconnection of data centers
CN104767812A (en) * 2014-10-10 2015-07-08 北京金创智博科技有限公司 Data transmitting method, device and system based on cloud service
CN105610648B (en) * 2016-01-11 2019-08-09 飞天诚信科技股份有限公司 A method and server for collecting operation and maintenance monitoring data
CN108206764B (en) * 2018-03-29 2022-02-22 新华三技术有限公司 Configuration method of network equipment configuration information, server and computer readable medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016054992A1 (en) * 2014-10-10 2016-04-14 中兴通讯股份有限公司 Network data collection system and method

Also Published As

Publication number Publication date
CN111162936A (en) 2020-05-15

Similar Documents

Publication Publication Date Title
CN111162936B (en) Data acquisition method and device
CN1996885A (en) Method, management server and device for remote control of the device upgrade time
CN111338814A (en) Message processing method and device, storage medium and electronic device
CN112702214A (en) Configuring a network
US20120089239A1 (en) Intelligent interface for a distributed control system
CN112765030A (en) Test method, test device, electronic equipment and computer storage medium
CN111209467A (en) Data real-time query system under multi-concurrency multi-channel environment
CN105162646A (en) Multi-protocol interface test system and method
CN111212135A (en) Message subscription method, device, system, electronic equipment and storage medium
CN108989390A (en) User requests retransmission method and device, Reverse Proxy and computer readable storage medium
CN114328122A (en) IO full life cycle time delay monitoring method and related device
CN104954482A (en) Configuration management system and method
CN107179977B (en) Database Full-automatic monitoring system based on mpm models
EP1808996A1 (en) A method for corresponding maintenance point identification with media access control address
CN116232843B (en) Multi-operation and maintenance management method and system for batch management of business machine clusters based on application group dimension
CN116708266A (en) Cloud service topological graph real-time updating method, device, equipment and medium
CN115422129B (en) A conversation processing method, device, electronic device and storage medium
CN112180757B (en) A smart home system and its strategy management method
CN110071778B (en) Time synchronization method, device, equipment and medium
WO2016091141A1 (en) Method and apparatus for information collection
CN114866412B (en) Data acquisition method, system, device and storage medium
CN104954505A (en) Monitoring method and monitoring system for whole data updating process of DNS (Domain Name Server)
Ciancetta et al. Plug-n-play smart sensor network with dynamic web service
CN112270469A (en) Remote equipment management method completed by synchronizing equipment attribute feature library
CN107124293B (en) Protocol management method and system of distributed network system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant