Timing optimization method and system for time-sharing light source controller
Through multi-channel timing feature data matrix and dynamic subspace decomposition technology, combined with timing attention network and hierarchical predictive control model, the problem of difficult timing synchronization and stability of multi-channel light source controllers in the existing technology is solved, and high-precision multi-channel collaborative control is achieved.
Patent Information
- Application Number
- CN202510104634.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-01-23
AI Technical Summary
The existing time-sharing line scanning light source control method is difficult to achieve high-precision timing synchronization and stability in high-speed, multi-channel collaborative control scenarios, especially under the requirements of trigger delay control accuracy of the order of 500ns.
Using multi-channel timing feature data matrix and dynamic subspace decomposition technology, the long-range dependence relationship between channels is analyzed through the timing attention network, a hierarchical predictive control model is constructed, sub-microsecond response control and millisecond optimization control are realized, and the optimal trigger timing sequence is generated.
It effectively reduces mutual interference between channels, improves the accuracy of multi-channel coordinated control, ensures the synchronization and stability of light source triggering, and meets the requirements of 500ns trigger delay control accuracy.
Smart Images

Figure CN119545609B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of timing optimization of light source controllers, and in particular to a timing optimization method and system for a time-sharing light source controller. Background Art
[0002] The time-sharing line scan light source controller is a key device to ensure the quality of image acquisition. With the continuous improvement of product inspection speed and accuracy requirements, the controller needs to accurately control the trigger timing of multi-channel light sources within the sub-microsecond time scale while ensuring the stability of the output voltage. However, due to factors such as mutual interference between multiple channels, dynamic changes in light source driving parameters, and electromagnetic interference in complex industrial environments, the control signal has timing jitter and delay drift.
[0003] Traditional time-sharing line-scanning light source control methods mainly rely on fixed trigger parameters and simple PID control, which is difficult to adapt to high-speed, multi-channel collaborative control scenarios. Although the introduction of technologies such as digital filtering and adaptive control can suppress interference to a certain extent, it is still insufficient when dealing with complex coupling relationships between multiple channels and rapid response requirements, especially under the trigger delay control accuracy requirements of the order of 500ns. It is difficult for existing methods to simultaneously take into account the real-time performance and stability of the system. Summary of the invention
[0004] The main purpose of the present invention is to provide a time-sharing light source controller timing optimization method and system, which effectively solves the timing jitter problem of multi-channel output and ensures the synchronization and stability of light source triggering.
[0005] To achieve the above object, the present invention provides a time-sharing light source controller timing optimization method, comprising the following steps:
[0006] Collect the high-speed optocoupler trigger signal, 8-channel output voltage signal and inter-channel delay signal of the time-sharing line scanning light source controller, and generate a multi-channel timing characteristic data matrix;
[0007] Performing dynamic subspace decomposition and bidirectional residual operation on the multi-channel time series feature data matrix to generate an anti-interference enhanced feature vector;
[0008] Inputting the anti-interference enhanced feature vector into a temporal attention network to analyze the long-range dependencies between channels and generate channel collaborative control features;
[0009] Based on the channel cooperative control characteristics, a hierarchical predictive control model is constructed, the trigger timing is processed by the sub-microsecond response control layer, and the drive parameters are dynamically adjusted by the millisecond optimization control layer to generate the optimal trigger timing sequence;
[0010] Send the optimal trigger timing sequence to each output channel, collect channel output trigger delay data in real time, and calculate the compensation trigger timing;
[0011] The system response characteristics under the compensation trigger timing are evaluated to generate an optimized control parameter group, and the optimized control parameter group is updated to the hierarchical predictive control model.
[0012] The present invention also provides a time-sharing light source controller timing optimization system, comprising:
[0013] The acquisition module is used to collect the high-speed optocoupler trigger signal, 8-channel output voltage signal and inter-channel delay signal of the time-sharing line scanning light source controller, and generate a multi-channel timing characteristic data matrix;
[0014] A decomposition module, used for performing dynamic subspace decomposition and bidirectional residual operation on the multi-channel time series feature data matrix to generate an anti-interference enhanced feature vector;
[0015] An analysis module, used for inputting the anti-interference enhanced feature vector into a temporal attention network to analyze the long-range dependency relationship between channels and generate channel collaborative control features;
[0016] A generation module is used to construct a hierarchical predictive control model based on the channel cooperative control characteristics, process the trigger timing through a sub-microsecond response control layer, dynamically adjust the drive parameters using a millisecond optimization control layer, and generate an optimal trigger timing sequence;
[0017] A calculation module, used to send the optimal trigger timing sequence to each output channel, collect channel output trigger delay data in real time, and calculate the compensation trigger timing;
[0018] An updating module is used to evaluate the system response characteristics under the compensation trigger timing, generate an optimized control parameter group, and update the optimized control parameter group to the hierarchical predictive control model.
[0019] The present invention also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
[0020] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods are implemented.
[0021] In summary, the technical solution provided by the present invention realizes high-precision acquisition and feature extraction of 8-channel trigger signals by introducing multi-channel time series feature data matrix and dynamic subspace decomposition technology, effectively reducing mutual interference between channels. The control system's ability to capture long-range time series dependencies is enhanced by combining time series attention network and bidirectional residual operation, and the accuracy of multi-channel collaborative control is improved. A hierarchical predictive control model is established, and the dynamic optimization of drive parameters is achieved while ensuring the 500ns trigger delay control accuracy through the synergy of sub-microsecond response control layer and millisecond optimization control layer. A parameter optimization mechanism based on system response characteristic evaluation is designed, and the control system's adaptability to environmental changes is enhanced through real-time evaluation and parameter update. Combined with high-speed optocoupler isolation and multi-stage filtering technology, the system's anti-interference ability and signal quality in complex industrial environments are improved. By compensating for the real-time calculation and update of the trigger timing, the timing jitter problem of multi-channel output is effectively solved, ensuring the synchronization and stability of light source triggering. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is a schematic diagram of the steps of a method for optimizing the timing of a time-sharing light source controller in one embodiment of the present invention;
[0023] Figure 2 It is a structural block diagram of a time-sharing light source controller timing optimization system in one embodiment of the present invention;
[0024] Figure 3 It is a schematic block diagram of the structure of a computer device according to an embodiment of the present invention.
[0025] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0027] Reference Figure 1 This embodiment provides a time-sharing light source controller timing optimization method, comprising the following steps:
[0028] S1, collects the high-speed optocoupler trigger signal, 8-channel output voltage signal and inter-channel delay signal of the time-sharing line scanning light source controller, and generates a multi-channel timing characteristic data matrix;
[0029] Among them, the differential trigger signal at the high-speed optocoupler input end of the time-sharing line scanning light source controller is sampled by analog-to-digital conversion, and the 5V differential signal is converted into a digital quantity. At the same time, the single-ended trigger signal is level-converted, and the DC12V to 24V signal is converted into a standard TTL level signal, so that the system can be compatible with various different input signals and accurately process these signals. Through the conversion process, a standardized trigger signal sampling sequence is obtained to ensure that each trigger signal has a unified level standard. Based on the trigger signal sampling sequence, the signal is resampled so that the signal can be processed more accurately in time to meet the requirements of signal acquisition frequency in different application scenarios. The signal is filtered using a Butterworth low-pass filter to filter out high-frequency noise. The Butterworth filter has a smooth frequency response and can effectively remove noise without significantly changing the characteristics of the signal, thereby obtaining a standard timing trigger sequence. The DC48V output signal is collected through the 8-channel output port, and a voltage sampling matrix is established based on the feedback signal of the constant voltage drive module. In the process of establishing the voltage sampling matrix, the voltage signal is filtered in real time by a Kalman filter to remove random noise in the signal. Due to its excellent prediction and filtering characteristics, the Kalman filter is suitable for processing random noise in dynamic systems. In this process, it can ensure that the obtained voltage sampling data sequence has good smoothness and accuracy, and can more accurately reflect the voltage change of the system. According to the standard timing trigger sequence, a time reference is established, and the voltage sampling data sequence is time-aligned to obtain a synchronous voltage data sequence. Based on the synchronous voltage data sequence, the trigger timing difference and voltage difference between adjacent channels are calculated to obtain the inter-channel delay feature sequence, providing information about the time and voltage changes between different channels. The standard timing trigger sequence is tested for piecewise stationarity, the stability of the signal in different time periods is analyzed, and the change points in the signal are found. On the basis of the piecewise stationarity test, the time-frequency features are extracted based on the short-time Fourier transform. The short-time Fourier transform is an effective tool for analyzing the time-frequency characteristics of non-stationary signals. It can decompose the signal into the spectrum distribution at different times and provide the time-frequency information of the signal. The instantaneous phase information is obtained through the Hilbert transform. The Hilbert transform can reveal the phase change of the signal and obtain the trigger timing feature vector. At the same time, the voltage fluctuation feature is extracted according to the synchronous voltage data sequence to obtain the voltage fluctuation feature vector. The voltage fluctuation feature vector can reflect the voltage fluctuation of different channels in the same time period. The trigger timing feature vector, voltage fluctuation feature vector and inter-channel delay feature sequence are combined to obtain a multi-channel timing feature data matrix.
[0030] S2, performs dynamic subspace decomposition and bidirectional residual operation on the multi-channel time series feature data matrix to generate an anti-interference enhanced feature vector;
[0031] Specifically, the multi-channel time series feature data matrix is segmented into time windows to capture the short-term changes and laws in the time series signal, and a segmented time series feature matrix group is obtained. The segmented time series feature matrix group is input into the dynamic subspace decomposition unit for feature extraction. The dynamic subspace decomposition unit contains a three-layer structure, which is used to extract features at different levels of the data. In the first layer, four parallel 1×1 convolution layers are used, and the number of convolution kernels in each convolution layer is 64, which effectively transforms and reduces the channel characteristics in the input feature matrix. At the same time, 1×1 convolution can extract important features between channels while keeping the spatial dimension unchanged. The second layer uses two parallel 3×3 convolution layers, and the number of convolution kernels in each convolution layer is 32, which further extracts local spatiotemporal features. The 3×3 convolution can capture local temporal dependencies and spatial relationships, so that the model can better understand the complex patterns in the feature matrix. In the third layer, one 1×1 convolution layer is used, and the number of convolution kernels is 16, which further reduces and compresses the features to obtain a subspace feature matrix. Through the gradual extraction of these three layers, feature data can be refined at different scales and angles, and the generated subspace feature matrix has strong expression ability. The subspace feature matrix is input into the channel attention module. This module contains a global average pooling layer and two fully connected layers. The global average pooling layer is used to globally summarize each channel of the feature matrix to obtain a global statistical information. After two fully connected layers, the output dimension of the first fully connected layer is 64, which is used to increase the nonlinear feature representation capability, and the output dimension of the second fully connected layer is 8, which is used to compress the features and obtain the channel weight vector. The channel weight vector represents the importance of each channel in the overall feature representation. Through these weights, different channels are selectively enhanced, so that the model can pay more attention to the channel features that contribute significantly to the final task. The channel weight vector is matrix multiplied with the subspace feature matrix to obtain the weighted subspace feature. The weighted subspace feature is input into the bidirectional residual network for feature enhancement. The bidirectional residual network consists of three residual blocks, each of which contains two 3×3 convolutional layers and a residual connection. The number of convolution kernels in each residual block is 32, 16, and 8, respectively. The gradually reduced number of convolution kernels can effectively extract features. At the same time, the information of the original input features is retained through the residual connection mechanism, thereby avoiding information loss in the process of feature extraction. The obtained positive residual features have strong representation ability and good robustness. The forward residual features are subtracted element by element from the original time series features to obtain feature residuals, which effectively extracts the change trend that is not fully expressed in the original features, thereby supplementing the feature information.In order to calculate the compensation features, a back propagation network is used. The network contains two fully connected layers. The output dimension of the first layer is 32, and the output dimension of the second layer is 16. The reverse residual features are calculated through these two layers to help the model effectively supplement and balance the original features and the forward residual features. The forward residual features and the reverse residual features are fused and the number of channels is compressed to integrate the forward and reverse information together, so that the final features can better reflect the overall time series pattern and change trend. After the fusion is completed, the fused feature vector is normalized and the feature values are adjusted to the same numerical range, thereby eliminating the magnitude differences between different features and improving the stability and convergence speed of model training. The obtained anti-interference enhanced feature vector has strong anti-noise ability and time series feature expression ability.
[0032] S3, input the anti-interference enhanced feature vector into the temporal attention network to analyze the long-range dependencies between channels and generate channel collaborative control features;
[0033] It should be noted that the anti-interference enhanced feature vector is input into the multi-head self-attention layer for feature interdependence analysis. The multi-head self-attention layer contains 8 parallel attention heads, each of which includes three linear transformation layers with an input dimension of 64 and an output dimension of 32. Through the multi-head self-attention mechanism, the model captures the dependency between input feature vectors from different angles and obtains a multi-head attention feature matrix. This design enables each attention head to learn different levels of relational information in the data and synthesize a feature matrix containing rich context. The multi-head attention feature matrix is input into a three-layer multi-scale convolution module for feature extraction. The first layer in the multi-scale convolution module uses a 1×1 convolution kernel, and the number of convolution kernels is 64. The features are fused between channels while keeping the spatial information unchanged, and the interaction characteristics between channels are enhanced. The second layer uses a 3×3 convolution kernel, and the number of convolution kernels is 32. In this way, the mid-scale spatiotemporal dependency is extracted, so that the model can capture the spatial correlation of features in the local area. The third layer uses 5×5 convolution kernels, and the number of convolution kernels is 16, so that the model can capture the change pattern of features from a larger range, which is suitable for extracting long-range dependency information in the signal. Through multi-scale convolution operations, multi-scale time series features are obtained, which contain temporal and spatial change information from a small range to a large range. Time series dependency extraction is performed on multi-scale time series features to obtain inter-channel time series dependency features, capturing the temporal association and mutual influence between channels. The inter-channel time series dependency features are input into the cross-channel attention enhancement module to establish deeper associations between different channels, and enhanced dependency features are generated by focusing on which channels contribute more to the overall performance of the system in a specific time period. The enhanced dependency features are input into the nonlinear mapping network to perform nonlinear transformation on the features. The nonlinear mapping network contains three fully connected layers, and the output dimensions of each layer are 64, 32, and 16 respectively. In order to enable the model to learn complex nonlinear relationships, each layer is followed by a LeakyReLU activation function. This activation function can effectively avoid the gradient vanishing problem and enhance the learning ability of the model by allowing inputs less than zero to have a non-zero slope. The mapping feature vector is obtained through layer-by-layer processing of three-layer full connection and activation function. The mapping feature vector is feature calibrated to ensure that the scale and distribution of different features are consistent. The calibrated feature vector is input into the channel co-optimizer to optimize the control characteristics between different channels to achieve collaborative work between channels. The channel co-optimizer contains two residual connection blocks, each of which consists of two 3×3 convolutional layers and one skip connection, with 16 convolution kernels. The skip connection in the residual connection block allows the original input features to be directly superimposed back after convolution processing, thereby effectively extracting features while maintaining the original features.The channel co-optimizer generates channel co-control features, which contain the temporal variation patterns of each channel and incorporate the interaction relationships between different channels.
[0034] S4, builds a hierarchical predictive control model based on channel collaborative control characteristics, processes the trigger timing through the sub-microsecond response control layer, and dynamically adjusts the drive parameters using the millisecond optimization control layer to generate the optimal trigger timing sequence;
[0035] Specifically, the channel cooperative control features are input into the timing prediction network for timing feature analysis and prediction. The timing prediction network consists of three long short-term memory (LSTM) units, and the number of hidden layer nodes of these LSTM units is 64, 32, and 16 respectively. Through the layer-by-layer decreasing design structure, the time dependency and global change trend of the input features can be effectively captured. The LSTM unit has the ability of sequence modeling and is suitable for processing data with long time dependency. By processing the channel cooperative control features, a trigger timing prediction sequence is generated. The trigger timing prediction sequence is input into the sub-microsecond response control layer for rapid processing. The sub-microsecond response control layer contains a fast response unit and a trigger compensation unit, and the input dimension of these units is 16 and the output dimension is 8. The fast response unit can respond to the input trigger signal in a very short time to cope with the high-speed change control requirements. The trigger compensation unit makes a small timing adjustment to the trigger signal to reduce the error and ensure the accuracy of the trigger control. Through the collaborative work of the fast response unit and the trigger compensation unit, a fast response control sequence is obtained. The driving parameters of the fast response control sequence are optimized to obtain the initial driving parameters. The initial driving parameters are input into the millisecond optimization control layer for processing. The millisecond optimization control layer contains two parameter optimization units, each of which consists of a fully connected layer and a parameter calibration layer, with an output dimension of 16. The fully connected layer performs nonlinear mapping on the driving parameters so that the system can find a more suitable driving parameter configuration. The parameter calibration layer ensures that the optimized parameters meet the constraints of the actual physical system, eliminates potential contradictions and conflicts between the parameters, and obtains the optimized driving parameters. Through the dynamic adjustment of the millisecond optimization control layer, the driving parameters are finely optimized while ensuring the fast response of the control to ensure the stability and robustness of the control. The optimized driving parameters are input into the multi-channel cooperative controller for cooperative control between different channels. The multi-channel cooperative controller contains two parallel control loops, each of which contains a PID controller and a state feedback controller, with an output dimension of 8. The PID controller processes the proportional, integral and differential parts of the input signal to achieve precise control, while the state feedback controller corrects the feedback of the system state to make the control process more stable and robust. Through the combination of PID control and state feedback control, the multi-channel cooperative controller can realize the cooperative control of each channel in a complex environment and obtain the cooperative control parameters. The cooperative control parameters are processed in time series to obtain the candidate trigger sequence. The candidate trigger sequence is input into the sequence optimization network for processing. The sequence optimization network contains two residual connection blocks, each of which consists of two 3×3 convolutional layers and a jump connection, and the number of convolution kernels is 8. The residual connection block retains the original features of the input through the jump connection and extracts new features in the convolution process. After being processed by the sequence optimization network, the optimized trigger sequence is obtained.The optimized trigger sequence is calibrated to adjust the time deviation of the trigger signal so that each trigger signal reaches the optimal state in terms of timing, avoiding the influence of time error and delay on system performance and obtaining the optimal trigger timing sequence.
[0036] S5, sending the optimal trigger timing sequence to each output channel, collecting channel output trigger delay data in real time, and calculating the compensation trigger timing;
[0037] Among them, the optimal trigger timing sequence is parsed by protocol and the data packet is encapsulated. The trigger timing sequence is converted into a format that can be transmitted through the communication network, that is, a communication data packet is formed. The encapsulated communication data packet is distributed through an 8-channel data distributor, in which the data of each channel needs to be CRC-checked to ensure the integrity of the data, and the channel number is matched to ensure the accurate delivery of the data. After these processes, the data is sent to each output channel to generate specific channel trigger instructions, which contain detailed control information on how to accurately trigger each light source. The channel trigger instructions are level-converted by high-speed optocouplers, the differential trigger signal is converted to a standard 5V level, and the single-ended trigger signal is converted to a DC12V to 24V level to ensure that the output level meets the requirements of different devices. The signal is isolated by an optoelectronic isolation circuit to improve the anti-interference ability and safety of the system. The isolated signal is used as a trigger control signal to directly control the state change of the light source. The trigger control signal is sampled at high speed to obtain the trigger timing data. These data contain the trigger state changes of each channel at different time points. By performing delay analysis on these data, the actual time interval between adjacent trigger signals can be calculated. In this process, the actual time interval is compared with the 500 nanosecond threshold set by the system. If the time interval of a channel exceeds the threshold, the channel is marked as a delay anomaly and the channel number of the delay anomaly is recorded. The identification of the delay anomaly will be used for subsequent control adjustments to ensure that all channels can be synchronized as much as possible, thereby optimizing the accuracy of light source control. The delay anomaly channel identification is associated and matched with the channel cooperative control characteristics of the system to extract the control characteristic parameters corresponding to the delay anomaly channel. The control characteristic parameters contain the specific working status and historical control information of the channel. The control characteristic parameters are input into the compensation calculation network, which generates the initial compensation parameters by analyzing and calculating the input characteristics. The initial compensation parameters are adaptively compensated and triggered edge alignment is processed. In the adaptive compensation stage, the compensation parameters are continuously adjusted to adapt to different working conditions and environmental conditions, so that the compensation effect can follow the changes of the system in real time. At the same time, through the trigger edge alignment process, it is ensured that the trigger signal edge of each channel can be aligned as much as possible to avoid the light source control error caused by edge deviation. After these processes, an accurate compensation sequence is finally obtained, which contains the fine compensation information for each delay abnormal channel, ensuring that the trigger signals of all channels can meet the requirements of synchronization and precise control. The accurate compensation sequence is synthesized with the optimal trigger timing sequence to obtain the final compensation trigger timing.
[0038] S6, evaluating the system response characteristics under the compensation triggering timing, generating an optimized control parameter group, and updating the optimized control parameter group to the hierarchical predictive control model.
[0039] Specifically, the timing characteristics of the 8-channel output signal are quantitatively analyzed based on the compensation trigger timing, and the dynamic behavior characteristics of the system in the actual control process are obtained by comprehensively evaluating the trigger response characteristics of each channel. Through the quantitative analysis of the 8-channel signal, the response of each channel under the compensation trigger is described with precise data to form a system response characteristic data matrix, which contains detailed information on the timing deviation, signal strength, response speed and other aspects of each channel. The optimization target is constructed for the system response characteristic data matrix. In order to optimize the control performance, the minimization of the trigger delay is set as the main optimization target, and multiple performance indicators are normalized and calculated through the weighted objective function. In this process, the trigger delay is considered, and other relevant performance indicators such as signal stability and inter-channel synchronization are combined to ensure that the overall performance of the system can be optimally improved. Through the normalization process, the performance indicators of different units and ranges are converted to the same range to form a performance evaluation index vector. Based on the performance evaluation index vector, the direction of parameter optimization is determined, and gradient search optimization is performed based on this direction. In the process of gradient search optimization, the parameters are continuously adjusted to find the best path to minimize the optimization target. This process evaluates the impact of each parameter change on the optimization target by calculating the gradient. Through multiple iterative searches, a parameter optimization sequence is obtained, which includes specific steps for gradually adjusting parameters to achieve optimal performance. The advantage of gradient search is that it can quickly find the direction to improve system performance and reduce the possibility of large deviations through gradual small adjustments. Constraint checks are performed on the parameter optimization sequence to ensure that these parameters are feasible in the actual physical system. The parameter constraint check process compares the optimized parameters with the physical constraints of the system to screen out valid parameter groups that meet the constraints. Constraints include voltage range, trigger frequency restrictions, etc. Only parameters that meet these physical conditions can ensure the normal operation of the system. After constraint checking, valid parameter groups are obtained, and these parameters are structured and packaged to form optimized control parameter groups. Through structured packaging, each optimized parameter is organized into a format that is easy to store and call, so as to facilitate application in the hierarchical predictive control model. The optimized control parameter groups are written into the parameter space of the sub-microsecond response control layer and the millisecond optimization control layer of the hierarchical predictive control model respectively to complete the parameter update of the hierarchical predictive control model. In the sub-microsecond response control layer, the updated parameters can ensure the system's rapid response to the trigger signal to meet the needs of high-speed control; while in the millisecond optimization control layer, the updated parameters help the system achieve optimal performance as a whole and ensure the stability and robustness of the control. By applying the optimized control parameter group to these two control layers, the overall performance of the hierarchical predictive control model is significantly improved, and it can achieve both fast and accurate response control on different time scales.
[0040] In one example, the high-speed optocoupler trigger signal, 8-channel output voltage signal and inter-channel delay signal of the time-sharing line scanning light source controller are collected, and a multi-channel timing feature data matrix is generated, including:
[0041] Perform analog-to-digital conversion sampling on the differential trigger signal at the high-speed optocoupler input end of the time-sharing line scanning light source controller, convert the 5V differential signal into a digital quantity, perform level conversion on the single-ended trigger signal, convert the DC12V~24V signal into a standard TTL level signal, and obtain a trigger signal sampling sequence;
[0042] Based on the trigger signal sampling sequence, the signal is resampled and high-frequency noise is filtered out through a Butterworth low-pass filter to obtain a standard timing trigger sequence;
[0043] The DC48V output signal is collected through the 8-channel output port, a voltage sampling matrix is established based on the feedback signal of the constant voltage drive module, and the voltage signal is filtered in real time through the Kalman filter to obtain a voltage sampling data sequence;
[0044] A time reference is established according to a standard timing trigger sequence, and a voltage sampling data sequence is time-aligned to obtain a synchronous voltage data sequence. Based on the synchronous voltage data sequence, the trigger timing difference and voltage difference between adjacent channels are calculated to obtain an inter-channel delay characteristic sequence.
[0045] The standard timing trigger sequence is tested for piecewise stability, the time-frequency features are extracted based on short-time Fourier transform, the instantaneous phase information is obtained through Hilbert transform, and the trigger timing feature vector is obtained;
[0046] The voltage fluctuation feature is extracted according to the synchronous voltage data sequence to obtain the voltage fluctuation feature vector, and the trigger timing feature vector, the voltage fluctuation feature vector and the inter-channel delay feature sequence are combined to obtain a multi-channel timing feature data matrix.
[0047] In this example, the differential trigger signal at the high-speed optocoupler input end of the time-sharing line scan light source controller is sampled by analog-to-digital conversion. In the system, differential signals can effectively reduce noise. In industrial environments, electromagnetic interference is a common problem, so differential signals are used to enhance anti-interference. The 5V differential trigger signal is sampled through analog-to-digital conversion (ADC) to convert the continuous analog signal into a digital quantity for subsequent digital signal processing. This process is expressed as:
[0048] ;
[0049] in, Represents the digital signal obtained after sampling, represents the input differential voltage signal, and Indicates the function of the analog-to-digital converter. At the same time, the single-ended trigger signal is level converted. In industrial control systems, the trigger signal has a higher voltage range, such as DC12V to 24V, but the standard TTL level range is usually between 0 and 5V. In order to make these signals suitable for subsequent digital circuits, the DC12V to 24V signal is converted into a TTL level signal through a level conversion module to obtain a trigger signal sampling sequence. Based on the trigger signal sampling sequence, the signal is resampled to ensure that the sampling frequency matches the processing frequency required by the system. Resampling can effectively reduce redundant information in the signal and improve data processing efficiency. For the resampled signal, in order to remove the high-frequency noise in the signal, a Butterworth low-pass filter is used for filtering. The design feature of the Butterworth filter is its smooth frequency response, so that the filtered signal does not produce obvious amplitude distortion. The transfer function of its low-pass filter is expressed as:
[0050] ;
[0051] in, represents the transfer function of the filter, is a complex frequency domain variable, is the cutoff frequency of the filter, is the order of the filter. Through the Butterworth filter, a smooth standard timing trigger sequence is obtained. The output signal is collected. The DC48V output signal is collected through the 8-channel output port, and a voltage sampling matrix is established based on the feedback signal of the constant voltage drive module. The voltage value obtained by real-time sampling forms a voltage matrix , where each row represents the sampling value at a different time point, and each column represents the voltage signal of a different channel. In order to remove the random noise in the voltage signal, the Kalman filter is used to filter the voltage signal in real time. The Kalman filter is a filtering method based on the state space model, and its state update equation is expressed as:
[0052] ;
[0053] in, represents the filtered state estimate, is the predicted state estimate, is the Kalman gain, is the observed value is the observation matrix. Through the Kalman filter, a smooth voltage sampling data sequence is obtained. A time base is established based on the standard timing trigger sequence, and the voltage sampling data sequence is time-aligned to ensure that the signals of different channels have the same time base, so as to perform effective comparison and analysis. After completing the time alignment, the trigger timing difference and voltage difference between adjacent channels are calculated based on the synchronized voltage data sequence. Assume and Respectively The trigger time and voltage signal of each channel, the trigger timing difference and voltage difference between adjacent channels are expressed as:
[0054] ;
[0055] ;
[0056] Through calculation, the delay feature sequence between channels is obtained, which reflects the difference in time and voltage between adjacent channels. The standard timing trigger sequence is tested for segmented stability to determine the stability and change trend of the signal in different time periods. The time-frequency features are extracted based on short-time Fourier transform. By dividing the signal into short-time segments and performing Fourier transform on each segment, the local features of the signal in the time domain and frequency domain are obtained. The calculation formula is:
[0057] ;
[0058] in, is the input signal, is the window function, is the frequency. Through short-time Fourier transform, the time-frequency distribution of the signal is obtained, so as to analyze the changes in the frequency characteristics of the signal over time. At the same time, the instantaneous phase information is obtained through Hilbert transform to understand the phase characteristics of the signal. The Hilbert transform is defined as:
[0059] ;
[0060] By calculating the instantaneous phase, the phase change characteristics of the signal are obtained to form a trigger timing feature vector. These characteristics are helpful for analyzing the dynamic characteristics and periodicity of the signal. The voltage fluctuation characteristics are extracted based on the synchronous voltage data sequence. The voltage fluctuation characteristics can reflect the voltage changes of different channels in the same time period. By calculating the statistical characteristics of voltage fluctuations, such as mean, variance, kurtosis and skewness, the voltage fluctuation feature vector is obtained, which reflects the fluctuation characteristics of the voltage signal in a statistical sense. The trigger timing feature vector, voltage fluctuation feature vector and inter-channel delay feature sequence are combined to form a multi-channel timing feature data matrix. The matrix is expressed as:
[0061] ;
[0062] in, Represents the multi-channel time series feature data matrix, Indicates The characteristic vector of each channel contains information on trigger timing characteristics, voltage fluctuation characteristics, delay characteristics, etc. Through the combination of these characteristics, the characteristics of each channel in terms of timing, amplitude and delay are described.
[0063] In one example, dynamic subspace decomposition and bidirectional residual operation are performed on a multi-channel time series feature data matrix to generate an anti-interference enhanced feature vector, including:
[0064] Perform time window segmentation on the multi-channel time series feature data matrix to obtain a segmented time series feature matrix group;
[0065] The segmented time series feature matrix group is input into the dynamic subspace decomposition unit. The dynamic subspace decomposition unit contains three layers: the first layer is 4 parallel 1×1 convolution layers with 64 convolution kernels, the second layer is 2 parallel 3×3 convolution layers with 32 convolution kernels, and the third layer is 1 1×1 convolution layer with 16 convolution kernels to obtain the subspace feature matrix.
[0066] The subspace feature matrix is input into the channel attention module for feature enhancement. The channel attention module contains a global average pooling layer and two fully connected layers. The output dimension of the first fully connected layer is 64, and the output dimension of the second fully connected layer is 8. The channel weight vector is obtained.
[0067] Perform matrix multiplication operation on the channel weight vector and the subspace feature matrix to obtain the weighted subspace feature;
[0068] The weighted subspace features are input into the bidirectional residual network for feature enhancement. The bidirectional residual network contains three residual blocks. Each residual block contains two 3×3 convolutional layers and a residual connection. The number of convolution kernels is 32, 16, and 8 respectively, and the positive residual features are obtained.
[0069] The forward residual feature is subtracted element by element from the original time series feature, and the compensation feature is calculated through the back propagation network. The back propagation network contains two fully connected layers. The output dimension of the first layer is 32, and the output dimension of the second layer is 16, to obtain the reverse residual feature;
[0070] The forward residual features and the reverse residual features are subjected to feature fusion and channel number compression to obtain a fused feature vector, and the fused feature vector is subjected to feature normalization to obtain an anti-interference enhanced feature vector.
[0071] In this example, the multi-channel time series feature data matrix is segmented into time windows. The long time series feature data matrix is divided into several short time periods to capture the changing characteristics of the data within the local time range and avoid information loss. Suppose the original multi-channel time series feature data matrix is ,in represents the time step, Indicates the number of channels. By time window length Divide the matrix into segments Divide into windows, and obtain the segmented time series feature matrix group:
[0072] ;
[0073] in, Indicates The segmentation matrix of time windows has a total of The segmented time series feature matrix group is input into the dynamic subspace decomposition unit. The dynamic subspace decomposition unit contains a three-layer structure, which extracts the spatial and temporal characteristics of the input feature matrix through multi-layer convolution operations. In the first layer, four parallel Convolutional layer, the number of convolution kernels in each convolutional layer is 64. Suppose the input is , the convolution operation is expressed as:
[0074] ;
[0075] in, express Convolution operation, It is the feature matrix obtained after the first layer of convolution. Convolution is used to change the number of input channels and learn different feature representations through multiple parallel convolutions. In the second layer, two parallel Convolutional layer, the number of convolution kernels in each convolutional layer is 32, and the convolution kernels in each convolutional layer are 32. Feature extraction is performed to capture more complex spatiotemporal dependencies. The convolution operation is expressed as:
[0076] ;
[0077] in, express Convolution operation, is the output feature of the second layer. In the third layer, a Convolution layer, the number of convolution kernels is 16, which is used to compress the number of channels and integrate feature information. The convolution operation is:
[0078] ;
[0079] in, Represents the final subspace feature matrix. Subspace feature matrix The input is sent to the channel attention module for feature enhancement. The channel attention module contains a global average pooling layer and two fully connected layers. Global average pooling is used to summarize the features of each channel to obtain a global description of each channel. , the global average pooling result is:
[0080] ;
[0081] in, Indicates The global features of all channels are combined to obtain the vector . z is input into two fully connected layers, and the output dimension of the first fully connected layer is 64:
[0082] ;
[0083] in, is the weight matrix, is the bias term, is the activation function. After the second fully connected layer, the output dimension is 8:
[0084] ;
[0085] Represents the channel weight vector, which contains the importance weight of each channel. and the subspace characteristic matrix Perform matrix multiplication to achieve weighted operation. Enhance the features of important channels while suppressing unimportant channel features. The weighted subspace features are expressed as:
[0086] ;
[0087] in, Represents element-by-element multiplication. The weighted subspace features are input into the bidirectional residual network for feature enhancement. The bidirectional residual network consists of three residual blocks, each of which contains two convolutional layer and a residual connection. The input of the residual block is , the convolution operation is expressed as:
[0088] ;
[0089] The residual connection mechanism helps the network train better and avoid the gradient vanishing problem by directly superimposing the input features on the output features. After processing by three residual blocks, the forward residual features are obtained. Subtract the forward residual feature from the original time series feature element by element to obtain the residual error for compensation calculation. Suppose the original feature is , then the residual calculation is expressed as:
[0090] ;
[0091] In order to compensate the residual error, the residual error The input is processed in the back propagation network. The back propagation network contains two fully connected layers. The output dimension of the first layer is 32, and the output dimension of the second layer is 16. The calculation formula is as follows:
[0092] ;
[0093] ;
[0094] in, and are the weight matrices, and is the bias term, Represents the reverse residual feature. The forward residual feature and the reverse residual feature are fused and the number of channels is compressed to obtain the final fused feature vector. Suppose the forward residual feature is And the reverse residual feature is , feature fusion is expressed as:
[0095] ;
[0096] Among them, Concat represents the feature connection operation, and the fused feature vector Contains forward and reverse feature information. In order to ensure the consistency of features between different channels, the fused feature vector is normalized to eliminate the differences in scales of features in different channels. The normalization formula is:
[0097] ;
[0098] in, represents the mean of the feature, Represents the standard deviation of the feature, and the standardized feature vector is The anti-interference enhanced feature vector obtained through the above steps can effectively enhance the robustness of the system in the face of noise and interference.
[0099] In one example, the interference-resistant enhanced feature vector is input into the temporal attention network to analyze the long-range dependencies between channels and generate channel collaborative control features, including:
[0100] The anti-interference enhanced feature vector is input into the multi-head self-attention layer. The multi-head self-attention layer contains 8 parallel attention heads. Each attention head contains three linear transformation layers. The input dimension is 64 and the output dimension is 32. The multi-head attention feature matrix is obtained.
[0101] The multi-head attention feature matrix is input into a three-layer multi-scale convolution module for feature extraction. The first layer uses a 1×1 convolution kernel with 64 convolution kernels, the second layer uses a 3×3 convolution kernel with 32 convolution kernels, and the third layer uses a 5×5 convolution kernel with 16 convolution kernels to obtain multi-scale temporal features.
[0102] Extract the temporal dependency of multi-scale temporal features to obtain inter-channel temporal dependency features, and perform cross-channel attention enhancement on the inter-channel temporal dependency features to obtain enhanced dependency features;
[0103] The enhanced dependency features are input into the nonlinear mapping network. The nonlinear mapping network contains three fully connected layers. The output dimensions of each layer are 64, 32, and 16 respectively. Each layer is followed by a LeakyReLU activation function to obtain a mapping feature vector.
[0104] The mapped feature vector is feature calibrated to obtain the calibrated feature vector, and the calibrated feature vector is input into the channel collaborative optimizer. The channel collaborative optimizer contains two residual connection blocks, each of which contains two 3×3 convolutional layers and one skip connection. The number of convolution kernels is 16, and the channel collaborative control feature is obtained.
[0105] In this example, the interference-resistant enhanced feature vector is input to the multi-head self-attention layer. Let the interference-resistant enhanced feature vector be ,in represents the number of time steps, Indicates the dimension of the feature vector. In the multi-head self-attention layer, there are 8 parallel attention heads, each of which contains three linear transformation layers, which are used to generate query, key and value respectively. Assuming the input dimension is 64 and the output dimension is 32, the linear transformation formula of each attention head is:
[0106] ;
[0107] in, The weight matrices representing queries, keys, and values, respectively, They are query matrix, key matrix and value matrix respectively. In each attention head, the attention weight is obtained by calculating the dot product of the query and the key, and these weights are scaled and softmaxed to obtain the attention matrix:
[0108] ;
[0109] in, is the dimension of the key vector, which is 32, Represents the dot product result of the query and the key, which is used to measure the correlation between each time step. Through scaling and softmax operations, the numerical stability of the attention weight is ensured, and the weight is normalized to the range of 0 to 1. In the 8 attention heads, each attention head calculates the attention result independently, and finally the results of all heads are connected to form a multi-head attention feature matrix:
[0110] ;
[0111] Among them, Concat means connecting the output results of each attention head. is the output matrix for linear transformation, Represents the multi-head attention feature matrix. Input to the three-layer multi-scale convolution module for feature extraction. The first layer uses Convolution kernel, the number of convolution kernels is 64, changing the number of input channels and fusing the information between channels:
[0112] ;
[0113] in, Represents the features after the first layer of convolution. The second layer uses Convolution kernel, the number of convolution kernels is 32, which is used to extract local spatial relationship features:
[0114]
[0115] in, Represents the output features after the second layer of convolution. The third layer uses Convolution kernel, the number of convolution kernels is 16, capturing a wider range of dependencies through a larger receptive field:
[0116] ;
[0117] The final multi-scale time series feature matrix is , contains the temporal and spatial information extracted by multi-layer convolution operations. The temporal dependency extraction is performed on the multi-scale temporal feature matrix to obtain the temporal dependency features between channels. The purpose of temporal dependency extraction is to analyze the temporal variation trend of each channel to determine the temporal correlation between the channels. Let the temporal dependency feature be In order to enhance these temporal dependency features, they are input into the cross-channel attention module for cross-channel attention enhancement. The cross-channel attention module calculates the global features of each channel, determines the importance of each channel, enhances the correlation between channels, and obtains enhanced dependency features:
[0118] ;
[0119] Among them, CrossAttention represents the cross-channel attention operation. is the enhanced dependency feature. The input is sent to the nonlinear mapping network, which contains three fully connected layers, each with output dimensions of 64, 32, and 16, respectively, and each layer is followed by a LeakyReLU activation function. The calculation formula for the first fully connected layer is:
[0120] ;
[0121] in, is the weight matrix, is the bias term, is the output of the first layer. Through the second and third layers, it is fully connected:
[0122] ;
[0123] ;
[0124] in, and are the weight matrices of the fully connected layers, and is the bias term, and the final mapping feature vector is After obtaining the mapped feature vector, it is calibrated to ensure that the scale and distribution of the feature vector are consistent across channels. The calibration operation is achieved by normalization or standardization, for example, using the mean and standard deviation for standardization:
[0125] ;
[0126] in, represents the mean of the feature, represents the standard deviation of the feature, is the calibrated feature vector. The calibrated feature vector is input into the channel collaborative optimizer, which contains two residual connection blocks, each of which contains two convolutional layer and a skip connection. The input of the residual block is , after two convolutional layers, the operation is:
[0127] ;
[0128] The residual connection mechanism helps to retain the original input information, prevent information loss, and improve the training efficiency of the network by directly superimposing the input features on the output features. After processing by two residual blocks, the final channel cooperative control feature is .
[0129] In one example, a hierarchical predictive control model is constructed based on the channel cooperative control characteristics, the trigger timing is processed by the sub-microsecond response control layer, and the drive parameters are dynamically adjusted by the millisecond optimization control layer to generate the optimal trigger timing sequence, including:
[0130] The channel cooperative control features are input into the timing prediction network. The timing prediction network contains three long short-term memory units, and the number of hidden layer nodes is 64, 32, and 16 respectively. The trigger timing prediction sequence is obtained through sequence prediction.
[0131] The trigger timing prediction sequence is input into the sub-microsecond response control layer for processing. The sub-microsecond response control layer includes a fast response unit and a trigger compensation unit. The input dimension is 16 and the output dimension is 8, and a fast response control sequence is obtained.
[0132] The driving parameters of the fast response control sequence are optimized to obtain the initial driving parameters, and the initial driving parameters are input into the millisecond optimization control layer for processing. The millisecond optimization control layer contains two parameter optimization units, each of which contains a fully connected layer and a parameter calibration layer, and the output dimension is 16, to obtain the optimized driving parameters;
[0133] The optimized driving parameters are input into the multi-channel cooperative controller, which includes two parallel control loops. Each loop includes a PID controller and a state feedback controller, and the output dimension is 8, to obtain the cooperative control parameters.
[0134] Perform time-series synthesis processing on the collaborative control parameters to obtain candidate trigger sequences, and input the candidate trigger sequences into the sequence optimization network. The sequence optimization network contains two residual connection blocks, each of which contains two 3×3 convolutional layers and one skip connection. The number of convolution kernels is 8, and the optimized trigger sequence is obtained.
[0135] Perform timing calibration on the optimized trigger sequence to obtain the optimal trigger timing sequence.
[0136] In this example, a deep network that can capture temporal dependencies is constructed, and a long short-term memory (LSTM) network is used to achieve temporal prediction. Suppose the channel collaborative control feature is ,in represents the number of time steps, Represents the dimension of the input feature. The time series prediction network consists of three LSTM units, and the number of hidden layer nodes of each LSTM unit is 64, 32, and 16 respectively, which are used to extract time series features layer by layer and compress information step by step. For the first LSTM unit, its input is , the output is :
[0137] ;
[0138] in, Indicates The input features of time steps, and Represent the hidden state of the first LSTM unit and the output of the memory unit respectively. Passed as input to the second LSTM cell:
[0139] ;
[0140] Similarly, the output of the second LSTM Passed as input to the third LSTM cell:
[0141] ;
[0142] in, is the final output feature, representing the deep time series feature obtained after passing through multiple layers of LSTM units. Through the layer-by-layer processing of LSTM units, the time series dependency in the channel collaborative control feature is effectively captured, and the trigger timing prediction sequence is obtained. The input is sent to the sub-microsecond response control layer for processing. The sub-microsecond response control layer contains a fast response unit and a trigger compensation unit, where the input dimension is 16 and the output dimension is 8. The fast response unit is used to quickly process the input signal so as to respond in a very short time and ensure the accuracy of the trigger. Its calculation formula is expressed as:
[0143] ;
[0144] in, is the weight matrix, is the bias term, The trigger compensation unit is used to fine-tune the signal on the basis of fast response to ensure compensation for external interference and improve control accuracy, and obtain a fast response control sequence. Optimize the drive parameters of the fast response control sequence to obtain the initial drive parameters. While meeting the control requirements, ensure that the drive signal has the optimal physical characteristics. The input is processed in the millisecond optimization control layer. The millisecond optimization control layer contains two parameter optimization units, each of which consists of a fully connected layer and a parameter calibration layer. The first fully connected layer is used to extract the driving parameter features, and its calculation formula is:
[0145] ;
[0146] in, is the weight matrix, is the bias term, is the parameter feature. The parameters are adjusted through the parameter calibration layer to ensure that they meet the physical constraints and obtain the optimized driving parameters:
[0147] ;
[0148] Among them, Calibration represents the parameter calibration operation, which is used to eliminate unreasonable parameter configuration. The optimized drive parameters are input into the multi-channel collaborative controller, which contains two parallel control loops, each of which contains a PID controller and a state feedback controller. The PID controller is used to implement proportional, integral and differential control, and its formula is:
[0149] ;
[0150] in, Indicates the error, , , are proportional, integral and differential gain coefficients respectively. The state feedback controller controls through the state feedback of the system to ensure the stability of the system. The outputs of these two control loops are combined to obtain the coordinated control parameters:
[0151] ;
[0152] in, Indicates the coordinated control parameters, the control characteristics of the integrated PID and state feedback. Perform timing synthesis processing to obtain candidate trigger sequences. The purpose of timing synthesis processing is to coordinate the control signals of each channel so that the overall response of the system has the best performance. The candidate trigger sequence is input into the sequence optimization network for optimization. The sequence optimization network contains two residual connection blocks, each of which contains two Convolutional layer and one skip connection, the number of convolution kernels is 8. The calculation formula of the residual connection block is:
[0153] ;
[0154] The residual connection mechanism helps the network train better and avoid the gradient vanishing problem by directly superimposing the input features on the output features. After processing by two residual blocks, the optimized trigger sequence is obtained. . To optimize the trigger sequence Perform timing calibration to ensure that the time step of the trigger sequence meets the system requirements. Timing calibration is achieved by interpolating and aligning the signal to obtain the optimal trigger timing sequence.
[0155] In one example, the optimal trigger timing sequence is sent to each output channel, the channel output trigger delay data is collected in real time, and the compensation trigger timing is calculated, including:
[0156] The optimal trigger timing sequence is analyzed by protocol and data packet encapsulation to obtain communication data packets, which are then distributed through an 8-channel data distributor. The data of each channel is subjected to CRC check and channel number matching, and then sent to each output channel to obtain channel trigger instructions.
[0157] The channel trigger command is converted to a 5V standard level through a high-speed optocoupler, and the differential trigger signal is converted to a DC12V~24V level. The signal is isolated through a photoelectric isolation circuit to obtain a trigger control signal.
[0158] The trigger control signal is sampled at high speed to obtain the trigger timing data, and the delay analysis is performed on the trigger timing data to calculate the time interval between adjacent trigger signals, compare it with the 500ns threshold, mark the channel number that exceeds the threshold, and obtain the delay abnormal channel identification;
[0159] The abnormal delay channel identification is associated and matched with the channel cooperative control characteristics, the control characteristic parameters of the corresponding channel are extracted, and the initial compensation parameters are generated through the compensation calculation network;
[0160] The initial compensation parameters are adaptively compensated and the trigger edge is aligned to obtain an accurate compensation sequence, and the accurate compensation sequence is synthesized with the optimal trigger timing sequence to obtain a compensation trigger timing.
[0161] In this example, protocol parsing and data packet encapsulation are performed on the optimal trigger timing sequence. Assume that the optimal trigger timing sequence is ,in represents the number of time steps, Represents the number of channels. Perform protocol parsing on the timing sequence, encode and format the timing data according to the communication protocol so that it can be effectively transmitted through the data link. After the protocol parsing is completed, perform data packet encapsulation, divide the timing data into small data blocks suitable for network transmission, and attach control information and verification information to obtain a communication data packet. The encapsulated communication data packet contains timing data, protocol header, check code and other information to ensure the integrity and correctness of the data during transmission. After the data packet encapsulation is completed, the communication data packet is distributed through an 8-channel data distributor to ensure that each channel can receive the corresponding trigger instruction. The data distributor splits and distributes the communication data packet according to the channel number, so that each channel can receive its own data. Assume Indicates The data packets of a channel, the allocation of the data distributor is expressed as:
[0162] ;
[0163] After the allocation is completed, a cyclic redundancy check (CRC) is performed on the data of each channel to ensure the integrity of the data. CRC check is a commonly used error detection technology. By performing polynomial division calculation on the data, a check code is obtained and the check code is attached to the data packet to verify the correctness of the data at the receiving end. The calculation formula of CRC check is:
[0164] ;
[0165] in, Represents a bitwise exclusive OR operation, It is a predefined polynomial used to generate a checksum. After the data packet is allocated and checked, the data packet of each channel is sent to each output channel to generate a channel trigger instruction. These trigger instructions are converted to levels through high-speed optocouplers to meet the level requirements of different devices. The differential trigger signal needs to be converted to a standard level of 5V, while the single-ended trigger signal needs to be converted to a level of DC12V to 24V. The optocoupler circuit is used to achieve level conversion and signal isolation to ensure the stability and anti-interference ability of the signal during transmission. The optocoupler circuit transmits optical signals to achieve electrical isolation between the input and output ends and generate a trigger control signal:
[0166] ;
[0167] in, Represents the converted trigger control signal, and OptoCoupler represents the processing operation of the optocoupler circuit. The trigger control signal is sampled at high speed to obtain the trigger timing data. By sampling the output signal of each channel at high speed, the actual response time of each trigger signal is captured, so as to perform delay analysis. Assume that the trigger timing data obtained by sampling is , calculate the time interval between adjacent trigger signals. The time interval calculation is expressed as:
[0168] ;
[0169] in, Indicates channel and Channel The trigger delay between and The calculated time interval is compared with the threshold of 500 nanoseconds set by the system. If the time interval of a channel exceeds the threshold, the channel is marked as abnormal delay, and the abnormal delay channel identification is obtained. , where each element is 1 or 0, indicating whether the channel has a delay anomaly. The delay anomaly channel identifier is associated and matched with the channel collaborative control feature to extract the control feature parameters of the corresponding channel. Suppose the channel collaborative control feature is ,in The dimension representing the control feature is used to extract the corresponding control feature parameters by matching the identifier of the delay abnormal channel:
[0170] ;
[0171] in, Represents element-by-element multiplication, which is used to extract the control features of the delay abnormal channel. The control feature parameters are input into the compensation calculation network to generate the initial compensation parameters. The compensation calculation network determines the appropriate compensation value by analyzing and calculating the input features to reduce the impact of the delay. The initial compensation parameters are adaptively compensated and triggered edge aligned to generate an accurate compensation sequence. Adaptive compensation adjusts the compensation parameters according to the current system status and historical information, so that the compensation effect can adaptively meet the needs of the system. Let the compensation parameter be , after adaptive adjustment, accurate compensation parameters are obtained. At the same time, in order to ensure the time synchronization of all channels, the compensation parameters are triggered and edge aligned so that the trigger edges of each channel are aligned as much as possible to obtain an accurate compensation sequence. The precise compensation sequence is synthesized with the optimal trigger timing sequence, and the final compensation trigger timing is generated by adding the two element by element.
[0172] In one example, the system response characteristics under the compensation triggering timing are evaluated, an optimized control parameter group is generated, and the optimized control parameter group is updated to the hierarchical predictive control model, including:
[0173] Based on the compensation trigger timing, the timing characteristics of the 8-channel output signals are quantitatively analyzed to obtain the system response characteristic data matrix;
[0174] The optimization target is constructed for the system response characteristic data matrix, the trigger delay minimization is set as the main optimization target, and multiple performance indicators are normalized and calculated through the weighted objective function to obtain the performance evaluation indicator vector;
[0175] Determine the parameter optimization direction according to the performance evaluation index vector, and perform gradient search optimization based on the parameter optimization direction to obtain the parameter optimization sequence;
[0176] Perform constraint check on the parameter optimization sequence to obtain a valid parameter group, and perform structured encapsulation on the valid parameter group to obtain an optimized control parameter group;
[0177] The optimized control parameter group is written into the parameter space of the sub-microsecond response control layer and the millisecond optimization control layer of the hierarchical predictive control model respectively to complete the parameter update of the hierarchical predictive control model.
[0178] In this example, the output signal of each channel is collected and analyzed to evaluate the response characteristics of each channel at different time steps. Assume that the compensation trigger timing is ,in represents the time step, Indicates the number of channels. Collect the output signal of each channel, quantitatively analyze the response characteristics of each channel, including response time, amplitude change, delay and other indicators, and generate a system response characteristic data matrix . Each element in Indicates that at time step Top, The response characteristics of each channel. The system response characteristics data matrix Optimization objectives are constructed to improve the overall control performance of the system. The main optimization objective is set to minimize the trigger delay. The trigger delay refers to the time difference between the trigger signal and the actual response signal. In order to measure the overall performance of the system, a weighted objective function is constructed to normalize multiple performance indicators and combine their contributions to the system performance. The performance evaluation indicator is set as the response delay. , signal amplitude deviation , inter-channel synchronization , then the weighted objective function It is expressed as:
[0179] ;
[0180] in, is the weighting coefficient, which represents the relative importance of each performance indicator to the overall optimization goal; are the maximum values of delay, amplitude deviation and synchronization, which are used for normalization. Through the weighted objective function, the performance indicators of different dimensions are converted to the same range to obtain the performance evaluation index vector The direction of parameter optimization is determined according to the performance evaluation index vector. The weighted objective function is optimized using the gradient descent method to determine the parameter optimization direction that minimizes the performance index. The update formula of gradient descent is:
[0181] ;
[0182] in, Indicates The parameters of the iterations, is the learning rate, Represents the gradient of the weighted objective function with respect to the parameter. By calculating the gradient, the direction of parameter update is determined so that the value of the objective function tends to be minimum in the next iteration. After multiple iterations, a set of parameter optimization sequences is obtained. , represents the parameters after stepwise optimization. Constraint checking is performed on the parameter optimization sequence to ensure that these parameters are valid in practical applications. The purpose of constraint checking is to verify whether the parameters meet the physical constraints of the system, such as voltage range, time delay, etc. Assume that the constraint condition is , then the valid parameter group is filtered by the following formula:
[0183] ;
[0184] Through constraint checking, the parameters that meet the physical constraints are retained to obtain the effective parameter group. The effective parameter group is structurally packaged for subsequent application in the control model. The packaged optimized control parameter group is . The optimized control parameter groups are written into the parameter spaces of the sub-microsecond response control layer and the millisecond optimization control layer of the hierarchical predictive control model. The hierarchical predictive control model contains two control layers, in which the sub-microsecond response control layer is used to achieve rapid response to the trigger signal, and the millisecond optimization control layer is used to dynamically adjust the control parameters of the system. Suppose the parameters of the sub-microsecond response control layer are , the parameters of the millisecond-level optimization control layer are , then the parameter update formula is:
[0185] ;
[0186] By applying the optimized parameter group to the two control layers, the parameter update of the hierarchical predictive control model is completed, thereby improving the overall performance of the system and enabling the controller to achieve fast and accurate control response on different time scales.
[0187] Reference Figure 2 , this embodiment provides a time-sharing light source controller timing optimization system, including:
[0188] Acquisition module 1, used to collect the high-speed optocoupler trigger signal, 8-channel output voltage signal and inter-channel delay signal of the time-sharing line scanning light source controller, and generate a multi-channel timing characteristic data matrix;
[0189] Decomposition module 2, used for performing dynamic subspace decomposition and bidirectional residual operation on the multi-channel time series feature data matrix to generate an anti-interference enhanced feature vector;
[0190] Analysis module 3, used for inputting the anti-interference enhanced feature vector into the temporal attention network to analyze the long-range dependency relationship between channels and generate channel collaborative control features;
[0191] Generation module 4 is used to build a hierarchical predictive control model based on channel cooperative control characteristics, process the trigger timing through the sub-microsecond response control layer, dynamically adjust the drive parameters using the millisecond optimization control layer, and generate the optimal trigger timing sequence;
[0192] Calculation module 5, used to send the optimal trigger timing sequence to each output channel, collect channel output trigger delay data in real time, and calculate the compensation trigger timing;
[0193] The updating module 6 is used to evaluate the system response characteristics under the compensation triggering timing, generate an optimized control parameter group, and update the optimized control parameter group to the hierarchical predictive control model.
[0194] In this embodiment, for the specific implementation of each unit in the above system embodiment, please refer to the above method embodiment, which will not be repeated here.
[0195] Reference Figure 3 In an embodiment of the present invention, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3As shown. The computer device includes a processor, a memory, a display screen, an input device, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the corresponding data in this embodiment. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the above method is implemented.
[0196] Those skilled in the art will understand that Figure 3 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied.
[0197] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.
[0198] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided by the present invention and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM.
[0199] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0200] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A time-sharing light source controller timing optimization method, characterized in that: The following steps are involved: Collect the high-speed optocoupler trigger signal, 8-channel output voltage signal and inter-channel delay signal of the time-sharing line scanning light source controller, and generate a multi-channel timing characteristic data matrix; Performing dynamic subspace decomposition and bidirectional residual operation on the multi-channel time series feature data matrix to generate an anti-interference enhanced feature vector; Inputting the anti-interference enhanced feature vector into a temporal attention network to analyze the long-range dependencies between channels and generate channel collaborative control features; Based on the channel cooperative control characteristics, a hierarchical predictive control model is constructed, the trigger timing is processed by the sub-microsecond response control layer, and the drive parameters are dynamically adjusted by the millisecond optimization control layer to generate the optimal trigger timing sequence; Send the optimal trigger timing sequence to each output channel, collect channel output trigger delay data in real time, and calculate the compensation trigger timing; The system response characteristics under the compensation trigger timing are evaluated to generate an optimized control parameter group, and the optimized control parameter group is updated to the hierarchical predictive control model.
2. The timing optimization method of a time-sharing light source controller according to claim 1, characterized in that: The method collects the high-speed optical coupler trigger signal, 8-channel output voltage signal and inter-channel delay signal of the time-sharing line scanning light source controller, and generates a multi-channel timing characteristic data matrix, including: Perform analog-to-digital conversion sampling on the differential trigger signal at the high-speed optocoupler input end of the time-sharing line scanning light source controller, convert the 5V differential signal into a digital quantity, perform level conversion on the single-ended trigger signal, convert the DC12V~24V signal into a standard TTL level signal, and obtain a trigger signal sampling sequence; Based on the trigger signal sampling sequence, the signal is resampled, and high-frequency noise is filtered out through a Butterworth low-pass filter to obtain a standard timing trigger sequence; The DC48V output signal is collected through the 8-channel output port, a voltage sampling matrix is established based on the feedback signal of the constant voltage drive module, and the voltage signal is filtered in real time through the Kalman filter to obtain a voltage sampling data sequence; Establishing a time reference according to the standard timing trigger sequence, time-aligning the voltage sampling data sequence to obtain a synchronous voltage data sequence, and calculating the trigger timing difference and voltage difference between adjacent channels based on the synchronous voltage data sequence to obtain an inter-channel delay feature sequence; Performing a piecewise stationarity test on the standard timing trigger sequence, extracting time-frequency features based on short-time Fourier transform, obtaining instantaneous phase information through Hilbert transform, and obtaining a trigger timing feature vector; Voltage fluctuation characteristics are extracted according to the synchronous voltage data sequence to obtain a voltage fluctuation characteristic vector, and the trigger timing characteristic vector, the voltage fluctuation characteristic vector and the inter-channel delay characteristic sequence are combined to obtain a multi-channel timing characteristic data matrix.
3. The timing optimization method of a time-sharing light source controller according to claim 2, characterized in that: The step of performing dynamic subspace decomposition and bidirectional residual operation on the multi-channel time series feature data matrix to generate an anti-interference enhanced feature vector includes: Performing time window segmentation on the multi-channel time series feature data matrix to obtain a segmented time series feature matrix group; Input the segmented time series feature matrix group into a dynamic subspace decomposition unit, wherein the dynamic subspace decomposition unit comprises a three-layer structure: the first layer is 4 parallel 1×1 convolution layers, the number of convolution kernels is 64, the second layer is 2 parallel 3×3 convolution layers, the number of convolution kernels is 32, and the third layer is 1 1×1 convolution layer, the number of convolution kernels is 16, and a subspace feature matrix is obtained; Input the subspace feature matrix into a channel attention module for feature enhancement, wherein the channel attention module includes a global average pooling layer and two fully connected layers, wherein the output dimension of the first fully connected layer is 64 and the output dimension of the second fully connected layer is 8, to obtain a channel weight vector; Performing a matrix multiplication operation on the channel weight vector and the subspace feature matrix to obtain a weighted subspace feature; Inputting the weighted subspace features into a bidirectional residual network for feature enhancement, the bidirectional residual network comprises three residual blocks, each residual block comprises two 3×3 convolutional layers and one residual connection, and the number of convolution kernels are 32, 16, and 8 respectively, to obtain a positive residual feature; Performing an element-by-element subtraction operation on the forward residual feature and the original time series feature, calculating the compensation feature through a back propagation network, wherein the back propagation network comprises two fully connected layers, the first layer output dimension is 32, and the second layer output dimension is 16, to obtain a reverse residual feature; The forward residual feature and the reverse residual feature are subjected to feature fusion and channel number compression to obtain a fused feature vector, and the fused feature vector is subjected to feature standardization to obtain an anti-interference enhanced feature vector.
4. The time-sharing light source controller timing optimization method according to claim 3, characterized in that: The step of inputting the anti-interference enhanced feature vector into a temporal attention network to analyze the long-range dependency relationship between channels and generate channel collaborative control features includes: Inputting the anti-interference enhanced feature vector into a multi-head self-attention layer, wherein the multi-head self-attention layer includes 8 parallel attention heads, each attention head includes three linear transformation layers, the input dimension is 64, and the output dimension is 32, to obtain a multi-head attention feature matrix; The multi-head attention feature matrix is input into a three-layer multi-scale convolution module for feature extraction. The first layer uses a 1×1 convolution kernel with 64 convolution kernels, the second layer uses a 3×3 convolution kernel with 32 convolution kernels, and the third layer uses a 5×5 convolution kernel with 16 convolution kernels to obtain multi-scale time series features. Performing temporal dependency extraction on the multi-scale temporal features to obtain inter-channel temporal dependency features, and performing cross-channel attention enhancement on the inter-channel temporal dependency features to obtain enhanced dependency features; Input the enhanced dependency feature into a nonlinear mapping network, wherein the nonlinear mapping network comprises three fully connected layers, the output dimensions of each layer are 64, 32, and 16 respectively, and each layer is followed by a LeakyReLU activation function to obtain a mapping feature vector; The mapped feature vector is feature calibrated to obtain a calibrated feature vector, and the calibrated feature vector is input into a channel collaborative optimizer, wherein the channel collaborative optimizer includes two residual connection blocks, each residual connection block includes two 3×3 convolutional layers and one jump connection, and the number of convolution kernels is 16, so as to obtain a channel collaborative control feature.
5. The time-sharing light source controller timing optimization method according to claim 4, characterized in that: The hierarchical predictive control model is constructed based on the channel cooperative control characteristics, the trigger timing is processed by the sub-microsecond response control layer, the drive parameters are dynamically adjusted by the millisecond optimization control layer, and the optimal trigger timing sequence is generated, including: The channel cooperative control feature is input into a timing prediction network, wherein the timing prediction network comprises three long short-term memory units, and the number of hidden layer nodes is 64, 32, and 16 respectively, and a trigger timing prediction sequence is obtained through sequence prediction; Input the trigger timing prediction sequence into a sub-microsecond response control layer for processing, wherein the sub-microsecond response control layer includes a fast response unit and a trigger compensation unit, the input dimension is 16, and the output dimension is 8, to obtain a fast response control sequence; Optimizing the driving parameters of the fast response control sequence to obtain initial driving parameters, and inputting the initial driving parameters into a millisecond-level optimization control layer for processing, wherein the millisecond-level optimization control layer includes two parameter optimization units, each of which includes a fully connected layer and a parameter calibration layer, and the output dimension is 16, to obtain optimized driving parameters; The optimized driving parameters are input into a multi-channel collaborative controller, wherein the multi-channel collaborative controller comprises two parallel control loops, each loop comprises a PID controller and a state feedback controller, and the output dimension is 8, to obtain collaborative control parameters; Performing time-series synthesis processing on the collaborative control parameters to obtain a candidate trigger sequence, and inputting the candidate trigger sequence into a sequence optimization network, wherein the sequence optimization network comprises two residual connection blocks, each residual block comprises two 3×3 convolutional layers and one skip connection, and the number of convolutional kernels is 8, to obtain an optimized trigger sequence; The optimized trigger sequence is subjected to timing calibration processing to obtain an optimal trigger timing sequence.
6. The time-sharing light source controller timing optimization method according to claim 5, characterized in that: The optimal trigger timing sequence is sent to each output channel, channel output trigger delay data is collected in real time, and compensation trigger timing is calculated, including: The optimal trigger timing sequence is subjected to protocol parsing and data packet encapsulation to obtain a communication data packet, and the communication data packet is distributed through an 8-channel data distributor, and CRC check and channel number matching are performed on the data of each channel, and the data is sent to each output channel to obtain a channel trigger instruction; The channel trigger command is level-converted by a high-speed optical coupler, the differential trigger signal is converted to a 5V standard level, the single-ended trigger signal is converted to a DC12V-24V level, and the signal is isolated by a photoelectric isolation circuit to obtain a trigger control signal; The trigger control signal is sampled at high speed to obtain trigger timing data, and the trigger timing data is subjected to delay analysis, the time interval between adjacent trigger signals is calculated, and compared with a 500ns threshold, and the channel number exceeding the threshold is marked to obtain a delay abnormal channel identifier; Associating and matching the abnormal delay channel identifier with the channel collaborative control feature, extracting the control feature parameters of the corresponding channel, and generating initial compensation parameters through a compensation calculation network; The initial compensation parameters are subjected to adaptive compensation and trigger edge alignment processing to obtain an accurate compensation sequence, and the accurate compensation sequence is synthesized with the optimal trigger timing sequence to obtain a compensation trigger timing sequence.
7. The timing optimization method of a time-sharing light source controller according to claim 6, characterized in that: The step of evaluating the system response characteristics under the compensation triggering timing, generating an optimized control parameter group, and updating the optimized control parameter group to the hierarchical predictive control model includes: Based on the compensation trigger timing, the timing characteristics of the 8-channel output signals are quantitatively analyzed to obtain a system response characteristic data matrix; An optimization target is constructed for the system response characteristic data matrix, minimization of the trigger delay is set as the main optimization target, and multiple performance indicators are normalized and calculated through a weighted objective function to obtain a performance evaluation indicator vector; Determine a parameter optimization direction according to the performance evaluation index vector, and perform gradient search optimization based on the parameter optimization direction to obtain a parameter optimization sequence; Performing constraint checking on the parameter optimization sequence to obtain a valid parameter group, and performing structural packaging on the valid parameter group to obtain an optimized control parameter group; The optimized control parameter group is written into the parameter space of the sub-microsecond response control layer and the millisecond optimization control layer of the hierarchical predictive control model respectively to complete the parameter update of the hierarchical predictive control model.
8. A time-sharing light source controller timing optimization system, characterized in that: For implementing the steps of the method according to any one of claims 1 to 7, the system comprises: The acquisition module is used to collect the high-speed optocoupler trigger signal, 8-channel output voltage signal and inter-channel delay signal of the time-sharing line scanning light source controller, and generate a multi-channel timing characteristic data matrix; A decomposition module, used for performing dynamic subspace decomposition and bidirectional residual operation on the multi-channel time series feature data matrix to generate an anti-interference enhanced feature vector; An analysis module, used for inputting the anti-interference enhanced feature vector into a temporal attention network to analyze the long-range dependency relationship between channels and generate channel collaborative control features; A generation module is used to construct a hierarchical predictive control model based on the channel cooperative control characteristics, process the trigger timing through a sub-microsecond response control layer, dynamically adjust the drive parameters using a millisecond optimization control layer, and generate an optimal trigger timing sequence; A calculation module, used to send the optimal trigger timing sequence to each output channel, collect channel output trigger delay data in real time, and calculate the compensation trigger timing; An updating module is used to evaluate the system response characteristics under the compensation trigger timing, generate an optimized control parameter group, and update the optimized control parameter group to the hierarchical predictive control model.
9. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Time-sharing linear scanning system and method based on machine vision
CN116858833A
Simulation light source controller parameter adaptive adjustment method and device
CN119322460A