A method, system, and medium for temperature control of a laser

By utilizing a temperature control method for the laser, preprocessing of cavity temperature information, and a segmented compensation table, automatic temperature compensation for the laser in a wide temperature environment was achieved. This solved the problem of unstable laser output in a wide temperature environment and ensured stable laser output at different temperatures.

CN123177580APending Publication Date: 2026-11-27PACOS OPTOELECTRONICS TECHNOLOGY (FOSHAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611367215.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-04
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies struggle to maintain laser temperature stability in wide-temperature environments, leading to output fluctuations and failing to meet the requirement for stable light output.

Method used

The cavity temperature information is preprocessed, the gear position is determined using a segmented compensation table, the compensation bias is calculated, and the output is buffered to generate a temperature control command to drive the TEC for temperature control.

Benefits of technology

Automatic temperature compensation is achieved over a wide temperature range, maintaining the stability of the laser output and adapting to changes in ambient temperature.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123177580A_ABST
    Figure CN123177580A_ABST
Patent Text Reader

Abstract

The application discloses a temperature control method, system and medium of a laser, and belongs to the technical field of laser control. The method comprises the following steps: acquiring cavity temperature information; performing sliding window de-extreme value averaging and low-pass filtering pretreatment on the cavity temperature data to obtain stable cavity temperature information; combining a preset segmented compensation table, performing gear judgment through hysteresis threshold comparison and multi-cycle confirmation to obtain a current compensation gear; extracting a corresponding compensation offset from the segmented compensation table, adding the offset to a reference set value to calculate a target set value; performing speed-limited climbing output buffering processing on the target set value to obtain an actual set value; and generating a temperature control instruction according to the actual set value to drive a TEC to perform temperature control, so that the TEC control temperature target can be automatically compensated according to the cavity temperature in a wide temperature range, and the setting value mutation under extreme temperature and TEC saturated oscillation can be avoided through the hysteresis, anti-shake and speed-limited buffering mechanism, and stable light emission is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of laser control technology, and in particular to a method, system and medium for temperature control of a laser. Background Technology

[0002] Solid-state lasers, such as those using nonlinear crystal frequency doubling or sum-frequency generation, have key components like the nonlinear crystal and LD pump source that are extremely sensitive to temperature. Precise temperature control using a TEC (thermal energy dissipation device) and temperature sensors is crucial to maintain these components at their optimal operating temperatures for stable laser output. However, real-world products typically operate over long periods in a wide temperature range, such as 0°C to 50°C. Fluctuations in ambient temperature alter the thermal environment and temperature gradient of the controlled components through the overall heat dissipation and optical cavity structure, causing the fixed temperature control target established under calibration conditions to deviate from its optimal value under high or low temperatures. Current solutions often employ a fixed temperature control target combined with PID control; however, this approach does not adjust the temperature control target according to ambient temperature changes, resulting in output fluctuations due to temperature drift over a wide temperature range, making it difficult to meet the requirement of stable laser output across this range. Summary of the Invention

[0003] This application aims to improve at least one technical problem in the background art.

[0004] This application provides a method for temperature control of a laser, comprising: Obtain cavity temperature information; Preprocess the cavity temperature data in the cavity temperature information to obtain stable cavity temperature information; The current compensation level is determined by analyzing the stable cavity temperature information and the preset segmented compensation table. Based on the current compensation level, extract the corresponding compensation offset from the segmented compensation table, and calculate the target setting value based on the compensation offset and the preset benchmark setting value. The target setpoint is buffered to obtain the actual setpoint. Temperature control commands are generated based on the actual set values ​​to drive the TEC to control the temperature of the controlled components.

[0005] According to some technical solutions of this application, obtaining the cavity temperature information specifically includes: Collect raw cavity temperature data to obtain cavity temperature data; Obtain historical gear position flags to obtain a set of flag positions; Obtain the feedback temperature of the controlled component in the TEC temperature control loop to obtain the real-time feedback temperature; Obtain the output status in the TEC temperature control circuit to obtain output status information; Get the current setpoint for the current control cycle; The cavity temperature data, flag set, real-time feedback temperature, current set value and output status information are integrated to obtain the cavity temperature information.

[0006] According to some technical solutions of this application, the preprocessing of the cavity temperature data in the cavity temperature information to obtain stable cavity temperature information specifically includes: Noise reduction processing is performed on the cavity temperature data in the cavity temperature information; The noise-reduced cavity temperature data is stored in a sliding buffer window of preset length according to the acquisition order to obtain the buffer window data. The extreme values ​​of the sliding buffer window data are removed, and the average value is calculated after removal to obtain the extreme value-removed average temperature. The extreme value average temperature is filtered to obtain stable cavity temperature information.

[0007] According to some technical solutions of this application, the step of determining the compensation level based on stable cavity temperature information and a preset segmented compensation table to obtain the current compensation level specifically includes: Extract the entry and exit threshold values ​​for each gear from the preset segmented compensation table; Extract the set of flag bits from the cavity temperature information, and determine the current gear from the set of flag bits; The stable chamber temperature information is compared with the entry and exit threshold values ​​corresponding to each gear, and the instantaneous gear is determined based on the comparison results. The instantaneous gear position is compared with the current gear position, and the current compensation gear position is determined based on the comparison result.

[0008] According to some technical solutions of this application, the step of comparing the stable cavity temperature information with the entry and exit thresholds corresponding to each gear position, and determining the instantaneous gear position based on the comparison result, specifically includes: Compare the stable chamber temperature information with the exit threshold value corresponding to the current gear; If the current gear is a high temperature gear and the stable cavity temperature information is lower than the exit threshold value corresponding to the current gear, or if the current gear is a low temperature gear and the stable cavity temperature information is higher than the exit threshold value corresponding to the current gear, then the stable cavity temperature information is compared with the entry threshold value corresponding to each gear. If a high-temperature setting exists and the stable cavity temperature information is higher than the entry threshold for that setting, or if a low-temperature setting exists and the stable cavity temperature information is lower than the entry threshold for that setting, then the setting that meets the corresponding entry conditions will be determined as the instantaneous setting. If the current gear does not meet the corresponding exit conditions, then the current gear will be determined as an instantaneous gear.

[0009] According to some technical solutions of this application, the step of comparing the instantaneous gear position with the current gear position and determining the current compensation gear position based on the comparison result includes: Compare the instantaneous gear position with the current gear position; If the instantaneous gear is the same as the current gear, then the current gear will be maintained as the current compensation gear; If the instantaneous gear position is inconsistent with the current gear position, then determine whether the candidate gear position remains unchanged within the preset sampling period; If so, set the candidate gear to the current compensation gear and update the flag set.

[0010] According to some technical solutions of this application, the step of extracting the corresponding compensation offset from the segmented compensation table based on the current compensation level, and calculating the target setting value based on the compensation offset and the preset benchmark setting value, specifically includes: Based on the current compensation level, extract the corresponding original bias from the segmented compensation table; The compensation bias is obtained by subtracting the preset constant from the original bias. Obtain the factory reference temperature and multiply it by the preset fixed-point scaling factor to obtain the reference setting value. The reference setting value is added to the compensation bias value to obtain the target setting value.

[0011] According to some technical solutions of this application, the step of performing output buffering processing on the target setpoint to obtain the actual setpoint specifically includes: The current set value is extracted from the cavity temperature information; Calculate the difference between the target setpoint and the current setpoint; The difference is compared with the preset speed limit step size. When the absolute value of the difference is less than or equal to the speed limit step size, the target setting value is used as the actual setting value. When the absolute value of the difference is greater than the speed limit step size, the current set value is added to the speed limit step size along the direction of the difference to obtain the actual set value.

[0012] This application also provides a temperature control system for a laser, used to implement the temperature control method for a laser as described in the above technical solution, comprising: The acquisition module is used to acquire cavity temperature information; The preprocessing module is used to preprocess the cavity temperature data in the cavity temperature information to obtain stable cavity temperature information. The judgment module is used to determine the current compensation level based on the stable cavity temperature information and the preset segmented compensation table. The calculation module is used to extract the corresponding compensation offset from the segmented compensation table based on the current compensation level, and calculate the target setting value based on the compensation offset and the preset benchmark setting value. The buffer module is used to perform output buffering processing on the target setpoint to obtain the actual setpoint. The generation module is used to generate temperature control commands based on actual set values, which are then used to drive the TEC to control the temperature of the controlled components.

[0013] This application also provides a computer-readable storage medium storing instructions that, when executed by a processor, implement the various steps of the laser temperature control method described in the above technical solution.

[0014] The temperature control method for a laser provided in this application has at least the following beneficial effects: by sequentially performing preprocessing, hysteresis anti-shake level judgment, segmented compensation calculation, output buffer processing, and temperature control command generation after acquiring cavity temperature information, the TEC temperature control target can be automatically corrected based on cavity temperature and segmented compensation table, so that the TEC temperature control target can be adjusted in real time with changes in ambient temperature, thereby maintaining stable light output performance over a wide temperature range. Attached Figure Description

[0015] Figure 1 A schematic flowchart illustrating the temperature control method for a laser provided in an embodiment of this application; Figure 2 This is a schematic diagram of the temperature control system of the laser provided in an embodiment of this application. Detailed Implementation

[0016] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0017] In the description of this application, it should be understood that the orientation descriptions, such as up, down, front, back, left, right, etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation or be constructed or operated in a specific orientation. Therefore, they should not be construed as limiting the present invention.

[0018] In the description of this application, unless otherwise expressly defined, terms such as "setup," "installation," and "connection" should be interpreted broadly, and those skilled in the art can reasonably determine the specific meaning of the above terms in this application in conjunction with the specific content of the technical solution.

[0019] The following is combined with Figures 1 to 2 Embodiments of the present invention will be described.

[0020] This application provides a method for temperature control of a laser, comprising: S100, acquire cavity temperature information; where cavity temperature refers to the measured temperature of the current laser's overall thermal environment, obtained by sampling from an NTC (Negative Temperature Coefficient) placed on the laser's optical cavity or heat dissipation structure via an ADC (Analog-to-Digital Converter) inside the STM32 microcontroller.

[0021] S200: Preprocess the cavity temperature data in the cavity temperature information to obtain stable cavity temperature information. In this embodiment, since directly using the raw cavity temperature data will cause transient spikes and incorrect gear switching, it is necessary to obtain a temperature value that can characterize the thermal inertia of the cavity after multi-level filtering of the cavity temperature data, which will be used as the basis for subsequent gear compensation judgment.

[0022] S300 determines the current compensation level based on stable cavity temperature information and a preset segmented compensation table. The segmented compensation table is a lookup table written into EEPROM (Electrically Erasable Programmable Read-Only Memory) during factory calibration, containing several cavity temperature nodes and their corresponding compensation biases. In this embodiment, the segmented compensation table has nine levels, for example, levels 0-8. Level 0 corresponds to a cavity temperature range of 20℃-35℃, with a compensation bias of 0. The five high-temperature levels (levels 4-8) correspond to cavity temperatures exceeding 35℃, 39℃, 43℃, 46℃, and 50℃, respectively, requiring an upward adjustment of the TEC temperature control target to compensate for insufficient TEC cooling capacity at high temperatures. The three low-temperature levels (levels 1-3) correspond to cavity temperatures below 20℃, 15℃, and 10℃, respectively, requiring a downward adjustment of the TEC temperature control target to compensate for changes in TEC heating capacity at low temperatures.

[0023] S400: Based on the current compensation level, extract the corresponding compensation bias from the segmented compensation table, and calculate the target setting value according to the compensation bias and the preset reference setting value. In this embodiment, the compensation bias is a temperature offset value pre-stored for each level in the segmented compensation table, used to make a positive (upward) or negative (downward) offset based on the reference temperature control temperature to correct the optimal temperature control target of TEC at different cavity temperatures. The "reference setting value" is a fixed-point expression of the TEC temperature control target determined under normal temperature calibration conditions. The target setting value is the TEC temperature control target after compensation correction.

[0024] S500 performs output buffering on the target setpoint to obtain the actual setpoint. In this embodiment, the output buffering is also called speed-limiting ramp-up buffering, which is used to solve the TEC saturation oscillation problem under extreme temperatures. Instead of writing the newly calculated target setpoint into the TEC temperature controller all at once, it moves only in the target direction within each control cycle by no more than one speed-limiting step ΔS, thereby avoiding the impact of sudden setpoint changes on the TEC. The speed-limiting step ΔS is the preset maximum allowable change in each control cycle; in this embodiment, ΔS=2, an internal fixed-point unit corresponding to 0.2℃.

[0025] The S600 generates temperature control commands based on actual setpoints to drive the TEC (Digital-to-Analog Converter) to control the temperature of the controlled component. These temperature control commands use the actual setpoint as the setpoint for the TEC's temperature control PID controller. The PID controller, based on the error between this setpoint and the temperature feedback from the controlled component, performs PID calculations and outputs a PWM (Pulse Width Modulation) signal or a DAC (Digital-to-Analog Converter) analog signal to drive the TEC to cool or heat.

[0026] For example, the actual setpoint of 352, corresponding to 35.2℃, is sent to the TEC temperature control PID controller as the setpoint for this cycle. The PID controller reads the real-time feedback temperature of the BBO crystal, 35.1℃, and calculates the error e = setpoint - feedback temperature = 35.2 - 35.1 = 0.1℃. Using the PID algorithm, when the error is small, the integral action is weakened to prevent integral saturation; when the error rate of change is large, the derivative weight is increased to speed up the response. The PID output is a duty cycle value, which, via the PWM drive circuit, controls the direction and magnitude of the TEC's power supply current. When heating is needed, the TEC is powered on for heating; when cooling is needed, the TEC is powered on for cooling. This allows the TEC to regulate the temperature of the BBO crystal according to the temperature control command, stabilizing the crystal temperature around 35.2℃. This temperature control sampling cycle ends, and after 200ms, the system enters the next cycle, restarting the entire process from S100, continuously cycling.

[0027] In some embodiments, S100, obtaining cavity temperature information, specifically includes: S110 collects raw cavity temperature data to obtain the cavity temperature data. For example, it can collect the data using an NTC thermistor mounted on the laser cavity heat sink, which serves as the raw cavity temperature value.

[0028] S120, obtain the historical level flag to obtain the flag set. For example, the flag set is a Boolean array or nine bits containing nine elements, each element corresponding to a compensation level, for example, corresponding to levels 0-8 in total. When a flag bit is 1, it indicates that the laser is currently or in the previous cycle at that level; when it is 0, it indicates that it is not in that level. In actual configuration and operation, only one flag bit is 1. For example, read from EEPROM, where bit0-bit8 correspond to levels 0-8 respectively. The reading result bit3=1, and the rest are 0, indicating that the laser was in level 3 in the previous control cycle, that is, the low temperature level, corresponding to the working condition where the cavity temperature is below 10℃. Parse this value into the flag set: flag[0]=0, flag[1]=0, flag[2]=0, flag[3]=1, flag[4]=0, flag[5]=0, flag[6]=0, flag[7]=0, flag[8]=0.

[0029] S130 acquires the feedback temperature of the controlled component in the TEC temperature control loop to obtain the real-time feedback temperature. The real-time feedback temperature refers to the actual measured temperature of the controlled component.

[0030] S140: Obtain the output status of the TEC temperature control loop to obtain output status information. This information includes the current output value of the PID controller and a flag indicating whether that output value is in a saturation state. Saturation means that the PID output has reached its upper or lower limit; for example, at extremely high temperatures, the TEC is cooling at full power but still cannot reduce the controlled point temperature to the target value.

[0031] S150, Obtain the current setting value for the current control cycle. The current setting value is the actual setting value issued in the previous control cycle, i.e., the current actual setting value.

[0032] S160 integrates cavity temperature data, flag set, real-time feedback temperature, current set value, and output status information to obtain cavity temperature information. For example, it can be packaged into a structure for easy subsequent use.

[0033] In some embodiments, step S200 involves preprocessing the cavity temperature data in the cavity temperature information to obtain stable cavity temperature information, specifically including: S210: The cavity temperature data in the cavity temperature information is denoised to obtain a value closer to the actual temperature. For example, the acquired cavity temperature data of 36.2℃ is fed into a first-order Kalman filter. The state transition model of the Kalman filter assumes that the temperature remains essentially constant between two adjacent sampling periods, with process noise covariance Q=0.01 and observation noise covariance R=0.1. The filter prediction step uses the estimated value of 36.0℃ from the previous period as the prior estimate for the current period; the update step merges the current observation value of 36.2℃ with the prior estimate, outputting the posterior estimate of 36.1℃, which is the denoised cavity temperature data.

[0034] S220: The noise-reduced cavity temperature data is stored in a sliding buffer window of a preset length according to the acquisition order to obtain buffer window data. The sliding buffer window is a fixed-length FIFO (First In First Out) circular queue. Each time new data is enqueued, the oldest data is pushed out, always storing the most recent sampled values. For example, the sliding buffer window length is set to L=16. The current window originally contains 15 data points. The noise-reduced 36.1℃ is appended to the end of the queue, filling the window to 16 data points. If new data is enqueued subsequently, the earliest enqueued data (the head of the queue) will be removed. The current buffer window data is {35.8,36.0,36.1,35.9,36.2,36.3,36.0,35.7,36.1,36.2,36.4,36.0,35.9,36.1,36.2,36.1}.

[0035] S230, perform extreme value removal on the sliding buffer window data and calculate the average value after removal to obtain the extreme value-removed average temperature. By removing the extreme values, the maximum and minimum values ​​in the dataset are first removed, as these two extreme values ​​are most likely abnormal spikes. Then, the average of the remaining data is calculated to obtain a more robust statistical estimate. For example, after sorting the 16 data points in the window, the maximum value (36.4) and minimum value (35.7) are found and removed. The arithmetic mean of the remaining 14 data points is calculated: Extreme value-removed average temperature = (35.8 + 36.0 + 36.1 + 35.9 + 36.2 + 36.3 + 36.0 + 36.1 + 36.2 + 36.2 + 36.0 + 35.9 + 36.1 + 36.2) ÷ 14, which is 36.06℃.

[0036] S240 performs filtering on the extreme value removal average temperature to obtain stable cavity temperature information. This filtering refers to first-order low-pass filtering (EMA), which further smooths the temperature curve after extreme value removal averaging, ensuring the output value follows the gradual thermal trend of the cavity temperature rather than being disturbed by residual fluctuations. The first-order low-pass filtering formula is: emaValue(n)=emaValue(n-1)+α×[avg(n)-emaValue(n-1)] Where α=0.15 is the smoothing coefficient, emaValue(n-1)=35.98℃ is the filtered output of the previous cycle, and avg(n)=36.06℃ is the average temperature after removing extreme values ​​in the current cycle. Substituting these values, emaValue=35.98+0.15×(36.06-35.98)=35.98+0.15×0.08=35.98+0.012=35.992℃. Rounding to one decimal place, this is 36.0℃. This value represents the stable cavity temperature information, used as the basis for subsequent gear selection. Thus, compared to the original cavity temperature data of 36.2℃, the output after multi-stage filtering is smoother and less prone to jumps due to single-point glitches or transient fluctuations.

[0037] In some embodiments, step S300 involves determining the compensation level based on stable cavity temperature information and a preset segmented compensation table to obtain the current compensation level, specifically including: S310 extracts the entry and exit threshold values ​​for each gear from a preset segmented compensation table. The segmented compensation table is stored in EEPROM, and each gear includes node temperature, upper hysteresis band H_up, lower hysteresis band H_down, and original bias. The entry and exit thresholds are calculated from the node temperature and hysteresis band. Taking gear 4 as an example, reading from the EEPROM, node temperature = 35℃, H_up = 1.0℃, H_down = 0.5℃, and original bias = 132. Therefore, the entry threshold = node temperature + H_up = 35 + 1.0 = 36.0℃, and the exit threshold = node temperature - H_down = 35 - 0.5 = 34.5℃. This allows for the extraction and calculation of all nine gears one by one.

[0038] S320 extracts a set of flag bits from the cavity temperature information and determines the current gear from the set of flag bits. The current gear refers to the compensation gear the system was in at the end of the previous control cycle, which can be determined by the unique flag bit that is 1 in the flag bit set during actual configuration. For example, if bit3 is read as 1 from the cavity temperature information, and the rest are 0, then the current gear is determined to be gear 3.

[0039] S330 compares the stabilized cavity temperature information with the corresponding entry and exit thresholds for each gear level, and determines the instantaneous gear level based on the comparison result. The instantaneous gear level refers to the compensation level determined at the current sampling moment solely based on the comparison between the stabilized cavity temperature and the threshold value, and has not yet been confirmed by anti-shake measures. The instantaneous gear level may change frequently due to temperature fluctuations, therefore it cannot be directly used as the final gear level.

[0040] The stable chamber temperature is 36.0℃, and the current gear is gear 3, i.e., the low-temperature gear, with an exit threshold of 11.0℃. Comparing 36.0℃ with the exit threshold of 11.0℃ for gear 3: 36.0℃ > 11.0℃, the exit condition is met, and gear 3 should be exited. Because the current gear needs to be exited, the system checks the entry thresholds of adjacent gears one by one in descending order of temperature. Since 36.0℃ is in the high-temperature range, the following gears on the high-temperature side are checked sequentially: Gear 8 entry threshold 51.0℃: 36.0℃ is less than 51.0℃, so it does not meet the requirement. Gear 7 entry threshold 47.0℃: 36.0℃ is less than 47.0℃, so it does not meet the requirement. Gear 6 entry threshold 44.0℃: 36.0℃ is less than 44.0℃, so it does not meet the requirement. Gear 5 entry threshold 40.0℃: 36.0℃ is less than 40.0℃, so it does not meet the requirement. The threshold for entering gear 4 is 36.0℃: 36.0 ≥ 36.0℃. The first gear to meet this condition is gear 4, and the instantaneous gear is determined as gear 4. If gear 4 is inconsistent with the current gear, it is considered a candidate gear. In other words, a candidate gear is a gear temporarily stored and awaiting confirmation when the instantaneous gear first becomes inconsistent with the current gear.

[0041] S340: Compare the instantaneous gear position with the current gear position, and determine the current compensation gear position based on the comparison result. For example, the instantaneous gear position 4 is inconsistent with the current gear position 3. Check the candidate gear position status; there were no candidate gear positions in the previous cycle, so the candidate gear position is set to 4, and the image stabilization counter is initialized to 1. In the second cycle, assuming the stabilized cavity temperature is 36.1℃ after filtering, the hysteresis-determined instantaneous gear position is still 4, i.e., 36.1℃ ≥ the 4th gear entry threshold of 36.0℃, consistent with the candidate gear position, and the counter increments to 2. In the third cycle, the stabilized cavity temperature is 36.0℃, the instantaneous gear position is still 4, and the counter is 3. In the fourth cycle, the stabilized cavity temperature is 36.2℃, the instantaneous gear position is still 4, and the counter is 4. In the fifth cycle, the stabilized cavity temperature is 36.1℃, still satisfying the 4th gear entry threshold of 36.0℃, the instantaneous gear position is still 4, and the counter reaches 5.

[0042] When N is set to 5, the counter meets the condition, and the anti-shake confirmation is successful. The candidate gear 4 is officially set as the current compensation gear, flag[3]=0 is set to clear the old flag bit; flag[4]=1 is set to set the new flag bit, and the current gear is updated to gear 4. The updated flag bit set is written back to EEPROM to prevent loss in case of power failure.

[0043] In some embodiments, step S330 compares the stable cavity temperature information with the entry and exit thresholds corresponding to each gear position, and determines the instantaneous gear position based on the comparison result, specifically including: S331, compare the stable chamber temperature information with the current gear and the corresponding exit threshold. In this embodiment, the current gear is gear 3 (node ​​temperature 10℃), and the exit threshold = node temperature + H_up = 10 + 1.0 = 11.0℃. That is, for the low temperature gear, exiting means that the temperature rises back to above the node temperature plus the upper hysteresis band. Compare the stable chamber temperature of 36.0℃ with the exit threshold of 11.0℃: 36.0℃ > 11.0℃, thus meeting the exit condition.

[0044] S332, if the current gear is a high temperature gear and the stable cavity temperature information is lower than the exit threshold value corresponding to the current gear, or if the current gear is a low temperature gear and the stable cavity temperature information is higher than the exit threshold value corresponding to the current gear, then the stable cavity temperature information is compared with the entry threshold value corresponding to each gear. In this embodiment, each gear level refers to a candidate compensation gear level. Since 36.0℃ is higher than the exit threshold of 11.0℃ for gear level 3, the system then checks the entry threshold values ​​for each gear level on the high-temperature side. The entry threshold is calculated as follows: High-temperature gear entry threshold = Node temperature + H_up. Each node is compared one by one. For gear level 8, at 50℃, the entry threshold is 50 + 1.0 = 51.0℃. Since 36.0℃ is less than 51.0℃, this does not meet the requirement. For gear level 7, at 46℃, the entry threshold is 46 + 1.0 = 47.0℃. Since 36.0℃ is less than 47.0℃, this does not meet the requirement. For gear level 6, at 43℃, the entry threshold is 43 + 1.0 = 44.0℃. Since 36.0℃ is less than 44.0℃, this does not meet the requirement. For gear level 5, at 39℃, the entry threshold is 39 + 1.0 = 40.0℃. Since 36.0℃ is less than 40.0℃, this does not meet the requirement. For the fourth node at 35℃, the entry threshold is 35 + 1.0 = 36.0℃. Since 36.0 ≥ 36.0, the condition is satisfied.

[0045] S333: If a high-temperature setting exists and the stable cavity temperature information is higher than the entry threshold for that setting, or if a low-temperature setting exists and the stable cavity temperature information is lower than the entry threshold for that setting, then the setting that meets the corresponding entry condition is determined as the instantaneous setting. In the search order from high temperature to low temperature, the 4th setting is the first setting to meet the entry threshold condition; therefore, the instantaneous setting is determined as the 4th setting to select the setting closest to the actual temperature for compensation.

[0046] S334, if the current gear does not meet the exit condition, then the current gear is determined as an instantaneous gear. In another embodiment, the current gear is gear 4, i.e., the high-temperature gear, with an exit threshold of 34.5°C and a stable chamber temperature of 34.0°C. 34.0°C is lower than 34.5°C, which meets the exit condition for the high-temperature gear. Therefore, it is necessary to check other gears and determine the instantaneous gear based on the entry threshold of each candidate gear. If the stable chamber temperature is within the hysteresis holding band of 34.5°C to 36.0°C, then the current gear, gear 4, remains unchanged, thereby avoiding back-and-forth switching at the boundary.

[0047] In some embodiments, step S340, comparing the instantaneous gear position with the current gear position and determining the current compensation gear position based on the comparison result, includes: S341, compare the instantaneous gear position with the current gear position; if the instantaneous gear position for this cycle is 4th gear, the current gear position is determined to be 3rd gear by bit3=1 in the flag set. If they are different, proceed to the next anti-shake judgment process.

[0048] S342, if the instantaneous level is the same as the current level, then the current level is maintained as the current compensation level; for example, if the stable cavity temperature in a certain cycle is 32.0℃, the instantaneous hysteresis decision level is level 0 (normal temperature), and the current level is also level 0, then they are consistent. In this case, there is no need to start the anti-shake timing, and the current level 0 is directly maintained as the current compensation level for this cycle. The compensation bias is 0, the target setpoint is equal to the reference setpoint, the output buffer remains unchanged, and the laser maintains its current state.

[0049] S343, if the instantaneous gear position is inconsistent with the current gear position, it is determined whether the candidate gear position remains unchanged within a preset sampling period. The preset sampling period is the number of stabilization cycles N. In this embodiment, N=5, meaning the candidate gear position must remain unchanged for N consecutive sampling periods before being officially confirmed. For example, a stabilization counter and a candidate gear position variable are constructed. In each subsequent sampling period, S310-S330 are re-executed to obtain a new instantaneous gear position: if the new instantaneous gear position is still the 4th gear, the counter count is increased. When temperature fluctuations cause the instantaneous gear position to jump back to the 3rd gear or another gear, if the new instantaneous gear position is not 4, the other gear is updated to the new instantaneous gear position, the counter is reset to 1, and the timing restarts. If the counter value is 5 at the end of the 5th period, the preset number of stabilization cycles N = 5 has been reached. In one embodiment, the stable cavity temperature in the 5th period is 36.1℃, which is still higher than the 4th gear entry threshold of 36.0℃, therefore the instantaneous gear position continues to be the 4th gear, and the candidate gear position remains unchanged continuously.

[0050] S344, if yes, then set the candidate level to the current compensation level and update the flag set. The stabilization counter reaches N=5, confirm the switch. Clear the 3rd level flag in the flag set, i.e., flag[3]=0. Set the 4th level flag in the flag set, i.e., flag[4]=1. And update the current level variable current_level=4. Write the updated flag set to the EEPROM address for storage, clear the counter, and remove the candidate level. The current compensation level is officially updated to the 4th level, and the subsequent extraction of the compensation bias and calculation of the target setting value will be based on the 4th level.

[0051] In some embodiments, step S400 involves extracting the corresponding compensation offset from the segmented compensation table based on the current compensation level, and calculating the target setting value based on the compensation offset and a preset benchmark setting value. Specifically, this includes: S410: Based on the current compensation level, extract the corresponding original bias value from the segmented compensation table. The original bias value is an unsigned 8-bit integer (0-255) stored in the EEPROM, with 127 as the zero point, encoding the compensation bias direction and magnitude. The advantage of this encoding method is that only one byte is needed to represent both positive and negative biases, and it is compatible with the unsigned storage characteristics of the EEPROM. Since the current compensation level is level 4, the original bias value = 132 is read from the 4th record of the segmented compensation table in the EEPROM. This value is stored in the EEPROM as an unsigned integer, occupying 1 byte.

[0052] S420: The compensation bias is obtained by subtracting a preset constant from the original bias. For example, the preset constant is 127, which is the zero point of the bias encoding. Subtracting 127 from the original bias yields a signed compensation bias. A positive result indicates that the TEC target needs to be increased on the high-temperature side, a negative result indicates that the TEC target needs to be decreased on the low-temperature side, and a result of zero indicates that no compensation is needed. For example, the original bias for the 0th level (normal temperature) is 127, and subtracting 127 results in 0, meaning no compensation bias is needed at normal temperature. The original bias for the 3rd level (low temperature) is 107, and subtracting 127 results in -20, meaning a decrease of 2.0℃. This indicates that at low temperatures, the TEC heating capacity is rapidly reduced by the environment, and the target temperature needs to be lowered to avoid full TEC load.

[0053] S430 retrieves the factory reference temperature and multiplies it by a preset fixed-point proportional coefficient to obtain the reference setpoint. The factory reference temperature is the optimal operating temperature of the controlled component, determined by an optical power meter and temperature scanning experiment under a 25°C calibration environment, and is written to the EEPROM by the factory calibration program. The fixed-point proportional coefficient of 10 is a conversion factor that converts the floating-point temperature value to a fixed-point integer representation within the PID controller to avoid floating-point division on the MCU, thus improving computational efficiency. For example, the factory reference temperature of a BBO crystal is 35.0°C. With a fixed-point proportional coefficient of 10, the reference setpoint = 35.0 × 10 = 350, which serves as the internal fixed-point unit.

[0054] S440 adds the reference setpoint to the compensation bias to obtain the target setpoint. The target setpoint is the fixed-point value of the TEC temperature control target after compensation correction. Target setpoint = reference setpoint + compensation bias, i.e., 350 + 5 = 355. Converted to actual temperature, 355 ÷ 10 = 35.5℃. That is, under the condition that the current cavity temperature is about 36.0℃, the TEC temperature control target of the BBO crystal should be 35.5℃, which is 0.5℃ higher than the 35.0℃ calibrated at room temperature, to compensate for the extra heat conducted to the crystal by the heat dissipation structure under high temperature environment and the decrease in TEC cooling efficiency.

[0055] In some embodiments, step S500 involves output buffering the target setpoint to obtain the actual setpoint, specifically including: S510: Extract the current setpoint from the cavity temperature information. The current setpoint is the actual setpoint issued in the previous control cycle. During the speed-limited ramp-up process, it is necessary to approach the target setpoint from the current setpoint; that is, the target setpoint of 355 cannot be directly used as the actual setpoint, but speed-limited ramp-up is required. For example, read the actual setpoint issued in the previous cycle. Assume that the previous cycle was just powered on, and this value was initialized to the factory baseline setpoint of 350, that is, the current actual setpoint issued is 350.

[0056] S520, calculate the difference between the target setpoint and the current setpoint. For example, the difference = target setpoint - current actual setpoint = 355 - 350 = 5. Since the difference is positive, it indicates that the target temperature is higher than the current setpoint, and the TEC target needs to be gradually increased so that the actual setpoint approaches the target setpoint in a speed-limiting manner.

[0057] S530: Compare the difference with a preset speed limit step, and when the absolute value of the difference is less than or equal to the speed limit step, take the target set value as the actual set value. The speed limit step ΔS is the maximum variation range of the actual issued set value allowed in each control cycle, which is preset as ΔS=2, corresponding to 0.2°C / cycle. The selection of this value should take response speed and smoothness into consideration: an excessively large ΔS results in a weak speed limit effect, while an excessively small ΔS leads to an overly long time to reach the target. For example, if the target set value in a certain cycle is 352 and the current actual issued set value is 351, the difference is 1, and |1|≤2. Then the actual set value of this cycle is directly set to the target set value 352, as the difference is small enough to be adjusted in one step without causing a TEC shock.

[0058] S540: When the absolute value of the difference is greater than the speed limit step, add the current set value to the speed limit step along the direction of the difference to obtain the actual set value. That is, actual set value = current actual issued set value + clamp(target set value - current actual issued set value, -ΔS, +ΔS). The clamp(value, min, max) function means limiting the value within the range [min, max]: if value>max, it returns max; if value<min, it returns min; otherwise, it returns value itself. In one embodiment, the difference = 355-350=5, with a positive direction, requiring an upward adjustment. clamp(5,-2,+2)=2, as 5>2 and is limited to 2. The actual set value in this cycle = 350+2=352, corresponding to 35.2°C. The speed-limited climbing process in subsequent cycles: in the second cycle, the difference = 355-352=3, clamp(3,-2,+2)=2, and the actual set value = 352+2=354. In the third cycle, the difference = 355-354=1, clamp(1,-2,+2)=1. Since 1≤2, no amplitude limiting is needed, and the actual set value = 354+1=355. In the fourth cycle, the difference = 355-355=0, the actual set value is 355, the target has been reached, and it remains unchanged thereafter. Thus, it takes 3 control cycles in total.

[0059] Therefore, the speed-limited climbing is completed smoothly within 3 cycles, avoiding the saturation overshoot caused by the TEC instantly jumping from low-power cooling to high-power cooling. In this way, the variation of the set value in each step does not exceed the speed limit step ΔS=2, ensuring that the set point of the TEC temperature control PID changes smoothly, and preventing the TEC from instantly entering a saturated state due to abrupt changes in the set value.

[0060] Furthermore, in some embodiments, during the aforementioned speed-limited ramp-up process, the TEC output saturation flag is checked simultaneously in each cycle, i.e., the output state in the TEC temperature control loop is reacquired. During the speed-limited ramp-up process, the system continuously monitors whether the output of the TEC temperature control PID is in a saturated state. If the saturated state continues for M consecutive cycles, it is determined that the temperature control capability limit of the TEC under the current environment has been approached, and the actual setpoint is frozen to continue changing in the direction that exacerbates TEC saturation, so that the PID closed loop converges near the setpoint achievable by the current capability; once the TEC exits saturation, the freeze is lifted and normal speed-limited ramp-up resumes.

[0061] This application also provides a temperature control system for a laser, used to implement the temperature control method for a laser as described in the above embodiments, comprising: The acquisition module 100 is used to acquire cavity temperature information; The preprocessing module 200 is used to preprocess the cavity temperature data in the cavity temperature information to obtain stable cavity temperature information. The judgment module 300 is used to determine the current compensation level based on the stable cavity temperature information and the preset segmented compensation table. The calculation module 400 is used to extract the corresponding compensation offset from the segmented compensation table based on the current compensation level, and calculate the target setting value based on the compensation offset and the preset benchmark setting value. The buffer module 500 is used to perform output buffering processing on the target setpoint to obtain the actual setpoint. The generation module 600 is used to generate temperature control commands based on actual set values, so as to drive the TEC to control the temperature of the controlled component.

[0062] This application also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, storing instructions that, when executed on a computer, cause the computer to perform the steps of a laser temperature control method.

[0063] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system, device, or unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0064] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0065] The preferred embodiments of the present invention have been described in detail above, but the present disclosure is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention, and these equivalent modifications or substitutions are all included within the scope defined by the claims of the present disclosure.

Claims

1. A method for temperature control of a laser, characterized in that: include: Obtain cavity temperature information; Preprocess the cavity temperature data in the cavity temperature information to obtain stable cavity temperature information; The current compensation level is determined by analyzing the stable cavity temperature information and the preset segmented compensation table. Based on the current compensation level, extract the corresponding compensation offset from the segmented compensation table, and calculate the target setting value based on the compensation offset and the preset benchmark setting value. The target setpoint is buffered to obtain the actual setpoint. Temperature control commands are generated based on the actual set values ​​to drive the TEC to control the temperature of the controlled components.

2. The temperature control method for a laser according to claim 1, characterized in that: The acquisition of cavity temperature information specifically includes: Collect raw cavity temperature data to obtain cavity temperature data; Obtain historical gear position flags to obtain a set of flag positions; Obtain the feedback temperature of the controlled component in the TEC temperature control loop to obtain the real-time feedback temperature; Obtain the output status in the TEC temperature control circuit to obtain output status information; Get the current setpoint for the current control cycle; The cavity temperature data, flag set, real-time feedback temperature, current set value and output status information are integrated to obtain the cavity temperature information.

3. The temperature control method for a laser according to claim 1, characterized in that: The preprocessing of the cavity temperature data in the cavity temperature information to obtain stable cavity temperature information specifically includes: Noise reduction processing is performed on the cavity temperature data in the cavity temperature information; The noise-reduced cavity temperature data is stored in a sliding buffer window of preset length according to the acquisition order to obtain the buffer window data. The extreme values ​​of the sliding buffer window data are removed, and the average value is calculated after removal to obtain the extreme value-removed average temperature. The extreme value average temperature is filtered to obtain stable cavity temperature information.

4. The temperature control method for a laser according to claim 1, characterized in that: The step of determining the compensation level based on stable cavity temperature information and a preset segmented compensation table to obtain the current compensation level specifically includes: Extract the entry and exit threshold values ​​for each gear from the preset segmented compensation table; Extract the set of flag bits from the cavity temperature information, and determine the current gear from the set of flag bits; The stable chamber temperature information is compared with the entry and exit threshold values ​​corresponding to each gear, and the instantaneous gear is determined based on the comparison results. The instantaneous gear position is compared with the current gear position, and the current compensation gear position is determined based on the comparison result.

5. The temperature control method for a laser according to claim 4, characterized in that: The step of comparing the stable cavity temperature information with the entry and exit thresholds corresponding to each gear position, and determining the instantaneous gear position based on the comparison result, specifically includes: Compare the stable chamber temperature information with the current gear and the corresponding exit threshold; If the current gear is a high temperature gear and the stable cavity temperature information is lower than the exit threshold value corresponding to the current gear, or if the current gear is a low temperature gear and the stable cavity temperature information is higher than the exit threshold value corresponding to the current gear, then the stable cavity temperature information is compared with the entry threshold value corresponding to each gear. If a high-temperature setting exists and the stable cavity temperature information is higher than the entry threshold for that setting, or if a low-temperature setting exists and the stable cavity temperature information is lower than the entry threshold for that setting, then the setting that meets the corresponding entry conditions will be determined as the instantaneous setting. If the current gear does not meet the corresponding exit conditions, then the current gear will be determined as an instantaneous gear.

6. The temperature control method for a laser according to claim 4, characterized in that: The step of comparing the instantaneous gear position with the current gear position and determining the current compensation gear position based on the comparison result includes: Compare the instantaneous gear position with the current gear position; If the instantaneous gear is the same as the current gear, then the current gear will be maintained as the current compensation gear; If the instantaneous gear position is inconsistent with the current gear position, then determine whether the candidate gear position remains unchanged within the preset sampling period; If so, set the candidate gear to the current compensation gear and update the flag set.

7. The temperature control method for a laser according to claim 1, characterized in that: The step of extracting the corresponding compensation offset from the segmented compensation table based on the current compensation level, and calculating the target setting value based on the compensation offset and the preset benchmark setting value, specifically includes: Based on the current compensation level, extract the corresponding original bias from the segmented compensation table; The compensation bias is obtained by subtracting the preset constant from the original bias. Obtain the factory reference temperature and multiply it by the preset fixed-point scaling factor to obtain the reference setting value. The reference setting value is added to the compensation bias value to obtain the target setting value.

8. The temperature control method for a laser according to claim 1, characterized in that: The step of output buffering the target setpoint to obtain the actual setpoint specifically includes: The current set value is extracted from the cavity temperature information; Calculate the difference between the target setpoint and the current setpoint; The difference is compared with the preset speed limit step size. When the absolute value of the difference is less than or equal to the speed limit step size, the target setting value is used as the actual setting value. When the absolute value of the difference is greater than the speed limit step size, the current set value is added to the speed limit step size along the direction of the difference to obtain the actual set value.

9. A temperature control system for a laser, used to implement the temperature control method for a laser as described in any one of claims 1-8, characterized in that: include: The acquisition module is used to acquire cavity temperature information; The preprocessing module is used to preprocess the cavity temperature data in the cavity temperature information to obtain stable cavity temperature information. The judgment module is used to determine the current compensation level based on the stable cavity temperature information and the preset segmented compensation table. The calculation module is used to extract the corresponding compensation offset from the segmented compensation table based on the current compensation level, and calculate the target setting value based on the compensation offset and the preset benchmark setting value. The buffer module is used to perform output buffering processing on the target setpoint to obtain the actual setpoint. The generation module is used to generate temperature control commands based on actual set values, which are then used to drive the TEC to control the temperature of the controlled components.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions that, when executed by a processor, implement the steps of the temperature control method for the laser as described in any one of claims 1-8.