A method and system for automatically generating interface controls bound to channels
Patent Information
- Application Number
- CN202611392328.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-09
- Publication Date
- 2026-10-30
AI Technical Summary
然而,这种人工操作方式在实际应用中暴露出诸多不足:
1、本申请提出的界面控件自动生成与通道绑定的方法,通过对逻辑通道表的自动解析与分组处理,建立了从逻辑通道到界面控件的自动映射,无需人工逐一手动输入通道标记,确保了界面控件与实际物理量的始终保持同步,避免了因手动命名错误导致的控件与数据源失配问题,显著提高了系统的数据准确性和可靠性。并通过批量创建显示面板和表格控件的方式,取代了传统手工逐一创建控件的繁琐流程,不仅大大提高了界面开发的效率,还保证了控件布局的一致性和准确性,降低了重复劳动带来的时间和人力成本;通过动态表格的构建和实时数据更新机制,确保界面显示与实际物理量始终保持同步。
Smart Images

Figure CN123011088A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of data processing technology, and specifically relates to a method and system for automatically generating interface controls and binding them to channels. Background Technology
[0002] Transmission test benches are key equipment for testing the performance of rotating machinery such as aero engines and reducers. Their measurement and control systems need to collect and display a large number of physical quantity signals in real time, such as vibration, temperature, and rotational speed.
[0003] With increasingly complex testing requirements, the number of display controls that need to be configured in the measurement and control system interface has increased dramatically. Traditional interface development methods often rely on engineers manually creating controls one by one and establishing the binding relationship between controls and data sources by manually inputting channel tags. However, this manual operation method has revealed many shortcomings in practical applications: On the one hand, manually creating a large number of controls is inefficient and makes it difficult to ensure the consistency and standardization of the interface layout; on the other hand, manual input of channel markers is prone to spelling errors or inconsistent formats, which can cause controls to fail to bind to the corresponding logical channel data source, leading to abnormal data display, misaligned values, or even no data display, seriously affecting the reliability of test data and the availability of the system.
[0004] Furthermore, when test tasks change or logical channel tables are updated, the existing solution lacks an efficient automated adjustment mechanism, often requiring tedious manual reconfiguration, which further increases maintenance costs and error risks.
[0005] Therefore, overcoming the shortcomings of the existing technology is an urgent problem to be solved in this technical field. Summary of the Invention
[0006] To address the aforementioned issues, this application provides a method for automatically generating and binding interface controls to channels, comprising the following steps: The logical channel table of the measurement and control system is filtered to extract the channel group and installation location. The number of records and the first row number of each different combination of channel group and installation location are counted. The filtered data is then stored in a dynamic table. Obtain the channel group and installation location name of each record in the dynamic table and combine them as the panel title. Create a display panel and generate corresponding sub-menu items in the interface menu. The sub-menu items are used to switch the display of the corresponding display panel. Insert the corresponding number of rows into the table of the display panel and supplement the logical channel name, unit and precision of each row based on the logical channel table. The table rows of each display panel are traversed, and several values are batch retrieved from the logical channel data array of the measurement and control program according to the first row number and assigned to the table cells. At the same time, the running status of each channel is obtained, and the display color of the cells is dynamically set according to the running status to form a dynamic data table.
[0007] Furthermore, the filtering process is implemented using SQL database programming and the records are sorted in ascending order by the number of records.
[0008] Furthermore, creating the display panel specifically involves: Using a preset table display template panel as the original panel, a display panel is created using the panel copy command, the position information of the display panel is set, and the handle of the display panel is returned.
[0009] Furthermore, generating corresponding sub-menu items in the interface menu is specifically as follows: Add sub-menu items by creating a new menu item function. The name of the sub-menu item is the panel title, and a callback function is configured for the sub-menu item.
[0010] Furthermore, when generating corresponding sub-menu items in the interface menu, it also includes: Compare the channel group of the current record with the channel group of the previous record. If they are different, insert a menu separator before inserting the current submenu item to visually group the submenu items of different channel groups.
[0011] Furthermore, the process of batch retrieving the corresponding values from the logic channel data array of the measurement and control program based on the first row number and assigning them to the table cells is as follows: Get the address of the element at the starting row of the channel group in the logical channel data array and use it as the starting address to batch assign values to the display array elements of the corresponding numerical display area in the table control.
[0012] Furthermore, the operating status of each channel includes normal, alarm, and fault. When the channel is in a normal state, it is displayed in the first color; when the channel is in an alarm state, it is displayed in the second color; and when the channel is in a fault state, it is displayed in the third color.
[0013] This application also provides a system for automatically generating and binding interface controls to channels, employing the method described above for automatically generating and binding interface controls to channels, including: The data filtering module is used to filter the logical channel table of the measurement and control system, extract the channel group and installation location, count the number of records and the first row number of each different combination of channel group and installation location, and store the filtered data into a dynamic table. The interface generation module is used to obtain the channel group and installation location name of each record in the dynamic table and combine them as the panel title, create the display panel and generate the corresponding sub-menu items in the interface menu. The sub-menu items are used to switch the display of the corresponding display panel, insert the corresponding number of rows in the table of the display panel, and supplement the logical channel name, unit and precision of each row based on the logical channel table. The real-time binding module is used to traverse the table rows of each display panel, retrieve several values from the logical channel data array of the measurement and control program in batches according to the first row number, and assign them to the table cells. At the same time, it retrieves the running status of each channel and dynamically sets the display color of the cells according to the running status to form a dynamic data table.
[0014] This application also provides a terminal, which includes a memory, a processor, and a computer program stored in the memory. When the computer program is executed by the processor, it implements the steps of the method described above for automatically generating interface controls and binding them to channels.
[0015] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method described above for automatically generating interface controls and binding them to channels.
[0016] Compared with the prior art, this application has the following advantages: 1. The method for automatically generating and binding interface controls to channels proposed in this application establishes an automatic mapping from logical channels to interface controls through automatic parsing and grouping of the logical channel table. This eliminates the need for manual input of channel tags, ensuring that interface controls remain synchronized with the actual physical quantities. It avoids mismatches between controls and data sources caused by manual naming errors, significantly improving the system's data accuracy and reliability. Furthermore, by batch-creating display panels and table controls, it replaces the tedious process of manually creating controls one by one, greatly improving the efficiency of interface development and ensuring the consistency and accuracy of control layout, reducing the time and labor costs associated with repetitive work. Through dynamic table construction and real-time data update mechanisms, it ensures that the interface display remains synchronized with the actual physical quantities.
[0017] 2. When the logical channel table changes, simply re-execute this method to automatically update the interface without manual adjustments. This achieves automated binding and dynamic display of status colors, ensuring the accuracy of real-time monitoring of key physical quantities and providing strong support for the safe operation of the transmission test bench.
[0018] Other features and advantages of this application will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures pointed out in the description and the accompanying drawings. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 A flowchart illustrating the method for automatically generating interface controls and binding them to channels in an embodiment of the present invention is shown. Figure 2 A flowchart of step S2 is shown; Figure 3 A schematic diagram of a dynamic table is shown; Figure 4 A flowchart of step S3 is shown; Figure 5 A schematic diagram of a dynamic data table is shown; Figure 6 A system block diagram illustrating the automatic generation and binding of interface controls to channels is shown in an embodiment of the present invention. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0022] It should be noted that, taking the transmission test bench currently adapted to helicopter transmission systems as an example, when the test model changes or additional test points are needed, the corresponding test point parameters need to be modified or added to the interface of the measurement and control software. The interface needs to display the name, actual value, and unit of the physical quantity of the test parameter.
[0023] However, since the names of controls on the design interface (such as "control type_channel marker") are all manually entered, it is very easy to make mistakes in the input of the string-type channel marker in practice. If the channel marker string of a control is entered incorrectly, after running the program, the interface will not display the actual Chinese name of the logical channel measurement point, but the incorrectly entered string. In addition, the measurement point parameter of the control will always be displayed as 0. The program will not report any errors or provide any information prompts. At this time, the designer needs to manually discover the problem, reset the correct name of the control channel marker on the interface according to the naming rules, and run the program again to correct the problem. Furthermore, the control operation steps displayed on the measurement and control software interface are numerous, and when many display parameters need to be added, the workload of creating new controls and naming controls on the interface will also increase accordingly.
[0024] To address the issues of high manual workload and high error rate in current transmission test bench control systems.
[0025] This invention provides a method for automatically generating and binding interface controls to channels. Figure 1 The diagram illustrates a method for automatically generating and binding interface controls to channels according to an embodiment of the present invention, specifically including the following steps: S1. Filter the logic channel table of the measurement and control system, extract the channel group and installation location, and count the number of records and the first row number of each different channel group and installation location combination. Store the filtered data into a dynamic table.
[0026] It should be noted that the logic channel table contains channel description information for each logic channel, including but not limited to channel group, installation location, logic channel name, unit, precision, channel label, data address location, and analog quantity linear transformation. The units include: voltage (V), current (A), and temperature (°C).
[0027] refer to Figure 2 In actual operation, the data is filtered and processed to extract the data required for the data display function.
[0028] In this embodiment, two key fields, channel group and installation location, are extracted from the logical channel table, and grouped and statistically analyzed using the combination of these two fields.
[0029] Specifically, for each unique combination of "channel group and installation location", the number of records it contains (i.e., the number of channels under that combination), the first row number and the last row number of that combination in the logical channel table are counted. The processed data is then stored in a new data structure, which is the dynamic table mentioned above.
[0030] Secondly, during the screening process, SQL database programming is used to select two fields, channel group and installation location, from the logical channel table. The data is grouped according to the combination of channel group and installation location, and the number of records under each combination is counted. The first row number and the last row number of each combination in the logical channel table are obtained, and then sorted in ascending order by the number of records (rows). Finally, the processed data is stored in a dynamic table.
[0031] Taking a certain transmission test bench as an example, the dynamic table obtained after processing is as follows: Figure 3 As shown in the table, each row corresponds to a "channel group + installation location" combination, such as "Variable Frequency Speed Control - Drive Motor", "Variable Frequency Speed Control - Rectifier", "Lubrication Hydraulics - Overall Operation", etc., and records the number of channels, start number, and end number for each combination. Specifically, the number of records for "Variable Frequency Speed Control - Drive Motor" is 22, the first row number is 43, and the last row number is 64; the number of records for "Variable Frequency Speed Control - Rectifier" is 13, the first row number is 30, and the last row number is 42; and the number of records for "Lubrication Hydraulics - Overall Operation" is 7, the first row number is 65, and the last row number is 71.
[0032] refer to Figure 3 In actual operation, the acquisition of variable frequency speed control precedes the acquisition of lubrication hydraulic fluid. The order of "lubrication hydraulic fluid - overall operation" is after the order of "variable frequency speed control - drive motor" and "variable frequency speed control - rectifier". Since the last number of "variable frequency speed control - drive motor" (64) is greater than the last number of "variable frequency speed control - rectifier" (42), the order of "variable frequency speed control - rectifier" is before the order of "variable frequency speed control - drive motor".
[0033] Based on the data query, grouping, statistics and sorting functions of SQL database, the entire analysis of logical channel table can be completed in one go. Compared with the traditional manual coding and traversal method, it directly improves the processing efficiency. Moreover, the processing results are sorted in ascending order of record number, which improves the convenience for operators to browse the display panel later.
[0034] In addition, if a key field query is invalid, the transaction will terminate to release query resources.
[0035] S2. Obtain the channel group and installation location name combination of each record in the dynamic table as the panel title, create a display panel and generate corresponding sub-menu items in the interface menu. The sub-menu items are used to switch the display of the corresponding display panel. Insert the corresponding number of rows into the table of the display panel and supplement the logical channel name, unit and precision of each row based on the logical channel table. Based on the dynamic table construction completed in step S1, the process enters the batch generation stage of interface controls.
[0036] refer to Figure 4 First, obtain the channel group name and installation location name for each record in the dynamic table, and combine them as the panel title generated subsequently (e.g., "Variable Frequency Speed Control - Rectifier"). Then, process all records in the dynamic table in a loop: Compare the channel group of the current record with the channel group of the previous record. If they are different, get the new group name and insert a menu separator in the interface menu to distinguish between different channel groups. Specifically, creating a display panel involves: A panel is created using a preset table display template as the base panel. The display panel is created using a panel copy command. In practice, the display panel is copied from the preset table display template to inherit all controls, layouts, and style attributes, including table controls, from the template. The display panel title is set to the aforementioned combined name, and its position on the interface is set. A handle to the display panel is also returned, serving as its unique identifier for subsequent submenu callback functions, data update modules, and other program modules to reference and manipulate, facilitating subsequent operations and management of the panel.
[0037] In this embodiment, a preset table display template panel is used as the original panel. The design of the template panel is based on actual needs during actual use. It typically includes the table controls and other basic components required for the measurement and control system interface, as well as style attributes such as font, color, column width, and row height, which will not be described in detail here. By using a unified panel, problems such as inconsistent sizes, alignment deviations, and style differences that may occur due to manual creation are eliminated, thereby improving the overall aesthetics and professionalism of the interface.
[0038] Correspondingly, the sub-menu items generated in the interface menu are as follows: Sub-menu items are added using a new menu item function. The sub-menu item's name is the panel title, ensuring a one-to-one correspondence between the menu item and the template panel for easy user identification and selection. A callback function is configured for each sub-menu item so that when the user clicks the sub-menu item, the interface switches to the corresponding display panel while hiding other panels, thus achieving panel switching.
[0039] After completing the above processing, users can quickly switch between different channel groups and installation locations to view measurement point data via the menu.
[0040] Insert the corresponding number of rows into the table control of each display panel. The number of rows is determined by the number of channels recorded in the dynamic table. After inserting the rows, populate each row of the table with the logical channel name, unit, and numerical display precision information based on the data in the logical channel table.
[0041] S3. Traverse the table rows of each display panel, and according to the first row number, batch obtain several records of values from the logical channel data array of the measurement and control program and assign them to the table cells. At the same time, obtain the running status of each row channel, and dynamically set the display color of the cells according to the running status to form a dynamic data table.
[0042] It should be noted that the measurement and control program maintains a logical channel data array during runtime. This array is a global variable, stored consecutively by channel group. Each element corresponds to the current real-time value of a logical channel, and the data type is double. The array index corresponds one-to-one with the row number in the logical channel table.
[0043] Specifically, the process of batch retrieving values from the logical channel data array of the measurement and control program based on the first row number and assigning them to table cells involves: obtaining the address of the element in the logical channel data array whose index corresponds to the starting row of the channel group; this address is the memory starting position of the first channel data in that group within the array. This address is selected as the starting address, and the length of the batch assignment is determined based on the number of records, to batch assign values to the display array elements in the corresponding value display area of the table control. For example, batch assignment is performed on the display array elements within the rectangular area from the first row, second column to the first column of the display row in the table control.
[0044] Copy the consecutive data blocks starting from the first address in the logical channel data array to the corresponding area of the table display array all at once. For example... Figure 5 As shown, the column structure of the table display template is "Channel Name | Current Value | Unit". The "Current Value" column is the target area for receiving batch assignments, and the static information such as "Unit" has been filled in step S2. Since the display array of the table control is also stored continuously in memory, this batch memory copying is extremely efficient and does not require reading row by row.
[0045] Correspondingly, based on the comparison results between the numerical values and the threshold range, the operating status of each channel is specifically divided into three types: normal, alarm, and fault.
[0046] Iterate through each row in the current display panel table and obtain the corresponding logical channel value for that row; The operating status is identified by comparing this value with a preset threshold range.
[0047] The display color of table cells is dynamically set according to different operating states: When the channel is in normal operation, the cell displays the first color. For example, setting the first color to black text indicates that the device is operating smoothly and all parameters are within the normal range. When the channel is in alarm mode, the cell displays in the second color. For example, the second color is set to purple text, indicating that the parameter exceeds the warning threshold but has not yet reached a dangerous level, requiring operator attention. When a channel is in a faulty state, the cell is displayed in the third color. For example, the third color is set to red text, indicating that the parameter is seriously out of control or the equipment is malfunctioning, requiring immediate action.
[0048] By using different colors to distinguish between normal, alarm, and fault operating states, operators do not need to check the values one by one and compare them with the thresholds. They can quickly judge the operating status of each channel simply by looking at the colors, which improves emergency response efficiency.
[0049] The method proposed in this invention establishes an automatic mapping from logical channels to interface controls through automatic parsing and grouping of the logical channel table. This eliminates the need for manual input of channel tags, ensuring that interface controls remain synchronized with actual physical quantities. It avoids mismatches between controls and data sources caused by manual naming errors, significantly improving the system's data accuracy and reliability. Furthermore, by batch-creating display panels and table controls, it replaces the tedious process of manually creating controls one by one, greatly improving the efficiency of interface development and ensuring the consistency and accuracy of control layout, reducing the time and labor costs associated with repetitive work. Through dynamic table construction and real-time data update mechanisms, it ensures that the interface display remains synchronized with the actual physical quantities.
[0050] When the logical channel table changes, simply re-execute this method to automatically update the interface without manual adjustments. This achieves automated binding and dynamic status color display, ensuring the accuracy of real-time monitoring of key physical quantities and providing strong support for the safe operation of the transmission test bench.
[0051] In addition, refer to Figure 6 The system also discloses a method for automatically generating and binding interface controls to channels, which includes: The data filtering module is used to filter the logical channel table of the measurement and control system, extract the channel group and installation location, count the number of records and the first row number of each different combination of channel group and installation location, and store the filtered data into a dynamic table. The interface generation module is used to obtain the channel group and installation location name of each record in the dynamic table and combine them as the panel title, create the display panel and generate the corresponding sub-menu items in the interface menu. The sub-menu items are used to switch the display of the corresponding display panel, insert the corresponding number of rows in the table of the display panel, and supplement the logical channel name, unit and precision of each row based on the logical channel table. The real-time binding module is used to traverse the table rows of each display panel, retrieve several values from the logical channel data array of the measurement and control program in batches according to the first row number, and assign them to the table cells. At the same time, it retrieves the running status of each channel and dynamically sets the display color of the cells according to the running status to form a dynamic data table.
[0052] The invention also discloses a terminal comprising a memory, a processor, and a computer program stored in the memory, wherein the computer program, when executed by the processor, implements the steps of the method described above for automatically generating interface controls and binding them to channels.
[0053] A computer-readable storage medium is also disclosed, which stores a computer program that, when executed by a processor, implements the steps of the method described above for automatically generating interface controls and binding them to channels.
[0054] In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more features. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified. Furthermore, the terms "installed," "connected," and "linked" should be interpreted broadly; for example, they may refer to a fixed connection, a detachable connection, or an integral connection; they may refer to a mechanical connection, an electrical connection, or a connection that allows for communication; they may refer to a direct connection or an indirect connection through an intermediate medium. Those skilled in the art can understand the specific meaning of these terms in this invention according to the specific circumstances.
[0055] It should be understood that all terms used to indicate orientation or positional relationship are based on the orientation or positional relationship shown in the accompanying drawings and are only for the convenience of describing the present invention and simplifying the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and should not be construed as a limitation of the present invention.
[0056] Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for automatically generating and binding interface controls to channels, characterized in that, Includes the following steps: The logical channel table of the measurement and control system is filtered to extract the channel group and installation location. The number of records and the first row number of each different combination of channel group and installation location are counted. The filtered data is then stored in a dynamic table. Obtain the channel group and installation location name of each record in the dynamic table and combine them as the panel title. Create a display panel and generate corresponding sub-menu items in the interface menu. The sub-menu items are used to switch the display of the corresponding display panel. Insert the corresponding number of rows into the table of the display panel and supplement the logical channel name, unit and precision of each row based on the logical channel table. The table rows of each display panel are traversed, and several values are batch retrieved from the logical channel data array of the measurement and control program according to the first row number and assigned to the table cells. At the same time, the running status of each channel is obtained, and the display color of the cells is dynamically set according to the running status to form a dynamic data table.
2. The method for automatically generating and binding interface controls to channels according to claim 1, characterized in that, The filtering process is implemented using SQL database programming and the records are sorted in ascending order by the number of records.
3. The method for automatically generating and binding interface controls to channels according to claim 1, characterized in that, The creation of the display panel specifically involves: Using a preset table display template panel as the original panel, a display panel is created using the panel copy command, the position information of the display panel is set, and the handle of the display panel is returned.
4. The method for automatically generating and binding interface controls to channels according to claim 1, characterized in that, The specific steps for generating corresponding sub-menu items in the interface menu are as follows: Sub-menu items are added by creating a new menu item function. The name of the sub-menu item is the panel title, and a callback function is configured for the sub-menu item.
5. The method for automatically generating and binding interface controls to channels according to claim 4, characterized in that, When generating corresponding sub-menu items in the interface menu, the process also includes: Compare the channel group of the current record with the channel group of the previous record. If they are different, insert a menu separator before inserting the current submenu item to visually group the submenu items of different channel groups.
6. The method for automatically generating and binding interface controls to channels according to claim 3, characterized in that, The specific steps of batch retrieving values from the logical channel data array of the measurement and control program according to the record number and the first row number, and assigning them to the table cells, are as follows: Obtain the address of the element in the logical channel data array whose index is the starting row of the channel group and use it as the first address. Determine the length of the batch assignment based on the number of records, and perform batch assignment on the display array elements of the corresponding numerical display area in the table control.
7. The method for automatically generating and binding interface controls to channels according to claim 1, characterized in that, The operating status of each channel includes normal, alarm, and fault. When the channel is in normal status, it is displayed in the first color; when the channel is in alarm status, it is displayed in the second color; and when the channel is in fault status, it is displayed in the third color.
8. A system for automatically generating interface controls and binding them to channels, characterized in that, include: The data filtering module is used to filter the logical channel table of the measurement and control system, extract the channel group and installation location, count the number of records and the first row number of each different combination of channel group and installation location, and store the filtered data into a dynamic table. The interface generation module is used to obtain the channel group and installation location name of each record in the dynamic table and combine them as the panel title, create a display panel and generate corresponding sub-menu items in the interface menu. The sub-menu items are used to switch the display of the corresponding display panel, insert the corresponding number of rows into the table of the display panel, and supplement the logical channel name, unit and precision of each row based on the logical channel table. The real-time binding module is used to traverse the table rows of each display panel, retrieve several values from the logical channel data array of the measurement and control program in batches according to the first row number, and assign them to the table cells. At the same time, it retrieves the running status of each channel and dynamically sets the display color of the cells according to the running status to form a dynamic data table.
9. A terminal, characterized in that, The terminal includes a memory, a processor, and a computer program stored in the memory, wherein the computer program, when executed by the processor, implements the functionality described in claim 1. Each step of the method for automatically generating interface controls and binding them to channels as described in any one of the 7 claims.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements as claimed in claim 1. Each step of the method for automatically generating interface controls and binding them to channels as described in any one of the 7 claims.
