CN111162936A - Data acquisition method and device - Google Patents

Data acquisition method and device Download PDF

Info

Publication number
CN111162936A
CN111162936A CN201911300621.0A CN201911300621A CN111162936A CN 111162936 A CN111162936 A CN 111162936A CN 201911300621 A CN201911300621 A CN 201911300621A CN 111162936 A CN111162936 A CN 111162936A
Authority
CN
China
Prior art keywords
acquisition time
acquisition
time
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.)
Granted
Application number
CN201911300621.0A
Other languages
Chinese (zh)
Other versions
CN111162936B (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, the bridge can be used for triggering the acquisition moments of a plurality of target devices, the unified management of the plurality of devices is realized, and therefore 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 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;
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;
determining a next acquisition time to the current acquisition time according to the 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 a plurality of 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; acquiring data corresponding to the current acquisition time by using an 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 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 the 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 the next collection time of the current collection time is collected.
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, 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 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 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 device 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, and 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. 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.
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 a sampling time in sequence, which may be 2:00, 2:20, 2:40, and the like), and if there are too many target devices and corresponding parameters, the server cannot create so many timers, so in this embodiment, the bridge communication network may use one timer to determine whether the preset acquisition time of each attribute in the target device expires one by one to ensure that each attribute may have a corresponding acquisition time, to collect the corresponding data. 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 register.
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 the 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, determining the current acquisition time according to the result information, 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, indicating that data needs to be acquired at the moment, further acquiring an acquisition state, if the acquisition state is not acquired, triggering an acquisition event corresponding to the current acquisition time, and acquiring the data corresponding to the current acquisition time 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:00 am, and the sampling interval time is 15 s. But the acquisition state is determined to be that the acquisition is not started at 9:00, the acquisition event at the current acquisition time is triggered at 9:01, the corresponding timestamp of the acquisition event is 9:01, and then 15s data are acquired.
Here, since there may be a delay of the current acquisition time (for example, a delay from 9:00 to 9:01), if an acquisition event corresponding to the current acquisition time is triggered, in order to improve the accuracy of acquisition, it is further necessary to re-determine the next acquisition time of the current acquisition time, and then update the next acquisition time in the buffer.
If the current acquisition time is not acquired at 9:00 and there is a delay, for example, the acquisition is started after 9:01 minutes, the next acquisition time determined after 15 seconds of acquisition is different from the next acquisition time determined in step S112, and therefore the next acquisition time needs to be updated in the buffer.
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. 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, cancellation processing event, sending and publishing 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 the content of the first and second substances,
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 a sampling time in sequence, which may be 2:00, 2:20, 2:40, and the like), and if there are too many target devices and corresponding parameters, the server cannot create so many timers, so in this embodiment, the bridge communication network may use one timer to determine whether the preset acquisition time of each attribute in the target device expires one by one to ensure that each attribute may have a corresponding acquisition time, to collect the corresponding data. 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 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.
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 formula (1), T1 is the 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.
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:00 am, and the sampling interval time is 15 s. But the acquisition state is determined to be that the acquisition is not started at 9:00, the acquisition event at the current acquisition time is triggered at 9:01, the corresponding timestamp of the acquisition event is 9:01, and then 15s data are acquired.
Here, since there may be a delay of the current acquisition time (for example, a delay from 9:00 to 9:01), if an acquisition event corresponding to the current acquisition time is triggered, in order to improve the accuracy of acquisition, it is further necessary to re-determine the next acquisition time of the current acquisition time, and then update the next acquisition time in the buffer.
If the current acquisition time is not acquired at 9:00 and there is a delay, for example, the acquisition is started after 9:01 minutes, then after 15 seconds of acquisition, the determined next acquisition time is different from the preset next acquisition time, and therefore the registration unit 25 needs to update the next acquisition time in the cache.
Further, after the data corresponding to the current collection time is collected, the data is sent to the 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 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. 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, 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 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 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; 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.
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 (10)

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;
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 the formula T-T1 + T.
3. The method of claim 1, wherein the acquiring data corresponding to the current acquisition time using the acquisition event corresponding to the current acquisition time comprises:
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.
4. The method of claim 1, wherein the target device comprises a plurality of parameters, each preset with a corresponding acquisition time instant.
5. The method of claim 1, wherein the collecting the 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.
6. 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;
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.
7. The apparatus of claim 6, wherein the determination 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 the formula T-T1 + T.
8. The apparatus according to claim 6, wherein 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 the next collection time of the current collection time is collected.
9. The apparatus of claim 6, wherein the target device comprises a plurality of parameters, each preset with a corresponding acquisition time instant.
10. The apparatus of claim 6, 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, 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 true CN111162936A (en) 2020-05-15
CN111162936B 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)

Cited By (2)

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

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102263704A (en) * 2011-09-01 2011-11-30 杭州华三通信技术有限公司 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
WO2016054992A1 (en) * 2014-10-10 2016-04-14 中兴通讯股份有限公司 Network data collection system and method
CN105610648A (en) * 2016-01-11 2016-05-25 飞天诚信科技股份有限公司 Operation and maintenance monitoring data collection method and server
CN108206764A (en) * 2018-03-29 2018-06-26 新华三技术有限公司 Configuration method, server and the computer-readable medium of configuring information of network appliance

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102263704A (en) * 2011-09-01 2011-11-30 杭州华三通信技术有限公司 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
WO2016054992A1 (en) * 2014-10-10 2016-04-14 中兴通讯股份有限公司 Network data collection system and method
CN105610648A (en) * 2016-01-11 2016-05-25 飞天诚信科技股份有限公司 Operation and maintenance monitoring data collection method and server
CN108206764A (en) * 2018-03-29 2018-06-26 新华三技术有限公司 Configuration method, server and the computer-readable medium of configuring information of network appliance

Cited By (4)

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

Also Published As

Publication number Publication date
CN111162936B (en) 2022-10-21

Similar Documents

Publication Publication Date Title
CN106953905B (en) Inter-domain directory sharing method and device
CN111162936B (en) Data acquisition method and device
CN105162646B (en) A kind of multi-protocol interface test system and method
CN101631053B (en) EAPS ring-network topology monitoring method and system
CN102254031A (en) Batch processing request-based Microsoft SQL server database cluster
CN110413295A (en) A kind of embedded device remote firmware updating method
CN111092865B (en) Security event analysis method and system
CN112765030A (en) Test method, test device, electronic equipment and computer storage medium
CN107179977B (en) Database Full-automatic monitoring system based on mpm models
CN108989390A (en) User requests retransmission method and device, Reverse Proxy and computer readable storage medium
WO2023123956A1 (en) Io full-lifecycle latency monitoring method and related apparatus
CN104954482A (en) Configuration management system and method
CN110581893A (en) data transmission method and device, routing equipment, server and storage medium
US20200409342A1 (en) Point value change notification
CN108111578B (en) Method for accessing power distribution terminal data acquisition platform into terminal equipment based on NIO
CN110071778B (en) Time synchronization method, device, equipment and medium
WO2016091141A1 (en) Method and apparatus for information collection
CN106773790B (en) multi-iteration power and communication joint simulation method based on global event axis synchronization
CN114780565A (en) Cache updating method and device, storage medium and electronic device
CN115454851A (en) Interface regression testing method and device, storage medium and electronic device
CN111614797B (en) Method and system for detecting IP address missing coverage
CN111737348B (en) Aging synchronization method and device based on database table
CN105573841B (en) A method of the control timer based on non-relational database executes
US11860752B2 (en) Agentless system and method for discovering and inspecting applications and services in compute environments
CN113938374B (en) Processing method and device for monitoring instrument panel

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