WO2023200361A1 - Data storage method and data extraction method - Google Patents

Data storage method and data extraction method Download PDF

Info

Publication number
WO2023200361A1
WO2023200361A1 PCT/RU2023/000095 RU2023000095W WO2023200361A1 WO 2023200361 A1 WO2023200361 A1 WO 2023200361A1 RU 2023000095 W RU2023000095 W RU 2023000095W WO 2023200361 A1 WO2023200361 A1 WO 2023200361A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
record
block
records
parameter
Prior art date
Application number
PCT/RU2023/000095
Other languages
French (fr)
Russian (ru)
Inventor
Алексей Александрович БРЫЗГАЛОВ
Original Assignee
Общество С Ограниченной Ответственностью "Авадс Софт"
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from RU2022109631A external-priority patent/RU2793082C1/en
Application filed by Общество С Ограниченной Ответственностью "Авадс Софт" filed Critical Общество С Ограниченной Ответственностью "Авадс Софт"
Publication of WO2023200361A1 publication Critical patent/WO2023200361A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • 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/22Indexing; Data structures therefor; Storage structures

Definitions

  • the present invention generally relates to methods for storing data and, in particular, to collecting and retrieving data obtained from various data sources.
  • the manufacturing process is increasingly dependent on data collection and use systems to improve process efficiency and reduce maintenance costs.
  • An important aspect of collecting data from sensors is the speed of data recording, without loss, and data archiving in such a way as to obtain data from the archive also at high speed to develop an operational solution.
  • the closest analogue of the method for collecting and retrieving data is the method described in patent US6651030, cl. G06F15/177, published 18.1 1.2003.
  • the proprietary data collection method involves receiving data from data sources, storing the data as records in a data file with a timestamp when the data was created, and writing a header file that associates the time interval with those records in the data files whose timestamps fall within the time interval.
  • a method for retrieving data records involves selecting a time interval of interest, accessing a header file that associates the time interval of interest with the data records, whose timestamps fall within the interval of interest, retrieving data records based on the timestamps of the data records.
  • the disadvantage of these methods is that the collected data is written to a data file without separating the data by parameters, which increases the time of data recording and the time of data retrieval for a certain parameter.
  • the technical result that can be obtained by implementing the proposed solution is to increase the speed of data recording without loss and reduce the time for retrieving the necessary data.
  • the specified technical result is obtained by creating a method for storing data, including receiving data from a data source, storing the data in the form of data records in computer memory, each data record containing a time stamp associated with the moment of data creation, and a parameter value, formation in memory computer from data records of record blocks of the same size, while one record block can contain data records of only one parameter, assigning a header to the record block, including the parameter identifier and address, and saving the generated record block to the database on a machine-readable wearable gel, formation and saving in the database a list of record block addresses for each parameter.
  • the header of the record block includes the address of the subsequent block of records or the header of the record block includes the address of the previous block of records; in another special case of execution, the header of the record block includes the address of the previous and subsequent block of records.
  • the record block header may include a timestamp of the first data record in the record block and/or a timestamp of the last data record in the record block and other service information.
  • the data record contains additional information.
  • the list of record block addresses contains timestamps. In this case, for each address from the list, the timestamp of the first data record and/or the time stamp of the last data record of the block of records at this address is stored.
  • Computer memory can be used as a machine-readable medium.
  • the specified technical result is also obtained through a method of data extraction, including entering a search query for a given parameter and a given time interval, searching in the list of addresses of record blocks and addresses from the headers of record blocks for the address of a record block containing the first time record of parameter data from a given time interval interval, reading data records from the found record block, starting with the first data record whose timestamp is greater than the start time of the specified time interval, moving to subsequent record blocks at addresses from the record block headers, up to the record block that contains the data record, label whose time exceeds the end time of the specified interval, retrieving data records with timestamps that fell within the specified time interval.
  • a block of records is found containing the last data record, the timestamp of which does not exceed the end time of the interval, and the data records are read with a transition to the previous blocks of records at the addresses from the headers of the record blocks , to a block of records that contains the first data record whose timestamp is less than the start time of the specified time interval, retrieving data records with timestamps that fall within the specified time interval.
  • the specified forms of presenting data records, forming blocks of records from them, saving blocks of records into the database allows you to quickly and reliably find all records by the desired parameter for a given time interval, without going through all blocks of data records recorded in the database, but according to a search query identify the required block of records and from it obtain a record about the requested parameter. This significantly increases the speed of saving records into the database and reduces the search time for the desired parameter and the reliability of the search without missing the required data.
  • parameter here means the value of any physical quantity (for example, pressure or temperature in the reactor, liquid level in a container, CO2 concentration, etc.), measured and presented in digital form or obtained based on the values of other parameters .
  • data record here means the final form of representing information about the value of a parameter with a timestamp of its receipt.
  • block of records here means a set of records of the same parameter, sorted by time in their timestamps, and the set of records has a fixed size, the same for all parameters.
  • database here means a collection of record blocks of different parameters and lists of record block addresses of each parameter, which may contain timestamps of the first and/or last record of the record block stored on a computer-readable medium and/or computer memory.
  • FIG. 1 schematically shows the form of representation of the stored information.
  • So record block 1 includes data records 2 and record block header 3.
  • Data record 2 contains a timestamp 4, a parameter value 5, and may optionally contain additional data record data 6, such as, for example, an OPC Foundation data quality attribute.
  • An important component of the record block 1 is its header 3, which in turn includes the parameter identifier 7, the address 8 of the previous or subsequent record block of this parameter and may contain additional information 9.
  • additional information may be, for example, timestamps 4 of the first and/or the last data record 2 in record block 1, the address of the previous or subsequent record block, complementing address 8 to store in header 3 the addresses of both the previous and subsequent record block.
  • This form of presentation of the stored information allows you to quickly, without searching through all the saved blocks of records, select the desired block by the header of the record block and find the data record of the desired parameter in it.
  • FIG. 2 shows a special case of a system for storing blocks of records of one parameter, which displays the placement in the address space of the database sin of successive blocks of records 1.
  • each block of records 1 in addition to data records 2, contains a header 3, which stores the address of the subsequent block of records.
  • the first block of records 1 is located at address 10
  • the second block of records is at address 11, and the third is at address 12.
  • header 3 of the first block of records 1 stores the address 11 of the second (subsequent in time) block of records 1
  • the second block of records 1 in its header 3 stores the address 12 of the third block of records 1.
  • Figure 3 shows another special case of the system for storing record blocks 1 of one parameter, when the header 3 of record block 1 contains the address of the previous record block in time.
  • FIG. 2 three consecutive blocks of records 1 are presented. From FIG. 3 you can see that the title 3 of the last block! records 1 stores the address 11 of the second block of records 1 (previous in time), which in its header 3 stores the address 10 of the first in time from those presented in FIG. 3 blocks of records 1.
  • This structure of interconnection of blocks of records allows you to quickly retrieve all data on a parameter for any time interval.
  • FIG. 4 schematically shows a special case of executing a list 13 that contains structures 14, where each structure 14 consists of the address 8 of a record block 1 and the timestamps 4 of the first and last data record 2 in a given record block 1.
  • the presence of such a list 13 allows for very fast find record block 1 storing data records 2 at a given point in time without scanning all database record blocks.
  • Figure 5 schematically shows the process control system. It includes three subsystems: subsystem 16 for collecting and processing data, subsystem HMI (human-machine interface) 18 and archiving subsystem 17. Software components 21, 23 and 26 of these subsystems operate on one computer 15. All of the following examples of the storage method are and data extraction are considered for the system shown in FIG. 5.
  • the claimed technical solution can be used in industrial automation systems (process control systems, automated control systems, etc.), commercial and technical accounting systems (ASKUE, ASTUE, etc.), as well as in dispatch systems for industrial facilities, housing and communal services facilities and in building automation.
  • industrial automation systems process control systems, automated control systems, etc.
  • ASKUE commercial and technical accounting systems
  • ASTUE ASTUE
  • dispatch systems for industrial facilities, housing and communal services facilities and in building automation.
  • the history of changes over time of each parameter is stored in the form of data records 2 (Fig. 1), containing the value of parameter 5, a time stamp 4 (real time) associated with the moment the value of parameter 5 was received and may contain a set of additional (service) information 6, if one is required.
  • a record may contain an 8-byte timestamp (64-bit Unix time), the value of parameter 5 in floating-point format is 4 bytes, and as additional (service) information 6, for example, a quality attribute in in accordance with the Fondation OPC standard.
  • This construction of data record 2 allows you to arrange data records in sequence according to their time stamps 4. Additional data 6 allows you to take into account their reliability in the future when analyzing the data.
  • Data records 2 about the history of changes in one parameter over time are stored in the form of blocks of records 1, which have the same size.
  • the number of data records 2 in one record block 1 is limited by its size, all of which refer to only one parameter.
  • Each block of records 1 has a header 3, which in turn includes a parameter identifier 7. This allows for a reduction in record size, since the parameter identifier 7 is present only in header 3 of record block 1 and is distributed to all data records 2 in it, which also leads to reduction time of saving and reading data by reducing the volume of stored and read information, as well as through the use of block operations.
  • the specified structure of record block 1 leads to the fact that when searching for the necessary information about a parameter, blocks with the identifier of only this parameter are viewed. This results in reduced search time.
  • Header 3 of record block 1 in addition to the identifier of parameter 7, contains the address 8 of another record block 1 storing data records 2 of the same parameter. This may be the address of the subsequent block of records 1 or the previous one.
  • Figure 2 shows a special case of implementing a data storage system for one parameter, when each block of records 1 in header 3 stores the address 8 of the subsequent block of records 1 of this parameter.
  • record blocks 1 with addresses 10, 11 and 12 are written sequentially in time: block of records 1 with address 10 are the first records in time, and with address 12 the last ones.
  • Figure 3 shows another special case of implementing a single parameter data storage system, where the same record blocks 1 are shown, but in their headers 3 the address 8 is stored not of the subsequent, but of the previous block of records 1.
  • the presence of addresses 8 of the subsequent or previous block of records 1 in header 3 allows you to quickly find the next block of records 1 to read if the request for data and time exceeds the time range of the stored data records 2 in this block records 1 . This allows you to significantly reduce data retrieval time.
  • the header 3 of record block 1 contains the timestamp 4 of the first record in the record block and/or the timestamp of the last record in this record block. This allows you to quickly search for the desired record block 1 when retrieving data for a given time interval, since to analyze the compliance of a given record block 1 with the request requirements, it is enough to read only its header 3, and not the entire record block 1. If the timestamps of 4 data records 2 of this record block 1 do not fall within the specified time interval, then a transition is made to another block of records 1 of the desired parameter, the address 8 of which is written in header 3 of this block 1.
  • a database is formed from blocks of records 1.
  • a list of 13 addresses of 8 record blocks 1 is formed for each parameter, which is also saved to the database.
  • the list 13 of addresses 8 of record blocks 1 is shown schematically in FIG. 4.
  • FIG. 4 shows that information about the addresses of 8 blocks of records 1, containing the history of changes in one parameter, is stored in the form of structures 14 containing the addresses of 8 blocks of records 1.
  • these structures 14, in addition to addresses 8 contain timestamps 4 of the first and last data records 2 in a given block of records 1.
  • the following structure 14 is added to the list 13. In the special case of executing structure 14, it can contain only one timestamp 4 - the first or last data record 2 in the block records 1.
  • structure 14 may not contain a timestamp 4.
  • adding a new structure 14 to list 13 is not performed when saving block of records 1 to the database, but at a specified time interval (for example, once a day). Blocks of records 1 are formed with different time intervals, therefore, during the formation of one of such blocks of records 1, several structures 14 (at fixed time intervals) with address 8 of the generated block of records 1 can be stored in list 13.
  • several record blocks 1 can be saved. In this case, the number of structures 14 with addresses of 8 record blocks 1 in the list 13 will not correspond to the number of record blocks 1 storing the history of this parameter.
  • the number of structures 14 may be less than the number of blocks of records 1 storing the history of one parameter, when, in order to reduce the size of the list 13, structures 14 are stored in it not for each block of records 1, but, for example, every third or every tenth, or another principle for reducing list size is used 13.
  • the database is stored in the form of one or several files on a machine-readable storage medium (HDD, SSD, SD, etc.) and/or in the computer's RAM.
  • a machine-readable storage medium HDD, SSD, SD, etc.
  • the proposed method of saving data allows you to obtain information about a parameter from the database as quickly as possible, without loss, i.e. extract all data on a parameter for any time interval, due to the fact that it is not necessary to scan all record blocks 1 stored in the database, and to search for record block 1 of the desired parameter, select from a list of 13 record block addresses 1 address 8 of the block containing the first by time, a record whose timestamp 4 exceeds the start time of the specified time interval.
  • a search is made for the last block of records 1 whose timestamp 4 of the last data record 2 is less than the start time a given time interval and then a search is performed with transition to addresses 8 in the headers 3 of blocks of records 1 with analysis of labels 4 of the first and last data record until a block of records 1 is identified containing the first data record 2, the timestamp of which 4 is greater than the start time of the specified time interval.
  • Records are read from the found record block 1, starting from the first data record 2, the timestamp of which is greater than the start time of the specified time interval, to the record block 1, which contains the first data record 2, the timestamp of which is greater than the end time of the specified time interval. , retrieving 2 data records with 4 timestamps that fell within a given time interval. All read records from the first one falling within a given time interval to the last one are the result of data retrieval.
  • a search is performed using a list of 13 addresses 8 of record blocks 1 and addresses 8 from the headers 3 of record blocks 1 of that record block 1, which contains the first entry data 2, whose timestamp 4 exceeds the end time of the specified time interval. Records are read from the found record block 1, starting from the first data record 2, the timestamp of which 4 is less than the end time of a specified time interval, in the reverse time direction to the record block 1, which contains the last data record 2, the timestamp of which 4 is greater than the start time of a given interval, retrieving records with timestamps that fell within a given time interval. All read records from the first one falling within a given time interval to the last one are the result of data retrieval.
  • FIG. 5 schematically shows the process control system. It includes three subsystems: a data collection and processing subsystem 16, an HMI (human-machine interface) subsystem 18 and an archiving subsystem 17. Software components 21, 23 and 26 of these subsystems operate on one computer 15.
  • HMI human-machine interface
  • the data collection and processing subsystem 16 includes input/output modules 19, to which sensors are connected that monitor process parameters, and which are polled via the RS-485 interface connected to the USB port 22 of the computer 15 through an RS-485/USB interface converter 20 , as well as a software component 21, which, using the MODBUS protocol with a given frequency, polls the input/output modules 19, processes the received data, converting them into values of physical quantities in float format, assigns them time stamps corresponding to the moment of receiving this data via the protocol, and a sign of quality in accordance with the OPO Foundation standard.
  • the data collection and processing subsystem 16 transmits the values of the monitored process parameters along with time stamps and quality attributes to the HMI subsystem 18 and the archiving subsystem 17. Values are transferred only for those parameters whose values have changed compared to the previous transmitted value by an amount greater than 0, 2% of their possible range of change.
  • the HMI subsystem 18 consists of means of interaction with the operator (monitor 27, keyboard 28 and mouse-type manipulator 29) and a software component 26, which processes operator commands submitted through the keyboard 28 and mouse-type manipulator 29, sends requests and receives data from the collection subsystem 16 and processing data and archiving subsystem 17, forms a visual image based on the received data and displays it on the monitor 27.
  • the archiving subsystem 17 consists of two mirrored hard drives 25, a fixed area of computer RAM 24 and an archiving software component 23, which receives data from the data collection and processing subsystem 16, forms data records 2 from the received data, from which it forms blocks in RAM 24 records 1, for example, 200 data records 2 of one parameter in each block of records 1 and saves blocks of records 1 as they are filled with data records 2 in the database on disks 25. Moreover, for each parameter in RAM 24 space is allocated to form one block records 1. After filling this block of records 1 with data records 2 and saving it to the database on disks 25, the space it occupies in memory 24 is released and used to form the next block of records 1 of this parameter.
  • data record 2 consists of a time stamp 4 in 64-bit Unix time format (8 bytes), parameter value 5 in float format (4 bytes) and additional information 6 in the form of a data quality indicator in accordance with the OPC Foundation standard (1 byte ).
  • the archiving subsystem 17 generates in RAM 24 for each parameter lists 13 of addresses for the placement of record blocks 1 storing data records 2 with the values of this parameter. These lists 13, as new information is added to them, are also saved to the database on disks 25.
  • the archiving subsystem 17 receives requests for data searches from the HMI subsystem 18, retrieves the requested data and transmits them to the HMI subsystem 18.
  • the time stamp 4 of the last data record 2 and the address 8 of the subsequent record block 1 are stored in the header 3 of the record block, and in the list 13 for each parameter, structures 14 are stored containing the address 8 and the time stamp 4 of the last data record 2, for every tenth block of records 1 of this parameter in the database.
  • the software component 26 of the HMI 18 subsystem To view archived data in the HMI subsystem 18, for example, to display changes in a parameter on a trend for the previous week, the software component 26 of the HMI 18 subsystem generates a request to the archiving subsystem 17, which specifies the parameter identifier 7, as well as the start time and end time of the time interval .
  • the start of the time interval will be 00:00:00.000 of the previous Monday, and the end will be 23:59:59.999 of the previous Sunday.
  • To prepare a sample of records in this time interval first search the database for record block 1, for which the start time of the specified time range (00:00:00.000 Monday) is between timestamps 4 of the first and last data record 2. To do this, access the list 13 for a given parameter.
  • the address 8 of the last block of records 1 is found, the time of the last record of which is less than the specified start time of the time interval.
  • Read header 3 of the found record block 1 and move to the next record block 1 at address 8, written in the found record block 1.
  • Read its header 3. If the timestamp 4 of the last data record 2 stored in it is less than the start time of the specified time interval, then address 8 from header 3 of this block of records 1 goes to the next block of records 1. And so on until the time stamp 4 of the last data record 2 in header 3 of the next block of records 1 does not exceed the start time of the specified time interval.
  • This data record 2 is considered to be the first one found in the required interval.
  • the sample includes only those data records 2 whose timestamps 4 are less than the end of the specified time interval.
  • the search for records ends and all data records placed in the sample are transferred to the software component 26 of the I1M1 1 subsystem, which, based on the resulting sample, builds an image of the trend of changes in the value of a given parameter, which is then displayed on monitor 1.
  • the value of the quality attribute is analyzed, which is an additional value 6 of each data record 2. Where the value of this attribute is not equal to 192 (the data has GOOD quality) the trend is shown as a dotted line.
  • the 1 timestamp 4 of the first data record 2 of this record block 1 and the address 8 of the previous record block 1 are stored in the header 3 of the record block 1, and a structure 14 is added to the list 13 containing only the address 8 of the current record block 1 to be filled, once a day at the moment the onset of a new day.
  • the software component 26 of the subsystem 1 GM1 18 generates a request to the archiving subsystem 17, which specifies the identifier of parameter 7, as well as the start time and time the end of the time interval: 00:00:00.000 of the previous Monday and 23:59:59.999 of the previous Sunday.
  • the archiving subsystem 17 specifies the identifier of parameter 7, as well as the start time and time the end of the time interval: 00:00:00.000 of the previous Monday and 23:59:59.999 of the previous Sunday.
  • To prepare a sample of data records 2 first find in the database a block of records 1 for which the end time of the specified time range (23:59:59.999 Sunday) is located between timestamps 4 of the first and last data record 2. For this, use list of 13 addresses 8 for a given parameter.
  • All data records 2 whose timestamp 4 is less than the end time of the specified time interval are retrieved and placed in sample. Next, they go to address 8 from header 3 of this record block 1 to the previous record block 1. Read data records 2 from the previous record block 1. If time stamp 4 in header 3 of this record block 1 is greater than the start time of the specified time interval, then all data records 2 of a given block of records 1 are extracted and placed in the sample. Otherwise, only data records 2 whose timestamp 4 is greater than the start time of the specified time interval are placed in the sample. This completes the sampling, and it is transferred to the software component 26 of the HMI 18 subsystem.
  • the address 8 of the subsequent record block 1 is stored in the header 3 of the record block 1, as well as additional information 9, including the timestamps 4 of the first and last data records 2 of this record block 1 and the address 8 of the previous record block 1.
  • the list 13 stores structures 14, including the address 8 of record block 1 and the timestamps 4 of its first and last data records 2.
  • the address 8 of the newly created (subsequent to the saved) record block 1 and the timestamp 4 of the last record of the saved record block 1 are written into its header 3.
  • the address 8 of the saved record block and the timestamp 4 of the first data record 2 when it is added to the new record block 1 are written into the header 3 of the newly created record block 1.
  • the HMI 18 subsystem requests parameter data for the previous week.
  • the HMI subsystem 18 was given the extracted sample of data records 2.
  • the operator changed the scale of the trend time axis, which required adding data three more days before the start time of the previous request time interval and two days after end of the previous request interval. In this case, you need to add data to the already obtained selection.
  • both after and before a given time interval two additional samples are performed. The first is to obtain data records from the end time of the initial time interval (23:59:59.999 of the previous Sunday) to 23:59:59.999 of the Tuesday of the current week. To do this, use the mechanism described in Example 1.
  • time stamp 4 of the last data record 2 in header 3 of this (subsequent) record block 1 is less than the end time time interval, then all data records 2 of this block of records 1 are retrieved and stored in the sample. The specified operations are repeated until the time stamp 4 of the last record 2 of the next block of records 1 is greater than the end time of the specified interval. In this case, only those data records 2 from the last read block of records 1 are saved in the sample, the timestamp 4 of which is less than the end time of the specified interval. This completes the filling of the first additional sample.
  • Example 2 use the sequence of actions described in Example 2, when you go to address 8 of the previous block of records 1 from header 3 of the current block of records 1, and compare the value of timestamp 4 of the first data record 2 with the start time of the specified time interval to determine last read block of records 1 to form a sample.
  • a selection is made of data records 2, the timestamps 4 of which are in the range from 00:00:00.000 Friday of the previous week to 00:00:00.000 of the previous Monday.
  • the address of record block 1 is determined, corresponding to the end time of the time interval of the second sample (00:00:00.000 of the previous Monday). For this, time stamps 4 of the first and last data records 2 from structures 14 of list 13 are used.
  • Address 8 of record block 1 is read from the address 8 found in this way. If the value of timestamp 4 of the first data record of this record block 1 is less than the start time of the specified time interval, then select from record block 1 data records 2 whose timestamps 4 fall within a given time interval, extract and place them in the sample, and complete the search. If the value of timestamp 4 of the first data record 2 of this block of records 1 is greater than the start time of the specified time interval 4, then it is placed in fetch all data records 2 whose timestamps 4 are less than the end time of the specified time interval and read the previous record block 1 at address 8 from header 3 of this record block 1.
  • timestamp 4 of the first data record 2 is greater than the start time of the specified time interval, then all data records 2 of this block of records 1 are extracted and placed in the sample and the transition to reading the previous block of records 1 is performed. These operations are performed until the time stamp 4 of the next read block of records 1 is less than the start time of the specified time interval. In this case, only those data records 2 are saved in the sample, the timestamps 4 of which are greater than the start time of the specified time interval, and the formation of the sample is completed.
  • the resulting two additional samples of data records 2 are transferred to the HMI 18 subsystem to complete the missing trend fragments.

Abstract

The group of inventions relates to methods for storing data received from different data sources. The technical result is an increase in the speed of recording data without losses, and a reduction in the time taken to extract necessary data. A data storage method includes: receiving data from a data source; saving the data in the form of data records in the memory of a computer, wherein each data record contains a time stamp related to the moment of creation of the data, and a parameter value; generating, from the data records, identically-sized record blocks in the computer memory, wherein a record block can contain data records for only one parameter; assigning to a record block a title including an identifier of the parameter and an address; saving the generated record block in a database on a machine-readable medium; generating and saving in the database a list of addresses of the record blocks for each parameter.

Description

СПОСОБ ХРАНЕНИЯ И СПОСОБ ИЗВЛЕЧЕНИЯ ДАННЫХ DATA STORAGE AND DATA RETRIEVAL METHOD
Область техники Field of technology
Настоящее изобретение в целом относится к способам хранения данных и, в частности, к сбору и извлечению данных, полученных от различных источников данных. The present invention generally relates to methods for storing data and, in particular, to collecting and retrieving data obtained from various data sources.
Технологический процесс производства все больше зависит от систем сбора данных и использования их с целью повышения эффективности технологического процесса и уменьшения затрат на его обслуживание. The manufacturing process is increasingly dependent on data collection and use systems to improve process efficiency and reduce maintenance costs.
Большинство технологических процессов автоматизированы и работу оборудования отслеживают датчики, информация с которых поступает в систему хранения и обработки данных. Most technological processes are automated and the operation of the equipment is monitored by sensors, the information from which enters the data storage and processing system.
Важным аспектом сбора данных с датчиков является скорость записи данных, без потерь, и архивирование данных таким образом, чтобы получить данные из архива также с высокой скоростью для выработки оперативного решения. An important aspect of collecting data from sensors is the speed of data recording, without loss, and data archiving in such a way as to obtain data from the archive also at high speed to develop an operational solution.
Уровень техники State of the art
Специалисту данной области техники известны такие системы архивации данных, как SQL Server (Microsoft), системы архивирования, разработанные компанией Wonderware (https://www.wonderware.com , SIEMENSA person skilled in the art is aware of such data archiving systems as SQL Server (Microsoft), archiving systems developed by Wonderware (https://www.wonderware.com, SIEMENS
(https://new.siemens.com/ru/ru/produkty/avtomatizacia/raspredelennye-sistemy- uprayleniya/simatic- 7/arhivaciya-dannyh-processa-i-otchetnost.html) и др.
Figure imgf000003_0001
(https://new.siemens.com/ru/ru/produkty/avtomatizacia/raspredelennye-sistemy-uprayleniya/simatic-7/arhivaciya-dannyh-processa-i-otchetnost.html), etc.
Figure imgf000003_0001
Однако указанные системы (архивы) являются сложными и ресурсоемкими, имеют определенную скорость получения данных из архива, которая не всегда отвечает' задачам предприятия и, кроме того, они являются дорогостоящими продуктами и не каждое предприятие может позволить себе установить указанные системы хранения данных. However, these systems (archives) are complex and resource-intensive, have a certain speed of retrieving data from the archive, which does not always meet the objectives of the enterprise and, in addition, they are expensive products and not every enterprise can afford to install these data storage systems.
Наиболее близким аналогом способа сбора и извлечения данных является способ, описанный в патенте US6651030, кл. G06F15/177, опубликованном 18.1 1.2003. Запатентованный способ сбора данных включает прием данных от источников данных, сохранение данных в виде записей в файл данных с отметкой времени создания данных и запись файла заголовка, который связывает интервал времени с теми записями в файлах данных, временные метки которых попадают в интервал времени. Способ извлечения записей данных включает выбор интересующего временного интервала, доступ к файлу заголовка, который связывает интересующий временной интервал с записями данных, временные метки которых попадают в интересующий интервал, извлечение записей данных на основе меток времени записей данных. The closest analogue of the method for collecting and retrieving data is the method described in patent US6651030, cl. G06F15/177, published 18.1 1.2003. The proprietary data collection method involves receiving data from data sources, storing the data as records in a data file with a timestamp when the data was created, and writing a header file that associates the time interval with those records in the data files whose timestamps fall within the time interval. A method for retrieving data records involves selecting a time interval of interest, accessing a header file that associates the time interval of interest with the data records, whose timestamps fall within the interval of interest, retrieving data records based on the timestamps of the data records.
Недостатком указанных способов является запись собранных данных в файл данных без разделения данных по параметрам, что увеличивает время записи данных и время извлечения данных по определенному параметру. The disadvantage of these methods is that the collected data is written to a data file without separating the data by parameters, which increases the time of data recording and the time of data retrieval for a certain parameter.
Сущность изобретения The essence of the invention
Заявляемое техническое решение устраняет указанные недостатки аналога. The claimed technical solution eliminates these disadvantages of the analogue.
Технический результат, который может быть получен при реализации заявляемого решения, заключается в увеличении скорости записи данных без потерь и сокращении времени извлечения необходимых данных. The technical result that can be obtained by implementing the proposed solution is to increase the speed of data recording without loss and reduce the time for retrieving the necessary data.
Указанный технический результат получают за счет создания способа хранения данных, включающего прием данных от источника данных, сохранение данных в виде записей данных в памяти компьютера, при этом каждая запись данных содержит метку времени, связанную с моментом создания данных, и значение параметра, формирование в памяти компьютера из записей данных блоков записей одинакового размера, при этом в одном блоке записей могут находиться записи данных только одного параметра, присвоение блоку записей заголовка, включающего идентификатор параметра и адрес, и сохранение сформированного блока записей в базу данных на машиночитаемый носи гель, формирование и сохранение в базе данных списка адресов блоков записей для каждого параметра. The specified technical result is obtained by creating a method for storing data, including receiving data from a data source, storing the data in the form of data records in computer memory, each data record containing a time stamp associated with the moment of data creation, and a parameter value, formation in memory computer from data records of record blocks of the same size, while one record block can contain data records of only one parameter, assigning a header to the record block, including the parameter identifier and address, and saving the generated record block to the database on a machine-readable wearable gel, formation and saving in the database a list of record block addresses for each parameter.
Причем заголовок блока записей включает адрес последующего блока записей или заголовок блока записей включает адрес предыдущего блока записей, еще в одном частном случае выполнения заголовок блока записей включает адрес предыдущего и последующего блока записей. Moreover, the header of the record block includes the address of the subsequent block of records or the header of the record block includes the address of the previous block of records; in another special case of execution, the header of the record block includes the address of the previous and subsequent block of records.
Заголовок блока записей может включать метку времени первой записи данных в блоке записей и/или метку времени последней записи данных в блоке записей и другую служебную информацию. The record block header may include a timestamp of the first data record in the record block and/or a timestamp of the last data record in the record block and other service information.
Сохраняют записи данных в блоке записей в порядке возрастания меток времени. Запись данных содержит дополнительную информацию. Store data records in a record block in ascending order of timestamps. The data record contains additional information.
Список адресов блоков записей содержит метки времени. При этом для каждого адреса из списка хранится метка времени первой записи данных и/или метка времени последней записи данных блока записей по данному адресу. В качестве машиночитаемого носителя может быть использована память компьютера.The list of record block addresses contains timestamps. In this case, for each address from the list, the timestamp of the first data record and/or the time stamp of the last data record of the block of records at this address is stored. Computer memory can be used as a machine-readable medium.
Указанный технический результат получают так же за счет способа извлечения данных, включающего введение поискового запроса для заданного параметра и заданного временного интервала, поиск в списке адресов блоков записей и адресов из заголовков блоков записей адреса блока записей, содержащего первую по времени запись данных параметра из заданного временного интервала, считывание записей данных из найденного блока записей, начиная с первой записи данных, метка времени которой больше времени начала заданного интервала времени, с переходом к последующим блокам записей по адресам из заголовков блоков записей, до блока записей, в котором содержится запись данных, метка времени которой превосходит время конца заданного интервала, извлечение записей данных с метками времени, которые попали в заданный интервал времени. The specified technical result is also obtained through a method of data extraction, including entering a search query for a given parameter and a given time interval, searching in the list of addresses of record blocks and addresses from the headers of record blocks for the address of a record block containing the first time record of parameter data from a given time interval interval, reading data records from the found record block, starting with the first data record whose timestamp is greater than the start time of the specified time interval, moving to subsequent record blocks at addresses from the record block headers, up to the record block that contains the data record, label whose time exceeds the end time of the specified interval, retrieving data records with timestamps that fell within the specified time interval.
В частном случае выполнения способа извлечения данных по списку адресов и адресам из заголовков блоков записей находят блок записей, содержащий последнюю запись данных, метка времени которой не превосходит времени конца интервала, и считывают записи данных с переходом к предыдущим блокам записей по адресам из заголовков блоков записей, до блока записей, в котором содержится первая запись данных, метка времени которой меньше времени начала заданного временного интервала, извлечение записей данных с метками времени, которые попали в заданный интервал времени. In a particular case of performing a method for retrieving data from a list of addresses and addresses from the headers of record blocks, a block of records is found containing the last data record, the timestamp of which does not exceed the end time of the interval, and the data records are read with a transition to the previous blocks of records at the addresses from the headers of the record blocks , to a block of records that contains the first data record whose timestamp is less than the start time of the specified time interval, retrieving data records with timestamps that fall within the specified time interval.
Указанные формы представления записей данных, формирование из них блоков записей, сохранения блоков записей в базу данных, позволяет быстро и надежно отыскать все записи по нужному параметру за заданный интервал времени, не перебирая все блоки записей данных, записанных в базу данных, а по поисковому запросу выявить нужный блок записей и из него получить запись о запрашиваемом параметре. Это значительно увеличивает скорость сохранения записей в базу данных и сокращает время поиска нужного параметра и надежность поиска без пропусков искомых данных. The specified forms of presenting data records, forming blocks of records from them, saving blocks of records into the database, allows you to quickly and reliably find all records by the desired parameter for a given time interval, without going through all blocks of data records recorded in the database, but according to a search query identify the required block of records and from it obtain a record about the requested parameter. This significantly increases the speed of saving records into the database and reduces the search time for the desired parameter and the reliability of the search without missing the required data.
Следует отметить, что термин «параметр» означает здесь значение какой-либо физической величины (например, давление или температура в реакторе, уровень жидкости в емкости, концентрация СОг и пр.), измеренной и представленной в цифровом виде или полученной на основе значений других параметров. It should be noted that the term “parameter” here means the value of any physical quantity (for example, pressure or temperature in the reactor, liquid level in a container, CO2 concentration, etc.), measured and presented in digital form or obtained based on the values of other parameters .
Термин «запись данных» означает здесь конечную форму представления информации о значении параметра с меткой времени его получения. Термин «блок записей» означает здесь набор записей одного и того же параметра, отсортированных по времени в их временных метках, причем набор записей имеет фиксированный размер, одинаковый для всех параметров. The term “data record” here means the final form of representing information about the value of a parameter with a timestamp of its receipt. The term "block of records" here means a set of records of the same parameter, sorted by time in their timestamps, and the set of records has a fixed size, the same for all parameters.
Термин «база данных» означает здесь набор блоков записей разных параметров и списки адресов блоков записей каждого параметра, которые могут содержать метки времени первой и/или последней записи блока записей, сохраненных на машиночитаемый носитель и/или память компьютера. The term “database” here means a collection of record blocks of different parameters and lists of record block addresses of each parameter, which may contain timestamps of the first and/or last record of the record block stored on a computer-readable medium and/or computer memory.
Краткое описание чертежей Brief description of drawings
Заявляемое техническое решение может быть проиллюстрировано следующими фигурами чертежей, где на фиг. 1 схематически показана форма представления сохраняемой информации. Гак блок записей 1 включает записи данных 2 и заголовок 3 блока записей. Запись данных 2 содержит метку времени 4, значение параметра 5 и может факультативно содержать дополнительные данные 6 записи данных, такие как, например, признак качества данных в соответствии со стандартом ОРС Foundation. Важной составляющей блока записей 1 является его заголовок 3, который в свою очередь включает идентификатор параметра 7, адрес 8 предыдущего или последующего блока записей этого параметра и может содержать дополнительную информацию 9. Такой дополнительной информацией может быть, например, метки времени 4 первой и/или последней записи данных 2 в блоке записей 1, адрес предыдущего или последующего блока записей, дополняющий адрес 8, чтобы хранить в заголовке 3 адреса, как предыдущего, так и последующего блока записей. Такая форма представления сохраняемой информации позволяет быстро, без перебора всех сохраненных блоков записей, по заголовку блока записей выделить нужный блок и найти в нем запись данных искомого параметра. The claimed technical solution can be illustrated by the following figures of the drawings, where in FIG. 1 schematically shows the form of representation of the stored information. So record block 1 includes data records 2 and record block header 3. Data record 2 contains a timestamp 4, a parameter value 5, and may optionally contain additional data record data 6, such as, for example, an OPC Foundation data quality attribute. An important component of the record block 1 is its header 3, which in turn includes the parameter identifier 7, the address 8 of the previous or subsequent record block of this parameter and may contain additional information 9. Such additional information may be, for example, timestamps 4 of the first and/or the last data record 2 in record block 1, the address of the previous or subsequent record block, complementing address 8 to store in header 3 the addresses of both the previous and subsequent record block. This form of presentation of the stored information allows you to quickly, without searching through all the saved blocks of records, select the desired block by the header of the record block and find the data record of the desired parameter in it.
На фиг. 2 представлен частный случай системы сохранения блоков записей одного параметра, где отображено размещение в адресном пространстве базы данных грех следующих подряд по времени блоков записей 1. На фиг. 2 показано, что каждый блок записей 1, помимо записей данных 2 содержит заголовок 3, в котором хранится адрес последующего по времени блока записей. Так первый по времени блок записей 1 размещен по адресу 10, второй блок записей - по адресу 11, а третий - по адресу 12. Из фиг. 2 видно, что заголовок 3 первого блока записей 1 хранит адрес 11 второго (последующего по времени) блока записей 1, а второй блок записей 1 в своем заголовке 3 хранит адрес 12 третьего блока записей 1. На фиг. 3 представлен еще один частный случай системы сохранения блоков записей 1 одного параметра, когда заголовок 3 блока записей 1 содержит адрес предыдущего по времени блока записей. Здесь, так же, как и на фиг.2, представлены три следующих подряд по времени блока записей 1. Из фиг. 3 видно, что заголовок 3 последнего блокг! записей 1 хранит адрес 11 второго блока записей 1 (предыдущего по времени), который в своем заголовке 3 хранит адрес 10 первого по времени из представленных на фиг. 3 блока записей 1. Такая структура взаимосвязи блоков записей позволяет максимально быстро извлечь все данные по параметру за любой интервал времени. In fig. Figure 2 shows a special case of a system for storing blocks of records of one parameter, which displays the placement in the address space of the database sin of successive blocks of records 1. In FIG. 2 shows that each block of records 1, in addition to data records 2, contains a header 3, which stores the address of the subsequent block of records. Thus, the first block of records 1 is located at address 10, the second block of records is at address 11, and the third is at address 12. From FIG. 2 it can be seen that header 3 of the first block of records 1 stores the address 11 of the second (subsequent in time) block of records 1, and the second block of records 1 in its header 3 stores the address 12 of the third block of records 1. In fig. Figure 3 shows another special case of the system for storing record blocks 1 of one parameter, when the header 3 of record block 1 contains the address of the previous record block in time. Here, as in FIG. 2, three consecutive blocks of records 1 are presented. From FIG. 3 you can see that the title 3 of the last block! records 1 stores the address 11 of the second block of records 1 (previous in time), which in its header 3 stores the address 10 of the first in time from those presented in FIG. 3 blocks of records 1. This structure of interconnection of blocks of records allows you to quickly retrieve all data on a parameter for any time interval.
На фиг. 4 схематично представлен частный случай выполнения списка 13, который содержит структуры 14, где каждая структура 14 состоит из адреса 8 блока записей 1 и меток времени 4 первой и последней по времени записи данных 2 в данном блоке записей 1. Наличие такого списка 13 позволяет очень быстро находить блок записей 1 , хранящий записи данных 2, на заданный момент времени без сканирования всех блоков записей базы данных. In fig. 4 schematically shows a special case of executing a list 13 that contains structures 14, where each structure 14 consists of the address 8 of a record block 1 and the timestamps 4 of the first and last data record 2 in a given record block 1. The presence of such a list 13 allows for very fast find record block 1 storing data records 2 at a given point in time without scanning all database record blocks.
На фиг. 5 схематично представлена система контроля за технологическим процессом. Она включает в себя три подсистемы: подсистему 16 сбора и обработки данных, подсистему HMI (человеко-машинный интерфейс) 18 и подсистему архивирования 17. Программные компоненты 21, 23 и 26 указанных подсистем функционируют на одном компьютере 15. Все приведенные ниже примеры выполнения способа сохранения и извлечения данных рассматриваются для системы, отображенной на фиг.5. In fig. Figure 5 schematically shows the process control system. It includes three subsystems: subsystem 16 for collecting and processing data, subsystem HMI (human-machine interface) 18 and archiving subsystem 17. Software components 21, 23 and 26 of these subsystems operate on one computer 15. All of the following examples of the storage method are and data extraction are considered for the system shown in FIG. 5.
Подробное раскрытие изобретения Detailed Disclosure of the Invention
Информация о состоянии функционирования различных устройств производства представляет собой огромный объем данных. Такие большие объемы данных должны быть сохранены в хронологическом порядке и возникают проблемы в хранении данных реального времени. Временный выход из строя отдельных устройств вносит свои неудобства, т.к. часть информации может быть пропущена в таком потоке сохранения данных. Возникает необходимость в надежном и скоростном способе архивирования и извлечения данных, который позволит быстро принять верное решение и, таким образом, увеличить производительность работы оборудования предприятия или подготовить отчет с актуальной информацией. Information about the operating status of various production devices represents a huge amount of data. Such large amounts of data must be stored in chronological order and problems arise in storing real-time data. Temporary failure of individual devices brings its own inconveniences, because... Some information may be missed in such a data storage flow. There is a need for a reliable and high-speed method of archiving and retrieving data, which will allow you to quickly make the right decision and, thus, increase the productivity of enterprise equipment or prepare a report with up-to-date information.
Заявляемое техническое решение может применяться в системах промышленной автоматизации (АСУТП, АСУЭ, и др.), системах коммерческого и технического учета (АСКУЭ, АСТУЭ, и др.), а также в системах диспетчеризации промышленных объектов, объектов ЖКХ и в автоматизации зданий. The claimed technical solution can be used in industrial automation systems (process control systems, automated control systems, etc.), commercial and technical accounting systems (ASKUE, ASTUE, etc.), as well as in dispatch systems for industrial facilities, housing and communal services facilities and in building automation.
История изменения во времени каждого параметра сохраняется в виде записей данных 2 (фиг.1), содержащих значение параметра 5, метку времени 4 (реального времени), связанную с моментом получения значения параметра 5 и может содержать набор дополнительной (служебной) информации 6, если таковая требуется. Например, запись может содержать метку времени размером 8 байт (64-битное Unix-время), значение параметра 5 в формате числа с плавающей точкой - 4 байта, а в качестве дополнительной (служебной) информации 6 может быть использован, например, признак качества в соответствии со стандартом ОРС Fondation. Такое построение записи данных 2 позволяет выстраивать записи данных в последовательности по их меткам времени 4. Дополнительные данные 6 позволяют в дальнейшем при анализе данных учитывать их достоверность. The history of changes over time of each parameter is stored in the form of data records 2 (Fig. 1), containing the value of parameter 5, a time stamp 4 (real time) associated with the moment the value of parameter 5 was received and may contain a set of additional (service) information 6, if one is required. For example, a record may contain an 8-byte timestamp (64-bit Unix time), the value of parameter 5 in floating-point format is 4 bytes, and as additional (service) information 6, for example, a quality attribute in in accordance with the Fondation OPC standard. This construction of data record 2 allows you to arrange data records in sequence according to their time stamps 4. Additional data 6 allows you to take into account their reliability in the future when analyzing the data.
Записи данных 2 об истории изменения одного параметра во времени сохраняются в виде блоков записей 1, которые имеют одинаковый размер. Количество записей данных 2 в одном блоке записей 1 ограничивается его размером, причем все они относятся только к одному параметру. Каждый блок записей 1 имеет заголовок 3, который в свою очередь включает идентификатор параметра 7. Это позволяет сократить размер записи, поскольку идентификатор параметра 7 присутствует только в заголовке 3 блока записей 1 и распространяется на все записи данных 2 в нем, что также приводит к сокращению времени сохранения и чтения данных за счет уменьшения объема сохраняемой и считываемой информации, а также за счет использования блочных операций. Data records 2 about the history of changes in one parameter over time are stored in the form of blocks of records 1, which have the same size. The number of data records 2 in one record block 1 is limited by its size, all of which refer to only one parameter. Each block of records 1 has a header 3, which in turn includes a parameter identifier 7. This allows for a reduction in record size, since the parameter identifier 7 is present only in header 3 of record block 1 and is distributed to all data records 2 in it, which also leads to reduction time of saving and reading data by reducing the volume of stored and read information, as well as through the use of block operations.
Указанная структура блока записей 1 приводит к тому, что при поиске нужной информации о параметре просматриваются блоки с идентификатором только данного параметра. Это приводит к снижению времени поиска. The specified structure of record block 1 leads to the fact that when searching for the necessary information about a parameter, blocks with the identifier of only this parameter are viewed. This results in reduced search time.
Заголовок 3 блока записей 1, помимо идентификатора параметра 7 содержит адрес 8 другого блока записей 1 , хранящего записи данных 2 того же параметра. Это может быз ъ адрес последующего по времени блока записей 1 или предыдущего. На фиг. 2 представлен частный случай выполнения системы хранения данных одного параметра, когда каждый блок записей 1 в заголовке 3 хранит адрес 8 последующего блока записей 1 этого параметра. Причем блоки записей 1 с адресами 10, 11 и 12 записаны последовательно по времени: блок записей 1 с адресом 10 - первых по времени записей, а с адресом 12 - последних. На фиг. 3 показан другой частный случай выполнения системы хранения данных одного параметра, где показаны те же блоки записей 1, но в их заголовках 3 хранится адрес 8 не последующего, а предыдущего блока записей 1. Наличие адресов 8 последующего или предыдущего блока записей 1 в заголовке 3 позволяет быстро находить следующий для считывания блок записей 1, если запрос данных но времени выходит за диапазон времени хранимых записей данных 2 в данном блоке записей 1 . Э то позволяет существенно сократить время извлечения данных. Header 3 of record block 1, in addition to the identifier of parameter 7, contains the address 8 of another record block 1 storing data records 2 of the same parameter. This may be the address of the subsequent block of records 1 or the previous one. In fig. Figure 2 shows a special case of implementing a data storage system for one parameter, when each block of records 1 in header 3 stores the address 8 of the subsequent block of records 1 of this parameter. Moreover, record blocks 1 with addresses 10, 11 and 12 are written sequentially in time: block of records 1 with address 10 are the first records in time, and with address 12 the last ones. In fig. Figure 3 shows another special case of implementing a single parameter data storage system, where the same record blocks 1 are shown, but in their headers 3 the address 8 is stored not of the subsequent, but of the previous block of records 1. The presence of addresses 8 of the subsequent or previous block of records 1 in header 3 allows you to quickly find the next block of records 1 to read if the request for data and time exceeds the time range of the stored data records 2 in this block records 1 . This allows you to significantly reduce data retrieval time.
Внутри каждого блока 1 все записи данных 2 о параметре отсортированы по времени.Within each block 1, all data records 2 about the parameter are sorted by time.
Заголовок 3 блока записей 1 содержит метку времени 4 первой записи в блоке записей и/или метку времени последней записи в этом блоке записей. Это позволяет быстрее искать нужный блок записей 1 при извлечении данных за заданный временной интервал, поскольку для анализа соответствия данного блока записей 1 требованиям запроса достаточно считать только его заголовок 3, а не весь блок записей 1. Если метки времени 4 записей данных 2 данного блока записей 1 не попадают в заданный интервал времени, то выполняется переход к другому блоку записей 1 искомого параметра, адрес 8 ко торого записан в заголовке 3 данного блока 1. The header 3 of record block 1 contains the timestamp 4 of the first record in the record block and/or the timestamp of the last record in this record block. This allows you to quickly search for the desired record block 1 when retrieving data for a given time interval, since to analyze the compliance of a given record block 1 with the request requirements, it is enough to read only its header 3, and not the entire record block 1. If the timestamps of 4 data records 2 of this record block 1 do not fall within the specified time interval, then a transition is made to another block of records 1 of the desired parameter, the address 8 of which is written in header 3 of this block 1.
Из блоков записей 1 формируется база данных. При этом в базу данных поступаю!' блоки записей 1, содержащие историю изменения различных параметров. Они последовательно записываются по свободным адресам на машиночитаемом носителе (в базе) не зависимо от параметра. При этом формируют список 13 адресов 8 блоков записей 1 для каждого параметра, который тоже сохраняется в базу данных. Список 13 адресов 8 блоков записей 1 схематично представлен на фиг. 4. На фиг. 4 показано, что информация об адресах 8 блоков записей 1, содержащих историю изменения одного параметра, сохраняется в виде структур 14, содержащих адреса 8 блоков записей 1. В час гном случае выполнения, указанные структуры 14 кроме адресов 8 содержат метки времени 4 первой и последней записи данных 2 в данном блоке записей 1. При сохранении каждого нового блока записей 1 в базу данных в список 13 добавляется следующая структура 14. В частном случае выполнения структуры 14 она может содержать только одну метку времени 4 - первой или последней записи данных 2 в блоке записей 1. A database is formed from blocks of records 1. At the same time, I enter the database!' record blocks 1 containing the history of changes in various parameters. They are sequentially written to free addresses on machine-readable media (in the database), regardless of the parameter. In this case, a list of 13 addresses of 8 record blocks 1 is formed for each parameter, which is also saved to the database. The list 13 of addresses 8 of record blocks 1 is shown schematically in FIG. 4. In FIG. 4 shows that information about the addresses of 8 blocks of records 1, containing the history of changes in one parameter, is stored in the form of structures 14 containing the addresses of 8 blocks of records 1. At the hour of execution, these structures 14, in addition to addresses 8, contain timestamps 4 of the first and last data records 2 in a given block of records 1. When each new block of records 1 is saved to the database, the following structure 14 is added to the list 13. In the special case of executing structure 14, it can contain only one timestamp 4 - the first or last data record 2 in the block records 1.
В еще одном частном случае выполнения структуры 14 она может не содержать временную метку 4. В этом случае добавление новой структуры 14 в список 13 выполняется не при сохранении блока записей 1 в базу данных, а с заданным временным интервалом (например, раз в сутки). Блоки записей 1 формируются с разным временным промежутком, поэтому за время формирования одного из таких блоков записей 1 в список 13 может быть сохранено несколько структур 14 (по фиксированным временным интервалам) с адресом 8 формируемого блока записей 1. В другом частном случае за указанный интервал времени может быть сохранено несколько блоков записей 1. При этом число структур 14 с адресами 8 блоков записей 1 в списке 13 не будет соответствовать числу блоков записей 1 , хранящих историю данного параметра. In another special case of execution of structure 14, it may not contain a timestamp 4. In this case, adding a new structure 14 to list 13 is not performed when saving block of records 1 to the database, but at a specified time interval (for example, once a day). Blocks of records 1 are formed with different time intervals, therefore, during the formation of one of such blocks of records 1, several structures 14 (at fixed time intervals) with address 8 of the generated block of records 1 can be stored in list 13. In another special case, for the specified time interval, several record blocks 1 can be saved. In this case, the number of structures 14 with addresses of 8 record blocks 1 in the list 13 will not correspond to the number of record blocks 1 storing the history of this parameter.
Еще в одном частном случае число структур 14 может быть меньше числа блоков записей 1, хранящих историю одного параметра, когда в целях сокращения размера списка 13 в него сохраняют структуры 14 не для каждого блока записей 1, а, например, каждый третий или каждый десятый, или используется другой принцип сокращения размера списка 13. In another special case, the number of structures 14 may be less than the number of blocks of records 1 storing the history of one parameter, when, in order to reduce the size of the list 13, structures 14 are stored in it not for each block of records 1, but, for example, every third or every tenth, or another principle for reducing list size is used 13.
База данных хранится в виде одного или нескольких файлов на машиночитаемом носителе информации (HDD, SSD, SD и др.) и/или в оперативной памяти компьютера.The database is stored in the form of one or several files on a machine-readable storage medium (HDD, SSD, SD, etc.) and/or in the computer's RAM.
Предлагаемый способ сохранения данных позволяет максимально быстро, без потерь получать из базы данных сведения о параметре, т.е. извлечь все данные по параметру за любой интервал времени, за счет того, что не требуется сканировать все блоки записей 1 , сохраненные в базе данных, а для поиска блока записей 1 искомого параметра выбирают из списка 13 адресов блоков записей 1 адрес 8 блока, содержащего первую по времени запись, метка времени 4 которой превосходит время начала заданного интервала времени. Если в списке 13 нет структуры 14 с адресом 8 такого блока записей 1 (в результате сокращения размера списка 13 или записи структур 14 по фиксированным временным интервалам), то выполняется поиск последнего блока записей 1, метка времени 4 последней записи данных 2 которого меньше времени начала заданного временного интервала и далее выполняется поиск с переходом по адресам 8 в заголовках 3 блоков записей 1 с анализом меток 4 первой и последней записи данных до выявления блока записей 1, содержащего первую запись данных 2, временная метка 4 которой больше времени начала заданного временного интервала. Осуществляют, считывание записей из найденного блока записей 1 , начиная с первой записи данных 2, метка времени 4 которой больше времени начала заданного интервала времени до блока записей 1, в котором содержится первая запись данных 2, метка времени 4 которой превосходит время конца заданного интервала времени, извлечение записей данных 2 с метками времени 4, которые попали в заданный интервал времени. Все считанные записи от первой, попадающей в заданный временной интервал, до последней являются результатом извлечения данных. The proposed method of saving data allows you to obtain information about a parameter from the database as quickly as possible, without loss, i.e. extract all data on a parameter for any time interval, due to the fact that it is not necessary to scan all record blocks 1 stored in the database, and to search for record block 1 of the desired parameter, select from a list of 13 record block addresses 1 address 8 of the block containing the first by time, a record whose timestamp 4 exceeds the start time of the specified time interval. If there is no structure 14 in list 14 with address 8 of such record block 1 (as a result of reducing the size of list 13 or writing structures 14 at fixed time intervals), then a search is made for the last block of records 1 whose timestamp 4 of the last data record 2 is less than the start time a given time interval and then a search is performed with transition to addresses 8 in the headers 3 of blocks of records 1 with analysis of labels 4 of the first and last data record until a block of records 1 is identified containing the first data record 2, the timestamp of which 4 is greater than the start time of the specified time interval. Records are read from the found record block 1, starting from the first data record 2, the timestamp of which is greater than the start time of the specified time interval, to the record block 1, which contains the first data record 2, the timestamp of which is greater than the end time of the specified time interval. , retrieving 2 data records with 4 timestamps that fell within a given time interval. All read records from the first one falling within a given time interval to the last one are the result of data retrieval.
В частном случае выполнения способа извлечения данных, когда в заголовках 3 блоков записей 1 сохраняют адрес 8 не последующего блока записей, а предыдущего, выполняется поиск посредством списка 13 адресов 8 блоков записей 1 и адресов 8 из заголовков 3 блоков записей 1 того блока записей 1, который содержит первую запись данных 2, метка времени 4 которой превосходит время конца заданного временного интервала. Осуществляют, считывание записей из найденного блока записей 1 , начиная с первой записи данных 2, метка времени 4 которой меньше времени конца заданного интервала времени в обратном по времени направлении до блока записей 1, в котором содержится последняя запись данных 2, метка времени 4 которой превосходит время начала заданного интервала, извлечение записей с метками времени, которые попали в заданный интервал времени. Все считанные записи от первой попадающей в заданный временной интервал до последней являются результатом извлечения данных. In a particular case of performing a data retrieval method, when in the headers 3 of record blocks 1 the address 8 is stored not of the subsequent record block, but of the previous one, a search is performed using a list of 13 addresses 8 of record blocks 1 and addresses 8 from the headers 3 of record blocks 1 of that record block 1, which contains the first entry data 2, whose timestamp 4 exceeds the end time of the specified time interval. Records are read from the found record block 1, starting from the first data record 2, the timestamp of which 4 is less than the end time of a specified time interval, in the reverse time direction to the record block 1, which contains the last data record 2, the timestamp of which 4 is greater than the start time of a given interval, retrieving records with timestamps that fell within a given time interval. All read records from the first one falling within a given time interval to the last one are the result of data retrieval.
Частные случаи выполнения способа сохранения и извлечения данных могуч быть проиллюстрированы приведенными неисчерпывающими примерами, которые проиллюстрированы фиг.5. Particular cases of the method of storing and retrieving data can be illustrated by the given non-exhaustive examples, which are illustrated in Fig.5.
На фиг. 5 схематично представлена система контроля за технологическим процессом. Она включает в себя три подсистемы: подсистему 16 сбора и обработки данных, подсистему HMI (человеко-машинный интерфейс) 18 и подсистему архивирования 17. Программные компоненты 21, 23 и 26 указанных подсистем функционируют на одном компьютере 15. In fig. Figure 5 schematically shows the process control system. It includes three subsystems: a data collection and processing subsystem 16, an HMI (human-machine interface) subsystem 18 and an archiving subsystem 17. Software components 21, 23 and 26 of these subsystems operate on one computer 15.
Подсистема 16 сбора и обработки данных включает в себя модули ввода/вывода 19, к которым подключены датчики, контролирующие технологические параметры, и которые опрашиваются по интерфейсу RS-485, подключенному к USB-порту 22 компьютера 15 через конвертер интерфейсов RS-485/USB 20, а так же программный компонент 21, который по протоколу MODBUS с заданной частотой опрашивает модули ввода/вывода 19, обрабатывает полученные данные, переводя их в значения физических величин в формате float, присваивает им временные метки, соответствующие моменту получения этих данных по протоколу, и признак качества в соответствии со стандартом ОРО Foundation. Далее подсистема 16 сбора и обработки данных передает значения контролируемых технологических параметров вместе с метками времени и признаками качества в подсистему HMI 18 и подсистему архивирования 17. Передача значений осуществляется только для тех параметров, значения которых изменились по сравнению с предыдущим переданным значением на величину превышающую 0,2% от их возможного диапазона изменения. The data collection and processing subsystem 16 includes input/output modules 19, to which sensors are connected that monitor process parameters, and which are polled via the RS-485 interface connected to the USB port 22 of the computer 15 through an RS-485/USB interface converter 20 , as well as a software component 21, which, using the MODBUS protocol with a given frequency, polls the input/output modules 19, processes the received data, converting them into values of physical quantities in float format, assigns them time stamps corresponding to the moment of receiving this data via the protocol, and a sign of quality in accordance with the OPO Foundation standard. Next, the data collection and processing subsystem 16 transmits the values of the monitored process parameters along with time stamps and quality attributes to the HMI subsystem 18 and the archiving subsystem 17. Values are transferred only for those parameters whose values have changed compared to the previous transmitted value by an amount greater than 0, 2% of their possible range of change.
Подсистема HMI 18 состоит из средств взаимодействия с оператором (монитор 27, клавиатура 28 и манипулятор типа мышь 29) и программного компонента 26, который обрабатывает команды оператора, поданные посредством клавиатуры 28 и манипулятора типа мышь 29, посылает запросы и получает данные от подсистемы 16 сбора и обработки данных и подсистемы архивирования 17, формирует визуальное изображение на основе полученных данных и выводит его на монитор 27. The HMI subsystem 18 consists of means of interaction with the operator (monitor 27, keyboard 28 and mouse-type manipulator 29) and a software component 26, which processes operator commands submitted through the keyboard 28 and mouse-type manipulator 29, sends requests and receives data from the collection subsystem 16 and processing data and archiving subsystem 17, forms a visual image based on the received data and displays it on the monitor 27.
Подсистема архивирования 17 состоит из двух зеркалированных жестких дисков 25, закрепленной области оперативной памяти 24 компьютера и программного компонента архивирования 23, который принимает данные от подсистемы 16 сбора и обработки данных, формирует из принятых данных записи данных 2, из которых в оперативной памяти 24 формирует блоки записей 1, например, по 200 записей данных 2 одного параметра в каждом блоке записей 1 и сохраняет блоки записей 1 по мере их заполнения записями данных 2 в базу данных на диски 25. Причем для каждого параметра в оперативной памяти 24 выделяется место для формирования одного блока записей 1. После заполнения этого блока записей 1 записями данных 2 и сохранения его в базу данных на диски 25 занимаемое им место в памяти 24 освобождается и используется для формирования следующего блока записей 1 данного параметра. Причем запись данных 2 состоит из метки времени 4 в формате 64-битное Unix-время (8 байт), значения параметра 5 в формате float (4 байта) и дополнительной информации 6 в виде признака качества данных в соответствии со стандартом ОРС Foundation (1 байт). Кроме того, подсистема архивирования 17 формирует в оперативной памяти 24 для каждого параметра списки 13 адресов размещения блоков записей 1 , хранящих записи данных 2 со значениями данного параметра. Эти списки 13 по мере дополнения в них новой информации также сохраняются в базу данных на диски 25. Кроме того, подсистема архивирования 17 принимает запросы на поиск данных от подсистемы HMI 18, выполняет выборку запрошенных данных и передает их в подсистему HMI 18. The archiving subsystem 17 consists of two mirrored hard drives 25, a fixed area of computer RAM 24 and an archiving software component 23, which receives data from the data collection and processing subsystem 16, forms data records 2 from the received data, from which it forms blocks in RAM 24 records 1, for example, 200 data records 2 of one parameter in each block of records 1 and saves blocks of records 1 as they are filled with data records 2 in the database on disks 25. Moreover, for each parameter in RAM 24 space is allocated to form one block records 1. After filling this block of records 1 with data records 2 and saving it to the database on disks 25, the space it occupies in memory 24 is released and used to form the next block of records 1 of this parameter. Moreover, data record 2 consists of a time stamp 4 in 64-bit Unix time format (8 bytes), parameter value 5 in float format (4 bytes) and additional information 6 in the form of a data quality indicator in accordance with the OPC Foundation standard (1 byte ). In addition, the archiving subsystem 17 generates in RAM 24 for each parameter lists 13 of addresses for the placement of record blocks 1 storing data records 2 with the values of this parameter. These lists 13, as new information is added to them, are also saved to the database on disks 25. In addition, the archiving subsystem 17 receives requests for data searches from the HMI subsystem 18, retrieves the requested data and transmits them to the HMI subsystem 18.
Пример 1. Example 1.
Сохраняют в заголовок 3 блока записей 1 метку времени 4 последней записи данных 2 и адрес 8 последующего блока записей 1 , а в списке 13 для каждого параметра сохраняют структуры 14, содержащие адрес 8 и метку времени 4 последней записи данных 2, для каждого десятого блока записей 1 данного параметра в базе данных. The time stamp 4 of the last data record 2 and the address 8 of the subsequent record block 1 are stored in the header 3 of the record block, and in the list 13 for each parameter, structures 14 are stored containing the address 8 and the time stamp 4 of the last data record 2, for every tenth block of records 1 of this parameter in the database.
В этом случае, при сохранении каждого блока записей 1 в базу данных на диски 25 в его заголовок 3 заносится в качестве дополнительной информации 9 метка времени 4 его последней записи данных 2, а в заголовок 3 предыдущего блока записей 1 заноси тся адрес 8, по которому записывается данный блок записей 1. Сохранение блока записей 1 в базу данных на диски 25 выполняется в случае его заполнения записями данных 2 до полного заданного объема. Кроме того, при сохранении в базу данных на диски 25 каждого десятого блока записей 1 данного параметра в список 13 добавляют структуру 14, содержащую адрес 8 сохраняемого блока записей 1 и метку времени 4 последней записи данных 2 этого блока записей 1. In this case, when each block of records 1 is saved to the database on disks 25, in its header 3 the time stamp 4 of its last data record 2 is entered as additional information 9, and in the header 3 of the previous block of records 1 the address 8 is entered, at which this block of records 1 is written. The block of records 1 is saved to the database on disks 25 if it is filled with data records 2 to the full specified volume. In addition, when saving every tenth block of records 1 of this parameter to the database on disks 25, structure 14 is added to list 13, containing the address 8 of the record block 1 being stored and the timestamp 4 of the last data record 2 of this record block 1.
Для просмотра архивных данных в подсистеме HMI 18, например, для отображения изменения параметра на тренде за предыдущую неделю, программный компонент 26 подсистемы HMI 18 формирует запрос в подсистему архивирования 17, в котором указывается идентификатор параметра 7, а также время начала и время конца временного интервала. В данном случае началом временного интервала будет время 00:00:00.000 предыдущего понедельника, а концом - 23:59:59.999 предыдущего воскресенья. Чтобы подготовить выборку записей в этом временном интервале сначала осуществляют поиск в базе данных блока записей 1, для которого время начала заданного временного диапазона (00:00:00.000 понедельника) находится между метками времени 4 первой и последней записи данных 2. Для этого обращаются к списку 13 для заданного параметра. В этом списке находят адрес 8 последнего блока записей 1, время последней записи которого меньше заданного времени начала временного интервала. Считывают заголовок 3 найденного блока записей 1 и переходят к следующему блоку записей 1 по адресу 8, записанному в найденном блоке записей 1. Считывают его заголовок 3. Если хранящаяся в нем временная метка 4 последней записи данных 2 меньше времени начала заданного временного интервала, то по адресу 8 из заголовка 3 данного блока записей 1 переходят к следующему блоку записей 1. И так далее пока метка времени 4 последней записи данных 2 в заголовке 3 очередного блока записей 1 не будет превосходить время начала заданного временного интервала. Такая запись данных 2 считается первой найденной искомого интервала. Далее считывают все записи данных 2 данного блока записей 1 и находят среди них первую запись данных 2, временная метка 4 которой будет больше времени начала заданного временного интервала. Все записи данных 2, начиная с первой найденной и до последней данного блока записей 1, сохраняют в выборку. Далее по адресу 8 из заголовка 3 данного блока записей 1 переходят к следующему блоку записей 1. Если временная метка 4 из заголовка 3 этого блока записей 1 меньше времени конца заданного временного интервала (23:59:59.999 воскресенья), то все записи данных 2 из данного блока записей 1 извлекают и добавляют в выборку. Если временная метка 4 из заголовка 3 данного блока записей 1 превосходит время конца заданного временного интервала, то считывают все записи данных 2 данного блока записей 1, но помещаю! в выборку только те записи данных 2, метки времени 4 которых меньше конца заданного временного интервала. На этом поиск записей заканчивают и все записи данных, помещенные в выборку, передаются в программный компонент 26 подсистемы I1M1 1 , которая по полученной выборке строит изображение тренда изменения значения заданного параметра, которое затем выводится на монитор 1. Причем при формировании изображения анализируется значение признака качества, являющегося дополни тельным значением 6 каждой записи данных 2. Там, где величина этого признака не равна 192 (данные имеют качество GOOD) тренд отображается пунктирной линией. To view archived data in the HMI subsystem 18, for example, to display changes in a parameter on a trend for the previous week, the software component 26 of the HMI 18 subsystem generates a request to the archiving subsystem 17, which specifies the parameter identifier 7, as well as the start time and end time of the time interval . In this case, the start of the time interval will be 00:00:00.000 of the previous Monday, and the end will be 23:59:59.999 of the previous Sunday. To prepare a sample of records in this time interval, first search the database for record block 1, for which the start time of the specified time range (00:00:00.000 Monday) is between timestamps 4 of the first and last data record 2. To do this, access the list 13 for a given parameter. In this list, the address 8 of the last block of records 1 is found, the time of the last record of which is less than the specified start time of the time interval. Read header 3 of the found record block 1 and move to the next record block 1 at address 8, written in the found record block 1. Read its header 3. If the timestamp 4 of the last data record 2 stored in it is less than the start time of the specified time interval, then address 8 from header 3 of this block of records 1 goes to the next block of records 1. And so on until the time stamp 4 of the last data record 2 in header 3 of the next block of records 1 does not exceed the start time of the specified time interval. This data record 2 is considered to be the first one found in the required interval. Next, all data records 2 of this block of records 1 are read and the first data record 2 is found among them, the timestamp 4 of which will be greater than the start time of the specified time interval. All data records 2, starting from the first found and up to the last of this block of records 1, are saved in the sample. Next, at address 8 from header 3 of this record block 1, they move to the next record block 1. If timestamp 4 from header 3 of this record block 1 is less than the end time of the specified time interval (23:59:59.999 Sunday), then all data records 2 from of this block of records 1 is extracted and added to the selection. If timestamp 4 from header 3 of this record block 1 exceeds the end time of the specified time interval, then all data records 2 of this record block 1 are read, but put! The sample includes only those data records 2 whose timestamps 4 are less than the end of the specified time interval. At this point, the search for records ends and all data records placed in the sample are transferred to the software component 26 of the I1M1 1 subsystem, which, based on the resulting sample, builds an image of the trend of changes in the value of a given parameter, which is then displayed on monitor 1. Moreover, when forming the image, the value of the quality attribute is analyzed, which is an additional value 6 of each data record 2. Where the value of this attribute is not equal to 192 (the data has GOOD quality) the trend is shown as a dotted line.
Пример 2. Example 2.
Сохраняют в заголовок 3 блока записей 1 метку времени 4 первой записи данных 2 данного блока записей 1 и адрес 8 предыдущего блока записей 1 , а в список 13 добавляют структуру 14, содержащую только адрес 8 текущего заполняемого блока записей 1, один раз в сутки в момент наступления новых суток. The 1 timestamp 4 of the first data record 2 of this record block 1 and the address 8 of the previous record block 1 are stored in the header 3 of the record block 1, and a structure 14 is added to the list 13 containing only the address 8 of the current record block 1 to be filled, once a day at the moment the onset of a new day.
В этом случае при сохранении каждого блока записей 1 в базу данных на диски 25 его адрес 8 записывается в заголовок 3 вновь создаваемого блока записей 1. При добавлении во вновь создаваемый блок записей 1 первой записи данных 2 ее метка времени 4 записывается в заголовок 3 данного блока записей 1 в качестве дополнительной информации 9. In this case, when each record block 1 is saved to the database on disks 25, its address 8 is written to header 3 of the newly created record block 1. When the first data record 2 is added to the newly created record block 1, its timestamp 4 is written to header 3 of this block 1 entries as additional information 9.
Так же, как и в Примере 1 для просмотра в подсистеме HMI 18 изменения параме тра на тренде за предыдущую неделю, программный компонент 26 подсистемы 1 ГМ1 18 формирует запрос в подсистему архивирования 17, в котором указан идентификатор параметра 7, а также время начала и время конца временного интервала: 00:00:00.000 предыдущего понедельника и 23:59:59.999 предыдущего воскресенья. В этом случае, чтобы подготовить выборку записей данных 2, сначала находят в базе данных блок записей 1, для которого время конца заданного временного диапазона (23:59:59.999 воскресенья) расположен между метками времени 4 первой и последней записи данных 2. Для этого применяют список 13 адресов 8 для заданного параметра. Поскольку записи в этот список 13 заносят раз в сутки, то порядковый номер каждой записи определяет время с точностью до суток при условии, что известна дата первой записи. Например, к началу заданного поискового временного интервала система работала уже 1 год и 2 недели. Тогда адрес 8 блока записей 1, который заполнялся на момент начала заданного временного интервала, находится в списке 13 адресов на 379 месте (365 - один год и 14 - две педели), а адрес 8 блока записей 1, который заполнялся в момент конца заданного временного интервала находится на 386 месте (на неделю позже). Поэтому считывают 386-й адрес в списке 13 адресов и переходят к блоку записей 1 по этому адресу 8. Считывают все записи данных 2 из данного блока записей 1. Все записи данных 2, метка времени 4 которых меньше времени конца заданного временного интервала, извлекают и помещают в выборку. Далее переходят по адресу 8 из заголовка 3 данного блока записей 1 к предыдущему блоку записей 1. Считывают из предыдущего блока записей 1 записи данных 2. Если метка времени 4 в заголовке 3 данного блока записей 1 больше времени начала заданного временного интервала, то все записи данных 2 данного блока записей 1 извлекают и помещают в выборку. В противном случае, в выборку помещают только тс записи данных 2, метка времени 4 которых больше времени начала заданного временного интервала. На этом формирование выборки заканчивается, и она передается программному компоненту 26 подсистемы HMI 18. Just as in Example 1, to view in the HMI subsystem 18 changes in the parameter on the trend for the previous week, the software component 26 of the subsystem 1 GM1 18 generates a request to the archiving subsystem 17, which specifies the identifier of parameter 7, as well as the start time and time the end of the time interval: 00:00:00.000 of the previous Monday and 23:59:59.999 of the previous Sunday. In this case, to prepare a sample of data records 2, first find in the database a block of records 1 for which the end time of the specified time range (23:59:59.999 Sunday) is located between timestamps 4 of the first and last data record 2. For this, use list of 13 addresses 8 for a given parameter. Since entries in this list 13 are entered once a day, the serial number of each entry determines the time accurate to the day, provided that the date of the first entry is known. For example, by the beginning of the specified search time interval, the system had already been operating for 1 year and 2 weeks. Then address 8 of record block 1, which was filled at the beginning of a given time interval, is in the list of 13 addresses in 379th place (365 - one year and 14 - two weeks), and address 8 of record block 1, which was filled at the end of the specified time interval interval is in 386th place (a week later). Therefore, the 386th address in the list of 13 addresses is read and goes to record block 1 at this address 8. All data records 2 from this record block 1 are read. All data records 2 whose timestamp 4 is less than the end time of the specified time interval are retrieved and placed in sample. Next, they go to address 8 from header 3 of this record block 1 to the previous record block 1. Read data records 2 from the previous record block 1. If time stamp 4 in header 3 of this record block 1 is greater than the start time of the specified time interval, then all data records 2 of a given block of records 1 are extracted and placed in the sample. Otherwise, only data records 2 whose timestamp 4 is greater than the start time of the specified time interval are placed in the sample. This completes the sampling, and it is transferred to the software component 26 of the HMI 18 subsystem.
Пример 3. Example 3.
Сохраняют в заголовок 3 блока записей 1 адрес 8 последующего блока записей 1 , а также дополнительную информацию 9, включающую метки времени 4 первой и последней записей данных 2 данного блока записей 1 и адрес 8 предыдущего блока записей 1. При этом список 13 хранит структуры 14, включающие адрес 8 блока записей 1 и временные метки 4 его первой и последней записей данных 2. The address 8 of the subsequent record block 1 is stored in the header 3 of the record block 1, as well as additional information 9, including the timestamps 4 of the first and last data records 2 of this record block 1 and the address 8 of the previous record block 1. In this case, the list 13 stores structures 14, including the address 8 of record block 1 and the timestamps 4 of its first and last data records 2.
В этом случае при сохранении блока записей 1 в базу данных на диски 25 в его заголовок 3 записывают адрес 8 вновь создаваемого (последующего для сохраняемого) блока записей 1 и метка времени 4 последней записи сохраняемого блока записей 1 . При этом в заголовок 3 вновь созданного блока записей 1 записывается адрес 8 сохраняемого блока записей и метка времени 4 первой записи данных 2 при ее добавлении в новый блок записей 1. In this case, when saving a record block 1 to the database on disks 25, the address 8 of the newly created (subsequent to the saved) record block 1 and the timestamp 4 of the last record of the saved record block 1 are written into its header 3. In this case, the address 8 of the saved record block and the timestamp 4 of the first data record 2 when it is added to the new record block 1 are written into the header 3 of the newly created record block 1.
Подсистема HMI 18 запрашивает данные по параметру за предыдущую педелю. Подсистеме HMI 18 была передана извлеченная выборка записей данных 2. Однако, после получения выборки записей данных 2 для отображения тренда, оператор изменил масштаб временной оси тренда, для чего потребовалось добавить данные еще за три дня до времени начала временного интервала предыдущего запроса и два дня после конца интервала предыдущего запроса. В этом случае требуется добавить данные в уже полученную выборку. Причем как после, так и до заданного временного интервала. Для этого выполняют две дополнительные выборки. Первая, для получения записей данных от времени конца начального интервала времени (23:59:59.999 предыдущего воскресенья) до 23:59:59.999 вторника текущей недели. Для этого используют механизм, описанный в Примере 1. Сначала посредством списка 13 находят адрес блока записей 1 , соответствующего времени начала временного интервала данной выборки (23:59:59.999 предыдущего воскресенья). При этом используют временные метки 4 первой и последней записей данных 2 из структур 14 списка 13. Считывают, по найденному таким образом адресу 8, блок записей 1. Если метка времени 4 последней записи данных 2 в заголовке 3 меньше времени конца временного интервала (23:59:59.999 вторника текущей недели), то выбирают из считанного блока записей 1 все записи данных 2, метки времени 4 которых больше времени начала временного интервала, извлекают их в выборку и далее считывают блок записей 1, находящийся по адресу 8 последующего блока записей 1 из заголовка 3. Если метка времени 4 последней записи данных 2 в заголовке 3 данного (последующего) блока записей 1 меньше времени конца интервала времени, то все записи данных 2 этого блока записей 1 извлекают и сохраняют в выборку. Повторяют указанные операции до тех пор, пока метка времени 4 последней записи 2 очередного блока записей 1 не будет больше времени конца заданного интервала. В этом случае в выборку сохраняют только те записи данных 2 из последнего считанного блока записей 1 , метка времени 4 которых меньше времени конца заданного интервала. На этом заполнение первой дополнительной выборки завершают. Если же значение метки времени 4 последней записи 2 первого считанного блока записей 1 превосходит время конца заданного временного интервала, то в выборку помещают записи данных 2 этого блока записей 1 , временные метки 4 которых попадают в заданный интервал времени и перехода к другим блокам записей 1 не выполняют. The HMI 18 subsystem requests parameter data for the previous week. The HMI subsystem 18 was given the extracted sample of data records 2. However, after receiving the sample of data records 2 to display the trend, the operator changed the scale of the trend time axis, which required adding data three more days before the start time of the previous request time interval and two days after end of the previous request interval. In this case, you need to add data to the already obtained selection. Moreover, both after and before a given time interval. To do this, two additional samples are performed. The first is to obtain data records from the end time of the initial time interval (23:59:59.999 of the previous Sunday) to 23:59:59.999 of the Tuesday of the current week. To do this, use the mechanism described in Example 1. First, using list 13, find the address of record block 1 corresponding to the start time of the time interval of this sample (23:59:59.999 of the previous Sunday). In this case, the timestamps 4 of the first and last data records 2 from the structures 14 of the list 13 are used. Read, according to the one found in this way address 8, record block 1. If the time stamp 4 of the last data record 2 in header 3 is less than the end time of the time interval (23:59:59.999 Tuesday of the current week), then select from the read record block 1 all data records 2, the timestamps of which 4 greater than the start time of the time interval, extract them into the sample and then read record block 1, located at address 8 of the subsequent record block 1 from header 3. If time stamp 4 of the last data record 2 in header 3 of this (subsequent) record block 1 is less than the end time time interval, then all data records 2 of this block of records 1 are retrieved and stored in the sample. The specified operations are repeated until the time stamp 4 of the last record 2 of the next block of records 1 is greater than the end time of the specified interval. In this case, only those data records 2 from the last read block of records 1 are saved in the sample, the timestamp 4 of which is less than the end time of the specified interval. This completes the filling of the first additional sample. If the value of the time stamp 4 of the last record 2 of the first read block of records 1 exceeds the end time of the specified time interval, then the data records 2 of this block of records 1 are placed in the sample, the timestamps 4 of which fall within the specified time interval and there is no transition to other blocks of records 1 perform.
Для формирования второй дополнительной выборки применяют последовательность действий, описанную в Примере 2, когда выполняют переход по адресу 8 предыдущего блока записей 1 из заголовка 3 текущего блока записей 1 , и сравнивают значение метки времени 4 первой записи данных 2 с временем начала заданного временного интервала для определения последнего считываемого блока записей 1 для формирования выборки. В данном случае делают выборку записей данных 2, временные метки 4 которых находятся в диапазоне от 00:00:00.000 пятницы предшествующей предыдущей педели до 00:00:00.000 предыдущего понедельника. Посредством списка 13 определяют адрес блока записей 1, соответствующего времени конца временного интервала второй выборки (00:00:00.000 предыдущего понедельника). Для этого используют временные метки 4 первой и последней записей данных 2 из структур 14 списка 13. Счи тывают но найденному таким образом адресу 8 блок записей 1. Если значение метки времени 4 первой записи данных этого блока записей 1 меньше времени начала заданного временного интервала, то выбирают из блока записей 1 записи данных 2, чьи временные метки 4 попадают в заданный временной интервал, извлекают и помещают их в выборку и завершают поиск. Если значение метки времени 4 первой записи данных 2 этого блока записей 1 больше времени начала заданного временного интервала 4, то помещают в выборку все записи данных 2, временные метки 4 которых меньше времени конца заданного временного интервала и считывают предыдущий блок записей 1 по адресу 8 из заголовка 3 данного блока записей 1. Если метка времени 4 первой записи данных 2 больше времени начала заданного временного интервала, то все записи данных 2 этого блока записей 1 извлекают и помещают в выборку и выполняют переход к считыванию предыдущего по времени блока записей 1. Выполняют данные операции до тех пор, пока метка времени 4 очередного считанного блока записей 1 не будет меньше времени начала заданного временного интервала. В этом случае в выборку сохраняют только те записи данных 2, метки времени 4 которых больше времени начала заданного интервала времени и формирование выборки на этом завершают. To form a second additional sample, use the sequence of actions described in Example 2, when you go to address 8 of the previous block of records 1 from header 3 of the current block of records 1, and compare the value of timestamp 4 of the first data record 2 with the start time of the specified time interval to determine last read block of records 1 to form a sample. In this case, a selection is made of data records 2, the timestamps 4 of which are in the range from 00:00:00.000 Friday of the previous week to 00:00:00.000 of the previous Monday. Using list 13, the address of record block 1 is determined, corresponding to the end time of the time interval of the second sample (00:00:00.000 of the previous Monday). For this, time stamps 4 of the first and last data records 2 from structures 14 of list 13 are used. Address 8 of record block 1 is read from the address 8 found in this way. If the value of timestamp 4 of the first data record of this record block 1 is less than the start time of the specified time interval, then select from record block 1 data records 2 whose timestamps 4 fall within a given time interval, extract and place them in the sample, and complete the search. If the value of timestamp 4 of the first data record 2 of this block of records 1 is greater than the start time of the specified time interval 4, then it is placed in fetch all data records 2 whose timestamps 4 are less than the end time of the specified time interval and read the previous record block 1 at address 8 from header 3 of this record block 1. If the timestamp 4 of the first data record 2 is greater than the start time of the specified time interval, then all data records 2 of this block of records 1 are extracted and placed in the sample and the transition to reading the previous block of records 1 is performed. These operations are performed until the time stamp 4 of the next read block of records 1 is less than the start time of the specified time interval. In this case, only those data records 2 are saved in the sample, the timestamps 4 of which are greater than the start time of the specified time interval, and the formation of the sample is completed.
Полученные две дополнительные выборки записей данных 2 передаются в подсистему HMI 18 для доработки недостающих фрагментов тренда. The resulting two additional samples of data records 2 are transferred to the HMI 18 subsystem to complete the missing trend fragments.
Благодаря наличию в заголовке 3 блока записей 1 адресов 8 как предыдущего, гак и последующего блока записей 1, а также меток времени 4 как первой, так и последней записи данных 2 получена возможность делать выборки записей данных 2 как вперед, гак и назад по времени, в зависимости от того, как удобнее в конкретном случае. Due to the presence in the header 3 of the block of records 1 of addresses 8 of both the previous, the same and the subsequent block of records 1, as well as time stamps 4 of both the first and last data record 2, it is possible to make samples of data records 2 both forward, backward and backward in time, depending on what is more convenient in a particular case.

Claims

ФОРМУЛА ИЗОБРЕТЕНИЯ CLAIM
1. Способ хранения данных, включающий прием данных от источника данных, сохранение данных в виде записей данных в памяти компьютера, при этом каждая запись данных содержит метку времени, связанную с моментом создания данных, и значение параметра, формирование в памяти компьютера из записей данных блоков записей одинакового размера, при этом в одном блоке записей могут находиться записи данных только одного параметра, присвоение блоку записей заголовка, включающего идентификатор параметра и адрес, и сохранение сформированного блока записей в базу данных на машиночитаемый носитель, формирование и сохранение в базе данных списка адресов блоков записей для каждого параметра. 1. A method of storing data, including receiving data from a data source, storing the data in the form of data records in computer memory, with each data record containing a time stamp associated with the moment of data creation and a parameter value, forming blocks from data records in computer memory records of the same size, while one block of records can contain data records of only one parameter, assigning a header to the block of records, including the parameter identifier and address, and saving the generated block of records to the database on a machine-readable medium, generating and saving a list of block addresses in the database entries for each parameter.
2. Способ по п.1, в котором заголовок блока записей включает адрес последующего блока записей. 2. The method of claim 1, wherein the record block header includes the address of a subsequent record block.
3. Способ по п.1, в котором заголовок блока записей включает адрес предыдущего блока записей. 3. The method of claim 1, wherein the record block header includes the address of the previous record block.
4. Способ по п.1, в котором заголовок блока записей включает адрес предыдущего и последующего блока записей. 4. The method of claim 1, wherein the record block header includes the address of the previous and subsequent record block.
5. Способ по п.1, в котором заголовок блока записей включает метку времени первой записи данных в блоке записей и/или последней записи данных в блоке записей. 5. The method of claim 1, wherein the record block header includes a timestamp of the first data record in the record block and/or the last data record in the record block.
6. Способ по п.1, в котором сохраняют записи данных в блоке записей в порядке возрастания меток времени. 6. The method of claim 1, wherein data records are stored in the record block in ascending order of timestamps.
7. Способ по п.1, в котором список адресов блоков записей содержит метки времени. 7. The method of claim 1, wherein the list of record block addresses contains timestamps.
8. Способ по п.7, в котором список содержит для каждого адреса метку времени первой записи данных и/или метку времени последней записи данных блока записей по данному адресу. 8. The method according to claim 7, wherein the list contains, for each address, a timestamp of the first data record and/or a timestamp of the last data record of a block of records at a given address.
9. Способ по п.1, в котором в качестве машиночитаемого носителя может быть использована оперативная память компьютера. 9. The method according to claim 1, in which computer RAM can be used as a machine-readable medium.
10. Способ извлечения данных, сохраненных способом по п.1, включающий введение поискового запроса для заданного параметра и заданного временного интервала, поиск в списке адресов блоков записей и адресов из заголовков блоков записей адреса блока записей, содержащего первую по времени запись данных параметра из заданного временного интервала, считывание записей данных из найденного блока записей, начиная с первой записи данных, метка времени которой больше времени начала заданного интервала времени, с переходом к последующим блокам записей по адресам из заголовков блоков записей, до блока записей, в котором содержится запись данных, метка времени которой превосходит время конца заданного интервала, извлечение записей данных с метками времени, которые попали в заданный интервал времени. 10. A method for retrieving data saved by the method according to claim 1, including entering a search query for a given parameter and a given time interval, searching in the list of addresses of record blocks and addresses from the headers of record blocks for the address of a record block containing the first time record of parameter data from a given time interval, reading data records from the found record block, starting with the first data record whose timestamp is greater than the start time of the specified time interval, moving to subsequent record blocks at the addresses from the record block headers, up to the record block that contains the data record, timestamp which exceeds the end time of a given interval, retrieving data records with timestamps that fell within a given time interval.
11. Способ извлечения данных по п. 10, в котором по списку адресов и адресам из заголовков блоков записей находят блок записей, содержащий последнюю запись данных, метка времени которой не превосходит времени конца интервала, и считывают записи данных с переходом к предыдущим блокам записей по адресам из заголовков блоков записей, до блока записей, в котором содержится первая запись данных, метка времени которой меньше времени начала заданного временного интервала, извлечение записей данных с метками времени, которые попали в заданный интервал времени. 11. The method for retrieving data according to claim 10, in which, using the list of addresses and addresses from the headers of record blocks, they find a block of records containing the last data record, the time stamp of which does not exceed the end of the interval, and read the data records with a transition to the previous blocks of records according to addresses from the record block headers, up to the record block containing the first data record whose timestamp is less than the start time of the specified time interval, retrieving data records with timestamps that fall within the specified time interval.
PCT/RU2023/000095 2022-04-11 2023-03-30 Data storage method and data extraction method WO2023200361A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
RU2022109631 2022-04-11
RU2022109631A RU2793082C1 (en) 2022-04-11 Method of storing and retrieval of data

Publications (1)

Publication Number Publication Date
WO2023200361A1 true WO2023200361A1 (en) 2023-10-19

Family

ID=88330108

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/RU2023/000095 WO2023200361A1 (en) 2022-04-11 2023-03-30 Data storage method and data extraction method

Country Status (1)

Country Link
WO (1) WO2023200361A1 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6651030B2 (en) * 2001-06-22 2003-11-18 Invensys Systems Inc. Method and system for collecting and retrieving time-series, real-time and non-real-time data
US20080208890A1 (en) * 2007-02-27 2008-08-28 Christopher Patrick Milam Storage of multiple, related time-series data streams
US20180067995A1 (en) * 2016-09-02 2018-03-08 Hitachi, Ltd. Sensor Data Search System, Sensor Data Search Method and Management Computer

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6651030B2 (en) * 2001-06-22 2003-11-18 Invensys Systems Inc. Method and system for collecting and retrieving time-series, real-time and non-real-time data
US20080208890A1 (en) * 2007-02-27 2008-08-28 Christopher Patrick Milam Storage of multiple, related time-series data streams
US20180067995A1 (en) * 2016-09-02 2018-03-08 Hitachi, Ltd. Sensor Data Search System, Sensor Data Search Method and Management Computer

Similar Documents

Publication Publication Date Title
US7092975B2 (en) Methods and apparatus for management of data storage resources
CN100386755C (en) Method and system for collecting and retrieving time-series, real-time and non-real-time data
EP0599466B1 (en) Apparatus and method for managing picture data
US6964040B2 (en) Optimizing storage and retrieval of monitoring data
US5519861A (en) Sampled data storage and editing system for the time series data being displayed according to collection location
CN111339103B (en) Data exchange method and system based on full-quantity fragmentation and incremental log analysis
US20160012016A1 (en) Data Visualization Methods, Data Visualization Devices, Data Visualization Apparatuses, and Articles of Manufacture
US7885933B2 (en) Apparatus and system for analyzing computer events recorded in a plurality of chronicle datasets
CN111143422A (en) Data retrieval method, data retrieval device, storage medium, and electronic device
RU2793082C1 (en) Method of storing and retrieval of data
WO2023200361A1 (en) Data storage method and data extraction method
JP3153094B2 (en) Manufacturing process control device
CN113115069A (en) Video storage method and system of automobile data recorder
JP2880849B2 (en) Plant operation information management device
JP3379674B2 (en) Plant monitoring and control equipment
JPH06214637A (en) History data processor
CN117591497B (en) Nuclear power historical data cross-system migration method
CN111522900B (en) Automatic analysis method, system, equipment and storage medium for unstructured data
US20230056433A1 (en) Data management device and program
CN113326189A (en) Method, system and equipment for tracking submission of introduced defects
McCamish et al. A data driven framework for real time power system event detection and visualization
JPH11339173A (en) Data management device and recording medium
JPS62116032A (en) Picture display system
CN117910970A (en) Power grid information management system based on knowledge graph
CN116483873A (en) Method for realizing historical snapshot data query based on change data

Legal Events

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

Ref document number: 23788673

Country of ref document: EP

Kind code of ref document: A1