A method for rapid response of main station real-time images based on MVC architecture
By adopting window view object caching strategy and double caching technology in the MVC architecture, the problem of insufficient real-time picture response performance of the main site is solved, fast response and efficient display are achieved, and user experience is improved.
Patent Information
- Application Number
- CN202210759431.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2042-06-30
AI Technical Summary
The prior art has shortcomings in the real-time picture response performance of the main site, especially in situations where there is high seriousness, high reliability and high security, real-time response requirements are high and the remote control operation behavior of pop-up screens is more common.
The window view object caching strategy based on the MVC architecture is adopted, and the survival count and cache management of window view objects are realized through the combination of a hash list and a list table. The cache strategy of screen file objects is optimized by combining double caching technology.
It significantly improves the response speed of the main site's real-time picture and can display a picture in tens of milliseconds, far exceeding the response speed of traditional real-time dynamic opening and deletion of files and window objects, improving the user experience.
Smart Images

Figure CN115185892B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a master station real-time picture rapid response method based on MVC architecture, belonging to the technical field of picture monitoring. Background Art
[0002] In industries such as automation, there are many master station software, such as distributed control systems, data acquisition and monitoring control, distribution network automation systems and rail transit integrated monitoring systems. These systems are different from general webscada systems and generally require very high real-time performance, fast screen refresh and quick response performance.
[0003] Model-View-Controller (MVC) is a software design pattern invented by Xerox PARC in the 1980s for the programming language Smalltalk-80. MVC stands for Model-View-Controller. MVC first existed in desktop programs. The purpose of using MVC is to separate the implementation code of M and V so that the same program can use different presentation forms. This pattern is used for layered development of applications and has been widely used in various software and various occasions.
[0004] A search of the domestic patent database found that although some inventions or articles have explored and studied the MVC architecture and practice, they mainly focus on the practical use of MVC. There are few related documents on the distributed control system (DCS), supervisory control and data acquisition (SCADA), distribution network automation system and rail transit integrated monitoring system designed based on the MVC architecture, which have configuration screens, scenes and software systems for real-time monitoring screens.
[0005] After searching the relevant patent database, we found that there are not many patents on the professional design and development of real-time screens of the master station. There are probably many reasons. Many application scenarios are non-grid or non-telecom scenarios with high seriousness, high reliability and high security, and many scenarios are web page displays. Generally speaking, these screens have low real-time response requirements, and there are few behaviors such as pop-up screen remote control operations. For the power system master station, these weaknesses need to be overcome. Summary of the invention
[0006] The technical problem to be solved by the present invention is to overcome the defects of the prior art and provide a method for rapid response of real-time images of a master station based on an MVC architecture.
[0007] To achieve the above object, the present invention provides a method for rapid response of real-time images of a main station based on an MVC architecture, including a window view object caching strategy process;
[0008] The window view object cache strategy process is implemented using the following steps:
[0009] The window view objects are maintained by using the window view object hash list and list table. The list table adopts the nearest placement strategy.
[0010] Determine whether the number of members in the list table is greater than the set value. If the number of members in the list table is not greater than the set value, the operation ends;
[0011] If the number of list table members is greater than the set value, the list table queue is looped to check whether each window view object in the list table is unlocked or hidden:
[0012] If each window view object is not unlocked or hidden, then the survival count of the window view object is performed, and the window view object is written into the window object survival list to determine whether the survival count of the window view object exceeds the count setting value;
[0013] If a window view object is unlocked or hidden, the window view object and the screen file object are decoupled, the window view object is removed from the window view object hash list and list table, the window view object enters the death state queue from the working state and is set as the window view death object, the screen file object remains in the screen file object working state linked list, and it is determined again whether the number of list table members is less than the cache setting value.
[0014] Preferably, the window view object caching strategy process further includes the following steps:
[0015] If the number of list table members is less than the cache setting value, the operation ends;
[0016] If the survival count of the window view object exceeds the count setting value, the survival count of the current window view object will be displayed and a warning will be given. The window view object needs to be unlocked and the screen view window currently being displayed needs to be closed. If the screen view window currently being displayed is not closed, no new window view object will be created.
[0017] If the survival count of the window view object does not exceed the count setting value, the operation ends.
[0018] Preferably, the window view object caching strategy process further includes the following steps:
[0019] Regularly clean up the dead window view objects in the global dead window view object list and remove the dead window view objects from the global dead window view object list, and clear the memory resources allocated to the dead window view objects;
[0020] If the screen file object corresponding to the window view death object is a non-cached file object, the memory resources allocated to the screen file object are cleared at the same time;
[0021] If the screen file object corresponding to the window view dead object is a dead file object, then if no other window view object is bound to the screen file object corresponding to the window view dead object, the memory resources allocated to the screen file object are cleared;
[0022] If the screen file object corresponding to the window view death object is a cache file object, the screen file object cache strategy process is entered, and the detection is cyclically performed from the head of the screen file object queue;
[0023] Circularly check whether the window view object associated with the screen file object in the global dead state screen file object list still has a coupling relationship. If there is a coupling relationship, the memory resources allocated to the screen file object will not be released temporarily; if there is no coupling relationship, the memory resources allocated to the screen object will be released.
[0024] Preferably, the picture file object cache strategy process is implemented using the following steps:
[0025] Create a new window view object and obtain the screen file object corresponding to the window view object;
[0026] Determine whether the screen file object is a cache file object or a non-cache file object. If the screen file object is a cache file object, trigger the opening of the screen file object cache.
[0027] Determine whether the number of screen file objects in the current global working state screen file object linked list exceeds the set limit. If the number of screen file objects in the current global working state screen file object linked list does not exceed the set limit, then end the operation; if the number of screen file objects in the current global working state screen file object linked list exceeds the set limit, then cyclically check the current global working state screen file object linked list according to the first-in-first-out strategy;
[0028] Determine whether the screen file object in the current global working state screen file object linked list is associated with the window view object currently in use. If so, loop to determine whether all screen file objects in the current global working state screen file object linked list are associated with the window view object currently in use until all screen file objects in the current global working state screen file object linked list have completed the determination;
[0029] During the loop judgment process, if the screen file object in the current global working state screen file object linked list is not associated with the window view object currently in use, it is determined whether the window view object corresponding to the screen file object is in the window view object global linked list or the window view object death linked list.
[0030] Preferably, the picture file object cache strategy process further includes the following steps:
[0031] If the window view object corresponding to or associated with the screen file object is in the global working state window object linked list or the global dead state window view object linked list, the screen file object cannot be deleted, and a loop is performed to determine whether the screen file object in the current global working state screen file object linked list is associated with an existing window view object until all screen file objects in the current global working state screen file object linked list have completed the determination;
[0032] If the window view object corresponding to the screen file object is not in the window view object global linked list or the window view object death linked list, the screen file object is deleted, the memory resources allocated to the screen file object are released, and it is determined whether the number of screen file objects in the current global working state screen file object linked list exceeds the set limit.
[0033] Preferably, it includes the window view object loading process;
[0034] The window view object loading process is implemented using the following steps:
[0035] When creating or loading a screen view window, determine whether the number of locked or displayed window view objects in the window view object cache list exceeds the limit. If it exceeds the limit, an alarm is issued and a prompt is given to close some locked or displayed screen view windows;
[0036] Remove the first hidden window view object from the global working state window view object list, and add the first hidden window view object to the global dead state window view object list;
[0037] If a new window view object needs to be popped up and the number of locked or displayed window view objects in the window view object cache list exceeds the limit, some locked or displayed window view objects must be unlocked and closed first.
[0038] Preferably, the window view object loading process further includes the following steps:
[0039] Determine whether the window view object exists in the window view object Hash list. If the window view object does not exist in the window view object Hash list, it is determined that it is enabled for the first time, and a new window view object is created and initialized. The new window view object is inserted into the window view object Hash list and added to the end of the list at the same time. Enter the screen file object model creation process, execute the screen file object cache strategy process, implement binding coupling mapping between the screen file object and the window view object, and set the window interface corresponding to the window view object to the top level display;
[0040] If the window view object exists in its window view object hash list, determine whether the screen file is modified;
[0041] The window view object loading process also includes the following steps:
[0042] If the screen file has been modified, the window view object is removed from the window view object hash list and list table, the window view object and the screen file object are decoupled, the window view object enters the global dead state window view object list from the global working state window view object linked list, the screen file object enters the global dead state screen file object list from the global working state screen file object linked list, the screen file object is set to the non-cached working mode, a new window view object is created and initialized again, the new window view object is inserted into the window view object hash list, and added to the end of the list table at the same time, the screen file object model creation process is entered, and the screen file object cache strategy process is executed. The screen file object and the window view object implement binding coupling mapping, and the screen file object and the screen view window corresponding to its window view object are set to the top display;
[0043] If the screen file has not been modified, it is determined that the window view object already exists at this time, the window view object Hash list remains unchanged, the window view object is removed from the original position of the window view object in the list table, and the window view object is added to the end of the list table queue again;
[0044] The screen view window is placed on top and is set to display state, and the screen view window is locked or unlocked; when the screen view window is switched, all pop-up unlocked screen view windows are hidden, and the locked screen view window continues to be displayed;
[0045] When the screen view window is closed, the window view object cache strategy process is triggered.
[0046] Preferably, the picture file object model creation process is implemented using the following steps:
[0047] When a picture view window is opened, the picture file corresponding to the picture view window is read; a new picture file object corresponding to the picture view window is created;
[0048] The process of creating a screen file object corresponding to a new screen view window includes the process of reading the screen file, creating various graphic primitive objects, creating various device model sets corresponding to these graphic primitive objects, and binding the association relationship between various graphic primitive objects and various device model sets;
[0049] Assign the screen file object a unique file identifier objectid; based on the file unique identifier objectid, query whether the screen file object exists in the screen file object hash list. If it does not exist, create a new screen file object model and initialize it, and put the screen file object into the global working state screen file object linked list, and set the template file or non-template file to the cache working mode;
[0050] If the screen file object exists, check whether the screen file timestamp corresponding to the screen file object is the latest, and determine whether the screen file corresponding to the screen file object has been modified;
[0051] The process of creating the screen file object model also includes the following steps:
[0052] If the screen file timestamp corresponding to the screen file object has been modified, the screen file object is removed from the global working state screen file object list, and the screen file object is moved to the global dead state screen file object list, the screen file object is set to non-cached working mode, a new screen file object model is created and initialized, the screen file object is placed in the global working state screen file object list, and the template file or non-template file is set to cache working mode;
[0053] If the screen file timestamp corresponding to the screen file object is the latest, determine whether the screen file object is a template screen; if the screen file object is a non-template screen, determine that the screen file object already exists, and multiple window view objects share the screen file object;
[0054] If the screen file object is a template screen, it is determined that the screen file object already exists, and the screen file object is deeply copied. The window view object exclusively uses the resources of the screen file object, and the copied screen file object is set to a non-cached working mode.
[0055] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned method when executing the program.
[0056] A computer-readable storage medium stores a computer program, which implements the steps of the above method when executed by a processor.
[0057] The beneficial effects achieved by the present invention are:
[0058] The MVC architecture in the present invention adopts a real-time screen display software tool architecture designed with independent cache and secondary cache. The screen configuration software and the model configuration tool are used in combination, and the screen content is finally stored in the form of a file after drawing. These screen files are loaded for real-time display, and the screen files form screen file objects. The screen file objects contain models of various types of graphic element information. The various screen view windows displayed, including the pop-up screen interface, are all visualization interfaces of the model data. The controller acts on the screen file object and the window view object. The controller adopts a special control strategy of the file model and the window view object secondary double cache technology to greatly improve the response speed of the real-time screen operation;
[0059] The method of the present invention can display a picture with a response speed of tens of milliseconds, which is much faster than the picture display response speed of real-time dynamic opening and deletion of files and window objects. As a real-time picture display software tool for the master station system of distributed control systems and SCADA systems, it has broad application prospects.
[0060] The main station real-time display screen software tool solution draws on and adopts the model-view-controller framework principle to achieve the separation of data business model and view, with clear architecture and easy maintenance and expansion of program code. A screen file object model corresponds to a display window, or it can correspond to multiple window views, so one screen can be displayed on multiple views and multiple screens. The controller adopts a dual control and management strategy model. The screen file object and window view object use a combination of hash and list to achieve fast hit window object access and first-in-first-out. The latest window view object is moved to the end of the team, and invalid window objects are first removed and released from the head of the team. The design concept of the most recent window is retained to improve the effectiveness and speed of the window object. The file object and the window view object use cache technology independently, and after combination, they form a two-level double cache structure. The number of cache objects is designed to be more reasonable. By exchanging computer memory space for response time, computer memory is opened up and consumed to a certain extent, which greatly improves the rapid response of real-time screens and improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 It is a schematic diagram of the MVC design concept;
[0062] Figure 2 It is a flowchart of the process of configuring the screen file;
[0063] Figure 3 It is a flow chart of the process of creating the picture file object model in the present invention;
[0064] Figure 4 is a flow chart of the window view object loading process in the present invention;
[0065] Figure 5is a flow chart of the window view object caching strategy process in the present invention;
[0066] Figure 6 It is a flow chart of setting the timer working mode of the window view object cache strategy process in the present invention;
[0067] Figure 7 It is a flow chart of the picture file object caching strategy process in the present invention. DETAILED DESCRIPTION
[0068] The following embodiments are only used to more clearly illustrate the technical solutions of the present invention, and are not intended to limit the protection scope of the present invention.
[0069] In the present invention, the main station real-time display screen software solution adopts the model-view-controller framework principle. In the design and programming implementation, Figure 1 As shown, it has the following design points and technical features:
[0070] Model: Screen file object model, such as Figure 3 As shown, these screen files are generated by screen configuration software tools (similar to AutoCAD drawing) (used in combination with model configuration tools). These screen files contain various types of graphic element information files, and the screen files are saved in a certain format. When the real-time screen display software tool is running, these screen files will be loaded to form a graphic element combination set of various basic graphic elements and custom combination graphic elements in the computer memory. This model business is based on all graphic element combination sets contained in each screen, rather than on a single graphic element item information. The screen file object model creation process (B) is the process of creating a model.
[0071] View: Display window, that is, window view object. Window view object is the attribute set of memory pointer in the computer. Window is the display window interface seen from the user or interface. There is a one-to-one correspondence between the two. Each time the window is switched or popped up, it appears as a whole page screen, and the graphic element item collection business contained in the display screen can be one screen file object model corresponding to one window view object, or it can correspond to multiple window view objects. The window view object loading process (C) is the process of creating a view.
[0072] Controller: acts on the model (file object) and also acts on the view (picture window). The present invention adopts a control and management strategy, which manages the picture file object and the window view object at the same time. A separate cache technology and a secondary cache are adopted. Space is exchanged for time, that is, computer memory is opened up and consumed to a certain extent to improve the rapid response of real-time pictures, which greatly improves the user experience. The window view resident in the memory displays a picture and can achieve a response speed of tens of milliseconds. The window view object cache strategy process (D) and the file object cache strategy process (E) are the connotations of the controller.
[0073] In this way, from the perspective of the entire real-time display screen tool software, this is a framework MVC design and programming idea.
[0074] Configuration screen process and results:
[0075] like Figure 2 The configuration screen file process shown in the figure, when the operator uses the main station screen configuration software tool, the screen can contain various basic graphics and custom combination graphics. All graphics in this page constitute the information set of the page. All graphics are stored in a file of a certain format to obtain the graphics information file. This graphics information file determines whether the window is displayed in a template or non-template form.
[0076] Screen file object model creation process (B)
[0077] like Figure 3 As shown in the figure, when the real-time screen display software tool is running, when a screen view window is opened, or a screen view window pops up when a certain graphic element is clicked, the screen file corresponding to the screen view window is first opened, the screen file content is read, and then space is allocated in the computer memory to create the screen file object. The process of creating this screen file object is not only the process of reading the screen file content and creating various graphic element objects, but also includes the process of creating a collection of various device models corresponding to these graphic elements, and binding the association relationship between various graphic elements and various device model collections.
[0078] In the present invention, creating a picture file object includes this series of complete processes. This picture file object is used to store the information set of each graphic element item. And the picture file object is queried or accessed from the picture file hash list with the file unique identifier objectid. In subsequent access behaviors, the picture element is not used as the access unit, but the picture file object is used as the access unit.
[0079] The screen file object is the object of the computer memory, the screen real-time display software running, and is essentially in the computer memory, and it disappears when the power is off. The screen file is a file or document used to store the model of the graphic element collection, which is stored in the computer hard disk and does not disappear when the power is off. The two are one-to-one corresponding, but they are not the same meaning. The screen file is searched by the file name or objectid, and the screen file object is searched by the computer memory address pointer. The two are combined into a hash list using the screen file hash list, for example, QHash<screen file objectid, screen file object pointer> m_graphhash;
[0080] Determine whether the screen file type is a non-template (single screen, multi-screen, pop-up non-template) screen or a template (custom combination graphic element, pop-up template) screen.
[0081] According to the file unique identifier objectid, the screen file hash list is retrieved to see if the screen file object exists. If the screen file object does not exist, a new screen file object model is created and initialized when it is loaded for the first time, and the screen file object is placed in the global working state screen file object linked list, and the template file or non-template file is set to cache working mode. If the screen file object exists, check whether the corresponding screen file timestamp of the screen file object is the latest, and determine whether the corresponding screen file of the screen file object has been modified.
[0082] If the screen file timestamp corresponding to the screen file object has been modified, it means that the screen file object corresponding to the screen file timestamp is no longer the latest. In this case, the screen file object will be removed from the global working state screen file object linked list, and the screen file object will be written into the global dead state screen file object list. The screen file object will be set to non-cached working mode, and a new screen file object model will be created and initialized again. The screen file object will be placed in the global working state screen file object linked list. Template files or non-template files will be set to cache working mode, that is, the screen file will be reloaded and the screen object process will be established.
[0083] If the screen file timestamp corresponding to the screen file object is the latest, then determine whether the screen file object is a template screen. If the screen file object is a non-template screen, then determine that the screen file object already exists, do not create a new screen file object, and multiple window view objects share the screen file object. If the screen file object is a template screen, then determine that the screen file object already exists, deeply copy the screen file object, the window view object exclusively uses the resources of the screen file object, and set the copied screen file object to non-cached working mode.
[0084] Note that when a template screen creates a new screen file object for the first time, it is set to cache working mode, while the subsequent deep copy of the template file object is set to non-cache working mode. In this way, there is only one screen file object for all templates or non-template screens.
[0085] The screen file object model creation process of the method of the present invention realizes that both non-template files and template file objects are uniquely stored in the global working state screen file object linked list, greatly increasing the actual number of valid objects in the working state file object buffer area.
[0086] Window view object loading process (C)
[0087] The screen file object has its own screen file Hash list, which stores contents such as: QHash<screen file objectid, screen file object pointer> m_graphhash;
[0088] The window view object also has its own window view object hash list, QHash<operation point objectid, window view object pointer> m_windowshash. Every time you click on the interface operation point primitive and the screen pops up, you will get the operation point primitive model objectid. From its model attributes, you will also get the screen file objectid. In this way, the window view object and the screen file object are associated. When different operation point objectids correspond to the same screen file objectid, this is the screen template file.
[0089] The window view object adopts a dual-table maintenance method: one is the window view object Hash list. According to the operation point objectid, the corresponding window view object can be immediately queried from the window view object Hash list (the screen file objectid is obtained from the operation point objectid attribute). The other is a list table, which records the window view object address pointer and adopts the first-in-first-out and the most recent placement strategy. If the window view object address pointer already exists in the list table, when the window view object address pointer is used, it is removed from the original position of the window view object address pointer in the list table and added to the end of the list table, which is the most recent placement strategy. The window view object Hash list and list table are maintained and updated synchronously.
[0090] When clicking the interface operation point element to create / load the screen view window, determine whether the number of locked or displayed window view objects in the window view object cache list exceeds the limit. If it exceeds the limit, an alarm will be issued and a prompt will be given to close some locked or displayed screen view windows.
[0091] Hidden and unlocked window views can be deleted, but locked or displayed interfaces cannot be deleted;
[0092] Remove the first hidden or unlocked window view object from the global working state window view object list, and add the first hidden or unlocked window view object to the global dead state window view object list;
[0093] There are three forms of window view objects: locked and displayed, unlocked and hidden, and unlocked and displayed. The window view object cache list records three types of window view objects: locked and displayed, unlocked and hidden, and currently displayed. Locked and displayed window view objects and currently displayed window view objects cannot be removed from the global working state window view object list. The first hidden or unlocked window view object will be removed from the global working state window view object list and enter the global dead state window view object list.
[0094] If a new window view object is to be popped up and the number of locked or displayed window view objects in the window view object cache list exceeds the limit, some of the displayed or locked window view objects must be unlocked and closed first.
[0095] Determine whether the window view object exists in the window view object Hash list:
[0096] If the window view object does not exist in the window view object Hash list, it is determined that this is the first time to enable the window view object. A new window view object is created and initialized, and the new window view object is inserted into the window view object Hash list and added to the end of the list. Enter the screen file object model creation process (B) and execute: file object cache strategy process (E). The screen file object and the window view object implement binding coupling mapping. The window interface corresponding to the window view object is set to the top display, and the title bar can be locked or unlocked.
[0097] If the window view object exists in its window view object hash list, determine whether the screen file has been modified:
[0098] If the screen file has been modified, the window view object is removed from both the window view object hash list and the list table, the window view object and the screen file object are decoupled, the window view object enters the global dead state window view object list from the global working state window view object linked list, the screen file object enters the global dead state screen file object list from the global working state screen file object linked list, the screen file object is set to the non-cached working mode, it is determined that the original window view object is invalid, the window view object is created and initialized again, the newly created window view object is inserted into the window view object hash list, and added to the end of the list table at the same time. Enter the screen file object model creation process (B), and execute the screen file object cache strategy process (E), the screen file object and the window view object implement binding coupling mapping, set to the top display, and the title bar can be locked or unlocked.
[0099] If the screen file is not modified, it is determined that the window view object already exists at this time, the window view object Hash list remains unchanged, the window view object is removed from its original position in the list table, and the window view object is added to the end of the list table queue again.
[0100] The screen view window is placed on top and is set to display state. The screen view window can be locked or unlocked. When switching the screen view window, all pop-up unlocked screen view windows are hidden, and the locked screen view window continues to be displayed.
[0101] Note that closing the screen view window does not actually close the screen view window and delete the corresponding window view object. In fact, it hides the window view object. The position of the window view object in the window view object hash list and list table does not change.
[0102] With the method of the present invention, if the operation is opened again, the window view object is immediately set to the display state, and the response is very fast and consumes very little time. The existing screen can be displayed again in tens of millimeters, and the customer experience is good. If the screen view window is closed, the actual behavior corresponds to deleting the window view object and the screen file object. When the screen view window is opened, the screen file content is read repeatedly, the screen file model process is established, and the two objects are created again, which is time-consuming, the screen response effect will be much worse, and the user experience is very poor.
[0103] When the screen view window is closed, the execution is triggered: the window view object cache strategy process (D). With the method of the present invention, the window display response is fast, and the window view object cache can be cleared in time.
[0104] Window view object cache strategy process (D)
[0105] like Figure 5As shown, the window view object is maintained by using a double table of window view object Hash list and list table, and the list table adopts the nearest placement at the end of the queue strategy.
[0106] Determine whether the number of list table members is greater than the set value. If the number of list table members is not greater than the set value, the operation ends.
[0107] If the number of list table members is greater than the set value, the list table queue is looped to check whether each window view object in the list table is unlocked or hidden:
[0108] If each window view object is not unlocked or hidden, it means that the window view object is in a locked or displayed state, then the window view objects are counted and written into the window object survival list to determine whether the survival count of the window view object exceeds the count setting value.
[0109] If a window view object is unlocked or hidden, the window view object and the screen file object are decoupled and removed from the window view object hash list and list table. The window view object enters the death state queue from the working state and is set as the window view death object. The screen file object remains in the screen file object working state linked list. It is determined whether the number of list table members is less than the cache setting value. If the number of list table members is less than the cache setting value, the cache strategy process is exited and the operation ends.
[0110] If the survival count of the window view object exceeds the count setting value, the survival count of the current window view object will be displayed and a warning will be issued. At this time, the window view object needs to be unlocked and the screen view window that is being displayed needs to be closed. If the screen view window that is being displayed is not closed, no new window view object will be created. If the survival count of the window view object does not exceed the count setting value, the cache strategy process will be exited and the operation will end.
[0111] In addition, the timer working mode is set:
[0112] Regularly clean up the dead window view objects in the global dead window view object list and remove them from the global dead window view object list, clearing the memory resources allocated to the dead window view object in the computer. If the screen file object corresponding to the dead window view object is detected as a non-cached file object, the memory resources allocated to the screen file object in the computer are cleared at the same time; if the screen file object corresponding to the dead window view object is detected as a dead file object, the memory resources allocated to the screen file object in the computer are cleared if no other window view object is bound to the screen file object corresponding to the dead window view object. Otherwise, enter the screen file object cache strategy process (E), and cyclically detect from the head of the screen file object queue.
[0113] The timer periodically loops to detect whether the window view object associated with the screen file object in the global dead state screen file object list still has a coupling relationship. If there is still a coupling relationship, it means that there is still a window view object bound, and the memory resources of the screen file object will not be released temporarily. If there is no coupling relationship, the memory resources allocated to the screen object in the computer will be released.
[0114] Image file object cache strategy process (E)
[0115] Window view objects are divided into three categories: 1. Window objects currently in use; 2. Global working state window view objects (valid and currently in use); 3. Global dead state window object linked list (invalid, dead, waiting for deletion).
[0116] When the window view object associated with the screen file object is in one of the three states, the screen file object cannot be deleted. When the screen file object is not associated with these three states, it is in an orphan state and the screen file object can be deleted.
[0117] Whenever a new window view object is created, the screen file object acquisition process is started at the same time to confirm whether the screen file object is a cache file object or a non-cached file object. If the screen file object is a cache file object, it triggers the opening of the screen file object cache.
[0118] Determine whether the number of screen file objects in the current global working state screen file object list exceeds the set limit. If not, exit and end the operation; if yes, check the current global working state screen file object list in a first-in-first-out loop from the queue.
[0119] Determine whether the screen file object in the current global working state screen file object list is associated with the window view object currently in use.
[0120] If yes, then loop to determine whether the screen file object in the current global working state screen file object linked list is associated with the window view object currently in use, until all the screen file objects in the current global working state screen file object linked list have completed the determination;
[0121] During the loop judgment process, if the screen file object in the current global working state screen file object linked list is not associated with the window view object currently in use, it is determined whether the window view object corresponding to the screen file object is in the window view object global linked list or the window view object death linked list.
[0122] If the window view object corresponding to or associated with the screen file object is in the global working state window object linked list or the global dead state window view object linked list, it means that the coupling relationship between the screen file object and the window view object has not been released, and the screen file object cannot be deleted. The process continues to determine whether the screen file object in the current global working state screen file object linked list is associated with an existing window view object until all screen file objects in the current global working state screen file object linked list have completed the determination.
[0123] If the window view object corresponding to the screen file object is not in the window view object global linked list or the window view object death linked list, the screen file object is determined to be an orphan screen file object, the screen file object is deleted and the memory resources allocated to the screen file object in the computer are released, and the program exits, and a determination is made as to whether the number of screen file objects in the current global working state screen file object list exceeds the set limit.
[0124] Circularly check whether the window view object associated with the screen file object in the global dead state screen file object list still has a coupling relationship. If there is still a coupling relationship, it means that there is still a window view object bound, and the memory resources of the screen file object will not be released temporarily. If there is no coupling relationship, the memory resources allocated to the screen object in the computer will be released.
[0125] The key points and points to be protected of the present invention mainly include the following aspects:
[0126] (1) The main station real-time display screen software tool solution draws on and adopts the model-view-controller framework principle to achieve the separation of data model (i.e. file object) and view (i.e. window object), independent control strategy, clear architecture, and easy maintenance and expansion of program code.
[0127] (2) Each time a window is switched or popped up, the screen is used as a basic unit to display the set of graphic elements contained in the screen. The access, indexing or operation of the screen file object is not based on some of the graphic elements in the screen file object, but on the entire set of objects in the file. A screen file object model can correspond to one window view or multiple window views, a single model multiple view mechanism, so one screen has multiple views and can be displayed on multiple computer screens.
[0128] (3) The controller adopts a dual-state and dual-table control and management strategy model, with dual-states mutually exclusive and dual-table synchronization. The screen file object and window view object each have two state maintenance lists, working state and dead state, and the two states are mutually exclusive. Both use a combination of hash and linked list, and the dual tables are synchronized to achieve fast access to objects while achieving first-in-first-out. The latest object is moved to the end of the queue, and invalid objects are removed and released from the head of the queue first, achieving the design concept of retaining the most recent object, improving the rapidity of object access and the novelty of recent use.
[0129] (4) The screen file object and the window view object use cache technology independently, and after being combined, they form a two-level double cache structure. The two designs have a reasonable number of cache objects, which greatly reduces the number of times the screen file content is read to create a new file object (especially the uniqueness of the screen template file object is adopted), and greatly reduces the number of times new window view objects are created. In this way, the computer memory space is exchanged for the screen response time, which opens up and consumes the computer memory to a certain extent, but greatly improves the rapid response of the real-time screen and improves the user experience.
[0130] (5) In the traditional sense, the behavior of popping up or opening a window is the process of creating a new window object and file object resource. The behavior of closing a window is the process of closing the window and then releasing the window object and file object resource;
[0131] In the present invention, closing a window only hides the window, and does not close or release the window object and file object. When opening a window, first access is made from the window object list, and if it exists, the window is directly displayed. If it does not exist, a new window object is created, and then the file object is obtained from the file object hash table. If it exists, the file object is directly obtained, otherwise a new one is created. If neither of them exists, the process of creating a new window object and file object is actually started. Because these two objects implement a secondary double cache, and implement first-in-first-out, invalid first-out, and adopt the strategy of placing the last one at the end of the queue, in most operation behavior scenarios, it is just pure display and hiding of the window.
[0132] (6) The screen distinguishes between non-template and template screens. Non-template screen files use a cached working mode, and their file objects can be shared in a one-to-many corresponding view window object. When the screen template file is read and generated for the first time, it uses a cached working mode. Then, when the template screen generates a new window again, it does not need to read the template screen file content again, but uses a direct deep copy of the existing screen template file object technology. In this way, each subsequent pop-up template screen has its own copy of the file object, but the new file object uses a non-cached working mode to achieve the uniqueness of the screen template file object, greatly increasing the number of actual valid objects in the file object cache.
[0133] In this way, the same template screen file model is uniquely stored in the global screen file object cache, but due to frequent pop-up screen operations, multiple windows can be generated and stored in the global window view object cache, reducing the process of reading the template file content and thus the process of establishing the template file model. Objects in the death list or non-cached state mark objects can also quickly release resources.
[0134] In summary, the present invention uses a series of methods to display a picture, which can achieve a response speed of tens of milliseconds, far exceeding the picture display response speed of real-time dynamic opening and deletion of files and window objects. As a real-time picture display software tool for distributed control systems, scada systems and other system master systems, it has broad application prospects.
[0135] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned method when executing the program.
[0136] A computer-readable storage medium stores a computer program, which implements the steps of the above method when executed by a processor.
[0137] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0138] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0139] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0140] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for rapid response of real-time images of a main station based on MVC architecture, characterized in that: Includes window view object cache strategy process; The window view object cache strategy process is implemented using the following steps: The window view objects are maintained by the window view object hash list and list table. The list table adopts the nearest placement strategy. Determine whether the number of members in the list table is greater than the set value. If the number of members in the list table is not greater than the set value, the operation ends; If the number of list table members is greater than the set value, the list table queue is looped to check whether each window view object in the list table is unlocked or hidden: If each window view object is not unlocked or hidden, then the survival count of the window view object is performed, and the window view object is written into the window object survival list to determine whether the survival count of the window view object exceeds the count setting value; If a window view object is unlocked or hidden, the window view object and the screen file object are decoupled, the window view object is removed from the window view object hash list and list table, the window view object enters the dead state queue from the working state and is set as the window view dead object, the screen file object is still retained in the screen file object working state linked list, and it is determined again whether the number of list table members is less than the cache setting value; The picture file object cache strategy process is implemented using the following steps: Create a new window view object and obtain the screen file object corresponding to the window view object; Determine whether the screen file object is a cache file object or a non-cache file object. If the screen file object is a cache file object, trigger the opening of the screen file object cache. Determine whether the number of screen file objects in the current global working state screen file object linked list exceeds the set limit. If the number of screen file objects in the current global working state screen file object linked list does not exceed the set limit, then end the operation; if the number of screen file objects in the current global working state screen file object linked list exceeds the set limit, then cyclically check the current global working state screen file object linked list according to the first-in-first-out strategy; Determine whether the screen file object in the current global working state screen file object linked list is associated with the window view object currently in use. If so, loop to determine whether all screen file objects in the current global working state screen file object linked list are associated with the window view object currently in use until all screen file objects in the current global working state screen file object linked list have completed the determination; During the loop judgment process, if the screen file object in the current global working state screen file object linked list is not associated with the window view object currently in use, it is judged whether the window view object corresponding to the screen file object is in the window view object global linked list or the window view object death linked list; The method also includes a window view object loading process; The window view object loading process is implemented using the following steps: When creating or loading a screen view window, determine whether the number of locked or displayed window view objects in the window view object cache list exceeds the limit. If it exceeds the limit, an alarm is issued and a prompt is given to close some locked or displayed screen view windows; Remove the first hidden window view object from the global working state window view object list, and add the first hidden window view object to the global dead state window view object list; If a new window view object needs to be popped up and the number of locked or displayed window view objects in the window view object cache list exceeds the limit, some locked or displayed window view objects must be unlocked and closed first.
2. According to the method of claim 1, the method is characterized in that: The window view object cache strategy process also includes the following steps: If the number of list table members is less than the cache setting value, the operation ends; If the survival count of the window view object exceeds the count setting value, the survival count of the current window view object will be displayed and a warning will be given. The window view object needs to be unlocked and the screen view window currently being displayed needs to be closed. If the screen view window currently being displayed is not closed, no new window view object will be created. If the survival count of the window view object does not exceed the count setting value, the operation ends.
3. According to the method of claim 1, the method is characterized in that: The window view object cache strategy process also includes the following steps: Regularly clean up the dead window view objects in the global dead window view object list and remove the dead window view objects from the global dead window view object list, and clear the memory resources allocated to the dead window view objects; If the screen file object corresponding to the window view death object is a non-cached file object, the memory resources allocated to the screen file object are cleared at the same time; If the screen file object corresponding to the window view dead object is a dead file object, then if no other window view object is bound to the screen file object corresponding to the window view dead object, the memory resources allocated to the screen file object are cleared; If the screen file object corresponding to the window view death object is a cache file object, the screen file object cache strategy process is entered, and the detection is cyclically performed from the head of the screen file object queue; Circularly check whether the window view object associated with the screen file object in the global dead state screen file object list still has a coupling relationship. If there is a coupling relationship, the memory resources allocated to the screen file object will not be released temporarily; if there is no coupling relationship, the memory resources allocated to the screen file object will be released.
4. According to the method of claim 1, the method is characterized in that: The picture file object cache strategy process also includes the following steps: If the window view object corresponding to or associated with the screen file object is in the global working state window object linked list or the global dead state window view object linked list, the screen file object cannot be deleted, and a loop is performed to determine whether the screen file object in the current global working state screen file object linked list is associated with an existing window view object until all screen file objects in the current global working state screen file object linked list have completed the determination; If the window view object corresponding to the screen file object is not in the window view object global linked list or the window view object death linked list, the screen file object is deleted, the memory resources allocated to the screen file object are released, and it is determined whether the number of screen file objects in the current global working state screen file object linked list exceeds the set limit.
5. According to the method of claim 1, the method is characterized in that: The window view object loading process also includes the following steps: Determine whether the window view object exists in the window view object Hash list. If the window view object does not exist in the window view object Hash list, it is determined that it is enabled for the first time, and a new window view object is created and initialized. The new window view object is inserted into the window view object Hash list and added to the end of the list at the same time. Enter the screen file object model creation process, execute the screen file object cache strategy process, implement binding coupling mapping between the screen file object and the window view object, and set the window interface corresponding to the window view object to the top level display; If the window view object exists in its window view object hash list, determine whether the screen file is modified; The window view object loading process also includes the following steps: If the screen file has been modified, the window view object is removed from the window view object hash list and list table, the window view object and the screen file object are decoupled, the window view object enters the global dead state window view object list from the global working state window view object linked list, the screen file object enters the global dead state screen file object list from the global working state screen file object linked list, the screen file object is set to the non-cached working mode, a new window view object is created and initialized again, the new window view object is inserted into the window view object hash list, and added to the end of the list table at the same time, the screen file object model creation process is entered, and the screen file object cache strategy process is executed. The screen file object and the window view object implement binding coupling mapping, and the screen file object and the screen view window corresponding to its window view object are set to the top display; If the screen file has not been modified, it is determined that the window view object already exists at this time, the window view object Hash list remains unchanged, the window view object is removed from the original position of the window view object in the list table, and the window view object is added to the end of the list table queue again; The screen view window is placed on top and is set to display state, and the screen view window is locked or unlocked; when the screen view window is switched, all pop-up unlocked screen view windows are hidden, and the locked screen view window continues to be displayed; When the screen view window is closed, the window view object cache strategy process is triggered.
6. According to the method of claim 1, the method is characterized in that: The creation process of the screen file object model is implemented using the following steps: When a picture view window is opened, the picture file corresponding to the picture view window is read; a new picture file object corresponding to the picture view window is created; The process of creating a screen file object corresponding to a new screen view window includes the process of reading the screen file, creating various graphic primitive objects, creating various device model sets corresponding to these graphic primitive objects, and binding the association relationship between various graphic primitive objects and various device model sets; Assign the unique identifier objectid to the image file object; Based on the file unique identifier objectid, check whether the picture file object exists in the picture file object hash list. If it does not exist, create a new picture file object model and initialize it, and put the picture file object into the global working state picture file object linked list. Template files or non-template files are all set to cache working mode. If the screen file object exists, check whether the screen file timestamp corresponding to the screen file object is the latest, and determine whether the screen file corresponding to the screen file object has been modified; The process of creating the screen file object model also includes the following steps: If the screen file timestamp corresponding to the screen file object has been modified, the screen file object is removed from the global working state screen file object list, and the screen file object is moved to the global dead state screen file object list, the screen file object is set to non-cached working mode, a new screen file object model is created and initialized, the screen file object is placed in the global working state screen file object list, and the template file or non-template file is set to cache working mode; If the screen file timestamp corresponding to the screen file object is the latest, determine whether the screen file object is a template screen; if the screen file object is a non-template screen, determine that the screen file object already exists, and multiple window view objects share the screen file object; If the screen file object is a template screen, it is determined that the screen file object already exists, and the screen file object is deeply copied. The window view object exclusively uses the resources of the screen file object, and the copied screen file object is set to a non-cached working mode.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 6 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
SCADA system picture caching system
CN107995176A
Method and apparatus for enhanced browsing
US20060143568A1