CN112367680B - External communication test method and device based on intelligent ammeter and computer equipment - Google Patents

External communication test method and device based on intelligent ammeter and computer equipment Download PDF

Info

Publication number
CN112367680B
CN112367680B CN202011210661.9A CN202011210661A CN112367680B CN 112367680 B CN112367680 B CN 112367680B CN 202011210661 A CN202011210661 A CN 202011210661A CN 112367680 B CN112367680 B CN 112367680B
Authority
CN
China
Prior art keywords
test
code
tested
frame
result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011210661.9A
Other languages
Chinese (zh)
Other versions
CN112367680A (en
Inventor
谢文旺
张乐平
周尚礼
张本松
薛冰
李伟华
郭兴林
范小飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Southern Power Grid Digital Grid Research Institute Co Ltd
Original Assignee
Southern Power Grid Digital Grid Research Institute Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Southern Power Grid Digital Grid Research Institute Co Ltd filed Critical Southern Power Grid Digital Grid Research Institute Co Ltd
Priority to CN202011210661.9A priority Critical patent/CN112367680B/en
Publication of CN112367680A publication Critical patent/CN112367680A/en
Application granted granted Critical
Publication of CN112367680B publication Critical patent/CN112367680B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/08Testing, supervising or monitoring using real traffic
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R35/00Testing or calibrating of apparatus covered by the other groups of this subclass
    • G01R35/04Testing or calibrating of apparatus covered by the other groups of this subclass of instruments for measuring time integral of power or current
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The application relates to an external communication test method and device based on a smart meter, computer equipment and a storage medium. Obtaining a corresponding test result by obtaining a code to be tested for realizing an external communication function in the intelligent ammeter, and carrying out tests including a channel identification function test, a serial port function test, a pipeline function test and the like on the code to be tested, wherein the channel identification function test is carried out on the basis of the identification of the channel by the code to be tested, the serial port function test is carried out on the basis of the test of the data frame by the code to be tested, and the pipeline function test is carried out on the basis of the test of the pipeline data frame by the code to be tested; and generating a test report corresponding to the code to be tested according to the test result. Compared with the traditional method for testing the intelligent ammeter through the black box, the intelligent ammeter testing method has the advantages that the channel identification function test, the serial port function test and the pipeline function test are carried out on external communication, and therefore the comprehensive effect of testing the external communication of the intelligent ammeter can be improved.

Description

External communication test method and device based on intelligent ammeter and computer equipment
Technical Field
The present application relates to the field of functional testing technologies, and in particular, to an external communication testing method and apparatus based on a smart meter, a computer device, and a storage medium.
Background
In recent years, with the continuous development of the energy internet and the continuous deep reform of the electric power market, the brand new business scene emerging in a new period brings higher requirements on interactivity, high efficiency, safety and the like of the intelligent electric meter. Meanwhile, the embedded operating system is introduced into the official member country of the international legal metering organization to meet the new requirements of IR46 on the metering, control and performance of the intelligent electric meter, and the like, so that the embedded operating system becomes an important direction of the development of the new-generation intelligent electric meter.
With the introduction of embedded operating systems, the software architecture of smart meters has become more complex, and the problem of software reliability has become a key factor affecting the quality of smart meters. The communication unit is one of the three core units of the new generation smart meter, and whether the function of external communication is normal or not is one of the key factors of whether the smart meter can normally operate. Therefore, how to develop a scientific and comprehensive test for the external communication function of the new-generation smart meter has become a problem to be solved in the research and development process of the new-generation smart meter. Currently, no embedded operating system is introduced into the existing smart meter, and the external communication function is usually tested by using a black box test mode aiming at the whole meter, however, the potential software quality risk cannot be comprehensively tested by the black box test mode.
Therefore, the existing intelligent ammeter external communication testing method has the defect of incomplete testing.
Disclosure of Invention
Based on the foregoing, it is necessary to provide an external communication testing method, device, computer equipment and storage medium based on a smart meter, which can improve the comprehensiveness and pertinence of the test.
An external communication test method based on a smart meter, the method comprising:
acquiring a code to be tested; the code to be tested comprises a code for realizing an external communication function in the intelligent ammeter;
testing the code to be tested to obtain a corresponding test result; the test comprises a channel identification function test, a serial port function test and a pipeline function test; the channel identification function test is performed on the basis of the identification of the channel by the code to be tested; the serial port function test is carried out on the test of serial port data frames based on the code to be tested; the pipeline function test is carried out on the basis of the code to be tested and the test of the pipeline data frame;
and generating a test report corresponding to the code to be tested according to the test result.
In one embodiment, the testing the code to be tested to obtain a corresponding test result includes:
Performing channel identification function test on the code to be tested to obtain a channel identification function test result;
performing serial port function test on the code to be tested to obtain a serial port function test result; the serial port function test comprises at least one of a serial port conversion function test and a serial port forwarding function test;
performing pipeline function test on the code to be tested to obtain a pipeline function test result; the pipeline functional test comprises at least one of a pipeline data frame identification functional test and a pipeline data frame forwarding functional test;
and obtaining the test result according to the channel identification function test result, the serial port function test result and the pipeline function test result.
In one embodiment, the performing the channel identification function test on the code to be tested to obtain a channel identification function test result includes:
acquiring a test data frame sent by an upper computer through a preset channel; the preset channel comprises an uplink channel, a Bluetooth channel and a downlink channel; the test data frame comprises a test data frame type; the test data frame type comprises a test data frame for a management core in the intelligent electric meter and a test data frame for a metering core in the intelligent electric meter;
Authenticating the test data frame based on a preset baud rate;
transmitting the test data frame passing the authentication to the code to be tested, so that the code to be tested encapsulates the test data frame according to the type of the test data frame to obtain an encapsulated test data frame, and returns the encapsulated test data frame;
comparing the encapsulated test data frame with the test data frame to obtain a comparison result;
judging whether the test data frame type which is not the test data frame exists in the test data frame types or not;
if yes, acquiring a test data frame which is not corresponding to the type of the test data frame from the test data frame type, returning the test data frame to the code to be tested as a new test data frame, so that the code to be tested encapsulates the test data frame according to the test data frame type to obtain an encapsulated test data frame, and returning the encapsulated test data frame;
if not, judging whether a preset channel which does not receive the test data frame exists in the preset channels;
if yes, acquiring a preset channel which does not receive the test data frame from the preset channel, and returning to the step of authenticating the test data frame based on a preset baud rate as a new preset channel;
And if not, ending the channel identification function test, and obtaining the channel identification function test result according to the comparison result.
In one embodiment, the serial port conversion function test includes: a frame format judgment test and a frame conversion test;
the frame format judgment test comprises the following steps:
acquiring a test frame aiming at the code to be tested; the test frame comprises at least two of an address error frame, a control code error frame, a length error frame, a data field error frame, a check code error frame and an end code error frame;
transmitting the test frame to the code to be tested, and obtaining a processing result of the code to be tested on the test frame;
determining a test result of the test frame according to the processing result;
judging whether a test frame which is not sent to the code to be tested exists in the test frames or not;
if yes, acquiring a test frame which is not transmitted to the code to be tested from the test frame, returning to the step of transmitting the test frame to the code to be tested as a new test frame, and acquiring a processing result of the code to be tested on the test frame;
if not, obtaining the test result of the frame format judgment test according to the test results of the plurality of test frames;
The frame conversion test includes:
acquiring an instruction frame aiming at the code to be tested through a preset channel; the preset channel comprises at least one of an uplink channel, a downlink channel and a Bluetooth channel;
the instruction frame is sent to the code to be tested, and a first processing result of the code to be tested for the instruction frame is obtained; the first processing result represents the processing result of address identification conversion of the code to be tested to the instruction frame initiator;
transmitting data frames with different encryption degrees to the code to be tested, and acquiring a second processing result of the code to be tested aiming at the data frames with different encryption degrees; the data frames with different encryption degrees comprise data frames corresponding to plaintext, plaintext and MAC and ciphertext and MAC; the second processing result represents the processing result of the code to be tested for identifying the encryption mode;
communicating with the code to be tested through different types of addresses, and acquiring a third processing result of the code to be tested for the communication of the different types of addresses; the third processing result represents the processing result of the code to be tested for identifying the communication address type;
Transmitting command frames with different lengths to the code to be tested, acquiring output frames of the code to be tested aiming at the command frames with different lengths, and acquiring a fourth processing result according to the output frames; the fourth processing result represents the processing result of the code to be tested on the frame length identification;
and obtaining a test result of the frame conversion test according to the first processing result, the second processing result, the third processing result and the fourth processing result.
In one embodiment, the performing the serial port function test on the code to be tested to obtain a serial port function test result includes:
acquiring a plurality of command frames to be forwarded aiming at the code to be tested; the command frame includes a plurality of different types of command frames;
transmitting the command frame to be forwarded to the code to be tested, so that the code to be tested adds a corresponding logic address to the command frame to be forwarded according to the type of the command frame to be forwarded;
and judging whether the logic address corresponds to the type of the command frame to be forwarded or not, and obtaining a test result of the serial port forwarding function test.
In one embodiment, the performing the pipeline function test on the code to be tested to obtain a pipeline function test result includes:
Transmitting a plurality of error communication frames of different types to the code to be tested through a pipeline corresponding to the type of the error communication frames, and obtaining an output result of the code to be tested;
and obtaining a test result of the pipeline data frame identification function test according to the output result.
In one embodiment, the performing the pipeline function test on the code to be tested to obtain a pipeline function test result includes:
sending a plurality of response frames of different types to the code to be tested, so that the code to be tested analyzes the response frames according to the types of the response frames and returns analysis results; the plurality of different types of response frames comprise a plurality of different types of normal response frames and a plurality of different types of abnormal response frames;
and obtaining a test result of the pipeline data frame forwarding function test according to the analysis result returned by the code to be tested.
An external communication testing device based on a smart meter, the device comprising:
the acquisition module is used for acquiring the code to be tested; the code to be tested comprises a code for realizing an external communication function in the intelligent ammeter;
the test module is used for testing the code to be tested to obtain a corresponding test result; the test comprises a channel identification function test, a serial port function test and a pipeline function test; the channel identification function test is performed on the basis of the identification of the channel by the code to be tested; the serial port function test is carried out on the test of the data frame based on the code to be tested; the pipeline function test is carried out on the basis of the code to be tested and the test of the pipeline data frame;
And the generating module is used for generating a test report corresponding to the code to be tested according to the test result.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the method described above when the processor executes the computer program.
A computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method described above.
According to the external communication testing method, the device, the computer equipment and the storage medium based on the intelligent ammeter, the codes to be tested for realizing the external communication function in the intelligent ammeter are obtained, and the codes to be tested are tested, including channel identification function tests, serial port function tests, pipeline function tests and the like, so that corresponding test results are obtained, wherein the channel identification function tests are conducted on the basis of the identification of the channels by the codes to be tested, the serial port function tests are conducted on the basis of the codes to be tested on the basis of the tests of the data frames, and the pipeline function tests are conducted on the basis of the codes to be tested on the pipeline data frames; and generating a test report corresponding to the code to be tested according to the test result. Compared with the traditional method for testing the intelligent ammeter through the black box, the intelligent ammeter testing method has the advantages that the channel identification function test, the serial port function test and the pipeline function test are carried out on external communication, and therefore the comprehensive effect of testing the external communication of the intelligent ammeter can be improved.
Drawings
FIG. 1 is an application environment diagram of a smart meter-based external communication test method in one embodiment;
FIG. 2 is a flow chart of a smart meter-based external communication testing method in one embodiment;
FIG. 3 is a flow chart of an external communication testing method based on a smart meter according to another embodiment;
FIG. 4 is a flow chart of a smart meter based external communication testing method according to yet another embodiment;
FIG. 5 is a block diagram of an external communication testing device based on a smart meter in one embodiment;
fig. 6 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The external communication testing method based on the intelligent ammeter provided by the application can be applied to an application environment shown in fig. 1. Wherein the test equipment 102 communicates with the server 104 via a network. The test device 102 may obtain a code to be tested for implementing an external communication function from the smart meter, or may obtain the pre-stored code to be tested from a local area of the test device 102, where the test device 102 may perform a corresponding test on the obtained code to be tested, including a channel identification function test, a serial port function test, a pipeline function test, and the like, and obtain a corresponding test result, so that a test report may be generated according to the test result, the test device 102 may send the test report to the server 104, and the server 104 may store the test report. Wherein the test device 102 may be an automated software test platform, and the server 104 may be implemented as a stand-alone server or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 2, there is provided a smart meter-based external communication testing method, which is described by taking the testing device in fig. 1 as an example, and includes the following steps:
step S202, obtaining a code to be tested; the code to be tested includes a code for implementing an external communication function in the smart meter.
The code to be tested can be a code for realizing an external communication function in the smart meter, and the smart meter can be a new generation smart meter conforming to the IR46 standard. The test device 102 may obtain the code to be tested from the smart meter. Specifically, the codes of the external communication function may be in an integral form after being packaged by the codes, and the test device 102 may first obtain the integral codes of the smart meter, and then obtain the relevant codes of the external communication function through header analysis and function positioning, for example, design source codes of functions such as frame format judgment, frame conversion, and the like. The external communication can be uplink communication and downlink communication of the new-generation intelligent ammeter, namely an external communication module in the intelligent ammeter can comprise an uplink module and a downlink module, wherein the uplink module can be used for communication between the electric energy meter and the acquisition equipment; the downlink module can be used for communication between the electric energy meter and other equipment.
Step S204, testing the code to be tested to obtain a corresponding test result; the testing comprises a channel identification function testing, a serial port function testing and a pipeline function testing; the channel identification function test is performed on the identification of the channel based on the code to be tested; the serial port function test is carried out on the test of the data frame based on the code to be tested; pipeline functional testing is performed on the basis of the code to be tested for testing the pipeline data frames.
The code to be tested may be a code for implementing an external communication function in the smart meter, and the test device 102 may perform a corresponding test on the code to be tested and obtain a corresponding test result, for example, may perform a channel identification function test, a serial port function test, a pipeline function test, and the like.
Specifically, in some embodiments, the test device 102 may perform a channel identification function test on the code to be tested to obtain a channel identification function test result; the serial port function test can be carried out on the code to be tested to obtain a serial port function test result; the serial port function test comprises at least one of a serial port conversion function test and a serial port forwarding function test; performing pipeline function test on the code to be tested to obtain a pipeline function test result; the pipeline functional test comprises at least one of a pipeline data frame identification functional test and a pipeline data frame forwarding functional test; and obtaining a test result according to the channel identification function test result, the serial port function test result and the pipeline function test result. The channel identification test may be a test performed on a plurality of channels of external communication, for example, an HPLC channel (uplink channel), a downlink channel, a bluetooth channel, and the like, and the test device 102 may test the identification correctness of the code to be tested on each channel, thereby being a channel identification function test result. The serial port conversion function test in the serial port function test may be a test of the functions of the test device 102 for testing frame format judgment, frame conversion, and the like of external communication, and the serial port forwarding function test may be a test of the routing function of the test device 102 for testing serial port data of external communication. The pipe data frame identification function test in the pipe function test may be a test of the error identification capability of the test device 102 to the code to be tested; the pipe data frame forwarding function test may be a test of the response frame analysis capability of the test device 102 to code to be tested.
Step S206, generating a test report corresponding to the code to be tested according to the test result.
The test results may include a channel identification function test result, a serial port function test result, a pipeline function test result, and the like. The test device 102 may generate a test report corresponding to the code to be tested, that is, a test report corresponding to the external communication function of the smart meter according to the test results corresponding to the plurality of tests, so that the test device 102 may complete the test of the external communication function of the smart meter. The test equipment 102 may also output test reports, such as shown in a display screen of the test equipment 102, so that the relevant staff may perform corresponding processing according to the test reports.
In the external communication testing method based on the intelligent electric meter, the code to be tested for realizing the external communication function in the intelligent electric meter is obtained, and the code to be tested is tested, including a channel identification function test, a serial port function test, a pipeline function test and the like, so that a corresponding test result is obtained, wherein the channel identification function test is performed based on the identification of the channel by the code to be tested, the serial port function test is performed based on the test of the data frame by the code to be tested, and the pipeline function test is performed based on the test of the pipeline data frame by the code to be tested; and generating a test report corresponding to the code to be tested according to the test result. Compared with the traditional method for testing the intelligent ammeter through the black box, the intelligent ammeter testing method has the advantages that the channel identification function test, the serial port function test and the pipeline function test are carried out on external communication, and therefore the comprehensive effect of testing the external communication of the intelligent ammeter can be improved.
In one embodiment, performing a channel identification function test on a code to be tested to obtain a channel identification function test result, including: acquiring a test data frame sent by an upper computer through a preset channel; the preset channel comprises an uplink channel, a Bluetooth channel and a downlink channel; the test data frame includes a test data frame type; the test data frame type comprises a test data frame for a management core in the intelligent electric meter and a test data frame for a metering core in the intelligent electric meter; based on a preset baud rate, authenticating the test data frame; transmitting the test data frame passing the authentication to the code to be tested, so that the code to be tested encapsulates the test data frame according to the type of the test data frame to obtain an encapsulated test data frame, and returning the encapsulated test data frame; comparing the encapsulated test data frame with the test data frame to obtain a comparison result; judging whether the test data frame type which is not a tested data frame exists in the test data frame types or not; if yes, acquiring a test data frame corresponding to the type which is not the tested data frame from the test data frame type, and returning to send the test data frame to the code to be tested as a new test data frame, so that the code to be tested encapsulates the test data frame according to the test data frame type to obtain an encapsulated test data frame, and returning to the step of encapsulating the test data frame; if not, judging whether a preset channel which does not receive the test data frame exists in the preset channels; if yes, acquiring a preset channel which does not receive the test data frame from the preset channel, and returning to the step of authenticating the test data frame based on the preset baud rate as a new preset channel; if not, ending the channel recognition function test, and obtaining a channel recognition function test result according to the comparison result.
In this embodiment, the smart meter may include a metering core and a management core, where the baud rate may be a modulation rate, which refers to a rate of modulating a carrier by an effective data signal, that is, a number of times of a change in a modulation state of the carrier in a unit time, and the preset baud rate may be a baud rate corresponding to a channel in an external communication function of the smart meter. The test device 102 may perform a channel identification function test on the code to be tested, and specifically, the external communication function module in the smart meter may include a plurality of channels, for example, an uplink channel HPLC, a downlink channel, a bluetooth channel, and the like, and the test device 102 may perform the above-mentioned channel identification function test on the channels, respectively.
Specifically, taking the above-mentioned upstream channel HPLC as an example, the channel identification function test of the code to be tested by the test device 102 may include the following steps:
(1) The test equipment 102 is connected with the HPLC module and performs identity authentication with the management core at 38400 baud rate;
(2) After the identity authentication is passed, the test device 102 sends a test frame to the management core, for example, a command frame for reading data of the management core;
(3) The method comprises the steps that a code to be tested corresponding to an external communication module receives a command, performs protocol analysis, encapsulates the command according to an interface protocol and sends the command to a bus pipeline;
(4) The management core test APP simulation bus module in the intelligent ammeter receives the pipeline data frame and sends the data to the test equipment 102;
(5) The test device 102 can compare the sending frame with the returning frame, and output the execution result of the management core instruction to obtain a comparison result;
(6) After the identity authentication is passed, the test frame in the step 2 is replaced by a test instruction for the metering core, the steps 2 to 5 are repeated, and the execution result of the metering core instruction is output;
(7) Repeating the testing process of the management core and the metering core in the steps 2-6 after the identity authentication is invalid, and outputting a testing result after the identity authentication is invalid;
(8) And obtaining a channel identification function test result of the upstream channel HPLC according to the test result.
The test device 102 may obtain the channel recognition function test result according to the comparison result. Specifically, the test device 102 may correctly pass the identity authentication, and after the identity authentication passes, the code to be tested may correctly identify the channel number, and when receiving the reading instructions of the management core and the metering core, the code to be tested may correctly return the reading data, and when the identity authentication fails, the code to be tested may successfully establish a channel when reading the data, and may determine that the channel identification function test is successful when the reading failure frame can be returned.
In addition, other communication methods of the test device 102 for the uplink channel and the test method for the downlink channel may be similar to the above steps, and when the test device 102 performs a test for the bluetooth channel identification function, the baud rate may be set to 115200 when bluetooth matching is performed with the management core, and the other steps may be the same.
Through the embodiment, the test device 102 can detect the channel identification function of external communication in the smart meter by detecting the correctness of the reading instruction of the code to be tested.
In one embodiment, the serial port conversion function test includes: a frame format judgment test and a frame conversion test; the frame format judgment test comprises: acquiring a test frame aiming at a code to be tested; the test frame comprises at least two of an address error frame, a control code error frame, a length error frame, a data field error frame, a check code error frame and an end code error frame; transmitting the test frame to the code to be tested, and obtaining the processing result of the code to be tested on the test frame; determining a test result of the test frame according to the processing result; judging whether a test frame which is not sent to the code to be tested exists in the test frames or not; if yes, acquiring a test frame which is not transmitted to the code to be tested from the test frame, returning to the step of transmitting the test frame to the code to be tested as a new test frame, and acquiring a processing result of the code to be tested on the test frame; if not, obtaining a test result of the frame format judgment test according to the test results of the plurality of test frames; a frame conversion test comprising: acquiring an instruction frame aiming at a code to be tested through a preset channel; the preset channel comprises at least one of an uplink channel, a downlink channel and a Bluetooth channel; transmitting the instruction frame to the code to be tested, and acquiring a first processing result of the code to be tested aiming at the instruction frame; the first processing result represents the processing result of address identification conversion of the code to be tested to the instruction frame initiator; transmitting data frames with different encryption degrees to the code to be tested, and acquiring a second processing result of the code to be tested aiming at the data frames with different encryption degrees; the data frames with different encryption degrees comprise data frames corresponding to plaintext, plaintext and MAC and ciphertext and MAC; the second processing result represents the processing result of the code to be tested for identifying the encryption mode; communicating with the code to be tested through different types of addresses, and acquiring a third processing result of the code to be tested for the communication of the different types of addresses; the third processing result represents the processing result of the code to be tested for identifying the communication address type; transmitting command frames with different lengths to the code to be tested, acquiring output frames of the code to be tested aiming at the command frames with different lengths, and acquiring a fourth processing result according to the output frames; the fourth processing result represents the processing result of the code to be tested for identifying the frame length; and obtaining a test result of the frame conversion test according to the first processing result, the second processing result, the third processing result and the fourth processing result.
In this embodiment, the frame format determination test may be used to test the determination and processing manner of the code to be tested on the format error of the data frame; frame conversion testing may be used to test the conversion capability of the code to be tested for data frames. Specifically, the step of the frame format judgment test may be as follows:
(1) The test device 102 communicates with the external communication module of the core board, which may also be referred to as a communication management service, through a carrier serial port or a bluetooth serial port, and sends a test frame, where the frame header of the test frame is not 68;
(2) Monitoring an execution result of the code to be tested by the test equipment 102, and obtaining a test result of the frame header format judging function according to the execution result; in addition, the test device 102 can also monitor the execution result together with the management core test APP in the smart meter;
(3) Replacing the test frame in the step 1 with an address error frame, and repeating the steps 1-2 to obtain a test result of the frame address format judging function;
(4) Replacing the test frame in the step 1 with a control code error frame, and repeating the steps 1-2 to obtain a test result of the frame control code format judging function;
(5) Replacing the test frame in the step 1 with a length error frame, and repeating the steps 1-2 to obtain a test result of the frame length format judging function;
(6) Replacing the test frame in the step 1 with a data domain error frame, and repeating the steps 1-2 to obtain a test result of the frame data domain format judging function;
(7) Replacing the test frame in the step 1 with a check code error frame, and repeating the steps 1-2 to obtain a test result of the frame check code format judging function;
(8) Replacing the test frame in the step 1 with an end code error frame, and repeating the steps 1-2 to obtain a test result of an end code number judging function;
(9) And (5) comprehensively analyzing the test results in the steps 2-8 to obtain the test result of the frame format judging function of the external communication module.
When the test device 102 detects that the code to be tested discards the test frames of each error type, and does not perform corresponding conversion and forwarding operations, it may determine that the test result of the frame format judgment test is successful, or else, it is failed.
The specific steps of the frame conversion test may be as follows:
(1) The test device 102 may communicate with the external communication module, i.e. the code to be tested, using the uplink channel, the downlink channel and the bluetooth channel, respectively, and send an instruction frame after establishing communication, and may obtain a monitoring result, i.e. a frame conversion result, of the function execution process of the external communication module by the management core test APP in the smart meter, and output a processing result of the address identification conversion function of the instruction initiator according to the frame conversion result;
(2) The test device 102 can communicate with the external communication module by using a plaintext, a plaintext+MAC, a ciphertext+MAC mode respectively, can acquire a monitoring result of the function execution process of the external communication module by the management core test APP in the intelligent ammeter, and outputs an encryption mode identification function processing result according to the frame conversion result;
(3) The test device 102 can communicate with an external communication module by using a real address, an all-A address, a abbreviated address and a broadcast address respectively, can acquire a monitoring result of an output frame of a code to be tested by a management core test APP in the intelligent ammeter, and can output a processing result of a communication address type identification function according to a frame conversion result;
(4) The test device 102 may send command frames with different lengths to the external communication module, and may obtain a monitoring result of the management core test APP in the smart meter on an output frame of the external communication module, and obtain a processing result of the frame length recognition function according to the frame conversion result.
(5) And (5) comprehensively analyzing the test results of the steps 1-4, and outputting the test result of the frame conversion function.
When the test device 102 detects that the code to be tested can correctly identify the address of the initiator, the encryption mode, the communication address type and the frame length, that is, the processing results of the above steps are successful, and can perform corresponding frame conversion, and output the converted command frame, the success of the frame conversion test can be determined.
Through the embodiment, the test device 102 can realize the serial port conversion function test of external communication in the smart meter by testing the judgment of the code to be tested on the frame format and the processing of frame conversion.
In one embodiment, the serial port function test is performed on the code to be tested to obtain a serial port function test result, including: acquiring a plurality of command frames to be forwarded aiming at codes to be tested; the command frames include a plurality of different types of command frames; transmitting the command frame to be forwarded to the code to be tested, so that the code to be tested adds a corresponding logic address to the command frame to be forwarded according to the type of the command frame to be forwarded; and judging whether the logic address corresponds to the type of the command frame to be forwarded or not, and obtaining a test result of the serial port forwarding function test.
In this embodiment, the command frame to be forwarded may include multiple types of command frames, and these command frames may be used to test the resolving power of the code to be tested on the command frames. The command frames of the various types can include a set command, a security authentication command, a multifunctional terminal command, a multi-data combination reading command, an ammeter reset command, an electric quantity reset command, an event reset command, a switch-on/off command, an alarm command, a power-on command and the like. Test equipment 102 may perform serial port forwarding function testing on code to be tested. Specifically, the test steps of the serial port forwarding function test may be as follows:
(1) The test device 102 may send a read command frame to the code to be tested after establishing communication with the code using automated test software;
(2) The test device 102 can control the management core test APP in the intelligent ammeter to receive the command frame output by the management core test APP, and acquire an analysis result of judging and analyzing the correctness of the internal logical address added by the command frame by the management core test APP, so as to output a test result of the reading command frame data routing function;
(3) The reading command frame in the step 1 is replaced by a setting command, a safety authentication command, a multifunctional terminal command, a multi-item data combination reading command, an ammeter zero clearing command, an electric quantity zero clearing command, an event zero clearing command, a switching-on/off command, an alarm command and a power-on command respectively, the steps 1-2 are repeated, and a test result of a data routing function corresponding to the instruction type is output;
(4) And comprehensively analyzing the test results of the different command types, and outputting the test results of the serial port forwarding function test of the external communication module.
When the test device 102 detects that the code to be tested can perform corresponding interpretation and conversion on the command frames of each type, and can send the converted frames to the management core APP, it can determine that the test result of the serial port forwarding function test is successful.
Through the embodiment, the test device 102 can test the serial port forwarding function of the code to be tested by using a plurality of different types of command frames, so that the serial port forwarding function test of the external communication function in the intelligent ammeter can be realized.
In one embodiment, performing pipeline function test on a code to be tested to obtain a pipeline function test result, including: transmitting a plurality of error communication frames of different types to a code to be tested through a pipeline corresponding to the type of the error communication frames, and obtaining an output result of the code to be tested; and obtaining a test result of the pipeline data frame identification function test according to the output result.
In this embodiment, the pipeline function test may be a test performed on the normality of pipeline communication of external communication in the smart meter, including a pipeline data frame identification function test and a pipeline data frame forwarding function test, where in the actual function implementation process, the external communication module has one end connected to a serial port (or bluetooth) so as to communicate with an external device, and the other end connected to a pipeline so as to communicate with an internal unit of the meter. The test device 102 may perform a pipeline data frame identification function test on the code to be tested, and obtain a corresponding test result. The pipeline data frame identification function test may be a test for identifying an error frame with respect to a code to be tested corresponding to the external communication. Specifically, the step of the pipe data frame identification function test may be as follows:
(1) The test equipment 102 establishes communication connection with the code to be tested through a pipeline;
(2) The test equipment 102 controls the management core APP to send command frames without internal communication frame header and internal communication frame header errors to the codes to be tested;
(3) The test equipment 102 monitors serial port information and outputs a test result of an internal communication frame head judging function;
(4) Sequentially replacing the communication frame in the step 2 with a command frame with a frame head not 68, a command frame with an address error, a command frame with a control code error, a command frame with a length error, a command frame with a data field error, a command frame with a check code error and a command frame with an end code error, repeating the steps 2-3, and outputting a test result of a 645 frame format judging function;
(5) And comprehensively analyzing test results under various frame formats, and outputting test results of the pipeline data frame identification function.
When the test device 102 detects that the code to be tested can discard each error frame in the test process and does not forward, the test result of the pipeline data frame identification function test can be determined to be successful.
Through the embodiment, the test device 102 can test the external communication in the smart meter for the pipeline data frame identification function by detecting the processing mode of the code to be tested for the error frame in the pipeline data frame.
In one embodiment, performing pipeline function test on a code to be tested to obtain a pipeline function test result, including: transmitting a plurality of response frames of different types to the code to be tested, so that the code to be tested analyzes the response frames according to the types of the response frames and returns analysis results; the plurality of different types of response frames comprise a plurality of different types of normal response frames and a plurality of different types of abnormal response frames; and obtaining a test result of the pipeline data frame forwarding function test according to the analysis result returned by the code to be tested.
In this embodiment, the plurality of different types of response frames may include a read-write data response frame with a control code of 11, a read-write data response frame, a security authentication response frame with a control code of 03, a multi-functional terminal output response frame with a control code of 1D, a multi-item data combination read-write response frame, an ammeter clear response frame, an electric quantity clear response frame, an event clear response frame, an instruction response frame with a control code of 1C, and the like, where each response frame may have a normal response frame and an abnormal response frame. The pipeline function test may further include a pipeline data frame forwarding function test, where the pipeline data frame forwarding function test may be a test performed on a pipeline data frame parsing capability of a code to be tested, and the test device 102 may perform the pipeline data frame forwarding function test on the code to be tested and obtain a corresponding test result. Specifically, the steps of the pipe forwarding function test may be as follows:
(1) The test equipment 102 establishes communication connection with the code to be tested through a pipeline;
(2) The test equipment 102 controls the management core test APP to respectively send reading data normal response frames with the control codes of 11 to the codes to be tested;
(3) The test equipment 102 monitors serial port information and outputs a routing result of reading data response frames;
(4) Sequentially replacing the frames in the step 2 with a read-write data normal response frame with a control code of 14, a security authentication normal response frame with a control code of 03, a multifunctional terminal output normal response frame with a control code of 1D, a plurality of data combination reading normal response frames, an ammeter resetting normal response frame, an electric quantity resetting normal response frame, an event resetting normal response frame and an instruction normal response frame with a control code of 1C, repeating the steps 2-3, and outputting a test result corresponding to the test item;
(5) Correspondingly replacing the normal response frames participating in the test in the steps 2-5 with abnormal response frames, repeating the steps to test, and outputting a test result corresponding to the test item;
(6) And comprehensively analyzing the test results and outputting the test results of the pipeline data frame forwarding function.
When the test device 102 detects that the code to be tested can perform corresponding interpretation and conversion on the normal response frame and the abnormal response frame, it can determine that the test result of the pipeline data frame forwarding function test is successful.
Through the embodiment, the testing device 102 can test the code to be tested by using the normal response frame and the abnormal response frame, so that the pipeline data frame forwarding test for external communication in the intelligent ammeter can be realized.
In one embodiment, as shown in fig. 3, fig. 3 is a flow chart of an external communication testing method based on a smart meter in another embodiment. In this embodiment, the test device 102 may obtain codes to be tested related to implementation of an external communication function in the smart meter, and perform a first test on the codes to be tested to obtain a first test result; the first test comprises an HPLC channel identification function test, a Bluetooth channel identification function test and a downlink channel identification function test, and the three tests comprise at least one of an identity authentication test, a management core data reading test, a metering core data reading test and a data reading test after authentication failure. The test device 102 may further perform a second test on the code to be tested to obtain a second test result; the second test comprises a serial port conversion function test and a serial port forwarding function test. The serial port conversion function test comprises at least one of a frame format judging function test and a frame conversion function test. The test device 102 may further perform a third test on the code to be tested to obtain a third test result, where the third test includes a pipe data frame identification function test and a pipe data frame forwarding function test, where the pipe data frame identification function test may include at least one of a frame header format determination function and a 645 frame format determination function test. The test device 102 may further obtain a test report of the external communication function of the smart meter according to the first test result, the second test result, and the third test result.
In yet another embodiment, as shown in fig. 4, fig. 4 is a flow chart of an external communication testing method based on a smart meter in yet another embodiment. In this embodiment, the channel identification function test 302 may include an uplink channel HPLC identification, a bluetooth channel identification, and a downlink channel identification, and a test process of each channel may include an identity authentication test, a test for reading data of a management core and a metering core, and the test device 102 may monitor a channel identification condition and a data reading result to obtain a test result of the channel identification function test. The serial port function test 303 may include a serial port conversion function test 3031 and a serial port forwarding function test 3032, where the serial port conversion function test 3031 may include a frame format determination function test and a frame conversion function test, and the serial port forwarding function test 3032 may include a traversal forwarding test of the code to be tested for different types of commands. Pipeline functional tests 304 may include a pipeline data frame identification test 3041 and a pipeline data frame forwarding functional test 3042, wherein pipeline data frame identification test 3041 may include an intercom frame header judgment functional test and a 645 frame format judgment functional test; the pipe data frame forwarding function test 3042 may include an ergodic route test for different types of commands of the pipe.
Through the above embodiment, the test device 102 may perform the channel identification function test, the serial port function test and the pipeline function test on the external communication, so as to achieve the effect of improving the test comprehensiveness of the external communication of the smart meter.
It should be understood that, although the steps in the flowcharts of fig. 2-4 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least a portion of the steps of fig. 2-4 may include multiple steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor does the order in which the steps or stages are performed necessarily occur sequentially, but may be performed alternately or alternately with at least a portion of the steps or stages in other steps or other steps.
In one embodiment, as shown in fig. 5, there is provided an external communication testing apparatus based on a smart meter, including: an acquisition module 500, a test module 502, and a generation module 504, wherein:
An acquisition module 500, configured to acquire a code to be tested; the code to be tested includes a code for implementing an external communication function in the smart meter.
The test module 502 is configured to test the code to be tested to obtain a corresponding test result; the testing comprises a channel identification function testing, a serial port function testing and a pipeline function testing; the channel identification function test is performed on the identification of the channel based on the code to be tested; the serial port function test is carried out on the test of the data frame based on the code to be tested; pipeline functional testing is performed on the basis of the code to be tested for testing the pipeline data frames.
And the generating module 504 is configured to generate a test report corresponding to the code to be tested according to the test result.
In one embodiment, the test module 502 is specifically configured to perform a serial port function test on a code to be tested to obtain a serial port function test result; the serial port function test comprises at least one of a serial port conversion function test and a serial port forwarding function test; performing pipeline function test on the code to be tested to obtain a pipeline function test result; the pipeline functional test comprises at least one of a pipeline data frame identification functional test and a pipeline data frame forwarding functional test; and obtaining a test result according to the channel identification function test result, the serial port function test result and the pipeline function test result.
In one embodiment, the test module 502 is specifically configured to obtain, through a preset channel, a test data frame sent by an upper computer; the preset channel comprises an uplink channel, a Bluetooth channel and a downlink channel; the test data frame includes a test data frame type; the test data frame type comprises a test data frame for a management core in the intelligent electric meter and a test data frame for a metering core in the intelligent electric meter; based on a preset baud rate, authenticating the test data frame; transmitting the test data frame passing the authentication to the code to be tested, so that the code to be tested encapsulates the test data frame according to the type of the test data frame to obtain an encapsulated test data frame, and returning the encapsulated test data frame; comparing the encapsulated test data frame with the test data frame to obtain a comparison result; judging whether the test data frame type which is not a tested data frame exists in the test data frame types or not; if yes, acquiring a test data frame corresponding to the type which is not the tested data frame from the test data frame type, and returning to send the test data frame to the code to be tested as a new test data frame, so that the code to be tested encapsulates the test data frame according to the test data frame type to obtain an encapsulated test data frame, and returning to the step of encapsulating the test data frame; if not, judging whether a preset channel which does not receive the test data frame exists in the preset channels; if yes, acquiring a preset channel which does not receive the test data frame from the preset channel, and returning to the step of authenticating the test data frame based on the preset baud rate as a new preset channel; if not, ending the channel recognition function test, and obtaining a channel recognition function test result according to the comparison result.
In one embodiment, the test module 502 is specifically configured to obtain a test frame for a code to be tested; the test frame comprises at least two of an address error frame, a control code error frame, a length error frame, a data field error frame, a check code error frame and an end code error frame; transmitting the test frame to the code to be tested, and obtaining the processing result of the code to be tested on the test frame; determining a test result of the test frame according to the processing result; judging whether a test frame which is not sent to the code to be tested exists in the test frames or not; if yes, acquiring a test frame which is not transmitted to the code to be tested from the test frame, returning to the step of transmitting the test frame to the code to be tested as a new test frame, and acquiring a processing result of the code to be tested on the test frame; if not, obtaining a test result of the frame format judgment test according to the test results of the plurality of test frames; a frame conversion test comprising: acquiring an instruction frame aiming at a code to be tested through a preset channel; the preset channel comprises at least one of an uplink channel, a downlink channel and a Bluetooth channel; transmitting the instruction frame to the code to be tested, and acquiring a first processing result of the code to be tested aiming at the instruction frame; the first processing result represents the processing result of address identification conversion of the code to be tested to the instruction frame initiator; transmitting data frames with different encryption degrees to the code to be tested, and acquiring a second processing result of the code to be tested aiming at the data frames with different encryption degrees; the data frames with different encryption degrees comprise data frames corresponding to plaintext, plaintext and MAC and ciphertext and MAC; the second processing result represents the processing result of the code to be tested for identifying the encryption mode; communicating with the code to be tested through different types of addresses, and acquiring a third processing result of the code to be tested for the communication of the different types of addresses; the third processing result represents the processing result of the code to be tested for identifying the communication address type; transmitting command frames with different lengths to the code to be tested, acquiring output frames of the code to be tested aiming at the command frames with different lengths, and acquiring a fourth processing result according to the output frames; the fourth processing result represents the processing result of the code to be tested for identifying the frame length; and obtaining a test result of the frame conversion test according to the first processing result, the second processing result, the third processing result and the fourth processing result.
In one embodiment, the test module 502 is specifically configured to obtain a plurality of command frames to be forwarded for a code to be tested; the command frames include a plurality of different types of command frames; transmitting the command frame to be forwarded to the code to be tested, so that the code to be tested adds a corresponding logic address to the command frame to be forwarded according to the type of the command frame to be forwarded; and judging whether the logic address corresponds to the type of the command frame to be forwarded or not, and obtaining a test result of the serial port forwarding function test.
In one embodiment, the test module 502 is specifically configured to send a plurality of error communication frames of different types to the code to be tested through a pipeline corresponding to the type of the error communication frame, and obtain an output result of the code to be tested; and obtaining a test result of the pipeline data frame identification function test according to the output result.
In one embodiment, the test module 502 is specifically configured to send a plurality of response frames of different types to the code to be tested, so that the code to be tested parses the response frames according to the types of the response frames and returns a parsing result; the plurality of different types of response frames comprise a plurality of different types of normal response frames and a plurality of different types of abnormal response frames; and obtaining a test result of the pipeline data frame forwarding function test according to the analysis result returned by the code to be tested.
For specific limitations on the smart meter-based external communication test device, reference may be made to the above limitations on the smart meter-based external communication test method, and no further description is given here. The above-described respective modules in the smart meter-based external communication test device may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a test device, i.e., an automated software test platform, the internal structure of which may be as shown in FIG. 6. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program, when executed by the processor, implements a smart meter-based external communication test method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in FIG. 6 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided, including a memory and a processor, where the memory stores a computer program, and the processor implements the smart meter-based external communication testing method described above when executing the computer program.
In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, which when executed by a processor implements the smart meter-based external communication testing method described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (10)

1. An external communication testing method based on a smart meter is characterized by comprising the following steps:
acquiring a code to be tested; the code to be tested comprises a code for realizing an external communication function in the intelligent ammeter;
testing the code to be tested to obtain a corresponding test result, including: performing channel identification function test on the code to be tested to obtain a channel identification function test result; the channel identification function test comprises uplink channel identification, bluetooth channel identification and downlink channel identification aiming at external communication; performing serial port function test on the code to be tested to obtain a serial port function test result; the serial port function test comprises at least one of a serial port conversion function test and a serial port forwarding function test, wherein the serial port conversion function test comprises a frame format judging test and a frame conversion test; performing pipeline function test on the code to be tested to obtain a pipeline function test result; the pipeline functional test comprises at least one of a pipeline data frame identification functional test and a pipeline data frame forwarding functional test, wherein the pipeline data frame identification functional test comprises an internal communication frame header judging functional test and a 645 frame format judging functional test, and the pipeline data forwarding functional test comprises a traversal routing test of different types of pipeline commands; obtaining the test result according to the channel identification function test result, the serial port function test result and the pipeline function test result;
And generating a test report corresponding to the code to be tested according to the test result.
2. The method according to claim 1, wherein the performing the channel identification function test on the code to be tested to obtain a channel identification function test result includes:
acquiring a test data frame sent by an upper computer through a preset channel; the preset channel comprises an uplink channel, a Bluetooth channel and a downlink channel; the test data frame comprises a test data frame type; the test data frame type comprises a test data frame for a management core in the intelligent electric meter and a test data frame for a metering core in the intelligent electric meter;
authenticating the test data frame based on a preset baud rate;
transmitting the test data frame passing the authentication to the code to be tested, so that the code to be tested encapsulates the test data frame according to the type of the test data frame to obtain an encapsulated test data frame, and returns the encapsulated test data frame;
comparing the encapsulated test data frame with the test data frame to obtain a comparison result;
judging whether the test data frame type which is not the test data frame exists in the test data frame types or not;
If yes, acquiring a test data frame which is not corresponding to the type of the test data frame from the test data frame type, returning the test data frame to the code to be tested as a new test data frame, so that the code to be tested encapsulates the test data frame according to the test data frame type to obtain an encapsulated test data frame, and returning the encapsulated test data frame;
if not, judging whether a preset channel which does not receive the test data frame exists in the preset channels;
if yes, acquiring a preset channel which does not receive the test data frame from the preset channel, and returning to the step of authenticating the test data frame based on a preset baud rate as a new preset channel;
and if not, ending the channel identification function test, and obtaining the channel identification function test result according to the comparison result.
3. The method of claim 1, wherein the frame format determination test comprises:
acquiring a test frame aiming at the code to be tested; the test frame comprises at least two of an address error frame, a control code error frame, a length error frame, a data field error frame, a check code error frame and an end code error frame;
Transmitting the test frame to the code to be tested, and obtaining a processing result of the code to be tested on the test frame;
determining a test result of the test frame according to the processing result;
judging whether a test frame which is not sent to the code to be tested exists in the test frames or not;
if yes, acquiring a test frame which is not transmitted to the code to be tested from the test frame, returning to the step of transmitting the test frame to the code to be tested as a new test frame, and acquiring a processing result of the code to be tested on the test frame;
if not, obtaining the test result of the frame format judgment test according to the test results of the plurality of test frames;
the frame conversion test includes:
acquiring an instruction frame aiming at the code to be tested through a preset channel; the preset channel comprises at least one of an uplink channel, a downlink channel and a Bluetooth channel;
the instruction frame is sent to the code to be tested, and a first processing result of the code to be tested for the instruction frame is obtained; the first processing result represents the processing result of address identification conversion of the code to be tested to the instruction frame initiator;
Transmitting data frames with different encryption degrees to the code to be tested, and acquiring a second processing result of the code to be tested aiming at the data frames with different encryption degrees; the data frames with different encryption degrees comprise data frames corresponding to plaintext, plaintext and MAC and ciphertext and MAC; the second processing result represents the processing result of the code to be tested for identifying the encryption mode;
communicating with the code to be tested through different types of addresses, and acquiring a third processing result of the code to be tested for the communication of the different types of addresses; the third processing result represents the processing result of the code to be tested for identifying the communication address type;
transmitting command frames with different lengths to the code to be tested, acquiring output frames of the code to be tested aiming at the command frames with different lengths, and acquiring a fourth processing result according to the output frames; the fourth processing result represents the processing result of the code to be tested on the frame length identification;
and obtaining a test result of the frame conversion test according to the first processing result, the second processing result, the third processing result and the fourth processing result.
4. The method of claim 1, wherein the performing serial port function test on the code to be tested to obtain a serial port function test result includes:
acquiring a plurality of command frames to be forwarded aiming at the code to be tested; the command frame includes a plurality of different types of command frames;
transmitting the command frame to be forwarded to the code to be tested, so that the code to be tested adds a corresponding logic address to the command frame to be forwarded according to the type of the command frame to be forwarded;
and judging whether the logic address corresponds to the type of the command frame to be forwarded or not, and obtaining a test result of the serial port forwarding function test.
5. The method according to claim 1, wherein the performing pipeline function test on the code to be tested to obtain a pipeline function test result includes:
transmitting a plurality of error communication frames of different types to the code to be tested through a pipeline corresponding to the type of the error communication frames, and obtaining an output result of the code to be tested;
and obtaining a test result of the pipeline data frame identification function test according to the output result.
6. The method according to claim 1, wherein the performing pipeline function test on the code to be tested to obtain a pipeline function test result includes:
sending a plurality of response frames of different types to the code to be tested, so that the code to be tested analyzes the response frames according to the types of the response frames and returns analysis results; the plurality of different types of response frames comprise a plurality of different types of normal response frames and a plurality of different types of abnormal response frames;
and obtaining a test result of the pipeline data frame forwarding function test according to the analysis result returned by the code to be tested.
7. An external communication testing device based on smart meter, characterized in that the device comprises:
the acquisition module is used for acquiring the code to be tested; the code to be tested comprises a code for realizing an external communication function in the intelligent ammeter;
the test module is used for testing the code to be tested to obtain a corresponding test result, and is specifically used for: performing channel identification function test on the code to be tested to obtain a channel identification function test result; the channel identification function test comprises uplink channel identification, bluetooth channel identification and downlink channel identification aiming at external communication; performing serial port function test on the code to be tested to obtain a serial port function test result; the serial port function test comprises at least one of a serial port conversion function test and a serial port forwarding function test, wherein the serial port conversion function test comprises a frame format judging test and a frame conversion test; performing pipeline function test on the code to be tested to obtain a pipeline function test result; the pipeline functional test comprises at least one of a pipeline data frame identification functional test and a pipeline data frame forwarding functional test, wherein the pipeline data frame identification functional test comprises an internal communication frame header judging functional test and a 645 frame format judging functional test, and the pipeline data forwarding functional test comprises a traversal routing test of different types of pipeline commands; obtaining the test result according to the channel identification function test result, the serial port function test result and the pipeline function test result;
And the generating module is used for generating a test report corresponding to the code to be tested according to the test result.
8. The device according to claim 7, wherein the test module is specifically configured to:
sending a plurality of response frames of different types to the code to be tested, so that the code to be tested analyzes the response frames according to the types of the response frames and returns analysis results; the plurality of different types of response frames comprise a plurality of different types of normal response frames and a plurality of different types of abnormal response frames;
and obtaining a test result of the pipeline data frame forwarding function test according to the analysis result returned by the code to be tested.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202011210661.9A 2020-11-03 2020-11-03 External communication test method and device based on intelligent ammeter and computer equipment Active CN112367680B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011210661.9A CN112367680B (en) 2020-11-03 2020-11-03 External communication test method and device based on intelligent ammeter and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011210661.9A CN112367680B (en) 2020-11-03 2020-11-03 External communication test method and device based on intelligent ammeter and computer equipment

Publications (2)

Publication Number Publication Date
CN112367680A CN112367680A (en) 2021-02-12
CN112367680B true CN112367680B (en) 2023-12-12

Family

ID=74512674

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011210661.9A Active CN112367680B (en) 2020-11-03 2020-11-03 External communication test method and device based on intelligent ammeter and computer equipment

Country Status (1)

Country Link
CN (1) CN112367680B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112804114B (en) * 2021-04-15 2021-07-06 施维智能计量系统服务(长沙)有限公司 System and method for automatic communication and configuration of energy metering Internet of things equipment
CN113341364A (en) * 2021-04-30 2021-09-03 南方电网数字电网研究院有限公司 Multi-module electric energy meter data identification method
CN113687294B (en) * 2021-08-12 2023-06-16 深圳供电局有限公司 Testing method and device for dual-core intelligent ammeter, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103245866A (en) * 2013-06-03 2013-08-14 国家电网公司 Portable telecontrol digital channel testing device and telecontrol digital channel testing method
CN110297207A (en) * 2019-07-08 2019-10-01 国网上海市电力公司 Method for diagnosing faults, system and the electronic device of intelligent electric meter
CN111581084A (en) * 2020-04-28 2020-08-25 南方电网数字电网研究院有限公司 Process testing method and device based on intelligent electric meter operating system
CN111813699A (en) * 2020-09-01 2020-10-23 南方电网数字电网研究院有限公司 Data routing test method and device based on intelligent electric meter and computer equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103245866A (en) * 2013-06-03 2013-08-14 国家电网公司 Portable telecontrol digital channel testing device and telecontrol digital channel testing method
CN110297207A (en) * 2019-07-08 2019-10-01 国网上海市电力公司 Method for diagnosing faults, system and the electronic device of intelligent electric meter
CN111581084A (en) * 2020-04-28 2020-08-25 南方电网数字电网研究院有限公司 Process testing method and device based on intelligent electric meter operating system
CN111813699A (en) * 2020-09-01 2020-10-23 南方电网数字电网研究院有限公司 Data routing test method and device based on intelligent electric meter and computer equipment

Also Published As

Publication number Publication date
CN112367680A (en) 2021-02-12

Similar Documents

Publication Publication Date Title
CN112367680B (en) External communication test method and device based on intelligent ammeter and computer equipment
CN111459794B (en) Communication network testing method, device, computer equipment and storage medium
CN111083225B (en) Data processing method and device in Internet of things platform and Internet of things platform
CN111061628B (en) Data analysis method, system, device, computer equipment and storage medium
CN108241576B (en) Interface testing method and system
CN113778879B (en) Interface fuzzy test method and device
CN104348578B (en) The method and device of data processing
CN112783787A (en) Interface test method, device and system and electronic equipment
CN112003901B (en) Leasing process information importing method and device, computer equipment and storage medium
CN112115060A (en) Audio test method and system based on terminal
CN111949537A (en) Interface test method, device, equipment and medium
CN103746868A (en) Methods and apparatuses for sending and receiving testing messages, and testing equipment
CN115833964A (en) Performance test method and performance test system of dual-mode communication module
CN113535578B (en) CTS test method, CTS test device and CTS test equipment
CN112131127B (en) Interface testing method, device and system and electronic equipment
CN114553663A (en) Abnormity detection method, device, equipment and storage medium
CN112650698A (en) Data transmission method and device, electronic equipment and storage medium
CN109960924A (en) One subsystem login method, device, system and electronic equipment
CN112737872B (en) ARINC664P7 end system cross-network testing system and method
CN115086191B (en) Automatic test method, device and equipment for bank card
CN113595240B (en) Method, device, equipment and storage medium for detecting electric power data
CN113395235B (en) IoT system remote testing method, system and equipment
CN212486538U (en) Capability verification system for intrusion detection
CN116054414B (en) Line defect hidden danger monitoring method, device, computer equipment and storage medium
CN116346824A (en) NB-IoT abnormal data testing method and system based on edge calculation

Legal Events

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