CN105335489B - A kind of accident alarming enquiring and optimizing method - Google Patents

A kind of accident alarming enquiring and optimizing method Download PDF

Info

Publication number
CN105335489B
CN105335489B CN201510677857.1A CN201510677857A CN105335489B CN 105335489 B CN105335489 B CN 105335489B CN 201510677857 A CN201510677857 A CN 201510677857A CN 105335489 B CN105335489 B CN 105335489B
Authority
CN
China
Prior art keywords
time
measuring point
program unit
database
inquiry
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.)
Active
Application number
CN201510677857.1A
Other languages
Chinese (zh)
Other versions
CN105335489A (en
Inventor
岳以洋
李佑文
罗存
包德梅
刘志超
李芳�
褚红健
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Guodian Nanzi Railway Traffic Engineering Co Ltd
Original Assignee
Nanjing Guodian Nanzi Railway Traffic Engineering Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing Guodian Nanzi Railway Traffic Engineering Co Ltd filed Critical Nanjing Guodian Nanzi Railway Traffic Engineering Co Ltd
Priority to CN201510677857.1A priority Critical patent/CN105335489B/en
Publication of CN105335489A publication Critical patent/CN105335489A/en
Application granted granted Critical
Publication of CN105335489B publication Critical patent/CN105335489B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases

Abstract

The invention discloses a kind of accident alarming enquiring and optimizing method, including alarm library, interface programs, it is characterised in that: further include a background program, configuration file and database;Inquiry plan is realized the following steps are included: 1, background program reads configuration file first, and the corresponding relationship of the attribute information for the measuring point that configuration file is related to is written in database;2, user passes through interface program input inquiry condition;3, querying condition is passed to background program by interface program;4, background program analysis request parameter and database is inquired;5, the result that inquiry obtains is returned to interface program by background program.This method has following advantage: using the corresponding relationship of Hash mapping attribute information, avoiding a large amount of repetitions, useless operation;Query time segmentation, improves search efficiency, shortens the waiting time of user;Avoid the generation of systemic breakdown such case.

Description

A kind of accident alarming enquiring and optimizing method
Technical field
The present invention relates to subway energy management system more particularly to a kind of accident alarming enquiring and optimizing methods.
Background technique
A component part of the accident alarming Query Subsystem as subway energy management system software for monitoring, divides The service condition for analysing the various production energy and equipment, realizes administration of energy conservation.When accident once occurs in system, system must be to use Family provides a kind of means of quick obtaining fault message.It need to have quite high flexibility, and user can be according to some inquiries Condition come position oneself care accident alarming information.
But in a practical situation, causes inquiry velocity slower since the quantity of warning message is very huge, influence user's body It tests, therefore more stringent requirements are proposed to the search efficiency of accident alarming Query Subsystem and safety.
When accident alarming occurs, general can be by the Time (time) of accident alarming, the ObjectId (uniqueness of measuring point Mark), Text (alarm content), in the information deposit alarm such as AlarmBehaviorLink (alarm behavior) library, but user removes It needs outside the information such as the Time (time), ObjectId (unique identification of measuring point), Text (alarm content) of accident alarming, AorId (zone of responsibility belonging to measuring point) and Name (title of measuring point) information are also needed, wherein AorId and Name is in subway energy It will not be stored in the alarm library of management system.
Conventional accident alarming Query Subsystem, way are to be done by inquiry alarm library and repository by database The mode of cartesian product come obtain user needs accident alarming all information.With the accident alarming letter stored in alarm library It ceases more and more, it is lower and lower to will lead to accident alarming Query Subsystem search efficiency.When the warning message in alarm library reaches When to a certain degree, if user looks into all accident alarmings record of whole station in one month, it may result in following problem and occur:
1 inquiry waiting time is too long.
2 cause systemic breakdown: background program does not receive database returned data within the waiting time of setting, can tie Shu Benci inquiry, can cause severest consequences at this time.Data base querying does not terminate at this time, and database will will use The resource of tempdb (temporary library) can be by the resource exhaustion of tempdb, at this time if the subway energy if record number is enough When management system there are other programs to need using tempdb, catastrophic consequence can be caused.
Inquiry plan is the set for the SQL statement that user is submitted, and executive plan is by produced after optimization processing Sentence set.The process of DBMS processing inquiry plan is such that in the morphology for finishing query statement, after syntax check, Sentence is submitted to the query optimizer of DBMS, after optimizer finishes the optimization of algebraic optimization and access path, by precompile Module is handled sentence and is generated executive plan, is then submitted to system processing in the suitable time and is executed, will finally hold Row result returns to user.It is all to use to be based in the highest version of actual database product (such as Oracel, sybase) The optimization method of cost, this optimization can estimate different inquiry plans according to information obtained from system dictionary table Then cost selects a preferably executive plan.Many programmers think that query optimization is data base management system (DBMS) Task, the SQL statement relationship write with programmer is little, this is wrong.One good query execution plan often may be used So that program feature improves decades of times.
The main task of query optimizer is control and the process for accelerating query execution and data transmission.However, inquiry is excellent Changing is always a complicated problem, and ideal, comprehensive query optimization is nearly impossible, and many experts and scholar are at this Many research and discussion were once made in field, but generally speaking, unsatisfactory, and the inquiry that often can only achieve localized target is excellent Change effect or even some theories and is not suitable for.
It becomes better and better although present database product has been made in terms of query optimization, the SQL submitted by user Sentence is the basis of system optimization, but becomes high after optimization of the one difficult to realize originally bad inquiry plan Jing Guo system Effect.
Summary of the invention
It aiming at the problems existing in the prior art, is the real-time for guaranteeing subway energy management system software, the present invention mentions A kind of accident alarming enquiring and optimizing method out makes to inquire as far as possible during query execution engine generates an implementation strategy Overhead and reach minimum total time.
Real system is different to the specific implementation of query optimization, but in general, can be summarized as four steps:
(1) certain internal representation, normally referred to as syntax tree are converted a query into.
(2) syntax tree is changed into according to certain equivalence transformation rule by optimization (standard) form.
(3) operative algorithm for selecting bottom, operates each of syntax tree and needs, according to access path, data Storage and distribution, storing data the information such as cluster to select specifically to execute algorithm.
(4) inquiry plan is generated.Inquiry plan is made of a series of internal operations, these internal operations are according to certain Order constitute one of inquiry and carry into execution a plan, usually such carry into execution a plan has many, needs to each executive plan meter Cost is calculated, therefrom selects cost one the smallest.
The present invention solves problem above by Optimizing Queries plan, and specific technical solution is as follows:
A kind of accident alarming enquiring and optimizing method, including alarm library, interface program, a background program, configuration file and Database;
The configuration file stores the data type information of whole measuring points;
S1: the background program reads the configuration file, and the attribute for the measuring point that the configuration file is related to first The corresponding relationship of information is written in the database;
S2: user passes through the interface program input inquiry condition;The querying condition includes query time, the institute of measuring point Belong to zone of responsibility AorId, the type Type of measuring point, alarm level Severity.
S3: the querying condition is passed to the background program by the interface program;
S4: the background program parses the required parameter and inquires the database;It inquires in the database and meets The record of the AorId and the Type in the querying condition, storage is in memory;
S5: the alarm library is inquired according to the query time, obtains the ObjectId unique identification or Text of measuring point Alarm content or Time time of fire alarming attribute information;According to the corresponding relationship, the name information of measuring point is obtained;
S6: the result that inquiry obtains is returned to the interface program by the background program.
Background program described in S5 divides the query time according to the inquiry initial time and deadline Section, when its be more than threshold value, then be divided into a period, be stored in time array.Preferably, the threshold value It is set as a consecutive days.
The time array obtains the described of measuring point first using the period as database described in unit cyclic query ObjectId, the Text and the Time;Then according to the corresponding relationship, the name information of measuring point is obtained.
Maximum response time is preset for the Time, has been more than maximum response time when the period of user query, then will The result inquired returns to the interface program, and terminates inquiry operation.
The attribute information includes:
The unique identification of ObjectId measuring point;
The affiliated zone of responsibility of AorId measuring point;
The type of Type measuring point, the Type include SinglePoint, MeasuredValue;
The title of Name measuring point;
The time of fire alarming of Time measuring point;
Severity alarm level;
Text alarm content.
The corresponding relationship includes: the Hash mapping Hash_ObIdAor, described of the ObjectId and AorId The Hash of ObjectId and the Name map Hash_ObIdName.
The invention has the following advantages: on the basis of analyzing the key technology of database inquiry optimization, this hair The bright a kind of method for having studied new raising accident alarming search efficiency.Firstly, the present invention avoids obtaining using cartesian product Break down the information of measuring point of alarming, and improves search efficiency, shortens the waiting time of user.Secondly, avoiding two result sets Between traversing operation, program efficiency greatly improved.Finally, avoid systemic breakdown such case generation: no matter user The query time range of setting has much, this program is to be split query time, and cyclic query is then carried out as unit of day Database is ensured that so every time from the result set obtained in database within controlled range.Avoid the knot because of inquiry Fruit collection is too big, and background program has been destroyed, and the inquiry operation of single database is also the case where continuing.
Detailed description of the invention
Fig. 1 is enquiring and optimizing method treatment process of the invention.
Fig. 2 is enquiring and optimizing method flow chart of the invention.
Specific embodiment
The preferred embodiment that the invention will now be described in detail with reference to the accompanying drawings.
1) (data type for the measuring point used all is stored in the configuration file, such as with configuration file SinglePoint, MeasuredValue etc.) mode, using program by ObjectId, Type (measuring point class of these measuring points Type), Name (title of measuring point), the information such as AorId (the affiliated zone of responsibility of measuring point) corresponding relationship newdata library is written In AlarmHistoryQueryDB, so in queries can to avoid use cartesian product obtain break down alarm survey Name the and AorId information of point;2) query time is segmented, such as user query 2015-07-01 to 2015-07-30 Number all warning messages, query time can be split, be inquired as unit of day by the present invention, this reduces The result set of inquiry database every time.3) the Hash mapping of measuring point ObjectId and AorId in queries, are established;ObjectId It is mapped with the Hash of Name, avoids the traversing operation between two result sets in this way, program efficiency greatly improved, saved Query time;4) it has been more than the response time that program, which is provided with maximum response time if the period of user query is too big, The result inquired can be returned to user by program, and remind the user query time too long, it is proposed that user shortens inquiry Time.
The foundation of AlarmHistoryQueryDB:
WriteDB_AlarmPoint program reads config.xml configuration file first and (houses institute in the configuration file Have the data type for the measuring point used, such as SinglePoint, MeasuredValue), it will be involved in config.xml file The ObjectId (unique identification of measuring point) of all measuring points arrived, Type (type of measuring point), Name (title of measuring point) and In the newly-built database AlarmHistoryQueryDB of the corresponding relationship deposit of the information such as AorId (the affiliated zone of responsibility of measuring point).
Inquiry plan is realized:
In accident alarming Query Subsystem, user is first by interface program come input inquiry condition: Time is (when inquiry Between), AorId (zone of responsibility), Severity (alarm level), measuring point type (such as SinglePoint, MeasuredValue), Querying condition is passed to background program by (and then click inquiry button) interface, and background program receives request After parameter, required parameter is parsed, inquiry database is then gone according to the querying condition that parsing obtains, will finally be inquired To result return to interface.
1. initially setting up the Hash of Hash mapping Hash_ObIdAor, ObjectId and Name of ObjectId and AorId Map Hash_ObIdName;
The accident alarming information directly checked out from the alarm library of subway energy management system software is unable to satisfy use Family need because user in addition to need the alarm occur time Time, generate the measuring point of this alarm ObjectId, this Outside the content Text of alarm, it is also necessary to obtain AorId (zone of responsibility) belonging to the measuring point for generating this alarm and generate this report The Name (measuring point title) of alert measuring point, but without storage, (subway energy management system is soft in alarm library by AorId and Name Part is more demanding to the real-time of alarm etc., for the real-time of the system of raising as far as possible, when storing warning message, some Information is not stored in alarm library, such as AorId and Name (passing through repository available AorId and Name)), the present invention passes through The background program WriteDB_AlarmPoint additionally developed, by the ObjectId for the measuring point used in project (measuring point Unique identification), AorId (zone of responsibility belonging to measuring point), ObjectType (type of measuring point, such as SinglePoint) and The information such as Name (title of measuring point) are stored in AlarmHistoryQueryDB database.In inquiry operation, pass through inquiry first AorId (zone of responsibility) and measuring point type (such as SinglePoint, MeasuredValue) the two condition queries in condition AlarmHistoryQueryDB database all checks out all records for meeting the two conditions, establish ObjectId and The Hash of Hash mapping Hash_ObIdAor, ObjectId and Name of AorId map Hash_ObIdName, are stored in memory In.
2. being split using algorithm to query time, the period being divided into as unit of day is stored in time array Middle arrTime;
It is split initial time str_time_st and deadline str_time_et is inquired in querying condition, then It will be in the access time time array arrTime that divide.Core code is as follows:
3. executing inquiry operation;
The time array arrTime according to obtained in step 2 obtains thing first using day as unit cyclic query alarm library Therefore measuring point ObjectId (unique identification of measuring point), Text (alarm content) and the Time (time of fire alarming) of alarm, then root According to Hash_ObIdAor obtained in step 1 (Hash of ObjectId and AorId mapping), Hash_ObIdName (Hash of ObjectId and Name mapping), obtains the input AorId and Name of the alarm point, Hash_ObIdName is measuring point The Hash of ObjectId and Name maps, it is known that measuring point ObjectId, the characteristics of can use Hash mapping, is quickly somebody's turn to do The Name of measuring point can greatly improve program efficiency, save the time.Every time inquiry database when, all can and program setting Response time compares, if the response time arrives, but program inquiring has not been completed, then returns to obtained data User, and remind user query time range too big, query time please be shorten.
Above embodiments are described only for partial function of the invention, but embodiment and attached drawing are not for limiting It is fixed of the invention.Without departing from the spirit and scope of the invention, any equivalent change or retouch done, also belongs to this hair Bright protection scope.Therefore protection scope of the present invention should be based on the content defined in the claims of this application.

Claims (7)

1. a kind of accident alarming enquiring and optimizing method, including alarm library, interface program unit, background program unit, configuration file And database;It is characterized in that, specific steps are as follows:
S1: the background program unit reads the configuration file first, and the configuration file stores the data class of whole measuring points Type information;The number is written in the corresponding relationship of the attribute information for the measuring point that the configuration file is related to by the background program unit According in library;
S2: user passes through the interface program unit input inquiry condition;The querying condition includes query time, the institute of measuring point Belong to zone of responsibility AorId, the type Type of measuring point;
S3: the querying condition is passed to the background program unit by the interface program unit;
S4: required parameter described in the background program unit resolves simultaneously inquires the database;It inquires in the database and meets The record of the AorId and the Type in the querying condition establish mapping relations, and storage is in memory;
S5: the alarm library is inquired according to the query time, obtains the ObjectId or Text or Time of measuring point;ObjectId For unique identification, Text be alarm content, Time is time of fire alarming;According to the mapping relations, obtain Name, i.e. measuring point Name information;The background program unit divides the query time according to the initial time and deadline of query time Section, specifically: it is more than threshold value between when queried, then is divided into a period, is stored in time array;
S6: the result that inquiry obtains is returned to the interface program unit by the background program unit.
2. according to the method described in claim 1, it is characterized by: the time array, first as unit of the period Database described in cyclic query obtains the ObjectId, the Text and the Time of measuring point;Then according to the correspondence Relationship obtains the name information of measuring point.
3. according to the method described in claim 1, it is characterized by: preferably, the threshold value is set as a nature Day.
4. according to the method described in claim 1, it is characterized by: maximum response time is preset for the Time, when user looks into The period of inquiry has been more than maximum response time, then the result inquired is returned to the interface program unit, and Terminate inquiry operation.
5. according to the method described in claim 1, it is characterized by:
The attribute information includes:
The unique identification of ObjectId measuring point;
The affiliated zone of responsibility of AorId measuring point;
The type of Type measuring point, the Type include SinglePoint, MeasuredValue;
The title of Name measuring point;
The time of fire alarming of Time measuring point;
Severity alarm level;
Text alarm content.
6. the method according to claim 1, wherein the mapping relations include: the ObjectId and described Hash mapping Hash_ObIdAor, the ObjectId of AorId and the Hash of the Name map Hash_ObIdName.
7. the method according to claim 1, wherein the querying condition further includes Severity, i.e. alarm etc. Grade.
CN201510677857.1A 2015-10-19 2015-10-19 A kind of accident alarming enquiring and optimizing method Active CN105335489B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510677857.1A CN105335489B (en) 2015-10-19 2015-10-19 A kind of accident alarming enquiring and optimizing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510677857.1A CN105335489B (en) 2015-10-19 2015-10-19 A kind of accident alarming enquiring and optimizing method

Publications (2)

Publication Number Publication Date
CN105335489A CN105335489A (en) 2016-02-17
CN105335489B true CN105335489B (en) 2019-02-15

Family

ID=55286016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510677857.1A Active CN105335489B (en) 2015-10-19 2015-10-19 A kind of accident alarming enquiring and optimizing method

Country Status (1)

Country Link
CN (1) CN105335489B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3608742B1 (en) * 2018-08-07 2021-10-06 ABB Schweiz AG Apparatus for alarm information determination

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102034344A (en) * 2010-11-29 2011-04-27 中国人民解放军第二炮兵工程学院 On-line detection and diagnosis device and method for voltage signal of photoelectric isolating type excess channel
CN103529707A (en) * 2013-11-07 2014-01-22 南京国电南自轨道交通工程有限公司 Design method for full object-oriented intelligent alarm model in integrated supervisory control system of metro
CN104317624A (en) * 2014-11-04 2015-01-28 南京联创科技集团股份有限公司 Plug-in processing based data assembling method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2475335A1 (en) * 2003-07-22 2005-01-22 At&T Corp. Method for three-dimensional inventory link

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102034344A (en) * 2010-11-29 2011-04-27 中国人民解放军第二炮兵工程学院 On-line detection and diagnosis device and method for voltage signal of photoelectric isolating type excess channel
CN103529707A (en) * 2013-11-07 2014-01-22 南京国电南自轨道交通工程有限公司 Design method for full object-oriented intelligent alarm model in integrated supervisory control system of metro
CN104317624A (en) * 2014-11-04 2015-01-28 南京联创科技集团股份有限公司 Plug-in processing based data assembling method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《基于无线通讯和ASP平台的大型装备远程监控技术研究》;赵迎龙;《中国优秀硕士学位论文全文数据库 工程科技Ⅱ辑》;20090315(第3期);C029-34

Also Published As

Publication number Publication date
CN105335489A (en) 2016-02-17

Similar Documents

Publication Publication Date Title
Urbani et al. Dynamite: Parallel materialization of dynamic rdf data
US8712972B2 (en) Query optimization with awareness of limited resource usage
US7698253B2 (en) Method and system for reducing host variable impact on access path selection
CN101382957B (en) System for establishing enquiry model and establishing method
US20170255673A1 (en) Batch Data Query Method and Apparatus
US11693912B2 (en) Adapting database queries for data virtualization over combined database stores
CN109656958B (en) Data query method and system
CN105183735A (en) Data query method and query device
CN106293891B (en) Multidimensional investment index monitoring method
CN104636257A (en) SQL coverage-based automatic testing method for application software in database based on
CN107665216A (en) A kind of data bank access method and middleware
CN109902101A (en) Transparent partition method and device based on SparkSQL
CN111459698A (en) Database cluster fault self-healing method and device
US20190188302A1 (en) Group-by-time operations with returned time context
CN109144978A (en) Right management method and device
GB2614014A (en) Learning-based workload resource optimization for database management systems
CN111581232B (en) ELK-based slow SQL real-time analysis method and system
CN102750384A (en) Device and method for acquiring data from multidatabase engine
CN117033424A (en) Query optimization method and device for slow SQL (structured query language) statement and computer equipment
CN105335489B (en) A kind of accident alarming enquiring and optimizing method
CN114238463A (en) Calculation engine control method and device for distributed index calculation
CN116703228B (en) Big data quality evaluation method and system
CN109033295A (en) The merging method and device of super large data set
US20200341678A1 (en) Data storage method and data storage engine
US11645283B2 (en) Predictive query processing

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant