An electric energy meter management unit detection method, device, equipment and medium
Patent Information
- Application Number
- CN202510960155.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-11
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2045-07-11
AI Technical Summary
[0005]本申请提供了一种电能表管理单元检测方法、装置、设备及介质,能够解决现有技术中电能表管理单元检测效率低下的问题
[0016] Compared with the prior art, the above embodiments have the following beneficial effects: First, by involving function codes in the function messages, the operation that the management unit test tool needs to perform in the current function message can be distinguished according to the function codes, so as to achieve precise control; furthermore, by reading and writing the function message control register to control the test status of the management unit and reading the status signal data of the management unit, various test conditions can be simulated without physically replacing the hardware, and the virtualized test scenario can extend the hardware life and reduce the risk of poor contact caused by frequent plugging and unplugging of the base table.
Smart Images

Figure CN120742217B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of energy metering equipment testing, and in particular to a method, apparatus, equipment and medium for testing an electricity meter management unit. Background Technology
[0002] With the rapid development of energy metering, the Internet of Things and other fields, electricity meters have gradually evolved from single electricity metering devices into multifunctional module devices that integrate management units such as detection and control, data management, multi-channel acquisition and intelligent adjustment.
[0003] The increasing complexity of electricity meter functions means that interface testing of electricity meters is also becoming more cumbersome. Traditional management unit interface testing methods rely on actual metering base meters. That is, testing different management units requires corresponding metering base meters, which is not only costly and occupies a lot of physical space, but also suffers from low testing efficiency, difficulty in simulating abnormal scenarios, and limited hardware resources. It cannot meet the testing requirements of high efficiency, high coverage, automation, and standardization.
[0004] Therefore, how to improve the detection efficiency of electricity meters that integrate multiple management units is a technical problem that needs to be solved. Summary of the Invention
[0005] This application provides a method, apparatus, equipment, and medium for detecting electricity meter management units, which can solve the problem of low detection efficiency of electricity meter management units in the prior art.
[0006] One embodiment of this application provides a method for detecting an electricity meter management unit, applied to a management unit testing fixture, the management unit testing fixture including: a function register; the method for detecting the electricity meter management unit includes:
[0007] When the first message sent by the host computer is received, the first message is parsed to obtain the frame header of the first message, and the first type of the first message is determined based on the frame header;
[0008] If the first message is a dialysis message, the first message is forwarded to the management unit so that the management unit performs the corresponding test operation according to the first message, receives the test result returned by the management unit, and returns the test result to the host computer.
[0009] If the first message is a function message, read and write operations are performed on the function register according to the first message to control the test status of the management unit or read the status signal data of the management unit.
[0010] Compared with existing technologies, the above embodiments have the following advantages: By sending transparent transmission messages and function messages from the host computer and analyzing the message frame headers, different test requirements can be automatically distinguished, avoiding the time consumption of manually switching test modes in traditional testing and improving test efficiency; furthermore, after the host computer sends transparent transmission messages, the transparent transmission messages are forwarded through the management unit test fixture, realizing automatic control of the management unit test process; finally, by reading and writing function registers through function messages, the status control and data acquisition of the management unit can be realized, and interface testing can be completed without relying on real metering base tables, effectively improving test efficiency and the standardization of the test process, while reducing test hardware costs.
[0011] Further, the step of performing read / write operations on the function register according to the first message to control the test state of the management unit or read the status signal data of the management unit includes:
[0012] The function message includes: a function code;
[0013] The type of the function message is determined based on the function code;
[0014] If the first message is a write function message, then the function register is controlled to change the test status of the management unit according to the first message;
[0015] If the first message is a read function message, then after reading the status signal data of the management unit according to the first message, the status signal data is returned to the host computer.
[0016] Compared with the prior art, the above embodiments have the following beneficial effects: First, by involving function codes in the function messages, the operation that the management unit test tool needs to perform in the current function message can be distinguished according to the function codes, so as to achieve precise control; furthermore, by reading and writing the function message control register to control the test status of the management unit and reading the status signal data of the management unit, various test conditions can be simulated without physically replacing the hardware, and the virtualized test scenario can extend the hardware life and reduce the risk of poor contact caused by frequent plugging and unplugging of the base table.
[0017] Further, the step of returning the status signal data to the host computer includes:
[0018] Generate a corresponding response function code based on the function code;
[0019] Based on the response function code and the status signal data, a corresponding function message return response frame is generated, and the function message return response frame is returned to the host computer.
[0020] Compared with the prior art, the above embodiments have the following beneficial effects: Since the host computer will send multiple first messages at the same time, which may include multiple function messages at the same time, the operation to be performed by the management unit test tool for each function message is different, and the corresponding data returned to the host computer is also different. Therefore, a unique corresponding response function code is generated based on the function code of the currently received function message as a clear response identifier, avoiding confusion between response and request and improving the accuracy of detection.
[0021] Furthermore, after forwarding the first message to the management unit, the process further includes:
[0022] The dialysis message includes: data destination interface code;
[0023] The corresponding device interface is determined based on the data destination interface code, and the first message is forwarded to the management unit through the device interface;
[0024] If the test result is not received from the management unit within the preset time, an exception message is returned to the host computer.
[0025] Compared with the prior art, the above embodiments have the following beneficial effects: by using interface code to dynamically select the transmission path to execute the corresponding test operation, and setting a timeout mechanism during the test, problems can be detected in a timely manner, avoiding long waiting times, thereby improving the system's adaptability and fault tolerance.
[0026] Furthermore, the device interface includes: an uplink communication interface, a dual-core communication interface, a transient waveform interface, and a southbound communication interface.
[0027] Compared with the prior art, the above embodiments have the following beneficial effects: Through the uplink communication interface and the southbound communication interface, the communication between the management unit and the metering base meter is simulated, thereby allowing the test fixture to simulate the behavior of the metering base meter without relying on the real base meter, thus testing the uplink communication function of the management unit; through the dual-core communication interface, adjustable parameters or analog signals are input to the management unit, thereby testing the power-on synchronization performance and serial port performance of the management unit; through the transient waveform interface, the data push function and data receiving performance of the management unit are tested.
[0028] Furthermore, if the first message is a dialysis message, it also includes:
[0029] If parsing the first message fails, determine the type of error in the first message;
[0030] Based on the anomaly type, a corresponding dialysis message parsing anomaly message return frame is generated and returned to the host computer.
[0031] Compared with the prior art, the above embodiments have the following beneficial effects: when the parsing of the dialysis message is abnormal, the corresponding dialysis message parsing abnormal message return frame is returned according to the current abnormal situation. Through the standardized abnormal feedback mechanism, the invisible error is transformed into visible and processable information, thereby improving the communication reliability and fault diagnosis efficiency in the detection process and improving the stability of the overall detection process.
[0032] Furthermore, the status signal data includes: the power-down status signal of the management unit and the electrical signals corresponding to each functional pin of the management unit.
[0033] Compared with the prior art, the above embodiments have the following beneficial effects: by using the management unit test fixture to detect the electrical signals of each functional pin of the management unit in real time, the control signals output by the management unit can be verified in a timely manner to see if they meet expectations. Furthermore, by detecting the power-down status signal of the management unit, the behavior of the management unit in case of unexpected power failure or active shutdown can be determined, and whether its power management module and data protection mechanism are effective.
[0034] Another embodiment of this application provides an energy meter management unit testing device, applied to a management unit testing fixture, the management unit testing fixture including: a function register; the energy meter management unit testing device including: a judgment module, a first execution module and a second execution module;
[0035] The judgment module is used to parse the first message to obtain the frame header of the first message when it receives the first message sent by the host computer, and to determine the first type of the first message based on the frame header;
[0036] The first execution module is configured to forward the first message to the management unit if the judgment module determines that the first message is a dialysis message, so that the management unit performs the corresponding test operation according to the first message, receives the test result returned by the management unit, and returns the test result to the host computer.
[0037] The second execution module is configured to perform read / write operations on the function register according to the first message if the judgment module determines that the first message is a function message, so as to control the test status of the management unit or read the status signal data of the management unit.
[0038] Another embodiment of this application also provides a terminal device, including: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the steps of the energy meter management unit detection method of this application.
[0039] Another embodiment of this application also provides a computer-readable storage medium item, including: a stored computer program, which, when the computer program is running, controls the device where the computer-readable storage medium is located to perform the steps of the energy meter management unit detection method of this application. Attached Figure Description
[0040] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0041] Figure 1 This is a flowchart illustrating a method for detecting an electricity meter management unit provided in some embodiments of this application;
[0042] Figure 2 This is a schematic diagram illustrating the connection relationship between a host computer, a management unit testing fixture, and a management unit, as provided in some embodiments of this application.
[0043] Figure 3 This is a schematic diagram of the functional framework of a management unit test fixture provided in some embodiments of this application;
[0044] Figure 4 This is a schematic diagram illustrating the interface definition of a management unit provided in some embodiments of this application;
[0045] Figure 5 This is a schematic diagram of the structure of an energy meter management unit detection device provided in some embodiments of this application. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0047] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.
[0048] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.
[0049] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0050] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0051] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).
[0052] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.
[0053] As the functions of electricity meters become more complex, interface testing of electricity meters has also become increasingly cumbersome. Traditional management unit interface testing methods rely on actual metering base meters, meaning that testing different management units requires corresponding metering base meters. This is not only costly and occupies a lot of physical space, but also suffers from low testing efficiency, difficulty in simulating abnormal scenarios, and limited hardware resources, failing to meet the requirements for high-efficiency, high-coverage, automated, and standardized testing.
[0054] Please refer to Figure 1To address the low detection efficiency of management units in existing energy meters, this application provides a method for detecting energy meter management units, applied to a management unit testing fixture. The management unit testing fixture includes a function register. The energy meter management unit detection method comprises steps S101 to S103, specifically:
[0055] S101: When the first message sent by the host computer is received, the first message is parsed to obtain the frame header of the first message, and the first type of the first message is determined according to the frame header.
[0056] Furthermore, in some embodiments of this application, the host computer controls the management unit test fixture to communicate with the management unit through a communication interface (Universal Serial Bus, USB), and conducts bidirectional communication with the management unit test fixture. It can send and receive interactive data with any communication interface of the management unit via USB. The management unit test fixture conducts bidirectional communication with the management unit through a preset serial port protocol, wherein the preset serial port protocol includes, but is not limited to, those specified.
[0057] refer to Figure 2 This is a schematic diagram illustrating the connection relationship between a host computer, a management unit test fixture, and a management unit, provided in some embodiments of this application. The management unit test fixture communicates bidirectionally with the management unit via UART (Universal Asynchronous Receiver / Transmitter) and SPI (Serial Peripheral Interface) serial port protocols. UART is a serial, asynchronous, full-duplex communication protocol, while SPI is a synchronous, serial, full-duplex communication protocol.
[0058] As can be seen, the management unit test fixture mentioned in this application embodiment is a device used to test the interaction interface between the management unit and the metering base meter. In the absence of a metering base meter, the management unit test fixture establishes communication with the management unit as the base meter end, and connects to the host computer to test and evaluate the interface function and stability of the management unit.
[0059] Preferably, in some embodiments of this application, the first message includes at least: a frame header, the length of the content transmitted in the first message, the content transmitted in the first message, a checksum, and a frame trailer; wherein, the frame header is 1 byte in size and is fixed as 0xAA or 0xCC; the length of the content transmitted in the first message is 2 bytes, with the least significant byte first; the length of the content transmitted in the first message is not fixed; the checksum is 2 bytes in size, using a CRC checksum, specifically CRC16-MODUS, with the least significant byte first, and the calculation range of the checksum includes data other than the checksum and the frame trailer in the first message; the frame trailer is 1 byte in size, and the frame trailer of the diagnostic message is fixed as 0x55.
[0060] S102: If the first message is a dialysis message, the first message is forwarded to the management unit so that the management unit performs the corresponding test operation according to the first message, receives the test result returned by the management unit, and returns the test result to the host computer.
[0061] Preferably, in some embodiments of this application, the dialysis message includes, in addition to the content included in the first message above, the data source and the data destination; wherein the data source and the data destination are both 1 byte in size and are represented by the corresponding interface code.
[0062] Preferably, in some embodiments of this application, the content transmitted by the dialysis message adopts the DL / T645 2007 data frame protocol, and the specific content includes at least: frame start symbol, code 68H; address field, code A0~A5; frame start symbol, code 68H; control code, code C; data field length, code L; data field, code DATA; check code, code CS; and end symbol, code 16H. The frame start symbol (FSB) identifies the beginning of a frame and has a value of 68H = 01101000B. Address fields A0 to A5 are the communication addresses, each 6 bytes in size. The control code is fixed at 0x07. The data field length is the number of bytes in the data field; L ≤ 200 for reading data and L ≤ 50 for writing data. L = 0 indicates no data field. The data field includes data identifiers and data, and its structure changes depending on the function of the control code. During transmission, the sender adds 33H per byte, and the receiver subtracts 33H per byte. The checksum is the modulo 256 sum of all bytes from the first FSB to the checksum, i.e., the binary arithmetic sum of all bytes, ignoring overflow values exceeding 256. The end symbol identifies the end of a frame and has a value of 16H = 00010110B.
[0063] Furthermore, in some embodiments of this application, if the first message is a dialysis message, it further includes:
[0064] If parsing the first message fails, determine the type of error in the first message;
[0065] Based on the anomaly type, a corresponding dialysis message parsing anomaly message return frame is generated and returned to the host computer.
[0066] Preferably, in some embodiments of this application, the dialysis message parsing error message return frame is a type of dialysis message, i.e., the frame header is 0xAA; the data source of the dialysis message parsing error message return frame is fixed at 0x00, i.e., the management unit test fixture itself; the length of the content returned by the dialysis message parsing error message return frame is 2 bytes, fixed at 0x0001; the content returned by the dialysis message parsing error message return frame is a 1-byte error code, representing the error type of the dialysis message sent by the host computer.
[0067] Preferably, in some embodiments of this application, the content returned by the dialysis message parsing error message return frame is a 1-byte error code. In some embodiments of this application, the error code is defined as follows: if the error code is 10000000B, it means there is no error; if the error code is 11000000B, it means the frame format of the dialysis message sent by the host computer is abnormal; if the error code is 11100000B, it means the dialysis message sent by the host computer is an invalid operation.
[0068] As can be seen from the above embodiments, when the parsing of the dialysis message is abnormal, this application returns the corresponding dialysis message parsing abnormal message return frame according to the current abnormal situation. Through the standardized abnormal feedback mechanism, the invisible error is transformed into visible and processable information, thereby improving the communication reliability and fault diagnosis efficiency in the detection process and improving the stability of the overall detection process.
[0069] Furthermore, in some embodiments of this application, after forwarding the first message to the management unit, the method further includes:
[0070] The dialysis message includes: data destination interface code;
[0071] The corresponding device interface is determined based on the data destination interface code, and the first message is forwarded to the management unit through the device interface;
[0072] If the test result is not received from the management unit within the preset time, an exception message is returned to the host computer.
[0073] Preferably, in some embodiments of this application, the step of returning an exception message to the host computer if the test result is not received from the management unit after a preset time includes:
[0074] After the management unit test fixture forwards the dialysis message sent by the host computer, it starts the management unit message reply timeout countdown. If the management unit test fixture fails to receive a message reply from the management unit before the timeout countdown, it returns an abnormal message to the host computer via the USB interface.
[0075] As can be seen from the above embodiments, this application uses interface code to dynamically select the transmission path to execute the corresponding test operation, and sets a timeout mechanism during the test to ensure that problems are detected in a timely manner and avoid long waiting times, thereby improving the system's adaptability and fault tolerance.
[0076] Furthermore, in some embodiments of this application, the device interface includes: an uplink communication interface, a dual-core communication interface, a transient waveform interface, and a southbound communication interface.
[0077] Preferably, in some embodiments of this application, the data destination interface code and the data destination interface code are as follows: the management unit test fixture itself is defined by interface code 0x00; the host computer interface is defined by interface code 0x01; the uplink communication interface is defined by interface code 0x02; the southbound communication interface is defined by interface code 0x03; the dual-core communication interface via UART is defined by interface code 0x04; the transient waveform communication interface 1 is defined by interface code 0x05; and the dual-core communication interface via SPI is defined by interface code 0x06.
[0078] Preferably, refer to Figure 3The diagram shows the functional framework of the management unit test fixture. The microcontroller unit (MCU) of the management unit test fixture communicates bidirectionally with the management unit's uplink communication interface via UART, bidirectionally with the management unit's dual-core communication interface via UART, bidirectionally with the management unit's transient waveform interface via SPI, bidirectionally with the management unit's dual-core communication interface via SPI, bidirectionally with the management unit's southbound communication interface via UART or CAN (Controller Area Network, a multi-master serial communication bus standard), bidirectionally with the host computer via USB, and interacts with the management unit's functional pins via MULTI / RST / RQ (MULTI is a multi-function multiplexed pin, RST is a reset signal pin, and RQ is a custom pin). The testing scheme for the management unit's uplink communication interface includes transmit / receive function testing and serial port performance testing; the testing scheme for the management unit's southbound communication interface includes transmit / receive function testing and serial port performance testing; the testing scheme for the management unit's dual-core communication interface includes power-on synchronization function testing and serial port performance testing; the testing scheme for the management unit's SPI data reception includes data push function testing and performance testing; the testing scheme for the management unit's functional pin monitoring includes monitoring of position signals, multi-function pulses, reset, etc.; and it also includes testing of the management unit's power-down signal interface.
[0079] As can be seen from the above embodiments, this application simulates the communication between the management unit and the metering base meter through the uplink communication interface and the southbound communication interface, thereby allowing the test fixture to simulate the behavior of the metering base meter without relying on the real base meter, thus testing the uplink communication function of the management unit; through the dual-core communication interface, adjustable parameters or analog signals are input to the management unit, thereby testing the power-on synchronization performance and serial port performance of the management unit; through the transient waveform interface, the data push function and data receiving performance of the management unit are tested.
[0080] S103: If the first message is a function message, perform read / write operations on the function register according to the first message to control the test status of the management unit or read the status signal data of the management unit.
[0081] Furthermore, in some embodiments of this application, the step of performing read / write operations on the function register according to the first message to control the test state of the management unit or read the status signal data of the management unit includes:
[0082] The function message includes: a function code;
[0083] The type of the function message is determined based on the function code;
[0084] If the first message is a write function message, then the function register is controlled to change the test status of the management unit according to the first message;
[0085] If the first message is a read function message, then after reading the status signal data of the management unit according to the first message, the status signal data is returned to the host computer.
[0086] Preferably, in some embodiments of this application, the function message, in addition to the content included in the first message described above, also includes: a function code and a register address. The function code is 1 byte in size and is used to define the read / write function register; the register address is 2 bytes in size and is used to determine the specific read / write operation to be performed. The frame end of the function message is fixed at 0x66.
[0087] Preferably, in some embodiments of this application, when the function code is 0x03, it represents that the current function message is a read function message and the operation of reading the function register is performed; when the function code is 0x06, it represents that the current function message is a write function message and the operation of writing the function register is performed.
[0088] Preferably, in some embodiments of this application, if the current function message is a read function message, then when the register address is 0x1000, the operation of reading the status of the management unit's position signal is executed; when the register address is 0x1001, the operation of reading the management unit's management signal output status is executed; when the register address is 0x1002, the operation of reading the management unit's power-down signal is executed.
[0089] Preferably, in some embodiments of this application, if the current function message is a write function message, the register address is only 0x1002, indicating that the power-down state of the management unit needs to be changed. If the content of the write function message is 0x00, it indicates that the power-down state of the management unit is turned off; if the content of the write function message is 0x01, it indicates that the power-down state of the management unit is turned on.
[0090] As can be seen from the above embodiments, this application firstly involves function codes in the function messages, and distinguishes the operations that the management unit test tool needs to perform in the current function message according to the function codes, so as to achieve precise control; furthermore, by reading and writing the function message control register, the test status of the management unit is controlled and the status signal data of the management unit is read, so that multiple test conditions can be simulated without physically replacing the hardware, and the virtualized test scenario can extend the hardware life and reduce the risk of poor contact caused by frequent plugging and unplugging of the base table.
[0091] Furthermore, in some embodiments of this application, the step of returning the status signal data to the host computer includes:
[0092] Generate a corresponding response function code based on the function code;
[0093] Based on the response function code and the status signal data, a corresponding function message return response frame is generated, and the function message return response frame is returned to the host computer.
[0094] Preferably, in some embodiments of this application, the function message return response frame is a type of function message, that is, the frame header of the function message return response frame is fixed at 0xCC. In some embodiments of this application, the function code of the function message return response frame includes: 1000XXXXB representing no function error; 1100XXXXB representing an error in the frame format of the function code sent by the host computer; 1110XXXXB representing an invalid operation of the function message sent by the host computer. Wherein, XXXX is the function code in the function message sent by the host computer. For example, if the function code sent by the host computer is 0x03 (00000011B), the corresponding function code of the function message return response frame is 0x83 (10000011B).
[0095] As can be seen from the above embodiments, since the host computer can send multiple first messages at the same time, which may include multiple function messages, the operation to be performed by the management unit test tool for each function message is different, and the corresponding data returned to the host computer is also different. Therefore, a unique corresponding response function code is generated based on the function code of the currently received function message as a clear response identifier to avoid confusion between response and request and improve the accuracy of detection.
[0096] Furthermore, in some embodiments of this application, the status signal data includes: the power-down status signal of the management unit and the electrical signals corresponding to each functional pin of the management unit.
[0097] Preferably, in some embodiments of this application, if the read function message register address is 0x1000, the position signal status of the management unit is returned through the function message return response frame. If the position signal of the management unit is valid, the content of the function message return response frame is set to 0x01; if the management unit has no position signal, the content of the function message return response frame is set to 0x00. If the read function message register address is 0x1001, the management signal output status of the management unit is returned through the function message return response frame. If the management unit has a pulse output, the content of the function message return response frame is set to 0x01; if the management unit has no pulse output, the content of the function message return response frame is set to 0x00. If the read function message register address is 0x1002, the power-down signal status of the management unit is returned through the function message return response frame. If the power-down signal of the management unit is not effective, the content of the function message return response frame is set to 0x00; otherwise, it is set to 0x01.
[0098] It is understood that the power-down state signal mentioned in the embodiments of this application refers to the power-down signal active state mentioned above, and the electrical signals corresponding to each functional pin of the management unit include, but are not limited to, the management signal output state and the management unit in position signal state mentioned above.
[0099] As can be seen from the above embodiments, this application uses a management unit test fixture to detect the electrical signals of each functional pin of the management unit in real time, thereby verifying in a timely manner whether the control signals output by the management unit meet expectations. Furthermore, by detecting the power-down status signal of the management unit, it can determine the behavior of the management unit when there is an unexpected power outage or when it is actively shut down, and whether its power management module and data protection mechanism are effective.
[0100] Preferably, the functional messages mentioned in some embodiments of this application are only used for data interaction between the host computer and the management unit test tool; at the same time, different messages need to be distinguished by a frame separator. The frame separator only serves as a separator and has no actual meaning. The size of the frame separator is 4 bytes, specifically 0xFE 0xFE 0xFE 0xFE.
[0101] Preferably, in some embodiments of this application, the communication between the host computer and the management unit test fixture is USB data packet communication, which limits the maximum length of a single data packet to 1024 bytes, and a data packet can contain multiple different first messages at the same time.
[0102] Preferably, Figure 4 The following is a schematic diagram of the interface definition of a management unit provided in some embodiments of this application, wherein the definitions of each interface are as follows: MVCC: Module power supply positive terminal; MVSS: Module power supply ground; J-RXD2 / RST: Composite function pin, which has both data reception and reset functions; CON_RG: Connection / configuration resistor; SPI2_MOSI: SPI2 interface master output slave input data line; SPI2_MISO: SPI2 interface master input slave output data line; SPI2_NSS: SPI2 interface chip select signal; K-RXD1: Keyboard / peripheral receive data; SPI1_CLK: SPI1 interface clock line; SPI1_CS: SPI1 interface chip select signal; MULTI: Multifunction pin; T-XD2: Transmit data; SPI2_CLK: SPI2 interface clock line; SPI2_CS: SPI2 interface chip select signal; SCC: Specific control signal.
[0103] In summary, the energy meter management unit testing method provided in this application has the following advantages: It automatically distinguishes between different test requirements by sending transparent and functional messages from a host computer and analyzing the message frame headers, avoiding the time consumption of manually switching test modes in traditional testing and improving test efficiency. Furthermore, after the host computer sends transparent messages, the management unit testing fixture forwards the messages, achieving automatic control of the management unit testing process. Finally, by reading and writing function registers using functional messages, it achieves status control and data acquisition of the management unit, completing interface testing without relying on a real metering base, effectively improving test efficiency and the standardization of the test process, while reducing test hardware costs. In the absence of a metering base, the management unit testing fixture integrates diversified interface testing solutions, controlling the test process by sending transparent messages from a host computer and achieving status control and data acquisition by reading and writing function registers using functional messages to complete interface testing. It has the advantages of high testing efficiency and high reliability, while also solving the problems of poor flexibility, high testing costs, and limited test scenario coverage in current management unit testing.
[0104] like Figure 5 As shown, based on the above-described method embodiments, one embodiment of this application provides an energy meter management unit testing device, applied to a management unit testing fixture, the management unit testing fixture including: a function register; the energy meter management unit testing device including: a judgment module 201, a first execution module 202 and a second execution module 203.
[0105] Further, in some embodiments of this application, the judgment module 201 is used to parse the first message to obtain the frame header of the first message when it receives the first message sent by the host computer, and determine the first type of the first message based on the frame header; the first execution module 202 is used to forward the first message to the management unit if the judgment module determines that the first message is a dialysis message, so that the management unit can perform the corresponding test operation according to the first message, receive the test result returned by the management unit, and return the test result to the host computer; the second execution module 203 is used to perform read and write operations on the function register according to the first message if the judgment module determines that the first message is a function message, so as to control the test status of the management unit or read the status signal data of the management unit.
[0106] Further, in some embodiments of this application, the second execution module 203 includes a first judgment unit, a first execution unit, and a second execution unit; the second execution module 203 is used to perform read and write operations on the function register according to the first message to control the test state of the management unit or read the status signal data of the management unit, including: the function message includes: a function code; the first judgment unit is used to determine the type of the function message according to the function code; the first execution unit is used to control the function register to change the test state of the management unit according to the first message if the first judgment unit determines that the first message is a write function message; the second execution unit is used to read the status signal data of the management unit according to the first message and return the status signal data to the host computer if the first judgment unit determines that the first message is a read function message.
[0107] Furthermore, in some embodiments of this application, the second execution unit is used to return the status signal data to the host computer, including: generating a corresponding response function code according to the function code; generating a corresponding function message return response frame according to the response function code and the status signal data, and returning the function message return response frame to the host computer.
[0108] Further, in some embodiments of this application, the first execution module 202 includes: a forwarding unit and a first exception return unit; after the first execution module 202 forwards the first message to the management unit, it further includes: the dialysis message includes: a data destination interface code; the forwarding unit is used to determine the corresponding device interface according to the data destination interface code, and forward the first message to the management unit through the device interface; the exception return unit is used to return an exception message to the host computer if the test result returned by the management unit is not received within a preset time.
[0109] Furthermore, in some embodiments of this application, the device interface includes: an uplink communication interface, a dual-core communication interface, a transient waveform interface, and a southbound communication interface.
[0110] Furthermore, in some embodiments of this application, the first execution module 202 further includes: an exception type determination unit and a second exception return unit; when the first judgment module 203 determines that the first message is a dialysis message, it further includes: the exception type determination unit, used to determine the exception type of the first message if parsing the first message is abnormal; the second exception return unit, used to generate a corresponding dialysis message parsing exception message return frame according to the exception type, and return the dialysis message parsing exception message return frame to the host computer.
[0111] Furthermore, in some embodiments of this application, the status signal data includes: the power-down status signal of the management unit and the electrical signals corresponding to each functional pin of the management unit.
[0112] It is understood that the above-described device embodiments correspond to the method embodiments of this application, and can implement the electricity meter management unit detection method provided by any of the above-described method embodiments of this application.
[0113] It should be noted that the device embodiments described above are merely illustrative, and some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided in this application, the connection relationships between modules indicate that they have communication connections, which can specifically be implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0114] Based on the above embodiments of the electricity meter management unit detection method, another embodiment of this application provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the electricity meter management unit detection method of any embodiment of this application.
[0115] For example, in this embodiment, the computer program can be divided into one or more modules, which are stored in the memory and executed by the processor to complete this application. The one or more module units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the terminal device.
[0116] The terminal device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0117] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting all parts of the terminal device via various interfaces and lines.
[0118] Based on the above-described method embodiments, another embodiment of this application provides a computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute the electricity meter management unit detection method described in any of the above-described method embodiments of this application.
[0119] The modules / units integrated in the device / terminal equipment, if implemented as software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.
Claims
1. A method for detecting an electricity meter management unit, characterized in that, An application is made to a management unit test fixture, the management unit test fixture including: a function register; the energy meter management unit testing method includes: When the first message sent by the host computer is received, the first message is parsed to obtain the frame header of the first message, and the first type of the first message is determined based on the frame header; If the first message is a transparent message, the first message is forwarded to the management unit so that the management unit performs the corresponding test operation according to the first message, receives the test result returned by the management unit, and returns the test result to the host computer. If the first message is a function message, read and write operations are performed on the function register according to the first message to control the test status of the management unit or read the status signal data of the management unit.
2. The method for detecting an electricity meter management unit as described in claim 1, characterized in that, The step of performing read / write operations on the function register according to the first message to control the test state of the management unit or read the status signal data of the management unit includes: The function message includes: a function code; The second type of the first message is determined based on the function code; If the first message is a write function message, then the function register is controlled to change the test status of the management unit according to the first message; If the first message is a read function message, then after reading the status signal data of the management unit according to the first message, the status signal data is returned to the host computer.
3. The method for detecting an electricity meter management unit as described in claim 2, characterized in that, The step of returning the status signal data to the host computer includes: Generate a corresponding response function code based on the function code; Based on the response function code and the status signal data, a corresponding function message return response frame is generated and returned to the host computer.
4. The method for detecting an electricity meter management unit as described in claim 1, characterized in that, After forwarding the first message to the management unit, the process further includes: The transparent transmission message includes: data destination interface code; The corresponding device interface is determined based on the data destination interface code, and the first message is forwarded to the management unit through the device interface; If the test result is not received from the management unit within the preset time, an exception message is returned to the host computer.
5. The method for detecting an electricity meter management unit as described in claim 4, characterized in that, The device interfaces include: an uplink communication interface, a dual-core communication interface, a transient waveform interface, and a southbound communication interface.
6. The method for detecting an electricity meter management unit as described in claim 1, characterized in that, If the first message is a transparent message, it also includes: If parsing the first message fails, determine the type of error in the first message; Generate a corresponding transparent message parsing exception message return frame according to the exception type, and return the transparent message parsing exception message return frame to the host computer.
7. A method for detecting an electricity meter management unit as described in any one of claims 1 to 6, characterized in that, The status signal data includes: the power-down status signal of the management unit and the electrical signals corresponding to each functional pin of the management unit.
8. A detection device for an electricity meter management unit, characterized in that, The device is applied to a management unit test fixture, which includes a function register; the energy meter management unit testing device includes a judgment module, a first execution module, and a second execution module. The judgment module is used to parse the first message to obtain the frame header of the first message when it receives the first message sent by the host computer, and to determine the first type of the first message based on the frame header; The first execution module is configured to forward the first message to the management unit if the judgment module determines that the first message is a transparent message, so that the management unit performs the corresponding test operation according to the first message, receives the test result returned by the management unit, and returns the test result to the host computer. The second execution module is configured to perform read / write operations on the function register according to the first message if the judgment module determines that the first message is a function message, so as to control the test status of the management unit or read the status signal data of the management unit.
9. A terminal device, characterized in that, The device includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements a method for detecting an energy meter management unit as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform a method for detecting an electricity meter management unit as described in any one of claims 1 to 7.
Citation Information
Patent Citations
System and method for testing protocol consistency of intelligent electric energy meter
CN111343052A
Electric energy meter management module test method and device, storage medium and computer equipment
CN115658459A