CN101917451B - Method of multi-purpose electric energy meter for communication by utilizing DL/T645 communication protocol - Google Patents

Method of multi-purpose electric energy meter for communication by utilizing DL/T645 communication protocol Download PDF

Info

Publication number
CN101917451B
CN101917451B CN 201010284475 CN201010284475A CN101917451B CN 101917451 B CN101917451 B CN 101917451B CN 201010284475 CN201010284475 CN 201010284475 CN 201010284475 A CN201010284475 A CN 201010284475A CN 101917451 B CN101917451 B CN 101917451B
Authority
CN
China
Prior art keywords
command
data
function
read
order
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
CN 201010284475
Other languages
Chinese (zh)
Other versions
CN101917451A (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.)
Wasion Group Co Ltd
Original Assignee
Wasion Group 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 Wasion Group Co Ltd filed Critical Wasion Group Co Ltd
Priority to CN 201010284475 priority Critical patent/CN101917451B/en
Publication of CN101917451A publication Critical patent/CN101917451A/en
Application granted granted Critical
Publication of CN101917451B publication Critical patent/CN101917451B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method of a multi-purpose electric energy meter for communication by utilizing a DL/T645 communication protocol, wherein the relevant attributes of commands are synthesized in one command attribute list; programs confirm the position of the programs in the command attribute list according to the received valid data frames and command processing functions to carry out the corresponding processing according to the attribute values provided by the command attribute list. Because the attributes of universal read-write commands referring to meter variables in a communication protocol DL/T645 of the multi-purpose electric energy meter are centrally managed, i.e. the command attribute list, the list is visual and clear and is convenient to transplant and modify. The invention combines command processing public data banks to finish the processing of the relevant command frames so as to greatly increase the portability and the maintainability of programs.

Description

The method that multifunctional electric energy meter communicates with DL/T645 communication protocol
Technical field
The present invention relates to the method that a kind of multifunctional electric energy meter communicates with DL/T645 communication protocol.
Background technology
" multifunctional electric energy meter communication protocol "---DL/T 645 comprises DL/T 645-1997 and DL/T 645-2007, in practice, general read write command in the stipulations often uses if-else statement and case statement to carry out matching judgment and the processing of order in programming, this pattern has following deficiency from the program maintainability angle: the if-else of (1) tens hundreds of bar or case statement nested, order search and inspection seems very numerous and diverse; (2) often related to the address of variable in RAM in every order, the address of eeprom, access limit grade etc., transplant for modification of program or module, because variable is distributed among a large amount of if-else or case statement, increased virtually designer's workload for the maintenance of program, upgrading, transplanting etc. operation.And in the stipulations General read write commandIt is the core that stipulations are processed, almost related to the whole parameter of table meter, in order to increase the readable and maintainable of program, be necessary address ram, FLASH address, eeprom address, the read-write properties of general read write command, relate to the attributes such as ginseng scope and relevant treatment function and put together it is managed, if with form it is carried out unified management, then can greatly increase the readable and maintainable of program.
Summary of the invention
The object of the present invention is to provide a kind of method that communicates with DL/T645 communication protocol based on the multifunctional electric energy meter of look-up table.
The method that this multifunctional electric energy meter provided by the invention communicates with DL/T645 communication protocol, described method is that association attributes with each bar order is comprehensively in a command property table, program is determined its position in described command property table according to the valid data frame of receiving, command processing function is processed accordingly according to the property value that described command property table provides, the association attributes of described each bar order comprises the command identifier relevant information, order random access memory ram address or the electric erasable formula memory eeprom address of related parameter, logical address (record class data), address in the piece (record class data), data protocol requires length, the inner physical length of data program, read-write properties, cryptographic levels, read-write operation function pointer, the processing of described order comprise following three steps:
(1) coupling of command identifier determines that the order that receives is corresponding to the position of described command property table, according to its its corresponding property value of position acquisition in described command property table;
(2) read-write properties and the cryptographic levels according to described command property table determines whether response command, do not respond and then returns exclude information;
(3) according to the read-write operation of command frame, enter corresponding command processing function in the command property table.
To command identifier continuous, the order linearly aligned a plurality of orders in related parameter address are used as a command set and process.
Command process functions at different levels set up a common data stack with simplified function between loaded down with trivial details parameter transmission, described command processing function at different levels can obtain its required input data from described common data stack, its result is also embodied in the data base and processes the function use for subordinate simultaneously.Can call same function for similar order, special command calls independent function and processes.
The present invention carries out unified management owing to the form in form relates to the attribute of showing variable to the general read write command among the multifunctional electric energy meter communication protocol DL/T645, it is the command property table, this table is intuitive, clear, the convenient transplanting and modification, finish the processing of related command frame in conjunction with command process common data stack, increased the portable and maintainable of program.
Description of drawings
Fig. 1 is the process chart of general read write command.
Fig. 2 is the matching treatment flow chart of command object identifier.
Embodiment
Basic thought of the present invention is the general read write command in the DL/T645 communication protocol to be related to the attribute of showing the meter variable carry out Classification Management, and is specific as follows:
typedef struct
{
unLong BaseCommandMark;
unsigned char ChangeLacation;
unsigned char ChangeLimit;
unsigned int EepromAddress;
unsigned char *ptGlobalVarietyRam;
unsigned char InDataLeng;
unsigned char ExDataLeng;
unsigned long ValueLimit;
unsigned char ReadWriteOpiton;
unsigned char PasswardClass;
unsigned char (*WriteFun)(void *inptUartInform);
unsigned char (*ReadFun)(void *inptUartInform);
}stCommandProptey;
It mainly is comprised of command code identification, data logical address and relative address, data attribute, command operation authority and 5 parts of order read-write operation function, and every/every serial base attribute of ordering is combined, and has just formed the command property table.Wherein command code identification is determined by BaseCommandMark, ChangeLacation and three parameters of ChangeLimit, wherein BaseCommandMark is the base value on the basic command relevant position, ChangeLacation is that command object changes the value on the position, ChangeLimit is for changing the position higher limit, these three parameters are for must there be attribute, and command object carries out its position in the command property table of matching judgment according to these three parameters.Data logical address and relative address comprise EepromAddress and ptGlobalVarietyRam, and these two parameters belong to optional attribute, for some preset parameters, such as pulse duration, belong to invalid attribute; In non-record data, these two parameters are calculated the address among the related parameter RAM of command object and the EEPROM automatically in conjunction with the value on the order variation position and difference D0, the data length InDataLeng of data in program of the base value on the basic command relevant position; In record data, EepromAddress is the relative address of a certain data in the data record piece in the record data, ptGlobalVarietyRam is the recorded information block address, the required property value of dissimilar orders is different, in order to save the program space, different property values shares same attribute space, and namely in different command processing functions, the same class attribute space characterizes different attributes.Data attribute comprises ExDataLeng, InDataLeng and three parameters of ValueLimit, and wherein ExDataLeng must have attribute, and it requires return data length for the agreement read command, and InDataLeng is the data lengths of data in program.When the related parameter of order is variable element, ValueLimit is for arranging the upper limit, when the related parameter of order is fixed value, it deposits preset parameter (such as pulse duration etc.), when the related parameter of order is record class data, it deposits record logic number corresponding to basic command, and wherein InDataLeng and ValueLimit are optional attribute.The command operation authority comprises ReadWriteOpiton and two parameters of PasswardClass, wherein ReadWriteOpiton is the access limit of order, it is essential attribute, (read right keeps item for expansion to operating right grade when PasswardClass is read-write operation, do not use at present), be optional attribute.Order read-write operation function comprises read operation function and write operation function, and these two parameters are option, and read/write function has general purpose function and special purpose function, determines to use what function according to command characteristics.
Command processing function common data stack is based on following three aspects and sets up: the data that provide in (1) command property table can not directly be used (the just first address that the set order provides needs conversion); (2) command processing functions at different levels need the essential information of command frame, and channel under data address and code data address, the command frame etc. is set such as address, the write order of read command return data; (3) set up a common data stack at command processing functions at different levels, loaded down with trivial details parameter transmission between the simplified function, the needed input data of command processing functions at different levels all can obtain from this data base, and result is embodied in the data base simultaneously, process function for subordinate.Wherein the form of command processing function common data stack is as follows:
typedef struct
{
const stCommandProptey *ptTab;
unsigned char *ptUartBuffer0;
unsigned char RW_Command;
unsigned char SerialNO;
unsigned char *ptPassward;
unsigned char *ptSetData;
unsigned char *ptReadRenAdd;
unsigned char RecordNum;
unsigned char MarkBytes;
unsigned int EepromAddress;
unsigned char *ptGlobalVarietyRam;
}stUartInform;
Wherein ptTab points to different command property tables, DL/T645-1997 and DL/T645-2007 are set up respectively the command property table, the one, for the processing directly perceived of program, the 2nd, in order to add zoom table speed, ptUartBuffer0 is the channel buffer first address when pre-treatment, RW_Command is the read write command sign, determined to call and read function and still write function, SerialNO is that command object is in the residing position of command property table, be used for command fetch attribute list relevant parameter, ptPassward is the code data address that order is set, be used for the authority validity judgement, ptSetData is the data address that arranges of order, ptReadRenAdd is that the read command return data is in the address of channel command frame (two kinds of stipulations read command return addresses are different), RecordNum is logic number (namely which bar records recently) corresponding to record class order, MarkBytes is length (two bytes of DL/T645-1997 of order data identifier, four bytes of DL/T645-2007), EepromAddress, ptGlobalVarietyRam is with introducing in the above-mentioned command property table, so differently can process function directly for read-write in address herein.After receiving legal read write command frame, each command processing function need to be with above-mentioned each information of information common data stack according to command property table and each channel command frame mark, for follow-up read/write function.Read/write function has flexibility, extensibility and versatility, can call same function for similar order, and the independent function of the usefulness of special command is processed, and can not change the formation of command property table.Universal function mainly comprises following several data: the general read/write function of (1) directly processing type, this class function generally are used for relating to the order that quantity of state etc. need not computing and judgement; (2) char/int/long type data general-purpose read/write function, most data all exist with the form of binary-coded decimal in the DL/T645 stipulations, and table is had the records of distance by the log the order sequenced data computing often with char/int/long type data, and such universal function solves stipulations and the skimble-scamble problem of routine data; (3) the general function universal function of reading of record class obtains command object corresponding record logic number and recorded information from the common data stack, calculate respective record piece EEPROM memory address, read the data that command object requires in conjunction with the piece bias internal address in the command property table and protocol data length again.And the special processing function mainly is for specific order, and he can call universal function, and is aided with the particular data Processing Algorithm.The special processing function is maximum places when order is deleted and revise, and also is the most local.
Fig. 1 is the process chart of general read write command, this flow process is based on the common data stack, judge at first whether the current command identifier mates, if command identifier coupling, then determined ptUartBuffer0, ptPassward, ptSetData, ptTab, ptReadRenAdd, RW_Command, RecordNum, MarkBytes, EepromAddress, ptGlobalVarietyRam and SerialNO, if command identifier does not mate, then flow process is directly returned, whether the access limit of judging afterwards the current command satisfies, the judgement of its access limit is according to ptUartBuffer0, ptPassward and SerialNO(are used for corresponding read-write properties and the Permission Levels of look-up command attribute list) and judge, if the access limit of the current command does not satisfy, then flow process is directly returned, if the access limit of the current command satisfies the processing that then reads and writes data, wherein process function and determine to call according to RW_Command and read function and still call and write function, the function that calls comes data are processed according to the information of common data stack.
Fig. 2 is the matching treatment flow chart of command object identifier, it at first is the initialization of the correlated variabless such as index point, basic command in the command property table and the communications command that receives are preserved respectively, judge afterwards whether the index point referent is the end mark of command property table, if the index point referent is not the end mark of command property table, then then judge the type of stipulations, if DL/T 645-1997 stipulations, then DL/T 645-1997 stipulations are carried out the decentralized processing of form, its unification is DL/T 645-2007 stipulations form, command object in the reading order attribute list changes the value on the position afterwards, base value on the basic command relevant position, change the position higher limit, if DL/T 645-2007 stipulations then directly the command object in the reading order attribute list change value on the position, base value on the basic command relevant position, change the position higher limit, judge that command object changes value on the position whether at the base value on the basic command relevant position with change between the higher limit of position after again, if the value that command object changes on the position is at the base value on the basic command relevant position and changes between the higher limit of position, whether other that then then judge command object equate with other positions (except changing the position) of basic command, if equate, then preserving command object and basic command is changing the difference on the position and is upgrading common data stack related data, if command object change value on the position be not the base value on the basic command relevant position and change between the higher limit of position or other positions of other positions and basic command (except changing the position) of command object unequal, then index point is from adding, whether rejudge the index point referent is the end mark of command property table, until command object changes value on the position at the base value on the basic command relevant position and changes between the higher limit of position and other positions of other positions and basic command of command object (except changing) equate, return at last matching result.

Claims (4)

1. method that multifunctional electric energy meter communicates with DL/T645 communication protocol, it is characterized in that described method is that association attributes with each bar order is comprehensively in a command property table, program is determined its position in described command property table according to the valid data frame of receiving, command processing function is processed accordingly according to the property value that described command property table provides, the association attributes of described each bar order comprises the command identifier relevant information, order random access memory ram address or the electric erasable formula memory eeprom address of related parameter, the logical address that is used for record class data, the interior address of piece that is used for record class data, data protocol requires length, the inner physical length of data program, read-write properties, cryptographic levels and read-write operation function pointer, the processing of described order comprise following three steps:
(1) coupling of command identifier determines that the order that receives is corresponding to the position of described command property table, according to its its corresponding property value of position acquisition in described command property table;
(2) read-write properties and the cryptographic levels according to described command property table determines whether response command, do not respond and then returns exclude information;
(3) according to the read-write operation of command frame, enter corresponding command processing function in the command property table.
According to multifunctional electric energy meter claimed in claim 1 with the method that DL/T645 communication protocol communicates, it is characterized in that to command identifier continuous, the order linearly aligned a plurality of orders in related parameter address are used as a command set and process.
3. the method that communicates with DL/T645 communication protocol of multifunctional electric energy meter according to claim 1, it is characterized in that command processing functions at different levels set up a common data stack with simplified function between loaded down with trivial details parameter transmission, described command processing function at different levels obtains its required input data from described common data stack, its result is also embodied in the data base and processes the function use for subordinate simultaneously.
4. multifunctional electric energy meter according to claim 1 is characterized in that for the same function of similar command calls with the method that DL/T645 communication protocol communicates, and special command calls independent function and processes.
CN 201010284475 2010-09-17 2010-09-17 Method of multi-purpose electric energy meter for communication by utilizing DL/T645 communication protocol Active CN101917451B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201010284475 CN101917451B (en) 2010-09-17 2010-09-17 Method of multi-purpose electric energy meter for communication by utilizing DL/T645 communication protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201010284475 CN101917451B (en) 2010-09-17 2010-09-17 Method of multi-purpose electric energy meter for communication by utilizing DL/T645 communication protocol

Publications (2)

Publication Number Publication Date
CN101917451A CN101917451A (en) 2010-12-15
CN101917451B true CN101917451B (en) 2013-02-13

Family

ID=43324835

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201010284475 Active CN101917451B (en) 2010-09-17 2010-09-17 Method of multi-purpose electric energy meter for communication by utilizing DL/T645 communication protocol

Country Status (1)

Country Link
CN (1) CN101917451B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104333547B (en) * 2014-10-24 2018-01-19 国家电网公司 A kind of method for security protection of two-way interaction intelligent electric energy meter

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103593372A (en) * 2012-08-17 2014-02-19 苏州工业园区新宏博通讯科技有限公司 Quick searching method of identifiers
CN104374999A (en) * 2014-10-24 2015-02-25 国家电网公司 Intelligent ammeter capable of supporting direct bidirectional interaction
CN108198582B (en) * 2017-12-28 2021-11-12 湖南国科微电子股份有限公司 NAND Flash control method and device and SSD
CN110442364A (en) * 2019-07-10 2019-11-12 北京欧铼德微电子技术有限公司 Processing method, processing system, display device and its electronic equipment of register

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1162120A (en) * 1997-01-31 1997-10-15 清华大学 Method for synchronously metering three-phase/single-phase fundamental electrical energy and harmonic electrical energy and electric meter thereof
CN101789944A (en) * 2010-02-09 2010-07-28 威胜集团有限公司 Development system of communication protocol stack of multifunctional energy meter

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1162120A (en) * 1997-01-31 1997-10-15 清华大学 Method for synchronously metering three-phase/single-phase fundamental electrical energy and harmonic electrical energy and electric meter thereof
CN101789944A (en) * 2010-02-09 2010-07-28 威胜集团有限公司 Development system of communication protocol stack of multifunctional energy meter

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104333547B (en) * 2014-10-24 2018-01-19 国家电网公司 A kind of method for security protection of two-way interaction intelligent electric energy meter

Also Published As

Publication number Publication date
CN101917451A (en) 2010-12-15

Similar Documents

Publication Publication Date Title
CN101917451B (en) Method of multi-purpose electric energy meter for communication by utilizing DL/T645 communication protocol
CN108647914A (en) Production scheduling method, apparatus, computer equipment and storage medium
CN104346285A (en) Memory access processing method, device and system
CN101201600A (en) Self configuration of embedded historians
CN101778147B (en) Menu display method and communication intelligent card
US7043324B2 (en) Methods and systems for modeling a bill of material for a configurable product
CN104778135A (en) Device compatible method and system
CN106446738A (en) Food positioning control method and food positioning control system based on radio frequency identification, and refrigerator
CN106293891A (en) Multidimensional investment target measure of supervision
CN110413265A (en) A kind of software configuration code generating method, device and electronic equipment
CN102163296A (en) Object storage management system based on passive data storage
CN104360853A (en) Method and device for configuration information management and information system
CN102930026A (en) Method and device for converting computer-aided design (CAD) model
CN109204609B (en) General assembly flexible production method, device and equipment
CN103632185A (en) Covering film intelligent card with extended functions
Tsai et al. A cost-based module mining method for the assemble-to-order strategy
CN1731404A (en) Method and system for carrying out engineering work load calculation by using computer
CN102193804A (en) Loading method of drivers in single board and communication equipment
CN103440518A (en) Coal mine management system based on RFID technology
WO2001020480A2 (en) Binary trees for detecting inventory problems in an enterprise model
Rajagopalan Adoption timing of new equipment with another innovation anticipated
CN102214214B (en) Method and device for processing data relationship and mobile communication terminal
CN202995845U (en) Large capacity access control system
CN105303464A (en) Data management system of intelligent electric energy meter
CN101387984A (en) Memory management method and apparatus

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant