Embodiment
Below in conjunction with Figure of description embodiment of the present invention is described further.
The method of a kind of while compatible with plurality of types of communication protocols of electric negative control system of the present invention comprises:
The communication protocol abstract model is set up;
The communication protocol message data is dynamically resolved;
Wherein, The present invention can set up a data coding in modeling process; Each data cell is set up unique digital coding at total system, and the identification code and the digital coding of setting up different communication protocol concern correspondence table, to reach the purpose of compatible all communication protocols.
Said database dictionary table is meant a plurality of Table in the relational database, and these dictionary tables combine the complete description of completion to the negative control of electric power communication protocol.Dictionary table comprises: database table coding schedule (TABLECODE), database column coding schedule (TABLE_COLUMN_CODE), digital coding table (DATACODE), table and digital coding relation table (TABLEDATACODE), identification code table (DTICODE), identification code resolution table (DTIPARSE), branch system of solutions table (DECOMPGROUP), identification code group table (DTIGROUP), identification code group detail list (DTIGROUPITEM).
Said Java object is meant a series of types that set up in the communication service program, and these types are combined the complete description of completion to the negative control of electric power communication protocol, and possess the ability of resolving all kinds of frame formats, data cell.These types comprise: Dai, Dti, Dui, DtiGroup.
Said initialization statement is meant a series of database Insert Into scripts, and these scripts insert the relevant dictionary table of database to all the elements of regulation in the negative control communication protocol, supply the communication service program to read.
(1) about the database dictionary table definition
Following table has been listed database coding schedule (TABLECODE) definition:
The field title |
The field note |
Data type |
Keyword |
Can be empty |
Default value |
Remarks |
DATA_CODE |
Digital coding |
varchar2(20) |
PK |
Not |
|
|
DATA_NAME |
Data name |
varchar2(50) |
|
Not |
|
|
The database coding schedule has defined the title that needs the table of specified data in the negative control of the storage communication protocol in the database, comprises instantaneous scale, current electric quantity indication table, day electric weight indication table, month electric weight indication table, alarm event table etc.
In the embodiment of the invention, following table has been listed database column coding schedule definition (TABLE_COLUMN_CODE):
The field title |
The field note |
Data type |
Keyword |
Can be empty |
Default value |
Remarks |
TABLE_CODE |
The table numbering |
number(4) |
PK |
Not |
|
|
COLUMN_CODE |
Column number |
number(5) |
PK |
Not |
|
|
COLUMN_NAME |
The row title |
varchar2(30) |
|
Not |
|
|
The database column coding schedule has defined the title of every row in the table that needs specified data in the negative control of the storage communication protocol in the database.
In the embodiment of the invention, following table has been listed digital coding table (DATACODE) definition:
The field title |
The field note |
Data type |
Keyword |
Can be empty |
Default value |
Remarks |
DATA_CODE |
Digital coding |
varchar2(20) |
PK |
Not |
|
|
DATA_NAME |
Data name |
varchar2(50) |
|
Not |
|
|
UNIT |
Unit |
varchar2(20) |
|
|
|
|
The digital coding table has defined the coding of all data cells in the database aspect, is the data cell definition of the final unique use of total system.
In the embodiment of the invention, following table has been listed table and digital coding relation table (TABLEDATACODE) definition:
The field title |
The field note |
Data type |
Keyword |
Can be empty |
Default value |
Remarks |
TABLE_CODE |
The table numbering |
number(4) |
PK |
Not |
|
|
ASSEMBLE_NUM |
The assembled scheme numbering |
number(4) |
PK |
Not |
|
|
ORIG_DATA_CODE |
The initial data coding |
varchar2(20) |
PK |
Not |
|
|
DEST_DATA_CODE |
The target data coding |
varchar2(20) |
|
Not |
|
Keep |
COLUMN_CODE |
Column number |
number(5) |
|
Not |
|
|
Table and digital coding relation table have defined the corresponding relation of Table and digital coding in the database; Definition to a data unit in communication protocol has multiple; Such as the electric weight indication can be current electric quantity indication, day electric weight indication, month electric weight indication, can be the field of different agreement to the definition unification of same data cell concrete some Table in the database through this table.
In the embodiment of the invention, following table has been listed identification code table (DTICODE) definition:
The identification code table definition in the negative control communication protocol to the regulation of data unit, the data cell that dissimilar in the communication protocol, difference is freezed kind, different objects is all imported in this table and is defined.
In the embodiment of the invention, following table has been listed identification code resolution table (DTIPARSE) definition:
The field title |
The field note |
Data type |
Keyword |
Can be empty |
Default value |
Remarks |
DTI_CODE |
Identification code |
varchar2(20) |
PK |
Not |
|
|
PRTL_TYPE |
Protocol type |
number(2) |
PK |
Not |
|
|
CNT_TYPE |
Content type |
number(3) |
PK |
Not |
|
|
PARSE_ORDER |
Resolve order |
number(3) |
PK |
Not |
|
|
DATA_CODE |
Digital coding |
varchar2(20) |
|
Not |
|
|
PARSE_TYPE |
Resolve type |
number(3) |
|
Not |
|
Word ammeter: 70 |
DATA_LENGTH |
Data length |
number(3) |
|
Not |
|
|
ADD_LENGTH |
Increase length |
number(3) |
|
Not |
|
|
DEC_DIGIT |
Scale |
number(3) |
|
Not |
|
|
BIT_EXTR_FLAG |
The bit extraction sign |
number(1) |
|
Not |
|
Word ammeter: 71 |
BEGIN_BIT |
Initial BIT position |
number(2) |
|
Not |
|
|
END_BIT |
Finish the BIT position |
number(2) |
|
Not |
|
|
INDI_REPLAY_FLAG |
Sign circulation layer sign |
number(1) |
|
Not |
|
Word ammeter: 72 |
REPLAY_TYPE |
The circulation layer type |
number(2) |
|
Not |
|
Word ammeter: 73 |
BLG_REPLAY_FLAG |
Affiliated circulation layer sign |
number(1) |
|
Not |
|
|
BLG_REPLAY_POS_FLAG |
Tick lables in the affiliated circulation layer |
number(1) |
|
Not |
|
Word ammeter: 74 |
DECOMP_FLAG |
Decompose sign |
number(1) |
|
Not |
|
Word ammeter: 75 |
OFFSET_VALUE |
Side-play amount |
number(10) |
|
Not |
|
|
EXT_DISP_FLAG |
Whether the FF data significance bit |
number(2) |
|
Not |
|
0--is invalid, and 1--is effective |
The identification code resolution table is the key that realizes that dynamic protocol is resolved, and has defined all behaviors of the negative control of complete parsing communication protocol message.The identification code table has been set up the notion of cursor; Regard the message that receives as an integral body, cursor moves forward according to the definition in the identification code table, extracts the length of regulation and resolves; Judge circulation, decomposition, extraction, drift marker then, data are done further processing.After cursor runs into end mark, then accomplish resolving, program is returned and is waited for next message.The communication service program reaches the purpose that possesses compatible multiple negative control communication protocol through reading this table.
In the embodiment of the invention, following table has been listed branch system of solutions table (DECOMPGROUP) definition:
The field title |
The field note |
Data type |
Keyword |
Can be empty |
Default value |
Remarks |
DTI_CODE |
Identification code |
varchar2(20) |
PK |
Not |
|
|
DATA_CODE |
Digital coding |
varchar2(20) |
PK |
Not |
|
|
DECOMP_ORDER |
Decompose order |
number(3) |
PK |
Not |
|
|
ITEM_NAME |
Decompose a title |
varchar2(30) |
|
Not |
|
|
BEGIN_BIT |
Initial BIT position |
number(3) |
|
Not |
|
|
END_BIT |
Finish the BIT position |
number(3) |
|
Not |
|
|
The decomposition behavior of bit that divided system of solutions table definition, the message minimum memory unit that the communication service program receives is a byte, but many times a plurality of information have been stored in a byte the inside, represent deciliter state of a switch such as each bit.Through reading the content of branch system of solutions table, read out the information of bit during analytic message, the confession program is used.
In the embodiment of the invention, following table has been listed identification code group table (DTIGROUP) definition:
The field title |
The field note |
Data type |
Keyword |
Can be empty |
Default value |
Remarks |
DTI_GRPID |
The identification code group # |
varchar2(20) |
PK |
Not |
|
|
DT1_GRP_NAME |
The identification code group name is claimed |
varchar2(50) |
|
Not |
|
|
PRTL_TYPE |
Protocol type |
number(2) |
|
Not |
|
Dictionary table classification: 23 |
CNT_TYPE |
Content type |
number(3) |
|
Not |
|
Dictionary table classification: 68 |
OWNER_TYPE |
Object type |
number(2) |
|
Not |
|
Dictionary table classification: 1 |
FRZ_TYPE |
The data-frozen type |
number(2) |
|
Not |
|
Dictionary table classification: 49 |
TABLE_CODE |
The table numbering |
number(4) |
|
Not |
|
|
ASSEMBLE_NUM |
The assembled scheme numbering |
number(4) |
|
Not |
|
|
INTEGRITY_DAIA_NUM |
Data integrity is counted |
number(3) |
|
Not |
|
|
Identification code group table is combined a plurality of data cells, uses during for the data in the communication service programmed acquisition electric power negative control terminal.Through this table, system can dynamic combined copy and accept data class, and does not need to write again code.
In the embodiment of the invention, following table has been listed identification code group detail list (DTIGROUPITEM) definition:
The field title |
The field note |
Data type |
Keyword |
Can be empty |
Default value |
Remarks |
DTI_GRP_ID |
The identification code group # |
varchar2(20) |
PK |
Not |
|
|
DTI_CODE |
Identification code |
varchar2(20) |
PK |
Not |
|
|
ORDERS |
Affiliated order |
number(3) |
|
Not |
|
|
Identification code group detail list has been stipulated the parsing order of each data cell in the group.
(2) about the JAVA definition of object
The DAI class, accomplish the definition of data cell identification point:
public?class?Dai{
public?int?daiCode=-1;//0--64
public?byte[]daiFrm=new?byte[]{0,0};
private?Protocol?m_prtlService=Protocol.getInstance();
public?Dai(){
}
/**
* constructed fuction is constructed DA according to Pn and terminal protocol type
*/
public?Dai(int?daiCode,int?prtl){
}
public?Dai(int?daiCode){
}
/**
* with Da0 and Da1 structure DA (having comprised 698 agreements)
*/
public?Dai(byte?da0,byte?da?1,int?prtl){
}
}
The DTI class, accomplish the information point definition:
public?class?Dti{
Public static finalint DTICODE_IMPEVENT=1; // ask important thing
Part
Public static final int DTICODE_CMMEVENT=2; // request is general
Incident
Public static final int FRZTYPE_NONE=-1; // do not freeze
Public static final int FRZTYPE_HOUR=1; // hour freeze
Public static final int FRZTYPE_DAY=2; // day freezes
Public static final int FRZTYPE_CBDAY=3; // the day of checking meter freezes
Public static final int FRZTYPE_MONTH=4; // the moon freezes
Public static final int FRZTYPE_CURRVE=5; // curve
public?String?dtiCode=″″;
public?byte[]dtiFrm=new?byte[]{0,0};
public?Vector<DtiDesc>dtiDescs=new?Vector<DtiDesc>();
public?DtiDataNe?dtiData=null;
public?byte[]m_td=null;
Public boolean integrity=false; // data integrity sign
private?Vector<byte[]>setParas=new?Vector<byte[]>();
public?int?setSign=-1;
private?Protocol?protocol=Protocol.getInstance();
public?Dti(){
}
}
The DUI class, accomplish the data cell complete definition:
public?class?Dui{
public?Dai?dai;
public?DtiNe?dti;
public?byte[]duiFrm=new?byte[]{0,0,0,0};
private?Protocol?m_prtlService=Protocol.getInstance();
public?Dui(){
}
public?Dui(Dai?dai,DtiNe?dti){
}
}
The DTIGROUP class is accomplished the combination to the data unit, definition:
public?class?DtiGroup{
public?String?dtigrpId=″″;
Public int tableNum=-1; // affiliated Table sequence number
Public int integrityDataNum=-1; // judgment data is complete counts
Public int contentType=-1; The type of // identification code content
public?int?objType=-1,frzType=-1;
Public int frzDensity=-1; // freeze density
private?LinkedHashMap?dtiMap=new?LinkedHashMap();
private LinkedHashMap origDestCodeMap = new
LinkedHashMap();
private LinkedHashMap destOrigCodeMap = new
LinkedHashMap();
public?DtiGroup(){
}
}
(3) about initialization definitions
In the embodiment of the invention, initialization statement is responsible for accomplishing the definition to all data cells in the negative control communication protocol, and accomplishes the conversion of identification code and digital coding, is an instance of initialization statement below:
INSERT INTO DTIPARSE
VALUES(′1′,4,1,0,′3000′,6,4,4,0,0,0,0,0,0,0,3,0,0,0);
INSERT INTO DTIPARSE
VALUES(′1′,4,1,1,′3001′,6,8,8,0,0,0,0,0,0,0,3,0,0,0);
INSERT INTO DTIPARSE
VALUES(′1′,4,1,2,′3002′,6,4,4,0,0,0,0,0,0,0,3,0,0,0);
INSERT INTO DTIPARSE
VALUES(′1′,4,1,3,′3003′,70,3,3,0,0,0,0,0,0,0,3,0,0,0);
INSERT INTO DTIPARSE
VALUES(′1′,4,1,4,′3004′,6,11,11,0,0,0,0,0,0,0,3,0,0,0);
Seeing also Fig. 1, is the schematic flow sheet of the method analytic message of a kind of while compatible with plurality of types of communication protocols of electric negative control system of the present invention.Beginning, the reading database dictionary table is set up the JAVA object; Received communication message then; Set up cursor, get into parse cycle; Analyze the message data district; Circulate, extract, decompose judgement; Analytic message; Run into end mark, close cursor, finish.
The system of a kind of while compatible with plurality of types of communication protocols of electric negative control system of the present invention comprises the communication server and connected electric power negative control terminal; The said communication server possesses the public network communication capacity; Can set up the multi-protocols passage automatically according to the communication protocol of the electric power negative control terminal on connecting; With electric power negative control terminal data forwarding to the different communication port of different agreement, supply other application services of backstage to use.Wherein, the multi-protocols passage comprises the abstract modeling to present main flow communication protocol.When electric power system need newly access terminal or the data class that need copy and accept when changing; Through the change initialization statement; Again carry out initialize routine, entire database and server have just possessed the support to New Deal or new data kind, need not change code.
The method of a kind of while compatible with plurality of types of communication protocols of electric negative control system of the present invention and system thereof be through the negative control of the complete description electric power of the mode communication protocol of database, Java object, initialization statement, reaches the purpose that the communication service program can the dynamic corresponding agreement changes, avoids hard coded.Make the negative control and management system of electric power have very strong compatibility, and can dispose conveniently, transplant flexibly, exploitation rapidly and efficiently, be easy to field conduct, reduce construction and maintenance cost, the raising operational efficiency.
The above is merely preferred embodiment of the present invention, not in order to restriction the present invention, all any modifications of within spirit of the present invention and principle, being done, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.