Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Aiming at the problems of manual disassembly command frame, data error, inconvenient deployment, isolation of each end and the like caused by single test of an energy product in the prior art, the application provides a test scheme aiming at the form of the whole energy product, and the test scheme is characterized in that the data of real products such as an inverter and the like are directly and efficiently simulated by means of a newly developed simulation register upper computer, so that the test scheme is compatible with business data of different manufacturers, autonomously combines and sends MODBUS protocol requests, displays the data received by a data acquisition device and the test result of the data display device through a data display device (comprising a panel and/or an EMS) and opens the whole link of the energy product to autonomously and directly verify the data acquisition device and the data display device, thereby simplifying the test flow, improving the test accuracy, saving time and resources.
Fig. 5 is a schematic diagram of a test system for energy products according to an embodiment of the application. As shown in fig. 5, the test system includes a host computer, a data acquisition device, a cloud server, and a data display device, wherein the data acquisition device may include or operate with a communication stick or communication stick firmware, and the data display device may include a panel and/or an EMS. In the test process, the upper computer converts the documents based on various protocols into configuration files in a unified format after acquiring the documents, the data acquisition equipment sends an instruction to the upper computer, the upper computer requests to acquire data in one or more registers, the upper computer acquires related data from the configuration files according to the instruction and sends the data to the data acquisition equipment, the data acquisition equipment sends the data to the cloud server, and the data display equipment acquires the data of the cloud server. In the embodiment shown in fig. 5, the upper computer and the data acquisition device communicate with each other through a standard MODBUS protocol or a custom protocol of a manufacturer, the data acquisition device and the cloud server communicate with each other through an MQTT (Message Queuing Telemetry Transport, message queue telemetry transport protocol) mechanism, and the cloud server and the data display device interact with each other through an atom interface.
In fig. 5, the host computer may be based on the MODBUS protocol communication data simulation software under box python ttkbootstrap ui according to some embodiments.
According to some embodiments, the basic flow of testing includes protocol selection, serial port configuration, protocol configuration, opening communication, and ending communication. Before the host computer establishes communication with the data acquisition device, the protocols used by the host computer and the data acquisition device need to be determined. FIG. 6 is a schematic diagram of a selection protocol during a test according to an embodiment of the application. Fig. 6 shows alternative protocols in fig. 4, each corresponding to a product, after the protocol is selected, determining a data acquisition device matched with the protocol, and performing communication between the upper computer and the data acquisition device according to the selected protocol, wherein the upper computer simulates the product of the selected protocol for testing.
After the protocol is selected, the serial port of the data acquisition device is also required to be configured. Fig. 7 is a schematic diagram of serial port setup during testing according to an embodiment of the present application. The serial port setting items include setting serial port numbers, baud rates, stop bits, data bits, check bits, and the like. According to some embodiments, the serial number automatically identifies that the PC supports serial ports, the baud rate supports 4800-115200, 13 baud rates, the stop bits include 1, 1.5, and 2, the data bits include 5, 6, 7, and 8, and the check bits include odd check (O), even check (E), 1 check (M), 0 check (S), and no check (N). As shown in fig. 7, the serial number is COM3, the baud rate is 9600, the stop bit is 1, the data bit is 8, and the check bit is N. According to some embodiments, the setting of the serial port may be modified according to actual needs.
According to some embodiments, the protocol documents provided by the respective vendors are based on respective protocols, which are likely to be different from each other. The open source upper computer adopted in the prior art only supports the generated general data according to the standard protocol, and for non-standard protocol content, the open source upper computer in the prior art cannot support, the applicability of a test mode is not universal, and command frames need to be manually combined and disassembled. In the present application, for protocol documents provided by respective manufacturers, they are first converted into documents of a preset format, respectively. FIG. 8 is a schematic diagram of protocol documents from vendors during testing, which may vary from vendor to vendor, and which may be provided differently. FIG. 9 is a schematic diagram of the protocol document shown in FIG. 8 converted according to a preset format. According to some embodiments, the type of information to be extracted may be predetermined, as shown in fig. 9, and information such as a protocol register address, a conversion coefficient, a chinese name, a default value, etc. may be extracted from the protocol document of fig. 8 to form an Excel document. After obtaining the document in the predetermined format, a configuration file is generated. FIG. 10 is a schematic diagram of a document generation configuration file shown in FIG. 9. According to some embodiments, after obtaining the predetermined format document, the predetermined format document is converted into a configuration file according to the set script. According to some embodiments, the script that converts the pre-formatted document into a configuration file includes Xlrd, pandas, pyyaml scripts. According to some embodiments, the Xlrd script reads the name in the predetermined format document as a packet name, and loops to obtain the base configuration information in the predetermined format document to generate a corresponding protocol configuration file. According to some embodiments, the generated configuration file includes register addresses and test data corresponding to each register address.
After the configuration file is obtained, the upper computer performs import and export of the configuration file. According to some embodiments, the configuration files created according to the product protocol documents are imported into the host computer, and the different protocol documents are imported into different configuration files to simulate products of different manufacturers. The serial tool parses the configuration file, initializing information such as register groups, command words, register values, register definitions, conversion coefficients, and the like. The interface UI thread of the upper computer renders the register group according to the configuration file, and displays the register information, as shown in fig. 11, wherein the configuration file is a yaml file. And initializing a simulation protocol register data structure by a serial port thread of the upper computer according to the configuration file, wherein the simulation protocol register data structure is used for requesting data operation by a later MODBUS protocol register. According to some embodiments, the upper computer obtains all current register values to generate a yaml configuration file, records the product state, and can subsequently import the yaml to realize state playback.
According to some embodiments, data (e.g., test data) of the configuration file may be modified. Clicking on the selected register, popping up the register modification window, inputting a 10-ary or 16-ary value to set the register value, and effecting display, as shown in fig. 12. As shown in fig. 12, the test data of "failure record" is modified to "100". When illegal data is input, data abnormality is presented.
After the configuration file is imported, the upper computer may start communication. According to some embodiments, after the method for analyzing the binding serial port protocol, the upper computer clicks on, opens the serial port, starts analyzing the serial port data, performs operations such as CRC16 data checking, and the like, operates according to instructions on legal data and responds to corresponding data, and sends error response to illegal data. When the test is expected to stop, clicking a stop button of the upper computer, closing the serial port, and stopping the analysis of the serial port.
According to some embodiments, during the testing process, the data acquisition device sends instructions to the host computer to acquire the test data. After receiving the instruction, the upper computer analyzes the instruction, further obtains the numerical value in which register is needed by the data acquisition equipment, obtains test data in the corresponding register from the configuration file according to the register address, writes the test data into the response buffer, and formats the response buffer data according to the MODBUS standard protocol specification. According to some embodiments, the system address, the data frame length, the response data, and the CRC16 check packet are written into the serial port transmit buffer, and the serial port transmits the response frame.
According to some embodiments, after receiving the response frame of the upper computer, the data acquisition device sends the response frame to the cloud server, the cloud server interacts with the data display device through the atom interface, and the data display device displays the received data. The data displayed by the data display equipment is compared with the test data manufactured by the lowest-layer upper computer register, so that the processing correctness of a whole set of data streams can be verified: and the data acquisition equipment is used for acquiring register data and packaging the DP, disassembling the DP point from the cloud server and providing the interface correctness for the data display equipment, so that the test of the data link of the whole energy product is realized.
According to some embodiments, in the process of testing the energy product data link, the test may be performed in two ways, the first way is to test the data display device first and then test the data acquisition device; the second way is to directly test the data link of the energy product, namely, through the configuration file, test the data acquisition equipment and directly verify the data display equipment.
According to a first test mode, fig. 13 is a schematic diagram of testing a data display device according to an embodiment of the present application, and fig. 14 is a schematic diagram of testing a data acquisition device according to an embodiment of the present application.
The consideration of testing the data display equipment and then testing the data acquisition equipment comprises the following steps: compared with the data display equipment, the data acquisition equipment has slow development rhythm, and after the data display equipment is tested, the data acquisition equipment is tested, so that the problems in the test of the data acquisition equipment can be positioned; and moreover, the data display equipment can provide effective data display after the test is finished, so that the display and comparison of test results are facilitated.
During a particular test, the preparation required includes:
a DP object model of a real product scheme such as an inverter is determined;
the DP analysis logic of the cloud server is completed;
the cloud server interface has been developed;
vendors have provided docked MODBUS protocol documents;
testing has developed inverter simulation host software;
the vendor MODBUS file has been converted into a general register identification file, i.e., a configuration file.
The specific test flow is as follows: in the testing process of the data display equipment, according to the DP object model and the requirements, a tester sorts test DP data, the test data display equipment is directly in butt joint with the object model, a register and data acquisition equipment are skipped, the test data display equipment is bound to a shadow equipment platform, virtual energy equipment is deployed, DP information is pushed through the shadow equipment, and data on the data display equipment are checked.
In the testing process of the data acquisition equipment, preparing test data required by an upper computer, namely data generated by a real product such as an inverter, preparing the data acquisition equipment, and burning and authorizing corresponding test firmware; after the data acquisition equipment is distributed with a network, the upper computer imports test data in the configuration file, and the serial port information is configured correctly; waiting for the firmware to read the register data, and viewing the data presentation on the data presentation device. In addition, in the case of updating the test data in real time in the upper computer, the data presentation is viewed on the data presentation apparatus.
In the first test mode, in the test process of the data display equipment, extreme data and fault data can be manufactured by depending on the DP point of the object model, the test coverage rate is improved, the analysis of the DP point by the cloud server can be verified by reporting the DP through the object model, and the correctness of the interface provided by the cloud server to the data display equipment can be verified by reporting the DP through the object model; in the testing process of the data acquisition equipment, only the upper computer software simulating the real product is required to be opened, the real product environment is not required to be prepared, the testing deployment efficiency is improved, the upper computer software simulating the inverter autonomously analyzes the instruction of the data acquisition equipment, autonomously combines and reports the corresponding register data, the problems of errors and overtime caused by manual test disassembly and combined commands are solved, and the testing accuracy is improved; various operations of a real product are not needed to be relied on, so that the test safety is improved; in addition, the firmware problem is intuitively fed back through the data and the effect displayed by the tested data display equipment, and the trouble of positioning the problem through the log is reduced. In addition, by simulating the inverter host software and the data (data derived from the configuration file) which is tested through the data display device, the capability of the firmware for register data reading and DP conversion can be verified, and after the whole link test is completed, the updated link (for example, the data acquisition device and/or the data display device update) can be tested through the configuration file.
For the subsequent application scenario of the first test mode, if the manufacturer updates the protocol document, the data acquisition device also needs to update if the manufacturer is a previously connected manufacturer, and only the modified protocol document needs to be tested, for example, one document is updated in 100 documents, and only the one document needs to be tested, so that the firmware capacity can be rapidly verified; if the existing data acquisition equipment is updated, checking and accepting firmware capacity is carried out through the tested data display equipment and the simulation inverter upper computer software; if the existing data display equipment (such as a panel) is upgraded, the DP information is rapidly reported through the object model to verify the data display equipment; if the data acquisition equipment is customized for manufacturers adopting other protocols independently, the firmware acceptance can be checked through the tested data display equipment; if the data display equipment is customized for other manufacturers independently, the DP information can be rapidly reported through the object model to verify the data display equipment.
The second test mode is considered: when multi-terminal testing is involved, the correctness of each terminal is ensured independently, and the testing is not realistic in a limited project period and in limited testing manpower; after the test data of manufacturers are changed, verifying the data accuracy of the data display equipment; after the cloud server interface is updated, the whole set of data flow can be verified.
According to a second test mode, referring to fig. 5, during a specific test, the preparation work required includes:
a DP object model of a real product scheme such as an inverter is determined;
the DP analysis logic of the cloud server is completed;
the cloud server interface has been developed;
vendors have provided docked MODBUS protocol documents;
testing has developed inverter simulation host software;
the manufacturer MODBUS file is converted into a general register identification file, namely a configuration file;
embedded firmware has been developed.
The specific test flow is as follows: preparing register data required by an upper computer, namely data generated by a real product, preparing data acquisition equipment which is already burnt and authorized, and successfully configuring a network, wherein the upper computer imports test data in a configuration file, and the configuration of serial information is correct; waiting for the data acquisition equipment to read the test data, checking the data display on the data display equipment, updating the test data in the upper computer in real time, and checking the data display on the data display equipment.
Benefits of the second test mode include: the data obtained by the data display equipment is compared with the test data of the lowest-layer upper computer register, so that the processing correctness of the data link of the energy product can be verified: the data acquisition equipment performs data acquisition and DP encapsulation on the register, disassembles the DP point from the cloud server, and provides the interface correctness for the data display equipment; by comparing the data displayed by the data display device with the data manufactured by the bottommost register, the time for testing the single data acquisition device and then testing the single data display device (such as panel test and/or EMS test) can be saved; when the data display equipment displays a plurality of pieces of equipment, a certain number of finished products are not required in a test stage, and the real products have certain requirements on a deployment environment and are not easy to deploy; the present application does not care about the register data processing and DP encapsulation process by the data acquisition device (e.g., communication stick firmware) and the DP resolution process by the cloud server.
For the subsequent application scene of the second test mode, under the condition that the cloud server updates the interface information, the manufacturer updates the register information such as the test data, the scene of the complete data stream can be rapidly verified through the second test mode.
On the basis of the above-described test system for energy products, according to an aspect of the present application, there is provided a test method for energy products, as shown in fig. 15, comprising the steps of.
Step S1501 determines the protocol of the product to be tested.
According to some embodiments, the basic flow of testing includes protocol selection, serial port configuration, protocol configuration, opening communication, and ending communication. Before the host computer establishes communication with the data acquisition device, the protocols used by the host computer and the data acquisition device need to be determined. After the protocol is selected, determining data acquisition equipment matched with the protocol, and communicating the upper computer with the data acquisition equipment according to the selected protocol, wherein the upper computer simulates a product of the selected protocol for testing.
Step S1502, generating a configuration file according to a protocol document corresponding to the protocol of the product to be tested.
According to some embodiments, the protocol documents provided by the respective vendors are based on respective protocols, which are likely to be different from each other. The open source upper computer adopted in the prior art only supports the generated general data according to the standard protocol, and for non-standard protocol content, the open source upper computer in the prior art cannot support, the applicability of a test mode is not universal, and command frames need to be manually combined and disassembled. In the present application, for protocol documents provided by respective manufacturers, they are first converted into documents of a preset format, respectively. The protocols followed by the various vendors may vary, as may the protocol documents provided. According to some embodiments, the type of information to be extracted may be predetermined, for example, information such as protocol register address, conversion coefficient, chinese name, default value, etc. may be extracted from the protocol document to form an Excel document. After obtaining the document in the predetermined format, a configuration file is generated. According to some embodiments, after obtaining the predetermined format document, the predetermined format document is converted into a configuration file according to the set script. According to some embodiments, the script that converts the pre-formatted document into a configuration file includes Xlrd, pandas, pyyaml scripts. According to some embodiments, the Xlrd script reads the name in the predetermined format document as a packet name, and loops to obtain the base configuration information in the predetermined format document to generate a corresponding protocol configuration file. According to some embodiments, the generated configuration file includes register addresses and test data corresponding to each register address.
Thus, step S1502 may include: acquiring a document in a preset format formed by the protocol document; and converting the document with the preset format into the configuration file according to the set script.
Step S1503, receiving an instruction for collecting test data from the data collecting device;
step S1504, determining test data corresponding to the target register address according to the target register address included in the instruction and the configuration file.
According to some embodiments, during the testing process, the data acquisition device sends instructions to the host computer to acquire the test data. After receiving the instruction, the upper computer analyzes the instruction, further obtains the numerical value in which register is needed by the data acquisition equipment, obtains test data in the corresponding register from the configuration file according to the address of the target register, writes the test data into the response buffer, and formats the response buffer data according to the MODBUS standard protocol specification.
Thus, step S1504 may include: analyzing the instruction to obtain the address information of the target register; and obtaining test data in a register corresponding to the address information from the configuration file.
Step S1505, transmitting the test data to the data acquisition device.
According to some embodiments, the host computer communicates with the data acquisition device in accordance with the protocol of the product to be tested. And the upper computer encapsulates the test data to be acquired according to the protocol of the product to be tested according to the instruction of the data acquisition equipment to form a protocol encapsulation frame, and then sends the protocol encapsulation frame to the data acquisition equipment.
Thus, step S1505 may include: packaging the test data through a protocol of a product to be tested to obtain a protocol packaging frame; and transmitting the protocol encapsulation frame to the data acquisition device.
Step S1506, comparing the result data fed back by the data display device with the test data to obtain a test result.
According to some embodiments, after receiving the response frame of the upper computer, the data acquisition device sends the response frame to the cloud server, interaction is performed between the cloud server and the data display device through the atom interface, and the data display device displays result data obtained according to the test data. The data display equipment feeds back the result data to the upper computer, and the upper computer can verify the processing correctness of a whole set of data streams by comparing the result data obtained by the data display equipment with test data manufactured by the registers of the upper computer at the bottommost layer: and the data acquisition equipment is used for acquiring register data and packaging the DP, disassembling the DP point from the cloud server and providing the interface correctness for the data display equipment, so that the test of the data link of the whole energy product is realized.
On the basis of the above-described test system for energy products, according to another aspect of the present application, there is provided a test method for energy products, as shown in fig. 16. In comparison with fig. 15, steps S1601 to S1606 of fig. 16 are the same as steps S1501 to S1506 of fig. 15, except that the method shown in fig. 16 further includes, before step S1601:
step S1601, test is performed on the data display device.
According to the mode of "test data presentation device first and then data acquisition device" shown in fig. 13 and 14, the data presentation device is tested before the data acquisition device is tested or the entire energy product data link is tested.
According to some embodiments, in the testing process of the data display device, according to the DP object model and the requirements, a tester sorts the test DP data, the test data display device is directly in butt joint with the object model, a register and a data acquisition device are skipped, the test data display device is bound to a shadow device platform, virtual energy devices are deployed, DP information is pushed through the shadow device, and data on the data display device is checked.
Thus, step S1601 may include:
sending test DP data to a cloud server through an object model;
transmitting the test DP data to the data display equipment through the cloud server; and
and checking the result data through the data display equipment.
According to the testing method and the testing system for the energy product, disclosed by the application, the developed upper computer can be compatible with standard protocol data and nonstandard protocol data, so that the testing method and the testing system can be compatible with business data of different manufacturers, and can be used for solving the problems that in the prior art, testing data is incomplete, the finished product deployment of the real product of the inverter/energy storage cabinet is inconvenient and the like when the energy data acquisition equipment is used for simulating equipment such as a power cabinet and an inverter, and the developed upper computer can autonomously combine and send a request of a MODBUS, so that the real inverter data can be directly and efficiently simulated. In addition, in the process of testing the energy product, each tested object such as the data acquisition equipment, the data display equipment and the like can be directly verified, the full link of the energy product data is opened, the testing flow is simplified, the testing accuracy is improved, and the time and the resources are saved.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present application is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are alternative embodiments, and that the acts and modules referred to are not necessarily required for the present application.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, such as the division of the units, merely a logical function division, and there may be additional manners of dividing the actual implementation, such as multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, electrical connection, or other forms.
Referring to fig. 17, fig. 17 provides an electronic device including a processor and a memory. The memory stores computer instructions that, when executed by the processor, cause the processor to execute the computer instructions to implement the methods and refinements shown in fig. 15 and 16.
It should be understood that the above-described device embodiments are illustrative only and that the disclosed device may be implemented in other ways. For example, the division of the units/modules in the above embodiments is merely a logic function division, and there may be another division manner in actual implementation. For example, multiple units, modules, or components may be combined, or may be integrated into another system, or some features may be omitted or not performed.
In addition, unless specifically described, each functional unit/module in each embodiment of the present application may be integrated into one unit/module, or each unit/module may exist alone physically, or two or more units/modules may be integrated together. The integrated units/modules described above may be implemented either in hardware or in software program modules.
The integrated units/modules, if implemented in hardware, may be digital circuits, analog circuits, etc. Physical implementations of hardware structures include, but are not limited to, transistors, memristors, and the like. The processor or chip may be any suitable hardware processor, such as CPU, GPU, FPGA, DSP and ASIC, etc., unless otherwise specified. The on-chip cache, off-chip Memory, memory may be any suitable magnetic or magneto-optical storage medium, such as resistive Random Access Memory RRAM (Resistive Random Access Memory), dynamic Random Access Memory DRAM (Dynamic Random Access Memory), static Random Access Memory SRAM (Static Random Access Memory), enhanced dynamic Random Access Memory EDRAM (Enhanced Dynamic Random Access Memory), high-Bandwidth Memory HBM (High-Bandwidth Memory), hybrid Memory cube HMC (Hybrid Memory Cube), and the like, unless otherwise indicated.
The integrated units/modules may be stored in a computer readable memory if implemented in the form of software program modules and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a memory, comprising several instructions for causing a computer electronic device (which may be a personal computer, a server or a network electronic device, etc.) to perform all or part of the steps of the method described in the various embodiments of the disclosure. And the aforementioned memory includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Embodiments of the present application also provide a non-transitory computer storage medium storing a computer program that, when executed by a plurality of processors, causes the processors to perform the methods and refinement as shown in fig. 15 and 16.
The foregoing has outlined rather broadly the more detailed description of embodiments of the application in order that the detailed description of the principles and embodiments of the application may be implemented in conjunction with the detailed description of embodiments of the application that follows. Meanwhile, based on the idea of the present application, those skilled in the art can make changes or modifications on the specific embodiments and application scope of the present application, which belong to the protection scope of the present application. In view of the foregoing, this description should not be construed as limiting the application.