CN111651640B - Cross indexing method, device, computer storage medium and equipment - Google Patents

Cross indexing method, device, computer storage medium and equipment Download PDF

Info

Publication number
CN111651640B
CN111651640B CN202010475407.5A CN202010475407A CN111651640B CN 111651640 B CN111651640 B CN 111651640B CN 202010475407 A CN202010475407 A CN 202010475407A CN 111651640 B CN111651640 B CN 111651640B
Authority
CN
China
Prior art keywords
cross
thread
index
cross index
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010475407.5A
Other languages
Chinese (zh)
Other versions
CN111651640A (en
Inventor
谭良良
陈宏君
洪礼鑫
张磊
谭林丰
文继锋
李响
牛洪海
蔡丹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NR Electric Co Ltd
NR Engineering Co Ltd
Original Assignee
NR Electric Co Ltd
NR Engineering Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NR Electric Co Ltd, NR Engineering Co Ltd filed Critical NR Electric Co Ltd
Priority to CN202010475407.5A priority Critical patent/CN111651640B/en
Publication of CN111651640A publication Critical patent/CN111651640A/en
Application granted granted Critical
Publication of CN111651640B publication Critical patent/CN111651640B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9014Indexing; Data structures therefor; Storage structures hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the application provides a method, a device, a computer storage medium and equipment for cross indexing, wherein the method comprises the following steps: controlling a main thread to acquire cross index information generated by a cross index thread and generating a cross index symbol based on the cross index information; under the condition that a modification event occurs in configuration engineering, controlling the cross index thread to refresh the cross index information to obtain refreshed cross index information; controlling the main thread to generate a refreshed cross index symbol based on the refreshed cross index information, and updating the cross index symbol according to the refreshed cross index symbol; therefore, the formation and the instant refreshing of the cross index information are realized in the editing process of the configuration project, and the use convenience and the editing efficiency of the configuration project are improved.

Description

Cross indexing method, device, computer storage medium and equipment
Technical Field
The present application relates to the field of visual configuration technologies, and in particular, to a method and an apparatus for cross indexing, a computer storage medium, and a device.
Background
In the editing process of industrial control configuration engineering (or simply referred to as industrial control configuration and configuration engineering), a visual page often refers to global variables of objects (devices) and cross-objects, Input and Output (IO) uploading variables, cross-page variables and the like for logic programming. The cross index forming method in the related art is formed by manual triggering, is slow in forming speed, and does not have a function of updating and checking immediately, so that the safety and the usability are insufficient. For example, for a 500 Megawatt (MW) Distributed Control System (DCS) project, the DCS project is composed of more than 40 devices, 20 ten thousand pieces of data are accumulated, 4000 pages of visualization programs are executed, and at this time, the amount of cross-index data is large, which results in low editing efficiency of the configuration project.
Disclosure of Invention
The application provides a method, a device, a computer storage medium and equipment for cross indexing, which can realize the formation and the instant refreshing of cross index information in the editing process of a configuration project, thereby improving the use convenience and the editing efficiency of the configuration project.
The technical scheme of the application is realized as follows:
in a first aspect, an embodiment of the present application provides a method for cross indexing, where the method includes:
controlling a main thread to acquire cross index information generated by a cross index thread and generating a cross index symbol based on the cross index information;
under the condition that a modification event occurs in a configuration project, controlling the cross index thread to refresh the cross index information to obtain refreshed cross index information;
and controlling the main thread to generate a refreshed cross index symbol based on the refreshed cross index information, and updating the cross index symbol according to the refreshed cross index symbol.
In a second aspect, an embodiment of the present application provides a cross indexing apparatus, where the cross indexing apparatus includes an obtaining unit, a modifying unit, and a refreshing unit; wherein,
the acquisition unit is configured to control the main thread to acquire cross index information generated by a cross index thread and generate a cross index symbol based on the cross index information;
the modification unit is configured to control the cross index thread to refresh the cross index information under the condition that a modification event occurs in a configuration project, and obtain refreshed cross index information;
and the refreshing unit is configured to control the main thread to generate a refreshed cross index symbol based on the refreshed cross index information, and update the cross index symbol according to the refreshed cross index symbol.
In a third aspect, an embodiment of the present application provides a cross indexing apparatus, which includes a memory and a processor; wherein,
the memory for storing a computer program operable on the processor;
the processor is adapted to perform the steps of the method according to the first aspect when running the computer program.
In a fourth aspect, an embodiment of the present application provides a computer storage medium storing a cross-indexing program, which when executed by at least one processor implements the steps of the method according to the first aspect.
In a fifth aspect, an embodiment of the present application provides an apparatus, which includes at least the cross-indexing apparatus as described in the second aspect or the third aspect.
The embodiment of the application provides a method, a device, a computer storage medium and equipment for cross indexing, wherein the method comprises the following steps: controlling a main thread to acquire cross index information generated by a cross index thread and generating a cross index symbol based on the cross index information; under the condition that a modification event occurs in a configuration project, controlling the cross index thread to refresh the cross index information to obtain refreshed cross index information; controlling the main thread to generate a refreshed cross index symbol based on the refreshed cross index information, and updating the cross index symbol according to the refreshed cross index symbol; therefore, after the cross index information is obtained through the cross index thread, the cross index symbol can be generated according to the cross index information, manual operation of a user is not needed, and use convenience of the configuration project is improved; meanwhile, cross index information can be checked in real time, so that the safety of configuration engineering is improved; in addition, after the configuration project is modified, the cross index information can be refreshed immediately in the editing process, and therefore the editing efficiency of the configuration project is improved.
Drawings
Fig. 1 is a schematic flowchart of a cross-indexing method according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram illustrating a display effect of a cross index according to an embodiment of the present application;
FIG. 3 is a schematic flow chart of another cross-indexing method provided in an embodiment of the present application;
fig. 4 is a schematic diagram illustrating an interaction process of cross indexing according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a cross indexing device according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of another cross indexing apparatus provided in the embodiment of the present application;
fig. 7 is a schematic hardware structure diagram of a cross indexing apparatus according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a device according to an embodiment of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
Industrial control configuration engineering (or simply industrial control configuration, configuration engineering) is a virtual control program established by configuration software for industrial control process, and is widely applied to various fields such as machinery, automobiles, petroleum, chemical engineering, papermaking, water treatment, process control and the like.
In the editing process of configuration engineering, a visualization page often refers to global variables, IO upload variables, cross-page variables and the like of an intra-object/cross-object for logic programming. The cross index forming method in the related art is formed by manual triggering, is slow in forming speed, and does not have a function of updating and checking immediately, so that the safety and the usability are insufficient. For example, for a 500MW DCS project, the DCS project is composed of 40 devices, 20 ten thousand points of data are accumulated, and 4000 pages of visualization programs are executed, so that the amount of cross-index data is large, which results in low editing efficiency of the configuration project.
Based on this, the embodiment of the present application provides a method for cross indexing, where the method includes: controlling a main thread to acquire cross index information generated by a cross index thread and generating a cross index symbol based on the cross index information; under the condition that a modification event occurs in a configuration project, controlling the cross index thread to refresh the cross index information to obtain refreshed cross index information; controlling the main thread to generate a refreshed cross index symbol based on the refreshed cross index information, and updating the cross index symbol according to the refreshed cross index symbol; therefore, after the cross index information is obtained through the cross index thread, the cross index symbol can be generated according to the cross index information, manual operation of a user is not needed, and use convenience of the configuration project is improved; meanwhile, cross index information can be checked in real time, so that the safety of configuration engineering is improved; in addition, after the configuration project is modified, the cross index information can be refreshed immediately in the editing process, and therefore the editing efficiency of the configuration project is improved.
Embodiments of the present application will be described in detail below with reference to the accompanying drawings.
In an embodiment of the present application, referring to fig. 1, a flowchart of a method for cross indexing provided in an embodiment of the present application is shown, and as shown in fig. 1, the method may include:
s101: controlling a main thread to acquire cross index information generated by a cross index thread and generating a cross index symbol based on the cross index information;
it should be noted that the method described in this embodiment is applied to a device installed with configuration software, and the device may be other devices such as an intelligent terminal, a personal computer, an industrial modular computer, an industrial control device, an industrial server, a general server, and the like. Configuration engineering aiming at a specific industrial control process is established through configuration software installed on equipment, and functions of data acquisition and process control can be provided for users.
The configuration project may include a main thread, a cross-index thread (or cross-index processing thread) in operation. The main thread responds to a mouse, a keyboard and a network event, and generates or refreshes and displays a cross index symbol according to cross index information; and the cross index thread is used for generating cross index information according to the configuration files of the objects.
The cross index information is used for indicating the index relation in the objects or among the objects in the configuration engineering. For industrial engineering, especially large DCS engineering, generally includes a plurality of objects (or called devices, apparatuses), each of which may include a plurality of parameters, covering a plurality of visualization pages. It should be understood that the objects herein are not distinct from the specific devices instantiated, but rather are virtualized control modules. That is, an object may have several parameters from several physical devices. For example, for a 500MW DCS project, there are 40 objects, 20 ten thousand points of data are accumulated, and 4000 pages of visualization program are performed, where the cross-index information may include an object number, a page number, a channel type, an IO node/branch/module number, a channel name, an attribute name, and an attribute display name.
Wherein the cross-index symbol is used to provide a link to jump to a source interface of some related data. The cross index symbol is generated according to the cross index information, and is generally displayed near the function module (or called function block) in the current page, and may represent different sources in different symbol forms, such as from a global variable or from an IO module variable, and jump to the source interface of the variable by double-clicking (or other operations). For management or designers, the working efficiency can be obviously improved by presenting the association relation existing among a plurality of objects through cross index symbols.
It should be noted that, the indexing method used in this embodiment is hash indexing, the hash indexing is implemented based on a hash table, only queries that exactly match index columns (an index column refers to information for matching an input value) are valid, and for each row of data, the storage engine calculates a hash code for all index columns, where the hash code is a smaller value, and hash codes calculated by different index columns are different. The hash index stores all hash codes in an index file while maintaining pointers to each row of data in a hash table. Thus, the hash code is calculated for the input value through the same algorithm, the corresponding storage address is found in the hash index table, and the data is taken, so that the indexing process is completed. Therefore, in the embodiment of the present application, the cross index information is presented in the form of a hash index table. In addition, the indexing method may also be a B-tree index or other existing indexing methods, and the embodiment of the present application is not limited herein.
It should be further noted that the cross index thread may select to store the generated cross index information in the shared memory, and the shared memory is a storage space that can be read by both the cross index thread and the main thread; alternatively, the cross-index thread may store the generated cross-index information in a separate storage space and then make the main thread access the cross-index information by sending a notification or a link.
It should be further noted that, after the cross index symbol is generated, the cross index symbol may also be presented to the user in the configuration engineering, so that the user may click the cross index symbol to jump to the source page. Specifically, the cross-index symbol may be presented in the form of:
please refer to fig. 2, which shows a schematic view of a cross-index presentation effect provided by an embodiment of the present application, and as shown in fig. 2, in a user-oriented configuration engineering page (or referred to as a visual page), variable names corresponding to global variables and IO variables are filled in through TAG Attributes (TAGs) of function blocks, so as to implement reference to the variables, and cross-page variable reference is implemented by setting a source page number and a source function block instance name; the cross-device variable reference is realized by setting the serial number of the source device, the source page number and the source terminal roll name. The cross index symbol is displayed near the function block (on the left side or the right side) in the page, and the underlined bold font (which can be set) displays "Global", "IO", and a page number, "Global" indicates that the input is from a Global variable, "IO" indicates that the input source is from an IO module variable, and a page number indicates that the input source is from a visualized page. And if the cross index symbol is right-keyed, jumping to the corresponding source end interface. And displaying a configuration interface on the global variable and the IO variable, displaying cross index symbols for the variables with cross indexes, and skipping to a reference page by a right key.
And when the main thread is opened and the configuration project is newly built, the cross index thread is started. Thus, in some embodiments, prior to step S101, the method may further comprise:
receiving a first operation instruction; wherein the first operation instruction is used for starting the configuration project;
and controlling the main thread to start the cross index thread in the starting process of the configuration project.
It should be noted that the first operation instruction is an instruction for the user to start the configuration project, and may be performed by a mouse, a keyboard, or other hardware devices. The main thread receives a first operation instruction of a user, starts a configuration project, and can be a new configuration project or an existing configuration project file is opened. In the process of creating/opening the configuration project, the main thread starts the cross index thread, so that cross index information is obtained through the cross index thread.
For configuration engineering, the cross index information may include an index relationship inside an object, and therefore, in some embodiments, the cross index information includes first cross index information, see fig. 3, which shows a flowchart of another cross index method provided in an embodiment of the present application, and as shown in fig. 3, after controlling the main thread to start the cross index thread, the method may further include:
s201: acquiring equipment configuration information and configuration engineering information through the cross index thread;
it should be noted that the cross-index information may include first cross-index information for indicating an index relationship inside an object in the configuration engineering. Since the first cross index information is relative to one object of the configuration project, the first cross index information between different objects has no relevance, so that the first index information of the configuration project can be obtained by adopting a plurality of parallel intra-object cross index threads. Therefore, the appropriate parallel number of the targets can be determined according to the equipment configuration information and the configuration engineering information, so that the appropriate number of cross index threads in the objects can be started, and the parameters of the objects can be processed to obtain the first cross index information. The device configuration information may include a core number, a frequency, or other performance parameters of a Central Processing Unit (CPU), and the configuration engineering information may include parameters of configuration engineering, such as an object number and a data amount.
S202: determining the parallel amount of the targets based on the equipment configuration information and the configuration engineering information;
it should be noted that, the number of the cross index sub-threads in the object is determined through the device configuration information and the configuration engineering information, and the first cross index information is obtained by processing different objects through a plurality of parallel cross index sub-threads in the object, so that the processing efficiency is high, and the processing time is obviously shortened.
Illustratively, the device configuration information is the number of CPU cores, the configuration engineering information is the number of objects, the number of CPU cores of the computer is read, and parallel cross index sub-threads in the objects are created according to the principle that the total load of the CPU does not exceed 75% (the threshold value can be adjusted). And distributing the objects to be processed by the cross index sub-thread in each object according to the principle of uniform number. For example, in the case of a 4-core CPU, 1 sub-thread is started if the project has only 1 object, 2 sub-threads are started if the project has 2 objects, and 3 threads are started if the number N of objects in the project is not less than 3, and each of the threads takes charge of [0- (N/3) ], [ (N/3) - (2N/3) ], and [ (2N/3) -N ] objects.
S203: and controlling the cross index thread to start a plurality of cross index sub-threads in the object based on the target parallel quantity, and generating the first cross index information.
It should be noted that the first cross index information is used to indicate an index relationship in an object in the configuration engineering. The configuration files of different objects are respectively read through a plurality of intra-object cross index sub-threads, different intra-object hash index tables are respectively generated according to the algorithm of hash index (or other index modes), and finally all the intra-object hash index tables are assembled into first cross index information.
For configuration engineering, the cross-index information may also include an index relationship between cross-objects, and thus, in some embodiments, the cross-index information further includes second cross-index information; after the generating the first cross index information, the method may further include:
and controlling the cross index thread to start a cross-object cross index sub-thread and generating second cross index information.
It should be noted that the second cross-index information is used to indicate the index relationship between the cross-objects in the configuration project. Since the second cross index information is an index relationship between a plurality of objects, it needs to be obtained after the first cross index information is generated. Therefore, the cross-object cross-indexing thread and the intra-object cross-indexing thread need to be set in series, that is, after the execution of the intra-object cross-indexing thread is finished, the cross-object cross-indexing thread is started to generate the second cross-indexing information. Since the indexing method adopted in this embodiment is hash indexing, the second cross index information may be a cross-object hash index table.
In this case, the time points at which the cross processing thread generates the first cross index information and the second cross index information are different. Therefore, for step S101, specifically, the following steps may be included:
when first cross index information generated by a cross index project is acquired, a main thread generates a first cross index symbol according to the first cross index information; and when second cross index information generated by the cross index project is acquired, the main thread generates a second cross index symbol according to the first cross index information.
It should be noted that, in actual use, after the main thread starts the cross index thread, the two threads are in a state of being performed in parallel, that is, the process of generating the cross index information by the cross index thread and the process of generating the cross index information by the main thread according to the cross index information are performed simultaneously, and time points of generating the first cross index information and the second cross index information in the cross index information are different, so that step S101 may be performed by the following mechanisms:
the step of the main thread for acquiring the cross index information is designed to be carried out regularly, namely the main thread starts a process of acquiring the cross index information regularly, and if the cross index information can be acquired, a cross index symbol is generated and displayed. In this case, if there are fewer objects in the configuration project, when the main thread acquires the cross index information for the first time, the main thread can already acquire the first cross index information and the second cross index information, and then the main thread can generate and display cross index symbols in and across objects when drawing the symbols for the first time; if there are more objects in the configuration project, the main thread may only obtain the first cross index information when obtaining the cross index information for the first time (or nth time), and the main thread may draw and display the cross index symbol in the object first, and then draw and display the cross index symbol when obtaining the second cross index information subsequently.
Of course, the step of acquiring the cross index information by the main thread may also be designed as event triggering, that is, after the cross index thread generates the cross index information, the cross index thread sends an event notification to the main thread, and then the main thread acquires the cross index information and generates a cross index symbol.
It should be noted that, since some errors, such as unmatched or duplicated information, may be generated in the generation process of the second cross-index information, the cross-index thread needs to check the second cross-index information after generating the cross-index information. Thus, in some embodiments, after said controlling the cross-indexed thread to initiate cross-object cross-indexed sub-threads, generating second cross-index information, the method further comprises:
controlling the cross-object cross index sub-thread to check second cross index information to obtain alarm information; wherein, the alarm information is used for indicating error information in the cross indexing process;
controlling the cross-object cross index sub-thread to check the second cross index information to obtain alarm information corresponding to the second cross index information; wherein the alarm information is used for indicating error information in the second cross index information;
and displaying the alarm information in the configuration project.
It should be noted that the second cross index information relates to a plurality of objects in the configuration engineering, and an error may occur in the association and matching process, so that after the cross-object cross index sub-thread generates the second cross index information, the second cross index information needs to be checked to generate the alarm information. The alarm information may be displayed at the bottom or on the side of the visualization page, which is not limited herein.
It should be further noted that, in this embodiment, the alarm information generated by the second cross index information is not stored in the shared memory, so after the alarm information is generated, the cross-object cross index thread needs to send a notification message to the main thread to display the alarm information. Of course, the alarm information may also be generated in the shared memory, so that the main thread may directly acquire the alarm information and display it.
S102: under the condition that a modification event occurs in a configuration project, controlling the cross index thread to refresh the cross index information to obtain refreshed cross index information;
it should be noted that the configuration engineering is started in response to the operation of the user, and the cross index thread reads the configuration file of each object to generate the cross index symbol when the configuration engineering is started for the first time. After that, the user enters the editing process, and may modify various symbols, parameters, or variables in the page, that is, a modification event occurs in the configuration engineering. At this time, the cross-index relationship of the objects in the configuration project changes synchronously with the modification event, so that the cross-index information and the cross-index symbol need to be refreshed to display the current cross-index relationship in real time.
Based on this, after the cross index thread generates the cross index symbol for the first time, the cross index thread can be set to be started at regular time, that is, whether the configuration project has a modification event is detected at regular time, and if so, the refreshed cross index information is generated. Of course, the cross-index thread may also be set to be event-triggered, and the embodiment of the present application is not limited herein.
In addition, since the modification event may be understood as a configuration project receiving an operation instruction related to user modification, in some embodiments, the method further includes:
when a second operation instruction is received, determining that a modification event occurs in the configuration project; the second operation instruction is used for controlling the main thread to modify one object in the configuration project so as to determine a modified object.
It should be noted that, the user sends a second operation instruction through the operation of a mouse, a keyboard or other hardware devices, for example, a modification value entered by the user, so as to modify various parameters in the configuration project, that is, a modification event occurs in the configuration project. After the modification event occurs, the modified object may be obtained. In addition, the modification event also includes deleting the entire object and creating an object.
The refreshing process of the cross index information and the cross index symbol can be performed on the modified object, and for other objects which have no association relation with the modified object, the reprocessing is not needed. Therefore, in some embodiments, in the case of a modification event occurring in the configuration engineering, the method further comprises:
controlling the main thread to set a modification mark for the modified object;
correspondingly, the controlling the cross index thread to refresh the cross index information to obtain the refreshed cross index information includes:
controlling the cross index thread to judge whether the configuration project has the modification mark or not based on the preset cycle duration;
and if so, controlling the cross index thread to refresh the cross index information based on the modification mark to obtain refreshed cross index information.
It should be noted that, in practical applications, a main thread executes a specific modification event, but the cross-indexing thread generates the refreshed cross-indexing information, so that the cross-indexing thread needs to sense the modification performed by the main thread through the modification flag. In this embodiment, the cross-index thread is periodically started, and the specific modification process is as follows:
after modifying the object to be modified, the main thread sets a modification flag for the modified object, where the modification flag may be a function that can be accessed by both the main thread and the cross index thread, the setting of the modification flag may specifically be to set the value of the function to true, and the resetting of the modification flag may specifically be to set the value of the function to false.
After the cross index thread is started for the first time to generate cross index information, the cross index thread keeps the cycle starting based on the preset cycle duration (for example, 1 second); in each period, the cross index thread judges whether a modification mark exists in a plurality of objects in the configuration project, if the modification mark exists, the cross index thread regenerates refreshed cross index information aiming at the object where the modification mark is located, and the refreshed cross index information comprises refreshed first cross index information and refreshed second cross index information. In addition, the cross-indexing thread may also be designed as an event trigger, i.e. the main thread generates a modification flag and then sends an event notification to the cross-indexing thread.
Further, in some embodiments, after obtaining the post-refresh cross-index information, the method may further include:
and controlling the cross index thread to reset the modification mark.
It should be noted that, after the cross index thread generates the refreshed cross index information, the modification flag is reset, so as to avoid repeated refreshing when the next cycle is started.
In the editing state, the user may perform multiple modifications in succession, so as to avoid wasting too much processing amount by crossing the index lines, and therefore, in some embodiments, before the receiving the second operation instruction, the method further includes:
controlling the main thread to set a pause mark; wherein the pause flag is used to indicate that the cross-indexed thread enters a pause state;
accordingly, after the controlling the main thread sets a modification flag to the modified object, the method may further include:
controlling the main thread to reset the pause flag to cause the cross-indexed thread to exit a paused state.
It should be noted that the pause flag can also be understood as a function that can be accessed by both the main thread and the cross-index thread. Before the main thread modifies the object to be modified, the main thread sets a pause mark (the value of the function is set to be true), and the cross index thread enters a pause state after reading the mark; then, when the main thread finishes modifying the object to be modified, the pause flag is reset (the value of the function is set to be false), and the cross index thread exits from the pause state at this time. Here, the suspended state means that the cross-index thread abandons the flow that has not been completed and prepares to enter the next cycle for starting. The design has the advantages that if the user continuously modifies twice, the cross index thread firstly detects the modification mark of the first modification, and a refreshing flow aiming at the first modification is started; at this time, if the user immediately performs the second modification, the main thread sends the pause flag again, so the cross index thread gives up the refresh processing for the first time, sets the normal end flag to be false (if the refresh process is ended, the normal end flag is true), and directly starts the next processing flow for the two modifications after waiting for the main thread to reset the pause flag, thereby not needing to complete the two refresh processes for the two modifications respectively. Meanwhile, in the first refresh process, the cross-index thread does not reset the modification flag in the first modification, and the normal end flag in the first refresh process is false, so that the two modification flags are processed in the second refresh process.
It should be further noted that, when the cross index thread processes to obtain the cross index information, it needs to apply for a storage space from the memory pool. Therefore, in some embodiments, before the controlling main thread acquires the cross index information generated by the cross index thread, the method may further include:
controlling the cross index thread to apply for a first memory space based on a first application strategy;
controlling the cross index thread to process the configuration information of one object in the configuration engineering based on the applied first memory space so as to obtain partial cross index information corresponding to the one object;
and controlling the cross index thread to release the first memory space.
Here, the first application policy is used to apply for the memory from the memory pool. That is, for a configuration project, the configuration information of each object is stored in a file, so that when the cross index information is generated for the first time, the cross index thread reads the files of each object to obtain the configuration information of the object, a memory pool is used for allocating a temporary memory in the obtaining process, and the applied temporary memory is recycled after the files of a single object are read and analyzed, thereby reducing the memory overhead.
Further, after the configuration project is started, if a modification event occurs, the configuration information of the modified object cannot be directly written into the configuration file. Therefore, before the receiving of the second operation instruction, the method may further include:
controlling the main thread to apply for a second memory space based on a second application strategy; the second memory space is used for storing the configuration information of the modified object;
correspondingly, the controlling the cross index thread to refresh the cross index information includes:
and controlling the cross index thread to acquire the configuration information of the modified object based on the second memory space, and refreshing the cross index information based on the configuration information of the modified object.
Here, the second application policy refers to applying for the memory through a new function. That is, for modification or display in the editing process, the main thread generally applies for the memory to store by the new function, and at this time, the cross indexing thread can read the memory data based on the mutex application, so that the cross indexing thread can obtain the data that has been modified in the memory but has not been stored in the file.
Therefore, under the condition that a modification event occurs in the configuration engineering, the cross index thread can be controlled to refresh the cross index information to obtain refreshed cross index information, so that the refreshed cross index information can be used for generating and updating refreshed cross index symbols in the following process.
S103: and controlling the main thread to generate a refreshed cross index symbol based on the refreshed cross index information, and updating the cross index symbol according to the refreshed cross index symbol.
It should be noted that, the main thread acquires the post-refresh cross index information and then generates a post-refresh cross index symbol, and in this process, the post-refresh cross index symbol is also generated in the shared memory, so that the main thread can directly acquire the post-refresh cross index information. Here, the main thread may also be based on a time trigger, an event trigger, or other triggering manner to obtain the post-refresh cross index information, and the embodiment of the present application is not limited in particular.
It should be noted that the main thread updates the cross index symbol with the refreshed cross index symbol, so that the configuration engineering can respond to the modification operation of the user and immediately refresh the cross index information.
It should be further noted that, for the refreshed cross index information, a checking process also exists, that is, the cross-object cross index sub-thread checks the refreshed second cross index information to obtain the refreshed warning information, and the cross index thread sends a notification message to the main thread, so that the refreshed warning information is displayed on the visual page.
When the user exits the configuration project, the cross-index thread needs to be exited first, and therefore, in some embodiments, the method further includes:
receiving a third operation instruction; wherein the third operation instruction is used for exiting the configuration project;
controlling the main thread to send an exit signal to the cross index thread in the exit process of the configuration project; wherein the exit signal is used for indicating the exit of the cross-index thread
It should be noted that, the main thread receives a third operation instruction sent by the user, that is, an instruction for exiting the configuration project, at this time, the cross index thread needs to be closed first, and the configuration project can be closed only after the cross index thread exits. In addition, before closing the cross index thread, a pause flag may be set so that the cross index thread stops calculating and processing, and then an exit signal is sent so that the cross index thread smoothly exits, thereby avoiding the cross index thread from being stuck.
Both the cross-index symbol and the refreshed cross-index symbol need to be presented to the user. Thus, in some embodiments, after step S101, the method may further comprise:
controlling the main thread to display the cross index symbol in a preset page of the configuration project
Accordingly, after step S103, the method may further include:
and controlling the main thread to display the refreshed cross index symbol in the preset page.
It should be noted that the preset page is a page for interaction between the configuration project and the user, that is, the visual page or the configuration project page. The main thread displays the cross index symbol/refreshed cross index symbol on the preset page, so that a user can access a source end page of the associated data through the cross index symbol/refreshed cross index symbol, and editing convenience is improved.
The cross-index symbol is generally displayed near the associated function module (i.e., the function block), and thus, in some embodiments, before the main thread is controlled to present the cross-index symbol in the preset page of the configuration project, the method may further include:
determining a functional module corresponding to the cross index symbol in the preset page, and establishing an association relation between the cross index symbol and the functional module; wherein the incidence relation is used for indicating that the cross index symbol is synchronously moved or deleted with the functional module.
It should be noted that, for convenience of use, the cross index symbol is generally displayed near the associated function module and has an association relationship with the function module, and when the user deletes or moves the function module, the cross index symbol is also deleted or moved synchronously. That is, as a function block moves within a visualization page, the cross-index symbol of the associated display moves synchronously; and when the functional blocks in the visual page are deleted, the associated cross index symbols are deleted synchronously.
Further, in some embodiments, the cross-index information includes at least one of: the device number, the page number, the channel type, the input and output node number, the branch number, the module number, the channel name, the attribute name and the attribute display name.
In summary, the present application realizes the fast formation and instant refresh of the cross index for the large DCS configuration project. In order to achieve the above object, the present application provides a method for forming and refreshing cross indexes, wherein when a configuration project is opened/newly built by configuration software, cross index information in and between devices (i.e. the above objects) is quickly formed by multithreading technology; in the configuration editing process, the main thread sets a modified and unrefreshed mark (namely the modified mark) as true, and the cross index thread refreshes and checks the cross index contents of the modified device and the associated device in real time; and after detecting that the cross index data of the current view is updated, the main thread redraws the cross index symbol. The method specifically comprises the following steps:
(1) the configuration software includes a main thread and a cross-index processing thread (i.e., the cross-index thread). The main thread responds to mouse, keyboard and network events and refreshes and displays the contents of the cross index. Starting a cross index processing thread after the main thread is opened and a project is newly built;
(2) the cross index threads comprise a plurality of intra-device cross index processing sub-threads which can be parallel and serial cross-device cross index processing sub-threads. The CPU core number of the computer is obtained, a plurality of parallel sub-threads are started, and each sub-thread distributes a device to be processed according to the equal number principle. After all the cross-device cross-index processing sub-threads are normally processed in the device, cross-device cross-index processing sub-threads are started to form variable information matched with reference of the cross-device checking;
(3) the cross-index thread employs a cycle on demand enforcement strategy. If the initial value of the 'first execution' is true, the 'modified and unrefreshed' mark of each device is not judged, the cross index processing sub-thread in the device reads the global variable file, the IO variable file and the visual page configuration file in each device, and only reads the required attributes of the cross index to form the hash table of the cross index in the device. And when the cross-device cross index processing sub-thread is normally finished, finishing the single cross index process, and setting the 'first execution' as false. Starting a subsequent period, when 'first execution' is false, if a sub thread needing to be started last time has already finished running and at least 1 device has a 'modified unrefreshed' mark as true, analyzing the modified device internal cross index content and refreshing the associated cross device cross index content;
(4) the main thread acquires mouse, keyboard and menu commands in the event response cycle process, and sends a cross index pause signal before executing a command for deleting variables, pages and symbols and a command for modifying the names of the variables. The cross index thread reads the signal in each subfunction, returns immediately after acquiring the pause signal, marks the 'normal end' of each subfunction as false, and fails the execution at this time without updating the cross index information. After executing a command for deleting variables, pages and symbols and a command for modifying variable names, the main thread sets a modified and unrefreshed flag of the device to be true, sends a cross index recovery signal and starts execution in a cross index thread recovery period;
(5) and the cross index thread forms an in-device cross index hash table, a cross-device cross index hash table, unmatched and repeated index information and informs the main thread to display unmatched and repeated alarm information. And the main thread regularly judges whether the currently displayed visual page, the global variable interface and the IO variable interface have cross index information updating or not, and instantly refreshes and displays the matched cross index content. When the current interface is switched, triggering an interface refreshing display flow;
(6) and stopping the cross index thread before the main thread closes and deletes the project.
Further, the visual page fills in variable names corresponding to global variables and IO variables through the TAG attributes of the function blocks to realize reference of the variables, and realizes reference of cross-page variables through setting source page numbers and source function block instance names; and cross-device variable reference is realized by setting a source device number, a source page number and a source terminal roll call. As shown in fig. 2, the cross index symbol is displayed near (left or right side) the functional block in the page, and the underlined bold font (which can be set) displays "Global", "IO", and a page number, "Global" indicates that the input originates from a Global variable, "IO" indicates that the input source is from an IO module variable, and a page number indicates that the input source is from a visualized page. And double-clicking the cross index symbol, and jumping to a corresponding source end interface. And displaying the index marks on the variables with the cross indexes on the global variable and IO variable display configuration interfaces, wherein the right key can jump to the reference page.
Furthermore, when the function block moves, the related displayed cross index symbol moves synchronously, and when the function block deletes, the related cross index symbol deletes synchronously.
Further, the cross index information includes a device number, a page number, a channel type, an IO node/branch/module number, a channel name, an attribute name, and an attribute display name.
Furthermore, the project is opened, cross index data is formed for the first time, when the files of all the devices are read, a memory pool is adopted to distribute the temporary memory, and the single device reads and analyzes the temporary memory which is applied for recycling, so that the memory overhead is reduced. In the editing process, if the page, the global variable and the IO variable configuration data of a certain device are displayed by mouse clicking, that is, the memory is applied by the conventional new function, the cross index thread reads the memory data based on the application of the mutex, and can acquire the data which is modified in the memory but not stored in the file.
After adopting above-mentioned scheme, this application has following beneficial effect: and (3) opening a project aiming at a large DCS configuration project, and completing the analysis and extraction process of the cross index information of 20 ten thousand and 4000 pages of 40 devices in 20 seconds. In the editing process, the cross index change caused by new creation and deletion of pages, symbols and variables is refreshed immediately within 1 second, the information of repeated citation, unmatched prompt and the like is checked in real time, the what you see is what you get is realized, and the safety and convenience of the configuration engineering are improved.
The embodiment of the application provides a method for cross indexing, which comprises the following steps: controlling a main thread to acquire cross index information generated by a cross index thread and generating a cross index symbol based on the cross index information; under the condition that a modification event occurs in configuration engineering, controlling the cross index thread to refresh the cross index information to obtain refreshed cross index information; based on the refreshed cross index information, controlling the main thread to generate a refreshed cross index symbol, and updating the cross index symbol according to the refreshed cross index symbol; therefore, cross index information can be obtained through the cross index thread, so that cross index symbols are generated and checked, and the use convenience and safety of configuration engineering are improved; in addition, after the configuration project is modified, the refreshed cross index information can be obtained through the cross index thread, so that a refreshed cross index symbol is generated, the cross index information can be refreshed immediately in the editing process, and the editing efficiency of the configuration project is improved.
In another embodiment of the present application, referring to fig. 4, which shows an interaction diagram of a cross index provided in an embodiment of the present application, as shown in fig. 4, the method of cross index mainly involves a main thread and a cross index thread, and for the main thread, the following steps are mainly included in an interaction process:
s3101: opening a configuration project;
it should be noted that: the configuration software is Graphical User Interface (GUI) editing software, and is used for establishing configuration engineering for a specific industrial control process. In an embodiment, the configuration project includes a main thread and a cross-index thread. The main thread is used for circularly processing hardware events and messages, and can respond to mouse and keyboard events to carry out operations such as creating/opening projects, creating and deleting pages/symbols, editing variables and the like; the cross index thread is used for reading the configuration of a plurality of objects in the configuration project and generating or refreshing cross index information. First, in response to a user's operation of creating/opening a project, the main thread opens a configuration project.
S3102: the main thread opens a page, draws and displays the cross index symbol;
it should be noted that, as shown in fig. 2, the cross index symbol is displayed near (on the left or right side) the function block in the page, and the underlined bold font (which can be set) displays "Global", "IO", and a page number, "Global" indicates that the input originates from a Global variable, "IO" indicates that the input source originates from an IO module variable, and a page number indicates that the input source originates from a visualized page. And if the cross index symbol is double-clicked, jumping to a corresponding source end interface. And displaying configuration interfaces of global variables and IO variables, displaying index marks on the variables with cross indexes, and skipping to a reference page by a right key.
S3103: setting a thread pause mark;
it should be noted that, when a user deletes a device, a page, a symbol, an IO variable, and a global variable through a hardware device (a mouse, a keyboard, and the like), the main thread receives the operation instruction, sets a thread pause flag, and then deletes the device, the page, the symbol, the IO variable, and the global variable, where setting the thread pause flag may be understood as setting a value of a pause function to true.
S3104: forming a thread pause mark;
it should be noted that the main thread forms a cross-index pause flag, so that the cross-index thread enters a pause state, and program conflicts and wasted computation amount are avoided.
S3105: after devices, pages, symbols, IO variables, global variables or the reference attribute is deleted, a modified unrefreshed mark is set;
after the thread pause flag is formed, the main thread deletes the device, page, symbol, IO variable, global variable or modified power plant identification (KKS) reference attribute according to the user's instruction, and sets a "modified not refreshed" flag (i.e., the aforementioned modified flag) for the modified object.
S3016: resetting a thread pause flag;
it should be noted that, after the main thread performs the modification operation, the value of the suspension function is set to be false, i.e., the thread suspension flag is reset. That is, after the main thread executes the delete variable, page, symbol command, and modify variable name command, the "modified not refreshed" flag of the device is set to true, the pause flag is reset, and the cross-index thread resumes periodic startup execution.
S3107: when the current view cross index is updated, redrawing and refreshing the cross index symbol;
it should be noted that, after the user deletes or modifies the device, the page, the symbol, the IO variable, and the global variable, the cross index information also changes correspondingly, so that the main thread needs to redraw and refresh the cross index symbol according to the refreshed cross index information.
S3108: judging whether a hardware event triggering the closing of configuration engineering or software closing exists;
here, if the determination result is yes, step S3109 is performed.
It should be noted that, when the main thread receives a hardware event for closing the configuration project or closing the software, the main thread enters an exit flow; if the main thread does not receive a hardware event for closing the configuration project or software closing, regularly judging whether cross index information updating exists in the currently displayed visual page, the global variable interface and the IO variable interface or not, and immediately refreshing and displaying matched cross index content. When the current interface is switched, the interface is triggered to refresh the display flow.
S3109: setting a thread pause mark;
it should be noted that, in the exit flow, the main thread also needs to set a thread pause flag first, so that the cross-indexed thread is in a pause state, and the cross-indexed thread is prevented from being stuck during the exit. Here, the thread pause flag is the same as the thread pause flag in steps 3103 to 3105.
S3110: sending a thread exit signal;
it should be noted that, after setting the thread pause flag, the main thread sends an exit signal to the cross-index thread to turn off the cross-index thread.
S3111: waiting for the cross index related thread to quit running and ending the related thread;
it should be noted that, after the cross index thread exits, the main thread ends the related thread, closes the page, and closes the configuration project.
For the cross index thread, the method mainly comprises the following steps in the interaction process:
s3201: starting a plurality of cross index sub-threads by the cross index thread according to the number of CPU cores, respectively reading data of each device in the configuration, forming a hash table for searching, and forming cross index information in the device;
it should be noted that, after the main thread is opened or a project is newly built, the cross index thread is started. The cross indexing thread is a thread of background processing, and the cross indexing thread is executed periodically, and the execution period of the cross indexing thread can be set according to the use requirement, for example, 1 second. The cross index threads comprise in-device cross sub-index threads and cross-device cross index sub-threads which are arranged in series, and meanwhile, the in-device cross sub-index threads can run in parallel, namely the cross index threads comprise a plurality of in-device cross index processing sub-threads which can be in parallel and a plurality of serial cross-device cross index processing sub-threads.
Therefore, the cross index thread reads the number of the CPU cores of the computer, and creates a plurality of parallel intra-device cross sub-index sub-threads according to the principle that the overall CPU load does not exceed a critical value (the critical value can be set according to the use requirement, for example, 75%). And distributing the devices to be processed by the crossed sub-index sub-threads in each device according to the principle of the average number. Illustratively, in the case of a 4-core CPU, if the project has only 1 object, 1 sub-thread is started, if the project has 2 objects, 2 sub-threads are started, and if the number N of objects of the project is greater than or equal to 3, 3 threads are started, each of which is responsible for [0- (N/3) ], [ (N/3) - (2N/3) ], and [ (2N/3) -N ] objects.
It should be noted that, when a project is opened, cross index data is formed for the first time, and a specific process is that when a cross index thread reads each device file, a temporary memory is allocated by using a memory pool, a single device reads and analyzes to generate cross index information, and then the applied temporary memory is recovered, thereby reducing memory overhead. In the editing process, if the page, the global variable and the IO variable configuration data of a certain device are displayed by clicking with a mouse, a conventional new function is applied for the memory, the cross index thread reads the memory data based on the application of the mutex, and the data which is modified in the memory but not stored in the file can be obtained.
As shown in fig. 2, the cross index information includes a device number, a page number, a channel type, an IO node/branch/module number, a channel name, an attribute name, and an attribute display name. The visual page fills in variable names corresponding to global variables and IO variables through TAG attributes of the function blocks to realize reference of the variables, and realizes reference of cross-page variables through setting source page numbers and source function block instance names; and cross-device variable reference is realized by setting a source device number, a source page number and a source terminal roll call.
That is to say, when the cross index thread is started, the initial value of the "first execution" of the cross index thread is true, at this time, the "modified unrefreshed" flag of each device is not judged, the intra-device cross index processing sub-thread reads the global variable file, the IO variable file and the visual page configuration file in each device, only reads the attributes required by the cross index, and forms the intra-device cross index hash table. And when the cross-device cross index processing sub-thread is normally finished, finishing the single cross index process, and setting the value of 'first execution' as false.
S3202: forming cross index information in a memory;
it should be noted that after the cross-device cross-index processing sub-thread is normally finished, cross-index information is formed in the memory, and the main thread can read the cross-index information in the memory to generate a cross-index symbol and display the cross-index symbol to the user.
S3203: judging whether the main thread sets a pause mark or not;
here, if the determination result is yes, return to step S3201; if the judgment result is negative, executing step S3204;
it should be noted that, when there is a thread pause flag, the cross index thread reads the pause flag in each sub-thread, and after acquiring the pause flag, the process returns to step S302, and sets the "normal end" flag of each cross index sub-thread to false, which means that the execution is failed this time and cross index information is not formed.
S3204: starting a cross-device cross index matching check thread to form cross index information among devices;
it should be noted that, after the cross-indexing thread in the device is finished, the cross-device cross-indexing thread is started to form cross-device cross-indexing information;
s3205: forming repeated and unmatched cross index information and informing the main thread of displaying the information at the bottom;
it should be noted that the cross-device cross-indexing thread checks the generated cross-device cross-indexing information, forms the repeated and unmatched information into alarm information, and notifies the main thread to display the information at the bottom.
That is, the cross index thread forms an intra-device cross index hash table, a cross-device cross index hash table, and unmatched/duplicated index information, the main thread generates a cross index symbol according to the intra-device cross index hash table and the cross-device cross index hash table for presentation, and presents alarm information according to the notification of the cross index thread.
S3206: starting a cross index refreshing thread periodically;
it should be noted that, the cross index thread adopts a cycle on-demand execution strategy, the cross index refresh thread is still the aforementioned thread and is only used for executing the refresh task, cycle start is timing start, and the cycle can be set according to the requirement, for example, 1 second.
S3207: judging whether the main thread sends a pause mark or not;
here, with respect to step S3207, if the determination result is yes, return is made to step S3206; if the judgment result is negative, step S3208 is performed;
it should be noted that, when starting the cross index refresh thread each time, it is necessary to determine whether the main thread sets a pause flag, if so, the execution is disabled, and the process returns to step S3206 to wait for the next cycle to start; if not, the subsequent steps are continuously executed.
S3208: judging whether the current project is modified and not refreshed;
here, with respect to step S3208, if the determination result is no, return is made to step S3206; if yes, go to step S3209;
it should be noted that, when the "first execution" is false, and the last started child thread has already been run and there are at least 1 devices whose "modified unrefreshed" flag is true, the modified intra-device cross index content is analyzed, and the associated cross-device cross index content is refreshed.
S3209: re-forming refreshing cross index information for the modified devices, and refreshing cross-device cross index information of the check devices;
it should be noted that, for the modified device, the cross-indexing thread reforms the refreshed intra-device cross-index information and the refreshed cross-device cross-index information referring to the device.
S3210: forming refreshing cross index information in a memory;
it should be noted that the cross index thread refreshes the memory to form cross index information, so that the main thread generates a refreshed cross index symbol based on the refreshed cross index information.
S3211: resetting a modified non-refresh flag of an associated device;
it should be noted that the cross-indexed thread resets the modified non-refresh flag of the modification device, and avoids refreshing again in the next cycle.
S3212: refreshing repeated and unmatched cross index information, and informing the main thread of displaying in the bottom information bar;
it should be noted that the cross-index thread checks the refreshed cross-device cross-index information to form refreshed alarm information.
S3213: judging whether an exit signal is received or not;
here, with respect to step S3213, if the determination result is no, return is made to step S3206; and if the judgment result is yes, exiting the cross indexing thread.
It should be noted that, according to the received exit signal, the cross-index thread exits, otherwise, the next cycle is entered.
In summary, the configuration software is graphical GUI editing software, and has a main thread based on event and message loop processing, where the thread affects mouse and keyboard events, and performs operations such as creating/opening a project, creating and deleting pages/symbols, and editing variables.
The cross-indexing process is a thread of background processing that is set to be executed periodically (e.g., 1 second). After the main thread opens the project, the cross-index processing thread is enabled. The cross index thread comprises a plurality of parallel cross index processing sub-threads in the device and serial cross index processing sub-threads of the device. Reading the number of CPU cores of the computer, and creating the parallel sub-thread according to the principle that the total load of the CPU does not exceed 75%. Each sub-thread distributes the devices to be processed according to the principle of average number (for example, in the case of 4 cores of CPU, if the project has only 1 object, 1 sub-thread is started, if the project has 2 objects, 2 sub-threads are started, if the number of the objects of the project is more than or equal to 3, 3 threads are started, and each thread is responsible for [0- (N/3) ], [ (N/3) - (2N/3) ], and [ (2N/3) - (N) ].
The initial value of the cross index thread 'first execution' is true, the 'modified and unrefreshed' mark of each device is not judged during the first processing, the cross index processing sub-thread in the device reads the global variable file, the IO variable file and the visual page configuration file in each device, only reads the attribute required by the cross index, and the cross index hash table in the device is formed. And when the cross-device cross index processing sub-thread is normally finished, finishing the single cross index process, and setting the 'first execution' as false.
The cross index information comprises a device number, a page number, a channel type, an IO node/branch/module number, a channel name, an attribute name and an attribute display name. The visual page fills in variable names corresponding to global variables and IO variables through TAG attributes of the function blocks to realize reference of the variables, and realizes reference of cross-page variables through setting source page numbers and source function block instance names; the cross-device variable reference is realized by setting the serial number of the source device, the source page number and the source terminal roll name. As shown in fig. 2, the cross index symbol is displayed near (left or right side) the function block in the page, and "Global", "IO", and page number are displayed in bold and underlined font (which can be set), "Global" indicates that the input originates from the Global variable, "IO" indicates that the input source is from the IO module variable, and "page number" indicates that the input source is from the visualized page. And double-clicking the cross index symbol, and jumping to a corresponding source end interface. And displaying the index marks on the variables with the cross indexes on the global variable and IO variable display configuration interfaces, wherein the right key can jump to the reference page.
When a project is opened, cross index data is formed for the first time, when each device file is read, a temporary memory is distributed by using a memory pool, and a single device reads and analyzes the temporary memory which is applied for and is recycled, so that the memory overhead is reduced. In the editing process, if the page, the global variable and the IO variable configuration data of a certain device are displayed by clicking with a mouse, namely, a memory is applied by a conventional new function, the cross indexing thread applies for reading the memory data based on the mutual exclusion lock, and can acquire the data which is modified in the memory but not stored in a file.
The cross-index refresh process during editing is as follows:
the cross-index thread employs a cycle on demand enforcement strategy. And starting a subsequent period, and when the 'first execution' is false, if the sub thread needing to be started last time is operated and the 'modified unrefreshed' flag of at least 1 device exists, analyzing the modified in-device cross index content and refreshing the associated cross-device cross index content.
The main thread obtains commands of a mouse, a keyboard and a menu in the process of an event response cycle, and sends a cross index pause signal before executing commands of deleting variables, pages and symbols and modifying variable names. The cross index thread reads the signal in each subfunction, returns immediately after acquiring the pause signal, marks the 'normal end' of each subfunction as false, and fails the execution at this time without updating the cross index information. After executing the delete variable, page, symbol command and modify variable name command, the main thread sets the modified and non-refreshed flag of the device as true, and sends the cross index recovery signal, and the cross index thread recovery cycle starts execution.
And the cross index thread forms an in-device cross index hash table, a cross-device cross index hash table, unmatched and repeated index information and informs the main thread to display unmatched and repeated alarm information. And the main thread regularly judges whether the currently displayed visual page, the global variable interface and the IO variable interface have cross index information updating or not, and instantly refreshes and displays the matched cross index content. When the current interface is switched, the interface refreshing display process is triggered.
And stopping the cross index thread before the main thread is closed and the project is deleted. And when the new project is opened again, the cross index thread is recovered.
That is, the present application discloses a cross-index forming and refreshing method: when a configuration engineering project is opened, starting a plurality of parallel threads to read and analyze configuration and configuration files of each device, forming an index hash table taking the device as a unit, and forming a cross index symbol in a device range; and then starting a cross-device cross index matching checking thread to form a cross index symbol between devices. In the configuration editing and debugging process, a periodic refreshing thread is started, and the change of cross index data caused by adding, deleting and renaming devices, pages, symbols and variables is refreshed immediately. Only modified devices and devices with cross-device indices are processed during the periodic refresh process. The method and the device for the configuration project updating and checking realize the instant formation, refreshing and checking of the cross index information in the editing process, and improve the safety and the editing efficiency of the configuration project.
The embodiment of the application provides a cross indexing method, which elaborates the specific implementation of the embodiment, and it can be seen that after cross index information is obtained through a cross indexing thread, a cross index symbol can be generated according to the cross index information, and manual operation by a user is not needed any more, so that the use convenience of configuration engineering is improved; meanwhile, cross index information can be checked in real time, so that the safety of configuration engineering is improved; in addition, after the configuration project is modified, the cross index information can be refreshed in real time in the editing process, and therefore the editing efficiency of the configuration project is improved.
In yet another embodiment of the present application, referring to fig. 5, which shows a schematic structural diagram of a cross indexing apparatus 40 provided in an embodiment of the present application, as shown in fig. 5, the cross indexing apparatus 40 includes an obtaining unit 401, a modifying unit 402, and a refreshing unit 403; wherein,
an obtaining unit 401 configured to control the cross index thread to refresh the cross index information when a modification event occurs in a configuration project, and obtain refreshed cross index information;
a modification unit 402 configured to control the cross index thread to refresh the cross index information when a modification event occurs in a configuration project, so as to obtain refreshed cross index information;
a refreshing unit 403, configured to control the main thread to generate a post-refresh cross index symbol based on the post-refresh cross index information, and update the cross index symbol according to the post-refresh cross index symbol.
In some embodiments, as shown in fig. 6, the cross indexing apparatus 40 may further include a starting unit 404 configured to receive a first operation instruction; the first operation instruction is used for starting the configuration project; and controlling the main thread to start the cross index thread in the starting process of the configuration project.
In some embodiments, the cross index information includes first cross index information, and the starting unit 404 may be further configured to obtain device configuration information and configuration engineering information through the cross index thread; determining a target parallelism quantity based on the equipment configuration information and the configuration engineering information; controlling the cross index thread to start a plurality of cross index sub-threads in the object based on the target parallel number to generate the first cross index information; the first cross index information is used for indicating an index relation in an object in the configuration engineering.
In some embodiments, the cross index information further includes second cross index information, and the starting unit 404 may be further configured to control the cross index thread to start a cross-object cross index sub-thread, so as to generate the second cross index information; and the second cross index information is used for indicating the index relationship among the cross objects in the configuration engineering.
In some embodiments, as shown in fig. 6, the cross indexing apparatus 40 may further include an alarm unit 405 configured to control the cross-object cross index sub-thread to check the second cross index information, so as to obtain alarm information corresponding to the second cross index information; wherein the alarm information is used for indicating error information in the second cross index information; and displaying the alarm information in the configuration project.
In some embodiments, the modification unit 402 may be further configured to determine that a modification event occurs in the configuration project when a second operation instruction is received; the second operation instruction is used for controlling the main thread to modify one object in the configuration project so as to determine the modified object.
In some embodiments, the modifying unit 402 may be further configured to control the cross-index thread to determine whether the configuration project has the modification flag based on a preset period duration; and if so, controlling the cross index thread to refresh the cross index information based on the modification mark to obtain refreshed cross index information.
In some embodiments, modification unit 402 may be further configured to control the cross-indexed thread to reset the modification flag.
In some embodiments, the modifying unit 402 may be further configured to control the main thread to set a pause flag before the receiving of the second operation instruction; wherein the pause flag is used to indicate that the cross-indexed thread enters a paused state; accordingly, after the main thread is controlled to set a modification flag to the modified object, the main thread is controlled to reset the pause flag so that the cross-indexed thread exits the pause state.
In some embodiments, as shown in fig. 6, the cross indexing apparatus 40 may further include an exit unit 406 configured to receive a third operation instruction; wherein the third operation instruction is used for exiting the configuration project; controlling the main thread to send an exit signal to the cross index thread in the exit process of the configuration project; wherein the exit signal is used to indicate the cross-indexed thread to exit.
In some embodiments, the obtaining unit 401 may be further configured to control the main thread to display the cross index symbol in a preset page of the configuration project; correspondingly, the refresh unit 403 may be further configured to control the main thread to display the post-refresh cross index symbol in the preset page.
In some embodiments, the obtaining unit 401 may be further configured to determine, in the preset page, a functional module corresponding to the cross index symbol, and establish an association relationship between the cross index symbol and the functional module; wherein the incidence relation is used for indicating that the cross index symbol is synchronously moved or deleted with the functional module.
In some embodiments, the cross-index information comprises at least one of: the device number, the page number, the channel type, the input and output node number, the branch number, the module number, the channel name, the attribute name and the attribute display name.
It is understood that, in this embodiment, a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, etc., and may also be a module, or may be non-modular. Moreover, each component in the embodiment may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a hardware mode, and can also be realized in a software functional module mode.
Based on the understanding that the technical solution of the present embodiment essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, and include several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the method of the present embodiment. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
Accordingly, the present embodiments provide a computer storage medium storing a cross-indexing program that, when executed by at least one processor, performs the steps of the method of any of the preceding embodiments.
Based on the above composition of the cross indexing device 40 and the computer storage medium, referring to fig. 7, which shows a specific hardware structure example of the cross indexing device 40 provided in the embodiment of the present application, as shown in fig. 7, the cross indexing device 40 may include: a communication interface 501, a memory 502, and a processor 503; the various components are coupled together by a bus device 504. It is understood that bus device 504 is used to enable connected communication between these components. Bus device 504 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, however, the various buses are identified in fig. 7 as bus device 504. The communication interface 501 is used for receiving and sending signals in the process of receiving and sending information with other external network elements;
a memory 502 for storing a computer program capable of running on the processor 503;
a processor 503 for executing, when running the computer program, the following:
controlling a main thread to acquire cross index information generated by a cross index thread and generating a cross index symbol based on the cross index information;
under the condition that a modification event occurs in a configuration project, controlling the cross index thread to refresh the cross index information to obtain refreshed cross index information;
and controlling the main thread to generate a refreshed cross index symbol based on the refreshed cross index information, and updating the cross index symbol according to the refreshed cross index symbol.
It will be appreciated that the memory 502 in the embodiments of the subject application can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of example, and not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous SDRAM (ESDRAM), Synchronous Link Dynamic Random Access Memory (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 502 of the apparatus and methods described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
And the processor 503 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by instructions in the form of hardware integrated logic circuits or software in the processor 503. The Processor 503 may be a general purpose Processor, a Digital Signal Processor (DSP), an APPlication Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, or discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 502, and the processor 503 reads the information in the memory 502 and completes the steps of the above method in combination with the hardware thereof.
It is to be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For a hardware implementation, the Processing units may be implemented within one or more APPlication Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units configured to perform the functions described herein, or a combination thereof.
For a software implementation, the techniques described herein may be implemented with modules (e.g., procedures, functions, and so on) that perform the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
Optionally, as another embodiment, the processor 503 is further configured to perform the steps of the method of any one of the preceding embodiments when running the computer program.
Based on the above composition and hardware structure schematic diagram of the cross indexing device 40, refer to fig. 8, which shows a composition structure schematic diagram of an apparatus 60 provided in an embodiment of the present application. The device 60 may be, for example, a smart terminal, a personal computer, an industrial modular computer, an industrial control device, an industrial server, a general-purpose server, or the like. As shown in fig. 8, the apparatus 60 comprises at least the cross-indexing means 40 as described in any of the previous embodiments. For the device 60, after the cross index information is obtained through the cross index thread, the cross index symbol can be generated according to the cross index information, and manual operation of a user is not needed any more, so that the use convenience of the configuration project is improved; meanwhile, cross index information can be checked in real time, so that the safety of configuration engineering is improved; in addition, after the configuration project is modified, the cross index information can be refreshed in real time in the editing process, and therefore the editing efficiency of the configuration project is improved.
The above description is only a preferred embodiment of the present application, and is not intended to limit the scope of the present application.
It should be noted that, in the present application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description, and do not represent the advantages and disadvantages of the embodiments.
The methods disclosed in the several method embodiments provided in the present application may be combined arbitrarily without conflict to obtain new method embodiments.
The features disclosed in the several product embodiments presented in this application can be combined arbitrarily, without conflict, to arrive at new product embodiments.
The features disclosed in the several method or apparatus embodiments provided herein may be combined in any combination to arrive at a new method or apparatus embodiment without conflict.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (16)

1. A method of cross-indexing, the method comprising:
controlling a main thread to acquire cross index information generated by a cross index thread and generating a cross index symbol based on the cross index information;
under the condition that a modification event occurs in configuration engineering, controlling the cross index thread to refresh the cross index information to obtain refreshed cross index information;
and controlling the main thread to generate a refreshed cross index symbol based on the refreshed cross index information, and updating the cross index symbol according to the refreshed cross index symbol.
2. The cross-indexing method of claim 1, wherein before the controlling main thread obtains cross-index information generated by a cross-indexing thread, the method further comprises:
receiving a first operation instruction; wherein the first operation instruction is used for starting the configuration project;
and controlling the main thread to start the cross index thread in the starting process of the configuration project.
3. The cross-indexing method of claim 2, wherein the cross-index information comprises first cross-index information, and after the controlling the main thread to start the cross-index thread, the method further comprises:
acquiring equipment configuration information and configuration engineering information through the cross index thread;
determining the parallel amount of the targets based on the equipment configuration information and the configuration engineering information;
controlling the cross index thread to start a plurality of cross index sub-threads in the object based on the target parallel quantity, and generating first cross index information; the first cross index information is used for indicating an index relation in an object in the configuration engineering.
4. The method of cross-indexing of claim 3, wherein the cross-index information further comprises second cross-index information; after the generating the first cross-index information, the method further comprises:
controlling the cross index thread to start a cross-object cross index sub-thread to generate second cross index information; and the second cross index information is used for indicating the index relation among the cross objects in the configuration engineering.
5. The method of cross-indexing as claimed in claim 4, wherein after said controlling the cross-indexing thread to initiate a cross-object cross-indexing child thread, generating second cross-indexing information, the method further comprises:
controlling the cross-object cross index sub-thread to check the second cross index information to obtain alarm information corresponding to the second cross index information; wherein the alarm information is used for indicating error information in the second cross index information;
and displaying the alarm information in the configuration project.
6. The method of cross-indexing of claim 1, further comprising:
when a second operation instruction is received, determining that a modification event occurs in the configuration project; the second operation instruction is used for controlling the main thread to modify one object in the configuration project so as to determine the modified object.
7. The cross-indexing method of claim 6, wherein in the event of a modification event in the configuration project, the method further comprises:
controlling the main thread to set a modification mark for the modified object;
correspondingly, the controlling the cross index thread to refresh the cross index information to obtain the refreshed cross index information includes:
controlling the cross index thread to judge whether the configuration project has the modification mark or not based on the preset cycle duration;
and if so, controlling the cross index thread to refresh the cross index information based on the modification mark to obtain refreshed cross index information.
8. The method of cross-indexing of claim 7, wherein after the obtaining refreshed cross-index information, the method further comprises:
and controlling the cross index thread to reset the modification mark.
9. The method of cross-indexing of claim 7, wherein prior to the receiving the second operation instruction, the method further comprises:
controlling the main thread to set a pause mark; wherein the pause flag is used to indicate that the cross-indexed thread enters a paused state;
accordingly, after the controlling the main thread sets a modification flag to the modified object, the method further comprises:
controlling the main thread to reset the pause flag to cause the cross-indexed thread to exit a paused state.
10. The method of cross-indexing of claim 1, further comprising:
receiving a third operation instruction; wherein the third operation instruction is used for exiting the configuration project;
controlling the main thread to send an exit signal to the cross index thread in the exit process of the configuration project; wherein the exit signal is used to indicate the cross-indexed thread to exit.
11. The cross-indexing method of claim 1, wherein after the generating cross-index symbols based on the cross-index information, the method further comprises:
controlling the main thread to display the cross index symbol in a preset page of the configuration project;
accordingly, after the updating the cross-index symbols according to the refreshed cross-index symbols, the method further comprises:
and controlling the main thread to display the refreshed cross index symbol in the preset page.
12. The method of claim 11, wherein before the controlling the main thread to show the cross index symbol in a preset page of the configuration project, the method further comprises:
determining a functional module corresponding to the cross index symbol in the preset page, and establishing an association relation between the cross index symbol and the functional module; wherein the incidence relation is used for indicating that the cross index symbol and the functional module move or delete synchronously.
13. A method of cross-indexing according to any one of claims 1 to 12, wherein: the cross-index information includes at least one of: the device number, the page number, the channel type, the input and output node number, the branch number, the module number, the channel name, the attribute name and the attribute display name.
14. A cross indexing device is characterized by comprising an acquisition unit, a modification unit and a refreshing unit; wherein,
the acquiring unit is configured to control the main thread to acquire cross index information generated by a cross index thread and generate a cross index symbol based on the cross index information;
the modification unit is configured to control the cross index thread to refresh the cross index information under the condition that a modification event occurs in a configuration project, and obtain refreshed cross index information;
the refreshing unit is configured to control the main thread to generate a refreshed cross index symbol based on the refreshed cross index information, and update the cross index symbol according to the refreshed cross index symbol.
15. A cross-indexing apparatus, comprising a memory and a processor; wherein,
the memory for storing a computer program operable on the processor;
the processor, when executing the computer program, configured to perform the steps of the method according to any of claims 1 to 13.
16. A computer storage medium, characterized in that the computer storage medium stores a cross-indexing program, which when executed by a processor implements the steps of the method according to any one of claims 1 to 13.
CN202010475407.5A 2020-05-29 2020-05-29 Cross indexing method, device, computer storage medium and equipment Active CN111651640B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010475407.5A CN111651640B (en) 2020-05-29 2020-05-29 Cross indexing method, device, computer storage medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010475407.5A CN111651640B (en) 2020-05-29 2020-05-29 Cross indexing method, device, computer storage medium and equipment

Publications (2)

Publication Number Publication Date
CN111651640A CN111651640A (en) 2020-09-11
CN111651640B true CN111651640B (en) 2022-07-22

Family

ID=72352711

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010475407.5A Active CN111651640B (en) 2020-05-29 2020-05-29 Cross indexing method, device, computer storage medium and equipment

Country Status (1)

Country Link
CN (1) CN111651640B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112363761B (en) * 2020-11-09 2022-08-02 西安热工研究院有限公司 Algorithm page variable reference method supporting dynamic relocation
CN113311788A (en) * 2021-04-13 2021-08-27 南京南瑞继保电气有限公司 Variable configuration processing method and device, computer storage medium and equipment
CN113220229B (en) * 2021-05-06 2023-02-28 浙江正泰中自控制工程有限公司 Online I/O undisturbed configuration method for distributed control system
CN113703413B (en) * 2021-11-01 2022-01-25 西安热工研究院有限公司 Data interaction method, system, equipment and storage medium based on secondary index
CN113778043B (en) * 2021-11-15 2022-02-11 西安热工研究院有限公司 Data point reference jumping method, system, equipment and medium for configuration tool

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102103623A (en) * 2010-09-29 2011-06-22 长沙博为软件技术有限公司 Cross index identification method for health file sharing platforms
CN108717860A (en) * 2018-04-28 2018-10-30 中南大学湘雅医院 Patient information cross index manager and establishing method thereof
CN110020321A (en) * 2018-04-13 2019-07-16 深圳壹账通智能科技有限公司 Generation method, device, equipment and the computer storage medium of product index

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102103623A (en) * 2010-09-29 2011-06-22 长沙博为软件技术有限公司 Cross index identification method for health file sharing platforms
CN110020321A (en) * 2018-04-13 2019-07-16 深圳壹账通智能科技有限公司 Generation method, device, equipment and the computer storage medium of product index
CN108717860A (en) * 2018-04-28 2018-10-30 中南大学湘雅医院 Patient information cross index manager and establishing method thereof

Also Published As

Publication number Publication date
CN111651640A (en) 2020-09-11

Similar Documents

Publication Publication Date Title
CN111651640B (en) Cross indexing method, device, computer storage medium and equipment
CN110020323B (en) Page switching method and system for hybrid application, computer equipment and storage medium
KR101669783B1 (en) Visualizing recorded executions of multi-threaded software programs for performance and correctness
CN108334585A (en) A kind of spiders method, apparatus and electronic equipment
US11269692B2 (en) Efficient sequencer for multiple concurrently-executing threads of execution
CN105528231A (en) Intermediate auxiliary function-based method and intermediate auxiliary function-based system for dynamically updating software
CN113296786B (en) Data processing method, device, electronic equipment and storage medium
CN110059023B (en) Method, system and equipment for refreshing cascade cache
CN113311788A (en) Variable configuration processing method and device, computer storage medium and equipment
US9274875B2 (en) Detecting memory hazards in parallel computing
US20140019849A1 (en) Extensible Content Focus Mode
WO2014125338A1 (en) A method of operating a multi-thread capable processor system, an automotive system comprising such multi-thread capable processor system, and a computer program product
CN109885489B (en) Data race detection method and device in driver
CN114490856A (en) Database WAL (Web independent language) disk-dropping method and system based on IOURING technology
CN101826017A (en) Granule-oriented programming, integrating and developing platform
US11467857B2 (en) Intelligently sensing digital user context to generate recommendations across client device applications
CN117252559A (en) Business process processing method, device, computer equipment and storage medium
CN117573255A (en) Interface refreshing method, device and medium for graphical application
CN111881212A (en) Method, device, equipment and storage medium for executing check point operation
EP2176761A1 (en) Object model for transactional memory
KR20200086093A (en) Apparatus and method for analyzing source code of concurrent program and computer readible storage medium therefor
CN113641871B (en) Lock-free hashing method, device, equipment and medium
Akscyn et al. Design of hypermedia script languages: the KMS experience
KR20200140210A (en) Idempotent kernel generateing method and apparatus
CN118192983A (en) Language compiling method, electronic device and storage medium

Legal Events

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