Method, device and electronic equipment for managing instrument data

Through the browser, the description files of smart instrument data are managed and merged instructions are generated, and the terminal maintenance problem is solved based on the CS architecture, cross-platform deployment and efficient data processing are realized, providing powerful data support for the predictive maintenance of smart instruments.

CN115499429BActive Publication Date: 2025-05-16SUPCON TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211202566.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-29
Publication Date
2025-05-16
Estimated Expiration
2042-09-29

AI Technical Summary

Technical Problem

When the device management software based on CS architecture maintains and parses the smart instrument description file through multiple terminals, it affects the access speed and is difficult to maintain, and it is difficult to provide a massive data foundation for the predictive maintenance of smart instruments.

Method used

The description file of smart instrument data is obtained and managed through the browser, and the instructions are generated in response to the merge parameter command, and the tasks are stored in the task queue through the database. The thread count threshold is determined based on the cache queue length of the task queue, so as to realize data communication with the instrument.

Benefits of technology

It realizes the merger and processing of instrument parameters, supports cross-platform deployment, improves access speed and maintenance convenience, and provides a massive data foundation for the predictive maintenance of intelligent instruments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115499429B_ABST
    Figure CN115499429B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device and electronic device for managing instrument data. The method includes: obtaining a description file storing instrument data transmitted through a browser, wherein the description file stores at least parameter data corresponding to multiple types of instruments; merging the parameter data in the description file in response to a merge parameter command sent by a target object through a browser to generate a first instruction; reading a target instruction from a database, generating a task according to the target instruction and storing it in a task queue, wherein the target instruction includes at least the first instruction; determining a thread quantity threshold at least according to the cache queue length of the task queue, and realizing data communication with the instrument through threads. The present application solves the technical problem that the maintenance and parsing of intelligent instrument description files through multiple terminals based on the CS architecture affects the access speed and is difficult to maintain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data management, and in particular to a method, device and electronic device for managing instrument data. Background Art

[0002] Online configuration and diagnosis of smart instruments is one of the core functions of equipment management software. This function enables the acquisition of instrument parameters and alarms, making it easier for users to diagnose and maintain the instruments. Currently, most equipment management software is based on the CS architecture, which temporarily loads the smart instrument description file on the client to obtain basic equipment parameters and alarm information, thereby achieving instrument configuration and diagnosis. To implement instrument configuration and diagnosis functions based on the CS architecture, multiple terminals need to be deployed, and the terminals need to maintain and parse the smart instrument description files, which affects the access speed and is difficult to maintain. It is difficult to provide effective support for distributed and cross-platform deployment, and it is difficult to provide a massive data foundation for predictive maintenance of smart instruments.

[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present application provide a method, device and electronic device for managing meter data, so as to at least solve the technical problem that maintenance and parsing of smart meter description files through multiple terminals based on CS architecture affect access speed and are difficult to maintain.

[0005] According to one aspect of an embodiment of the present application, a method for managing instrument data is provided, including: obtaining a description file storing instrument data transmitted via a browser, wherein the description file stores at least parameter data corresponding to multiple types of instruments; in response to a merge parameter command sent by a target object via the browser, merging the parameter data in the description file to generate a first instruction; reading a target instruction from a database, generating a task according to the target instruction and storing it in a task queue, wherein the target instruction includes at least the first instruction; determining a thread number threshold at least according to a cache queue length of the task queue, and realizing data communication with the instrument through threads.

[0006] Optionally, a first instruction set and a first parameter set corresponding to the first instruction set are stored in the database, and a second instruction set and a second parameter set corresponding to the second instruction set are also stored in the database, wherein the first instruction set includes multiple first instructions, the second instruction set includes multiple second instructions, and the second instructions are instructions corresponding to data on which the merge parameter command has not been executed.

[0007] Optionally, the thread number threshold is determined at least based on the cache queue length of the task queue, including: obtaining the number of cores of the central processing unit and the upper limit of the cache length of the task queue; determining the thread number threshold based on the number of cores of the central processing unit; determining multiple critical values ​​corresponding to the task queue based on the upper limit of the cache length of the task queue and the thread number threshold.

[0008] Optionally, after determining multiple critical values ​​corresponding to the task queue, the method also includes: sorting the multiple critical values ​​in a preset order; taking out the target critical value from the sorted multiple critical values ​​in turn, and comparing the target critical value with the number of task queues; when the number of task queues is greater than the target critical value, starting a new thread; when the number of task queues is less than the target critical value, deleting a thread.

[0009] Optionally, after determining the thread number threshold at least based on the cache queue length of the task queue, the method also includes: obtaining the data volume of the target data and the upper limit of the cache length of the task queue; determining the ratio of the data volume of the target data and the upper limit of the cache length of the task queue; and determining the number of service instances at least based on the ratio.

[0010] Optionally, after determining the number of service instances, the method also includes: starting a new service instance when the service instance satisfies at least one of the following conditions, the conditions including: the usage rate of the central processing unit of the service instance is greater than a first threshold and the duration exceeds the first duration, wherein the first threshold is determined by at least the number of cores of the central processing unit; or, the memory size of the service instance exceeds the memory limit and the number of threads of the service instance is greater than or equal to the thread number threshold; or, the number of concurrently communicating instruments corresponding to the service instance is greater than the number of concurrently communicating instruments corresponding to a single service instance; or, the cache length of the task queue is greater than the upper limit of the cache length of the task queue.

[0011] Optionally, after determining the number of service instances, the method also includes: closing the service instance when the service instance satisfies at least one of the following conditions, the conditions including: the cache length of the task queue is 0, and no target data is received within a second time period; or, there are at least two types of business in multiple service instances, but the utilization rate of the central processing unit is lower than a second threshold within a third time period, then the business of multiple service instances is merged and the idle service instance is closed.

[0012] According to another aspect of an embodiment of the present application, a method for managing instrument data is also provided, including: transmitting a description file storing instrument data through a browser, wherein the description file stores at least parameter data corresponding to multiple types of instruments; responding to a merge parameter command of a target object, sending the merge parameter command to a server; sending data request information to the server, and receiving a request result returned by the server.

[0013] According to another aspect of the embodiment of the present application, a device for managing instrument data is also provided, including: an acquisition module, used to acquire a description file storing instrument data transmitted through a browser, wherein the description file at least stores parameter data corresponding to multiple types of instruments; a merging module, used to merge the parameter data in the description file in response to a merge parameter command sent by the target object through the browser, and generate a first instruction; an encapsulation module, used to read the target instruction from a database, generate a task according to the target instruction and store it in a task queue, wherein the target instruction includes at least the first instruction; a determination module, used to determine a thread number threshold based on at least the cache queue length of the task queue, and realize data communication with the instrument through threads.

[0014] According to another aspect of the embodiments of the present application, an electronic device is also provided, including: a memory for storing program instructions; a processor, connected to the memory, for executing program instructions to implement the following functions: obtaining a description file storing instrument data transmitted via a browser, wherein the description file at least stores parameter data corresponding to multiple types of instruments; in response to a merge parameter command sent by a target object via a browser, merging the parameter data in the description file to generate a first instruction; reading a target instruction from a database, generating a task based on the target instruction and storing it in a task queue, wherein the target instruction includes at least the first instruction; determining a thread number threshold based at least on a cache queue length of the task queue, and realizing data communication with the instrument through threads.

[0015] According to another aspect of the embodiments of the present application, a non-volatile storage medium is provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned method for managing instrument data by running the computer program.

[0016] In an embodiment of the present application, a browser is used instead of a terminal to manage the description file of the smart meter, by obtaining a description file storing meter data transmitted by the browser, wherein the description file stores at least parameter data corresponding to multiple types of meters; in response to a merge parameter command sent by the target object through the browser, the parameter data in the description file is merged to generate a first instruction; the target instruction is read from a database, and a task is generated according to the target instruction and stored in a task queue, wherein the target instruction includes at least the first instruction; a thread number threshold is determined at least according to a cache queue length of the task queue, and data communication with the meter is realized through threads, thereby achieving the purpose of at least completing the parameter merging of the meter through the browser, thereby achieving the technical effect of cross-platform deployment of the parameter merging and parameter processing of the meter, and further solving the technical problem of maintaining and parsing the description file of the smart meter through multiple terminals based on the CS architecture, affecting the access speed, and being difficult to maintain. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0018] Figure 1 is a hardware structure block diagram of a computer terminal (or electronic device) for implementing a method for managing meter data according to an embodiment of the present application;

[0019] Figure 2 is a flow chart of a method for managing instrument data according to an embodiment of the present application;

[0020] Figure 3 is a flow chart of determining multiple critical values ​​corresponding to a task queue according to an embodiment of the present application;

[0021] Figure 4 is a flowchart of a processing thread according to an embodiment of the present application;

[0022] Figure 5 is a flowchart of another method for managing instrument data according to an embodiment of the present application;

[0023] Figure 6 is a flow chart of the interaction between the browser and the server according to an embodiment of the present application;

[0024] Figure 7 It is a design principle diagram of a background service according to an embodiment of the present application;

[0025] Figure 8 is a flow chart for obtaining instrument data according to an embodiment of the present application;

[0026] Fig. 9 It is a structural diagram of a device for managing meter data according to an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0029] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:

[0030] DD file: smart instrument description file.

[0031] CS architecture: client-server architecture.

[0032] The method embodiment for managing meter data provided in the embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 The hardware structure block diagram of a computer terminal (or electronic device) for implementing a method for managing meter data is shown. Figure 1 As shown, the computer terminal 10 (or electronic device 10) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors (the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0033] It should be noted that the one or more processors and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or electronic device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0034] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the method for managing instrument data in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, realizing the above-mentioned method for managing instrument data. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0035] The transmission module 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0036] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or electronic device).

[0037] It should be noted that, in some optional embodiments, the above Figure 1 The computer device (or electronic device) shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. It should be noted that Figure 1This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the above-described computer device (or electronic device).

[0038] In the above operating environment, an embodiment of the present application provides an embodiment of a method for managing instrument data. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0039] Figure 2 is a flow chart of a method for managing instrument data according to an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:

[0040] Step S202, obtaining a description file storing instrument data transmitted through a browser, wherein the description file stores at least parameter data corresponding to multiple types of instruments.

[0041] Step S204: In response to the merge parameter command sent by the target object through the browser, the parameter data in the description file is merged to generate a first instruction.

[0042] In the above steps S202 to S204, the server obtains the smart meter description file (i.e., DD file) transmitted by the user through the browser, and takes out the parameter data in the DD file, such as alarm data, diagnostic data, etc. The DD file also includes a METHOD parameter, which is used to define the behavior operation. For example, when receiving a data storage instruction, in order to respond to the storage instruction, the behavior operation performed by the server is defined by METHOD.

[0043] In the DD file, some parameters can be merged after being identified and parsed by the server, while some parameters cannot be merged. In order to reduce the parameter query time, reduce the communication volume, and obtain the most parameter data, the merge parameter command can be executed according to various types of instruments. Specifically, the user obtains the parameter data in the DD file through the browser, and sends a merge parameter command to the parameters in the DD file that can be merged. These merged parameters can be searched and obtained by the first instruction, and the first instruction and the corresponding parameter data are passed to the database. At the same time, the parameter data that cannot be merged is also stored in the database after being parsed by the server. In the embodiment of the present application, the database storing the first instruction and the corresponding parameters can be a Postgre database.

[0044] In another optional embodiment, after obtaining the DD file transmitted through the browser, the server automatically executes the parameter merging command by parsing the DD file, and stores the merged parameter data and the first instruction in the database. At the same time, the parameter data that cannot be merged and its corresponding instructions are also stored in the database. When the user requests the parameter through the browser, the server can query the corresponding instruction from the database according to the request parameter. If the request parameter is a parameter after the parameter merger is executed, the corresponding parameter data is returned according to the corresponding first instruction. If the request parameter is a parameter that has not been merged, the instruction corresponding to the parameter is queried from the database and the corresponding parameter data is returned. It should be noted that each type of parameter in the parameter data that cannot be merged corresponds to a command, and the parameter data that can be merged can obtain multiple types of parameters at the same time through one command. For example, the EJA instrument of the YOKOGAWA manufacturer can merge the three parameters of TEMPERATURE, PV, and LOOPCURRENT into one HART command for reading.

[0045] Step S206, reading the target instruction from the database, generating a task according to the target instruction and storing it in the task queue, wherein the target instruction at least includes the first instruction.

[0046] In the above step S206, when the user requests parameter data from the server through the browser, the server obtains the corresponding target data according to the target instruction corresponding to the parameter data in the database, encapsulates the target data and generates a task and stores it in the task queue. When the parameter data requested by the user is a parameter after executing parameter merging, the target instruction is the first instruction. When the parameter data requested by the user is a parameter after not executing parameter merging, the target instruction is the second instruction, and the second instruction is the instruction corresponding to the parameter without executing parameter merging.

[0047] Step S208, determining a thread quantity threshold at least according to the cache queue length of the task queue, and implementing data communication with the instrument through threads.

[0048] In the above step S208, when the server processes the data in the task queue, it needs to start the thread pool, determine the thread number threshold according to the cache queue length of the task queue, dynamically maintain the thread number according to the business volume, and each thread continuously communicates with the instrument to obtain parameter data, stores it in the time series database, and returns it to other business services through the interface.

[0049] In the above-mentioned method for managing instrument data, a first instruction set and a first parameter set corresponding to the first instruction set are stored in a database, and a second instruction set and a second parameter set corresponding to the second instruction set are also stored in the database, wherein the first instruction set includes multiple first instructions, the second instruction set includes multiple second instructions, and the second instructions are instructions corresponding to data for which a merge parameter command has not been executed.

[0050] In step S208 of the above-mentioned method for managing instrumentation data, the thread quantity threshold is determined at least according to the cache queue length of the task queue, such as Figure 3 The flowchart shown specifically includes the following steps:

[0051] Step S302, obtaining the number of cores of the central processing unit and the upper limit of the cache length of the task queue;

[0052] Step S304, determining a thread quantity threshold according to the number of cores of the central processing unit;

[0053] Step S306, determining multiple critical values ​​corresponding to the task queue according to the upper limit of the cache length of the task queue and the threshold of the number of threads.

[0054] In an embodiment of the present application, by managing threads and working threads, based on the intra-process multi-threaded interaction method, the management thread monitors the existing running status of the work, the cache length upper limit of the task queue can be set to 100, and the calculation formula of the thread number threshold is: thread number threshold = CPU core number × 3 / 2 + 1, when the number of cores of the central processing unit, that is, the number of CPU cores is 4 cores, the thread number threshold = 4 × 3 / 2 + 1 = 7, then the critical value of the task queue can be determined by the task queue cache length upper limit and the thread number threshold, that is, 100 / 7≈14, rounded down, that is, the multiple critical values ​​corresponding to the task queue are: 14, 28, 42, 56, 70, 84, 100 respectively.

[0055] In the above step S306, after determining the multiple critical values ​​corresponding to the task queue, Figure 4 As shown, the method also includes the following steps:

[0056] Step S402, sorting the multiple critical values ​​according to a preset order;

[0057] Step S404, sequentially taking out the target critical value from the sorted multiple critical values, and comparing the target critical value with the number of task queues;

[0058] Step S406, when the number of task queues is greater than the target critical value, start a new thread;

[0059] Step S408: when the number of task queues is less than the target critical value, delete a thread.

[0060] In the above steps S402 to S408, a new thread is started each time the number of task queues exceeds a critical value. If the number of task queues is lower than a certain critical value and the duration of this state exceeds a preset time, a thread is deleted. In the embodiment of the present application, the preset time can be 3 minutes, but is not limited to this. The specific value can be selected according to the actual situation and is not limited here.

[0061] In step S208 of the above-mentioned method for managing instrument data, after determining the thread quantity threshold at least based on the cache queue length of the task queue, the method also includes the following steps: obtaining the data volume of the target data and the upper limit of the cache length of the task queue; determining the ratio of the data volume of the target data to the upper limit of the cache length of the task queue; and determining the number of service instances at least based on the ratio.

[0062] In the embodiment of the present application, the background service cluster automatically maintains the number of service instances according to the size of the target data. The service instance periodically sends data based on the source to the service monitoring manager, which determines the status of the service instance and Figure 3 and Figure 4 The corresponding flowchart triggers the start and stop of the service instance. When a new instance is started, the new instance receives new business requests and continuously transfers tasks in the original instance to the new instance (transfer rate 50%) until the number of task queues in all instances is less than the upper limit of the cache length of the task queue. The data based on the source includes: the upper limit of the cache length of the task queue, the number of concurrent smart meters interacting in real time, the CPU upper limit, the memory limit, and the thread number threshold.

[0063] In the above process, after determining the number of service instances, the method specifically further includes: when the service instance satisfies at least one of the following conditions, starting a new service instance, the conditions including: the usage rate of the central processing unit of the service instance is greater than a first threshold value, and the duration exceeds the first duration, wherein the first threshold value is determined by at least the number of cores of the central processing unit, for example, the CPU of the service instance exceeds the CPU upper limit, and the duration is greater than 3 minutes. In the embodiment of the present application, the CPU upper limit can be calculated by the following formula: CPU upper limit = (100 / number of CPU cores) × 0.6; or, the memory size of the service instance exceeds the memory limit, and the number of threads of the service instance is greater than or equal to the thread number threshold. For example, it can be set The memory limit is set to 500M. When the memory size of the service instance exceeds 500M and the number of threads of the service instance is greater than or equal to the thread number threshold, a new service instance is started; or, the number of concurrently communicating instruments corresponding to the service instance is greater than the number of concurrently communicating instruments corresponding to a single service instance. For example, the number of concurrently communicating instruments corresponding to a single service instance can be set to 10. When the number of concurrently communicating instruments corresponding to the service instance is greater than 10, a new service instance is started; or, the cache length of the task queue is greater than the upper limit of the cache length of the task queue. For example, when the upper limit of the cache length of the task queue is set to 100, when the cache length of the task queue is greater than 100, a new service instance is started.

[0064] In the above process, after determining the number of service instances, the method specifically also includes: when the service instance meets at least one of the following conditions, closing the service instance, the conditions include: the cache length of the task queue is 0, and no target data is received within the second time period, for example, the second time period can be set to 3 minutes; or, there are at least two types of business in multiple service instances, but the utilization rate of the central processing unit is lower than the second threshold within the third time period, then the business of multiple service instances is merged, and the idle service instances are closed. For example, there are multiple service instances with two types of tasks, timing and subscription, but the CPU utilization rate is lower than 1% for a long time (for example, more than 10 minutes), then the business of multiple service instances is merged, and the idle instances are closed.

[0065] Through the above steps, the parameter data that can be merged can be merged through the merge parameter instruction, so as to achieve the purpose of reducing the communication volume and obtaining the most parameter data. At the same time, the thread number threshold can be determined according to the cache queue length of the task queue, and the number of service instances can be automatically maintained according to the amount of data, and the start of a new service instance or the shutdown of a service instance can be determined according to different conditions.

[0066] The method for managing instrument data provided in the embodiment of the present application has the following advantages: 1) supports distributed storage and zero maintenance on the client; 2) can realize cross-platform deployment of device configuration and diagnosis, for example, can realize deployment in windows system and linux system, the method can be implemented based on service development languages ​​such as C++, JAVA, etc. In the service cluster, the registration center is implemented based on nacos, and each service is registered when it is started. When accessing between services, the destination service routing information (IP+port) is first obtained from nacos, and then an http request is initiated for data interaction; in the message queue Rabbitmq, the time series data between services are sent and stored according to the predefined switches and queues; in the implementation method, the background services developed in C++ and JAVA can run across platforms, relying on server clusters and Rabbitmq to realize data interaction; 3) unified management and maintenance of instrument DD files, by pre-parsing the DD files in the parameter service, single parsing and composite use of DD files are realized; 4) massive data is provided for predictive maintenance of smart instruments, and high-performance and stable reading of instrument data can be realized; 5) a light client is realized, and parameter configuration and diagnostic adjustment of instruments are completed through a browser.

[0067] Figure 5 is a flowchart of another method for managing instrument data according to an embodiment of the present application. Figure 5 As shown, the method comprises the following steps:

[0068] Step S502, transmitting a description file storing instrument data through a browser, wherein the description file stores at least parameter data corresponding to multiple types of instruments;

[0069] Step S504, in response to the merge parameter command of the target object, sending the merge parameter command to the server;

[0070] Step S506, sending data request information to the server, and receiving the request result returned by the server.

[0071] The above steps S502 to S506 implement the management of instrument data through the browser. Specifically, the browser transmits the DD file to the server and sends the merge parameter command of the target object to the server. The browser executes the user's data request instruction and sends data request information to the server. The server retrieves the corresponding parameter data from the database according to the instruction corresponding to the parameter and returns it to the browser.

[0072] Figure 6 is a flowchart of the interaction between the browser and the server according to an embodiment of the present application, such as Figure 6As shown, in step S601, the user transmits a DD file to the server by means of a browser. The DD file includes parameter data corresponding to various types of instruments, such as alarm data, diagnostic data, etc. The DD file also includes a METHOD parameter, which is used to define the behavior operation; in step S602, the server parses the DD file and stores it in the database, and records the parsed parameter index; in step S603, the user logs in to the data management system at the front end (in the form of a browser or client), opens the online parameter page of the instrument, and sends the parameters that can be merged to the server through a merge parameter command; in step S604, the server responds to the merge parameter command, merges the parameter data, and generates a first instruction; in step S605, the user sends an http request to the server through a browser, and establishes a websocket connection between the browser and the server; in step S606, the server retrieves the instruction corresponding to the parameter data from the database and sends it to the driver service; in step S607, after the driver service communicates with the instrument, it returns the data packet to the server, and the server parses the data according to the parameter index, parses out each parameter value, and returns it to the browser for display through websocket in step S608.

[0073] Figure 7 is a design principle diagram of a background service according to an embodiment of the present application. Figure 7 In the process, the interface layer is used to realize communication with each service instance in the service instance cluster. The server obtains the instructions corresponding to the parameters from the Postgre database, such as the first instruction, the second instruction, etc., and encapsulates the instructions and stores them in the task queue. The tasks in the task queue communicate with the smart meter through threads. Each thread continuously communicates with the meter to obtain the parameter data corresponding to the instruction, stores it in the InfluxDB time series database, and returns it to other business services through the interface.

[0074] Figure 8 is a flow chart of obtaining instrument data according to an embodiment of the present application, such as Figure 8As shown, the background service reads the instrument data in real time and provides three kinds of functional data to the outside: real-time data, time series data and subscription data. The acquisition process of these three kinds of data is as follows: Step S801, the business layer sends real-time data request information to the service instance cluster in the server; Step S802, the server takes the instruction corresponding to the parameter from the database, such as the first instruction, the second instruction, etc., and returns the instruction to the server; Step S803, the server encapsulates the received instruction and stores it in the task queue; Step S804, the service instance in the server communicates with the instrument through a thread, and requests to obtain the parameter data corresponding to the instruction; Step S805, the instrument returns the parameter data corresponding to the instruction to the server; Step S806, the server parses the received parameter data and returns it to the business layer. Step S807, the business layer sends a time series data request message to the service instance cluster in the server; Step S808, the server takes the instruction corresponding to the parameter from the database, such as the first instruction, the second instruction, etc., and returns the instruction to the server; Step S809, the server encapsulates the received instruction and stores it in the periodic task queue; Step S810, the service instance in the server communicates with the instrument through a thread, and requests to obtain the parameter data corresponding to the instruction; Step S811, the instrument returns the parameter data corresponding to the instruction to the server; Step S812, the server parses the received parameter data and stores it in the time series database; Step S813, the business layer periodically sends a request message to the database, requesting to obtain the parameter data of the instrument; Step S814, the database returns the corresponding parameter data to the business layer; Step S815, the business layer processes according to the parameter data returned by the database, for example, In step S816, the business layer sends a subscription data request message to the service instance cluster in the server; in step S817, the server takes the instruction corresponding to the parameter from the database, such as the first instruction, the second instruction, etc., and returns the instruction to the server; in step S818, the server encapsulates the received instruction and stores it in the periodic task queue; in step S819, the service instance in the server communicates with the instrument through a thread to request to obtain the parameter data corresponding to the instruction; in step S820, the instrument returns the parameter data corresponding to the instruction to the server; in step S821, the server parses the received parameter data; in step S822, the server sends the parsed parameter data to the message queue according to the switch; in step S823, the message queue forwards the parameter data to the business layer according to the subscribed queue; in step S824, the business layer processes the received parameter data or displays the data.

[0075] Fig. 9 is a structural diagram of a device for managing meter data according to an embodiment of the present application, such as Fig. 9 As shown, the device comprises:

[0076] An acquisition module 902 is used to acquire a description file storing instrument data transmitted through a browser, wherein the description file stores at least parameter data corresponding to multiple types of instruments;

[0077] A merging module 904, configured to merge the parameter data in the description file in response to a merge parameter command sent by the target object through the browser, and generate a first instruction;

[0078] The encapsulation module 906 is used to read the target instruction from the database, generate a task according to the target instruction and store it in the task queue, wherein the target instruction includes at least the first instruction;

[0079] The determination module 908 is used to determine the thread quantity threshold at least according to the cache queue length of the task queue, and realize data communication with the instrument through the thread.

[0080] In the above-mentioned device for managing instrument data, a first instruction set and a first parameter set corresponding to the first instruction set are stored in a database, and a second instruction set and a second parameter set corresponding to the second instruction set are also stored in the database, wherein the first instruction set includes multiple first instructions, the second instruction set includes multiple second instructions, and the second instructions are instructions corresponding to data for which a merge parameter command has not been executed.

[0081] In the determination module 908 in the above-mentioned device for managing instrument data, the thread number threshold is determined at least based on the cache queue length of the task queue, which specifically includes the following processes: obtaining the number of cores of the central processing unit and the upper limit of the cache length of the task queue; determining the thread number threshold based on the number of cores of the central processing unit; determining multiple critical values ​​corresponding to the task queue based on the upper limit of the cache length of the task queue and the thread number threshold.

[0082] In the above process, after determining the multiple critical values ​​corresponding to the task queue, the device for managing instrument data also includes the following process: sorting the multiple critical values ​​according to a preset order; taking out the target critical value from the sorted multiple critical values ​​in turn, and comparing the target critical value with the number of task queues; when the number of task queues is greater than the target critical value, starting a new thread; when the number of task queues is less than the target critical value, deleting a thread.

[0083] In the determination module 908 in the above-mentioned device for managing instrument data, after determining the thread number threshold at least based on the cache queue length of the task queue, the device for managing instrument data also includes: obtaining the data volume of the target data and the upper limit of the cache length of the task queue; determining the ratio of the data volume of the target data to the upper limit of the cache length of the task queue; and determining the number of service instances at least based on the ratio.

[0084] In the above-mentioned device for managing instrument data, a new service instance is started when the service instance meets at least one of the following conditions, the conditions including: the usage rate of the central processing unit of the service instance is greater than a first threshold and the duration exceeds the first duration, wherein the first threshold is determined by at least the number of cores of the central processing unit; or, the memory size of the service instance exceeds the memory limit and the number of threads of the service instance is greater than or equal to the thread number threshold; or, the number of concurrently communicating instruments corresponding to the service instance is greater than the number of concurrently communicating instruments corresponding to a single service instance; or, the cache length of the task queue is greater than the upper limit of the cache length of the task queue.

[0085] In the above-mentioned device for managing instrument data, when a service instance meets at least one of the following conditions, the service instance is closed, and the conditions include: the cache length of the task queue is 0, and no target data is received within the second time length; or, there are at least two types of services in multiple service instances, but the usage rate of the central processor is lower than the second threshold within the third time length, then the services of multiple service instances are merged and the idle service instance is closed.

[0086] It should be noted that Fig. 9 The device for managing instrument data shown is used to perform Figure 2 The method for managing instrument data shown in the figure, therefore the relevant explanations in the above method for managing instrument data are also applicable to the device for managing instrument data, and will not be repeated here.

[0087] An embodiment of the present application also provides a non-volatile storage medium, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the following method for managing instrument data by running the computer program: obtaining a description file for storing instrument data transmitted by a browser, wherein the description file at least stores parameter data corresponding to multiple types of instruments; in response to a merge parameter command sent by a target object through a browser, merging the parameter data in the description file to generate a first instruction; reading a target instruction from a database, generating a task according to the target instruction and storing it in a task queue, wherein the target instruction includes at least the first instruction; determining a thread number threshold based on at least a cache queue length of the task queue, and realizing data communication with the instrument through threads.

[0088] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0089] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0090] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0091] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0092] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0093] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0094] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for managing instrument data, characterized in that: include: Acquire a description file storing instrument data transmitted through a browser, wherein the description file stores at least parameter data corresponding to multiple types of instruments; In response to a merge parameter command sent by the target object through the browser, the parameter data in the description file are merged to generate a first instruction; When the target object requests parameter data from the server through the browser, the server obtains the corresponding target data according to the target instruction corresponding to the parameter data in the database, encapsulates the target data, generates a task and stores it in the task queue, wherein the target instruction at least includes the first instruction; The thread quantity threshold is determined at least according to the cache queue length of the task queue, and data communication with the instrument is achieved through the thread.

2. The method according to claim 1, characterized in that The database stores a first instruction set and a first parameter set corresponding to the first instruction set, and the database also stores a second instruction set and a second parameter set corresponding to the second instruction set, wherein the first instruction set includes multiple first instructions, the second instruction set includes multiple second instructions, and the second instructions are instructions corresponding to data on which a merge parameter command has not been executed.

3. The method according to claim 1, characterized in that Determining the thread quantity threshold at least according to the cache queue length of the task queue includes: Obtaining the number of cores of the central processing unit and the upper limit of the cache length of the task queue; Determining the thread quantity threshold according to the number of cores of the central processing unit; According to the upper limit of the cache length of the task queue and the thread quantity threshold, a plurality of critical values ​​corresponding to the task queue are determined.

4. The method according to claim 3, characterized in that: After determining the multiple critical values ​​corresponding to the task queue, the method further includes: Sorting the multiple critical values ​​according to a preset order; Sequentially taking out a target critical value from the sorted multiple critical values, and comparing the target critical value with the number of the task queue; When the number of the task queue is greater than the target critical value, starting a new thread; When the number of the task queue is less than the target critical value, a thread is deleted.

5. The method according to claim 3, characterized in that: After determining the thread quantity threshold at least according to the cache queue length of the task queue, the method further includes: Obtaining the data volume of the target data and the upper limit of the cache length of the task queue; Determine a ratio between the amount of the target data and an upper limit of a cache length of the task queue; The number of service instances is determined based on at least the ratio.

6. The method according to claim 5, characterized in that After determining the number of service instances, the method further includes: When the service instance satisfies at least one of the following conditions, a new service instance is started, wherein the conditions include: The usage rate of the central processing unit of the service instance is greater than a first threshold and lasts for a period longer than the first period, wherein the first threshold is determined at least by the number of cores of the central processing unit; or The memory size of the service instance exceeds the memory limit, and the number of threads of the service instance is greater than or equal to the thread number threshold; or, The number of concurrently communicating instruments corresponding to the service instance is greater than the number of concurrently communicating instruments corresponding to a single service instance; or, The cache length of the task queue is greater than the upper limit of the cache length of the task queue.

7. The method according to claim 6, characterized in that After determining the number of service instances, the method further includes: When the service instance satisfies at least one of the following conditions, the service instance is closed, wherein the conditions include: The cache length of the task queue is 0, and the target data is not received within the second time period; or, If there are at least two types of services in the multiple service instances, but the usage rate of the central processor is lower than the second threshold within a third time period, the services of the multiple service instances are merged and the idle service instances are closed.

8. A method for managing instrument data, characterized in that: include: Transmitting a description file storing instrument data through a browser, wherein the description file stores at least parameter data corresponding to multiple types of instruments; In response to a merge parameter command of the target object, the merge parameter command is sent to a server, wherein the server merges the parameter data in the description file in response to the merge parameter command sent by the target object through the browser to generate a first instruction; Send data request information to the server and receive the request result returned by the server, wherein when the target object requests parameter data from the server through the browser, the server obtains the corresponding target data according to the target instruction corresponding to the parameter data in the database, encapsulates the target data and generates a task and stores it in the task queue, and the target instruction at least includes the first instruction.

9. A device for managing instrument data, characterized in that: include: An acquisition module, used for acquiring a description file storing instrument data transmitted through a browser, wherein the description file stores at least parameter data corresponding to multiple types of instruments; A merging module, configured to merge the parameter data in the description file in response to a merge parameter command sent by the target object through the browser to generate a first instruction; an encapsulation module, configured to, when the target object requests parameter data from the server through the browser, cause the server to obtain corresponding target data according to the target instruction corresponding to the parameter data in the database, encapsulate the target data, generate a task and store it in a task queue, wherein the target instruction at least includes the first instruction; The determination module is used to determine the thread quantity threshold at least according to the cache queue length of the task queue, and realize data communication with the instrument through the thread.

10. An electronic device, characterized in that: include: A memory for storing program instructions; A processor is connected to the memory and is used to execute program instructions that implement the following functions: obtaining a description file storing instrument data transmitted through a browser, wherein the description file at least stores parameter data corresponding to multiple types of instruments; in response to a merge parameter command sent by a target object through the browser, merging the parameter data in the description file to generate a first instruction; when the target object requests parameter data from a server through the browser, the server obtains corresponding target data according to a target instruction corresponding to the parameter data in a database, encapsulates the target data, generates a task and stores it in a task queue, wherein the target instruction at least includes the first instruction; and determines a thread quantity threshold based on at least a cache queue length of the task queue, and realizes data communication with the instrument through threads.

11. A non-volatile storage medium, characterized in that: The non-volatile storage medium includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the method for managing instrument data according to any one of claims 1 to 7 by running the computer program.

Citation Information

Patent Citations

  • Physiological multi-parameter remote monitoring system and method based on B / S structure

    CN101292867A

  • Distributed remote test system, method and server

    CN101741648A