Food detection process automation method and system
By acquiring the sample injection time and detection value sequence of the food testing device, calculating the deviation amplitude, and adjusting the execution time parameters in combination with PID control, the problem of time error and instability of detection data caused by sample state fluctuations in the food testing process is solved, and efficient and reliable automation of the food testing process is achieved.
Patent Information
- Application Number
- CN202511285851.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-10
- Publication Date
- 2025-12-02
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In existing food testing processes, fluctuations in sample condition lead to time errors and instability in test data, affecting the stability and repeatability of test results. In particular, inconsistent response times in high-throughput testing tasks result in decreased testing efficiency and reliability.
By acquiring the actual time consumed and the sequence of detection values in the sample injection process, the deviation amplitude is calculated, and the execution time parameters are adjusted in conjunction with PID control to achieve dynamic control duration revision, ensuring the completion of the injection behavior and the stability of the detection, and generating an automated control record for the food testing process configuration.
It improves the time accuracy and data consistency of the detection process, enhances the adaptability and self-adjustment capability of the detection process, and ensures the reliability and consistency of the detection results.
Smart Images

Figure CN121049531A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of process automation control technology, and in particular to a method and system for automating food testing processes. Background Technology
[0002] The field of process automation control technology involves the automated management and coordination of multi-step continuous operations in various systems such as industry, agriculture, and medicine. This includes the sequential control, parameter adjustment, and status monitoring of each operational node in the process flow. Typically, program-based control logic is used to automatically control the entire process. Specifically, food testing process automation methods refer to the automatic execution of operations such as sample collection, reagent addition, reaction control, and data reading in food quality and safety testing. This typically employs relay logic control systems or PLC sequential control programs to schedule testing tasks and set testing conditions. This includes setting the sequential logic of the testing program, triggering operation flow switching using limit switches, and controlling the duration of each stage using preset timers.
[0003] In existing food testing processes, the testing rhythm is mainly set by a program sequence control method, relying on preset timers and limit switches for operation switching and duration control. Due to the constraints of fixed parameters, it is difficult to cope with time errors and unstable test data caused by sample state fluctuations. In actual testing, data deviations are easily caused by insufficient or excessive sample injection, and it is impossible to provide real-time feedback and correction for subtle fluctuations that occur in the testing process, resulting in poor stability and low repeatability of test results. For example, in high-throughput testing tasks, this type of control method often leads to inconsistent response times between multiple samples, thereby affecting testing efficiency and result reliability. Summary of the Invention
[0004] The purpose of this invention is to address the shortcomings of existing technologies by proposing an automated method for food testing processes.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: an automated method for food testing processes, comprising the following steps: S1: Obtain the single step execution signal and corresponding actual consumption time of the sample injection stage in the food testing device, count the step time value and the current target step total number and perform multiplication operation, calculate the control duration value of the set execution sequence, and generate sample injection timing reference data. S2: Read the sequence of test values obtained from three consecutive samplings under the operation node during the food testing process, calculate the numerical difference between two adjacent sets of test values and perform absolute value calculation, and generate statistical data on the deviation of the test sequence. S3: Based on the sample injection timing reference data and the detection sequence deviation amplitude data, determine whether the injection action has been completed and whether the completion time is within the set timing range. At the same time, determine whether the deviation amplitude is within the allowable deviation range. If both conditions are met, set the signal output allowable state, mark it as a valid output state, and generate an injection control signal linkage state record. S4: Based on the valid output status in the injection control signal linkage status record, adjust the proportional gain of the current injection timing reference value using PID control, update the target execution time parameter set in the next injection task, and obtain the injection control time revision data.
[0006] As a further aspect of the present invention, the sample injection timing reference data includes control duration value, step time value, and total number of target steps; the detection sequence deviation amplitude data includes absolute value of the difference between detection values, adjacent sampled detection value pairs, and deviation amplitude results; the injection control signal linkage status record includes injection action completion status, timing range validity, deviation amplitude compliance, and signal output allow status mark record; and the injection control time revision data includes updated target execution time parameters, proportional gain adjustment data, and PID control response adjustment value.
[0007] As a further aspect of the present invention, the step of obtaining the sample injection timing reference data specifically includes: S111: Based on the single step execution signal and the corresponding actual consumption time of the sample injection stage in the food testing device, the time value of a single step action and the total number of steps of the current task target are statistically analyzed. The total step duration is obtained by multiplying the step time value and the total number of steps. S112: Based on the total step duration value, and according to the required execution synchronization accuracy of the injection control action, collect three data items: response feedback time, execution delay time, and control start time of the injection stage. By correlating the three time data items with the total step duration, obtain the control synchronization difference value. S113: Based on the control synchronization difference value and the total step duration value, the data content is integrated to obtain the synchronization control execution time information under the injection task and generate sample injection timing reference data.
[0008] As a further aspect of the present invention, the step of obtaining the detection sequence deviation amplitude data specifically includes: S211: Obtain the sequence of test values obtained from three consecutive samplings under the operation node during the food testing process, synchronously record the time point of each sampling and the identification code of the corresponding testing channel, construct the test value sequence according to the sampling order of the three test results, and associate each sample value with the corresponding sampling number and channel number to obtain the test value sequence data; S212: Based on the detection value sequence data, extract the pairwise combinations of the three samples, identify the positional relationship in the sequence, identify the magnitude of the numerical change of adjacent sampling groups, determine the fluctuation range of two consecutive sampling results in the detection value sequence, and quantify the segmental difference of the overall change between the first and last detection values to form the detection difference combination quantity. S213: Based on the detection difference combination, interval matching is performed in conjunction with the deviation interval benchmark. The amplitude level is identified by comparing the correspondence with the upper and lower limits of the deviation interval benchmark. Interval labels are added to different amplitude levels, and the sampling node number and sampling time information are bound simultaneously to generate detection sequence deviation amplitude data.
[0009] As a further aspect of the present invention, the step of obtaining the injected control signal linkage state record specifically includes: S311: Based on the sample injection timing reference data and the actual injection completion time recorded in the detection task, determine whether the injection action has been completed, and determine whether the completion time is within the timing range set by the reference. Record the status mark and generate a timing range satisfaction status record. S312: Based on the detection sequence deviation amplitude data, extract all detection fluctuation amplitude data under the current detection task, and determine whether each amplitude value is within the allowable deviation range, whether the detection data meets the stability requirements, and generate a detection stability compliance status record. S313: Based on the timing range satisfying state record and the detection stability conforming state record, read the state records sequentially and perform a joint judgment operation with the control signal output rules. If all are valid states, construct an identifier for allowing the injection control signal output, and synchronously register the control task number, current node number and trigger time information in the task instruction response table to generate an injection control signal linkage state record.
[0010] As a further aspect of the present invention, the step of obtaining the injection control time revision data specifically includes: S411: Based on the output status data in the injection control signal linkage status record, extract the effective output task structure, identify the corresponding injection task number and timing parameters, and filter the associated injection timing reference value. Through the effective status filtering operation, form a task activation set and generate activation injection task set data. S412: Based on the activation injection task set data, combined with the injection timing reference value in the task and the Kp value in the PID control parameter configuration table, identify the proportional gain setting value corresponding to the current task execution time, calculate and obtain the adjusted proportional gain value and write it into the task parameter structure, and at the same time update the target time in the timing reference to generate the adjusted target time parameter. S413: Based on the adjusted target time parameter, write the adjusted target execution time into the current scheduling task structure, and at the same time update the version number of the PID adjustment action and generate the corresponding revision record to form a traceable parameter change chain. Integrate all structure update content and generate injection control time revision data.
[0011] As a further aspect of the present invention, the method further includes: S5: Based on the injection control time revision data, fill the target execution time parameter into the control instruction configuration, activate the corresponding injection rhythm control signal, and write the signal structure into the status interface of the automation control to generate the food testing process configuration automation control record. The automated control record configuration for the food testing process includes injection rhythm control signals, control command configuration data, and status interface signal structure.
[0012] As a further aspect of the present invention, the steps for acquiring automated control records in the food testing process specifically include: S511: Based on the injected control time revision data, write the revised target execution time parameter into the control instruction configuration structure of the current task, and update the control version number and adjustment status flag in the status record area. After the filling action is performed, the operation batch number and writing timestamp are recorded synchronously to generate control instruction configuration time value structure data. S512: Based on the control command, configure time value structure data, determine whether the current task meets the rhythm control activation condition, and after the determination is successful, associate the task target time with the detected rhythm, generate the initial parameters of the injected rhythm control signal according to the set rhythm logic, combine them to form the content of the signal structure buffer area, and generate the injected rhythm control signal data. S513: Based on the injected rhythm control signal data, the signal content is sequentially written into the automated control status interface, and status interface task structure entries are generated. At the same time, the link pointer of the corresponding detection task structure is generated to obtain the food detection process configuration automated control record.
[0013] An automated food testing process system includes: The injection time matching module is used to execute S1: acquire the single step execution signal and corresponding actual consumption time of the sample injection link in the food testing device, count the step time value and the current task target step total number and perform multiplication operation, calculate the control duration value of the set execution sequence, and generate sample injection timing reference data. The data stability calculation module is used to execute S2: read the sequence of test values obtained from three consecutive samplings under the operation node during the food testing process, calculate the numerical difference between two adjacent sets of test values and perform absolute value calculation, and statistically generate test sequence deviation amplitude data; The linkage signal verification module is used to execute S3: based on the sample injection timing reference data and the detection sequence deviation amplitude data, it determines whether the injection action has been completed and whether the completion time is within the set timing range, and at the same time determines whether the deviation amplitude is within the allowable deviation range. If both conditions are met, the signal output allowable state is set, marked as a valid output state, and an injection control signal linkage state record is generated. The time parameter revision module is used to execute S4: based on the valid output status in the injection control signal linkage status record, adjust the PID control proportional gain of the current injection timing reference value, update the target execution time parameter set in the next round of injection task, and obtain injection control time revision data; The automated control configuration module is used to execute S5: based on the injection control time revision data, fill the target execution time parameter into the control instruction configuration, activate the corresponding injection rhythm control signal, and write the signal structure into the status interface of the automated control to generate the food testing process configuration automated control record.
[0014] Compared with the prior art, the advantages and positive effects of the present invention are as follows: In this invention, by introducing a joint judgment method based on injection timing and detection value fluctuation, the actual step time is statistically analyzed and associated with the task target to generate a dynamic control duration. Simultaneously, continuous detection data sequences are collected to quantify the deviation amplitude, achieving a dual judgment on the completion of injection behavior and detection stability. The target execution time parameters are revised in reverse by combining signal linkage status, and the execution parameters of subsequent operations are dynamically corrected based on feedback results. By configuring synchronous injection rhythm signals and status interface content with control commands, the responsiveness of the detection process to time accuracy and data consistency is effectively improved, the coordination and matching degree between injection rhythm and detection response is enhanced, and the food detection process scheduling is adaptive, self-regulating, and reliable. Attached Figure Description
[0015] Figure 1 This is a flowchart of the main steps of the present invention; Figure 2 This is a flowchart of the process for obtaining timing reference data for sample injection in this invention. Figure 3 This is a flowchart of the process for acquiring sequence deviation amplitude data in this invention; Figure 4 Flowchart for obtaining control signal linkage status records in this invention; Figure 5 A flowchart for obtaining control time revision data is provided for this invention; Figure 6 A flowchart illustrating the automated control and record acquisition process for the food testing workflow of this invention. Detailed Implementation
[0016] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0017] In the description of this invention, it should be understood that the terms "length," "width," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships, are based on the orientation or positional relationships shown in the accompanying drawings and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, in the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0018] Please see Figure 1 An automated method for food testing processes includes the following steps: S1: Obtain the single step execution signal and corresponding actual consumption time of the sample injection stage in the food testing device, count the step time value and the current target step total number and perform multiplication operation, calculate the control duration value of the set execution sequence, and generate sample injection timing reference data. S2: Read the sequence of test values obtained from three consecutive samplings under the operation node during the food testing process, calculate the numerical difference between two adjacent sets of test values, perform absolute value operation on the difference result, and statistically generate test sequence deviation amplitude data; S3: Based on the sample injection timing reference data and the detection sequence deviation amplitude data, determine whether the injection action has been completed and whether the completion time is within the set timing range. At the same time, determine whether the deviation amplitude is within the allowable deviation range (the repeatability limit (r value) and reproducibility limit (R value) defined by international standards, used to determine the stability of the detection results, and the standard is the maximum allowable deviation within the 95% confidence interval). If both conditions are met, set the signal output allowable state, mark it as an effective output state, and generate an injection control signal linkage state record. S4: Based on the effective output status in the injection control signal linkage status record, adjust the proportional gain of the current injection timing reference value using PID control (the parameter adjustment method defined by the industrial process control standard, which reduces the system response speed by reducing the proportional gain (Kp value), with the standard being a reduction in adjustment time of more than 20%), update the target execution time parameter set in the next round of injection task, and obtain the injection control time revision data; S5: Based on the injection control time revision data, the target execution time parameter is filled into the control instruction configuration, the corresponding injection rhythm control signal is activated, and the signal structure is written into the status interface of the automation control to generate the food testing process configuration automation control record.
[0019] The sample injection timing reference data includes control duration, step time, and total number of target steps. The detection sequence deviation amplitude data includes the absolute value of the difference between detection values, adjacent sampled detection value pairs, and deviation amplitude results. The injection control signal linkage status record includes the injection action completion status, timing range validity, deviation amplitude compliance, and signal output allow status mark record. The injection control time revision data includes the updated target execution time parameter, proportional gain adjustment data, and PID control response adjustment value. The food testing process configuration automation control record includes the injection rhythm control signal, control command configuration data, and status interface signal structure.
[0020] Please see Figure 2 Step S1 is as follows: S111: Based on the single step execution signal and the corresponding actual consumption time of the sample injection stage in the food testing device, the time value of a single step action and the total number of steps of the current task target are statistically analyzed. The total step duration is obtained by multiplying the step time value and the total number of steps. Based on the single-step execution signal and corresponding actual consumption time of the sample injection stage in the food testing device, this stage is decomposed. It is necessary to clarify the trigger frequency of the single-step signal command and the start and end points of the corresponding response record. During implementation, the timestamp of the step signal generation can be exported from the system control log, and the start and end times of the actuator are recorded synchronously. For example, if the single-step signal trigger time is detected to be 12.002 seconds, the response start time is 12.010 seconds, and the execution completion time is 12.065 seconds during actual equipment operation, then the actual consumption time of this step action can be calculated as 0.055 seconds. Simultaneously, it is necessary to identify the total number of steps required in the current injection task. This parameter can be obtained through the task scheduling sequence. For example, if the current task plan sets 17 step actions to be completed, combined with the previously statistically analyzed single-step action time values... Data is combined to form a complete step-time structure chain. In this process, the timing differences of the step signals in different time periods should be identified, and the time values of each step node are classified and aggregated to form a periodic data array. For example, when the time values of the 1st to 17th step cycles fluctuate between 0.055 seconds and 0.062 seconds, the 17 data points can be summed and their cumulative sum recorded, which is the total step duration value of the entire injection process. During the acquisition of this type of time data, the clock frequency error of the device itself and the processing delay caused by the control logic need to be considered. Therefore, the device timer accuracy calibration value needs to be introduced as a benchmark reference in the data preprocessing stage. For example, if the current device timer error is ±0.002 seconds, the boundary correction of all single step time values needs to be performed. Finally, the total step duration value is obtained through data aggregation.
[0021] S112: Based on the total step duration value and the required execution synchronization accuracy of the injection control action, collect three data points: response feedback time, execution delay time, and control start time of the injection stage. By correlating these three time data points with the total step duration, obtain the control synchronization difference value. Using the obtained total step time value, and based on the synchronization accuracy standard required by the current injection control action, time parameters of each control module involved in the injection process are collected and coordinated for verification. Specifically, three data points need to be monitored: module response feedback time, execution delay time, and control start time. These three data points can be obtained through the task feedback data packets of the control system. For example, if the response feedback time of control module A is 0.007 seconds, the execution delay time is 0.011 seconds, and the control start time is 0.009 seconds, totaling 0.027 seconds, a significant difference can be found when compared with the aforementioned total step time value. If the total step time is 0.897 seconds, it is necessary to determine whether the cumulative time of the three items causes a time deviation in the overall injection process. During processing, the time points of each module should be arranged into a time sequence, and then a time sequence matrix table should be generated according to the module number and time sequence arrangement. This matrix table should then be compared with the total step time value. Perform an association matching operation to determine if the predetermined injection synchronization standard is met. If not, record the synchronization error value. This synchronization error can be defined as the absolute value of the difference between the cumulative time value of the control module and the total step duration. To improve the accuracy of error judgment, a synchronization difference judgment benchmark value should be introduced. This benchmark value can be set with reference to the system synchronization judgment specification. For example, if the system requires the synchronization difference value not to exceed 0.04 seconds, then set the synchronization difference judgment benchmark value to 0.04 seconds. When the actual difference value is less than this benchmark value, the synchronization is judged to be normal; otherwise, it is recorded as an abnormal state. The specific threshold setting is based on the system performance stability. For example, the rationality of a synchronization threshold of 0.04 seconds can be obtained through multiple tests. If the system can maintain stable operation of the device more than 10 times within a synchronization difference of 0.035 seconds, then 0.04 seconds can be used as a reasonable setting value. The final difference judgment result is the control synchronization difference value.
[0022] S113: Based on the control synchronization difference value and the total step duration value, the data content is integrated to obtain the synchronization control execution time information under the injection task and generate sample injection timing reference data. Based on the obtained control synchronization difference value and total step time, and considering the possible task sequence adjustments during the injection process, coordinated control is implemented for the interruption factors, operational stability quantities, and task sequence frequency involved in the execution process. First, the impact range of various interference factors on the injection time should be obtained. For example, in one injection process, if there are three task interruption events, the corresponding time impact quantities are 0.021 seconds, 0.017 seconds, and 0.026 seconds respectively. The total interrupt time is obtained by accumulating these three data points to 0.064 seconds. Simultaneously, the current device operating state is identified, and the operational stability state quantity is set as the standard deviation value of the injection time during device operation. If the injection time is found to be 0.901 seconds, 0... The standard deviations of 0.894 seconds, 0.899 seconds, 0.908 seconds, and 0.903 seconds are approximately 0.0052 seconds. This value is the state variable value. The task sequence adjustment frequency is obtained by statistically analyzing the number of times the task order is adjusted per unit time. If the task is adjusted 4 times within 30 minutes, the frequency is 0.133Hz. By integrating the above three data items with the control synchronization difference value and the total step duration value, a corresponding control execution time structure can be established through data structure mapping. This structure represents the baseline timing parameters that need to be set under the current injection conditions. These parameters will serve as the timing control reference standard during the sample injection process, and will then be used as the basis for the automatic configuration of subsequent timing parameters, ultimately generating the sample injection timing baseline data.
[0023] Table 1. Setting of various influencing parameters in the sample injection task
[0024] As shown in Table 1, the table lists the actual collected data and quantification of key parameters during the sample injection process, providing the necessary data foundation and execution basis for the generation of subsequent sample injection timing reference data.
[0025] Please see Figure 3 Step S2 is as follows: S211: Obtain the sequence of test values obtained from three consecutive samplings under the operation node during the food testing process, synchronously record the time point of each sampling and the identification code of the corresponding testing channel, construct the test value sequence according to the sampling order of the three test results, and associate each sample value with the corresponding sampling number and channel number to obtain the test value sequence data; To obtain the sequence of test values obtained from three consecutive samplings at each operational node during food testing, it is necessary to specify the sampling time, sample number, and sensor channel corresponding to each round of testing. The test values should be recorded in chronological order and labeled according to the sequence number. , , Each sampling must be completed by the same device at the same node to avoid external variables interfering with numerical stability. During the detection process, real-time recording is performed using the digital acquisition module in the detection device. Assuming three sets of detection values collected at a typical operation node are 2.31 mg / L, 2.57 mg / L, and 2.44 mg / L, corresponding to sample numbers S01-T1, S01-T2, and S01-T3 respectively, the recording must be synchronously bound with corresponding timestamps, for example, 08:31:05, 08:31:12, and 08:31:19 respectively. This type of structured data will be transmitted... The data is then processed uniformly in subsequent modules. During the acquisition process, the detection system should also introduce calibration logic to determine whether the data meets the current task's standard sampling frequency. If the sampling interval exceeds the standard range, the data in that round should be recorded as invalid and the sampling task should be re-executed. The standard sampling interval can be defined according to the equipment specifications. For example, if the allowed interval range is 5 to 8 seconds, then the time interval in the above example is 7 seconds and 7 seconds. If the condition is met, the data is valid. The system performs data merging according to the sample identifier and channel number bound in the acquisition structure and archives it to the cache module according to the storage strategy to generate the detection value sequence data.
[0026] S212: Based on the detection value sequence data, extract the pairwise combinations of the three samples, identify the positional relationship in the sequence, identify the magnitude of the numerical changes of adjacent sampling groups, determine the fluctuation range of two consecutive sampling results in the detection value sequence, and quantify the segmental differences of the overall change between the first and last detection values to form the detection difference combination quantity. Based on the sequence data of the detected values, pairwise combinations of the three detected values are extracted to construct two sets of difference pairs in sequence number order. Their positional relationship in the sequence is identified: the first set consists of the first and second values, and the second set consists of the second and third values, to identify their changing trends and fluctuation intensity. Simultaneously, the overall range of change between the first and last values is identified. During processing, the system needs to perform basic logical judgments to avoid outliers affecting the difference extraction. If any detected value is outside the valid detection range, such as exceeding the upper limit of the equipment's detection range of 5.00 mg / L or falling below the lower limit of detection of 0.10 mg / L, the difference extraction operation for that round is terminated, and an anomaly flag for that data item is recorded in the log. (Example data: 2.31 mg / L) In the samples of 2.57 mg / L and 2.44 mg / L, the first group of changes was identified as +0.26 mg / L, the second group as -0.13 mg / L, and the first and last changes as +0.13 mg / L. Based on this sequence of changes, the system constructs a structured result set and records the positive and negative directions of change simultaneously. In this process, no difference calculation is performed; instead, a set of difference description values in the structure is formed. The system can further introduce change magnitude description fields as needed to label each difference pair, such as marking "increase," "decrease," or "stable" as classification labels. During the difference pair extraction process, each structural data item will be passed as an input item to the downstream judgment module for further processing to generate the detection difference combination quantity.
[0027] S213: Based on the detection difference combination quantity, interval matching is performed in combination with the deviation interval benchmark. The amplitude level is identified by comparing the correspondence with the upper and lower limits of the deviation interval benchmark. Interval labels are attached to different amplitude levels, and the sampling node number and sampling time information are bound simultaneously to generate detection sequence deviation amplitude data. Based on the detected difference combination quantity, a set deviation interval benchmark is introduced to identify and classify its amplitude level. The deviation interval benchmark should be preset as a closed upper and lower limit interval, and it is recommended to set it to the range of [0.00mg / L, 0.50mg / L]. According to actual detection experience, it is subdivided into four amplitude levels: 0~0.10mg / L is level I, 0.11~0.20mg / L is level II, 0.21~0.35mg / L is level III, and 0.36~0.50mg / L is level IV. The fluctuation stability corresponding to each level is different. The system describes the difference values in the difference combination quantity according to the interval range. Matching is performed to identify the level corresponding to each set of change values. If a set of difference description values is 0.26 mg / L, 0.13 mg / L, and 0.13 mg / L, it is classified into Level III, Level II, and Level III, respectively. Based on this level, a fluctuation level code is formed. At the same time, the sampling time and node number in the detection task information structure are called up to bind the difference level code with the task node information to form a data structure label. Finally, a sequence deviation amplitude structure data for analysis is established. For a complete labeling structure, the fields introduced include sample number, timestamp, fluctuation level, and amplitude range. The data output structure is shown in the table below: Table 2 Labels for Detection Sequence Deviation Amplitude
[0028] As shown in Table 2, each data item in this structure has been bound to the fluctuation level label corresponding to the difference between the original sample information and the detection value, thereby completing the construction and labeling of the detection structure and finally generating the detection sequence deviation amplitude data.
[0029] Please see Figure 4 Step S3 is as follows: S311: Based on the sample injection timing reference data and the actual injection completion time recorded in the detection task, determine whether the injection action has been completed, and determine whether the completion time is within the timing range set by the reference. Record the status flag and generate a timing range satisfaction status record. Based on the sample injection timing reference data and the injection completion time recorded in the detection task record, it is necessary to clarify the response time and actual completion time of the injection control signal. The system should extract the injection completion flag time from the task instruction response table and compare this time with the allowable range set in the timing reference data item by item. The allowable range consists of the set start time and end time. For example, if the allowable timing range for a certain injection task is 13:15:00 to 13:15:08, and the task completion time is recorded as 13:15:05, then it falls within the range, and the system marks the injection as timing satisfied. If the recorded time is 13:15:09, it is considered to exceed the upper limit and does not meet the conditions. During the execution process, it is necessary to determine whether the injection task is completed, which can be determined by the signal termination flag field. A field value of 1 represents the action is completed, and a value of 0 represents the action is not completed. As shown in the sample data structure in Table 3, the task time of the third group meets the timing requirements and the action completion flag is 1. The system recognizes that the injection timing conditions are met. The system finally writes the task record structure that meets the conditions into the status table and generates a timing range satisfied status record.
[0030] Table 3 Comparison of Sample Injection Task Time
[0031] As shown in Table 3, through field comparison, tasks T001 and T003 are identified as meeting the time limit, while T002 does not meet the condition because the completion time exceeds the limit. Only tasks that meet the time limit and whose actions are completed are marked and output, and finally, a record of meeting the time limit is generated.
[0032] S312: Based on the detection sequence deviation amplitude data, extract all detection fluctuation amplitude data under the current detection task, determine whether each amplitude value is within the allowable deviation range, whether the detection data meets the stability requirements, and generate a detection stability compliance status record. Based on the detection sequence deviation amplitude data, the stability of all detection difference amplitudes collected under the current detection task needs to be judged. The judgment criteria are set according to international analytical method standards, among which the repeatability limit (r value) and reproducibility limit (R value) are key judgment criteria. Generally, the r value represents the maximum allowable deviation under the same experimental conditions, while the R value represents the upper limit of allowable deviation under different experimental conditions. For example, for benzene-based organic compounds, the standard r value is 0.12 mg / L and the R value is 0.20 mg / L. The system compares each group of detection differences with the above upper and lower limits in sequence. For example, if the difference is 0.11 mg / L... Both 0.15 mg / L and 0.28 mg / L are between the r and R values, so the data set can be considered to meet the stability requirements. If a difference of 0.28 mg / L occurs, it exceeds the R value range and should be marked as not meeting the requirements. The detection system also needs to establish a correlation between the detection task number and the detection node number to ensure that the fluctuation judgment result is bound to the task output. In the fluctuation judgment results listed in Table 4, the system marks the compliance status column according to the comparison structure between the difference and the standard limit. Compliance is 1 and non-compliance is 0. Data that meets the conditions will be output as stability passed, generating a detection stability compliance status record.
[0033] Table 4. Stability Judgment Table for Detection Difference Amplitude
[0034] Referring to Table 4, test numbers D001 and D002 meet the limit requirements, while D003 exceeds the upper limit of the R value. The system only outputs data with a compliance status of 1 for the next step of judgment, generating a test stability compliance status record.
[0035] S313: Based on the timing range satisfying state record and the detection stability conforming state record, read the state record in sequence and perform joint judgment operation with the control signal output rule. If all are valid states, construct the identifier that the injected control signal is allowed to be output, and synchronously register the control task number, current node number and trigger time information in the task instruction response table to generate the injected control signal linkage state record. The system reads the timing range compliance status record and the stability compliance status record in sequence and performs a dual-state interactive logic judgment. First, it reads the timing status result to identify whether it is a valid value, and then reads the stability status to confirm whether the detection deviation is within the standard limit. When performing the judgment operation, the system maps the two status value structures to the control signal output logic area. If both statuses are valid, that is, both field values are 1, it is determined that the current task meets the conditions for injecting control signal output. The system then writes to the linkage record table. The record fields include the injection task number, control signal flag, task timestamp, and detection node number, and establishes a task status number index. The system output linkage status record is shown in Table 5. When the status flag bit value is 1, it indicates that the task has allowed signal output. The status record is written to the task linkage structure to generate the injection control signal linkage status record.
[0036] Table 5. Record of Injection Control Task Linkage Status
[0037] As shown in Table 5, the output status flag is set to 1 only when both the timing state and the stability state are valid. The system updates the control signal output permission state accordingly and finally generates the injected control signal linkage status record.
[0038] Please see Figure 5 Step S4 is as follows: S411: Based on the output status data in the injection control signal linkage status record, extract the effective output task structure, identify the corresponding injection task number and timing parameters, and filter the associated injection timing reference value. Through the effective status filtering operation, form a task activation set and generate activation injection task set data. Based on the valid output status in the linkage status record of the injected control signal, the system first extracts the data records marked as "allowed status" or "valid status" from the task structure, reads the output flag field value bound to the task number, and performs joint mapping processing on this type of task number. It then retrieves the associated injection timing reference value structure table entry, which should include fields such as target injection time, proportional gain setting, response hysteresis parameter, and version identifier. After identification, the system establishes a structural mapping between the task number and the timing reference value, extracts the current injection target time in the corresponding structure as a variable parameter, and establishes a task-parameter key-value index in the data buffer to facilitate subsequent parameter adjustment actions for these tasks. For example, in the linkage status records numbered CT001 and CT005, the "output status flag" field is 1. Based on the task ID matching structure, the system extracts the injection timing reference values of 4.20s and 3.90s, and writes the two sets of data into the PID control structure buffer. The output structure includes fields such as task number, injection target time, and adjustment status bit, as shown below: Table 6. Injection Task Target Time Extraction Table
[0039] As shown in Table 6, the system identifies valid tasks based on status flags, establishes a mapping between target time parameters and adjustment structures, and finally obtains the set of activated injection tasks.
[0040] S412: Based on the activation injection task set data, combined with the corresponding injection timing reference value in the task and the Kp value in the PID control parameter configuration table, identify the proportional gain setpoint corresponding to the current task execution time using the formula: ; The adjusted proportional gain value is calculated and written into the task parameter structure. Simultaneously, the target time in the timing reference is updated, generating the adjusted target time parameter. This represents the adjusted proportional gain value. To adjust the previous proportional gain value, For injection time offset, As the timing reference period, This is the response latency threshold; Based on the activation injection task set data, the system extracts data such as the current proportional gain Kp, injection target time, actual response offset, and task execution count from the structure corresponding to each task, and compares it with the corresponding fields in the PID control parameter management table to determine whether it is within the allowable adjustment conditions. The initial setting value of Kp is usually between 1.50 and 2.50 depending on the device characteristics. If the offset exceeds 15% of the timing cycle, the adjustment logic is triggered. In actual operation, assuming that the original setting Kp for task CT001 is 2.00, the injection target time is 4.20s, the detected actual injection response time is 4.67s, then the offset is 0.47s. The timing base cycle is set to 5.00s, the task execution frequency n is 3 times, and the response delay threshold is set to 0.30s. Then, multi-level calculations are performed by substituting the above values into the formula: first step: ; ; Step Two: ; The result shows that adjusting Kp from the original value of 2.00 to 1.966 is within the effective adjustment range and conforms to the response mitigation principle. The system updates the Kp value and writes it into the corresponding task parameter structure table, and revises the target injection time of the task to 3.85s, finally generating the adjusted target time parameter.
[0041] The adjusted proportional gain value represents the Kp parameter that is reset for the controller to perform adjustment actions within the current injection control cycle after comprehensively evaluating factors such as system response offset and allowable response delay. This value directly determines the degree of response of the control system to changes in error signals. It is the proportional factor between the controller output change and the error during the adjustment process. The adjusted proportional gain value can effectively reflect the current system's adaptability to deviation and adjustment intensity. Compared with the original Kp value, its numerical change reflects the dynamic response strategy adopted by the system when facing response deviation or delay, thereby making the control output more stable and convergent.
[0042] The formula is based on a comprehensive approach to handling multi-source bias and feedback factors in the proportional gain adjustment behavior. Firstly, it employs... The injection time offset is normalized in the form of a dimensionless relative offset intensity, which represents the proportion of the current response offset in the entire timing period. This is a negative factor and is therefore used as a deduction factor in the formula to lower the proportional gain value. Then, the following is introduced... The normalized quantity used as the response delay threshold reflects the system's allowable response tolerance. This is a positive compensation term, which moderately adjusts the proportional gain after the aforementioned deduction to avoid excessive system response suppression. This compensation reflects the system's adaptability to slow response behavior. Overall, the formula adopts a superposition mechanism of "negative term reduction + positive term replenishment". Through addition and subtraction operations, a dynamic balance between offset and tolerance is established in the proportional gain adjustment, ensuring that the adjustment result can respond to out-of-tolerance behavior without making the controller sluggish, and ultimately achieving reasonable revision of the Kp value and closed-loop feedback.
[0043] S413: Based on the adjusted target time parameters, write the adjusted target execution time into the current scheduling task structure, update the version number of the PID adjustment action, generate the corresponding revision record, form a traceable parameter change chain, integrate all structure update content, and generate injection control time revision data. The system calls the adjusted target time parameter and writes the revised target time value into the task execution parameter structure of the current scheduler using the task number as the index. At the same time, it sets the adjustment version number field for tasks that have performed PID adjustment actions, increments the version number value, and binds it to the task status record structure. Meanwhile, the key parameters involved in each round of adjustment, such as the original Kp, the adjusted Kp, the original time and the revised time, and the response offset, are recorded in the revision record area of the parameter management table. The revision batch number is set in the version control module of the control system to associate the operation trajectory. Table 7 is a schematic diagram of the structure of the revised parameter record, which lists the original proportional gain and adjustment results, offset, and task version identification information. The historical backtracking of parameters can be completed by comparing the structure, which is convenient for system maintenance and task traceability. Finally, the structure is summarized and written into the task control instruction to generate the injected control time revision data.
[0044] Table 7 Injection Control Parameter Revision Record Table
[0045] Referring to Table 7, the revision record structure completes the system-wide recording and status encapsulation of key parameters. The injection task controller updates the parameter fields and version identifiers accordingly, and finally generates the injection control time revision data.
[0046] Please see Figure 6 The S5 steps are as follows: S511: Based on the injected control time revision data, the revised target execution time parameter is written into the control instruction configuration structure of the current task. At the same time, the control version number and adjustment status flag are updated in the status record area. After the filling action is performed, the operation batch number and writing timestamp are recorded synchronously to generate control instruction configuration time value structure data. Based on the injected control time revision data, the system fills the control parameters into the instruction configuration structure. During execution, the system first reads the key fields in the revision data structure. These fields typically include: task number, target execution time, proportional gain version number, and adjustment status flag. Taking task number CT001 as an example, its target execution time is 3.85 seconds, version number is V3, and status flag is 1. The system uses a hash index lookup to quickly locate the control entry corresponding to CT001 in the control instruction template structure, and then finds the target execution time field within that entry, which is usually located in the 6th byte offset area. The system then calls the write module to perform a reload write operation on this byte segment, overwriting the original value of 2.50 seconds with the current revision time of 3.85 seconds. To ensure data integrity during the write operation, the system adds two fields at the end of the instruction configuration: the "version number field" and the "adjustment status flag field," writing V3 and 1 respectively. Subsequently, the system generates a corresponding log entry to record the batch number, such as 2024-08-21-CT001-B2, and generates a UTC timestamp value as the write time record. All this information will be uniformly encapsulated into structure items, packaged into control configuration structure data in JSON or binary structure form. A specific example is as follows: Table 8. Control Command Configuration Sample Table
[0047] As shown in Table 8, the process of replacing and writing the execution time in the system clearly shows that the CT001 task was adjusted from the original 2.50 seconds to 3.85 seconds, and the control version and status identifier were updated. This series of field replacement and status bit injection operations constructed the control instruction configuration time value structure data.
[0048] S512: Based on the control command, configure the time value structure data, determine whether the current task meets the rhythm control activation condition, and after the determination is successful, associate the task target time with the detected rhythm, generate the initial parameters of the injected rhythm control signal according to the set rhythm logic, combine them to form the content of the signal structure buffer, and generate the injected rhythm control signal data. The system invokes the control instruction configuration time value structure data to generate the injected rhythm control signal. When the system performs this operation, it first extracts the target execution time field of each task from the control instruction configuration structure and retrieves the rhythm synchronization factor and control signal activation flag set in the control template based on the task number. The system compares the fields to determine if the synchronization factor is greater than or equal to the rhythm start threshold set for the current task. If it is greater than the threshold (e.g., ≥2.0) and the control signal activation flag is 1, the task is considered to have the conditions to trigger the rhythm control signal. Taking task CT001 as an example, its target execution time is 3.85 seconds, the rhythm factor is 2.3, and the start threshold is set to 2.0, satisfying the activation conditions. Subsequently, the system retrieves the module number (e.g., module M7) from the signal template structure by looking up a table and combines it with data fields such as task ID and rhythm factor to generate the signal structure content. The system needs to construct a rhythm bitmap to identify whether the signal is activated and set the signal fields based on factors such as rhythm period and response delay. The CT001 task structure is converted into a signal structure as follows: Task ID: CT001; Module number: M7; Signal activation bit: 1; Rhythm factor: 2.3; Signal period: 1.00 seconds; Signal time offset: 0.85 seconds; Finally, this structure is packaged into a signal data structure for subsequent state interface writing, generating injected rhythm control signal data.
[0049] S513: Based on the injected rhythm control signal data, the signal content is sequentially written into the automated control status interface, and the status interface task structure entries are generated. At the same time, the link pointer of the corresponding detection task structure is generated to obtain the food detection process configuration automated control record. Based on the injected rhythm control signal data, the system writes to the automation control status interface. In this operation, the system reads the fields of the generated signal structure, calling the task ID, signal value, status code, time stamp, and control flags to assemble a status structure. During the writing process, the system sorts the signal structure fields in ascending order by module number to ensure consistency in structure transmission. Taking CT001 and CT002 as examples, CT001 belongs to module M7, and CT002 belongs to M4; therefore, CT002 is listed first in the structure arrangement. The system then generates link pointer values for each signal structure, such as PTR_CT001 and PTR_CT002, and binds them to the synchronization call flag field in the current task control scheduling queue. The system then maps this data structure to the control record buffer, generating the following records: Table 9 Automated Control Record Structure
[0050] As shown in Table 9, the signal structure is finally recorded in the order of modules and a signal output chain is formed to obtain the automated control record of the food testing process configuration.
[0051] An automated food testing process system includes: The injection time matching module is used to execute S1: acquire the single step execution signal and corresponding actual consumption time of the sample injection link in the food testing device, count the step time value and the current task target step total number and perform multiplication operation, calculate the control duration value of the set execution sequence, and generate sample injection timing reference data. The data stability calculation module is used to execute S2: read the sequence of test values obtained from three consecutive samplings under the operation node during the food testing process, calculate the numerical difference between two adjacent sets of test values and perform absolute value calculation, and statistically generate test sequence deviation amplitude data; The linkage signal verification module is used to execute S3: based on the sample injection timing reference data and the detection sequence deviation amplitude data, it determines whether the injection action has been completed and whether the completion time is within the set timing range, and at the same time determines whether the deviation amplitude is within the allowable deviation range. If both conditions are met, the signal output is set to allow state, marked as valid output state, and an injection control signal linkage state record is generated. The time parameter revision module is used to execute S4: based on the valid output status in the injection control signal linkage status record, adjust the PID control proportional gain of the current injection timing reference value, update the target execution time parameter set in the next injection task, and obtain the injection control time revision data; The automated control configuration module is used to execute S5: based on the injected control time revision data, the target execution time parameter is filled into the control instruction configuration, the corresponding injection rhythm control signal is activated, and the signal structure is written into the status interface of the automated control to generate the food testing process configuration automated control record.
[0052] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
Claims
1. An automated method for food testing processes, characterized in that, Includes the following steps: S1: Obtain the single step execution signal and corresponding actual consumption time of the sample injection stage in the food testing device, count the step time value and the current target step total number and perform multiplication operation, calculate the control duration value of the set execution sequence, and generate sample injection timing reference data. S2: Read the sequence of test values obtained from three consecutive samplings under the operation node during the food testing process, calculate the numerical difference between two adjacent sets of test values and perform absolute value calculation, and generate statistical data on the deviation of the test sequence. S3: Based on the sample injection timing reference data and the detection sequence deviation amplitude data, determine whether the injection action has been completed and whether the completion time is within the set timing range. At the same time, determine whether the deviation amplitude is within the allowable deviation range. If both conditions are met, set the signal output allowable state, mark it as a valid output state, and generate an injection control signal linkage state record. S4: Based on the valid output status in the injection control signal linkage status record, adjust the proportional gain of the current injection timing reference value using PID control, update the target execution time parameter set in the next injection task, and obtain the injection control time revision data.
2. The automated food testing process method according to claim 1, characterized in that, The sample injection timing reference data includes control duration, step time, and total number of target steps. The detection sequence deviation amplitude data includes the absolute value of the difference between detection values, adjacent sampled detection value pairs, and deviation amplitude results. The injection control signal linkage status record includes the injection action completion status, timing range validity, deviation amplitude compliance, and signal output allow status marker record. The injection control time revision data includes the updated target execution time parameter, proportional gain adjustment data, and PID control response adjustment value.
3. The automated food testing process method according to claim 1, characterized in that, The specific steps for obtaining the sample injection timing reference data are as follows: S111: Based on the single step execution signal and the corresponding actual consumption time of the sample injection stage in the food testing device, the time value of a single step action and the total number of steps of the current task target are statistically analyzed. The total step duration is obtained by multiplying the step time value and the total number of steps. S112: Based on the total step duration value, and according to the required execution synchronization accuracy of the injection control action, collect three data items: response feedback time, execution delay time, and control start time of the injection stage. By correlating the three time data items with the total step duration, obtain the control synchronization difference value. S113: Based on the control synchronization difference value and the total step duration value, the data content is integrated to obtain the synchronization control execution time information under the injection task and generate sample injection timing reference data.
4. The automated food testing process method according to claim 1, characterized in that, The specific steps for obtaining the detection sequence deviation amplitude data are as follows: S211: Obtain the sequence of test values obtained from three consecutive samplings under the operation node during the food testing process, synchronously record the time point of each sampling and the identification code of the corresponding testing channel, construct the test value sequence according to the sampling order of the three test results, and associate each sample value with the corresponding sampling number and channel number to obtain the test value sequence data; S212: Based on the detection value sequence data, extract the pairwise combinations of the three samples, identify the positional relationship in the sequence, identify the magnitude of the numerical change of adjacent sampling groups, determine the fluctuation range of two consecutive sampling results in the detection value sequence, and quantify the segmental difference of the overall change between the first and last detection values to form the detection difference combination quantity. S213: Based on the detection difference combination, interval matching is performed in conjunction with the deviation interval benchmark. The amplitude level is identified by comparing the correspondence with the upper and lower limits of the deviation interval benchmark. Interval labels are added to different amplitude levels, and the sampling node number and sampling time information are bound simultaneously to generate detection sequence deviation amplitude data.
5. The automated food testing process method according to claim 1, characterized in that, The specific steps for obtaining the injected control signal linkage status record are as follows: S311: Based on the sample injection timing reference data and the actual injection completion time recorded in the detection task, determine whether the injection action has been completed, and determine whether the completion time is within the timing range set by the reference. Record the status mark and generate a timing range satisfaction status record. S312: Based on the detection sequence deviation amplitude data, extract all detection fluctuation amplitude data under the current detection task, and determine whether each amplitude value is within the allowable deviation range, whether the detection data meets the stability requirements, and generate a detection stability compliance status record. S313: Based on the timing range satisfying state record and the detection stability conforming state record, read the state records sequentially and perform a joint judgment operation with the control signal output rules. If all are valid states, construct an identifier for allowing the injection control signal output, and synchronously register the control task number, current node number and trigger time information in the task instruction response table to generate an injection control signal linkage state record.
6. The automated food testing process method according to claim 1, characterized in that, The specific steps for obtaining the injection control time revision data are as follows: S411: Based on the output status data in the injection control signal linkage status record, extract the effective output task structure, identify the corresponding injection task number and timing parameters, and filter the associated injection timing reference value. Through the effective status filtering operation, form a task activation set and generate activation injection task set data. S412: Based on the activation injection task set data, combined with the injection timing reference value in the task and the Kp value in the PID control parameter configuration table, identify the proportional gain setting value corresponding to the current task execution time, calculate and obtain the adjusted proportional gain value and write it into the task parameter structure, and at the same time update the target time in the timing reference to generate the adjusted target time parameter. S413: Based on the adjusted target time parameter, write the adjusted target execution time into the current scheduling task structure, and at the same time update the version number of the PID adjustment action and generate the corresponding revision record to form a traceable parameter change chain. Integrate all structure update content and generate injection control time revision data.
7. The automated food testing process method according to claim 1, characterized in that, The method further includes: S5: Based on the injection control time revision data, fill the target execution time parameter into the control instruction configuration, activate the corresponding injection rhythm control signal, and write the signal structure into the status interface of the automation control to generate the food testing process configuration automation control record. The automated control record configuration for the food testing process includes injection rhythm control signals, control command configuration data, and status interface signal structure.
8. The automated food testing process method according to claim 7, characterized in that, The specific steps for obtaining automated control records in the food testing process are as follows: S511: Based on the injected control time revision data, write the revised target execution time parameter into the control instruction configuration structure of the current task, and update the control version number and adjustment status flag in the status record area. After the filling action is performed, the operation batch number and writing timestamp are recorded synchronously to generate control instruction configuration time value structure data. S512: Based on the control command, configure time value structure data, determine whether the current task meets the rhythm control activation condition, and after the determination is successful, associate the task target time with the detected rhythm, generate the initial parameters of the injected rhythm control signal according to the set rhythm logic, combine them to form the content of the signal structure buffer area, and generate the injected rhythm control signal data. S513: Based on the injected rhythm control signal data, the signal content is sequentially written into the automated control status interface, and status interface task structure entries are generated. At the same time, the link pointer of the corresponding detection task structure is generated to obtain the food detection process configuration automated control record.
9. An automated system for food testing processes, characterized in that, The system is used to implement the automated food testing process method according to any one of claims 1-8, including: The injection time matching module is used to execute S1: acquire the single step execution signal and corresponding actual consumption time of the sample injection link in the food testing device, count the step time value and the current task target step total number and perform multiplication operation, calculate the control duration value of the set execution sequence, and generate sample injection timing reference data. The data stability calculation module is used to execute S2: read the sequence of test values obtained from three consecutive samplings under the operation node during the food testing process, calculate the numerical difference between two adjacent sets of test values and perform absolute value calculation, and statistically generate test sequence deviation amplitude data; The linkage signal verification module is used to execute S3: based on the sample injection timing reference data and the detection sequence deviation amplitude data, it determines whether the injection action has been completed and whether the completion time is within the set timing range, and at the same time determines whether the deviation amplitude is within the allowable deviation range. If both conditions are met, the signal output allowable state is set, marked as a valid output state, and an injection control signal linkage state record is generated. The time parameter revision module is used to execute S4: based on the valid output status in the injection control signal linkage status record, adjust the PID control proportional gain of the current injection timing reference value, update the target execution time parameter set in the next round of injection task, and obtain injection control time revision data; The automated control configuration module is used to execute S5: based on the injection control time revision data, fill the target execution time parameter into the control instruction configuration, activate the corresponding injection rhythm control signal, and write the signal structure into the status interface of the automated control to generate the food testing process configuration automated control record.