A voltage adjustment method, device, and storage medium for an encoder.
By establishing voltage value tables and temperature monitoring, combined with coarse and fine adjustments, the problem of precise encoder adjustment during voltage fluctuations was solved, ensuring stable operation and performance maintenance of the encoder under complex working conditions.
Patent Information
- Application Number
- CN202411825973.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-12-12
AI Technical Summary
Existing encoders cannot adjust accurately when there are large voltage fluctuations, which can lead to malfunctions or even damage. In particular, in industrial environments, voltage surges or drops caused by power grid failures exceed the processing capacity of voltage regulation modules.
By establishing a voltage value table, obtaining the voltage AD value and comparing it with the threshold, and combining coarse and fine adjustments with temperature monitoring, precise voltage adjustment is achieved, ensuring the stable operation of the encoder under complex working conditions.
The encoder can run stably under complex working conditions, avoid abnormalities caused by voltage fluctuations, and ensure good maintenance of encoding performance.
Smart Images

Figure CN119668351B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of encoders, and in particular to a voltage adjustment method, device, and storage medium for an encoder. Background Art
[0002] Currently, there are two types of encoders. The first type is for applications requiring slightly higher voltage adaptability. These encoders may integrate a simple voltage adjustment module internally. For example, some high-precision industrial encoders incorporate a small linear regulator or similar voltage adjustment circuit to adapt to varying power supply voltage fluctuations within a certain range. The second type is encoders with simpler functions that often lack a dedicated voltage adjustment module. These encoders are typically simpler in design and rely primarily on an externally provided stable voltage source. They generally only convert the input physical quantity (such as rotation angle, linear displacement, etc.) into the corresponding coded signal output. Their voltage adaptability is relatively weak. For example, some common incremental encoders used for simple counting or measurement applications do not have built-in voltage adjustment functionality. Moreover, encoder voltage adjustment modules typically only allow effective adjustment within a relatively narrow voltage range. For example, it may only be able to process input voltages that fluctuate within 10%-20% of the rated voltage, stabilizing them to a relatively suitable value for use by the encoder's internal circuitry. Once the fluctuation of the external input voltage exceeds this preset range, such as encountering a large fluctuation in the mains voltage (e.g., a sudden rise or fall in voltage caused by a power grid fault in an industrial environment that exceeds the processing capacity of the adjustment module), the voltage adjustment module may be unable to adjust the voltage to a suitable level, thereby causing the encoder to malfunction or even face the risk of damage.
[0003] Therefore, there is an urgent need for a voltage adjustment method for encoders that can accurately and automatically adjust the voltage, based on existing technologies. Summary of the Invention
[0004] To address the aforementioned technical problems, this invention provides a voltage adjustment method, device, and storage medium for an encoder. The technical solution of this invention is implemented as follows:
[0005] A voltage adjustment method for an encoder includes the following steps:
[0006] S1, create a table of voltage values and store it in the encoder's internal address;
[0007] S2, obtain the voltage AD value through the encoder's feedback circuit and record it in the previously established table;
[0008] S3, compare the AD value with the voltage threshold, V0 - V1 = V i V i It is the difference;
[0009] S4, coarse adjustment, will be in V i For values greater than 2, perform a coarse adjustment, adjusting by ±2V each time, until V is reached. i The absolute value less than 2;
[0010] S5, fine-tuning, in V i For absolute values greater than 0.5 and less than 2, fine-tune the value, adjusting it by ±0.2V each time, until V... i Absolute values less than 0.5.
[0011] Preferably, step S1 further includes the following sub-steps:
[0012] S11, preset feedback time j;
[0013] S12, preset voltage threshold V0, where V0 is a range value, within the normal voltage range of the current encoder. c V c -V0 = ±1;
[0014] S13, preset temperature threshold K, as the normal operating temperature, preset temperature value K n As the over-temperature operating temperature value and the over-temperature operating time threshold j a .
[0015] Preferably, step S2 further includes the following sub-steps:
[0016] S21, obtain the current temperature value K1 through the encoder's temperature sensor;
[0017] S22, Obtain the current temperature value if it is greater than the preset temperature threshold K in step S13, or less than the preset temperature value K. n The system is judged to be in an overheating operating state.
[0018] S23, the duration of the over-temperature operating state is greater than the over-temperature operating time threshold j. a If the circuit is determined to be faulty, proceed to step S4.
[0019] Preferably, step S3 further includes the following sub-steps:
[0020] S31, obtain the voltage values for historical periods using the previously established table;
[0021] S32: When the voltage value exceeds the threshold more than 3 times during the historical period, the current voltage value is coarsely adjusted.
[0022] S33: When the voltage value exceeds the threshold less than 3 times during the historical period, fine-tune the current voltage value.
[0023] An encoder voltage adjustment device includes at least one processor, at least one memory, and computer program instructions stored in the memory, which implement the encoder voltage adjustment method described above when executed by the processor.
[0024] A storage medium storing computer program instructions, characterized in that: when the computer program instructions are executed by a processor, the voltage adjustment method of the encoder described above is implemented.
[0025] This invention solves the problem that current encoders can only adjust the voltage simply, and cannot adjust the voltage after the adjustment range is exceeded. Furthermore, this invention achieves a combination of coarse and fine adjustment by comparing AD values with thresholds, referring to historical voltage values, and analyzing the linear table after coarse adjustment. This allows for precise adaptation to the encoder's operating voltage, ensuring its stable operation. Considering temperature factors, it integrates temperature monitoring and related judgment logic, which can adjust the voltage in a timely manner according to temperature conditions, effectively responding to anomalies such as overheating, avoiding the impact of temperature on encoder performance, and ensuring that the encoder maintains good coding performance under complex operating conditions. Attached Figure Description
[0026] Figure 1 This is a schematic diagram of a voltage adjustment method for an encoder according to the present invention. Detailed Implementation
[0027] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, exemplary embodiments will be described in detail below, examples of which are illustrated in the accompanying drawings. In the following description relating to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of methods and systems consistent with some aspects of this application as detailed in the appended claims.
[0028] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0029] Example 1
[0030] like Figure 1 As shown, the present invention provides a voltage adjustment method for an encoder, comprising the following steps:
[0031] S1, create a table of voltage values and store it in the encoder's internal address;
[0032] Preferably, step S1 further includes the following sub-steps:
[0033] S11, preset feedback time j;
[0034] S12, preset voltage threshold V0, where V0 is a range value, within the normal voltage range of the current encoder. c V c -V0=±1; The preset voltage threshold V0 is a range value, and satisfies V c -V0 = ±1. Taking the previous example, if V c If the voltage is 5V ± 0.5V, then V0 can be set to 4V-6V. This voltage threshold V0 will serve as an important basis for subsequent judgments on whether the voltage deviates from the normal range and the adjustment range.
[0035] S13, preset temperature threshold K, as the normal operating temperature, preset temperature value K n As the over-temperature operating temperature value and the over-temperature operating time threshold j a .
[0036] This table uses a multi-column data structure, detailed as follows:
[0037] The "Timestamp" column precisely records the exact time of each voltage AD value acquisition, adjustment operation, or other related activity, with time precision set to the millisecond level. By recording detailed time information, the entire process of voltage changes can be clearly traced, facilitating subsequent in-depth analysis of voltage fluctuation patterns and evaluation of the effectiveness of adjustment strategies.
[0038] Voltage AD Value Column: This column stores the actual analog-to-digital conversion (AD) values of the voltage obtained through the encoder feedback circuit. This data is one of the core bases for subsequent voltage analysis, difference calculation, and determining adjustment requirements.
[0039] Low Voltage Threshold Column: Pre-set acceptable lower voltage thresholds for different operating conditions. These thresholds are determined based on factors such as the encoder's specific specifications, performance requirements, and past experience, providing crucial reference for judging whether the voltage is too low and determining the direction of adjustment.
[0040] High Voltage Threshold Column: Corresponding to the Low Voltage Threshold Column, this column sets the acceptable upper voltage threshold for different operating conditions. The data in this column, together with the lower threshold, defines the reasonable range of voltage values, ensuring the encoder operates stably within a suitable voltage range.
[0041] Difference V iFor the low threshold column: Based on the formula V0-V1=Vi (where V0 is the actual voltage value corresponding to the currently acquired voltage AD value, and V1 is the preset threshold standard value in the low voltage threshold column), the difference between the actual voltage value and the lower voltage threshold is calculated and stored. This difference allows for a direct assessment of whether the voltage is below a reasonable range and the degree of deviation. The difference V... i Similar to the high threshold column: the difference between the actual voltage value and the upper voltage threshold is calculated and stored according to the above formula, which is used to assess whether the voltage is higher than the reasonable range and the deviation.
[0042] The Adjustment Status column comprehensively records details of each voltage adjustment operation, including whether an adjustment was performed, the magnitude of the adjustment, the direction of the adjustment, whether the voltage was increased or decreased, and whether the voltage reached the expected range after the adjustment. This data is helpful for subsequent review of the voltage adjustment process, timely identification of potential problems, and optimization of adjustment strategies.
[0043] The "Cumulative Adjustment Count" column counts the total number of voltage adjustments since the encoder was started or last reset. Monitoring this data helps understand voltage stability. A frequent increase in the cumulative adjustment count may indicate potential voltage supply instability or changes in encoder performance, requiring further investigation.
[0044] During the encoder startup or initialization phase, a comprehensive initialization operation is performed on the aforementioned voltage value table. First, all columns of data in the table are thoroughly cleared to ensure that no invalid, outdated, or interfering data exists in the table initially. Then, a corresponding internal address is assigned to each row of data in the table. These addresses are tightly coupled with the encoder's internal data processing logic, enabling accurate and rapid location of the target data during subsequent data read / write operations. The address allocation process follows a specific order and rules, such as allocating consecutive address spaces sequentially according to time order to facilitate data management and retrieval. Simultaneously, the table's related index structure is initialized to ensure efficient data retrieval based on different column data conditions, such as quickly finding voltage data within a specific time period based on a timestamp. S2, the voltage AD value is obtained through the encoder's feedback circuit and recorded in the previously established table;
[0045] Preferably, step S2 further includes the following sub-steps:
[0046] S21, obtain the current temperature value K1 through the encoder's temperature sensor;
[0047] S22, Obtain the current temperature value if it is greater than the preset temperature threshold K in step S13, or less than the preset temperature value K. nIf the current temperature value K1 is greater than the preset temperature threshold K and less than the preset temperature value Kn, the encoder is determined to be in an over-temperature operating state. For example, if K1 is 60℃ and K is 50℃, Kn is determined to be in an over-temperature operating state. n If the temperature is 70℃, then the encoder is in an over-temperature operating state.
[0048] Calculation formula: K < K1 < K n If this inequality is satisfied, the system is in an over-temperature operating state.
[0049] S23, the duration of the over-temperature operating state is greater than the over-temperature operating time threshold j. a If the circuit is deemed faulty, proceed to step S4. After confirming the over-temperature operating state, start timing. If the duration of the over-temperature operating state exceeds the over-temperature operating time threshold ja, the circuit is deemed faulty, and the process proceeds directly to step S4 for coarse voltage adjustment. Assuming the over-temperature state has lasted for 15 minutes, exceeding ja... a = After 10 minutes, it is considered that there may be a problem with the working circuit, and it is necessary to try to improve the situation by adjusting the voltage;
[0050] Calculation formula: Duration of overheating > j a If this condition is met, the circuit is determined to be faulty.
[0051] The feedback circuit operates as a continuous, periodic activity. It samples the input voltage at pre-set time intervals (e.g., every 50 milliseconds) and sends the sampled analog voltage signal to an analog-to-digital converter (ADC) for conversion, thus obtaining the corresponding voltage AD value. During each sampling process, the feedback circuit also performs preprocessing operations on the input voltage signal, such as filtering, to remove potential high-frequency interference signals, ensuring that the acquired voltage AD value accurately reflects the actual input voltage. During normal encoder operation, the feedback circuit continuously acquires the input voltage AD value strictly according to the set time intervals. Each time a new AD value is acquired, a series of recording operations are immediately initiated. First, the current precise timestamp, accurate to the millisecond level, is obtained, which can be achieved through the encoder's internal clock module. Then, the newly acquired AD value, along with the current timestamp, is accurately recorded in the corresponding row and column position of the voltage value table according to a pre-set table structure and address allocation rules. For example, if the feedback circuit acquires an AD value of 32768 at a certain moment, and the timestamp at this time is 2024-11-11 15:45:30.250 (assuming the current time), then 32768 is recorded in the "Voltage AD Value" column, and 2024-11-11 15:45:30.250 is recorded in the "Timestamp" column, completing one complete voltage AD value acquisition and recording operation. Through this continuous acquisition and recording operation, the dynamic changes of the input voltage in the encoder can be tracked in real time and comprehensively, providing detailed and accurate data support for subsequent in-depth voltage analysis and precise adjustment operations.
[0052] S3, compare the AD value with the voltage threshold, V0 - V1 = V i V i It is the difference;
[0053] Preferably, step S3 further includes the following sub-steps:
[0054] S 31, obtain the voltage value of the historical period through the previously established table. Through the previously established voltage value table, the voltage value data within a certain historical period can be retrieved back. The time span of the historical period is 2 hours.
[0055] S32: When the voltage value exceeds the threshold more than 3 times during the historical period, the current voltage value is coarsely adjusted.
[0056] S33: When the voltage value exceeds the threshold less than 3 times during the historical period, fine-tune the current voltage value.
[0057] S4, coarse adjustment, will be in V i For values greater than 2, perform a coarse adjustment, adjusting by ±2V each time, until V is reached. i The absolute value less than 2;
[0058] Preferably, step S4 further includes the following sub-steps:
[0059] S41, using the previously established table, obtain a linear table of voltage values after at least three coarse adjustments;
[0060] S42, determine if the linear table is wavy, adjust it by ±4V each time, obtain the voltage values after at least 3 coarse adjustments using the previously established table, arrange these voltage values in chronological order to form a linear table, and select the adjusted voltage values after multiple coarse adjustments, namely V1, V2...V n Form a linear list [V1, V2, ... V n ];
[0061] S43, determine if the linear table is a broken-line descending shape, adjust it by ±1V each time, as described in S42, after multiple adjustments, select the adjusted voltage values, namely V1, V2...V n Form a linear list [V1, V2, ... V n ].
[0062] S5, fine-tuning, in V i For absolute values greater than 0.5 and less than 2, fine-tune the value, adjusting it by ±0.2V each time, until V... i Absolute values less than 0.5;
[0063] Preferably, step S5 further includes the following sub-steps:
[0064] S51. Using the previously established table, obtain a linear table of voltage values after at least three coarse adjustments. Arrange these voltage values in chronological order to form a linear table. After multiple coarse adjustments, select the voltage values after the three most recent adjustments, namely V1, V2, and V3, to form a linear table [V1, V2, V3].
[0065] S52 determines if the linear list is wavy and adjusts it by ±0.4V each time;
[0066] S53 determines if the linear list is a broken-line descending shape, and adjusts it by ±0.1V each time.
[0067] Preferably, the following steps are also included:
[0068] Based on the previously established table, the ratio Q between temperature and voltage values is obtained through historical records. Using the historical records, multiple sets of temperature and corresponding voltage data at different times are selected, totaling five sets: (K1, V1), (K2, V2), (K3, V3), (K4, V4), and (K5, V5). Then, using data analysis methods such as linear regression, the ratio Q between temperature and voltage values is calculated. Assuming a simple linear regression model is used, with temperature value x and voltage value y, the least squares method is used to fit the linear equation y = Qx + b, where b is the intercept. The calculation formula is as follows:
[0069] First, calculate the average values of x and y, as well as the covariance cov(x, y) and variance var(y). Then, the proportional relationship Q = cov(x, y) / var(y).
[0070] Based on the ratio Q between temperature and voltage values, and the current voltage value, the predicted temperature rise of the encoder within time j is determined. The current voltage value is denoted as V_current. Based on the ratio Q between temperature and voltage values, and the current voltage value, the predicted temperature rise of the encoder within feedback time j can be predicted. Assume the predicted temperature rise is ΔK. predicted Then, according to the linear relationship, we have: ΔK predicted = (V_current - V_previous) / Q, where V_previous is the voltage value obtained last time;
[0071] If the predicted temperature increase is less than the actual temperature increase, the required voltage value for the temperature decrease is obtained based on the ratio Q between the temperature and voltage values, and the process jumps to step S4; when the predicted temperature increase is ΔK... predicted Less than the actual temperature rise ΔK actual If the actual temperature rises faster than predicted, it indicates a possible anomaly in the voltage's influence on temperature. In this case, based on the ratio Q between temperature and voltage values, the required voltage value ΔK for the temperature to decrease is determined. target Let the temperature drop be V_target and the required voltage be V_current. Then V_target = V_current - ΔK target *Q. Then jump to step S4 to perform a coarse voltage adjustment operation, attempting to control the temperature rise by adjusting the voltage to ensure the encoder works normally.
[0072] An encoder voltage adjustment device includes at least one processor, at least one memory, and computer program instructions stored in the memory, which implement the encoder voltage adjustment method described above when executed by the processor.
[0073] A storage medium storing computer program instructions, characterized in that: when the computer program instructions are executed by a processor, the voltage adjustment method of the encoder described above is implemented.
[0074] Example 2
[0075] A voltage adjustment method for an encoder includes the following steps:
[0076] S1, Data Collection and Preprocessing, involves acquiring real-time data from the encoder, including the following steps:
[0077] S11, Collect voltage-related data: Collect voltage data from the encoder under various actual working scenarios, including input voltage values and voltage fluctuations at different time periods, such as peak values, valley values, and fluctuation frequencies. For example, in an industrial production environment, record the voltage information of the encoder at different stages such as equipment startup, stable operation, and load changes.
[0078] Temperature data acquisition: If the encoder has a temperature detection function, it will also collect temperature values during its operation, covering the normal operating temperature range and temperature data of possible high or low temperature abnormalities.
[0079] Collect encoding output data: Record the encoding output of the encoder under different voltage and temperature conditions, such as the accuracy, stability, and degree of deviation from the expected encoding result.
[0080] Collect manual adjustment records: When the encoder voltage is adjusted manually, record the details of each adjustment, including the voltage value before adjustment, the magnitude and direction of adjustment, the voltage value after adjustment, and the improvement of the encoder's encoding output after adjustment.
[0081] S12 Data Preprocessing and Cleaning: The collected data is carefully examined to remove outliers, errors, or data points that are clearly inconsistent with reality. For example, if a voltage value is found that far exceeds the encoder's normal operating voltage range and is obviously unreasonable, it will be discarded.
[0082] For voltage values, normalization can be achieved using a linear normalization method, mapping them to a specific range, such as [0, 1]. Assuming the encoder's normal operating voltage range is [Vmin, Vmax], the normalized voltage value V_normalized for any acquired voltage value V can be calculated using the formula: V_normalized = (V - Vmin) / (Vmax - Vmin).
[0083] For temperature values, a similar normalization method is used, normalizing the temperature value T within its normal operating temperature range [Tmin, Tmax] to T_normalized=(T-Tmin) / (Tmax-Tmin).
[0084] The encoded output data can also be normalized according to the specific situation so that the neural network can uniformly process input data of different magnitudes.
[0085] S13, Data Partitioning: Divide the preprocessed complete dataset into training, validation, and test sets according to a certain ratio. Typically, about 70% of the data is used as the training set to train the neural network model; 20% is used as the validation set to monitor the model's performance during training and prevent overfitting; and the remaining 10% is used as the test set to evaluate the model's final performance after training. For example, if 1000 sets of data are collected, 700 sets are used for training, 200 sets for validation, and 100 sets for testing.
[0086] S2, Building a neural network model in the encoder, includes the following steps:
[0087] S21, Input Layer: Based on the collected data characteristics, determine the number of nodes in the input layer and the corresponding input variables. For example, if voltage value, temperature value (if available), and the degree of deviation of the encoded output are considered as input features, the input layer can be set with three nodes, each corresponding to the normalized values of these three input variables.
[0088] S22, Hidden Layers: Employing a Multilayer Perceptron (MLP) architecture, multiple hidden layers are used to enhance the model's learning ability and its capacity to capture complex data relationships. Generally, it's advisable to start with 2-3 hidden layers, adjusting the specific number based on subsequent training results and data complexity. For the number of nodes in each hidden layer, begin with a relatively small number, such as 32 nodes for the first hidden layer and 64 nodes for the second. The choice of node count also needs to be optimized based on performance during training to find the configuration best suited to the data characteristics.
[0089] S23, Output Layer: The number and meaning of nodes in the output layer depend on the desired outcome. In this scheme, the output layer has one node whose output value corresponds to the magnitude of the encoder voltage adjustment (after normalization). For example, if the desired actual voltage adjustment magnitude is within the range of [-5V, 5V], then the normalized adjustment magnitude value output by the output layer needs to be converted into an applicable voltage adjustment value through subsequent inverse normalization processing.
[0090] S24, Define the activation function, hidden layer activation function: In the hidden layer, the ReLU (Rectified Linear Unit) activation function is widely used, its expression is: f(x) = max(0, x). The ReLU function has advantages such as simple computation, effective avoidance of the vanishing gradient problem, and faster neural network training. When the input value x is greater than 0, the output value is equal to x; when the input value x is less than or equal to 0, the output value is 0. This characteristic allows the neural network to converge to a better solution more quickly during training.
[0091] S25, Output Layer Activation Function. The appropriate activation function is selected based on the characteristics of the output layer's task. If the output voltage adjustment range has no specific range limitation, for example, it can take values within any real number range, then a linear activation function can be chosen, meaning the output value equals the input value. However, if the output voltage adjustment range needs to be limited to a specific interval, [-1, 1], corresponding to the actual voltage adjustment range, [-5V, 5V] after normalization, then the Sigmoid function can be chosen. The expression for the Sigmoid function is: f(x) = 1 / (1 + exp(-x)), which can convert any real number input into an output value between 0 and 1. When using the Sigmoid function, corresponding inverse normalization processing needs to be performed after obtaining the output value to obtain the actually applicable voltage adjustment range value.
[0092] S3. Train the model; use the mean squared error (MSE) as the loss function to measure the difference between the voltage adjustment value predicted by the neural network and the actual optimal voltage adjustment value. The formula for calculating the mean squared error is: MSE = 1 / n∑(y_pred - y_true)^2, where y_pred is the voltage adjustment value predicted by the neural network (after normalization), y_true is the actual optimal voltage adjustment value (also after normalization), and n is the number of samples. By minimizing the mean squared error, the prediction result of the neural network can be made as close as possible to the actual optimal value, thereby improving the accuracy of the model in voltage adjustment decisions.
[0093] Stochastic gradient descent (SGD) and its variants are commonly used neural network optimization algorithms. For example, one can first try using the original stochastic gradient descent algorithm, whose basic principle is to update the weights of the neural network according to the loss function, with the update formula as follows: Where w_t is the weight vector at the current time step, w_{t+1} is the weight vector at the next time step, and η is the learning rate. This is the gradient of the loss function under the current weight vector. The value of the learning rate η is crucial. Generally, it is recommended to start with a small value, such as 0.001, and then adjust it according to the convergence during training.
[0094] Besides the original stochastic gradient descent algorithm, its variants, such as Adagrad, Adadelta, and Adam, can be considered. These variants, based on the original stochastic gradient descent algorithm, adaptively adjust the learning rate, allowing them to better adapt to different data characteristics and training stages, accelerating training convergence and improving the final model performance. For example, the Adagrad algorithm automatically adjusts the learning rate based on the historical sum of squared gradients for each parameter, enabling different parameters to be updated with different learning rates during training, thus utilizing data information more effectively.
[0095] During training, appropriate training parameters such as the number of training epochs and batch size need to be set. The number of training epochs determines how many times the neural network iterates through the entire training set. Generally, it's advisable to initially set it between 100 and 500 epochs, and then adjust it based on performance on the validation set. The batch size determines how many samples are used to calculate gradients and update weights during each training iteration. Common batch sizes include 32, 64, and 128, and these should be optimized based on data characteristics and training results. During training, closely monitor the changes in the loss value on the validation set. When the loss value on the validation set stops decreasing significantly or begins to increase, it indicates potential overfitting. In such cases, it's necessary to adjust training parameters or take other measures (such as increasing the amount of data or adjusting the network architecture) to prevent overfitting.
[0096] S4, Applying the model obtained from steps S1-S3 to voltage regulation.
[0097] S41 Real-time Data Input: During actual encoder operation, the current voltage value, temperature value (if the encoder has a temperature detection function), and the degree of deviation in the encoded output are acquired in real time through corresponding sensors or data acquisition modules. Then, following the previous data preprocessing method, this real-time data is normalized to meet the requirements of the neural network input layer. For example, the real-time acquired voltage value is normalized using the formula (V-Vmin) / (Vmax-Vmin), the temperature value (if any) is normalized using a similar formula, and the degree of deviation in the encoded output is also normalized accordingly.
[0098] S42, Voltage Regulation Decision:
[0099] Normalized real-time data is input into a pre-trained neural network model. The neural network performs calculations and inferences based on the input data, outputting a normalized voltage adjustment amplitude value. If the output layer uses a linear activation function, this output value is the actual voltage adjustment amplitude value to be applied (only inverse normalization is needed to obtain the actual voltage adjustment value); if the output layer uses a Sigmoid function, the output value needs to be inverse normalized first, and converted into an actual applicable voltage adjustment amplitude value according to a pre-defined correspondence. For example, if the Sigmoid function output value is 0.6, the corresponding actual voltage adjustment amplitude value after inverse normalization might be 3V (assuming the corresponding actual voltage adjustment range is [-5V, 5V]).
[0100] Based on the actual voltage adjustment value obtained, the encoder voltage is adjusted accordingly. For example, if it is calculated that the voltage needs to be increased by 3V, then the voltage increase is achieved through appropriate voltage adjustment methods (such as adjusting the power supply output, changing the voltage divider circuit, etc.).
[0101] S43, Effect Monitoring and Model Optimization: After adjusting the encoder voltage, continuously monitor the encoder's encoding output, including encoding accuracy, stability, and deviation from the expected encoding result. If problems persist with the adjusted encoding output, such as no significant improvement in encoding accuracy or the appearance of new encoding jumps, it indicates that the voltage adjustment may not have achieved the expected results.
[0102] In this case, it is necessary to collect new data, including adjusted voltage values, temperature values, encoding output, and adjustment effects. This new data should be added to the original dataset, and the neural network model should be retrained and optimized to improve the accuracy and effectiveness of the model in voltage adjustment decisions, thereby better adapting to the voltage adjustment needs of the encoder under different operating conditions.
[0103] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A voltage adjustment method for an encoder, characterized in that, Includes the following steps: S1, create a table of voltage values and store it in the encoder's internal address; S2, obtain the voltage AD value through the encoder's feedback circuit and record it in the previously established table; S3, compare the AD value with the voltage threshold, V0 - V1 = V i V i It is the difference; S4, coarse adjustment, will be in V i For values greater than 2, perform a coarse adjustment, adjusting by ±2V each time, until V is reached. i The absolute value less than 2; S5, fine-tuning, in V i For absolute values greater than 0.5 and less than 2, fine-tune the value, adjusting it by ±0.2V each time, until V... i Absolute values less than 0.5; Step S1 further includes the following sub-steps: S11, preset feedback time j; S12, preset voltage threshold V0, where V0 is a range value, within the normal voltage range of the current encoder. c ,V c -V0=±1; S13, preset temperature threshold K, as the normal operating temperature, preset temperature value K n As the over-temperature operating temperature value and the over-temperature operating time threshold j a ; Step S2 further includes the following sub-steps: S21, obtain the current temperature value K1 through the encoder's temperature sensor; S22, Obtain the current temperature value if it is greater than the preset temperature threshold K in step S13, or less than the preset temperature value K. n The system is judged to be in an overheating state. S23, the duration of the over-temperature operating state is greater than the over-temperature operating time threshold j. a If the circuit is determined to be faulty, proceed to step S4. Step S3 further includes the following sub-steps: S31, obtain the voltage values for historical periods using the previously established table; S32: When the voltage value exceeds the threshold more than 3 times during the historical period, the current voltage value is coarsely adjusted. S33: When the voltage value exceeds the threshold less than 3 times during the historical period, fine-tune the current voltage value; Based on the previously established table, obtain the ratio Q between temperature and voltage values through historical records; Based on the ratio Q between temperature and voltage values, and the current voltage value, determine the predicted temperature rise of the encoder within time j. When the predicted temperature rise is less than the actual temperature rise, the voltage value required for the temperature drop is obtained based on the ratio Q between the temperature value and the voltage value, and coarse adjustment is performed in step S4.
2. A voltage adjustment device for an encoder, comprising at least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement the method of claim 1.
3. A storage medium storing computer program instructions thereon, characterized in that: The method described in claim 1 is implemented when computer program instructions are executed by a processor.
Citation Information
Patent Citations
Heat dissipation regulation and control method and device, communication equipment and storage medium
CN116419541A
Nozzle voltage output self-correction method and device and storage medium
CN117465135A