A programmable data interaction method and system based on NFC
By dynamically adjusting the execution order of NFC interaction steps and adopting a multi-threaded programming model, the problems of step dependence and resource overhead in NFC data interaction are solved, and efficient parallel processing and performance improvement are achieved.
Patent Information
- Application Number
- CN202411017283.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-07-29
AI Technical Summary
During the NFC data interaction process, there are problems such as step dependence, device heterogeneity and resource overhead, which limits the potential of parallel processing and leads to limited performance improvement.
By obtaining real-time parameters of device status and network status, the decision tree algorithm is used to dynamically adjust the execution order of NFC interactive steps, marking independent steps as parallel execution, and optimizing the execution of parallel tasks through multi-threaded programming model and thread pool management resources.
It realizes effective parallel processing and performance improvement in NFC interaction, optimizes interaction efficiency and throughput, reduces the computing pressure on the server, and improves the overall performance and user experience of the system.
Smart Images

Figure CN118764847B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information technology, and in particular to a programmable data interaction method and system based on NFC. Background Art
[0002] In the context of the widespread application of near field communication (NFC) technology, data interaction efficiency and performance optimization have become key factors in improving user experience and enhancing system competitiveness. However, achieving efficient parallel processing in the process of NFC programmable data interaction faces many challenges and limitations. Specifically, there are complex dependencies in the interaction steps. For example, identity authentication, key negotiation and data exchange are closely linked and cannot be easily divided into independent parallel tasks, which limits the potential of parallel processing. At the same time, the introduction of parallel processing strategies may also bring additional resource consumption and system complexity, and it is necessary to find the best balance between performance optimization and system overhead. To this end, when optimizing the NFC interaction sequence and parallel processing mechanism, it is necessary to comprehensively consider multiple factors such as the relationship between steps to achieve a reasonable division of task granularity and accurate selection of parallel models. This requires not only an in-depth understanding of the characteristics and requirements of specific business scenarios, but also the design of a parallel optimization solution that is both efficient and takes into account system reliability, security and maintainability. In summary, how to effectively overcome the limitations of step dependency, device heterogeneity and resource overhead in the NFC data interaction process to achieve true parallel processing and performance improvement is a technical problem that needs to be solved urgently. Summary of the invention
[0003] The present invention provides a programmable data interaction method based on NFC, which mainly includes:
[0004] Obtain the real-time parameters of the device status and network status during the NFC interaction process, dynamically adjust the execution order of the NFC interaction steps using the decision tree algorithm based on the parameter information, mark the independent steps without dependencies as executable in parallel, and obtain the optimized execution order of the NFC interaction steps;
[0005] According to the organization and access characteristics of programmable data and the granularity division results of parallel tasks, a multi-threaded programming model is used to allocate independent execution threads for each parallel NFC interaction step. The thread resources are managed through a thread pool, and the number of threads is dynamically adjusted. The optimal concurrency is determined while ensuring the consistency of programmable data, so as to improve the concurrency and throughput of NFC interactions.
[0006] A directed acyclic graph is constructed through a depth-first search algorithm to describe the dependency relationship between NFC interaction steps. The optimal execution order of the steps is calculated using a topological sorting algorithm, so that dependent steps are executed first and independent steps are executed later and in parallel as much as possible. Data locality is optimized based on the distributed storage characteristics of programmable data, and an execution order of NFC interaction steps that takes into account both parallel execution and data access efficiency is obtained.
[0007] Obtain the key performance indicator data of the execution time of each step in the NFC interaction process and the access frequency of programmable data, establish a performance prediction model through the support vector machine regression algorithm, predict the interaction efficiency under different execution orders and data organization methods, and select the optimal execution order and data layout according to the prediction results;
[0008] Optimize the multi-granularity parallel tasks of NFC interaction steps, select parallel granularity according to step level, operation level, and data level, determine the dependency constraints between parallel tasks through the dependency relationship of programmable data, maximize the degree of parallelization while satisfying dependency constraints and data consistency, use heuristic algorithms to search for the optimal parallel granularity combination, and balance the complexity and benefits of parallel optimization;
[0009] For cross-device NFC interactions, a distributed task scheduling algorithm is used to coordinate the task allocation and execution progress of multiple devices, dynamically adjust task allocation according to the computing power and load status of the device, and allocate some computing tasks to the device for parallel processing. Through collaborative computing between devices and distributed storage of programmable data, end-to-end full-link parallel optimization is achieved to reduce the computing pressure on the server.
[0010] For NFC interactions with large amounts of data, the data slicing method is used to divide the programmable data into multiple small blocks, and the multiplexing mechanism is used to transmit the small data blocks in parallel on multiple channels, making full use of the communication bandwidth to shorten the data transmission delay, and using the programmable data security mechanism to ensure data security during the transmission process.
[0011] The present invention provides a programmable data interaction system based on NFC, which mainly includes:
[0012] Device status dynamic adjustment module, used to optimize NFC interaction steps based on real-time status and decision tree algorithm;
[0013] Multithreaded programming model module, used to allocate independent threads for parallel execution and manage thread resources;
[0014] Dependency optimization module, used to construct directed acyclic graphs and topological sorting to optimize the order of NFC steps;
[0015] Performance prediction and optimization module, used to predict interaction efficiency and optimize data layout through support vector machine regression algorithm;
[0016] Parallel task granularity optimization module, used to select parallel granularity and use heuristic algorithm to search for the optimal combination;
[0017] Distributed task scheduling module, used to coordinate task allocation and computing collaboration among devices to achieve full-link parallel optimization;
[0018] The data segmentation and transmission module is used to segment the data and transmit it in parallel through multiplexing to ensure data security.
[0019] The technical solution provided by the embodiment of the present invention may have the following beneficial effects:
[0020] The present invention discloses a programmable data interaction method based on NFC; for NFC interaction scenarios with large data volumes, the data is divided into multiple small blocks, which are transmitted in parallel on multiple channels through a multiplexing mechanism, thereby making full use of the communication bandwidth, and increasing the reliability of data transmission through a forward error correction coding algorithm, thereby effectively shortening the delay of data transmission and improving the interaction efficiency; in general, the present invention optimizes the NFC interaction efficiency and throughput through the following methods: dynamically adjusting the execution order of NFC interaction steps according to the device status and network status, and using a decision tree algorithm to optimize the execution order; executing independent steps that can be processed in parallel concurrently through a multi-threaded programming model, and utilizing Use thread pool to dynamically manage thread resources; use depth-first search algorithm and topological sorting algorithm to handle dependencies between steps to achieve the optimal execution order; use support vector machine regression algorithm to predict interaction efficiency under different execution orders and select the optimal order; perform parallelization according to different granularities (step level, operation level, data level), and search for the optimal parallel granularity combination through heuristic algorithms; in cross-device NFC interactions, use distributed task scheduling algorithms to optimize task allocation and execution progress, and achieve end-to-end full-link parallel optimization; in interactions with large amounts of data, use data sharding and parallel transmission technology, and improve data transmission efficiency through multiplexing and forward error correction coding. The application of these technologies not only improves the concurrency and throughput of NFC interactions, but also optimizes the overall efficiency and reliability of interactions, effectively reduces the computing pressure on the server, and improves the overall performance of the system and the user's interactive experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 The present invention is a flowchart of a programmable data interaction method based on NFC.
[0022] Figure 2 It is a schematic diagram of a programmable data interaction method and system based on NFC of the present invention.
[0023] Figure 3 This is another schematic diagram of a programmable data interaction method and system based on NFC of the present invention.
[0024] Figure 4 It is a structural schematic diagram of a programmable data interaction system based on NFC of the present invention. DETAILED DESCRIPTION
[0025] In order to further understand the content of the present invention, the present invention is described in detail in conjunction with the accompanying drawings and embodiments. The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are only used to explain the relevant inventions, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.
[0026] like Figure 1-3 In this embodiment, a programmable data interaction method and system based on NFC may specifically include:
[0027] S101. Acquire the device status and network status real-time parameters during the NFC interaction process, dynamically adjust the execution order of the NFC interaction steps using a decision tree algorithm based on the parameter information, mark the independent steps without dependencies as executable in parallel, and obtain an optimized execution order of the NFC interaction steps.
[0028] The invention relates to obtaining real-time data of NFC device status parameters and network status, and monitoring key indicators of signal strength, data transmission rate and response time in the real-time data; constructing an NFC interaction process model based on the monitoring results of key indicators by using the C4.5 decision tree algorithm, wherein the decision tree algorithm uses the information gain ratio as the feature selection criterion; using a directed acyclic graph to represent the dependency relationship between NFC interaction steps for the NFC interaction process model, wherein the directed acyclic graph includes nodes and connections between nodes; analyzing the directed acyclic graph by using a topological sorting algorithm, identifying mutually independent and non-dependent steps, and marking the mutually independent and non-dependent steps as tasks that can be executed in parallel; generating an optimized interaction process including serial and parallel execution instructions, wherein the execution instructions in the optimized interaction process are sent to an NFC control module, wherein the NFC control module includes an instruction parser, a task scheduler and a hardware driver interface; the instruction parser receives and parses the execution instructions, the task scheduler coordinates the task execution order according to the parallel mark in the execution instructions, and the hardware driver interface interacts with the NFC hardware according to the task execution order to perform read, write and authentication operations.
[0029] Specifically, the real-time data of NFC device status parameters and network status are obtained, and key indicators such as signal strength, data transmission rate, and response time in the interaction process are monitored in real time. According to the statistical analysis of historical interaction data, the normal range of each indicator is determined, and multi-level threshold rules are set. The preset multi-level threshold rules are used to determine whether the current interaction environment meets the normal interaction conditions. The C4.5 decision tree algorithm is used to construct the NFC interaction process model, and the information gain ratio is used as the feature selection criterion. The information gain ratio of the decision tree nodes is dynamically adjusted according to the acquired device status and network parameters, and the decision tree structure is optimized using pruning technology. For different parameter combinations, the optimal path in the decision tree is calculated by the depth-first search algorithm to obtain the optimized execution order of the NFC interaction steps. The optimized NFC interaction steps are subjected to dependency analysis, and the dependencies between the NFC interaction steps are represented by a directed acyclic graph. The independent and non-dependent steps are identified by the topological sorting algorithm, and these steps are marked as tasks that can be executed in parallel, and an optimized interaction process containing serial and parallel execution instructions is generated. The execution instructions of each step are obtained from the optimized interaction process, and the execution instructions are sent to the NFC control module according to the order and parallel marking defined by the process. The NFC control module includes a command parser, a task scheduler, and a hardware driver interface. The command parser receives and parses execution instructions, the task scheduler coordinates the execution order of tasks according to parallel tags, and the hardware driver interface is responsible for interacting with the NFC hardware to perform specific operations such as reading, writing, and authentication. During the NFC interaction process, device status parameters and network status data are obtained in real time, including signal strength in dBm, data transmission rate in kbps, and response time in ms. According to the analysis of historical interaction data, the normal range of signal strength is set to -50dBm to -70dBm, the normal range of data transmission rate is set to 100kbps to 424kbps, and the normal range of response time is set to 10ms to 50ms. A multi-level threshold rule is established: when the signal strength is lower than -65dBm, the data transmission rate is lower than 200kbps, or the response time exceeds 30ms, a first-level warning is triggered; when the signal strength is lower than -70dBm, the data transmission rate is lower than 100kbps, or the response time exceeds 50ms, a second-level warning is triggered and the interaction strategy is adjusted. The C4.5 decision tree algorithm is used to construct the NFC interaction process model, with the information gain ratio as the feature selection criterion. For example, for the signal strength feature, the information gain ratio is calculated to be 0.8, the information gain ratio of the data transmission rate feature is 0.6, and the information gain ratio of the response time feature is 0.7. These weights are dynamically adjusted according to the parameters obtained in real time. For example, when a sudden drop in signal strength is detected, the weight of the signal strength feature is increased to 0.9. The α-β pruning technique is used to optimize the decision tree structure, setting α = 0.05 and β = 0.1. For different parameter combinations, the depth-first search algorithm is used to calculate the optimal interaction path, and the search depth is limited to 5 layers.Generate an optimized execution sequence of NFC interaction steps, such as [authentication, read data, write data, encrypt, transmit]. Then, use a directed acyclic graph to represent the dependencies between these steps, where nodes represent steps and edges represent dependencies. Use the Kahn algorithm to perform topological sorting to identify steps that can be executed in parallel, such as [authentication, read data] can be executed in parallel. Generate an optimized interaction flow containing serial and parallel execution instructions as {parallel: [authentication, read data], serial: [write data, encrypt, transmit]}. Finally, send the optimized execution instructions to the NFC control module. The instruction parser in the control module receives and parses the instructions, and assigns the parallel task [authentication, read data] to multiple processing units for simultaneous execution. The task scheduler coordinates the parallel execution of authentication and data reading according to the parallel tag, and then executes the data writing, encryption and transmission operations in sequence. The hardware driver interface is responsible for interacting with the NFC hardware and performing specific read, write, authentication and other operations, such as communicating with the NFC tag through the ISO / IEC14443 protocol to complete data exchange.
[0030] The standard NFC interaction process is obtained from the pre-established interaction steps, and an independence analysis is performed on each interaction step. A dependency graph of the interaction steps is built, and a graph theory algorithm is used to traverse the dependency graph to identify all potential parallel execution opportunities and determine the dependency relationship between steps. If there is no direct dependency between two steps, they are marked as a pair of steps that can be executed in parallel.
[0031] The standard NFC interaction process is obtained from a pre-established interaction step database, and the interaction steps are subjected to independence analysis, and the correlation between the steps is calculated using the Pearson correlation coefficient. It is determined whether the correlation coefficient is less than a preset threshold value. If it is less than the preset threshold value, the step is determined to be an independent step. An interaction step dependency graph is constructed according to the independence analysis result, and the dependency graph uses a weighted adjacency matrix to represent the dependency relationship between the steps. A depth-first search is performed on the dependency graph to identify strongly connected components, and the depth-first search uses the Tarjan algorithm. For node pairs that are not in the same strongly connected component, they are determined to be potential parallel execution opportunities. The potential parallel execution opportunities are verified, and the verification uses the Petri net model to determine that parallel execution does not cause deadlock or resource competition. For the pairs of steps that can be executed in parallel that have passed the verification, the critical path method is used to analyze the execution time of parallel tasks. According to the step execution time and resource requirements, a genetic algorithm is used to optimize the resource allocation strategy. The optimized NFC interaction process is output, and the optimized NFC interaction process includes steps that can be executed in parallel.
[0032] Specifically, the standard NFC interaction process is obtained from the pre-established interaction step database, and an independence analysis is performed on each interaction step. The correlation between steps is calculated using the Pearson correlation coefficient, and the absolute value greater than 0.7 is taken as the threshold for dependency. If the correlation coefficient is less than the threshold, the step is determined to be an independent step. According to the results of the independence analysis, an interaction step dependency graph is constructed, and a weighted adjacency matrix is used to represent the dependency relationship between steps. The matrix element value is a real number between 0 and 1, which represents the dependency strength. The higher the dependency strength, the closer the corresponding matrix element value is to 1. The Tarjan algorithm is used to perform a depth-first search on the dependency graph to identify strongly connected components. For node pairs that are not in the same strongly connected component, they are determined as potential parallel execution opportunities. The dependency relationship between steps is determined by comparing the path lengths between nodes. If there is no direct dependency between two steps, they are marked as a pair of steps that can be executed in parallel. The Petri net model is used to verify the identified parallel execution opportunities to ensure that parallel execution will not cause deadlock or resource competition. For the verified parallel executable step pairs, the critical path method is used to analyze the execution time of parallel tasks, and the optimal parallel execution plan is generated in combination with the resource-constrained multi-project scheduling algorithm. Genetic algorithm is used to optimize resource allocation strategy, and the optimized NFC interaction process is output according to the execution time and resource requirements of the steps. In the process of optimizing the NFC interaction process, the standard interaction step sequence is first obtained from the pre-established database, such as [initialization, authentication, reading, writing, encryption, transmission]. Independence analysis is performed on each step, and the correlation between steps is calculated using the Pearson correlation coefficient. For example, the correlation coefficient between authentication and reading is 0.8, and the correlation coefficient between authentication and writing is 0.3. A threshold of 0.7 is set to determine that authentication and reading are dependent, and authentication and writing are independent steps. Based on the analysis results, a weighted adjacency matrix is constructed to represent the dependency relationship, such as the weight of authentication to reading is 0.8, and the weight of authentication to writing is 0.3. The Tarjan algorithm is used to perform a depth-first search on the dependency graph to identify the strongly connected components {initialization, authentication, reading} and {writing, encryption, transmission}. Node pairs that are not in the same strongly connected component are determined to be potential parallel opportunities, such as (authentication, writing). The feasibility of parallel execution is verified through the Petri net model, and a Petri net containing library places and transitions is constructed to simulate the parallel execution process to ensure that no deadlock occurs. For the verified parallel step pairs, such as (authentication, writing), the critical path method is applied to analyze the execution time. Assuming that authentication takes 30ms and writing takes 20ms, parallel execution can reduce the total time from 50ms to 30ms. Genetic algorithm is used to optimize resource allocation, with the population size set to 100, the crossover rate 0.8, the mutation rate 0.1, and 500 iterations. The chromosome encoding represents the task allocation scheme, and the fitness function considers execution time and resource utilization.After optimization, the optimal parallel execution scheme is obtained as {parallel: [authentication, writing], serial: [initialization, reading, encryption, transmission]}, and the total execution time is optimized from the original 150ms to 110ms, and the resource utilization rate is improved by 20%. Finally, the optimized NFC interaction process is output, which achieves a significant improvement in interaction efficiency.
[0033] S102. According to the organization mode and access characteristics of programmable data and the granularity division result of parallel tasks, a multi-threaded programming model is used to allocate an independent execution thread to each parallel NFC interaction step, thread resources are managed through a thread pool, the number of threads is dynamically adjusted, and the optimal concurrency is determined under the premise of ensuring the consistency of programmable data, so as to improve the concurrency and throughput of NFC interaction.
[0034] Acquire NFC interaction data, where the NFC interaction data is stored in a multidimensional array structure; retrieve the NFC interaction data in the multidimensional array structure by a bitmap index method to obtain a retrieval result; split the NFC interaction steps into fine-grained subtasks by a critical path method according to the retrieval result; allocate independent execution threads for the fine-grained subtasks, where the execution threads are generated by a multithreaded programming model; if the fine-grained subtasks are executed, use a two-phase locking protocol to implement concurrency control, where the concurrency control uses a read-write lock mechanism to implement data sharing and mutual exclusion; collect real-time data of concurrent execution by a performance counter, where the real-time data includes thread utilization and task waiting time; and establish a performance prediction model by a random forest algorithm according to the real-time data, where the performance prediction model is used to guide dynamic adjustment of concurrency.
[0035] Specifically, according to the organization and access characteristics of programmable data, a multidimensional array structure is used to store NFC interaction data, and bitmap indexing technology is used to achieve fast data retrieval. A cache mechanism is established for frequently read and written data blocks to improve data access efficiency. Data flow analysis technology is used to identify the read and write mode and access frequency of NFC interaction data, providing a basis for subsequent task decomposition.
[0036] Combined with the granularity division results of parallel tasks, the critical path method is used to decompose tasks and split the NFC interaction steps into fine-grained subtasks. The earliest start time and the latest completion time of each subtask are calculated to identify the tasks on the critical path. A task dependency graph is established to identify the set of tasks that can be executed in parallel and calculate the execution time and resource requirements of each task.
[0037] Adopt a multi-threaded programming model, allocate independent execution threads for each parallel NFC interaction step, and use thread pools to manage thread resources. Set the number of core threads and maximum threads in the thread pool, predict the task arrival rate through the exponentially weighted moving average algorithm, dynamically adjust the thread pool size based on the prediction results, and adjust the number of active threads in real time.
[0038] Under the premise of ensuring programmable data consistency, a two-phase locking protocol is used to implement concurrency control, and a read-write lock mechanism is used to achieve data sharing and mutual exclusion. Load balancing is performed through the minimum completion time priority algorithm, tasks are dynamically assigned to idle threads, and task priorities are adjusted. Performance counters are used to collect real-time data of concurrent execution, such as thread utilization, task waiting time, etc., and a performance prediction model is established through the random forest algorithm to guide the dynamic adjustment of concurrency and optimize the concurrency and throughput of NFC interactions.
[0039] In the process of NFC interaction optimization, a 4-dimensional array structure is first used to store interaction data. Each dimension represents the device ID, interaction type, data block and timestamp. Using a 32-bit bitmap index, every 8 bits are divided into a slot corresponding to one dimension of the array, achieving data retrieval with O(1) time complexity. An LRU cache is established for data blocks with an access frequency of more than 100 times / second, and the cache size is set to 1MB. Through data flow analysis, it is identified that read operations account for 70%, write operations account for 30%, and 90% of accesses are concentrated on 20% of data blocks. Based on this, the critical path method is used for task decomposition, and the NFC interaction is divided into 10 subtasks. The critical path is calculated to contain 6 tasks with a total time consumption of 150ms. Four pairs of task sets that can be executed in parallel are identified, and the average execution time of each pair of tasks is 25ms. A multi-threaded model is adopted, and the number of core threads of the thread pool is initialized to 4 and the maximum number of threads is 8. The exponentially weighted moving average algorithm is used, and the weight factor α is set to 0.3, and the predicted task arrival rate is 20 / second. When the predicted value exceeds 25 / second, the number of threads is dynamically increased; when it is less than 15 / second, the number of threads is reduced. A two-phase locking protocol is implemented, and the read lock timeout is set to 50ms and the write lock timeout is set to 100ms. The minimum completion time priority algorithm is used to assign newly arrived tasks to the thread with the shortest estimated completion time, and the task priority range is 1-10. Using performance counters, data is collected every 100ms, including 10 indicators such as thread utilization and task waiting time. A performance prediction model is established through the random forest algorithm, using 100 decision trees and the feature importance threshold is set to 0.05. According to the prediction results, when the thread utilization is lower than 60% or higher than 90%, the concurrency is adjusted to increase the NFC interaction throughput from the original 100 times / second to 150 times / second.
[0040] For each step in the NFC interaction process, the computational complexity and resource requirements are analyzed, and a task feature model is established, including task type, estimated execution time, and memory usage parameters. Tasks with similar features are clustered using a task classification algorithm to obtain a task granularity division scheme.
[0041] Obtain static code analysis results for each step of the NFC interaction process, the static code analysis results include loop nesting depth, number of conditional branches and number of function calls; calculate the computational complexity score of each step according to the static code analysis results, the computational complexity score is obtained by a weighted sum model; collect system parameters during the NFC interaction process, the system parameters include CPU usage, memory occupancy and I / O operation frequency, use the sliding window method to calculate the average value in the window as the execution time, and take the preset quantile as the peak resource consumption; construct a task feature vector, the task feature vector includes feature data composed of the computational complexity score and system parameters; perform dimensionality reduction processing on the feature data, the dimensionality reduction processing adopts the principal component analysis method, and selects the first k principal components whose cumulative contribution rate reaches a preset range as the main feature combination; after the main feature combination is determined, perform cluster analysis on the main feature combination, the cluster analysis adopts the K-means++ algorithm, and determines the optimal number of clusters by calculating the silhouette coefficient, so as to obtain the final task clustering result and granularity division scheme.
[0042] Specifically, for each step in the NFC interaction process, a static code analysis tool is used to extract key indicators, including loop nesting depth, number of conditional branches, and number of function calls. Using the weighted sum model, these indicators are assigned weights of 0.4, 0.3, and 0.3, respectively, and the computational complexity score of each step is calculated. The resource monitoring component is used to collect parameters such as CPU usage, memory usage, and I / O operation frequency in the NFC interaction process in real time, combined with the timestamp information recorded in the step execution log. The sliding window method is used, and the window size is set to 10 seconds. The average value in the window is calculated as the execution time, and the 95% quantile is taken as the peak resource consumption. The Z-score standardization method is used to convert feature data of different dimensions to a unified scale. Based on the obtained computational complexity and resource requirement data, a task feature vector is constructed, which includes attributes such as task type, estimated execution time, and memory usage. The principal component analysis method is used to reduce the dimension of the feature data, and the cumulative contribution rate threshold is set to 85%. The first k principal components that meet the threshold are selected as the main feature combination. The K-means++ algorithm is used to perform cluster analysis on the processed task feature vectors and initialize the cluster center. The maximum number of iterations is set to 100, and the iteration is stopped when the moving distance of the cluster center is less than 0.001 or the maximum number of iterations is reached. The silhouette coefficient is used to evaluate the clustering effect, and the number of clusters when the silhouette coefficient is the largest is taken as the optimal granularity division scheme to obtain the final task clustering result and granularity division scheme. In the process of NFC interaction process optimization, the static code analysis tool is first used to analyze each step and extract key indicators: the average loop nesting depth is 3.2, the average number of conditional branches is 12.5, and the average number of function calls is 8.7. The weighted sum model is applied with weights of 0.4, 0.3, and 0.3 respectively, and the complexity score of each step is calculated, with an average score of 7.3. Subsequently, the resource monitoring component collects the average CPU usage of 65%, the peak memory usage of 256MB, and the I / O operation frequency of 200 times / second. The average execution time is calculated using a 10-second sliding window to be 150ms, and the 95% quantile resource consumption is CPU78% and memory 320MB. Z-score standardization was applied to these data to convert CPU usage, memory usage, and I / O frequency into a standard normal distribution with a mean of 0 and a standard deviation of 1. A task feature vector was constructed, which contained the standardized execution time, resource consumption, and complexity score. The principal component analysis method was used for dimensionality reduction. The cumulative contribution rate threshold was set to 85%, and the first three principal components were selected as the main feature combination, which explained 87.6% of the total variance. The K-means++ algorithm was used to initialize the cluster center and perform cluster analysis on the feature vector. The maximum number of iterations was set to 100, and the algorithm stopped when the moving distance of the cluster center was less than 0.001 or the iteration limit was reached. After many attempts, it was found that the silhouette coefficient was the largest when k=4, which was 0.68, and was determined to be the optimal number of clusters.Finally, four task categories were obtained: I / O intensive, compute intensive, memory intensive, and mixed, with corresponding average execution times of 100ms, 200ms, 180ms, and 150ms, respectively, which provided a basis for subsequent parallel optimization.
[0043] S103. Construct a directed acyclic graph by using a depth-first search algorithm to describe the dependency relationship between NFC interaction steps, and use a topological sorting algorithm to calculate the optimal execution order of the steps, so that the dependent steps are executed first, and the independent steps are executed later and in parallel as much as possible, and optimize data locality according to the distributed storage characteristics of programmable data, so as to obtain the NFC interaction step execution order that takes into account both parallel execution and data access efficiency.
[0044] A depth-first search algorithm is used to traverse the NFC interaction steps, and a directed acyclic graph is constructed to represent the dependency relationship between the steps, wherein the nodes in the graph represent the interaction steps and the edges represent the dependency relationship; according to the edges in the directed acyclic graph, the weights of the edges are set, and the weights are obtained by estimating the data exchange size between each step through static code; the directed acyclic graph is topologically sorted using the Kahn algorithm to calculate the optimal execution order of the steps; based on the topological sorting results, the critical path method is used to identify parallel execution opportunities, and if the execution time intervals of two steps do not overlap, they are marked as parallel executable; based on the parallel executable marks, a preliminary parallel execution plan is generated using a list scheduling algorithm; the degree of data sharing between the steps is calculated, and an affinity matrix is constructed, and the degree of data sharing is obtained based on the distributed storage characteristics of programmable data; the spectral clustering method is used to group the steps with high correlation into the same computing node, and the correlation is determined according to the affinity matrix; based on the grouping results, the parallel execution plan is adjusted to generate an execution order of the NFC interaction steps that takes into account both parallel execution and data access efficiency.
[0045] Specifically, the depth-first search algorithm is used to traverse the NFC interaction steps and construct a directed acyclic graph to represent the dependencies between the steps. The nodes in the graph represent the interaction steps and the edges represent the dependencies. The number of bytes is used as the unit of measurement for the amount of data transmission. The size of the data exchange between each step is estimated through static code analysis and set as the weight of the edge. According to the constructed directed acyclic graph, the Kahn algorithm is used for topological sorting to calculate the optimal execution order of the steps. A priority queue is used to store nodes with an in-degree of 0. Each time the first node is taken out, it is added to the result sequence and the in-degree of its adjacent nodes is updated. This process is repeated until all nodes are visited. Based on the topological sorting results, the critical path method is used to identify parallel execution opportunities. The earliest start time is calculated by forward traversal and the latest completion time is calculated by backward traversal. If the execution time intervals of two steps do not overlap, they are marked as parallel executable. According to the identified parallel opportunities, a preliminary parallel execution plan is generated using the list scheduling algorithm. Combined with the distributed storage characteristics of programmable data, the degree of data sharing between steps is calculated and the affinity matrix is constructed. The spectral clustering method is used to group highly correlated steps into the same computing node to minimize cross-node data transmission. Based on the grouping results, the parallel execution plan is adjusted to generate an execution order of NFC interaction steps that takes into account parallel execution and data access efficiency. In the process of optimizing the NFC interaction process, the depth-first search algorithm is first used to traverse the 10 interaction steps and construct a directed acyclic graph. Through static code analysis, the size of data exchange between steps is estimated. For example, the data transmission volume from step 1 to step 2 is 1024 bytes, which is set as the weight of the edge. Subsequently, the Kahn algorithm is applied for topological sorting, and a priority queue is used to store 5 initial nodes with an in-degree of 0. Each time the head node of the queue is taken out and added to the result sequence, the in-degree of the adjacent node is updated, and finally the optimized execution order is obtained.
[0046] [1,3,5,2,4,6,8,7,9,10]. Next, the critical path method is used to identify parallel opportunities. The earliest start time (ES) is calculated by forward traversal, such as ES1 = 0ms for step 1 and ES2 = 50ms for step 2; the latest completion time (LF) is calculated by backward traversal, such as LF9 = 450ms for step 9 and LF10 = 500ms for step 10. It is found that the execution time intervals of step 2 and step 3 do not overlap and are marked as parallelizable. Using the list scheduling algorithm, 10 steps are allocated to 3 processors, and the preliminary parallel plan is generated as processor 1 [1,2,6,9], processor 2 [3,5,8], and processor 3 [4,7,10]. Then, the degree of data sharing between steps is calculated, and a 10x10 affinity matrix is constructed. For example, the affinity of step 1 and step 2 is 0.8. Using the spectral clustering method, the 10 steps are divided into 4 groups, [1,2,3], [4,5], [6,7,8], [9,10]. Based on the grouping results, the parallel plan is adjusted to node 1 [1,2,3], node 2 [4,5,6], node 3 [7,8,9,10], and finally the NFC interaction step execution sequence is generated that takes into account both parallel execution and data locality.
[0047] Using the strategy of maximizing the potential of parallel execution, the topological sorting results are analyzed to identify the set of steps that can be executed in parallel and build parallel execution groups. Through the data locality optimization algorithm, the data access pattern of the steps in each parallel execution group is calculated and the steps are reordered to optimize the data access locality.
[0048] Obtain the execution time window of the step, and use the critical path method to calculate the earliest start time and the latest completion time of the step; determine the parallel possibility between steps according to the execution time window, and identify a set of steps that can be executed in parallel; use the Kern i ghan-L in algorithm to perform graph partitioning based on the set of parallel execution steps to obtain a parallel execution group; for the parallel execution group, use a bitmap to represent the data access mode of each step, and construct a data access vector; based on the data access vector, calculate the data reuse and access locality index between steps; reorder the steps in the parallel execution group, and use a genetic algorithm to optimize, wherein the fitness function is obtained by combining data reuse, cache hit rate and switching overhead between steps; for the reordered execution order, use a performance simulator to calculate the expected execution time and resource utilization.
[0049] Specifically, the topological sorting results are analyzed, and the critical path method is used to calculate the earliest start time and the latest completion time of each step. The parallel possibility between steps is determined by comparing the time windows, and the set of steps that can be executed in parallel is identified. When there are multiple critical paths, the path with the largest resource demand is selected as the main critical path. According to the identified parallel step set, the Kernighan-Lin algorithm is used to partition the graph, and the balance factor is set to 0.1, the maximum number of iterations is 100, and the steps are grouped to construct parallel execution groups. At the same time, resource constraints are considered to ensure that the resource demand of each execution group does not exceed the available resources of the system. The total execution time, resource demand and data dependency of each execution group are calculated to provide a basis for subsequent optimization. For each parallel execution group, the data flow analysis technology is used to track the data read and write operations of the steps in the group. A bitmap is used to represent the data access mode of each step, 1 represents read operation, 2 represents write operation, and 0 represents no access. A data access vector is constructed, and the data reuse and access locality index between steps are calculated. Based on the data access vector and locality index, a genetic algorithm is used to reorder the steps in the parallel execution group. The crossover rate is set to 0.8, the mutation rate is set to 0.1, and the population size is set to 100. The fitness function comprehensively considers data reuse, cache hit rate, and switching overhead between steps, and the weighted sum of these factors is used as the fitness value. The order of steps is iteratively optimized to finally obtain the execution order of steps with the best data access locality. The optimized execution order is evaluated using a performance simulator, and the expected execution time and resource utilization are calculated and compared with the original order. In the process of optimizing the NFC interaction process, the topological sorting results of the 10 steps are first analyzed, and the earliest start time and the latest completion time are calculated using the critical path method, such as ES = 0ms and LF = 50ms for step 1. By comparing the time windows, it is found that steps 2 and 3 can be executed in parallel. There are two critical paths, and the path with a total resource requirement of 280 units is selected as the main critical path. Then, the Kernighan-Li n algorithm is used to partition the graph, the balance factor is set to 0.1, the maximum iteration is 100 times, and the 10 steps are divided into 3 parallel execution groups [1,2,3], [4,5,6], and [7,8,9,10]. The total execution time of execution group 1 is calculated to be 150ms, the resource requirement is 180 units, and the data dependency is 0.6. Data flow analysis is performed on each execution group. For example, the data access vector of step 1 is
[0050] [1,2,0,1,0] means reading data block 1, writing data block 2, and reading data block 4. The data reuse of steps 1 and 2 is calculated to be 0.8, and the access locality index is 0.7. The execution order is optimized using a genetic algorithm, with a crossover rate of 0.8, a mutation rate of 0.1, and a population size of 100. The data reuse weight in the fitness function is 0.4, the cache hit rate weight is 0.4, and the step switching overhead weight is 0.2. After 500 generations of iterations, the optimized execution order is [1,3,2,5,4,6,8,7,9,10]. The performance simulator evaluation shows that the total execution time after optimization is reduced from the original 500ms to 420ms, and the resource utilization rate is increased from 65% to 78%.
[0051] S104. Obtain the key performance indicator data of the execution time of each step in the NFC interaction process and the access frequency of programmable data, establish a performance prediction model through the support vector machine regression algorithm, predict the interaction efficiency under different execution orders and data organization methods, and select the optimal execution order and data layout according to the prediction results.
[0052] The key performance indicator data of the execution time of each step in the NFC interaction process and the access frequency of programmable data are obtained; the Z-score standardization method is used to standardize the data according to the key performance indicator data, and the interquartile range method is used to detect and process outliers; feature engineering is performed on the standardized performance indicator data to extract the key feature vectors of execution time, access frequency, and data dependency, and an input feature matrix is constructed; the importance of the feature vector is calculated by the random forest algorithm, and the features with the highest importance ranking and the preset ratio are selected; if the correlation coefficient between the features is higher than the threshold, the redundant features are eliminated; the optimal hyperparameters of the support vector machine regression algorithm are determined by the grid search method, wherein the kernel function type selects RBF and linear kernel, the C value range is the preset value, and the gamma range is the preset value; the support vector machine regression model is trained according to the optimal hyperparameters, and the feature vectors of different execution orders and data organization methods are input to obtain the predicted interaction efficiency; the performance of the regression model is evaluated by K-fold cross validation, and the model with the best performance in the validation set is selected; the execution order and data layout scheme with the highest interaction efficiency are determined according to the ranking of the prediction results.
[0053] Specifically, a performance monitoring tool is used to obtain key performance indicator data of the execution time of each step in the NFC interaction process and the access frequency of programmable data. The Z-score standardization method is used to standardize the data, and the interquartile range method is used to detect and process outliers to obtain a normalized performance indicator data set. Feature engineering is performed on the processed performance indicator data to extract key feature vectors, including execution time, access frequency, data dependency, etc., to construct an input feature matrix, and the interaction efficiency is used as the target variable. The random forest algorithm is used to calculate the importance of features, and the features ranked in the top 80% of importance are selected. The correlation coefficients between features are calculated, and redundant features with correlations higher than 0.9 are eliminated. The grid search method is used to determine the optimal hyperparameters of the support vector machine regression algorithm. The kernel function type selects RBF and linear kernel, and the C value range is
[0054] [0.1,1,10,100], and the gamma range is [0.01,0.1,1,10]. The parameter combination with the best performance was selected through 5-fold cross validation. Based on the selected hyperparameters, the support vector machine regression model was trained, and the feature vectors of different execution orders and data organization methods were input to predict the corresponding interaction efficiency. The model performance was evaluated using K-fold cross validation (K=5), and the model with the best performance on the validation set was selected. According to the ranking of the prediction results, the execution order and data layout scheme with the highest interaction efficiency were selected. The SHAP value was used to analyze the contribution of the features to the prediction results and provide explainable optimization suggestions. During the NFC interaction optimization process, the performance monitoring tool collected 1000 sets of data samples, including the execution time of 10 steps and the access frequency of 20 data blocks. The Z-score method was used to standardize the data to a distribution with a mean of 0 and a standard deviation of 1. The interquartile range method detected 37 outliers and replaced them with the upper and lower quartiles. Subsequently, 15 key features were extracted, including an average execution time of 120ms, a maximum access frequency of 200 times / second, and a data dependency of 0.6. The random forest algorithm calculates the importance of features and selects 12 features with a cumulative importance of 80%. Correlation analysis found that for highly correlated features (>0.9), 10 features were removed and retained. The grid search method selects between RBF and linear kernels, with a C value range of [0.1, 1, 10, 100] and a gamma range of [0.01, 0.1, 1, 10]. The optimal parameter combination is selected as RBF kernel, C = 10, gamma = 0.1 through 5-fold cross validation. The support vector machine model is trained, and 100 feature vectors with different execution orders and data organization methods are input to predict interaction efficiency.
[0055] The average accuracy of the 5-fold cross validation reached 87%. The optimal solution predicted an interaction efficiency improvement of 23%, the execution order was [1, 3, 5, 2, 4, 7, 6, 8, 9, 10], and the data layout used block storage. SHAP analysis showed that execution time and data locality contributed the most to the prediction results, accounting for 40% and 35% respectively.
[0056] S105. Optimize the multi-granularity parallel tasks of the NFC interaction steps, select the parallel granularity according to the step level, operation level, and data level, determine the dependency constraints between parallel tasks through the dependency relationship of programmable data, maximize the degree of parallelization while satisfying the dependency constraints and data consistency, use heuristic algorithms to search for the optimal parallel granularity combination, and balance the complexity and benefits of parallel optimization.
[0057] Multi-granularity analysis is performed on the NFC interaction steps to obtain the task division at the step level, operation level and data level, and a task dependency graph is constructed. According to the task dependency graph, the greedy coloring algorithm is used to color the nodes in descending order of degree to obtain the initial parallel granularity combination scheme for marking parallel tasks of different granularities. A two-dimensional matrix is used to represent the data dependency between tasks. If there is a dependency between tasks, the matrix element value is 1, and if there is no dependency, it is 0. The data dependency matrix is established. Based on the parallelism evaluation function f=w1*(1 / T)+w2*R+w3*(1 / D), where T is the execution time, R is the resource utilization, D is the data access overhead, and w1, w2, and w3 are weight coefficients, the parallelization degree scores of different parallel granularity combinations are calculated. The simulated annealing algorithm is used to search for the optimal parallel granularity combination. The initial temperature is set to 100, the cooling coefficient is 0.95, 50 iterations are performed at each temperature, and the termination temperature is 0.01. The parallel granularity is randomly adjusted in each iteration, and the score of the new scheme is calculated according to the evaluation function to obtain the optimal scheme that balances the complexity and benefits of parallel optimization.
[0058] Specifically, a multi-granularity analysis is performed on the NFC interaction steps, and the parallel tasks are divided according to the step level, operation level, and data level to construct a task dependency graph. A greedy coloring algorithm is used to color the nodes in descending order of degree, mark the parallel tasks of different granularities, and obtain the initial parallel granularity combination scheme. The critical path method is used to analyze the task dependency graph, identify the critical path and slack time, and optimize the task allocation on the non-critical path. The data flow analysis technology is used to track the read and write operations of programmable data between parallel tasks. A two-dimensional matrix is used to represent the data dependency between tasks. The matrix element value of 1 indicates the existence of dependency and 0 indicates no dependency. A data dependency relationship matrix is established. Identify the dependency constraints and potential data conflicts between parallel tasks to ensure data consistency. Design a parallelism evaluation function in the form of
[0059] f=w1*(1 / T)+w2*R+w3*(1 / D), where T is the execution time, R is the resource utilization, D is the data access overhead, and w1, w2, and w3 are weight coefficients. Taking into account the task execution time, resource utilization, and data access overhead, the parallelization degree scores of different parallel granularity combinations are calculated as the optimization objective function. The simulated annealing algorithm is used to search for the optimal parallel granularity combination. The initial temperature is set to 100, the cooling coefficient is 0.95, 50 iterations are performed at each temperature, and the termination temperature is 0.01. The parallel granularity is randomly adjusted in each iteration, and the score of the new solution is calculated according to the evaluation function. The better solution or the local suboptimal solution is accepted according to probability. The optimized parallel solution is evaluated using a parallel task scheduling simulator, and the actual speedup ratio and resource utilization are calculated and compared with the theoretical expectations. Finally, the optimal solution that balances the complexity and benefits of parallel optimization is output. In the NFC interaction optimization process, multi-granularity analysis is first performed on 10 interaction steps, and 3 step-level tasks, 12 operation-level tasks, and 25 data-level tasks are identified. A task dependency graph was constructed, containing 40 nodes and 60 edges. A greedy coloring algorithm was used to color the nodes in descending order of degree, and 5 colors were used to mark parallel tasks of different granularities. The critical path method analysis found that the critical path length was 8, containing 6 tasks, and 4 tasks on the non-critical path were reallocated. Data flow analysis tracked the transfer of 100 data items between tasks and constructed a 40x40 data dependency matrix, in which 78 elements with a value of 1 indicated dependency. 15 pairs of parallel tasks with potential data conflicts were identified. A parallelism evaluation function was designed with weight coefficients w1=0.5, w2=0.3, and w3=0.2. The simulated annealing algorithm had an initial temperature of 100, a cooling coefficient of 0.95, and 50 iterations per temperature. After 2000 iterations, the optimal parallel granularity combination was obtained, which was 2 step-level tasks, 8 operation-level tasks, and 18 data-level tasks. The evaluation of the parallel task scheduling simulator shows that the actual speedup ratio of the optimized solution is increased from 1.8 to 2.7 compared with the initial solution, and the resource utilization rate is increased from 65% to 82%, which is close to the theoretical expectation of 2.9 and 85%. The final output parallel optimization solution achieves a balance between complexity and benefits, and meets the dependency constraints and data consistency requirements.
[0060] S106. For cross-device NFC interactions, a distributed task scheduling algorithm is used to coordinate the task allocation and execution progress of multiple devices, dynamically adjust task allocation according to the computing power and load conditions of the devices, and allocate part of the computing tasks to the device side for parallel processing. Through collaborative computing between devices and distributed storage of programmable data, end-to-end full-link parallel optimization is achieved to reduce the computing pressure on the server.
[0061] A task decomposition request carrying NFC interaction process information is received, and the task decomposition request is issued when the system is initialized; according to the task decomposition request, a graph-based task decomposition algorithm is used to decompose the NFC interaction process into fine-grained task units and construct a task dependency graph; the execution score of each task unit in the task dependency graph is obtained, and the execution score is calculated by a static code analysis tool; if the task unit execution score is obtained, a distributed task scheduling algorithm is used to solve the optimal task allocation scheme through the maximum flow minimum cut algorithm; according to the optimal task allocation scheme, a lightweight execution engine is deployed on the device side, the assigned tasks are received and local calculations are performed; a sliding time window is used to monitor the device status in real time and dynamically adjust the task allocation strategy; programmable data is obtained, and the consistent hashing algorithm is used to disperse and store the programmable data on multiple devices; server-side load monitoring data is received, and the load monitoring data is collected in real time by a load balancer; if the load monitoring data exceeds a preset threshold, a task reallocation mechanism is triggered to migrate more computing tasks to the device side.
[0062] Specifically, a graph-based task decomposition algorithm is used to decompose the NFC interaction process into fine-grained task units and construct a task dependency graph. Static code analysis tools are used to calculate the cyclomatic complexity and number of instructions of the task. Combined with historical execution time data, a complexity scoring model is established to mark the computational complexity and data dependency of the task, providing a basis for subsequent distributed scheduling. A distributed task scheduling algorithm is used to calculate the task execution score of each device based on the computing power and current load status of the device. The device is regarded as a source point, the task is regarded as a sink point, and the edge weight from the device to the task is set as the execution score of the device. The maximum flow minimum cut algorithm is used to solve the optimal task allocation scheme to achieve load balancing. A lightweight execution engine is deployed on the device side to receive the assigned tasks and perform local calculations. A 5-minute sliding time window is used to update the device status every 30 seconds, calculate the average CPU usage, memory usage and network bandwidth within the window, monitor the computing power and load changes of the device in real time, and dynamically adjust the task allocation strategy. A distributed data storage layer is built, and a consistent hashing algorithm is used to store programmable data on multiple devices in a distributed manner. The Raft consensus algorithm is used to maintain data consistency. The heartbeat interval is set to 100ms, the election timeout is set to a random value of 300-500ms, log replication is used to ensure data consistency, and the log size is controlled by the log compression mechanism. Local access and parallel processing of data are achieved to complete end-to-end full-link parallel optimization. A load balancer is deployed to monitor the server CPU, memory, and network load in real time. When the load exceeds 80%, the task redistribution mechanism is triggered to migrate more computing tasks to the device side. In the cross-device NFC interaction optimization, the graph-based task decomposition algorithm is first used to split the interaction process into 50 fine-grained task units, and a task dependency graph containing 75 edges is constructed. The static code analysis tool calculates that the average cyclomatic complexity of the task is 8 and the average number of instructions is 500. Combined with historical data, the complexity scoring model is established as score = 0.3*cyclomatic complexity + 0.5*number of instructions / 100 + 0.2*historical execution time (ms). The distributed scheduling algorithm considers the computing power and load of the five devices to calculate the task execution score. Take 5 devices as source points and 50 tasks as sink points to build a maximum flow network, and set the edge weight as the device execution score. The maximum flow minimum cut algorithm solves the optimal allocation scheme, which is to allocate 12 tasks to device 1, 10 tasks to device 2, 15 tasks to device 3, 8 tasks to device 4, and 5 tasks to device 5. The device-side execution engine uses a 5-minute sliding window and updates the status every 30 seconds. It is calculated that the average CPU usage of device 1 is 70%, the memory usage is 60%, and the network bandwidth is 15Mbps. The distributed storage layer uses a consistent hashing algorithm to distribute 100GB of programmable data to 5 devices. The Raft consensus algorithm maintains data consistency, with a heartbeat interval of 100ms and an election timeout of 300-500ms random value. Log compression is triggered every 1000 records or 10MB.Load balancer monitoring showed that the server CPU usage dropped to 65%, memory usage dropped to 55%, and network load dropped to 70%. 30% of computing tasks were successfully migrated to the device side, achieving end-to-end full-link parallel optimization.
[0063] S107. For NFC interactions with large amounts of data, a data slicing method is used to divide the programmable data into multiple small blocks, and a multiplexing mechanism is used to transmit the small data blocks in parallel on multiple channels, making full use of the communication bandwidth to shorten the data transmission delay, and a programmable data security mechanism is used to ensure data security during the transmission process.
[0064] Receive network access request information carrying a unique identification number of a smart meter, the network access request information is issued by the smart meter when it accesses the network. Send an authentication instruction to the smart meter according to the network access request information, and the smart meter sends a visible light communication signal containing the unique identification number of the smart meter according to the authentication instruction. Receive a network access confirmation instruction with a terminal identification number and a unique identification number of the smart meter, the network access confirmation instruction is generated by the terminal after receiving the visible light communication signal. Determine whether the terminal identification number is legal, specifically including querying a work order database, wherein the work order database contains work order data with a work terminal identification number; determine whether there is a work terminal identification number that is the same as the terminal identification number in the work order database. If there is a work terminal identification number that is the same as the terminal identification number in the work order database, then determine that the terminal identification number is legal. If the terminal identification number is determined to be legal, then allow the unique identification number of the smart meter to pass the network access authentication. Obtain an authentication result obtained by the authentication server based on the legality of the terminal identification number, and the authentication result is used to determine whether the smart meter is allowed to access the network.
[0065] Specifically, when the smart meter accesses the network, it will send a network access request message with a unique identification number, which consists of 32 digits and letters. After receiving the request, the system will send a 128-bit random string to the smart meter as an authentication instruction. After receiving the instruction, the smart meter uses the AES-128 algorithm to encrypt the unique identification number and sends the encryption result through visible light communication technology, with a transmission power of 10mW and modulation mode of OFDM. After receiving the visible light signal, the working terminal demodulates the unique identification number of the smart meter, and splices its own terminal identification number with it to generate a network access confirmation instruction, which is sent to the system through the 4G network. After receiving the instruction, the system will query whether the terminal identification number exists in the work order database. The work order database contains 1,000 work order data and uses a B+ tree index. The query time complexity is O(logn). If the terminal identification number is found to exist, it is determined to be legal and the smart meter is allowed to pass the network access authentication; otherwise, the authentication fails. Finally, the authentication result will be obtained from the authentication server. The server uses the RADIUS protocol and supports processing 1,000 authentication requests per second. According to the authentication result, an access confirmation or rejection message is sent to the smart meter using the MQTT protocol with a QoS level of 1 to ensure reliable transmission.
[0066] The above is only a preferred embodiment of the present invention. It should be pointed out that ordinary technicians in this technical field can make several improvements and supplements without departing from the principle of the present invention. These improvements and supplements should also be regarded as the scope of protection of the present invention.
Claims
1. A programmable data interaction method based on NFC, characterized in that: The method comprises: The device status and real-time parameters of the network status during the NFC interaction process are obtained. According to the parameter information, the decision tree algorithm is used to dynamically adjust the execution order of the NFC interaction steps, and the independent steps without dependencies are marked as executable in parallel, so as to obtain the optimized execution order of the NFC interaction steps, which is as follows: Obtaining real-time data on NFC device status parameters and network conditions, and monitoring key indicators such as signal strength, data transmission rate, and response time in the real-time data; According to the monitoring results of key indicators, the NFC interaction process model is constructed using the C4.5 decision tree algorithm, which uses the information gain ratio as the feature selection criterion; For the NFC interaction process model, a directed acyclic graph is used to represent the dependency relationship between NFC interaction steps, and the directed acyclic graph includes nodes and connections between nodes; Analyze the directed acyclic graph by a topological sorting algorithm, identify the steps that are independent of each other and have no dependencies, and mark the steps that are independent of each other and have no dependencies as tasks that can be executed in parallel; Generate an optimized interactive process including serial and parallel execution instructions, wherein the execution instructions in the optimized interactive process are sent to an NFC control module, wherein the NFC control module includes an instruction parser, a task scheduler, and a hardware driver interface; The instruction parser receives and parses the execution instruction, the task scheduler coordinates the task execution order according to the parallel mark in the execution instruction, and the hardware driver interface interacts with the NFC hardware according to the task execution order to perform read, write and authentication operations; It also includes: obtaining a standard NFC interaction process from pre-established interaction steps, performing independence analysis on each interaction step, establishing an interaction step dependency graph, traversing the dependency graph using a graph theory algorithm, identifying all potential parallel execution opportunities, and determining the dependency relationship between steps. If there is no direct dependency between two steps, they are marked as a step pair that can be executed in parallel. Specifically, it includes: obtaining a standard NFC interaction process from a pre-established interaction step database, performing independence analysis on the interaction steps, and calculating the correlation between steps using a Pearson correlation coefficient; Determine whether the correlation coefficient is less than a preset threshold. If so, determine that the step is an independent step. Construct an interactive step dependency graph based on the independence analysis result. The dependency graph uses a weighted adjacency matrix to represent the dependency relationship between steps. Perform a depth-first search on the dependency graph to identify strongly connected components. The depth-first search uses the Tarjan algorithm. For node pairs that are not in the same strongly connected component, they are determined to be potential parallel execution opportunities, and the potential parallel execution opportunities are verified. The Petri net model is used for verification to determine that parallel execution does not lead to deadlock or resource competition. For the verified parallel executable step pairs, the critical path method is used to analyze the parallel task execution time. According to the step execution time and resource requirements, the genetic algorithm is used to optimize the resource allocation strategy, and the optimized NFC interaction process is output. The optimized NFC interaction process includes steps that can be executed in parallel.
2. The method according to claim 1 further comprises, according to the organization mode and access characteristics of programmable data, in combination with the granularity division result of parallel tasks, using a multi-threaded programming model to allocate an independent execution thread to each parallel NFC interaction step, managing thread resources through a thread pool, dynamically adjusting the number of threads, and determining the optimal concurrency under the premise of ensuring the consistency of programmable data, so as to improve the concurrency and throughput of NFC interaction, specifically: Acquire NFC interaction data, where the NFC interaction data is stored in a multidimensional array structure; Retrieving the NFC interaction data in the multidimensional array structure by a bitmap indexing method to obtain a retrieval result; According to the search results, the NFC interaction steps are divided into fine-grained subtasks using the critical path method; For the fine-grained subtask, an independent execution thread is allocated, and the execution thread is generated by a multi-threaded programming model; If the fine-grained subtask is executed, a two-phase locking protocol is used to implement concurrency control, and the concurrency control adopts a read-write lock mechanism to achieve data sharing and mutual exclusion; Collecting real-time data of concurrent execution through performance counters, wherein the real-time data includes thread utilization and task waiting time; A performance prediction model is established based on the real-time data using a random forest algorithm, wherein the performance prediction model is used to guide dynamic adjustment of concurrency; It also includes: for each step in the NFC interaction process, analyzing its computational complexity and resource requirements, establishing a task feature model, including task type, estimated execution time, memory usage parameters, clustering tasks with similar features using a task classification algorithm, and obtaining a task granularity division scheme, specifically including: obtaining static code analysis results for each step of the NFC interaction process, the static code analysis results including loop nesting depth, number of conditional branches, and number of function calls; calculating the computational complexity score of each step based on the static code analysis results, the computational complexity score being derived from a weighted sum model; collecting system parameters during the NFC interaction process, the system parameters including CPU usage, memory usage, and so on. The occupancy and I / O operation frequency are calculated by using the sliding window method, and the average value in the window is calculated as the execution time, and the preset quantile is taken as the peak resource consumption; a task feature vector is constructed, and the task feature vector contains feature data composed of the computational complexity score and system parameters; the feature data is subjected to dimensionality reduction processing, and the dimensionality reduction processing adopts the principal component analysis method, and the first k principal components whose cumulative contribution rate reaches the preset range are selected as the main feature combination; after the main feature combination is determined, the main feature combination is subjected to cluster analysis, and the cluster analysis adopts the K-means++ algorithm, and the optimal number of clusters is determined by calculating the silhouette coefficient, so as to obtain the final task clustering result and granularity division scheme.
3. The method according to claim 1 further comprises: constructing a directed acyclic graph by a depth-first search algorithm to describe the dependency relationship between the NFC interaction steps, calculating the optimal execution order of the steps by a topological sorting algorithm, so that the dependent steps are executed first, and the independent steps are executed later and as parallel as possible, and optimizing data locality according to the distributed storage characteristics of programmable data, so as to obtain the NFC interaction step execution order that takes into account both parallel execution and data access efficiency, specifically: A depth-first search algorithm is used to traverse the NFC interaction steps and a directed acyclic graph is constructed to represent the dependency relationship between the steps. The nodes in the graph represent the interaction steps and the edges represent the dependency relationship. According to the edges in the directed acyclic graph, setting the weights of the edges, wherein the weights are obtained by estimating the size of data exchange between each step through static code; Using the Kahn algorithm to topologically sort the directed acyclic graph and calculate the optimal execution order of the steps; Based on the result of the topological sorting, the critical path method is used to identify parallel execution opportunities. If the execution time intervals of two steps do not overlap, they are marked as being executable in parallel. Generate a preliminary parallel execution plan using a list scheduling algorithm according to the parallel executable mark; Calculating the degree of data sharing between steps and constructing an affinity matrix, wherein the degree of data sharing is based on the distributed storage characteristics of programmable data; using a spectral clustering method to group steps with high correlation into the same computing node, wherein the correlation is determined according to the affinity matrix; According to the grouping results, the parallel execution plan is adjusted to generate an execution sequence of NFC interaction steps that takes into account both parallel execution and data access efficiency; It also includes: using a parallel execution potential maximization strategy to analyze the topological sorting results, identify a set of steps that can be executed in parallel, build a parallel execution group, calculate the data access mode of the steps in each parallel execution group through a data locality optimization algorithm, and reorder the steps to optimize the data access locality, specifically including: obtaining the execution time window of the step, and using the critical path method to calculate the earliest start time and the latest completion time of the step; judging the parallel possibility between steps according to the execution time window, and identifying a set of steps that can be executed in parallel; using the Kernighan-Lin algorithm to divide the graph according to the set of parallel execution steps to obtain parallel execution groups; for the parallel execution group, using a bitmap to represent the data access mode of each step, and building a data access vector; according to the data access vector, calculating the data reuse and access locality index between steps; reordering the steps in the parallel execution group, and optimizing them using a genetic algorithm, wherein the fitness function is obtained by combining data reuse, cache hit rate and switching overhead between steps; and using a performance simulator to calculate the expected execution time and resource utilization for the reordered execution order.
4. The method according to claim 1 further comprises obtaining the execution time of each step in the NFC interaction process, the key performance indicator data of the access frequency of programmable data, establishing a performance prediction model through a support vector machine regression algorithm, predicting the interaction efficiency under different execution orders and data organization modes, and selecting the optimal execution order and data layout according to the prediction results, specifically: Obtain key performance indicator data of execution time of each step in the NFC interaction process and access frequency of programmable data; According to the key performance indicator data, the Z-score standardization method is used to standardize the data, and the interquartile range method is used to detect and process outliers; Perform feature engineering on the standardized performance indicator data, extract key feature vectors of execution time, access frequency, and data dependency, and construct an input feature matrix; The importance of the feature vector is calculated using a random forest algorithm, and features with a preset ratio of importance ranking are selected; If the correlation coefficient between features is higher than the threshold, the redundant features are removed; The grid search method is used to determine the optimal hyperparameters of the support vector machine regression algorithm, where the kernel function type selects RBF and linear kernel, the C value range is the preset value, and the gamma range is the preset value; The support vector machine regression model is trained according to the optimal hyperparameters, and feature vectors of different execution orders and data organization methods are input to obtain predicted interaction efficiency; K-fold cross validation is used to evaluate the performance of the regression model, and the model with the best performance on the validation set is selected; According to the prediction results, the execution order and data layout scheme with the highest interaction efficiency are determined.
5. The method according to claim 1 further comprises: optimizing multi-granularity parallel tasks of NFC interaction steps, selecting parallel granularity according to step level, operation level, and data level, determining dependency constraints between parallel tasks through dependency relationships of programmable data, maximizing the degree of parallelization while satisfying dependency constraints and data consistency, using a heuristic algorithm to search for the optimal parallel granularity combination, and balancing the complexity and benefits of parallel optimization, specifically: Perform multi-granularity analysis on NFC interaction steps, obtain task division at step level, operation level, and data level, and construct a task dependency graph; According to the task dependency graph, a greedy coloring algorithm is used to color the nodes in descending order of degree to obtain an initial parallel granularity combination scheme for marking parallel tasks of different granularities; Use a two-dimensional matrix to represent the data dependency between tasks. If there is a dependency between tasks, the matrix element value is 1, and if there is no dependency, the matrix element value is 0, and the data dependency matrix is established; Based on the parallelism evaluation function f=w1*(1 / T)+w2*R+w3*(1 / D), where T is the execution time, R is the resource utilization, D is the data access overhead, and w1, w2 and w3 are weight coefficients, the parallelization degree scores of different parallel granularity combinations are calculated; The simulated annealing algorithm is used to search for the optimal parallel granularity combination. The initial temperature is set to 100, the cooling coefficient is 0.95, 50 iterations are performed at each temperature, and the termination temperature is 0.
01. The parallel granularity is randomly adjusted in each iteration, and the score of the new solution is calculated according to the evaluation function to obtain the optimal solution that balances the complexity and benefit of parallel optimization.
6. The method according to claim 1 further comprises, for cross-device NFC interactions, using a distributed task scheduling algorithm to coordinate the task allocation and execution progress of multiple devices, dynamically adjusting the task allocation according to the computing power and load status of the device, allocating part of the computing tasks to the device for parallel processing, and achieving end-to-end full-link parallel optimization through collaborative computing between devices and distributed storage of programmable data to reduce the computing pressure on the server, specifically: receiving a task decomposition request carrying NFC interaction process information, wherein the task decomposition request is issued when the system is initialized; According to the task decomposition request, a graph-based task decomposition algorithm is used to decompose the NFC interaction process into fine-grained task units, and a task dependency graph is constructed; Obtaining an execution score of each task unit in the task dependency graph, where the execution score is calculated by a static code analysis tool; If the task unit execution score is obtained, the distributed task scheduling algorithm is used to solve the optimal task allocation solution through the maximum flow minimum cut algorithm; Deploy a lightweight execution engine on the device side according to the optimal task allocation scheme, receive the allocated tasks and perform local calculations; Use sliding time windows to monitor device status in real time and dynamically adjust task allocation strategies; Acquire programmable data, and use a consistent hashing algorithm to disperse and store the programmable data on multiple devices; Receiving server-side load monitoring data, the load monitoring data being collected in real time by a load balancer; If the load monitoring data exceeds a preset threshold, the task reallocation mechanism is triggered to migrate more computing tasks to the device side.
7. The method according to claim 1 further comprises, for NFC interactions with large amounts of data, using a data slicing method to divide the programmable data into multiple small blocks, using a multiplexing mechanism to transmit the small data blocks in parallel on multiple channels, making full use of the communication bandwidth to shorten the data transmission delay, and using a programmable data security mechanism to ensure data security during the transmission process, specifically: Receiving network access request information carrying a unique identification number of a smart meter, wherein the network access request information is sent when the smart meter is connected to a network; Sending an authentication instruction to the smart meter according to the network access request information, and the smart meter sending a visible light communication signal including a unique identification number of the smart meter according to the authentication instruction; Receiving a network access confirmation instruction with a terminal identification number and a unique identification number of a smart meter, wherein the network access confirmation instruction is generated after the terminal receives a visible light communication signal; Determining whether the terminal identification number is legal specifically includes querying a work order database, wherein the work order database contains work order data with the work terminal identification number; Determine whether there is a work terminal identification number identical to the terminal identification number in the work order database; If the work order database has a work terminal identification number that is identical to the terminal identification number, then determining that the terminal identification number is legal; If the terminal identification number is determined to be legitimate, the unique identification number of the smart meter is allowed to pass the network access authentication; An authentication result obtained by the authentication server based on the legitimacy of the terminal identification number is obtained, and the authentication result is used to determine whether the smart meter is allowed to access the network.
8. A programmable data interaction system based on NFC, used to execute the method according to any one of claims 1 to 7, characterized in that: The system comprises: Device status dynamic adjustment module, used to optimize NFC interaction steps based on real-time status and decision tree algorithm; Multithreaded programming model module, used to allocate independent threads for parallel execution and manage thread resources; Dependency optimization module, used to construct directed acyclic graphs and topological sorting to optimize the order of NFC steps; Performance prediction and optimization module, used to predict interaction efficiency and optimize data layout through support vector machine regression algorithm; Parallel task granularity optimization module, used to select parallel granularity and use heuristic algorithm to search for the optimal combination; Distributed task scheduling module, used to coordinate task allocation and computing collaboration among devices to achieve full-link parallel optimization; The data segmentation and transmission module is used to segment the data and transmit it in parallel through multiplexing to ensure data security.
Citation Information
Patent Citations
Parallel programming model system of DAG oriented data driving type application and realization method
CN101710286A
Remote sensing image parallel cluster processing scheduling strategy suitable for Internet scene
CN112114960A