WO2020151205A1 - 电能表数据管理方法 - Google Patents

电能表数据管理方法 Download PDF

Info

Publication number
WO2020151205A1
WO2020151205A1 PCT/CN2019/096192 CN2019096192W WO2020151205A1 WO 2020151205 A1 WO2020151205 A1 WO 2020151205A1 CN 2019096192 W CN2019096192 W CN 2019096192W WO 2020151205 A1 WO2020151205 A1 WO 2020151205A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
protocol
list
format
establishing
Prior art date
Application number
PCT/CN2019/096192
Other languages
English (en)
French (fr)
Inventor
熊运塔
甘建平
胡忠勇
Original Assignee
威胜集团有限公司
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 威胜集团有限公司 filed Critical 威胜集团有限公司
Publication of WO2020151205A1 publication Critical patent/WO2020151205A1/zh

Links

Images

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/22Indexing; Data structures therefor; Storage structures
    • 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/25Integrating or interfacing systems involving database management systems

Definitions

  • This application relates to the field of power management technology, but is not limited to the field of power management technology, and in particular to a power meter protocol and data management method.
  • the electric energy meter is an important measurement component in the electric power system, and it undertakes important tasks such as electric energy measurement, data, and data storage. Therefore, the importance of the electric energy meter is self-evident.
  • the electric energy meter not only stores a large amount of electricity consumption data of the user, but also stores various types of data and resources during the development of the electric energy meter.
  • the existing solutions for visualized management of electricity meter protocol objects mainly focus on categorizing DL/T645 protocols and data objects, modeling the protocol in a tree shape, and storing the object storage structure such as authority management, storage location, and storage format. , Display format, etc. are combined in the same host computer in one line table, that is, the protocol and object are defined on the host computer in one line, and then according to the protocol and object, a very comprehensive code function list is generated together, and then C is used on the microcontroller according to the list.
  • the language processing function performs protocol analysis and object reading, as shown in Figure 1 below.
  • the protocol and the meter storage data objects are defined in a table.
  • the protocol and data objects are closely coupled, which is equivalent to a table completed at the same time.
  • the functions of the three modules of protocol management, object management, and data management are expanded, and the functions of freezing records and event recording protocol data are expanded.
  • the upper computer forms are relatively large and complex. In specific implementation, whether it is the software development of the upper computer or the program of the electric meter, the logic is relatively complicated, and it is not easy to develop and maintain.
  • the purpose of the present invention is to provide an electric energy meter protocol and data management method that can improve the stability and reliability of the electric energy meter when using the DL/T698.45 protocol, and reduce the coupling of the electric energy meter protocol with objects and data.
  • the electric energy meter protocol and data management method provided by the present invention includes the following steps:
  • the establishment of the data list specifically includes data ID, data storage format, storage location, storage address and data block number:
  • Data ID Defined as an enumeration form, used for the operation of the object module
  • Data storage format including data format, unit and conversion relationship
  • Storage location and storage address The storage location is obtained by data manipulation according to the storage address;
  • Number of data blocks used to indicate the number of data blocks included in the data.
  • the establishment of the protocol list specifically includes protocol ID, protocol object identifier, attribute, maximum value of element index in the attribute, communication data type number, pre-read or pre-write function, and read and write permissions:
  • Protocol ID used to indicate the protocol applicable to the energy meter
  • the maximum value of the element index in the attribute the maximum value of the element index of an OAD. During the protocol operation, if it exceeds the maximum value of the element index in the attribute, it is an illegal protocol;
  • Communication data type number used to define the data type of all objects
  • Read and write permissions used to indicate the read and write permissions of data.
  • the establishment object list specifically includes protocol ID, data ID base value, continuous number of data ID, communication format, display format and display prompt information:
  • Protocol ID The unique serial number defined in the protocol list, used to find specific data content
  • Data ID base value used to define the starting position of the data ID
  • Number of consecutive data IDs used to define the number of units when one protocol corresponds to multiple consecutive data IDs.
  • the establishment of the DL/T698.45 protocol method list specifically includes the protocol object identifier, method identifier, communication data type number, and method function ID:
  • Protocol object identifier it is the object identifier OI in the object method descriptor OMD;
  • Method ID is the object method number in the object method descriptor OMD
  • Communication data type number the same as the number in the protocol list, and corresponding to the type pointer of the parameter, which is used to define the data type of the method and determine the legality of the data;
  • Method function ID an enumeration of method IDs used internally by the meter.
  • the establishment of a record-type protocol object list specifically includes the establishment of a general event record protocol object list, a phased event record protocol object list, and a freeze event record protocol object list.
  • the electric energy meter protocol and data management method provided by the present invention adopts the design framework idea of separating data, protocol and object and the realization method of protocol data object management, which can improve the stability of electric energy meter when using the DL/T698.45 protocol. Performance and reliability, and reduce the coupling between the energy meter protocol and the object and data.
  • Figure 1 is a schematic diagram of the data management method of the existing electric energy meter system
  • Figure 2 is a schematic diagram of a simple framework of the data management method of the electric energy meter system of the present invention
  • FIG. 3 is a schematic diagram of the overall scheme of the data management method of the electric energy meter system of the present invention.
  • Figure 4 is a flow chart of the implementation of the present invention.
  • Fig. 5 is a flow chart of the data read processing flow of the electric meter of the present invention.
  • FIG. 2 is a schematic diagram of the simple framework of the data management method of the electric energy meter system of the present invention: the data management method of the electric energy meter provided by the present invention includes the following steps:
  • Data ID Data storage format storage location Storage address Number of data blocks
  • the meter data can be summarized as follows:
  • Data ID Defined as an enumeration form for the object module to read and operate. Each data defines an enumeration ID;
  • Data storage format includes data format, unit, and conversion relationship.
  • the voltage format is unsigned int, the unit is V, and it is converted to two decimal places.
  • C language structure Expressed in C language structure as
  • the storage format can be consistent with the display format and communication format, or it can be inconsistent, as long as the format conversion module is used for conversion processing, which can better separate the modules.
  • the data format here can be shared by the three modules of data, protocol, and display, and used as a common attribute in the meter.
  • the data format list is defined, it is also defined as a set of enumerated attributes, which are used as data attributes.
  • the data storage location can be RAM data or EEPROM data, FLASH data directly, and then the underlying driver can perform data operations according to the storage location and address.
  • Number of data blocks DL/T698.45 also supports block data.
  • a positive active energy data includes 5 data in total, 1, 2, 3, and 4 sub-rates, called block data, corresponding to the number of data blocks.
  • the data of the electricity meter can be understood as specific electricity meter data, such as instantaneous data, variable data, and parameter data.
  • Each data corresponds to a data ID; similarly, event and freeze records also have corresponding record IDs.
  • Method operations have method IDs. The contents corresponding to the data ID, record ID, and method ID all belong to the electricity meter data.
  • the data and the protocol may not be strictly related, and the data ID sequence can be inconsistent with the protocol ID sequence, or not continuous, but the smallest element unit communicates with the meter The smallest element of the agreement corresponds.
  • the protocol list is defined as follows:
  • an OAD protocol is defined as a protocol serial number, called the protocol ID, corresponding to the specific OAD protocol content.
  • OAD Including the protocol object identifier OI, attributes, and the corresponding element index size. To determine the legitimacy of the protocol, when defining the list, define the element index size position as the maximum value of the element index in the attribute. During protocol operation, exceeding the maximum element index is an illegal protocol.
  • Communication data type for protocol encoding and decoding, it is necessary to define the data types of all objects. Considering that some objects have common data format content (data types), so the data type definition and naming are standardized to avoid repeated data type definitions and save codes .
  • Simple type definition starting with TYPE; ARRAY is followed by the number of arrays, and the specific data content of the array is repeated because of the repeated element content, so only one set of the same data content needs to be defined; struct also follows the number of elements, because the element content is different , So the structure is defined separately even if it has the same data type.
  • Numbering communication data types into enumerated attributes for use in defining protocols which can also save code space, because a data type is defined as an INT8U (unsigned char) const pointer, which occupies 4 bytes of space, as After the element, it can only occupy 1 byte or 2 bytes according to the number of communication data types.
  • INT8U unsigned char
  • const INT8U AR_3_U16[4] ⁇ array,3,longunsigned,2 ⁇ ;
  • Read and write permissions For example, variables generally have read-only permissions, most of the meter parameters are readable and writable, and some parameters (such as software record numbers, current set of time zone tables, time zone tables, etc.) are read-only outside the factory.
  • Individual protocol content may need to be processed in advance, adding pre-read functions and pre-write functions.
  • the code Stored in the database, when the code is generated, it is sorted by protocol OI and attribute size, so that the meter program can use the dichotomy to find it quickly. That is, it is displayed in categories when the host computer is object-oriented management, and is sorted by protocol size when generating programs.
  • the protocol serial number is the protocol ID: the unique serial number defined in the protocol list, used to find specific data content.
  • Data ID base value and continuous number Since one protocol of DL/T698.45 may correspond to multiple data units, the ID of these data may be continuous or not continuous, such as parameter variables, due to the DL/T698.45 protocol It does not necessarily correspond to the underlying modules one-to-one.
  • the data may be defined by different modules, so the ID may be discontinuous, or the data of the same module, and block data, such as a set of tariff energy or ABC voltage, etc.
  • the LCD parameters correspond to the display parameter IDs (5, 8, 9, 10, 45, 68, 78), which are not continuous, so the LCD parameter list is defined as 5 lines (data ID 8, 9, 10 is defined as the ID base address Is 8, the number of consecutive is 3).
  • the communication format and display format are the common data format attributes of the meter data, but the data type format of communication, display, and storage may be different. For example, most of the DL/T698.45 protocol is hexadecimal, while the display is In BCD decimal system, the conversion relationship (number of decimal places) may also be different. In specific use, look up the object list, obtain the corresponding format, and send the data to the protocol after unified conversion through the format conversion module and format conversion function Module or display module use.
  • Display prompt information At present, most electric meters use field LCD, each screen displays different character display, and the specific display prompt information is defined on the host computer (simulate the screen characters of the LCD screen, and then check the characters, which is vivid and intuitive) , Generate and display the content of the prompt information (5 bytes of data).
  • the prompt information When the C file code is generated, the prompt information is generated in 5 bytes in a list format.
  • Each prompt information is defined as an enumeration
  • the object list module is defined as an enumeration. Protocol
  • the processing module finds the display information by looking up the table and sends it to the display module for use. Different protocols, prompt the same display information, when generating code, the enumeration used is the same. This can save the code space for displaying the information list, and in the object list, only one byte can represent 5 bytes of prompt information content, saving code.
  • the foregoing mainly describes some basic data such as instantaneous data power, variables, parameter variables and other data protocol object lists.
  • the actual DL/T698.45 also has operation methods and recorded data (including general event class7, sub-event class24, and Frozen data class9), you can also use the principle of separation of protocol data objects for simple model establishment.
  • the objects correspond to the method ID and record data ID respectively.
  • Protocol object identifier Communication data type number
  • Method function ID Communication data type number
  • the ACTION operation method of some objects is stipulated in the DL/T698.45 protocol, corresponding to the OMD of the protocol (refer to the DL/T698.45 protocol document data type chapter), the corresponding method content is different, and some operation methods may be possible With parameters, there are data types, and some without parameters (that is, the data type is NULL). According to the requirements of the protocol test specification, the meter program is required to determine the type and data validity of the method. So define the protocol method ID list as follows:
  • Protocol object identifier the object identifier OI in the object method descriptor OMD.
  • Method ID The method ID in the OMD of the object method descriptor-the object method number.
  • Communication data type number same as the number in the protocol list, the type pointer of the corresponding parameter is used to define the data type of the method and judge the legality of the data.
  • the method ID is an enumeration of the method ID used inside the meter. In this way, when operating a DL/T698.45 protocol method, you can find the specific implementation function by searching the method function list through this method ID, and then the method function can be realized.
  • the steps of establishing a record type protocol object list specifically including establishing a general event record protocol object list, a phased event record protocol object list, and a frozen event record protocol object list.
  • the DL/T698.45 protocol divides meter events into general events (7 types) and sub-events (24 types).
  • the attributes of similar events are common, so the attributes of all similar events have the same format, content and communication protocol format , Define several attributes of general events and sub-events in the object list (same as the previous object list table) as the general event attribute list to find the communication format and display format.
  • the corresponding object ID sequence is the same, so as long as you define a record data ID list of the event record table, add the record data ID defined in the object list, then Defined as the specific attribute basic data ID, that is, the data ID of the specific event protocol object can be found according to the basic ID in the object list.
  • This processing method can greatly save the list space code.
  • the OI representative of the split-phase event can be defined as 0x3000 in the protocol list
  • the OI representative of the general event is defined as 0x3FFF
  • the frozen representative OI is defined as 0x5000.
  • the parameter of the event because not every event has it, and all the parameter protocol objects must be listed, so the parameter of the event (the attribute number of general event parameter is 6, the attribute number of sub-event parameter is 5) is regarded as a parameter.
  • the number of occurrences of events in the current value record table is the record module object, the basic ID is defined in the event object list, and the accumulated time is the status module object, so the current value record table uses the two IDs in combination when the meter program is processed.
  • phase-separated event record protocol object list is as follows:
  • the principle is the same as the general event protocol object.
  • the list of itemized event protocol objects can be defined as the following table content:
  • the definition of the frozen event record protocol object list is as follows:
  • Attribute number Attribute number Attribute 2 List content OI Freeze record ID
  • the frozen records only have the frozen data table and the associated object attribute table, which belong to the record module data, so the frozen object list is defined as:
  • Attribute number Attribute number Attribute 2 list content OI freeze record ID
  • the entire management system can be represented by the following block diagram 3, using 7 simple pages on the host computer to manage the protocol list and object list of DL/T698.45 common data (electricity, variables, parameter variables (including event parameters), etc.) , Data list, method protocol object list, general event protocol object list, phased event protocol object list, frozen protocol object list.
  • the event and freeze recording module When the event and freeze recording module records the specific OAD-related object data content, it also obtains the value and storage format of the data through the protocol list -> object list -> data list; when communication is read or displayed, through the protocol list -> object list Get the communication format or display format and display information.
  • the upper computer is used for manual and simple configuration of the table of data, protocol, and object list content, including object-oriented attribute definition, classification definition, and table storage, which are stored in the database, and then the data is sorted when new or modified protocols are added Generate code. Because attribute extraction uses the method of separating data, protocol, and object, the complex protocol data relationship is simplified into three separate modules, and the relationship between the three modules is associated according to their own serial numbers, and the development of the host computer is relatively simple .
  • the generated C code is used in the meter program in the form of constant list and enumeration.
  • the meter program uses a simple search algorithm to find the communication or display format according to the protocol, and obtain the data content, after format conversion, or pass to the encoding module for communication, Or pass it to the display module for data display and prompt the relevant character content.
  • Read and write access control and control of the encryption security mode specified in the DL/T698.45 protocol are also implemented here.
  • the pre-read function judges that only a few protocols need special processing. Add the pre-read function protocol list. By searching the list of pre-read functions, if the protocol has a pre-read function to be called, call the pre-read function processing.
  • Format conversion When the communication (or display) format is consistent with the storage in the data list, format conversion is not required, otherwise the format conversion is performed to obtain the communication or display data, and then they are delivered to the communication codec module or display module interface for processing.
  • the processing flow of setting data is basically the same as the data reading flow.
  • the difference is that the data setting calls the pre-write function, and after the format conversion is placed in the search data list, the communication format needs to be converted to the storage format.
  • the method operation process is basically the same as the data setting process. The difference is that the setting obtains the data ID of the data list, and the method operation obtains the method ID of the data list. Then, according to the method ID, look for the specific method processing function. .
  • the record data After obtaining the specific data ID, the record data calls the event record module to read the data, and then according to the associated object OAD, obtain the data encoding type and data communication format (or display format) by searching the protocol list and object list respectively, After format conversion, it is sent to the communication module for protocol encoding processing or display module display processing.
  • the meter protocol is separated from the attribute list of the meter data object, which realizes the visual management of the separation of the specific meter protocol and the object attribute, and reduces the coupling between the meter protocol and the specific data.
  • the specific data can be divided into modules according to the function, and the power meter software development And later maintenance becomes very easy, not easy to make mistakes.
  • the specific classification of the protocol is realized through the list of the upper computer, and when the protocol list and the data object C file realized by the specific electric meter are generated, the classification definition is no longer used, and the sorted protocol list and data object are uniformly generated to facilitate the program to use the dichotomy
  • the search algorithm realizes protocol search and data object search. This realization method not only realizes the classification and definition of the meter data, but also is closely related to the DL/T698.45 protocol, and is easy to expand and modify. At the same time, it greatly saves the code for the meter implementation. Compared with ordinary programs, the same function saves more than 33% of the code, optimizes the complexity by half, and realizes the logic of the program more simple and understandable, and less error-prone.
  • the method of separating the data protocol object module, the upper computer table is greatly simplified, and the correlation between the lists is basically only the protocol ID, object ID, and data ID and logic are greatly simplified.
  • the software development of the upper computer only needs to store the table in the database, and then perform simple sorting to generate C files. There is no very complicated logical relationship, and the development workload is reduced by more than half.
  • the generated electricity meter C with order List files are simply associated through protocol ID, object ID, and data ID.
  • the correlation between modules is greatly reduced, the logic complexity of the electric meter program is greatly reduced, and the program implementation is more simplified.
  • the same functional data protocol object module separation method saves more than 25% of the code than the protocol tree management section method, optimizes the complexity by more than half, and reduces the logic complexity of the program, which greatly improves the stability of product quality.
  • Protocol Separate data, protocol, and object. It is very easy to transplant to other protocol meters, such as 62056, DL/T645 protocol, etc. You only need to modify the definition of the protocol list and simply modify the object list.
  • the meter program can modify the protocol search method. , The code search and maintenance of the object list and data list basically do not need to be modified, which greatly reduces the migration of standardized module platforms and saves human resource costs.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Arrangements For Transmission Of Measured Signals (AREA)
  • Computer And Data Communications (AREA)

Abstract

一种电能表协议与数据管理方法,包括如下步骤:建立数据列表的步骤;建立协议列表的步骤;建立对象列表的步骤;建立DL/T698.45协议方法列表的步骤;建立记录型协议对象列表的步骤;用建立的数据列表、协议列表、对象列表、DL/T698.45协议方法列表和记录型协议对象列表,对电能表的协议与数据进行管理。

Description

电能表数据管理方法
本申请要求2019年1月22日在中国国家知识产权局提交的中国专利申请的优先权,专利申请号为CN201910056035.X,发明名称为“电能表数据管理方法”,此中国专利申请的全部内容通过引用结合在本申请中。
技术领域
本申请涉及电能管理技术领域但是不限于电能管理技术领域,尤其涉及一种电能表协议与数据管理方法。
背景技术
随着经济技术的发展和人们生活水平的提高,电能已经成为了人们生产和生活中必不可少的二次能源,给人们的生产和生活带来了无尽的便利。电能表是电力系统中的重要计量部件,其承担着电能计量和数据、数据保存等重要任务,因此电能表的重要性不言而喻。电能表中不仅存储着用户的大量用电数据,还存储着电能表在开发时的各类型数据和资源。
2016年,国家电网表布了最新的面向对象DL/T698.45协议。DL/T698.45协议将用于最新的电表中,并且用于新一代双芯电表中,然而DL/T698.45协议采用面向对象形式定义,与原有DL/T645协议是两种完全不同的技术协议,协议灵活,扩展性强,采用面向对象思维,很适合C++之类面向对象上位机进行开发,但使用C语言开发则很不方便,原有DL/T645协议的实现方式已不能满足该协议的开发要求。目前电表大部份使用的是单片机嵌入式技术,芯片资源有限,主要采用C语言开发,实现面向对象的协议开发很不方便。
同时,现有针对电表协议对象进行可视化管理的方案主要是针对DL/T645协议及数据对象进行归类整理,把协议按树形建模,把对象的存储结构如权限管理、存储位置、存储格式、显示格式等合并在同一个上位机一行表格中,即把协议与对象在上位机上定义在一行中,然后根据协议与对象,一起生成很全面的代码功能列表,再根据列表在单片机上采用C语言处理函数进行协议解析与对象读取,如下图1所示。该方案由于DL/T645协议较为简单,同时为了能将所有对象及功能考虑全部,所以将协议与电表存储数据对象都定义在一个表格中,协议与数据对象紧密关联耦合,相当于一个表格同时完成了协议管理、对象管理、数据管理三个模块的功能,再扩展增加冻结记录、事件记录协议数据功能,上位机表格较为庞大复杂。具体实现时,无论是上位机软件开发还是电表程序,逻辑都较为复杂,很不容易开发及维护。
发明内容
本发明的目的在于提供一种能够提高电能表在使用DL/T698.45协议时的稳定性和可靠性、而且降低电能表协议与对象及数据的耦合性的电能表协议与数据管理方法。
本发明提供的这种电能表协议与数据管理方法,包括如下步骤:
建立数据列表的步骤;
建立协议列表的步骤;
建立对象列表的步骤;
建立DL/T698.45协议方法列表的步骤;
建立记录型协议对象列表的步骤;
用建立的数据列表、协议列表、对象列表、DL/T698.45协议方法列表和记录型协议对象列表,对电能表的数据进行管理。
所述的建立数据列表,具体包括数据ID、数据存储格式、存储位置、存储地址和数据块数:
数据ID:定义为枚举形式,用于对象模块的操作;
数据存储格式:包括数据格式、单位和换算关系;
存储位置和存储地址:存储位置为根据存储地址进行数据操作得到;
数据块数:用于表示数据所包括的数据块数。
所述的建立协议列表,具体包括协议ID、协议对象标识、属性、属性内元素索引最大值、通信数据类型编号、读前或写前函数和读写权限:
协议ID:用于表示电能表所适用的协议;
属性内元素索引最大值:一个OAD的元素索引的最大值,在协议操作时,超过属性内元素索引最大值则为不合法的协议;
通信数据类型编号:用于定义所有对象的数据类型;
读写权限:用于标示数据的读写权限。
所述的建立对象列表,具体包括协议ID、数据ID基值、数据ID连续个数、通信格式、显示格式和显示提示信息:
协议ID:协议列表中定义的唯一序列号,用于查找具体数据内容;
数据ID基值:用于定义数据ID的起始位置;
数据ID连续个数:用于定义一条协议对应多个连续数据ID时的单元个数。
所述的建立DL/T698.45协议方法列表,具体包括协议对象标识、方法标识、通信数据类型编号和方法函数ID:
协议对象标识:为对象方法描述符OMD中的对象标识OI;
方法标识:为对象方法描述符OMD中的对象方法编号;
通信数据类型编号:与协议列表中的编号相同,并对应参数的类型指针,用于定义方法的数据类型和判断数据的合法性;
方法函数ID:为电表内部使用的方法ID枚举。
所述的建立记录型协议对象列表,具体包括建立通用事件记录协议对象列表、分相事件记录协议对象列表和冻结事件记录协议对象列表。
本发明提供的这种电能表协议与数据管理方法,采用数据、协议、对象三者分离的设计架构思路与协议数据对象管理实现方法,能够提高电能表在使用DL/T698.45协议时的稳定性和可靠性、而且降低电能表协议与对象及数据的耦合性。
附图说明
图1为现有的电能表系统的数据管理方式示意图;
图2为本发明的电能表系统的数据管理方式简单框架示意图;
图3为本发明的电能表系统的数据管理方式整体方案示意图;
图4为本发明的实现流程图;
图5为本发明的电表读取数据处理流程图。
具体实施方式
如图2所示为本发明的电能表系统的数据管理方式简单框架示意图:本发明提供的这种电能表数据管理方法,包括如下步骤:
建立数据列表的步骤;
数据列表的定义如下:
数据ID 数据存储格式 存储位置 存储地址 数据块数
电表数据可以归纳为如下内容:
数据ID:定义成枚举形式,以便对象模块读取和操作,每一个数据定义一个枚举ID;
数据的存储格式:数据格式包括数据格式,单位,以及换算关系,如 电压格式为unsigned int,单位为V,换算为两位小数。以C语言结构表示为
Typedef struct
{
INT8U format;/*〝数据类型〞*/
INT8U unit;/*〝数据单位〞*/
INT8S exp;/*〝数据小数位数〞*/
}ST_FMT_ATTR;
例如:
电压格式:{E_U_2_BYTE,E_V_UNIT,-2}——两字节无符号数据,单位V,2位小数位数;
电流格式:{E_S_4_BYTE,E_A_UNIT,-3}——四字节有符号数据,单位A,3位小数位数;
存储格式可以与显示格式、通信格式一致,也可以不一致,只要在使用时,统一经过格式转换模块进行转换处理即可,这样可以较好的起到模块分离作用。
这里的数据格式可以数据、协议、显示三个模块共用,在电表中作为一个共有属性使用。定义好数据格式列表后,也是定义为一组枚举属性,作为数据的属性使用。
存储位置与存储地址:数据存储的位置可以直接是RAM数据或EEPROM数据、FLASH数据,然后底层驱动程序根据存储位置与地址进行数据操作即可。
数据块数:DL/T698.45也支持块数据,如一个正向有功电能数据包括总、1、2、3、4分费率共5个数据,称为块数据,对应的数据块数。
电表的数据,可以理解为具体的电表数据,如瞬时数据、变量数据、参变量数据,每个数据对应一个数据ID;同样的,事件和冻结记录也有相 应的记录ID。方法操作有方法ID。数据ID、记录ID、方法ID对应的内容都统一归属于电表数据。
数据定义时,数据具体属于哪个模块可以根据电表底层应用分模块定义,即数据与协议可以不存在严格的关联,数据ID顺序可以与协议ID顺序不一致,或不连续,但最小元素单元与电表通信协议的最小元素对应。
建立协议列表的步骤;
协议列表定义如下:
Figure PCTCN2019096192-appb-000001
与数据定义一样,将一条OAD协议定义成一个协议序列号,称为协议ID,对应具体的OAD协议内容。
OAD:包括协议对象标识OI、属性、以及对应的元素索引大小。由于要判断协议的合法性,定义列表时,把元素索引大小位置定义为属性内元素索引最大值,在协议操作时,超过元素索引最大值则为不合法的协议。
通信数据类型:协议编解码用,需要定义所有对象的数据类型,考虑到一些对象有共同的数据格式内容(数据类型),所以把数据类型定义和命名标准化,避免重复的数据类型定义,节省代码。遵循如下规则定义:
数据类型定义采用简写,举例说明如下:
AR=ARRAY,ST=STRUCT,
U8=unsigned_t,S8=integer,
U16=longunsigned,S16=long_t,
U32=doublelongunsigned,S32=doublelong
U64=long64unsigned,S64=long64
VIS=visiblestring OCTS=octstring
BITS=bitstring EN=enum
DAES=date_time_s
简单类型定义,以TYPE开头;ARRAY后跟随数组个数,数组具体数据内容由于元素内容重复,所以相同数据内容只需定义一组即可;struct后也跟随元素个数,由于元素内容是不同的,所以结构体即使有同样的数据类型也分别定义。
将通信数据类型进行编号成枚举属性,以便在定义协议时用,这样也可以节省代码空间,因为一个数据类型定义为一个INT8U(unsigned char)的const指针,占用的是4字节空间,作为元素后,可以根据通信数据类型个数多少,只占用1字节或2字节即可。
举例说明:三相表电压数据类型定义:ABC三相电压,电压数据类型为longunsigned。
const INT8U AR_3_U16[4]={array,3,longunsigned,2};
读写权限:比如变量一般是只读权限,大部份电表参数是可读写的,部份参数(如软件备案号、当前套时区表,时段表等)为厂外只读等。
个别协议内容,可能需要提前处理,增加读前函数与写前函数。
具体生成C文件代码时,由于读前函数与写前函数比较少,不放在一起,单独生成一个小列表即可,这样比较节省代码。
为了节省代码空间,上位机表格定义时,选择有读写权限,但实际生成constC文件代码时,也一样不体现读写字节内容,而是生成一个只读的协议列表与可读写的协议列表,可以为每条协议节省一个字节的代码,尤其是四字节的CPU,可以在已经四字节对齐的场景下,每条协议可以节省四字节的代码空间。
这两种处理,在节省代码效率上是非常可观的。
协议列表在上位机上定义时,可以根据协议具体的分类(面向对象协议将协议类定义为class id=1至26类),分别定义,从而达到与DL/T698.45 协议的定义紧密关联关系,保存在数据库中,在生成代码时,按协议OI和属性大小进行排序,以便电表程序使用二分法快速查找。即在上位机面向对象管理时以分类展示,生成程序时以协议大小排序。
建立对象列表的步骤;
对象列表的定义如下:
Figure PCTCN2019096192-appb-000002
协议序列号即协议ID:协议列表中定义的唯一序列号,用于查找具体数据内容。
数据ID基值与连续个数:由于DL/T698.45一个协议可能对应多个数据单元,这些数据的ID可能是连续的,也可能不是连续的,比如参变量,由于DL/T698.45协议不一定与底层模块一一对应,可能数据是不同的模块定义,这样ID就可能是不连续的,也可能是同一模块的数据,且是块数据,如一组费率电能量或ABC电压等,为了节省代码空间,将连续的对象ID,用OBIS元素连续个数来定义,方面定位。比如电压对象,数据ID分别对应E_VOLT_LA=1、E_VOLT_LB=2、E_VOLT_LC=3,是连续的。举例定义如下:
{E_P_VOLT_ID,E_VOLT_LA,3,FORMAT_V_COM,FORMAT_V_DISP,E_INFO_V},/*电压*/
可以把电压的对象列表定义一行即可。而LCD参数分别对应显示参数ID(5,8,9、10,45,68,78),则不是连续的,所以LCD参数列表定义成5行(数据ID 8,9,10定义成ID基址为8,连续个数为3)。
举例定义如下:
{
{E_P_LCD_ID,5,1,FORMAT_5_COM,FORMAT_5_DISP,E_INFO_5},
{E_P_LCD_ID,8,3,FORMAT_8_COM,FORMAT_8_DISP,E_INFO_8},
{E_P_LCD_ID,45,1,FORMAT_45_COM,FORMAT_45_DISP,E_INFO_45},
{E_P_LCD_ID,68,1,FORMAT_68_COM,FORMAT_68_DISP,E_INFO_68},
{E_P_LCD_ID,78,1,FORMAT_78_COM,FORMAT_78_DISP,E_INFO_78},
},
实际应用时,上表中的第二列数据ID值5,8,45,68,78是以枚举形式定义的。
通信格式与显示格式为电表数据的共有数据格式属性,但通信、显示、存储的数据类型格式可能是不一样的,比如DL/T698.45协议大部份是十六进制的,而显示是BCD十进制的,同时换算关系(小数位数)也有可能不一样,在具体使用时,查找对象列表,获取到对应的格式后,通过格式转换模块,格式转换函数统一转换后把数据分别发给协议模块或显示模块使用。
显示提示信息,目前电表大部份采用的是字段式液晶,每一屏显示不同的字符显示,在上位机上定义具体的显示提示信息(模拟液晶屏的屏幕字符,然后勾选字符,生动直观),生成显示提示信息内容(5个字节数据),具体生成C文件代码时,提示信息5字节生成列表格式,把每个提示信息定义为枚举,在对象列表模块定义为枚举,协议处理模块通过查表方式查到显示信息,传给显示模块使用。不同协议,提示同样的显示信息,生成代码时,使用的枚举是一样的。这样可以节省显示信息列表的代码空间,而在对象列表中,又只用一个字节即可以代表5字节的提示信息内容,节省代码。
前面主要描述了一些基本数据如瞬时数据电量、变量、参变量之类的数据协议对象列表,实际DL/T698.45还有操作方法以及记录型数据(包括通 用事件class7、分项事件class24、以及冻结数据class9),同样可以采用协议数据对象分离的原则进行简单模型建立。对象分别对应方法ID和记录型数据ID。
建立DL/T698.45协议方法列表的步骤;
DL/T698.45协议方法列表的定义如下:
协议对象标识 方法标识 通信数据类型编号 方法函数ID
DL/T698.45协议中规定了部份对象的ACTION操作方法,对应协议的OMD(参考DL/T698.45协议文档数据类型章节),对应的方法内容是不一样的,且有的操作方法可能带参数,即有数据类型,有的不带参数(即数据类型为NULL),根据协议测试规范要求,需要电表程序判断方法的类型与数据合法性。所以将协议方法ID列表定义如下:
协议对象标识:对象方法描述符OMD中的对象标识OI。
方法标识:对象方法描述符OMD中的方法标识——即对象方法编号。
通信数据类型编号:与协议列表中的编号一样,对应参数的类型指针,用于定义方法的数据类型,判断数据的合法性。
方法ID为电表内部使用的方法ID枚举,这样,在操作一个DL/T698.45的协议方法时,通过这个方法ID,查找方法函数列表,即可找到具体实现函数,即可实现方法功能。
建立记录型协议对象列表的步骤:具体包括建立通用事件记录协议对象列表、分相事件记录协议对象列表和冻结事件记录协议对象列表。
DL/T698.45协议将电表的事件分为通用事件(7类)与分项事件(24类),同类事件的属性是共有的,所以所有同类事件的属性具有相同的格式内容与通信协议格式,将通用事件与分项事件的几个属性在对象列表(同前面对象列表表格)中定义为通用事件属性列表,以便查找通信格式与显示格式。由于事件协议中的大部份对象都是记录模块的对象,所以对应的对象ID顺 序是一致的,这样只要定义一个事件记录表的记录数据ID列表,将对象列表中定义的记录数据ID,则定义为具体属性基础数据ID,即可以根据对象列表中的基础ID,查找到具体事件协议对象的数据ID。这种处理方法,可以极大的节省列表空间代码。例如,可以将分相事件的在协议列表中OI代表规定为0x3000,通用事件的OI代表定义为0x3FFF,冻结代表OI定义为0x5000。
事件的参数,由于不是每个事件都有,且所有的参数协议对象都要列出来,所以把事件的参数(通用事件参数属性编号为6,分项事件参数属性编号为5)属性当做一个参变量协议对象来定义。
通用事件记录协议对象列表的定义如下:
协议属性号 属性2 属性7
对象 事件记录表 当前值记录表
OI 记录数据ID 简化为1个数据ID(累计时间)
事件类几个属性在列表中共用一个数据ID(同一个模块的用基址ID代替),以便查找格式和显示信息。
将同属于记录模块的属性2事件记录表属性3关联对象属性表、属性4当前记录数、属性5最大记录数、属性10时间状态记录表简化,根据事件对象列表中的记录数据基础ID来偏移计算具体ID,所以不用定义所有事件协议属性列表。
当前值记录表的事件发生次数为记录模块对象,基础ID定义在事件对象列表中,累计时间为状态模块对象,所以当前值记录表在电表程序处理时,将两个ID联合使用。
分相事件记录协议对象列表的定义如下:
与通用事件协议对象一样原理,可以将分项事件协议对象列表定义成如下表格内容:
Figure PCTCN2019096192-appb-000003
冻结事件记录协议对象列表的定义如下:
属性号 属性号 属性2
列表内容 OI 冻结记录ID
冻结记录只有冻结数据表与关联对象属性表,都属于记录模块数据,所以将冻结对象列表定义为:
属性号属性号属性2列表内容OI冻结记录ID
综合起来,整个管理系统可以用如下框图3表示,在上位机上用7个简单页面分别管理DL/T698.45普通数据(电量、变量、参变量(包括事件参数)等)的协议列表、对象列表、数据列表,方法协议对象列表、通用事件协议对象列表、分相事件协议对象列表、冻结协议对象列表。
事件与冻结记录模块在记录具体的OAD关联对象数据内容时,也是通过协议列表->对象列表->数据列表获取数据的值与存储格式;通信抄读或显示时,通过协议列表->对象列表获取通信格式或显示格式及显示信息。
本发明的具体实现流程如图4所示:
上位机用于数据、协议、对象列表内容的表格手动简单配置,分别包括面向对象的属性定义、分类定义、表格存储,存储在数据库中,然后在新增协议或修改协议时,对数据进行排序生成代码。由于属性提取采用了数据、协议、对象三者分离的方法,将复杂的协议数据关系简化三个单独 模块,且三个模块的关系分别根据自己的序列号进行关联,上位机的开发工作较为简单。
生成的C代码以常数列表及枚举形式用于电表程序,电表程序采用简单的查找算法,根据协议查找通信或显示格式,以及获取数据内容,进行格式转换后,或传给编码模块进行通信,或传给显示模块进行数据显示,并提示相关字符内容。
读数据的处理流程如图5所示,在整体方案的基础上,读数据处理的详细处理流程如下,增加如下内容:
权限控制:读写权限控制以及DL/T698.45协议规定的加密安全模式控制也在这里实现。
读前函数判断,只有较少协议需要特殊处理,增加读前函数协议列表,通过查找读前函数的列表,如果该条协议有读前函数要调用,则调用读前函数处理。
格式转换:通信(或显示)格式与数据列表中的存储一致时,不用格式转换,否则进行格式转换得到通信或显示的数据,然后分别交给通信编解码模块或显示模块接口处理。
设置数据的处理流程与数据读取流程基本上差不多,不同的是,数据设置调用的是写前函数、以及将格式转换放在了查找数据列表后,需要将通信格式转换成存储格式。
方法操作处理流程与数据设置流程也基本相同,不同的是,设置获取的是数据列表的数据ID,方法操作获取的是数据列表的方法ID,然后根据方法ID,再去查找具体的方法处理函数。
记录型数据在获取到具体的数据ID后,调用事件记录模块读取数据,然后再根据关联对象OAD,通过分别查找协议列表,对象列表,获取数据编码类型、数据通信格式(或显示格式),再进行格式转换后发送到通信模块 进行协议编码处理或显示模块显示处理。
本发明方法的优点如下:
电表协议与电表数据对象的属性列表分离,实现了具体电表协议与对象属性分离的可视化管理,降低电能表协议与具体数据的耦合性,具体数据可以根据功能自已分模块化分,电能表软件开发和后期维护变得非常容易,不易出错。
通过在上位机列表方式实现协议的具体分类,而在生成具体电表实现的协议列表与数据对象C文件时,不再采用分类定义,统一生成已排序的协议列表与数据对象,方便程序使用二分法查找算法实现协议查找与数据对象的查找,这种实现方法不仅实现了电表数据的分类定义,与DL/T698.45协议紧密关键,且易扩展修改,同时又极大的节省了电表实现的代码空间,相比普通程序,同样的功能节省代码33%以上,复杂度优化一半,程序实现逻辑更加简单易懂,不易出错。
与现有针对电表协议进行协议树的全部属性特性管理方法相比,数据协议对象模块分离的方法,上位机表格大为简化,各列表之间的关联性基本上只有协议ID,对象ID,数据ID,逻辑大大简化,上位机软件开发只要把表格存储在数据库中,然后进行简单排序,生成C文件即可,没有非常复杂的逻辑关系,开发工作量减少一半以上,生成的具有顺序的电表C列表文件,其中分别通过协议ID、对象ID、数据ID简单关联,模块之间的关联性大大降底,电表程序实现逻辑复杂度大大降底,程序实现更加简化。同样的功能数据协议对象模块分离的方法比协议树管理节法节省代码25%以上,复杂度优化一半以上,程序逻辑复杂度的降底,使产品质量的稳定性大大提高。
将数据、协议、对象三者分离,非常容易移植到其它协议电表,如62056、DL/T645协议等,只需修改协议列表的定义和简单修改对象列表即可,电 表程序修改协议查找方法即可,对象列表、数据列表的代码查找及维护基本不用修改,极大减少了标准化的模块平台移植工作,节省人力资源成本。

Claims (6)

  1. 一种电能表协议与数据管理方法,其中,所述方法包括如下步骤:建立数据列表的步骤;建立协议列表的步骤;建立对象列表的步骤;建立DL/T698.45协议方法列表的步骤;建立记录型协议对象列表的步骤;用建立的数据列表、协议列表、对象列表、DL/T698.45协议方法列表和记录型协议对象列表,对电能表的协议与数据进行管理。
  2. 根据权利要求1的方法,其中,所述的建立数据列表,具体包括数据ID、数据存储格式、存储位置、存储地址和数据块数:数据ID:定义为枚举形式,用于对象模块的操作;数据存储格式:包括数据格式、单位和换算关系;存储位置和存储地址:存储位置为根据存储地址进行数据操作得到;数据块数:用于表示数据所包括的数据块。
  3. 根据权利要求2的方法,其中,所述的建立协议列表,具体包括协议ID、协议对象标识、属性、属性内元素索引最大值、通信数据类型编号、读前或写前函数和读写权限:协议ID:用于表示电能表所适用的协议;属性内元素索引最大值:一个OAD的元素索引的最大值,在协议操作时,超过属性内元素索引最大值则为不合法的协议通信数据类型编号:用于定义所有对象的数据类型;读写权限:用于标示数据的读写权限。
  4. 根据权利要求3的方法,其中,所述的建立对象列表,具体包括协议ID、数据ID基值、数据ID连续个数、通信格式、显示格式和显示提示信息:协议ID:协议列表中定义的唯一序列号,用于查找具体数据内容;数据ID基值:用于定义数据ID的起始位置;数据ID连续个数:用于定义一条协议对应多个连续数据ID时的单元个数。
  5. 根据权利要求4的方法,其中,所述的建立DL/T698.45协议方法列表,具体包括协议对象标识、方法标识、通信数据类型编号和方法函数ID:协议对象标识:为对象方法描述符OMD中的对象标识OI;方法标识: 为对象方法描述符OMD中的对象方法编号;通信数据类型编号:与协议列表中的编号相同,并对应参数的类型指针,用于定义方法的数据类型和判断数据的合法性;方法函数ID:为电表内部使用的方法ID枚举。
  6. 根据权利要求5的方法,其中,所述的建立记录型协议对象列表,具体包括建立通用事件记录协议对象列表、分相事件记录协议对象列表和冻结事件记录协议对象列表。
PCT/CN2019/096192 2019-01-22 2019-07-16 电能表数据管理方法 WO2020151205A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910056035.X 2019-01-22
CN201910056035.XA CN109739863B (zh) 2019-01-22 2019-01-22 电能表数据管理方法

Publications (1)

Publication Number Publication Date
WO2020151205A1 true WO2020151205A1 (zh) 2020-07-30

Family

ID=66365561

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/096192 WO2020151205A1 (zh) 2019-01-22 2019-07-16 电能表数据管理方法

Country Status (2)

Country Link
CN (1) CN109739863B (zh)
WO (1) WO2020151205A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109739863B (zh) * 2019-01-22 2021-03-02 威胜集团有限公司 电能表数据管理方法
CN110133338B (zh) * 2019-05-16 2021-03-30 国网重庆市电力公司电力科学研究院 一种双芯电能表及显示方法
CN112152882A (zh) * 2020-09-28 2020-12-29 广东浩宁达实业有限公司 面向对象协议数据释义模块、方法、装置以及一种集中器

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050044418A1 (en) * 2003-07-25 2005-02-24 Gary Miliefsky Proactive network security system to protect against hackers
US7315863B2 (en) * 2001-09-20 2008-01-01 Oracle International Corp Method and apparatus for automatic notification of database events
CN101706815A (zh) * 2009-12-03 2010-05-12 北京和利时系统工程有限公司 数据库设备和系统
CN102096663A (zh) * 2009-12-14 2011-06-15 深圳速浪数字技术有限公司 一种数据表编辑方法及数据库服务器
CN108228817A (zh) * 2017-12-29 2018-06-29 华为技术有限公司 数据处理方法、装置和系统
CN109739863A (zh) * 2019-01-22 2019-05-10 威胜集团有限公司 电能表数据管理方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9230006B2 (en) * 2010-09-30 2016-01-05 Bullhorn, Inc. Remote access to tracking system contact information
CN102621921A (zh) * 2012-03-13 2012-08-01 江西省电力科学研究院 一种电能表编程器
CN107861724B (zh) * 2017-11-06 2020-03-20 烟台东方威思顿电气有限公司 快速适配dlms/cosem对象的脚本化编码方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7315863B2 (en) * 2001-09-20 2008-01-01 Oracle International Corp Method and apparatus for automatic notification of database events
US20050044418A1 (en) * 2003-07-25 2005-02-24 Gary Miliefsky Proactive network security system to protect against hackers
CN101706815A (zh) * 2009-12-03 2010-05-12 北京和利时系统工程有限公司 数据库设备和系统
CN102096663A (zh) * 2009-12-14 2011-06-15 深圳速浪数字技术有限公司 一种数据表编辑方法及数据库服务器
CN108228817A (zh) * 2017-12-29 2018-06-29 华为技术有限公司 数据处理方法、装置和系统
CN109739863A (zh) * 2019-01-22 2019-05-10 威胜集团有限公司 电能表数据管理方法

Also Published As

Publication number Publication date
CN109739863B (zh) 2021-03-02
CN109739863A (zh) 2019-05-10

Similar Documents

Publication Publication Date Title
WO2020151205A1 (zh) 电能表数据管理方法
CN107391744B (zh) 数据存储、读取方法、装置及其设备
CN103559217B (zh) 一种面向异构数据库的海量组播数据入库实现方法
CN104573231B (zh) 基于bim的智慧楼宇系统和方法
CN101763416B (zh) 一种数据库空间栅格对象存取方法
WO2019109518A1 (zh) 一种数据列表的上传方法及其终端
CN111191303A (zh) Bim数据处理方法、装置、电子设备及计算机存储介质
WO2022100032A1 (zh) 系统分析可视化方法、装置、电子设备及计算机可读存储介质
CN109753537A (zh) 一种从关系数据到图数据的交互式数据迁移方法
CN102566990B (zh) 一种在Java应用中进行数据操作的方法及装置
CN104317864B (zh) 一种基于iec61850逻辑节点的信息模型自动识别的方法
CN111400389B (zh) 基于ifc扩展的运维5d-bim数据集成共享系统
CN104079613A (zh) 用于多租户间共享应用程序对象的方法和系统
CN106886568B8 (zh) 一种分表方法、装置及电子设备
CN102722368B (zh) 一种基于文档树和消息泵的插件式软件设计方法
CN113642299A (zh) 一种基于电网统计报表一键生成的方法
CN114185895A (zh) 数据导入导出方法、装置、电子设备及存储介质
CN115408546A (zh) 一种时序数据管理方法、装置、设备及存储介质
US12068762B2 (en) Waveform file processing method, storage medium, and device
Liu et al. Research on middle platform construction and large data analysis of power enterprises based on Aliyun
WO2022160443A1 (zh) 谱系挖掘方法、装置、电子设备及计算机可读存储介质
CN115114297A (zh) 数据轻量存储及查找方法、装置、电子设备及存储介质
CN111427867B (zh) 一种基于混合式存储的模型持久化方法
CN112632408A (zh) 基于互联网与智能技术的环境地质调查系统
CN114443427A (zh) 一种基于大数据分析的云资源效能评估方法

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19911838

Country of ref document: EP

Kind code of ref document: A1