Relay protection system software interface development method and device
By configuring a universal data model and using universal display controls, the problems of code redundancy and low development efficiency in relay protection system software interface development are solved, efficient and low-cost interface development is achieved, and flexible interface editing and replication are provided. A highly practical interface development method.
Patent Information
- Application Number
- CN202310163944.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-24
- Publication Date
- 2024-08-27
AI Technical Summary
In the existing technology, the software interface development of the relay protection system has the problems of code redundancy, low development work efficiency and high cost.
By configuring a common data model and using common display controls, a common interface is generated to support the editing and display of data objects, abstract away basic functions, reduce code redundancy and memory consumption, and improve development efficiency.
It achieves the reduction of code redundancy, reduction of development costs, saving of memory resources and improvement of development efficiency, and provides flexible interface editing and highly reusable interface development methods.
Smart Images

Figure CN118550520A
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of interface development, and in particular relates to a method and device for developing software interface of a relay protection system. Background Art
[0002] With the rise of digital technology, the degree of digitalization of power system relay protection is gradually improving. At this time, it is necessary to design related supporting software to synchronize the requirements of relay protection information digitalization. In the design of relay protection system development tools, there are many display interfaces that have the same functions and styles, but they display different data sources according to different needs. The development of a large number of display interfaces with the same functions will cause code redundancy and increase the burden of memory usage. Since different interfaces are implemented by different developers, the same functions will waste a lot of manpower and material resources. In short, in the prior art, the development of relay protection system software interfaces has code redundancy, heavy memory burden, and waste of manpower and material resources, resulting in high cost and low work efficiency of relay protection system software interface development. Therefore, the design of a universal display interface is extremely important in the design of relay protection system development tools. Summary of the invention
[0003] The purpose of the present invention is to provide a method and device for developing a software interface for a relay protection system, so as to solve the problems of code redundancy, low development efficiency and high cost in the prior art when developing a software interface for a relay protection system.
[0004] In order to solve the above technical problems, the technical solutions provided by the present invention and the corresponding beneficial effects of the technical solutions are as follows:
[0005] A method for developing a software interface for a relay protection system of the present invention comprises the following steps:
[0006] 1) Configure a general data model according to requirements; the general data model is used to describe various data objects required for interface display, and the general data model includes various data items used for interface display; configure the data value corresponding to each data item in the engineering data;
[0007] 2) Use the model parsing module to parse the general data model and engineering data to obtain data objects;
[0008] 3) Loading the data object and calling the universal display control to generate a universal interface to display each data item and the corresponding data value. The universal display control is a universal display control created based on the universal data model;
[0009] 4) Edit data objects on the general interface according to business requirements to obtain the final displayed relay protection system software interface.
[0010] The beneficial effects of the above technical solution are as follows: the present invention displays the description information of the configured data object on the general display control by configuring the description information of the data object in the general data model and using the general display control. The present invention extracts the general basic functions through the general data model and the general display control, and then satisfies different developers to write different display interfaces according to their needs by configuring the general data model and parsing the data model. Therefore, the present invention does not waste a lot of human resources and time resources, shortens the development cycle, reduces development costs, and also reduces the redundancy and bloat of the code in the project, saves memory resources, has strong reusability, and improves development efficiency.
[0011] Further, in order to expand the scope of application, editing the data object in step 4) includes adding data values corresponding to data items, deleting data values corresponding to data items, modifying data values corresponding to data items, and modifying the display order of data values corresponding to data items.
[0012] Furthermore, the common data model is stored in an XML file.
[0013] Furthermore, in order to meet more requirements, the general data model includes a display attribute configuration node, and also includes at least one of an export attribute configuration node and all attribute configuration nodes; the display attribute configuration node is used to configure each data item of the data object that needs to be displayed on the interface; the export attribute configuration node is used to configure each data item of the data object that needs to be exported; the all attribute configuration node is used to configure all data items of each data object required by the interface.
[0014] Furthermore, the general display control created in step 3) includes a data table.
[0015] Furthermore, in order to improve the convenience of the editing interface, the general interface includes a display area and a tool area; in step 4), the data object is edited through the following menu items in the tool area: add data, delete data, undo, redo, adjust data order and modify data value.
[0016] Furthermore, the undo and redo operation functions are implemented in the following manner: an action stack is established in the general display control; when a modification operation is performed on the general interface, the corresponding operation actions are added to the action stack of the general display control in sequence according to the operation order; when the undo command is triggered, the top action in the action stack is popped out; if the redo command is triggered, it is necessary to determine whether the action stack is empty. If it is empty, the redo command cannot be executed. If it is not empty, the most recently popped action in the action stack is added back into the action stack.
[0017] Furthermore, the QToolBar class in pyqt is used to implement the operation functions of adding data, deleting data, adjusting data order and modifying data values.
[0018] Furthermore, the relay protection system software interface data finally displayed in step 4) is saved in the engineering data.
[0019] In order to solve the above problems, the present invention further provides a relay protection system software interface development device, including a processor, wherein the processor is used to execute computer instructions to implement a relay protection system software interface development method as the present invention, thereby achieving the same beneficial effects as the method. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a schematic diagram of a data model table in a method embodiment of the present invention;
[0021] Figure 2 It is a schematic diagram of a data model table of a permission configuration business function in a method embodiment of the present invention;
[0022] Figure 3 It is a general control data display diagram in the method embodiment of the present invention;
[0023] Figure 4 It is a schematic diagram of a file export format in a method embodiment of the present invention;
[0024] Figure 5 is a general control area distribution diagram in a method embodiment of the present invention;
[0025] Figure 6 is a right-click function block diagram in a method embodiment of the present invention;
[0026] Figure 7 It is a schematic diagram of adding data function in the method embodiment of the present invention;
[0027] Figure 8 is an undo-redo flow chart in a method embodiment of the present invention;
[0028] Fig. 9 This is a schematic diagram of password modification in the authority configuration service in the method embodiment of the present invention;
[0029] Fig.10 is a schematic diagram of a revocation function in an embodiment of the method of the present invention;
[0030] Fig.11 It is a schematic diagram of the redo function in the method embodiment of the present invention. DETAILED DESCRIPTION
[0031] The purpose of the present invention is to provide a method and device for developing a software interface of a relay protection system. The present invention provides a universal interface model for a relay protection system development tool. The present invention includes a universal data model, a model parsing module and a universal display control. In a specific project, the data items to be displayed in the interface are described by configuring the universal data model, the engineering data is configured corresponding to the universal data model, and then the universal data model and the engineering data are parsed by the model parsing module, the universal display control is called, and a universal interface is generated. The universal interface includes each data item and the data value corresponding to the data item. The universal interface in the present invention also supports the function of re-editing to improve flexibility. The present invention aims to provide a universal interface control for a relay protection system development tool, improve development efficiency, reduce the time and energy waste of developers, and reduce the consumption of memory space.
[0032] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described in detail below with reference to the accompanying drawings and embodiments.
[0033] Method Example:
[0034] A method embodiment of a software interface development method for a relay protection system of the present invention comprises creating a general data model, creating a model parsing module, creating a general interface and realizing the modification operation function of the interface data object; the general data model is used to dynamically configure the data to be displayed on the interface and describe the data object; the model parsing module is used to load and parse the description file of the general data model, initialize the data object, and load the data object in the memory; the general interface comprises a general display control (also referred to as the general control), and is used to load the data object and call the general display control to display the data parsed by the model parsing module; the interface modification operation is used to modify the data attributes displayed on the interface, including realizing the modification of attribute values, data display order, adding data, deleting data, undoing and redoing functions.
[0035] The method of the present invention comprises the following steps:
[0036] Step 1: Create a common data model.
[0037] Common data model: A data display model used for dynamically configuring interfaces. It can change the interface display data and the attributes of the data to be displayed without modifying the code.
[0038] The following is an introduction to the general data model:
[0039] In this embodiment, the general data model is stored in the form of a table, so the general data model is also called a data model table. Figure 1As shown, by dynamically configuring the general data model in the data model table, the data object is described by the general data model. The data model table is mainly divided into three nodes: display attribute configuration node (optMode), export attribute configuration node (expMode) and all attribute configuration node (attrMember). Among them, each attribute is also called each data item, and the data value corresponding to the data item corresponds to the attribute value.
[0040] Display attribute node: configure the attributes of the data object displayed on the general interface. The display layer of the relay protection development tool relies on the display description of the data object to display and edit attributes in different functional units, and can be dynamically updated according to the attribute description information of the data type and the display attribute description information.
[0041] Export attribute node: configure the attribute information in the data object that needs to be exported to the file. Configure according to the data attributes required by the relay protection device, and then export the required data attribute information according to the configuration. The data attribute information of the data export can be changed dynamically.
[0042] All attribute nodes: configure all attributes of the data object. Different attribute configurations are performed according to different functional units of the relay protection development tool. You only need to configure different data models according to different functions, and you can achieve data display of different functions without changing the code.
[0043] The following describes the configuration of the general data model based on the implementation of the permission configuration business interface as an example:
[0044] like Figure 2 As shown in the figure, when configuring the data model table for the permission configuration service, the optMode node is configured with five data attributes: name, password, type, power, and enable. These five attributes are used as table headers to display data on the general interface. The specific data display is as follows: Figure 3 As shown in the figure, the five data attributes of name, password, type, power and enable are configured in the expMode node. In the export file, these five data attributes will be used as the node header to export the file. The specific file export format is as follows Figure 4 As shown in the figure, the attrMember node is configured with five data attributes: name, password, type, power, and enable, that is, the data model has only these five attributes.
[0045] The above node information is stored in the data model description file, which is an XML file.
[0046] By abstracting data into self-describing configurable information, the data is independent of code version changes in the design software, the data model can be modified and adjusted dynamically, and the editing interface and export configuration files can be obtained synchronously, which greatly improves the versatility of the relay protection design software and the response speed to changes in data model requirements.
[0047] Step 2: Create a model parsing module for loading and parsing data model tables.
[0048] The general data model description file is loaded and parsed through the model parsing module, the data object is initialized, and the data object is loaded into the memory.
[0049] In order to load and parse the data model table, a general data model operation class (TDataModelopt) and a configuration data class (TCfgDatas) are designed.
[0050] The general data model operation class mainly provides interfaces such as data model information loading, initializing global data configuration, exporting XML project files, and exporting configuration files.
[0051] Among them, the data model loading interface is used to read the data of each node in the data model table and generate a TTable object in the computer memory; the initialization global data configuration interface is used to load each data model table as a global variable; the export xml project file interface is used to export the project file according to the project data in the datalist in the memory, which is an xml file; the export configuration file interface is used to configure the node expMode according to the export attribute to export the configuration file, which is a txt text file, such as Figure 4 shown.
[0052] The configuration data class mainly provides a global data object access interface, and provides encapsulation of the data table (TTable) class and data (BaseModel class) in TCfgDatas.
[0053] Among them, the TTable class is used to implement the function of loading model tables. Each model table is a TTable object in the computer memory. The BaseModel class is used for instance engineering data. A piece of engineering data is a BaseModel object in the computer memory.
[0054] The following is an example of the permission configuration business to illustrate the specific process of using the model parsing module to parse the data model table in the present invention: First, the data parsing module uses a TTable class to instantiate the permission configuration data model table, and then loads it as a global variable. After opening the project, the data parsing module parses the project file and searches for the project data of the permission configuration in the project. After finding it, the Base Model class is called to instantiate the project data and store it in the datalist. Each project data of the permission configuration business is a BaseModel object in the computer memory.
[0055] Step 3: Create a universal display control, load the data object and call the universal display control to generate a universal interface. The universal interface is used to display the user-configured data. Users only need to call the interface to use it without having to develop and implement it from scratch. Instantiate the universal display control, load the data object, and call the universal display control to display the data. The specific universal control data display effect is as follows: Figure 3 shown.
[0056] In this embodiment, the universal display control is a table, also called a universal table control. The universal table control corresponds to the attributes configured in the data model table. Each attribute serves as the header of the universal table control. The universal display control is mainly divided into two areas, such as Figure 5 As shown in Table 1, they are toolbar (area 1) and display area (area 2). The general table control mainly includes a series of basic functions such as adding data, deleting data, adjusting the order of data in the table, and modifying data values, as shown in Table 1 below.
[0057] Specifically, in this embodiment, the PyQt third-party library is used to create a display control. When the data object is loaded and the general display control is called, the number of table rows is determined according to the number of data in the datalist node, and the number of table columns is determined according to the number of attributes in the display attribute configuration node optMode. The order of each attribute configuration in the display attribute configuration node optMode is displayed column by column in the table header, and then displayed in the table in sequence according to the order of data configuration in the datalist node.
[0058] Step 4: Configure the general data model and engineering data according to business needs. The model parsing module parses the general data model and engineering data to obtain data objects, instantiate general display controls, load data objects, and call general display controls to display data in order to display various attributes and corresponding attribute values.
[0059] The engineering data includes the attribute values corresponding to the attributes in the general data model. For example, when configuring the data model table for the permission configuration service, the optMode node is configured with five data attributes: name, password, type, power, and enable. The attribute values corresponding to the attributes are configured in the engineering data, such as operator 1, 0123, operator, 0x7ff4c, 1.
[0060] Step 5: Implement the modification operation function, re-edit the general interface, and obtain the final displayed relay protection system software interface.
[0061] The general display control is mainly divided into two areas, namely the toolbar (area 1) and the display area (area 2). Figure 5 The general table control mainly includes a series of basic functions such as adding data, deleting data, adjusting the order of data in the table, and modifying data values, as shown in Table 1. There are add, delete, move up, and move down function buttons on the toolbar. Clicking the function button triggers its corresponding function. For example, clicking the add button will add a row to the data table. Users can add data by entering in the cells of the interface, such as Figure 7 As shown. The toolbar uses the QToolBar class in pyqt. To add, delete, move up and down actions on the toolbar, the QAction class is used. Then the actions are added to the toolbar class using the addAction method. Data modification is achieved by directly clicking on cells in the table to trigger cell changes and save signals.
[0062] Table 1 Toolbar Function Table
[0063] Button name describe "+” Add to Add data "-” delete Delete selected data "↓” Move Down Move the selected data down "↑” Move Up Move the selected data up
[0064] Undo and redo commands: support interface undo and redo operations, and realize undo and redo of interface operations.
[0065] Right click on the display area, and a right click function box will pop up, such as Figure 6 As shown. Clicking the undo option on the right-click function box will undo the last step and restore to the state before the operation. Clicking the redo option on the right-click function box will restore the state before the most recently undone operation. In addition, it also includes functions such as copy, paste, copy down and fill down.
[0066] Undo and redo encapsulate the functions of adding data, deleting data, moving up, moving down, and modifying data into related action classes. Each class inherits the QUndoCommand class and encapsulates the corresponding undo and redo methods. First, establish an action stack in the common control. When performing operations such as adding, deleting, modifying, moving up, and moving down on the common control interface, the related operation actions will be added to the action stack of the common control in sequence. When the undo command is executed, the top action in the action stack will be popped out. When executing the redo command, you first need to determine whether the stack is empty. If it is empty, the redo command cannot be executed. If it is not empty, the most recently popped action in the action stack will be added back into the stack. The process is as follows Figure 8 shown.
[0067] In the permission configuration function interface, change the system administrator's password from 0123 to 1233, as follows Fig. 9 Then right-click, a right-click function box pops up, click the Undo function, and the system administrator's password will be restored from 1233 to 0123. Because only one action operation is performed, there is only one element in the action stack. After executing the Undo function, the action stack is empty, so the Undo function becomes gray and cannot be triggered again, as shown below Fig.10 After executing the undo function, there is the most recently popped element in the stack, so the redo function can be executed. Right-click, and a right-click function box pops up. Click the redo function, and the system administrator's password will change from 0123 to 1233 again, as shown in the figure below. Fig.11 shown.
[0068] The present invention is introduced again below based on the permission configuration service as an example:
[0069] In the permission configuration business, the table name of the permission configuration business in the data model table is user. By obtaining the user table in the data model table in memory, all the information configured in the model table in the permission configuration business can be obtained. Instantiate the general interface control class, and then pass in the model table name of the permission configuration business. The general interface control will obtain the attributes required to be displayed in the interface of the permission configuration business model table through the table name, set the display attribute to the table header, and also need to pass in the project data in the datalist in the data model. If the datalist is not empty, the existing project data will be automatically added to the interface table first. Among them, the datalist is to create a row in the interface table by clicking the Add Data button on the interface, and at the same time, a project data object of the permission configuration business will be created in the datalist of the model object. Fill in the specific attribute value in the table of the corresponding attribute on the interface, and the corresponding attribute value of the data object will be modified. When the Delete function button is clicked, the selected data row will be deleted on the interface, and the corresponding data object will be deleted in the datalist of the data model table. When the Up and Down function buttons are clicked, the data row on the interface will move up and down, and the corresponding data objects in the datalist of the data model table will exchange positions. Finally, click the tool save button to save the project data according to all the properties configured in the data model table (if expMode = 'True' is passed in the save interface, it will be saved according to the export properties configured in the data model table) and saved as a corresponding xml project file.
[0070] In this embodiment, the attributes configured in the data model table are the contents of the table header, and the general display control is a data table. In other embodiments, the attributes can also be configured in the data model table, and each attribute represents each element in the bar graph, and the general display control is a bar graph; for example, taking the number of failures of three devices per month as an example, the attributes configured in the data model table include the number of bar graph comparisons, the name of each comparison item, and the number of comparisons. The number of failures of the device in each month needs to be configured in the datalist of the data model table in the engineering project, and the height of the bar graph is displayed in the general display control according to the number of device failures corresponding to the month. In other embodiments, the attributes can also be configured in the data model table, and each attribute represents each element in the line graph, and the general display control is a line graph. For example, taking the number of failures of a certain device per month as an example, the attributes configured in the data model table include the device name, the number of months, and the number of failures of the device per month, and the general display control is based on the number of months and the month.
[0071] The beneficial effects of the above technical solution include the following aspects:
[0072] First: strong reusability.
[0073] Different developers write different display interfaces as needed by configuring a common data model and a common display control, and some common basic functions contained in the extracted interface are implemented through the common data model, which saves a lot of human resources and time resources, shortens the development cycle, and also reduces the redundancy and bloat of the code in the project, and reduces the consumption of memory resources. Therefore, the present invention can not only liberate developers, reduce the waste of manpower and material resources, but also reduce the consumption of memory resources and improve development efficiency.
[0074] Second: easy and convenient to use.
[0075] The use of common controls only requires calling instantiation, and then passing data to the instance class, the interface will automatically display the data, and developers do not need to write code separately. Common controls have complete basic functions, and some basic functions are encapsulated, such as adding, deleting, modifying, and adjusting the order of data. Developers do not need to spend time and energy to develop and implement basic functions. Common controls have been tested in a large number of uses, with strong reliability and guaranteed performance.
[0076] Third: convenient function maintenance and upgrade.
[0077] When developers use common controls, they only need to call the interface directly, and no maintenance is required. To upgrade common controls, developers who use common controls do not need to modify the code. Only a dedicated person is needed to upgrade the common controls. The external interface of the common controls remains unchanged, and the latest version will be automatically synchronized through the call of the interface. Moreover, common controls are maintained by a dedicated person, so there is no waste of extra manpower and material resources.
[0078] Device Example:
[0079] An embodiment of a relay protection system software interface development device of the present invention is as follows Figure 8 As shown, it includes a memory, a processor and an internal bus, and the processor and the memory communicate and exchange data with each other through the internal bus. The memory includes at least one software function module stored in the memory, and the processor executes various functional applications and data processing by running the software program and module stored in the memory, thereby realizing a method for developing a software interface for a relay protection system introduced in the method embodiment of the present invention.
[0080] The processor may be a processing device such as a microprocessor MCU, a programmable logic device FPGA, etc. The memory may be any memory that uses electrical energy to store information, such as RAM, ROM, etc.
Claims
1. A method for developing a software interface for a relay protection system, characterized in that: The following steps are involved: 1) Configure a general data model according to requirements; the general data model is used to describe various data objects required for interface display, and the general data model includes various data items used for interface display; configure the data value corresponding to each data item in the engineering data; 2) Use the model parsing module to parse the general data model and engineering data to obtain data objects; 3) Loading the data object and calling the universal display control to generate a universal interface to display each data item and the corresponding data value. The universal display control is a universal display control created based on the universal data model; 4) Edit data objects on the general interface according to business requirements to obtain the final displayed relay protection system software interface.
2. The method for developing a software interface for a relay protection system according to claim 1, characterized in that: Editing the data object in step 4) includes adding data values corresponding to data items, deleting data values corresponding to data items, modifying data values corresponding to data items, and modifying the display order of data values corresponding to data items.
3. The method for developing a software interface for a relay protection system according to claim 1, characterized in that: The common data model is stored in an xml file.
4. The method for developing a software interface for a relay protection system according to claim 3, characterized in that: The general data model includes a display attribute configuration node, and also includes at least one of an export attribute configuration node and all attribute configuration nodes; the display attribute configuration node is used to configure each data item of the data object that needs to be displayed on the interface; The export attribute configuration node is used to configure the data items of the data objects that need to be exported; the all attribute configuration nodes are used to configure all data items of the data objects required by the interface.
5. The method for developing a software interface for a relay protection system according to claim 1, characterized in that: The general display control created in step 3) includes a data table.
6. The method for developing a software interface for a relay protection system according to claim 2, characterized in that: The general interface includes a display area and a tool area; in step 4), the data object is edited through the following menu items in the tool area: at least two operations of adding data, deleting data, undoing, redoing, adjusting data order and modifying data value.
7. The method for developing a software interface for a relay protection system according to claim 6, characterized in that: The undo and redo functions are implemented in the following ways: an action stack is established in the general display control; when performing a modification operation on the general interface, the corresponding operation actions are added to the action stack of the general display control in the order of operation; when the undo command is triggered, the top action in the action stack is popped out; If a redo command is triggered, it is necessary to determine whether the action stack is empty. If it is empty, the redo command cannot be executed. If it is not empty, the most recently popped action in the action stack is added back into the action stack.
8. The method for developing a software interface for a relay protection system according to claim 6, characterized in that: The QToolBar class in pyqt is used to implement the operations of adding data, deleting data, adjusting data order and modifying data values.
9. The method for developing a software interface for a relay protection system according to any one of claims 1 to 8, characterized in that: The relay protection system software interface data finally displayed in step 4) is saved in the engineering data.
10. A relay protection system software interface development device, characterized in that: It includes a processor, which is used to execute computer instructions to implement the relay protection system software interface development method as described in any one of claims 1 to 9.
