CN109726176A - The quick storage and querying method of railway signal electrical device data - Google Patents
The quick storage and querying method of railway signal electrical device data Download PDFInfo
- Publication number
- CN109726176A CN109726176A CN201811509714.XA CN201811509714A CN109726176A CN 109726176 A CN109726176 A CN 109726176A CN 201811509714 A CN201811509714 A CN 201811509714A CN 109726176 A CN109726176 A CN 109726176A
- Authority
- CN
- China
- Prior art keywords
- data
- block
- index
- record
- railway signal
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present invention provides the quick storage and querying method of a kind of railway signal electrical device data, the quick storage method of the railway signal electrical device data includes: to create empty data file;According to data type, data record is stored in chronological order in the data block of sky data file;Data block is divided into several sub-blocks;The storage time and position offset for extracting the first data record in sub-block are as index record;Index record is stored in the index block of sky data file;The querying method of the railway signal electrical device data includes: that type obtains all corresponding index blocks to document reader according to the input data, obtains corresponding index record in the index block further according to the time parameter of input;Corresponding data block is traversed according to the index record, corresponding sub-block is searched, decompresses the data record of the sub-block, returned data set.The present invention has the advantages that practical, circulation storage and quickly positioning.
Description
Technical field
The present invention relates to data storages specifically to relate to a kind of railway signal electrical equipment with inquiring technology field
The quick storage and querying method of data.
Background technique
The data of railway signals equipment are broadly divided into switching value, analog quantity and recording curve data, the shape of these three data
State is different.Switching value is there are three types of mode: unknown, pick up and fall;Analog quantity is continuous linear data;Recording curve
It is the set of multi-group data.This kind of data, that is, huge and many and diverse need to meet circulation storage and adapt to station different data version
This demand, the total amount and sequence of version difference Various types of data are also different, and there is an urgent need to look for a kind of data storage method can be complete
The data of these three types of complete record and the function of having quick storage and inquiry.
In order to solve the above problems, people are seeking always a kind of ideal technical solution.
Summary of the invention
The purpose of the present invention is in view of the deficiencies of the prior art, to provide a kind of the fast of railway signal electrical device data
Speed storage and querying method.
To achieve the goals above, the technical scheme adopted by the invention is that: a kind of railway signal electrical device data
The quick storage method of quick storage and querying method, the railway signal electrical device data includes:
Empty data file is created, railway signal electrical device data is stored with circulation;The sky data file includes several data
Block and several index blocks;
After railway signal electrical device data wait store is converted to binary array, compression processing is carried out, is remembered as data
Record;According to data type, the data record is stored in chronological order in the data block of the empty data file;
The data block is divided into several sub-blocks;Each sub-block is recorded comprising N data;
The storage time and position offset for extracting the first data record in the sub-block are as index record;By institute
Index record is stated to be stored in the index block of the empty data file;
The querying method of the railway signal electrical device data includes:
Create document reader, user input data type and time parameter;
Type obtains all corresponding index blocks to the document reader according to the input data, further according to the time parameter of input
Obtain corresponding index record in the index block;
Corresponding data block is traversed according to the index record, corresponding sub-block is searched, decompresses the sub-block
Data record, returned data set.
Based on above-mentioned, the data block is divided into switching value data block, analog data block and recording curve data block;It is described
Index block is divided into switching value index block, analog quantity index block and recording curve index block;
The switching value data block and switching value index block, the analog data block and the analog quantity index block, the note
Curve data block and the recording curve index block are recorded, is corresponded.
Based on above-mentioned, the sky data file includes data number of blocks, data block size, index interval and data set of types
It closes.
Based on above-mentioned, the quick storage method of the railway signal electrical device data specifically includes the following steps:
Step a inputs data record to be stored, if the data type of the data record is defined data type,
Go to step b;
Otherwise the data type of the data record is stored in the data type set, and empty for data type distribution
Data block and index block, then go to step b;
Step b goes to step c if the data type is not event type;
Otherwise increase a logout in the data block of all data types, terminate depositing for railway signal electrical device data
Store up process;
Step c goes to step e if the corresponding data block of the data type or index block are not write completely;
Otherwise, the writer of next empty data file is obtained, write-in overflow data record terminates railway signal electrical number of devices
According to Stored Procedure;
Step e obtains the corresponding data block of the data type, goes to step f if being unsatisfactory for writing the requirement of index record;
Otherwise the corresponding index block of the data type is obtained, judges whether the remaining space of the index block meets storage need
It wants:
If meeting storage needs, it will be directly written in the index block after index record compression, update the index block
Used space, go to step h;
If being unsatisfactory for storage needs, new index block is distributed, will be written in the index block after index record compression, more
The new index block has used space, goes to step h;
Step f, if the remaining space of the data block meets storage needs, step g;Otherwise, new data block is distributed, then
Go to step g;
Step g after the railway signal electrical device data wait store is converted to binary array, carries out compression processing, write-in
In the data block;The write-in offset pointer for updating the data type, then goes to step h;
Step h updates file header, data type table and block allocation table, terminates the Stored Procedure of railway signal electrical device data.
The present invention has substantive distinguishing features outstanding and significant progress compared with the prior art, and specifically, the present invention mentions
The quick storage and querying method for having supplied a kind of railway signal electrical device data devise the binary file of a set of band compression
Storage organization, by all data conversions at binary array, circulation stores different types of data;Using being obtained when reading
Data type and time range first read index block, the index record closed on are read from index block, according to index record
Record information realizes efficient data query acquisition modes to quickly navigate to data record.
Detailed description of the invention
Fig. 1 is the flow diagram of date storage method of the invention.
Fig. 2 is the flow diagram of data query method of the invention.
Specific embodiment
Below by specific embodiment, technical scheme of the present invention will be described in further detail.
Embodiment 1
As shown in Figure 1 and Figure 2, a kind of quick storage and querying method of railway signal electrical device data, railway letter
The quick storage method of number electrical equipment-data includes:
Empty data file is created, railway signal electrical device data is stored with circulation;The sky data file includes several data
Block and several index blocks;
After railway signal electrical device data wait store is converted to binary array, compression processing is carried out, is remembered as data
Record;According to data type, the data record is stored in chronological order in the data block of the empty data file;
The data block is divided into several sub-blocks;Each sub-block is recorded comprising N data;
The storage time and position offset for extracting the first data record in the sub-block are as index record;By institute
Index record is stated to be stored in the index block of the empty data file;
The querying method of the railway signal electrical device data includes:
Create document reader, user input data type and time parameter;
Type obtains all corresponding index blocks to the document reader according to the input data, further according to the time parameter of input
Obtain corresponding index record in the index block;
Corresponding data block is traversed according to the index record, corresponding sub-block is searched, decompresses the sub-block
Data record, returned data set.
Specifically, the data block is divided into switching value data block, analog data block and recording curve data block;The rope
Draw block and is divided into switching value index block, analog quantity index block and recording curve index block;The switching value data block and switching value rope
Draw block, the analog data block and the analog quantity index block, the recording curve data block and the recording curve index
Block corresponds.
Specifically, the data record is switching value data, analog data or recording curve in preset time region
The data acquisition system of data.Index record is convenient for capable of quickly navigating to purpose data record by index record in reading
On, promote reading speed.
Embodiment 2
The quick storage method of the railway signal electrical device data specifically includes the following steps:
Step a inputs data record to be stored, if the data type of the data record is defined data type,
Go to step b;
Otherwise the data type of the data record is stored in the data type set, and empty for data type distribution
Data block and index block, then go to step b;
Step b goes to step c if the data type is not event type;
Otherwise increase a logout in the data block of all data types, terminate depositing for railway signal electrical device data
Store up process;
Step c goes to step e if the corresponding data block of the data type or index block are not write completely;
Otherwise, the writer of next empty data file is obtained, write-in overflow data record terminates railway signal electrical number of devices
According to Stored Procedure;
Step e obtains the corresponding data block of the data type, goes to step f if being unsatisfactory for writing the requirement of index record;
Otherwise the corresponding index block of the data type is obtained, judges whether the remaining space of the index block meets storage need
It wants:
If meeting storage needs, it will be directly written in the index block after index record compression, update the index block
Used space, go to step h;
If being unsatisfactory for storage needs, new index block is distributed, will be written in the index block after index record compression, more
The new index block has used space, goes to step h;
Step f, if the remaining space of the data block meets storage needs, step g;Otherwise, new data block is distributed, then
Go to step g;
Step g after the railway signal electrical device data wait store is converted to binary array, carries out compression processing, write-in
In the data block;The write-in offset pointer for updating the data type, then goes to step h;
Step h updates file header, data type table and block allocation table, terminates the Stored Procedure of railway signal electrical device data.
Each data type independently distributes a data block and an index block, data record are stored to data block, index
Record is stored to index block.And not all data record has index record, index record only includes crucial record, extracts institute
The storage time and position offset for stating the first data record in sub-block are quickly fixed convenient for system as index record
It searches position.For example, each sub-block is recorded comprising 100 datas, i.e., every 100 data record increases an index note
Record.
Data block or index block can be applied distributing empty a data block or index block after writing completely, while block number being written
The unified management of block allocation table.One empty data file writes Man Houhui and automatically generates a new empty data file, new sky data text
File header and data the set of types conjunction of part are consistent, can be new for each data type application one in new empty data file
Data block and index block, after empty data file number reaches limit value can write full file for first block allocation table in
Block message records again after emptying, and realizes datacycle storage.
Embodiment 3
Application creates empty data file, each sky data file include file header, data type table, block allocation table, data block and
Index block;Specific file structure is as follows:
When empty Generating Data File, the File header information of the sky data file has been fixed;Empty data file is dimensioned to
2048 bytes;The file header, for record the version number of the empty data file, data format version, number of data blocks,
The size of each data block, the size of data type table, block distribute table size, current recording mechanism and start recording number;It is as follows
Shown in table:
When empty Generating Data File, the data type table information of the sky data file has been fixed.The data type table it is big
It is small to be set as 2048 bytes, for recording the size, the number of data type and specific data type of data type table;Institute
It states data type and is set as 256 bytes, for recording data type ID, data type name, first piece of data block of the type
Number, presently written position, data record number and the index record number of presently written position, index block head block number, index block
Mesh.It is as shown in the table:
Explanation of field | Deviate byte | Occupy byte |
Directory area size (contains itself, byte) | 0 | 4 |
Data type number | 4 | 4 |
Retain | 8 | 56 |
0th data type | 64 | 256 |
…… | …… | …… |
(n-1)th data type | 256*(n-1)+64 | 256 |
Free area | xx | xxx |
Explanation of field | Deviate byte | Occupy byte |
Data type | 0 | 4 |
Data type name | 4 | 128 |
Data block head block number | 132 | 4 |
The presently written position of data block | 136 | 4 |
Index block head block number | 140 | 4 |
The presently written position of index block | 146 | 4 |
Data record number | 148 | 4 |
Index record number | 152 | 4 |
Data record total bytes | 156 | 8 |
Record data format | 164 | 1 |
Whether storage indexes | 165 | 1 |
Retain | 166 | 90 |
When empty Generating Data File, the block allocation table format of the sky data file has been fixed, and is constantly updated when data are written
Every piece of distribution label and use space.Described piece of allocation table is used to record the size of allocation table, the block number of this document distribution, often
The assignment record of block;Every piece of distribution label (whether free block, if not be then directed toward next block number) comprising the block and block is
The space used.It is as shown in the table:
Explanation of field | Deviate byte | Occupy byte |
Distribute table size (including itself) | 0 | 4 |
Block number mesh | 4 | 4 |
Retain | 8 | 120 |
0 assignment record of block | 128 | 10 |
…… | …… | …… |
Fast n-1 assignment record | 128+(n-1) * 10 | 10 |
Free area |
Block assignment record item:
Block distribution label | 0 | 4 |
Block use space (byte) | 4 | 4 |
Record format version [1] in data block | 8 | 2 |
Finally it should be noted that: the above embodiments are merely illustrative of the technical scheme of the present invention and are not intended to be limiting thereof;Although ginseng
According to preferred embodiment, invention is explained in detail, it should be understood by those ordinary skilled in the art that: still can be with
It modifies to a specific embodiment of the invention or some technical features can be equivalently replaced;Without departing from skill of the present invention
The spirit of art scheme should all cover within the scope of the technical scheme claimed by the invention.
Claims (4)
1. a kind of quick storage and querying method of railway signal electrical device data, which is characterized in that the railway signal electrical
The quick storage method of device data includes:
Empty data file is created, railway signal electrical device data is stored with circulation;The sky data file includes several data
Block and several index blocks;
After railway signal electrical device data wait store is converted to binary array, compression processing is carried out, is remembered as data
Record;According to data type, the data record is stored in chronological order in the data block of the empty data file;
The data block is divided into several sub-blocks;Each sub-block is recorded comprising N data;
The storage time and position offset for extracting the first data record in the sub-block are as index record;By institute
Index record is stated to be stored in the index block of the empty data file;
The querying method of the railway signal electrical device data includes:
Create document reader, user input data type and time parameter;
Type obtains all corresponding index blocks to the document reader according to the input data, further according to the time parameter of input
Obtain corresponding index record in the index block;
Corresponding data block is traversed according to the index record, corresponding sub-block is searched, decompresses the sub-block
Data record, returned data set.
2. the quick storage and querying method of railway signal electrical device data according to claim 1, it is characterised in that:
The data block is divided into switching value data block, analog data block and recording curve data block;The index block is divided into switching value
Index block, analog quantity index block and recording curve index block;
The switching value data block and switching value index block, the analog data block and the analog quantity index block, the note
Curve data block and the recording curve index block are recorded, is corresponded.
3. the quick storage and querying method of railway signal electrical device data according to claim 1, it is characterised in that:
The sky data file includes that data number of blocks, data block size, index interval and data set of types are closed.
4. the quick storage and querying method of railway signal electrical device data according to claim 2, which is characterized in that
The quick storage method of the railway signal electrical device data specifically includes the following steps:
Step a inputs data record to be stored, if the data type of the data record is defined data type,
Go to step b;
Otherwise the data type of the data record is stored in the data type set, and empty for data type distribution
Data block and index block, then go to step b;
Step b goes to step c if the data type is not event type;
Otherwise increase a logout in the data block of all data types, terminate depositing for railway signal electrical device data
Store up process;
Step c goes to step e if the corresponding data block of the data type or index block are not write completely;
Otherwise, the writer of next empty data file is obtained, write-in overflow data record terminates railway signal electrical number of devices
According to Stored Procedure;
Step e obtains the corresponding data block of the data type, goes to step f if being unsatisfactory for writing the requirement of index record;
Otherwise the corresponding index block of the data type is obtained, judges whether the remaining space of the index block meets storage need
It wants:
If meeting storage needs, it will be directly written in the index block after index record compression, update the index block
Used space, go to step h;
If being unsatisfactory for storage needs, new index block is distributed, will be written in the index block after index record compression, more
The new index block has used space, goes to step h;
Step f, if the remaining space of the data block meets storage needs, step g;Otherwise, new data block is distributed, then
Go to step g;
Step g after the railway signal electrical device data wait store is converted to binary array, carries out compression processing, write-in
In the data block;The write-in offset pointer for updating the data type, then goes to step h;
Step h updates file header, data type table and block allocation table, terminates the Stored Procedure of railway signal electrical device data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811509714.XA CN109726176B (en) | 2018-12-11 | 2018-12-11 | Method for rapidly storing and inquiring railway signal electrical equipment data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811509714.XA CN109726176B (en) | 2018-12-11 | 2018-12-11 | Method for rapidly storing and inquiring railway signal electrical equipment data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109726176A true CN109726176A (en) | 2019-05-07 |
CN109726176B CN109726176B (en) | 2022-12-06 |
Family
ID=66294889
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811509714.XA Active CN109726176B (en) | 2018-12-11 | 2018-12-11 | Method for rapidly storing and inquiring railway signal electrical equipment data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109726176B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112084145A (en) * | 2020-09-04 | 2020-12-15 | 深圳科安达电子科技股份有限公司 | Data storage and reading method for railway signal centralized monitoring system |
CN112523863A (en) * | 2020-11-18 | 2021-03-19 | 中国航空工业集团公司西安航空计算技术研究所 | Electric control engine cycle monitoring method based on combination of long meters and short meters |
CN112699146A (en) * | 2020-12-31 | 2021-04-23 | 新奥数能科技有限公司 | Data pushing method and device based on general information model, server and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1632765A (en) * | 2004-12-31 | 2005-06-29 | 大唐微电子技术有限公司 | A flash memory file system management method |
WO2014015828A1 (en) * | 2012-07-27 | 2014-01-30 | 腾讯科技(深圳)有限公司 | Data storage space processing method and processing system, and data storage server |
-
2018
- 2018-12-11 CN CN201811509714.XA patent/CN109726176B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1632765A (en) * | 2004-12-31 | 2005-06-29 | 大唐微电子技术有限公司 | A flash memory file system management method |
WO2014015828A1 (en) * | 2012-07-27 | 2014-01-30 | 腾讯科技(深圳)有限公司 | Data storage space processing method and processing system, and data storage server |
Non-Patent Citations (1)
Title |
---|
候志立: "一种基于用电信息采集终端的曲线数据存储方案", 《中国新技术新产品》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112084145A (en) * | 2020-09-04 | 2020-12-15 | 深圳科安达电子科技股份有限公司 | Data storage and reading method for railway signal centralized monitoring system |
CN112523863A (en) * | 2020-11-18 | 2021-03-19 | 中国航空工业集团公司西安航空计算技术研究所 | Electric control engine cycle monitoring method based on combination of long meters and short meters |
CN112699146A (en) * | 2020-12-31 | 2021-04-23 | 新奥数能科技有限公司 | Data pushing method and device based on general information model, server and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN109726176B (en) | 2022-12-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106708427B (en) | A kind of storage method suitable for key-value pair data | |
CN109726176A (en) | The quick storage and querying method of railway signal electrical device data | |
CN100468402C (en) | Sort data storage and split catalog inquiry method based on catalog tree | |
CN105574093B (en) | A method of index is established in the spark-sql big data processing system based on HDFS | |
CN100583832C (en) | Data management method and system | |
CN104346357B (en) | The file access method and system of a kind of built-in terminal | |
CN101777016B (en) | Snapshot storage and data recovery method of continuous data protection system | |
CN104572670B (en) | A kind of storage of small documents, inquiry and delet method and system | |
CN104978361B (en) | Method and device for storing real-time monitoring data of power environment | |
CN107239569A (en) | A kind of distributed file system subtree storage method and device | |
CN103729447A (en) | Method for fast searching database | |
CN106201355A (en) | Data processing method and device and storage system | |
CN103631907A (en) | Method and system for migrating relational data to HBbase | |
CN103577440A (en) | Data processing method and device in non-relational database | |
CN103198150B (en) | A kind of large data index method and system | |
CN101464901B (en) | Object search method in object storage device | |
CN103714163A (en) | Pattern management method and system of NoSQL database | |
CN104462141A (en) | Data storage and query method and system and storage engine device | |
CN103544156A (en) | Method and device for storing files | |
CN106599040A (en) | Layered indexing method and search method for cloud storage | |
MY128743A (en) | Av data recording apparatus and method, and disk recorded by the same | |
CN101571869A (en) | File memory and read method of smart card and device thereof | |
CN105159616A (en) | Disk space management method and device | |
CN102609492A (en) | Metadata management method supporting variable table modes | |
CN101963993B (en) | Method for fast searching database sheet table record |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |