RU2793082C1 - Method of storing and retrieval of data - Google Patents

Method of storing and retrieval of data Download PDF

Info

Publication number
RU2793082C1
RU2793082C1 RU2022109631A RU2022109631A RU2793082C1 RU 2793082 C1 RU2793082 C1 RU 2793082C1 RU 2022109631 A RU2022109631 A RU 2022109631A RU 2022109631 A RU2022109631 A RU 2022109631A RU 2793082 C1 RU2793082 C1 RU 2793082C1
Authority
RU
Russia
Prior art keywords
data
record
records
block
address
Prior art date
Application number
RU2022109631A
Other languages
Russian (ru)
Inventor
Алексей Александрович Брызгалов
Original Assignee
Общество с ограниченной ответственностью "АВАДС СОФТ" (ООО "АВАДС СОФТ")
Filing date
Publication date
Application filed by Общество с ограниченной ответственностью "АВАДС СОФТ" (ООО "АВАДС СОФТ") filed Critical Общество с ограниченной ответственностью "АВАДС СОФТ" (ООО "АВАДС СОФТ")
Application granted granted Critical
Publication of RU2793082C1 publication Critical patent/RU2793082C1/en
Priority to PCT/RU2023/000095 priority Critical patent/WO2023200361A1/en

Links

Images

Abstract

FIELD: storing and retrieving data obtained from various data sources.
SUBSTANCE: data storage method is comprised of receiving data from a data source, storing data in form of data records in the computer memory, each data record contains a time stamp associated with the moment of data creation and a parameter value, formed in the computer memory from the data records of blocks of records of the same size, while in one record block there can be 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 medium, generating and saving in the database a list of addresses of record blocks for each parameter.
EFFECT: increase of the speed of lossless data recording and reduction of time required to retrieve the necessary data.
11 cl, 5 dwg, 3 ex

Description

Область техникиTechnical field

Настоящее изобретение в целом относится к способам хранения данных и, в частности, к сбору и извлечению данных, полученных от различных источников данных.The present invention generally relates to methods for storing data and, in particular, to the collection and retrieval of data obtained from various data sources.

Технологический процесс производства все больше зависит от систем сбора данных и использования их с целью повышения эффективности технологического процесса и уменьшения затрат на его обслуживание.The manufacturing process is increasingly dependent on data acquisition systems and their use to improve process efficiency and reduce maintenance costs.

Большинство технологических процессов автоматизированы и работу оборудования отслеживают датчики, информация с которых поступает в систему хранения и обработки данных.Most of the 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 a 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 knows such data archiving systems as SQL Server (Microsoft), archiving systems developed by Wonderware (https://www.wonderware.com), SIEMENS

(https://new.siemens.com/ru/nVprodukty/avtomatizacia/raspredelerm upravleniya/simatic-pcs-7/arhivaciya-dannyh-processa-i-otchetnost.html) и др.(https://new.siemens.com/ru/nVprodukty/avtomatizacia/raspredelerm upravleniya/simatic-pcs-7/arhivaciya-dannyh-processa-i-otchetnost.html), etc.

Однако указанные системы (архивы) являются сложными и ресурсоемкими, имеют определенную скорость получения данных из архива, которая не всегда отвечает задачам предприятия и, кроме того, они являются дорогостоящими продуктами и не каждое предприятие может позволить себе установить указанные системы хранения данных.However, these systems (archives) are complex and resource-intensive, have a certain speed of obtaining data from the archive, which does not always meet the tasks of the enterprise, and, moreover, they are expensive products and not every enterprise can afford to install these data storage systems.

Наиболее близким аналогом способа сбора и извлечения данных является способ, описанный в патенте US6651030, кл. G06F 15/177, опубликованном 18.11.2003. Запатентованный способ сбора данных включает прием данных от источников данных, сохранение данных в виде записей в файл данных с отметкой времени создания данных и запись файла заголовка, который связывает интервал времени с теми записями в файлах данных, временные метки которых попадают в интервал времени. Способ извлечения записей данных включает выбор интересующего временного интервала, доступ к файлу заголовка, который связывает интересующий временной интервал с записями данных, временные метки которых попадают в интересующий интервал, извлечение записей данных на основе меток времени записей данных.The closest analogue of the method of collecting and extracting data is the method described in US6651030, cl. G06F 15/177 published 11/18/2003. The patented method of collecting data includes receiving data from data sources, storing the data as records in a data file with a data creation time stamp, and writing a header file that associates a time interval with those records in the data files whose timestamps fall within the time interval. The method for extracting data records includes selecting a time interval of interest, accessing a header file that associates the time interval of interest with data records whose timestamps fall within the interval of interest, extracting data records based on the timestamps of the data records.

Недостатком указанных способов является запись собранных данных в файл данных без разделения данных по параметрам, что увеличивает время записи данных и время извлечения данных по определенному параметру.The disadvantage of these methods is the recording of the collected data in a data file without dividing the data by parameters, which increases the data recording time and the data retrieval time for a specific parameter.

Сущность изобретенияThe essence of the invention

Заявляемое техническое решение устраняет указанные недостатки аналога.The proposed 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 required to retrieve the necessary data.

Указанный технический результат получают за счет создания способа хранения данных, включающего прием данных от источника данных, сохранение данных в виде записей данных в памяти компьютера, при этом каждая запись данных содержит метку времени, связанную с моментом создания данных, и значение параметра, формирование в памяти компьютера из записей данных блоков записей одинакового размера, при этом в одном блоке записей могут находиться записи данных только одного параметра, присвоение блоку записей заголовка, включающего идентификатор параметра и адрес, и сохранение сформированного блока записей в базу данных на машиночитаемый носитель, формирование и сохранение в базе данных списка адресов блоков записей для каждого параметра.The specified technical result is obtained by creating a method for storing data, including receiving data from a data source, storing data in the form of data records in computer memory, each data record contains a timestamp 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 medium, forming and saving in record block address list database 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 particular 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 the timestamp of the first data record in the record block and/or the timestamp of the last data record in the record block and other service information.

Сохраняют записи данных в блоке записей в порядке возрастания меток времени. Запись данных содержит дополнительную информацию.The data records are stored in the record block in ascending order of timestamps. The data record contains additional information.

Список адресов блоков записей содержит метки времени. При этом для каждого адреса из списка хранится метка времени первой записи данных и/или метка времени последней записи данных блока записей по данному адресу.The record block address list contains timestamps. In this case, for each address from the list, the timestamp of the first data record and/or the timestamp of the last data record of the block of records at the given address is stored.

В качестве машиночитаемого носителя может быть использована память компьютера.Computer memory may be used as the computer-readable medium.

Указанный технический результат получают так же за счет способа извлечения данных, включающего введение поискового запроса для заданного параметра и заданного временного интервала, поиск в списке адресов блоков записей и адресов из заголовков блоков записей адреса блока записей, содержащего первую по времени запись данных параметра из заданного временного интервала, считывание записей данных из найденного блока записей, начиная с первой записи данных, метка времени которой больше времени начала заданного интервала времени, с переходом к последующим блокам записей по адресам из заголовков блоков записей, до блока записей, в котором содержится запись данных, метка времени которой превосходит время конца заданного интервала, извлечение записей данных с метками времени, которые попали в заданный интервал времени.The specified technical result is also obtained due to the method of extracting data, including the introduction of a search query for a given parameter and a given time interval, searching in the list of addresses of blocks of records and addresses from the headers of blocks of records of the address of a block of records containing the first record of parameter data from a given time interval. interval, reading data records from the found record block, starting from the first data record, the timestamp of which is greater than the start time of the specified time interval, with the transition to subsequent blocks of records at addresses from the headers of the record blocks, to the record block that contains the data record, the label time exceeds the end time of the specified interval, extracting data records with timestamps that fall within the specified time interval.

В частном случае выполнения способа извлечения данных по списку адресов и адресам из заголовков блоков записей находят блок записей, содержащий последнюю запись данных, метка времени которой не превосходит времени конца интервала, и считывают записи данных с переходом к предыдущим блокам записей по адресам из заголовков блоков записей, до блока записей, в котором содержится первая запись данных, метка времени которой меньше времени начала заданного временного интервала, извлечение записей данных с метками времени, которые попали в заданный интервал времени.In a particular case of performing a method for extracting data by a list of addresses and addresses from the headers of record blocks, a record block is found containing the last data record, the timestamp of which does not exceed the time of the end of the interval, and the data records are read with a transition to previous blocks of records by addresses from the headers of the record blocks , up to the block of records that contains the first data record whose timestamp is less than the start time of the specified time interval, extracting data records with timestamps that fall within the specified time interval.

Указанные формы представления записей данных, формирование из них блоков записей, сохранения блоков записей в базу данных, позволяет быстро и надежно отыскать все записи по нужному параметру за заданный интервал времени, не перебирая все блоки записей данных, записанных в базу данных, а по поисковому запросу выявить нужный блок записей и из него получить запись о запрашиваемом параметре. Это значительно увеличивает скорость сохранения записей в базу данных и сокращает время поиска нужного параметра и надежность поиска без пропусков искомых данных.The specified forms of presentation of data records, the formation of blocks of records from them, saving blocks of records to the database, allows you to quickly and reliably find all records by the desired parameter for a given time interval, without going through all the blocks of data records recorded in the database, but by 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 to the database and reduces the search time for the desired parameter and the reliability of the search without missing the required data.

Следует отметить, что термин «параметр» означает здесь значение какой-либо физической величины (например, давление или температура в реакторе, уровень жидкости в емкости, концентрация СО2 и пр.), измеренной и представленной в цифровом виде или полученной на основе значений других параметров.It should be noted that the term "parameter" here means the value of some physical quantity (for example, pressure or temperature in the reactor, liquid level in the vessel, CO 2 concentration, etc.), measured and presented in digital form or obtained on the basis of the values of other parameters.

Термин «запись данных» означает здесь конечную форму представления информации о значении параметра с меткой времени его получения.The term "data record" means here the final form of presenting information about the value of a parameter with a timestamp of its receipt.

Термин «блок записей» означает здесь набор записей одного и того же параметра, отсортированных по времени в их временных метках, причем набор записей имеет фиксированный размер, одинаковый для всех параметров.The term "block of records" means here a set of records of the same parameter, sorted by time in their timestamps, and the record set has a fixed size, the same for all parameters.

Термин «база данных» означает здесь набор блоков записей разных параметров и списки адресов блоков записей каждого параметра, которые могут содержать метки времени первой и/или последней записи блока записей, сохраненных на машиночитаемый носитель и/или память компьютера.The term "database" here means a set of record blocks of different parameters and address lists of record blocks 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 the drawings

Заявляемое техническое решение может быть проиллюстрировано следующими фигурами чертежей, гдеThe claimed technical solution can be illustrated by the following figures of the drawings, where

на фиг. 1 схематически показана форма представления сохраняемой информации. Так блок записей 1 включает записи данных 2 и заголовок 3 блока записей. Запись данных 2 содержит метку времени 4, значение параметра 5 и может факультативно содержать дополнительные данные 6 записи данных, такие как, например, признак качества данных в соответствии со стандартом ОРС Foundation. Важной составляющей блока записей 1 является его заголовок 3, который в свою очередь включает идентификатор параметра 7, адрес 8 предыдущего или последующего блока записей этого параметра и может содержать дополнительную информацию 9. Такой дополнительной информацией может быть, например, метки времени 4 первой и/или последней записи данных 2 в блоке записей 1, адрес предыдущего или последующего блока записей, дополняющий адрес 8, чтобы хранить в заголовке 3 адреса, как предыдущего, так и последующего блока записей. Такая форма представления сохраняемой информации позволяет быстро, без перебора всех сохраненных блоков записей, по заголовку блока записей выделить нужный блок и найти в нем запись данных искомого параметра.in fig. 1 schematically shows the form of representation of the stored information. So record block 1 includes data records 2 and header 3 of the record block. The data record 2 contains a timestamp 4, a parameter value 5 and may optionally contain additional data record 6 such as, for example, a data quality indication according to the OPC Foundation standard. An important component of record block 1 is its header 3, which in turn includes parameter identifier 7, address 8 of the previous or subsequent record block of this parameter, and may contain additional information 9. Such additional information can be, for example, timestamps 4 of the first and/or of 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 enumeration of all saved blocks of records, by the header of the block of records, select the desired 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.In FIG. 2 shows a special case of a system for storing blocks of records of one parameter, which shows the placement in the address space of the database of three blocks of records 1 following in a row in time. 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 block of records that follows in time. Thus, the first block of records 1 is located at address 10, the second block of records is located at address 11, and the third block is located at address 12. From FIG. Figure 2 shows that header 3 of the first record block 1 stores address 11 of the second (subsequent in time) record block 1, and the second record block 1 in its header 3 stores address 12 of the third record block 1.

На фиг. 3 представлен еще один частный случай системы сохранения блоков записей 1 одного параметра, когда заголовок 3 блока записей 1 содержит адрес предыдущего по времени блока записей. Здесь, так же, как и на фиг. 2, представлены три следующих подряд по времени блока записей 1. Из фиг. 3 видно, что заголовок 3 последнего блока записей 1 хранит адрес 11 второго блока записей 1 (предыдущего по времени), который в своем заголовке 3 хранит адрес 10 первого по времени из представленных на фиг. 3 блока записей 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, just as in Fig. 2, three successive blocks of records 1 are shown. From FIG. 3 it can be seen that the header 3 of the last block of 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 of those shown in FIG. 3 blocks of records 1. This structure of the relationship of blocks of records allows you to quickly retrieve all the data on the parameter for any time interval.

На фиг. 4 схематично представлен частный случай выполнения списка 13, который содержит структуры 14, где каждая структура 14 состоит из адреса 8 блока записей 1 и меток времени 4 первой и последней по времени записи данных 2 в данном блоке записей 1. Наличие такого списка 13 позволяет очень быстро находить блок записей 1, хранящий записи данных 2, на заданный момент времени без сканирования всех блоков записей базы данных.In FIG. 4 schematically shows a particular case of list 13 execution, which contains structures 14, where each structure 14 consists of address 8 of record block 1 and timestamps 4 of the first and last data record 2 in this record block 1. The presence of such a list 13 allows very fast find record block 1, which stores 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. 5 is a schematic representation of a 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. The software components 21, 23, and 26 of these subsystems operate on the same computer 15. All the following examples of the execution of the saving method and data retrieval are considered for the system depicted in FIG. 5.

Подробное раскрытие изобретенияDetailed disclosure of the invention

Информация о состоянии функционирования различных устройств производства представляет собой огромный объем данных. Такие большие объемы данных должны быть сохранены в хронологическом порядке и возникают проблемы в хранении данных реального времени. Временный выход из строя отдельных устройств вносит свои неудобства, т.к. часть информации может быть пропущена в таком потоке сохранения данных. Возникает необходимость в надежном и скоростном способе архивирования и извлечения данных, который позволит быстро принять верное решение и, таким образом, увеличить производительность работы оборудования предприятия или подготовить отчет с актуальной информацией.Information about the state of operation of various production devices is a huge amount of data. Such large amounts of data must be stored in chronological order and there are problems in storing real-time data. Temporary failure of individual devices brings its own inconvenience, because. some information may be omitted in such a data storage stream. 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 the equipment of the enterprise or prepare a report with up-to-date information.

Заявляемое техническое решение может применяться в системах промышленной автоматизации (АСУТП, АСУЭ, и др.), системах коммерческого и технического учета (АСКУЭ, АСТУЭ, и др.), а также в системах диспетчеризации промышленных объектов, объектов ЖКХ и в автоматизации зданий.The claimed technical solution can be used in industrial automation systems (PCS, ASUE, etc.), commercial and technical accounting systems (ASKUE, ASTUES, etc.), as well as in dispatching systems for industrial facilities, housing and communal services and in building automation.

История изменения во времени каждого параметра сохраняется в виде записей данных 2 (фиг. 1), содержащих значение параметра 5, метку времени 4 (реального времени), связанную с моментом получения значения параметра 5 и может содержать набор дополнительной (служебной) информации 6, если таковая требуется. Например, запись может содержать метку времени размером 8 байт (64-битное Unix-время), значение параметра 5 в формате числа с плавающей точкой - 4 байта, а в качестве дополнительной (служебной) информации 6 может быть использован, например, признак качества в соответствии со стандартом ОРС Fondation. Такое построение записи данных 2 позволяет выстраивать записи данных в последовательности по их меткам времени 4. Дополнительные данные 6 позволяют в дальнейшем при анализе данных учитывать их достоверность.The history of change in time of each parameter is stored in the form of data records 2 (Fig. 1), containing the value of parameter 5, the time stamp 4 (real time) associated with the moment of obtaining the value of parameter 5 and may contain a set of additional (service) information 6 if one is required. For example, a record may contain a timestamp of 8 bytes (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 indicator in in accordance with the OPC Fondation standard. Such construction of the data record 2 allows one to arrange the data records in sequence according to their timestamps 4. The additional data 6 makes it possible 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 one parameter change over time are stored as 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, and all of them refer to only one parameter. Each Record Block 1 has a Header 3, which in turn includes a Parameter ID 7. This reduces the size of the record since Parameter ID 7 is present only in Header 3 of Record Block 1 and applies to all Data Record 2 records in it, which also results in a reduction the time of saving and reading data by reducing the amount of stored and read information, as well as through the use of block operations.

Указанная структура блока записей 1 приводит к тому, что при поиске нужной информации о параметре просматриваются блоки с идентификатором только данного параметра. Это приводит к снижению времени поиска.The specified structure of the block of records 1 leads to the fact that when searching for the necessary information about the parameter, blocks with the identifier of only this parameter are looked up. This results in a reduction in 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 parameter identifier 7, contains the address 8 of another record block 1 that stores data records 2 of the same parameter. This may be the address of the block of records 1 next in time or the previous one. In FIG. 2 shows a special case of the execution of a data storage system of 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 recorded sequentially in time: record block 1 with address 10 is the first record in time, and address 12 is the last record. In FIG. Figure 3 shows another particular case of the execution of a data storage system of one parameter, where the same record blocks 1 are shown, but their headers 3 store address 8 not of the next, but of the previous record block 1. The presence of addresses 8 of the subsequent or previous record block 1 in header 3 allows quickly find the next block of records 1 to be read if the data request by time is outside the time range of the stored data records 2 in this block of records 1. This can significantly reduce the data retrieval time.

Внутри каждого блока 1 все записи данных 2 о параметре отсортированы по времени.Within each block 1, all parameter data records 2 are sorted by time.

Заголовок 3 блока записей 1 содержит метку времени 4 первой записи в блоке записей и/или метку времени последней записи в этом блоке записей. Это позволяет быстрее искать нужный блок записей 1 при извлечении данных за заданный временной интервал, поскольку для анализа соответствия данного блока записей 1 требованиям запроса достаточно считать только его заголовок 3, а не весь блок записей 1. Если метки времени 4 записей данных 2 данного блока записей 1 не попадают в заданный интервал времени, то выполняется переход к другому блоку записей 1 искомого параметра, адрес 8 которого записан в заголовке 3 данного блока 1.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 that record block. This allows you to quickly search for the desired record block 1 when extracting data for a given time interval, since in order to analyze the compliance of this record block 1 with the requirements of the request, it is enough to read only its header 3, and not the entire record block 1. If the timestamps are 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, address 8 of which is recorded 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. In this case, blocks of records 1 containing the history of changes in various parameters enter the database. They are sequentially written to free addresses on a machine-readable medium (in the database) regardless of the parameter. At the same time, a list of 13 addresses of 8 blocks of records 1 for each parameter is formed, which is also stored in the database. A 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. In a particular case of execution, these structures 14, in addition to addresses 8, contain timestamps 4 of the first and last records data 2 in this record block 1. When each new record block 1 is saved to the database, the following structure 14 is added to list 13. In a particular case of structure 14 execution, it can contain only one timestamp 4 - the first or last data record 2 in the record block 1.

В еще одном частном случае выполнения структуры 14 она может не содержать временную метку 4. В этом случае добавление новой структуры 14 в список 13 выполняется не при сохранении блока записей 1 в базу данных, а с заданным временным интервалом (например, раз в сутки). Блоки записей 1 формируются с разным временным промежутком, поэтому за время формирования одного из таких блоков записей 1 в список 13 может быть сохранено несколько структур 14 (по фиксированным временным интервалам) с адресом 8 формируемого блока записей 1. В другом частном случае за указанный интервал времени может быть сохранено несколько блоков записей 1. При этом число структур 14 с адресами 8 блоков записей 1 в списке 13 не будет соответствовать числу блоков записей 1, хранящих историю данного параметра.In another particular case of executing structure 14, it may not contain a timestamp 4. In this case, the addition of a new structure 14 to list 13 is performed not while saving record block 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 these blocks of records 1, several structures 14 (at fixed time intervals) with address 8 of the formed block of records 1 can be saved to the list 13. In another particular case, for the specified time interval several record blocks 1 can be saved. In this case, the number of structures 14 with addresses 8 of record blocks 1 in list 13 will not correspond to the number of record blocks 1 that store the history of this parameter.

Еще в одном частном случае число структур 14 может быть меньше числа блоков записей 1, хранящих историю одного параметра, когда в целях сокращения размера списка 13 в него сохраняют структуры 14 не для каждого блока записей 1, а, например, каждый третий или каждый десятый, или используется другой принцип сокращения размера списка 13.In another particular case, the number of structures 14 may be less than the number of record blocks 1 that store the history of one parameter, when, in order to reduce the size of the list 13, structures 14 are stored in it not for every record block 1, but, for example, every third or every tenth, or a different list reduction principle is used 13.

База данных хранится в виде одного или нескольких файлов на машиночитаемом носителе информации (HDD, SSD, SD и др.) и/или в оперативной памяти компьютера.The database is stored as one or more 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 get information about the parameter from the database as quickly as possible, without loss, i.e. extract all data by parameter for any time interval, due to the fact that it is not required to scan all blocks of records 1 stored in the database, and to search for block of records 1 of the desired parameter, select from the list of 13 addresses of blocks of records 1 address 8 of the block containing the first in time, a record whose timestamp 4 is greater than the start time of the specified time interval. If there is no structure 14 with address 8 of such record block 1 in list 13 (as a result of reducing the size of list 13 or writing structures 14 at fixed time intervals), then the last block of records 1 is searched for, the timestamp 4 of the last data record 2 of which is less than the start time a given time interval, and then a search is performed with a jump to addresses 8 in the headers 3 of blocks of records 1 with the analysis of labels 4 of the first and last data records until block of records 1 is identified, containing the first data record 2, the timestamp 4 of which is greater than the start time of the specified time interval. The records are read from the found record block 1, starting from the first data record 2, the timestamp 4 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 4 of which is greater than the end time of the specified time interval , extracting 2 data records with 4 timestamps that fell within the given time interval. All read records from the first one that falls within the specified time interval to the last one are the result of data extraction.

В частном случае выполнения способа извлечения данных, когда в заголовках 3 блоков записей 1 сохраняют адрес 8 не последующего блока записей, а предыдущего, выполняется поиск посредством списка 13 адресов 8 блоков записей 1 и адресов 8 из заголовков 3 блоков записей 1 того блока записей 1, который содержит первую запись данных 2, метка времени 4 которой превосходит время конца заданного временного интервала. Осуществляют, считывание записей из найденного блока записей 1, начиная с первой записи данных 2, метка времени 4 которой меньше времени конца заданного интервала времени в обратном по времени направлении до блока записей 1, в котором содержится последняя запись данных 2, метка времени 4 которой превосходит время начала заданного интервала, извлечение записей с метками времени, которые попали в заданный интервал времени. Все считанные записи от первой попадающей в заданный временной интервал до последней являются результатом извлечения данных.In a particular case of executing the data extraction method, when in the headers 3 of record blocks 1, address 8 is stored not of the subsequent record block, but of the previous one, a search is performed using the list 13 of 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 data record 2 whose timestamp 4 is greater than the end time of the given time interval. The records are read from the found record block 1, starting from the first data record 2, the timestamp 4 of which is less than the end time of the specified time interval in the reverse time direction to the records block 1, which contains the last data record 2, the timestamp 4 of which exceeds the start time of the specified interval, extracting records with timestamps that fall within the specified time interval. All read records from the first one that falls within the specified time interval to the last one are the result of data extraction.

Частные случаи выполнения способа сохранения и извлечения данных могут быть проиллюстрированы приведенными неисчерпывающими примерами, которые проиллюстрированы фиг. 5.Particular cases of the implementation of the data storage and retrieval method can be illustrated by the following non-exhaustive examples, which are illustrated in FIG. 5.

На фиг. 5 схематично представлена система контроля за технологическим процессом. Она включает в себя три подсистемы: подсистему 16 сбора и обработки данных, подсистему HMI (человеко-машинный интерфейс) 18 и подсистему архивирования 17. Программные компоненты 21, 23 и 26 указанных подсистем функционируют на одном компьютере 15.In FIG. 5 is a schematic representation of a 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.

Подсистема 16 сбора и обработки данных включает в себя модули ввода/вывода 19, к которым подключены датчики, контролирующие технологические параметры, и которые опрашиваются по интерфейсу RS-485, подключенному к USB-порту 22 компьютера 15 через конвертер интерфейсов RS-485/USB 20, а так же программный компонент 21, который по протоколу MODBUS с заданной частотой опрашивает модули ввода/вывода 19, обрабатывает полученные данные, переводя их в значения физических величин в формате float, присваивает им временные метки, соответствующие моменту получения этих данных по протоколу, и признак качества в соответствии со стандартом ОРС Foundation. Далее подсистема 16 сбора и обработки данных передает значения контролируемых технологических параметров вместе с метками времени и признаками качества в подсистему HMI 18 и подсистему архивирования 17. Передача значений осуществляется только для тех параметров, значения которых изменились по сравнению с предыдущим переданным значением на величину превышающую 0,2% от их возможного диапазона изменения.The data acquisition and processing subsystem 16 includes input/output modules 19, to which sensors are connected that control technological parameters and are interrogated via the RS-485 interface connected to the USB port 22 of the computer 15 through the RS-485/USB interface converter 20 , as well as the software component 21, which, using the MODBUS protocol, polls the I / O modules 19 at a given frequency, processes the received data, converting them into values of physical quantities in float format, assigns them timestamps corresponding to the moment when this data was received via the protocol, and a sign of quality in accordance with the OPC Foundation standard. Further, the data collection and processing subsystem 16 transmits the values of the controlled technological parameters, together 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 a value greater than 0, 2% of their possible range.

Подсистема 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 29) and a software component 26 that processes operator commands given by keyboard 28 and mouse 29, sends requests and receives data from the collection subsystem 16 and data processing and archiving subsystem 17, generates 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 the RAM 24 of the computer and a software archiving component 23, which receives data from the data collection and processing subsystem 16, forms data records 2 from the received data, from which blocks are formed in the 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 to 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 timestamp 4 in the 64-bit Unix time format (8 bytes), parameter value 5 in the 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 the RAM 24 for each parameter lists 13 of addresses for placing 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 stored in the database on disks 25. In addition, the archiving subsystem 17 receives requests for data search from the HMI subsystem 18, fetches the requested data and transfers them to the HMI subsystem 18.

Пример 1.Example 1

Сохраняют в заголовок 3 блока записей 1 метку времени 4 последней записи данных 2 и адрес 8 последующего блока записей 1, а в списке 13 для каждого параметра сохраняют структуры 14, содержащие адрес 8 и метку времени 4 последней записи данных 2, для каждого десятого блока записей 1 данного параметра в базе данных.In the header 3 of the record block 1, the timestamp 4 of the last data record 2 and the address 8 of the subsequent record block 1 are saved, and in the list 13 for each parameter, structures 14 are stored containing the address 8 and the timestamp 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, its header 3 is entered as additional information 9 with the timestamp 4 of its last data record 2, and the header 3 of the previous block of records 1 contains the address 8 at which the this block of records 1. Saving the block of records 1 to the database on disks 25 is performed if it is filled with data records 2 to the full specified volume. In addition, when saving to the database on disks 25 of every tenth block of records 1 of this parameter, structure 14 is added to list 13 containing address 8 of the saved record block 1 and 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 подсистемы HMI 18, которая по полученной выборке строит изображение тренда изменения значения заданного параметра, которое затем выводится на монитор 27. Причем при формировании изображения анализируется значение признака качества, являющегося дополнительным значением 6 каждой записи данных 2. Там, где величина этого признака не равна 192 (данные имеют качество GOOD) тренд отображается пунктирной линией.To view archived data in the HMI subsystem 18, for example, to display a parameter change on a trend for the previous week, the software component 26 of the HMI subsystem 18 generates a request to the archiving subsystem 17, which indicates the parameter identifier 7, as well as the start and end times of the time interval . In this case, the time interval will start at 00:00:00.000 on the previous Monday and end at 23:59:59.999 on the previous Sunday. To prepare a selection of records in this time interval, the database is first searched for record block 1, for which the start time of the specified time range (Monday 00:00:00.000) is between timestamps 4 of the first and last data record 2. To do this, access the list 13 for the 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. Header 3 of the found record block 1 is read and the next record block 1 is read at address 8 recorded in the found record block 1. Its header 3 is read. 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 go to the next block of records 1. And so on until the timestamp 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. Such data record 2 is considered to be the first one found in the searched interval. Next, all data records 2 of this block of records 1 are read and among them the first data record 2 is found, the timestamp 4 of which will be greater than the start time of the specified time interval. All records of data 2, from the first found to the last given block of records 1, are stored in the sample. Further, at address 8 from header 3 of this record block 1, they go 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 sample. If timestamp 4 from header 3 of this block of records 1 exceeds the end time of the specified time interval, then all data records 2 of this block of records 1 are read, but only those data records 2 whose timestamps 4 are less than the end of the specified time interval are placed in the sample. This completes the search for records and all data records placed in the sample are transferred to the software component 26 of the HMI subsystem 18, which, based on the received sample, builds an image of the trend of changing the value of the specified parameter, which is then displayed on the monitor 27. Moreover, when forming the image, the value of the quality attribute is analyzed , which is an additional value of 6 of each data record 2. Where the value of this feature is not equal to 192 (the data is of GOOD quality), the trend is displayed as a dotted line.

Пример 2.Example 2

Сохраняют в заголовок 3 блока записей 1 метку времени 4 первой записи данных 2 данного блока записей 1 и адрес 8 предыдущего блока записей 1, а в список 13 добавляют структуру 14, содержащую только адрес 8 текущего заполняемого блока записей 1, один раз в сутки в момент наступления новых суток.The time stamp 4 of the first data record 2 of this record block 1 and the address 8 of the previous record block 1 are saved in the header 3 of the record block 1, and the structure 14 is added to the list 13, containing only the address 8 of the current filled record block 1, once a day at the moment the arrival of a new day.

В этом случае при сохранении каждого блока записей 1 в базу данных на диски 25 его адрес 8 записывается в заголовок 3 вновь создаваемого блока записей 1. При добавлении во вновь создаваемый блок записей 1 первой записи данных 2 ее метка времени 4 записывается в заголовок 3 данного блока записей 1 в качестве дополнительной информации 9.In this case, when each block of records 1 is saved to the database on disks 25, its address 8 is written to header 3 of the newly created block of records 1. When the first data record 2 is added to the newly created block of records 1, its timestamp 4 is written to the header 3 of this block records 1 as additional information 9.

Так же, как и в Примере 1 для просмотра в подсистеме HMI 18 изменения параметра на тренде за предыдущую неделю, программный компонент 26 подсистемы HMI 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.Just as in Example 1, to view in the HMI subsystem 18 the parameter change on the trend for the previous week, the software component 26 of the HMI subsystem 18 generates a request to the archiving subsystem 17, which specifies the parameter identifier 7, as well as the start and end times of the time period. interval: 00:00:00.000 the previous Monday and 23:59:59.999 the previous Sunday. In this case, to prepare a selection of data records 2, first find in the database a block of records 1 for which the time of the end of the specified time range (23:59:59.999 Sunday) is located between timestamps 4 of the first and last data record 2. To do this, apply a 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 to within a day, provided that the date of the first entry is known. For example, by the beginning of a given search time interval, the system has been working for 1 year and 2 weeks. Then address 8 of record block 1, which was filled at the time of the beginning of the specified time interval, is in the list of 13 addresses at position 379 (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 at 386th place (a week later). Therefore, the 386th address in the address list 13 is read and jumps to record block 1 at this address 8. All data records 2 are read from this record block 1. All data records 2 whose timestamp 4 is less than the end time of the specified time interval are extracted and placed in the sample. Next, go to address 8 from header 3 of this block of records 1 to the previous block of records 1.

Считывают из предыдущего блока записей 1 записи данных 2. Если метка времени 4 в заголовке 3 данного блока записей 1 больше времени начала заданного временного интервала, то все записи данных 2 данного блока записей 1 извлекают и помещают в выборку. В противном случае, в выборку помещают только те записи данных 2, метка времени 4 которых больше времени начала заданного временного интервала. На этом формирование выборки заканчивается, и она передается программному компоненту 26 подсистемы HMI 18.Data records 2 are read from the previous record block 1. If the timestamp 4 in the header 3 of this record block 1 is greater than the start time of the specified time interval, then all data records 2 of this record block 1 are extracted and placed in the sample. Otherwise, only those 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 subsystem 18.

Пример 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 block of records 1 is stored in the header 3 of the block of records 1, as well as additional information 9, including the timestamps 4 of the first and last data records 2 of this block of records 1 and the address 8 of the previous block of records 1. In this case, the list 13 stores structures 14, including address 8 of record block 1 and timestamps 4 of its first and last data record 2.

В этом случае при сохранении блока записей 1 в базу данных на диски 25 в его заголовок 3 записывают адрес 8 вновь создаваемого (последующего для сохраняемого) блока записей 1 и метка времени 4 последней записи сохраняемого блока записей 1. При этом в заголовок 3 вновь созданного блока записей 1 записывается адрес 8 сохраняемого блока записей и метка времени 4 первой записи данных 2 при ее добавлении в новый блок записей 1.In this case, when saving block of records 1 to the database on disks 25, in its header 3, the address 8 of the newly created (subsequent for the saved) block of records 1 and the time stamp 4 of the last record of the saved block of records 1 are written. In this case, in the header 3 of the newly created block records 1, the address 8 of the stored record block and the timestamp 4 of the first data record 2 are written when it is added to the new 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 subsystem 18 requests the parameter data for the previous week. The retrieved sample of data records 2 was transferred to the HMI subsystem 18. However, after receiving a sample of data records 2 to display the trend, the operator rescaled the time axis of the trend, which required adding data three more days before the start time of the previous request time interval and two days after the end of the interval of the previous request. In this case, you need to add data to the already received sample. And both after and before the specified time interval. To do this, perform two additional samples. The first one is to get 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 Tuesday of the current week. To do this, use the mechanism described in Example 1. First, using the 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, timestamps 4 of the first and last data records 2 from structures 14 of list 13 are used. Record block 1 is read at the address 8 found in this way. If the timestamp 4 of the last data record 2 in header 3 is less than the time of the end of the time interval (23: 59:59.999 Tuesday of the current week), then from the read block of records 1 all data records 2 are selected, the timestamps 4 of which are greater than the time of the start of the time interval, they are extracted into the sample and then the block of records 1 located at address 8 of the subsequent block of records 1 from header 3. If the timestamp 4 of the last data record 2 in header 3 of this (subsequent) record block 1 is less than the end time of the time interval, then all data records 2 of this record block 1 are retrieved and stored in the sample. These operations are repeated until the timestamp 4 of the last record 2 of the next block of records 1 is greater than the time of the end of the specified interval. In this case, only those data records 2 from the last read block of records 1 are stored 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 timestamp 4 of the last record 2 of the first read block of records 1 exceeds the end time of the specified time interval, then 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 the transition to other blocks of records 1 is not 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 the second additional sample, the sequence of actions described in Example 2 is used, when a jump is made to address 8 of the previous block of records 1 from the header 3 of the current block of records 1, and the value of the timestamp 4 of the first data record 2 is compared with the start time of the specified time interval to determine of the last read block of records 1 for sampling. In this case, data records 2 are sampled whose timestamps 4 are in the range from Friday 00:00:00.000 of the previous previous week to 00:00:00.000 of the previous Monday. List 13 determines the address of record block 1 corresponding to the time of the end of the time interval of the second sample (00:00:00.000 of the previous Monday). To do this, use the timestamps 4 of the first and last data records 2 from the structures 14 of the list 13. The block of records 1 is read at the address 8 found in this way. from record block 1, data records 2 whose timestamps 4 fall within the specified time interval are retrieved and placed in the sample, and the search is completed. 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 all data records 2 whose timestamps 4 are less than the end time of the specified time interval are placed in the sample and the previous block of records 1 is read at address 8 from header 3 of this record block 1. If the time stamp 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 record block 1 are extracted and placed in the sample and the transition to reading the previous record block 1 in time is performed. operations until the timestamp 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 stored in the sample, the timestamps 4 of which are greater than the start time of the specified time interval, and the sampling is completed.

Полученные две дополнительные выборки записей данных 2 передаются в подсистему HMI 18 для доработки недостающих фрагментов тренда.The received two additional samples of data records 2 are transferred to the HMI subsystem 18 to finalize 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 and subsequent block of records 1, as well as time stamps 4 of both the first and last data record 2, it is possible to sample data records 2 both forward and backward in time, depending on what is more convenient in a particular case.

Claims (11)

1. Способ хранения данных, включающий прием данных от источника данных, сохранение данных в виде записей данных в памяти компьютера, при этом каждая запись данных содержит метку времени, связанную с моментом создания данных, и значение параметра, формирование в памяти компьютера из записей данных блоков записей одинакового размера, при этом в одном блоке записей могут находиться записи данных только одного параметра, присвоение блоку записей заголовка, включающего идентификатор параметра и адрес, и сохранение сформированного блока записей в базу данных на машиночитаемый носитель, формирование и сохранение в базе данных списка адресов блоков записей для каждого параметра.1. A method of data storage, including receiving data from a data source, storing 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 in the computer memory from data records records of the same size, while in one record block there can be data records of only one parameter, assigning a header to the record block, including the parameter identifier and address, and saving the generated block of records to the database on a machine-readable medium, generating and saving the list of block addresses in the database entries for each setting. 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, which stores the data records in the record block in ascending order of timestamps. 7. Способ по п. 1, в котором список адресов блоков записей содержит метки времени.7. The method of claim. 1, in which the list of addresses of blocks of records contains timestamps. 8. Способ по п. 7, в котором список содержит для каждого адреса метку времени первой записи данных и/или метку времени последней записи данных блока записей по данному адресу.8. The method of claim 7, wherein the list contains, for each address, the timestamp of the first data record and/or the timestamp of the last data record of the block of records at the given address. 9. Способ по п. 1, в котором в качестве машиночитаемого носителя может быть использована оперативная память компьютера.9. The method of claim. 1, in which the machine-readable medium can be used computer RAM. 10. Способ извлечения данных, сохраненных способом по п. 1, включающий введение поискового запроса для заданного параметра и заданного временного интервала, поиск в списке адресов блоков записей и адресов из заголовков блоков записей адреса блока записей, содержащего первую по времени запись данных параметра из заданного временного интервала, считывание записей данных из найденного блока записей, начиная с первой записи данных, метка времени которой больше времени начала заданного интервала времени, с переходом к последующим блокам записей по адресам из заголовков блоков записей, до блока записей, в котором содержится запись данных, метка времени которой превосходит время конца заданного интервала, извлечение записей данных с метками времени, которые попали в заданный интервал времени.10. A method for retrieving data stored by the method of 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 of the address of the record block containing the first record of parameter data from a given time interval, reading data records from the found record block, starting from the first data record, the timestamp of which is greater than the start time of the specified time interval, with the transition to subsequent record blocks at addresses from the record block headers, up to the record block containing the data record, whose timestamp is greater than the end time of the specified interval, extracting data records with timestamps that fall within the specified time interval. 11. Способ извлечения данных по п. 10, в котором по списку адресов и адресам из заголовков блоков записей находят блок записей, содержащий последнюю запись данных, метка времени которой не превосходит времени конца интервала, и считывают записи данных с переходом к предыдущим блокам записей по адресам из заголовков блоков записей, до блока записей, в котором содержится первая запись данных, метка времени которой меньше времени начала заданного временного интервала, извлечение записей данных с метками времени, которые попали в заданный интервал времени.11. The method of extracting data according to claim 10, in which, according to the list of addresses and addresses from the headers of the record blocks, a record block is found containing the last data record, the time stamp of which does not exceed the end time of the interval, and the data records are read with a transition to the previous record blocks by addresses from the headers of record blocks, up to the record block containing the first data record whose timestamp is less than the start time of the specified time interval, extracting data records with timestamps that fell within the specified time interval.
RU2022109631A 2022-04-11 2022-04-11 Method of storing and retrieval of data RU2793082C1 (en)

Priority Applications (1)

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

Publications (1)

Publication Number Publication Date
RU2793082C1 true RU2793082C1 (en) 2023-03-28

Family

ID=

Citations (4)

* 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
US20180067995A1 (en) * 2016-09-02 2018-03-08 Hitachi, Ltd. Sensor Data Search System, Sensor Data Search Method and Management Computer
RU2735439C2 (en) * 2018-11-27 2020-11-02 Алибаба Груп Холдинг Лимитед System and method for protecting information
US20200389626A1 (en) * 2017-11-15 2020-12-10 Murata Machinery, Ltd. Management server, management system, management method, and program

Patent Citations (4)

* 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
US20180067995A1 (en) * 2016-09-02 2018-03-08 Hitachi, Ltd. Sensor Data Search System, Sensor Data Search Method and Management Computer
US20200389626A1 (en) * 2017-11-15 2020-12-10 Murata Machinery, Ltd. Management server, management system, management method, and program
RU2735439C2 (en) * 2018-11-27 2020-11-02 Алибаба Груп Холдинг Лимитед System and method for protecting information

Similar Documents

Publication Publication Date Title
EP3007081B1 (en) Processing spatiotemporal data records
US7092975B2 (en) Methods and apparatus for management of data storage resources
WO1999036861A1 (en) Method for storing time series data and time series database system, method and system for processing time series data, time series data display system, and recording medium
CN111339103A (en) Data exchange method and system based on full fragmentation and incremental log analysis
US7885933B2 (en) Apparatus and system for analyzing computer events recorded in a plurality of chronicle datasets
CN104270605A (en) Method and device for processing video monitoring data
RU2793082C1 (en) Method of storing and retrieval of data
US10534763B2 (en) Data sampling in a storage system
CN111143422A (en) Data retrieval method, data retrieval device, storage medium, and electronic device
CN111125171A (en) Monitoring data access method, device, equipment and readable storage medium
WO2023200361A1 (en) Data storage method and data extraction method
CN114387123B (en) Data acquisition management method
EP3926428B1 (en) Control device, control program, and control system
CN111221894B (en) Time sequence database storage method, device and server based on configuration
JP3153094B2 (en) Manufacturing process control device
JP2880849B2 (en) Plant operation information management device
CN112131296A (en) Data exploration method and device, electronic equipment and storage medium
CN110955709A (en) Data processing method and device and electronic equipment
CN112783711A (en) Method and storage medium for analyzing program memory on NodeJS
CN111522900B (en) Automatic analysis method, system, equipment and storage medium for unstructured data
JPH06214637A (en) History data processor
US20230056433A1 (en) Data management device and program
CN113326189A (en) Method, system and equipment for tracking submission of introduced defects
CN117591229B (en) Device data viewing and displaying method and system based on gateway embedded Web
CN113868301B (en) Method, device and equipment for extracting industrial equipment data