A task processing method based on event rules
By employing an event-rule-based task processing method in semiconductor manufacturing plants, utilizing Rete networks and standardized event objects, the problems of wasted computing resources and response latency in existing technologies are solved. This enables multi-system collaborative processing and dynamic rule adjustment, improving system response efficiency and availability.
Patent Information
- Application Number
- CN202611336532.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies for task processing in semiconductor manufacturing plants suffer from problems such as wasted computing resources, response delays, and difficulty in dynamically adjusting rules. In particular, they cannot achieve cross-system collaborative processing in scenarios involving multiple sources and multiple conditions that trigger complex events.
The task processing method based on event rules is adopted. By receiving event patterns and task templates, it is compiled into Rete network instances, converted into standardized event objects with a unified data structure, and incremental event pattern matching is performed. Combined with real-time factory context information, task priority arbitration and execution are carried out.
It achieves low-complexity event matching, reduces response latency, minimizes invalid calculations, supports complex triggering logic linkage across multiple systems, and dynamically adjusts rules without interrupting event processing, thereby improving system availability and flexibility.
Smart Images

Figure CN123177992A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of task data processing technology, and is a task processing method based on event rules. Background Technology
[0002] In semiconductor manufacturing plants, the execution of production tasks heavily relies on various real-time status information. Traditional task processing methods primarily employ a periodic scanning model, where the system polls the status of all equipment and materials at fixed time intervals, executing the corresponding task when conditions are met. This model suffers from significant waste of computational resources, with numerous polling operations incurring unnecessary overhead when the status remains unchanged, and the response latency, in the worst case, approaching a complete polling cycle. Another approach is a fixed-trigger model, which triggers a pre-set single task when a specific event occurs. While this provides timely responses, the rules are tightly coupled with the task logic, making it unsuitable for handling complex event triggering scenarios involving multiple sources and conditions. Some existing systems have introduced event-driven mechanisms; however, event types and processing logic are typically hard-coded into the program, making it difficult to dynamically add, delete, or modify rules, and hindering collaborative event processing across material handling systems, real-time dispatching systems, and robot management systems. Summary of the Invention
[0003] The purpose of this section is to outline some aspects of embodiments of the present invention and to briefly describe some preferred embodiments. Simplifications or omissions may be made in this section, as well as in the abstract and title of this application, to avoid obscuring the purpose of these documents; however, such simplifications or omissions should not be construed as limiting the scope of the invention.
[0004] To address the technical problems existing in the background art, the present invention provides a task processing method based on event rules, comprising the following steps: Receive event rules containing event patterns and task templates, validate the event rules, and compile the validated rules into Rete network instances; Receive heterogeneous raw events from different external subsystems, and convert the heterogeneous raw events into standardized event objects with a unified data structure according to the mapping rules corresponding to the event source and event type; The event pattern matching engine routes the standardized event object to the corresponding Rete network instance based on the event type, performs incremental event pattern matching, and generates a rule trigger result object when all event conditions of the rule are met. The task execution layer triggers the result object to load the corresponding task template according to the rules, and generates a task instance by combining the real-time collected factory context information. The task instance is then subject to priority arbitration, and the arbitrated task instance is sent to the corresponding external subsystem for execution.
[0005] Preferably, the validation of the event rules includes: performing lexical and syntactic validation, reference validity validation, and rule conflict checking on the rule definition data; wherein, the rule conflict checking converts the event type, field comparison conditions, and resource keys into a constraint set and performs intersection judgment to identify potential resource conflicts.
[0006] Preferably, compiling the validated rules into a Rete network instance includes: creating a type node and a set of Alpha nodes for each atomic event, constructing a Beta node network, and creating memory storage areas for Alpha nodes and Beta nodes respectively; wherein, the Rete network instance sets a global type index table with the event type as the key at the event entry point, and performs composite node merging on consecutive Alpha conditions.
[0007] Preferably, converting the heterogeneous raw events into standardized event objects with a unified data structure includes: sequentially performing protocol identification and integrity verification, mapping rule retrieval, field extraction, field value conversion and normalization, standardized event object assembly and default value filling, and data validity verification through a multi-layer adaptation architecture consisting of a driver layer, an adapter layer, and a proxy layer.
[0008] Preferably, the event pattern matching engine performs incremental event pattern matching by: performing duplicate event verification on the received standardized event objects; routing them to the corresponding type nodes according to the event type; performing single event condition filtering through the Alpha node chain; performing multi-event connection testing through the Beta node, and generating a partial matching state when the sequence, non-event, and / or logical combinations are satisfied; and generating a rule trigger result object when all event conditions of the rule are satisfied.
[0009] Preferably, the step of generating task instances by combining real-time collected factory context information and prioritizing the task instances includes: collecting context information including real-time coordinates of the aerial transport vehicle, traffic congestion index, task queue depth, processor load, equipment health score, electricity price period, and factory shift; the task instantiation module corrects task parameters based on the context information; the priority arbitrator divides the task instances into conflict sets according to resource keys, sorts them based on a normalized comprehensive score of rule priority, business urgency, waiting time, and deadline, and supports preemption of high-priority tasks.
[0010] Preferably, the process of distributing the arbitrated task instance to the corresponding external subsystem for execution includes: the task dispatcher selecting a protocol adapter according to the target subsystem, converting the task instance into the target protocol format and sending it, and using the task instance identifier for idempotency verification and retries.
[0011] Preferably, the method further includes: when updating the rules, generating a new version of the Rete network instance for add, modify, or enable operations, and generating a network configuration that does not contain the target rule branch for delete or disable operations; after sandbox verification and shadow parallel operation, atomically switching the active version reference; after switching, the old version network instance retains the incomplete matching state until it expires.
[0012] Preferably, the sandbox verification includes: rerunning the old and new versions of the Rete network instance using the same historical event replay sequence, initial state and context snapshot, calculating the trigger consistency rate, parameter difference rate and matching latency, and entering the shadow parallel running stage only when all indicators meet the preset threshold.
[0013] Preferably, the method is deployed in a central scheduling server, edge computing node, or distributed computing cluster in a semiconductor manufacturing plant to achieve collaborative scheduling among material handling systems, real-time dispatching systems, robot control systems, and equipment automation programs.
[0014] Compared with the prior art, the technical effects of the present invention are as follows: 1. This invention uses an event-driven mechanism to replace periodic polling, and achieves incremental matching through an improved Rete network and Alpha Memory hash index. The matching operation has low time complexity, reduced response latency, and no invalid computational overhead when there is no state change.
[0015] 2. The event mode of this invention supports AND, OR, NOT, and sequence logic combinations of multi-source atomic events and time window constraints, which can realize the automated linkage of complex trigger logic involving multiple systems such as dispatching, transportation, and equipment status.
[0016] 3. This invention adopts a dual-version grace period switching strategy to achieve hot rule updates, supporting the addition, modification, and deletion of rules without interrupting event processing. The update process goes through sandbox verification, shadow parallel operation, and atomic route switching stages, taking into account both the high availability requirements of continuous system operation and the dynamic adjustment requirements of business rules. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein: Figure 1 This is a schematic diagram of the logical architecture of a task processing system based on event rules according to the present invention; Figure 2This is a schematic diagram illustrating the rule definition, event matching, and task generation process of an event rule-based task processing method according to the present invention. Figure 3 This is a timing diagram illustrating the event interaction and task collaboration between various software systems when the present invention is applied to an emergency batch order insertion scenario. Figure 4 This diagram illustrates a comparison of response latency between the periodic polling processing mode and the event-driven processing mode employed in this invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.
[0019] This invention provides an event-rule-based task processing method. This method can be deployed in a central scheduling server, edge computing nodes, or distributed computing cluster in a semiconductor manufacturing plant to achieve collaborative task scheduling among multiple heterogeneous subsystems, such as Material Control System (MCS), Real-Time Dispatching (RTD), Robot Control System (RCS), and Equipment Automation Program (EAP). This method compiles business rules into an incrementally matchable Rete network, standardizes heterogeneous raw events into unified standardized event objects (StandardizedEventObjects, hereinafter referred to as standardizedEvent objects), and performs task orchestration and arbitration based on context awareness. This reduces redundant calculations caused by periodic polling and improves the timeliness and configurability of cross-subsystem event triggering and task collaborative processing.
[0020] The technical solution of the present invention will be described in detail below through several embodiments.
[0021] Example 1: S1. Receive event rules defined by the user or upper-layer application, which include event patterns and task templates. Perform lexical and syntactic checks, reference validity checks, and conflict checks on the event rules. Compile the rules that pass the checks into Rete network instances. The Rete network instance contains type nodes, Alpha nodes, Alpha Memory, Beta nodes, Beta Memory, and terminal nodes. Establish a global first-level index based on event type and an internal hash second-level index of AlphaMemory based on the value of the bound variable field.
[0022] Specifically, the system provides a rule configuration interface, which is a graphical user interface.
[0023] Users define event rules through this interface, and the rule definition data is submitted to the system in a structured format such as JSON.
[0024] Each event rule consists of the following three components: The first part is the event pattern, which is used to define the logical combination of one or more atomic events required to trigger the rule.
[0025] Supported logical combination types include AND, OR, NOT, SEQUENCE, and any nested combinations thereof.
[0026] Each atomic event must contain at least: an event source identifier, which specifies the source subsystem of the event (such as MCS, RTD, EAP); an event type, which specifies the type name of the event (such as Equipment.Idle, LotAvailable); an optional constraint expression, which applies filtering conditions to the event payload properties; and an optional bind declaration, which declares the key fields that need to be extracted and stored in the rule-shared scope after the atomic event matches successfully.
[0027] The second part is the task template, which defines one or more tasks to be generated and executed after the rule is triggered. Each task must include at least: task type (e.g., dispatch instruction, transport instruction), target subsystem identifier, and task parameter list. Task parameters support a dynamic binding mechanism based on placeholder syntax, with the placeholder format being ${expression}.
[0028] Expressions are evaluated in real time when a rule is triggered. Data sources that can be referenced include: current event properties (such as ${event.payload.lotID}), cross-event references (such as ${E1.lotID}, which references event field bound variables of other matched atomic events through event aliases), rule-level variables (variables predefined by the ruleVars field when the rule is defined), system-level global variables (read-only configuration constants maintained by the system configuration center), and built-in functions (such as the string substring function fn.substring() and the current time function fn.now()).
[0029] Among them, event field binding variables are declared using bind, rule-level variables are declared using rule Vars, and system-level global variables are system configuration constants.
[0030] In this embodiment, the variable lookup priority is as follows: event local scope, event field bound variables, rule-level variables, system-level global variables, and built-in functions.
[0031] The third part consists of rule attributes, including: rule priority (an integer ranging from 1 to 100, with higher values indicating higher base priority), rule validity period (specifying the start and end times from which the rule version can receive production events), maximum number of triggers, trigger cooldown interval, and enabled status. Both the maximum number of triggers and the trigger cooldown interval correspond to a trigger scope key. The trigger scope key is generated by one or more event fields explicitly specified in the rule, such as device identifier, batch identifier, or handling task identifier. When no trigger scope key is configured, the rule identifier is used as the global scope.
[0032] The system uses a rule identifier, rule version, and trigger scope key to form a trigger status key, and records the cumulative number of triggers and the time of the most recent trigger within that scope. A new rule trigger result object is allowed to be generated only if the cumulative number of triggers has not reached the maximum number of triggers, and the difference between the current logical processing time and the time of the most recent trigger is not less than the trigger cooldown interval.
[0033] After receiving the rule definition data, the system performs the following verification steps in sequence: First, lexical and syntactic verification, checking the integrity of the JSON structure, the correctness of field types, and the syntactic compliance of placeholder expressions; Second, reference validity verification, verifying whether the event source and event type have been registered in the system metadata, verifying whether the field path referenced in the placeholder exists in the event load schema of the corresponding event type, and verifying whether the alias referenced across events is declared in the event schema; Third, rule conflict check, which is performed only on rule conditions that can be statically analyzed.
[0034] The system converts event types, field comparison conditions, finite set memberships, numerical range conditions, event time windows, and resource keys declared in task templates into constraint sets. For conditions containing only equality, inequality, numerical ranges, and finite set memberships, the system compares the intersection of the corresponding constraint sets to determine if the triggering conditions of two rules can be simultaneously met. If the triggering conditions of two rules intersect, and the task instances generated by the two rules have the same resource key, and at least one task instance declares exclusive access to the resource, then the two rules are marked as potential resource conflicts.
[0035] For conditions that include custom script functions, runtime external service calls, or dynamic expressions that cannot be statically evaluated, the system will mark the corresponding rules as not statically valid and transfer them to the sandbox for replay verification.
[0036] After successful verification, the system persistently stores the rule in the rule base database and assigns it a unique rule identifier and version number. It should be noted that the rule identifier uniquely identifies the same business rule, while the rule version number distinguishes different definition versions of the same business rule and monotonically increments within the version chain corresponding to the rule identifier.
[0037] Simultaneously, after successful verification, the system compiles the rules and converts them into Rete network instances. The Rete network instance referred to in this article is a global type index table set at the event entry point of the Rete network, using the event type as the key, and merging composite nodes for consecutive alpha conditions in the same rule branch that depend only on a single standardized Event object.
[0038] The global type index table is used to directly route standardized Event objects to rule branches that subscribe to the corresponding event type; composite Alpha nodes are used to execute multiple single event conditions of the same rule branch sequentially in a single function call.
[0039] The specific sub-steps for the system to compile the rules are as follows: S101, Event Pattern Parsing: The system parses the event pattern definition and constructs an abstract syntax tree.
[0040] It should be noted that in this syntax tree, each leaf node represents an atomic event, and each internal node represents a logical operator. If the rule contains nested logic (such as (E1 AND E2) ORE3), then the syntax tree will have a corresponding multi-level nested structure.
[0041] S102. Alpha Network Construction: For each atomic event, the system creates an Alpha node chain. First, a type node is created, which uses the event type string as the routing key and is responsible for distributing arriving standardized Event objects only to the rule branches listening for that event type. Downstream of the type node is a set of Alpha nodes, each Alpha node corresponding to an atomic comparison operation in the constraint expression.
[0042] For example, the conditional expression payload.priority>=90ANDsource.type=='etch' is broken down into two Alpha nodes: the first Alpha node encapsulates the value of the payload.priority field of the comparison operation reads the event and compares it with the constant 90 for greater than or equal to; the second Alpha node encapsulates the value of the source.type field of the comparison operation reads the event and compares it with the string constant 'etch' for equality.
[0043] For example, to improve execution efficiency, the compiler optimizer merges multiple sequential Alpha nodes within the same rule into a single composite condition judgment node. This composite node performs all atomic comparison operations at once, reducing the transmission overhead between nodes.
[0044] S103. Beta Network Construction: The system constructs a Beta node network based on logical operators. For the AND operation, the system constructs a two-input Beta node, with its left input coming from the AlphaMemory of the preceding event and its right input coming from the AlphaMemory of the current event. This Beta node encapsulates a connection test function to check whether the two events satisfy the association condition (e.g., the lotID of E1 is equal to the lotID of E2).
[0045] For a chained combination of multiple AND events (such as E1ANDE2ANDE3), the system constructs cascaded Beta nodes, with the output (BetaMemory) of the previous Beta node serving as the left input of the next Beta node.
[0046] For OR operations, the system independently builds an Alpha network for each branch and constructs an OR Beta node at the confluence. This node transmits an activation signal downstream when a new event arrives in the AlphaMemory of any branch.
[0047] For sequence patterns to The system, based on the AND network, adds timestamp order checking logic to the connection test function of the Beta node; that is, only when the connection order is checked is the sequence checked correctly. The event occurred earlier than A valid sequence match is formed when the two events occur at the same time and satisfy the association field constraints and event time window constraints defined in the rule.
[0048] For NOT operations, the system constructs a negative Beta node, which continuously monitors whether a standardized event of the negative event type arrives within a specified time window. If no such event is detected within the window, the negative Beta node is triggered and sends an activation signal to the terminal node.
[0049] S104. Memory storage area construction and index establishment: The system creates an AlphaMemory storage area for each Alpha node and a BetaMemory storage area for each Beta node.
[0050] Alpha Memory is used to store all valid normalized Event instances and their bound variables filtered by Alpha, and its internal data is organized using a hash index structure.
[0051] The hash index is established based on the binding declaration of atomic events: the system extracts the fields specified in the binding declaration (such as lotID), uses the actual value of the field in the normalized event as the hash key, and uses the list of normalized event instances (chaining method to handle the same key-value collision) as the hash value.
[0052] In this embodiment, Beta Memory is used to store partial matching status objects. These objects include at least: rule identifier, rule version, set of matched event identifiers, earliest event occurrence time, most recent event occurrence time, and status expiration time, as well as the set of binding variables extracted from each event and the current matching progress position (pointing to the next Beta node to be matched).
[0053] S105. Terminal Node Construction: The system constructs a terminal node at the final convergence point of the Rete network. This terminal node stores the unique identifier of the current rule and a reference pointer to the corresponding task template. When the matching activation signal is transmitted to the terminal node, it signifies that all event conditions for the rule have been met, triggering the subsequent task execution process.
[0054] S106. Global Index Registration: After compilation, the system registers each type of node in the newly generated Rete network instance to the global type index table. This global type index table is a thread-safe hash mapping structure, where the key is the event type string and the value is a list of all types of nodes that have subscribed to that event type.
[0055] It should be noted that this index allows the event routing operation in step S3 to directly locate the relevant rule branch without traversing all rules.
[0056] S2. Receive heterogeneous raw events from different subsystems, utilize a multi-layered adaptation architecture consisting of a driver layer, an adapter layer, and a proxy layer, and based on configurable mapping rules and a set of predefined field conversion functions, gradually convert the heterogeneous raw events into standardized Event objects with a unified data structure, and publish the standardized Event objects to the Event Bus.
[0057] For example, different subsystems in a semiconductor factory use different communication protocols and data formats. Equipment automation systems typically use the SECS / GEM protocol to transmit binary-encoded SECS-II messages via HSMS or RS-232; material handling systems typically provide HTTP RESTful APIs with data in JSON format; some sensors and programmable logic controllers use the Modbus TCP protocol; and robot management systems may use vendor-specific TCP protocols.
[0058] The multi-layered adaptation architecture consists of three layers from bottom to top: the first layer is the driver layer, which is responsible for the underlying physical communication.
[0059] The driver layer encapsulates the underlying communication details such as TCPSocket connection management, serial port read / write, and HTTP client, providing a unified data stream read / write interface to the upper layer. Each driver instance is bound to a physical connection or a communication endpoint.
[0060] The second layer is the adapter layer, which is the core layer of the architecture. Each adapter instance corresponds to a specific subsystem connection and embeds a parser for the corresponding protocol. The adapter receives the raw byte stream or text stream from the driver layer and uses the protocol parser to parse it into an intermediate data structure in key-value pair form. The adapter is also associated with a mapping rule instance, which defines the correspondence between fields of the intermediate data structure and fields of the standardized Event object.
[0061] The third layer is the proxy layer, used to handle legacy systems that cannot be directly modified. The proxy is deployed as an independent sidecar process on the legacy device side, converting the device's private protocol into standard message protocols such as MQTT, and then connecting to the adapter layer via the standard protocol.
[0062] Mapping rules are a set of configurations that describe the correspondence between fields, and their generation supports three methods: One method is manual configuration, where users specify the mapping relationship between the original field paths and the standard field paths one by one through the interface or configuration file; Secondly, there is template generation. The system has pre-set mapping templates for common protocols such as SECS / GEM and Modbus. After the user selects a template, the system automatically generates most of the mapping relationships, and the user only needs to make minor adjustments. Thirdly, there is automatic recommendation. The system uses the edit distance algorithm to calculate the string similarity between the original field name and the standard field name, and automatically recommends pairs with similarity higher than a preset threshold (such as 0.8) to the user for confirmation.
[0063] For example, in this embodiment, the mapping rules adopt a hierarchical storage strategy, including: the most frequently accessed hot rules are cached in memory in the form of a hash table to achieve sub-microsecond access latency; all rules and all historical versions are persistently stored in a relational database to support version backtracking and auditing; archive rules that have not been used for more than a year are serialized and stored in a distributed file system in the form of JSON files to save database storage space.
[0064] The standardized Event object's data structure is a predefined, unified format, containing at least the following fields: a globally unique event identifier, a string generated using the `event-` prefix followed by a UUID; the event occurrence time (i.e., the actual time the business state recorded by the event source occurred), a string conforming to the ISO 8601 standard; the event reception time (i.e., the system time when the adapter layer first received the original event), recording the moment the system received the event; the event source identifier, recording the identifier of the subsystem that generated the event; the event type, a string using dotted-part naming convention (e.g., `Equipment.Idle`); the event-associated object identifier, recording the identifier of the associated main device or material carrier; the event payload, a collection of key-value pairs storing the business attribute data carried by the event; the event priority, an optional field used to mark the urgency level; and a tracing identifier used for distributed call chain tracing.
[0065] It should be noted that the judgments involving the order of events, sequence patterns, and event time windows are all based on the time of event occurrence; the judgments involving processing timeouts and system performance measurements are based on the processing time (i.e., the system time used by the event pattern matching engine when processing standardized Event objects).
[0066] When a raw event arrives at the adapter layer, the system executes the standardized conversion pipeline according to the following sub-steps: S201. The system identifies the communication protocol used by the original event by analyzing the source IP address, port number, message header characteristic bytes, or URL path of the data packet.
[0067] After identifying the protocol, perform integrity checks on the data packets. For example, calculate the checksum of SECS / GEM messages and compare it with the checksum field in the message. For HTTP requests, check whether the Content-Length matches the actual Body length.
[0068] S202. Based on the identified event source system and event type (if this can be preliminarily determined from the raw data), the system retrieves the corresponding mapping rule from the memory cache. If the cache is not found, the system loads the rule from the database and backfills the cache.
[0069] If no mapping rule is found that corresponds to the event source and event type, the system will save the original fields to an isolated unmapped event record for subsequent configuration of mapping rules and fault analysis. Only when the event source is included in the pass-through whitelist and the corresponding event payload structure definition has explicitly declared the fields, field types and units that are allowed to be retained, can a standardized Event object be generated according to the pass-through mapping.
[0070] S203. The system extracts the original field values from the parsed intermediate data structure based on the original field path expressions defined in the mapping rules.
[0071] For example, for nested JSON structures, field paths use dotted decimal notation (e.g., data.equipment.id); for SECS / GEM messages, field paths use SVID or CEID numbers.
[0072] S204. Field Value Conversion and Normalization. The system sequentially applies the chain of conversion functions specified in the mapping rules to each extracted raw field value. The system's pre-defined conversion functions include, but are not limited to: type conversion functions toInt (converts strings or floating-point numbers to integers), to String (converts to strings), and to Float (converts to floating-point numbers); the status mapping function map Status, which internally maintains a configurable key-value lookup table, for example, mapping the raw status code string RUN to the standard status string BUSY, and IDLE to IDLE; the time format normalization function to ISO 8601, which recognizes various common date and time formats and uniformly converts them to the ISO 8601 standard format; the unit conversion function unitConvert, for example, converting Fahrenheit temperature values to Celsius; and the custom script function script, allowing users to write scripts to perform complex conversion logic on field values.
[0073] The transformation function chain is executed sequentially according to the configuration order, with the output of the previous function serving as the input of the next function.
[0074] Each field with a physical quantity meaning is configured with its physical quantity type, input unit, standard unit, and value range in the event load structure definition.
[0075] The unit conversion function only allows conversions between compatible units of the same physical quantity type and converts the result to the standard unit corresponding to that field.
[0076] Custom script functions are executed in an isolated sandbox environment. The sandbox only exposes the current field values, whitelisted standard functions, and read-only configuration parameters to the script.
[0077] The system sets the maximum execution time and maximum memory usage for each script execution. If the script execution times out, an exception occurs, or the output type does not meet the mapping rule requirements, the current field conversion is marked as failed, and the system will execute one of the following exception handling strategies: discard the event, use the default value, or enter the exception event queue.
[0078] S205. The system assembles the converted field values according to the data structure definition of the standardized Event object.
[0079] For fields declared as required in the mapping rules but which cannot be extracted from the original event and for which no business default value is configured, the system marks the standardized Event object as a validation failure.
[0080] For fields declared as optional, the system either preserves the field's missing state or fills it with the default value explicitly configured for that field in the event payload structure definition.
[0081] The default value must be consistent with the field type, unit, and value range, and must have a configuration basis in the corresponding event payload structure definition.
[0082] S206. The system performs a final validation on the assembled standardized Event object, including: checking whether all required fields (such as event identifier, event occurrence time, and event type) are non-empty; checking whether the values of enumerated fields (such as event type) are within the system's predefined valid value range; and checking whether the event occurrence time... and event reception time To determine the reasonableness of the timing sequence, both conditions must be met: ;
[0083] in To allow for clock lead tolerance of the event source, a time unit is provided, which is determined by the clock synchronization configuration corresponding to the event source.
[0084] If this condition is not met, the system will mark the standardized Event object as a time anomaly and discard it or send it to the anomaly event queue according to the event source configuration.
[0085] Once the validation passes, the standardized Event object is marked as ready.
[0086] The generated standardized Event objects are published to the event bus. The event bus employs a publish-subscribe pattern and is built on streaming data platforms such as Apache Kafka. During publication, the eventType field value of the standardized Event object is used as the message subject. The event bus maintains a subscription relationship table between topics and consumers (i.e., the various types of nodes in the event pattern matching engine in step S3), and pushes standardized Events to all matching consumers in real time based on this table. This mechanism minimizes the coupling between event producers and consumers, allowing each subsystem to evolve and deploy independently. Adding a new event source or event type only requires adding the corresponding adapter and subscription relationship, without modifying existing business logic.
[0087] S3. The event pattern matching engine, acting as a consumer of the event bus, consumes the standardized Event objects in real time. It performs incremental matching based on the loaded Rete network instance, routes events through a global type index, filters single-event conditions through the Alpha node chain, performs fast association lookup through the Alpha Memory hash index, conducts multi-event connection testing through Beta nodes, maintains and updates the partial matching status of each active rule in the global partial matching status table, processes the event time window constraints defined in the rules, and when all event conditions of a rule are met and reach the terminal node, it aggregates the matched event context, encapsulates it into a rule trigger result object, and outputs it to the task execution layer.
[0088] Specifically, the event pattern matching engine is the core computational component of the task processing method of this invention. During the initialization phase, the engine loads all rules that are enabled and within their validity period from the rule base, and loads their compiled Rete network instances into memory.
[0089] The engine also initializes a global partial match status table, which tracks all active, not yet fully matched rule instances and their current progress.
[0090] When a new standardized Event object is pushed to the engine from the event bus, the engine performs the following sub-steps for incremental matching: S300. When the event pattern matching engine receives a standardized Event object, it uses the event source identifier and the globally unique event identifier to form an event idempotent key, and then queries the deduplication status table for the event idempotent key.
[0091] The system pre-calculates all active rules for each event type based on the event type and establishes a schedule for deduplicating and retaining events by type. For event types... Its deduplication retention time Defined as: ; in, For subscribed event types The set of active rules, For rules Event time window, For rules Allowed lateness time. If If the value is empty, the normalized Event object will only record short-term reception logs. If the idempotent key for the event already exists in the deduplication state table, the current processing of the normalized Event object will be terminated; otherwise, the idempotent key will be written to the event, and event type routing will continue. The event processing status in the deduplication state table includes at least "processing" and "completed". When an event is received for the first time, the idempotent key is written to the "processing" status; after the normalized Event object completes event type routing and rule network reception, it is updated to the "completed" status. If the "processing" status is not updated to "completed" after the processing timeout period, the event can be reprocessed through the recovery process.
[0092] S301. The engine first extracts the event Type field value of the standardized Event object and uses this value as the key to perform an exact lookup in the global type index table.
[0093] If the search result is a non-empty list, a list of all type nodes that have subscribed to this event type is obtained. If the search result is empty, the event pattern matching engine terminates the rule matching process for this standardized Event object, but still saves the standardized Event object according to the event log retention policy for auditing, rule replay, and subsequent rule configuration. This step, through index pruning, ensures that the engine's computing resources are consumed only on a subset of rules related to the current event.
[0094] S302. For each type node in the type node list, the engine passes the standardized Event object to the Alpha node chain starting from that type node.
[0095] The normalized Event object passes through each Alpha node in the chain in sequence, and each Alpha node executes a compiled atomic conditional function on it. Each Alpha node performs atomic conditional checks on a single normalized Event object, including comparing the field values of the normalized Event object with constants determined at compile time, rule-level read-only variables, or other field values within the normalized Event object.
[0096] In this embodiment, cross-event conditions involving field relationships between two or more standardized Event objects are connected and matched by the Beta node based on the event field binding variables.
[0097] If a normalized Event object successfully passes the condition checks of all Alpha nodes in the chain, then the normalized Event object is marked as a valid event relative to that rule branch; If the condition check fails at any Alpha node, the matching process of the normalized Event object for that rule branch will terminate immediately.
[0098] S303. For valid Events filtered by Alpha, the engine extracts the field values specified in the bind declaration of the atomic event and stores the standardized Event instance along with all its bind variables as a whole in the Alpha Memory corresponding to the rule branch.
[0099] At the same time, the engine uses the actual value of the field specified in the bind declaration as the key to create an index entry pointing to the normalized Event instance in the hash index inside the Alpha Memory.
[0100] S304. After a valid event is stored in the Alpha Memory, the engine notifies the downstream Beta node connected to the Alpha Memory.
[0101] Each Beta node encapsulates a compiled connection test function that takes two normalized Event instances as parameters.
[0102] Taking a typical AND connection scenario as an example, assuming that the newly arrived Event is the right input (R), the Beta node performs a hash lookup from the Alpha Memory corresponding to the left input (L) using the bound variable value (such as lotID) of the right input Event as the lookup key.
[0103] For sequence patterns to Only when The event occurred earlier than A valid sequence match is formed when the two events occur at the same time and satisfy the association field constraints and event time window constraints defined in the rule.
[0104] The newly generated partial matching state object's destination is determined by the current Beta node's position in the network. If other Beta nodes exist downstream of the current Beta node, the partial matching state object is stored in the Beta Memory corresponding to the current Beta node, awaiting the arrival of subsequent Events.
[0105] The same standardized Event object can enter multiple rule branches; for the same rule, different event aliases store candidate events separately. Candidate event combinations that meet all event conditions can form a match, but candidate combinations with the same rule identifier, rule version, and set of associated event identifiers will only generate one rule trigger result object.
[0106] Each partially matched status record includes the rule identifier, rule version, set of matched event identifiers, earliest event occurrence time, most recent event occurrence time, and status expiration time. The status expiration time is determined based on the maximum event time window and allowed lateness time for the corresponding rule.
[0107] When the event time watermark exceeds the state expiration time, the system deletes the matching state and its event records in AlphaMemory and Beta Memory that are no longer referenced by other valid matching states.
[0108] S305. In particular, if the event pattern of a rule contains an event time window constraint, when the first event is successfully matched and a partially matched state is created, the engine records a window start timestamp for that state and starts a corresponding timer task.
[0109] When subsequent events arrive and attempts are made to connect and match, the Beta node's connection test function will additionally calculate the difference between the current event occurrence time and the window's start timestamp, and compare it with the preset window size.
[0110] For event patterns that include non-event conditions, the occurrence time of the preceding event specified in the rule is used as the starting point of the observation window, and the time window length is configured according to the rule. Determine the endpoint of the observation window.
[0111] The system advances the event time watermark based on the occurrence time of received events. Specifically, the system only advances the watermark when the event time watermark exceeds the end of the observation window and the allowed lateness time. The sum of the values is used to determine if the non-event condition is met when no standardized Event object that satisfies the non-event condition is received in the observation window.
[0112] Time window length and allowable lateness time All are time units, and satisfy the following conditions: , It should be noted that standardized Event objects that arrive after the allowed late time are placed in the late event queue. Unless a compensation task template is pre-configured for the corresponding rule, late events do not cancel tasks already sent to external subsystems.
[0113] For OR logic, the engine builds an independent Alpha network and Alpha Memory for each branch.
[0114] When a valid normalized event arrives in the Alpha Memory of any branch, a matching state is generated directly and passed downstream without waiting for events from other branches.
[0115] S306. When the matching activation signal arrives at the terminal node, it signifies that all event conditions defined by the rule (including atomic event conditions, logical combination conditions, and event time window conditions) have been met.
[0116] The engine performs the following operations: First, it retrieves the rule identifier and task template reference pointer from the metadata stored in the endpoint; second, it backtracks along the matching path, collecting all standardized Event instances and their bound variables participating in this matching from each Beta Memory and Alpha Memory, aggregating them into a complete event context object; then, it encapsulates the rule identifier, rule version, current trigger timestamp, and event context object into a rule trigger result object; finally, it pushes the rule trigger result object to the input queue of the task execution layer.
[0117] The rule trigger result object includes at least the rule identifier, rule version, trigger result identifier, trigger time, set of associated event identifiers, standardized Event object references corresponding to each event alias, event field binding variables, task template references, and trigger scope keys.
[0118] The trigger result identifier is deterministically generated based on the rule identifier, rule version, and sorted set of associated event identifiers; at the same time, the engine updates the trigger count and average matching delay metric of the rule in the global statistics.
[0119] S4. Receive the rule-triggered result object, and use a context-aware task orchestration algorithm to evaluate and replace the dynamic parameters in the task template in combination with the real-time collected factory context information to generate specific task instances; use a priority arbitration algorithm based on a multi-factor comprehensive scoring model to resolve conflicts and sort the execution of multiple task instances; and use a task dispatcher to convert the task instances into an instruction format that the target subsystem can recognize and distribute them to the corresponding external subsystems for execution.
[0120] Specifically, this step is responsible for transforming the logical results of rule matching into device operation instructions that have a real impact on the physical world. The task execution layer consists of three interconnected sub-modules: a task instantiation module, a priority arbitrator, and a task dispatcher.
[0121] When the rule trigger result object arrives at the task instantiation module, the module performs the following operations: First, the task instantiation module loads the corresponding task template definition based on the rule identifier and task template reference carried in the trigger result object. Second, the module creates an expression evaluation context. This evaluation context is a hierarchical variable scope stack, with the top layer being the event-local scope of each standardized Event in the current trigger event set (containing the Payload field of each standardized Event), the lower layer being the rule-shared scope (containing event field bound variables declared via bind and rule-level variables rule Vars), and the bottom layer being the global scope (containing system-level global variables and built-in functions). The module iterates through each parameter value in the task template, checking whether it contains a placeholder expression. For parameter values containing placeholders, the module submits them as expression strings to the expression evaluation engine for parsing and evaluation. For exceptions occurring during the evaluation process, if the task parameter has a default value configured in the default Value field of the task template that matches the parameter type and unit, then that default value is used; otherwise, the task instance is marked as having failed parameter evaluation and will not proceed to the priority arbitration and task dispatch steps. The built-in function `fn.now()` reads the logical processing time from the expression evaluation context. During online runtime, the logical processing time is the processing time at the start of task instantiation; during historical event playback, the logical processing time is determined by the playback engine based on the historical event occurrence time and the playback clock.
[0122] Meanwhile, the task instantiation module calls a context-aware orchestration algorithm to dynamically correct task parameters. The system has an independent context acquisition service that periodically collects real-time factory context information from the following data sources: real-time coordinates of each Overhead Hoist Transport (OHT) and traffic congestion index of each transport segment from the MCS location service; current task queue depth and processor load of each subsystem from the monitoring system; current health score of each device from the EAP (generated by the EAP or equipment health management system according to its existing assessment rules); and current electricity price period and factory shift information from the time service. The collected context data is aggregated into a context fact base.
[0123] Each context fact must include at least the parameter name, parameter value, unit, data source identifier, collection time, validity period, and version number. The task instantiation module uses the rule trigger time as the query benchmark and selects the latest context fact whose collection time is no later than the rule trigger time and is still valid at the rule trigger time. If no context fact meets the above conditions, the pre-configured exception handling strategy of the task template is executed, including pausing the generation of task instances, using template default values with clear business basis, or transferring the task instance to the manual confirmation queue.
[0124] When correcting task parameters, the orchestration algorithm adjusts the parameters according to a predefined set of correction rules. For example, one correction rule is: when the task type is a transport instruction and the current traffic congestion index of the task's target path exceeds 0.8, the route planning strategy is switched from the shortest path to the smoothest path, and the route planning service is invoked to recalculate the route. The real-time coordinates of the OHT are used to determine the current position of the candidate OHT in the transportation network and serve as the starting point parameter for the route planning service to calculate the network distance from the candidate OHT to the task's starting position. The route planning service uses the current network node of the candidate OHT as the starting point and the network node corresponding to the task's starting position as the ending point. For candidate paths... Calculate the route cost based on the sum of the estimated travel times of the transport segments included in the route: ; in, For transport section The estimated travel time under the current traffic congestion index, in time. The route planning service selects routes that satisfy equipment access constraints and... The smallest candidate path.
[0125] Another correction rule is: when the current period is a peak electricity price period and the task priority is below a certain threshold, add an energy-saving mode flag to the task.
[0126] For example, the current electricity price period is only used for non-urgent energy-saving tasks that can be delayed. For urgent tasks, safety-related tasks, and tasks that have exceeded the latest execution time, the electricity price period does not change their execution order. When the conditions for enabling the energy-saving mode are met, this method only writes the energy-saving mode flag into the task instance and does not directly calculate or issue the OHT running speed.
[0127] MCS determines the actual operating speed based on the safe speed range specified by the OHT equipment manufacturer, the speed limit of the transport section, and the latest completion time of the task. If enabling energy-saving mode would cause the task to exceed the latest completion time, MCS ignores the energy-saving mode flag and executes the normal speed strategy.
[0128] In addition, another modified rule is: when the health score of the target device is lower than the minimum execution threshold corresponding to the device type, the device will not be included in the candidate execution device set.
[0129] The equipment health score is recorded as follows The range of values satisfies: ; The higher the value, the more suitable the equipment condition is for performing the task. The equipment health score is generated by the EAP or equipment health management system according to its existing equipment condition assessment rules.
[0130] Factory shifts are used to select pre-configured shift scheduling strategies or the set of weights corresponding to shifts.
[0131] For processor load Processor load is used to determine whether the target subsystem meets the task reception conditions. It is the proportion of the processor busy time of the target subsystem within the specified sampling window to the total duration of the sampling window, with a value range of [value missing]. Processor load According to the length The calculation of the sliding sampling window, It has a unit of time. When continuous Each sampling period satisfies At that time, the target subsystem Remove from the candidate target set; when consecutive Each sampling period satisfies At that time, the target subsystem Restore to the candidate target set and satisfy .
[0132] For task queue depth This parameter is the target subsystem. The number of tasks currently in a waiting or pending state, expressed in task count. Assume the maximum configured task queue depth is [value missing]. .
[0133] Only when satisfied At that time, the target subsystem Enter the candidate target set; when At that time, the target subsystem New task instances are not being accepted at this time. and The units are all for the number of tasks.
[0134] Through the above steps, the task instantiation module generates one or more specific task instances for each task template in the rule triggering result. Each task instance is a data structure that includes at least the task instance identifier, task type, target subsystem identifier, task parameter set, generation time, associated rule triggering result identifier, and task status.
[0135] The task instance identifier is deterministically generated based on the rule identifier, rule version, task template identifier, and a sorted set of associated event identifiers. When the same rule version is used to repeatedly instantiate a task based on the same set of associated events and the same task template, the same task instance identifier will be generated.
[0136] After the expression is evaluated, the task instantiation module performs type, mandatory, unit, and range checks on the actual parameter values according to the task parameter structure definition. Parameters with physical quantity meaning are first converted to the standard units specified in the task parameter structure definition before the range is checked. If any mandatory parameter fails to be validated, the task instance is marked as having failed parameter validation and will not proceed to the priority arbitration and task distribution steps.
[0137] The generated task instances are sent to the priority arbitrator. The priority arbitrator is responsible for resolving the contention for limited execution resources among multiple task instances. First, for each task instance, its execution conditions are determined based on the target subsystem's online status, processor load rejection threshold, minimum device health threshold, resource access mode, and task parameter integrity. Task instances that do not meet the execution conditions are not included in the priority scoring.
[0138] Each task template declares at least one resource key and a corresponding resource access mode. The resource key is used to uniquely identify the device, transport segment, port, vehicle, or target processing unit occupied during task execution; the resource access mode includes shared access and exclusive access. When two task instances to be executed have at least one identical resource key, and at least one of the task instances declares exclusive access to that resource, the two task instances are assigned to the same set of conflicting tasks.
[0139] The arbitrator compares the overall task scores only within the same set of conflicting tasks. The arbitrator calculates an overall score for each task instance. The scoring model is as follows: ; The meanings and calculation methods of each factor are as follows: This is the rule priority normalization factor. Let the original rule priority value be... The range of values is ,when hour: ; when At that time, it was stipulated , .
[0140] This is a normalization factor for task urgency. Let the original task urgency value be... The range of values is ,when hour: ; when At that time, it was stipulated , .
[0141] The waiting time normalization factor is calculated using the following formula: ; in and All units are time; The maximum allowed waiting time for this task type, in time; No unit .
[0142] As a business deadline factor, if a task has a deadline, it can be defined as: ; in This is the latest deadline for completing the task. These are constants for task lead time, and all have a time unit. No unit .
[0143] Weighting factors satisfy and .
[0144] Arbitrators are based on a comprehensive score. Tasks are ranked from highest to lowest score. When overall scores are the same, they are stably sorted sequentially by rule priority, task generation time, and task instance identifier. The task with the highest overall score that meets the execution conditions enters the pending assignment state, while the remaining tasks enter the waiting state. Non-conflicting tasks will not be blocked due to task competition on other resources.
[0145] The arbitrator also implements preemption logic: if a newly arrived high-priority task... Overall rating Exceeding the currently executing task rating The preset preemption threshold has been reached, and If the execution progress is less than halfway complete and the process is in a state where it can be safely interrupted, the arbitrator will issue a preemption command to suspend the process. The execution will immediately allocate resources. The seized Return to the waiting queue.
[0146] After arbitration, a task queue with a defined execution order is formed. The task dispatcher retrieves task instances from the queue sequentially and, based on their target subsystem field, looks up the corresponding communication interface configuration in the subsystem interface registry. The interface registry stores the API endpoint address, authentication credentials, and communication protocol for each external subsystem.
[0147] The task dispatcher selects the corresponding protocol adapter based on the target subsystem identifier in the task instance. Each protocol adapter maintains a unified mapping relationship between task parameter fields and target protocol fields, as well as data type conversion rules and unit conversion rules. Task instances that do not have a corresponding protocol adapter or whose required fields are not mapped are marked as protocol conversion failures.
[0148] After a task is issued, the dispatcher creates a task status tracking object locally. The execution status of a task instance includes at least the following: pending arbitration, waiting, pending dispatch, sent, confirmed, executing, successful execution, failed execution, and pending retry.
[0149] After the task dispatcher completes the protocol conversion and sends the instruction, it updates the task status to "sent"; after receiving the acceptance confirmation returned by the target subsystem for the task instance identifier, it updates the task status to "acknowledged".
[0150] If no confirmation is received after the confirmation waiting time, the task status will be updated to "Pending Retry," and a limited number of retries will be performed without changing the task instance identifier. If no confirmation is received after the maximum number of retries, the task status will be updated to "Execution Failed," and an alarm record will be generated.
[0151] When sending tasks to external subsystems, the task dispatcher carries a task instance identifier as an idempotent identifier. When retrying due to network timeouts, lost acknowledgments, or service restarts, the original task instance identifier must be used again. If the target subsystem returns a response confirming receipt of the same task instance identifier, the task dispatcher considers that response an idempotent acknowledgment.
[0152] S5. While the system is running continuously, the event rules are hot-updated using a dual-version grace period switching strategy. The update operations include adding, modifying, deleting, enabling, and disabling rules. The hot update process goes through five stages: new version loading and compilation, sandbox verification, shadow parallel operation, atomic route switching, and old state recycling. The new version network instance is built and verified without stopping the live Rete network instance from receiving and processing events. The impact of rule updates on the continuity of online event processing is reduced by atomically updating event route references.
[0153] Specifically, semiconductor manufacturing plants require their production scheduling systems to operate continuously 24 / 7, and they are not allowed to shut down for maintenance due to rule adjustments.
[0154] The hot update mechanism provided in this step allows operations and maintenance personnel to dynamically manage rules through API or management interface during system operation. During rule updates, the old version network instance continues to process production events until the new version network instance completes verification and meets the switching conditions, thereby reducing the interruption of event processing caused by rule updates.
[0155] The system maintains a version chain for each rule in the rule base. Each time a rule is modified, the system directly creates a new version. The hot update process is driven by a state machine in the rule version manager and strictly follows the sequence of the following five stages: S501. When the system receives a rule update request, for add, modify or enable operations, the system performs verification and compilation on the target rule version and generates a new Rete network instance; for delete or disable operations, the system generates a new version network configuration that no longer contains the target rule branch, and builds a new Rete network instance with this network configuration.
[0156] The deletion operation marks the target rule as deleted while retaining the version chain and audit logs.
[0157] After compilation, the new network instance is marked as DRAFT, allocated independent memory space, and a version-level type index table, partial matching status table, and memory nodes are built exclusively for this new version of the Rete network instance, completely isolated from the current production Rete network instance serving production traffic. The type nodes of this new network instance are not injected into the global type index of the event pattern matching engine in the production environment for the time being.
[0158] S502. The system provides an independent rule testing sandbox environment. The sandbox constructs a historical event replay sequence in ascending order of the event occurrence time of standardized Event objects. When two standardized Event objects have the same event occurrence time, they are stably sorted according to the event source identifier, message bus partition identifier, and partition offset. The sandbox loads both the old and new versions of the Rete network instance, and inputs the same historical event replay sequence, initial rule state, system-level global variable snapshot, and context fact snapshot into the two network instances respectively. Both the old and new versions are rerun in the same sandbox environment, with the same resource quota and the same timing caliber. The system compares the rule triggering result objects, task instance parameters, and matching latency generated after the two versions are rerun. The historical actual running results of the old version in the production environment are only used for auxiliary verification and are not used as a direct baseline for matching latency comparison.
[0159] Operations personnel can specify the replay time range, and the sandbox will re-inject all historical standardized events within that time range into the new version of the Rete network instance for simulation. The sandbox records all triggering events of the rules, the parameters of the generated task instances, and the time consumed for each matching operation during the simulation.
[0160] The rule update request also includes the expected scope of changes, which at least includes the affected rule identifiers, allowed new trigger record types, allowed disappearance trigger record types, allowed changes to task parameter fields, and the allowed range of change for each parameter. During sandbox validation, the comparison results are divided into expected and unexpected differences. Trigger record differences and parameter differences falling within the expected scope of changes are not included in the version anomaly indicators; differences not falling within the expected scope of changes are included in the unexpected trigger difference rate and unexpected parameter difference rate. The pass condition for the new version is based on whether the unexpected differences exceed the corresponding threshold.
[0161] Trigger consistency rate Defined as: ; in The number of shared trigger records that are successfully matched one-to-one between the old and new versions. The total number of trigger records generated for the new version. Total number of trigger records generated for older versions. Different versions of the same business rule maintain the same rule identifier and are distinguished by different rule version numbers. Trigger records are grouped according to the rule identifier, trigger scope key, and sorted set of associated event identifiers. For multiple trigger records within the same group, they are sorted in ascending order of trigger time, and the record with the smallest absolute difference in trigger time is matched first; when the absolute differences in trigger times are the same, the matching order is determined by the lexicographical order of the trigger result identifiers. The rule identifier, trigger scope key, and set of associated event identifiers are the same, and the absolute value of the difference between two trigger times is not greater than the allowable time deviation. When this occurs, it is determined to be a joint trigger.
[0162] Each trigger record can participate in a maximum of one match. New rules that do not have a corresponding rule identifier in the old version, and deleted rules that do not have a corresponding rule identifier in the new version, will be processed according to the expected scope of change.
[0163] Parameter difference rate Defined as: ; in This represents the number of parameter fields whose comparison results are inconsistent between the old and new versions of the corresponding task instance. This represents the total number of parameter fields involved in the comparison.
[0164] The task instances generated by the new and old versions are matched one-to-one according to the rule identifier, task template identifier, task type, target subsystem identifier, and associated event identifier set.
[0165] Strings, booleans, and enumerations are compared precisely; time parameters are first standardized to the same time base and time precision before comparison; list parameters are compared either by position or by normalized set based on the order sensitivity attribute declared in the task parameter structure definition. Object parameters are expanded according to the normalized field path and compared field by field. Parameter fields that exist only in one version are counted as difference fields. For numeric parameters with units... and First, convert both to the same standard unit, then determine whether they are consistent based on the following conditions: ; in The absolute comparison tolerance configured for this parameter has the same units as the parameter being compared. This is a unitless relative comparison tolerance.
[0166] Single match delay Defined as: ; in For the first The monotonic clock time of a standardized Event object entering the Rete network instance under test. The monotonic clock time is used to complete the relevant rule matching for the standardized Event object and output the corresponding matching results.
[0167] Average latency deviation between new and old versions Defined as: ; In addition to the average matching delay, the system also records the matching delay at the 95th percentile. Matching delay with the 99th percentile Both the old and new versions use the same monotonic clock and the same timing boundary measurements for matching delay.
[0168] Only when consistency rate is triggered Not lower than the preset consistency rate threshold and parameter difference rate If the difference rate is not higher than the preset threshold, the average matching latency is not higher than the preset average latency threshold, and the 99th percentile matching latency is not higher than the preset long-tail latency threshold, the new version allows entry into the next stage, and the status changes to TEST. It should be noted that each threshold is determined by the rule version management configuration and is recorded along with the corresponding test environment, the number of replay events, and the number of rules.
[0169] S503. After passing sandbox verification, the status of the new version Rete network instance is upgraded to ACTIVE_PENDING. The system maintains both a primary version matching context and a shadow version matching context within the event pattern matching engine. The primary version context is bound to the old version network instance and its version-level type index table and partial matching status table, while the shadow version context is bound to the new version network instance and its independent version-level type index table and partial matching status table.
[0170] The new version of the Rete network instance initializes with a state snapshot corresponding to the start time of the shadow run.
[0171] For partial matching states that have entered the old version network before the shadow operation begins but have not yet been completed, the old version network continues to process the partial matching states until they are triggered, expire, or the grace period ends; the new version network does not inherit partial matching states from the old version.
[0172] When a standardized event arrives at the engine, the engine copies the event into two copies and injects them into the main version context and the shadow version context respectively for incremental matching.
[0173] During shadow execution, the new version of the Rete network instance receives the same standardized Event objects as the old version, but the rule-triggered result objects and task instances it generates are only used for comparison and verification. The system isolates the task instances generated by the new version through the shadow execution identifier and saves them to the verification result storage area. This phase lasts for a configurable time window (called the parallel grace period). During the grace period, the monitoring system performs real-time A / B comparisons of the running metrics of the old and new versions.
[0174] S504. After the parallel grace period ends, if the monitoring system confirms that all performance metrics of the new version are normal under real traffic, the system prepares to perform the formal switchover. The switchover operation is accomplished by atomically replacing the main version context pointer of the event pattern matching engine with the pointer of the new version context.
[0175] Before switching, the system records the old version network instance identifier and the current active version reference. If the active version reference update fails, the old version network instance will remain the active version. If, after a successful reference update, the new version network instance is found to be unavailable, the error rate exceeds a threshold, or task instantiation fails continuously within a preset observation period, the active version reference will be atomically restored to the old version network instance. During the rollback, the original task instance identifier will continue to be used to perform idempotency checks to avoid duplicate task delivery triggered by the same rule.
[0176] After the switch is complete, the new version network instance will be in the ACTIVE state, and the old version network instance will be in the DEPRECATED state.
[0177] After an atomic switch in event routing, newly arriving normalized Event objects only enter the new version of the network. Specifically, the old version of the network only processes events already received before the switch and their partial matching states, and no longer receives new events.
[0178] S505. For older Rete network instances and their contexts marked as DEPRECATED, the system cannot immediately reclaim their memory because their Beta Memory still contains partially matched states that may be waiting for subsequent events.
[0179] Older versions of Rete network instances retain some matching states formed before the event routing switch, until the corresponding state is fully triggered or expires due to the event time window. Newer versions of Rete network instances do not inherit some matching states from older versions.
[0180] The matching status of the old version that is not completed after the grace period ends is marked as terminated, and the corresponding rule identifier, the set of associated event identifiers, and the reason for termination are recorded.
[0181] At the same time, the system initiates a background garbage collection task to periodically clear out timed-out matching states, release memory from abandoned Rete network node graphs, and clean up orphaned index entries. This mechanism ensures that memory leaks do not occur during the rule hot update process.
[0182] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.
Claims
1. A task processing method based on event rules, characterized in that, The method includes: Receive event rules containing event patterns and task templates, validate the event rules, and compile the validated rules into Rete network instances; Receive heterogeneous raw events from different external subsystems, and convert the heterogeneous raw events into standardized event objects with a unified data structure according to the mapping rules corresponding to the event source and event type; The event pattern matching engine routes the standardized event object to the corresponding Rete network instance based on the event type, performs incremental event pattern matching, and generates a rule trigger result object when all event conditions of the rule are met. The task execution layer triggers the result object to load the corresponding task template according to the rules, and generates a task instance by combining the real-time collected factory context information. The task instance is then prioritized and arbitrated, and the arbitrated task instance is sent to the corresponding external subsystem for execution.
2. The task processing method based on event rules according to claim 1, characterized in that, The validation of the event rules includes: performing lexical and syntactic validation, reference validity validation, and rule conflict checking on the rule definition data; wherein, the rule conflict checking converts the event type, field comparison conditions, and resource key into a constraint set and performs intersection judgment to identify potential resource conflicts.
3. The task processing method based on event rules according to claim 1, characterized in that, Compiling validated rules into a Rete network instance includes: creating a type node and a set of Alpha nodes for each atomic event, constructing a Beta node network, and creating memory storage areas for Alpha nodes and Beta nodes respectively; wherein, the Rete network instance sets up a global type index table with the event type as the key at the event entry point, and performs composite node merging on consecutive Alpha conditions.
4. The task processing method based on event rules according to claim 1, characterized in that, The process of converting the heterogeneous raw events into standardized event objects with a unified data structure includes: through a multi-layered adaptation architecture consisting of a driver layer, an adapter layer, and a proxy layer, sequentially performing protocol identification and integrity verification, mapping rule retrieval, field extraction, field value conversion and normalization, standardized event object assembly and default value filling, and data validity verification.
5. The task processing method based on event rules according to claim 1, characterized in that, The event pattern matching engine performs incremental event pattern matching by: performing duplicate event verification on the received standardized event objects; routing them to the corresponding type nodes according to the event type; filtering single event conditions through the Alpha node chain; performing multi-event connection tests through the Beta node, and generating a partial matching state when the sequence, non-event, and / or logical combinations are satisfied; and generating a rule trigger result object when all event conditions of the rule are satisfied.
6. The task processing method based on event rules according to claim 1, characterized in that, The process of generating task instances by combining real-time collected factory context information and prioritizing these task instances includes: collecting context information such as real-time coordinates of aerial transport vehicles, traffic congestion index, task queue depth, processor load, equipment health score, electricity price period, and factory shift; the task instantiation module corrects task parameters based on the context information; and the priority arbitrator divides task instances into conflict sets according to resource keys, sorts them based on a normalized comprehensive score of rule priority, business urgency, waiting time, and deadline, and supports preemption of high-priority tasks.
7. The task processing method based on event rules according to claim 1, characterized in that, The process of distributing the arbitrated task instance to the corresponding external subsystem for execution includes: the task dispatcher selecting a protocol adapter based on the target subsystem, converting the task instance into the target protocol format and sending it, and using the task instance identifier for idempotency verification and retries.
8. The task processing method based on event rules according to claim 1, characterized in that, The method further includes: when updating rules, generating a new version of the Rete network instance for add, modify, or enable operations, and generating a network configuration that does not contain the target rule branch for delete or disable operations; after sandbox verification and shadow parallel operation, atomically switching the active version reference; after switching, the old version network instance retains the incomplete matching state until it expires.
9. A task processing method based on event rules according to claim 8, characterized in that, The sandbox verification includes: using the same historical event replay sequence, initial state, and context snapshot, rerunning the old and new versions of the Rete network instance respectively, calculating the trigger consistency rate, parameter difference rate, and matching latency, and entering the shadow parallel operation stage only when all indicators meet the preset thresholds.
10. A task processing method based on event rules according to claim 1, characterized in that, The method is deployed in a central scheduling server, edge computing node, or distributed computing cluster in a semiconductor manufacturing plant to achieve collaborative scheduling between material handling systems, real-time dispatching systems, robot control systems, and equipment automation programs.
