Knob screen device real-time control method and system based on serial communication

CN122470547BActive Publication Date: 2026-09-15ZHEJIANG MOFANG KUAICANG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610952897.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-30
Publication Date
2026-09-15
Estimated Expiration
2046-06-30

AI Technical Summary

Technical Problem

[0004]但是,通过上述方式在旋钮快速连续转动时,会在串口链路中形成超出预设通信带宽限额的高频增量指令,导致通信队列积压、主控解析延迟以及本地界面等待回传确认而产生显示滞后,存在交互响应延迟低于预设标准的问题;同时,主控设备在接收大量过时增量指令后,仍可能按顺序执行无效更新,存在难以准确反映操作人员最终调节意图、导致被控设备发生控制过冲或控制节奏失配的问题;并且,现有方式通常仅关注增量值传输,缺少对旋转速度、旋转加速度、目标预测值以及过渡节奏的协同处理,难以兼顾精细微调场景下的控制精度与高速调节场景下的通信效率,存在实时性与稳定性难以同时满足的问题

Benefits of technology

[0047]1. This invention calculates angular velocity and angular acceleration, and dynamically switches between incremental real-time transmission and intent prediction transmission strategies based on thresholds; this effectively blocks high-frequency command concurrency during rapid rotation, avoids serial communication queue backlog and local interface display lag, and significantly improves the smoothness of human-computer interaction;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122470547B_ABST
    Figure CN122470547B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of electronic control and serial communication, and particularly to a knob screen device real-time control method and system based on serial communication, comprising: obtaining pulse sequence data generated by a knob encoder, extracting pulse direction and pulse timestamp; calculating real-time angular velocity and real-time angular acceleration based on the pulse direction and the pulse timestamp; comparing the real-time values with preset threshold values respectively and generating comparison results; dynamically switching serial data sending and local interface rendering strategies according to the comparison results; executing an incremental real-time sending strategy at low speed, executing an intention prediction sending strategy at high speed or acceleration, sending a state package containing a target value, interrupting a process of waiting for a master control feedback confirmation, and calling a gradual motion animation function to smoothly render a local display screen interface to the target value; the present application can reduce serial congestion, improve interface response smoothness, and reduce control overshoot caused by outdated incremental instructions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electronic control and serial communication technology, specifically to a real-time control method and system for rotary screen devices based on serial communication. Background Technology

[0002] In the human-machine interaction link of industrial control equipment, knob devices with displays have gradually become a common interaction method in scenarios of setting process parameters such as temperature, pressure, and vacuum due to their ability to both input parameters and display them locally.

[0003] Currently, rotary screen devices and main control devices generally communicate via serial ports. During operation, the rotary encoder typically outputs pulse signals, and the rotary screen device generates incremental instructions according to the pulse direction and number, and sends them to the main control device frame by frame. The main control device then parses each instruction and updates the set value, while simultaneously sending the confirmation result back to the local display interface to achieve consistency between parameter adjustment and interface display.

[0004] However, when the knob is rotated rapidly and continuously using the above method, high-frequency incremental commands exceeding the preset communication bandwidth limit are generated in the serial port link. This leads to communication queue backlog, main control parsing delay, and display lag due to local interface waiting for confirmation. There is a problem that the interactive response delay is lower than the preset standard. At the same time, after receiving a large number of outdated incremental commands, the main control device may still execute invalid updates in sequence, which may make it difficult to accurately reflect the operator's final adjustment intention and cause the controlled device to experience control overshoot or control rhythm mismatch. Furthermore, the existing method usually only focuses on incremental value transmission and lacks the coordinated processing of rotation speed, rotation acceleration, target prediction value, and transition rhythm. It is difficult to balance the control accuracy in fine-tuning scenarios and the communication efficiency in high-speed adjustment scenarios, and there is a problem that real-time performance and stability cannot be satisfied at the same time. Summary of the Invention

[0005] The purpose of this invention is to provide a real-time control method and system for rotary screen devices based on serial communication, and to solve the following technical problems:

[0006] It avoids communication congestion and overshoot of controlled quantities caused by high-frequency concurrent commands, and makes it easier to maintain the smoothness of local display and reduce the step impact of controlled devices.

[0007] The objective of this invention can be achieved through the following technical solutions:

[0008] A real-time control method for a rotary screen device based on serial communication, wherein the rotary screen device has a local display screen and a rotary encoder, and is connected to a main control device via a serial port, the method includes the following steps: acquiring pulse sequence data generated by the rotary encoder of the rotary screen device, and extracting the pulse direction and pulse timestamp from the pulse sequence data;

[0009] Calculate the real-time angular velocity and real-time angular acceleration based on the pulse direction and the pulse timestamp; compare the real-time angular velocity and real-time angular acceleration with preset angular velocity thresholds and preset angular acceleration thresholds, respectively;

[0010] When the real-time angular velocity is less than or equal to the preset angular velocity threshold and the real-time angular acceleration is less than or equal to the preset angular acceleration threshold, the incremental real-time transmission strategy is executed, and incremental pulse commands are sent to the main control device through the serial port.

[0011] When the real-time angular velocity is greater than the preset angular velocity threshold, or the real-time angular acceleration is greater than the preset angular acceleration threshold, the intent prediction sending strategy and local interface rendering strategy are executed: the sending of incremental pulse commands is blocked, and the target value is predicted based on the real-time angular velocity, the real-time angular acceleration and the preset prediction time window, starting from the current pulse timestamp, and the target value is generated. A status packet containing the target value is generated and the status packet is sent to the main control device through the serial port.

[0012] Simultaneously, the current user interface state is interrupted from waiting for the serial port feedback confirmation signal, and a preset easing animation function is called to render the interface display state of the local display screen to the target value.

[0013] Preferably, the step of predicting the target value based on the real-time angular velocity, the real-time angular acceleration, and a preset prediction time window specifically includes:

[0014] Obtain the prediction algorithm model pre-configured in the rotary screen device;

[0015] The real-time angular velocity, the real-time angular acceleration, and the preset prediction time window are input into the prediction algorithm model;

[0016] The rotational kinematics curve is calculated using the prediction algorithm model, and the target value is output.

[0017] The prediction algorithm model is either a Kalman filter model or a quadratic function fitting model.

[0018] Preferably, the specific method for generating the state packet containing the target value includes:

[0019] Based on the real-time angular velocity and the target value, calculate the estimated time to reach the target value;

[0020] Calculate the rate of change of acceleration of the pulse sequence data within a historical preset time window starting from the current moment; based on the preset numerical range of the rate of change of acceleration, find the corresponding easing curve type in a preset mapping table that reflects the correspondence between the rate of change of acceleration and the easing curve;

[0021] The expected time, the easing curve type, and the target value are encapsulated together to form the state packet.

[0022] Preferably, the status packet is sent to the main control device via the serial port, so that the main control device can receive and parse the target value, the estimated time, and the easing curve type.

[0023] Based on the target value, the expected time, and the easing curve type, a smooth control curve is generated locally on the main control device.

[0024] The smooth control curve is used to generate continuous drive signals and output them to the controlled device connected to the master control device, so as to drive the controlled device to smoothly transition to the physical state corresponding to the target value.

[0025] Preferably, the steps for implementing the incremental real-time transmission strategy specifically include:

[0026] The increment value is determined based on the pulse direction;

[0027] The incremental value is encapsulated into an incremental pulse command;

[0028] According to the original time interval generated by the pulse sequence data, the incremental pulse command is sent to the main control device frame by frame through the serial port.

[0029] Preferably, the step of calculating the real-time angular velocity and real-time angular acceleration based on the pulse direction and the pulse timestamp specifically includes:

[0030] Calculate the time difference between two adjacent pulse timestamps;

[0031] Obtain the preset unit angular displacement corresponding to a single pulse of the rotary encoder;

[0032] By dividing the preset unit angular displacement by the time difference value in conjunction with the pulse direction, the real-time angular velocity is obtained;

[0033] Calculate the velocity difference between two adjacent real-time angular velocities;

[0034] The real-time angular acceleration is obtained by dividing the velocity difference by the corresponding time difference.

[0035] A real-time control system for a rotary screen device based on serial communication, wherein the rotary screen device has a local display screen and is connected to a main control device via a serial port, the system comprising:

[0036] The data acquisition module is used to acquire pulse sequence data generated by the rotary encoder of the rotary screen device, and extract the pulse direction and pulse timestamp from the pulse sequence data;

[0037] The feature calculation module is used to calculate the real-time angular velocity and real-time angular acceleration based on the pulse direction and the pulse timestamp;

[0038] The strategy judgment module is used to compare the real-time angular velocity and the real-time angular acceleration with preset angular velocity thresholds and preset angular acceleration thresholds, respectively.

[0039] The communication and rendering control module is used to execute an incremental real-time transmission strategy and send incremental pulse commands to the main control device through the serial port when the real-time angular velocity is less than or equal to the preset angular velocity threshold and the real-time angular acceleration is less than or equal to the preset angular acceleration threshold.

[0040] And, when the real-time angular velocity is greater than the preset angular velocity threshold, or the real-time angular acceleration is greater than the preset angular acceleration threshold, the intent prediction sending strategy and local interface rendering strategy are executed: the transmission of incremental pulse commands is blocked, the target value is predicted based on the real-time angular velocity, the real-time angular acceleration and the preset prediction time window, a status packet containing the target value is generated, and the status packet is sent to the main control device through the serial port;

[0041] Simultaneously, the current user interface state is interrupted from waiting for the serial port feedback confirmation signal, and a preset easing animation function is called to render the interface display state of the local display screen to the target value.

[0042] Preferably, the communication and rendering control module sends a status packet containing the target value to the main control device via the serial port.

[0043] This enables the main control device to receive the status packet and parse out the target value.

[0044] Based on the target value, a smooth control curve is generated locally on the main control device.

[0045] The smooth control curve is used to generate continuous drive signals and output them to the controlled device connected to the master control device.

[0046] The beneficial effects of this invention are:

[0047] 1. This invention calculates angular velocity and angular acceleration, and dynamically switches between incremental real-time transmission and intent prediction transmission strategies based on thresholds; this effectively blocks high-frequency command concurrency during rapid rotation, avoids serial communication queue backlog and local interface display lag, and significantly improves the smoothness of human-computer interaction;

[0048] 2. This invention introduces Kalman filtering or quadratic function fitting model to predict target values; this mechanism transforms pulse-by-pulse transmission into final intent transmission, effectively avoiding overshoot of controlled physical quantities caused by the main control device executing a large number of backlogged outdated incremental commands, and responding more accurately to the operator's true adjustment intent;

[0049] 3. The present invention adds the estimated time and easing curve type to the status packet, enabling the master control device to reconstruct the smooth control curve locally and output continuous drive signals accordingly; this mechanism ensures the smooth physical transition process of the controlled device, avoids the step impact caused by sudden changes, and keeps the execution rhythm of the master control device consistent with the interaction of the rotary screen device.

[0050] 4. In the low-speed fine-tuning stage, this invention sends incremental commands frame by frame strictly according to the original pulse time interval. This strategy fully preserves the step characteristics and time distribution of the operator during fine calibration, ensuring high-precision control under fine-tuning conditions and effectively making up for the shortcomings of the single prediction mode in small setting scenarios. Attached Figure Description

[0051] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings;

[0052] Figure 1 A flowchart illustrating the real-time control method for a rotary screen device based on serial communication provided in this application embodiment;

[0053] Figure 2 This is a schematic diagram of the module of the real-time control system for a rotary screen device based on serial communication in the embodiments of this application. Detailed Implementation

[0054] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0055] Please see Figure 1A real-time control method for a rotary screen device based on serial communication. The rotary screen device has a local display screen and a rotary encoder, and is connected to the main control device via a serial port. The method includes the following steps: acquiring pulse sequence data generated by the rotary encoder of the rotary screen device, and extracting the pulse direction and pulse timestamp from the pulse sequence data.

[0056] Real-time angular velocity and real-time angular acceleration are calculated based on pulse direction and pulse timestamp; the real-time angular velocity and real-time angular acceleration are compared with preset angular velocity thresholds and preset angular acceleration thresholds, respectively.

[0057] When the real-time angular velocity is less than or equal to the preset angular velocity threshold and the real-time angular acceleration is less than or equal to the preset angular acceleration threshold, the incremental real-time transmission strategy is executed, and incremental pulse commands are sent to the main control device through the serial port.

[0058] When the real-time angular velocity is greater than the preset angular velocity threshold, or the real-time angular acceleration is greater than the preset angular acceleration threshold, the intent prediction sending strategy and local interface rendering strategy are executed: the sending of incremental pulse commands is blocked, the target value is predicted based on the real-time angular velocity, real-time angular acceleration and preset prediction time window, starting from the current pulse timestamp, the target value is generated, a status packet containing the target value is generated, and the status packet is sent to the main control device through the serial port;

[0059] At the same time, the current user interface state is interrupted from waiting for the serial port feedback confirmation signal, and the preset easing animation function is called to render the interface display state of the local display screen to the target value.

[0060] This embodiment provides a real-time control mechanism for rotary screen devices based on serial communication. Specifically, this mechanism is applied to the human-machine control link of a biopharmaceutical freeze dryer. The rotary screen device is installed on the front door operation panel of the freeze dryer, and the main control device is installed in the electrical control cabinet. The two are connected through a universal asynchronous transceiver serial port.

[0061] The operator sets the target temperature of the shelf or the vacuum level of the cavity by rotating the knob with the display screen. The main control equipment then converts the set value into a heating plate power adjustment signal, a cooling valve opening signal, and a vacuum pump linkage control signal.

[0062] Because the freeze-drying process is sensitive to the rate of temperature rise and the amount of overshoot, the control link not only requires smooth interaction, but also requires that the controlled quantity not be overshooted due to the backlog of the serial port queue during rapid adjustment.

[0063] The rotary encoder continuously outputs a pulse sequence, each pulse carrying at least direction information and sampling time; the direction can be expressed as clockwise (positive) and counterclockwise (negative); the timestamp can be expressed as a millisecond counter value.

[0064] After receiving a pulse, the rotary screen device organizes adjacent pulses into event pairs. For example, if four pulses are collected within a certain period of time, with the directions being positive, positive, positive, and positive respectively, the corresponding timestamps are 100ms, 120ms, 135ms, and 145ms respectively. It can be seen that the interval between the first two pulses is 20ms, and the intervals after that are 15ms and 10ms. The shortening of the interval indicates that the rotation speed is increasing.

[0065] If the encoder is preset so that each pulse represents 1 unit of set step size, or corresponding For mechanical rotation, the rotary screen device can further calculate the current real-time angular velocity and real-time angular acceleration; this calculation can be performed either by updating the value with each new pulse or by using a sliding window method to avoid excessive amplification of the results by a single jitter pulse;

[0066] After completing the feature calculation, the rotary screen device compares the real-time angular velocity with the preset angular velocity threshold and the real-time angular acceleration with the preset angular acceleration threshold.

[0067] Thresholds can be pre-configured according to the scenario. For example, in the freeze dryer temperature setting scenario, the angular velocity threshold corresponds to more than 8 pulses per second, and the angular acceleration threshold corresponds to the shortening of the interval between three consecutive pulses being greater than the preset time difference threshold. If neither of the two results exceeds the threshold, it means that the operator is fine-tuning, and at this time, the incremental real-time sending strategy is adopted.

[0068] Specifically, for each pulse received, an incremental pulse command of +1 or -1 is generated according to the direction and sent to the main control device frame by frame via the serial port. The main control device updates the set value frame by frame and sends the new confirmation value back to the local display screen. This mode is suitable for fine calibration, such as fine-tuning the shelf temperature from -32℃ to -31℃.

[0069] If any comparison result exceeds the threshold, the intention prediction sending strategy is switched to the switch. The switching action includes at least two synchronization sub-actions: first, blocking the subsequent high-frequency incremental pulses from being sent frame by frame to avoid serial port queuing; second, predicting the operator's intention target value based on the recent pulse speed and acceleration trends.

[0070] The target value here is not the current position, but the possible stop setting point inferred based on the current rotation trend. For example, if the current local display value is -35℃ and the operator is rotating clockwise rapidly, based on the calculation of the last few pulses, it may continue to rise to -20℃ within the preset prediction time window of 300ms. In this case, the rotary screen device will not send the next dozen or so +1 instructions, but will encapsulate -20℃ as the target value into a status packet and send it to the main control device.

[0071] The status packet can also carry a mode identifier, packet number and check field, so that the master control device can correctly identify that the packet belongs to the predictive mode rather than the ordinary incremental mode;

[0072] At the same time, the local display screen no longer waits for frame-by-frame confirmation from the main control device; the rotary screen device first reads the current interface status, for example, if the current display shelf temperature setting is -35℃ and the status bar is at the 35% position, it directly interrupts the blocking process of waiting for confirmation and calls the preset easing animation function to smoothly transition the display value from -35℃ to the predicted target value of -20℃.

[0073] The easing process can use a transition curve that is fast at first and then slows down, so as to be consistent with the human perception of high-speed rotation; in this way, even if the physical bandwidth of the serial port is low, the local interface will still maintain continuous response and there will be no visual lag phenomenon where the interface continues to render even though the operation has stopped.

[0074] Regarding the anomaly handling mechanism, if the adjacent timestamps collected are the same, resulting in a time difference of zero, the current velocity calculation result is set to the previous valid value, and the pulse is only used for counting and does not participate in the acceleration update.

[0075] If the direction is detected to alternate between positive and negative within a preset time interval threshold, it indicates that there is mechanical vibration or that the user has slightly reversed the direction at the boundary position. At this time, the de-shaking state can be entered first, and a stable direction will be retained only once within a preset 20ms observation window.

[0076] If the recent speed decrease exceeds the preset proportional threshold and the absolute speed is lower than the preset low speed threshold, the rotary screen device can recalculate the target value and send a correction status packet; if the serial port is temporarily busy and cannot be sent immediately, the old predicted status packet is discarded first, and only the status packet corresponding to the latest target value is retained to avoid the main control device from executing the expired intent.

[0077] If the local display animation has not ended but a new target value has been generated, the current animation frame position will be used as the new starting point to continue the next easing transition.

[0078] Before the sublimation process of a certain batch of freeze-dried formulations begins, the operator needs to quickly raise the shelf temperature from -40℃ to -10℃. If the pulse-by-pulse feeding scheme is adopted, the rapid rotation of the knob will generate a number of +1 instructions that exceed the single-time parsing queue length of the main control equipment. The main control equipment needs to parse and update the instructions one by one, and the vacuum pump linkage strategy will also be frequently recalculated, causing the system control delay to exceed the preset time threshold.

[0079] In this embodiment, the rotary screen first identifies the high-speed upward adjustment action locally and predicts the target value as -12℃. When the operator is about to stop rotating the screen, it is corrected to -10℃ according to the deceleration trend, and a new status packet is sent to the main control device.

[0080] The local display screen scrolls continuously from -40℃ to -10℃, while the main control device organizes subsequent control actions according to the target value; the operator sees a continuous response, while the main control device receives low-density, high-information control intentions.

[0081] The purpose of this step is to dynamically switch between pulse-by-pulse transmission and final intent transmission under the condition of limited serial port bandwidth, thereby reducing communication congestion caused by high-frequency command concurrency, maintaining local display smoothness, and reducing the probability of invalid execution of outdated incremental commands by the main control device.

[0082] In a preferred embodiment of the present invention, the step of predicting the target value based on real-time angular velocity, real-time angular acceleration, and a preset prediction time window specifically includes: obtaining a prediction algorithm model pre-configured in the rotary screen device; inputting the real-time angular velocity, real-time angular acceleration, and preset prediction time window into the prediction algorithm model; calculating the rotational kinematics curve through the prediction algorithm model and outputting the target value; wherein, the prediction algorithm model is a Kalman filter model or a quadratic function fitting model.

[0083] This embodiment provides a target value prediction mechanism. Specifically, based on the aforementioned dynamic switching, relying solely on the method of directly extrapolating by a fixed multiple when the current speed exceeds the threshold can initially compress the amount of serial port data. However, when the freeze dryer operator approaches the target value and the negative rate of acceleration changes exceeds the preset threshold, or there is a short pause or the magnitude is less than the preset step size threshold for reverse correction, the positive or negative prediction deviation exceeds the preset tolerance range.

[0084] Therefore, this embodiment further introduces a prediction algorithm model to output a target value that is closer to the true intention based on recent rotational kinematic features;

[0085] The rotary screen device can be pre-set with two types of models: one is the Kalman filter model, and the other is the quadratic function fitting model; the two can be selected according to the device's computing power, sampling noise level, or application scenario.

[0086] Taking the Kalman filter model as an example, the current position and current angular velocity can be regarded as state variables, and the position corresponding to the newly acquired pulse can be regarded as an observation. Whenever a new pulse arrives, the next position is predicted based on the state at the previous moment, and then the prediction result is corrected by combining the observation value, so as to obtain a smoother state estimate.

[0087] Furthermore, the specific computational chain of the Kalman filter model includes two steps: state prediction and observation update. In the prediction stage, based on the position and real-time angular velocity of the previous moment and combined with the laws of rotational kinematics, the prior state vector and the corresponding error covariance of the current moment are estimated.

[0088] During the update phase, the newly acquired pulse position is introduced as the observation input, and the Kalman gain is calculated in combination with the observation noise parameters. The Kalman gain is then used to weight and correct the prior state vector to obtain the optimal posterior state estimate at the current time.

[0089] The optimal posterior state estimate is recursively pushed forward along a preset prediction time window; if the current estimated position is 20 steps, the angular velocity estimate increases by 4 steps every 100ms, and the prediction time window is set to 300ms, then the uncorrected target value can be initially estimated as follows: Each step length;

[0090] If new observations show that the user has begun to decelerate, the target value may be adjusted to 29 steps after filtering correction; this results in a dynamically converged target value, rather than a single coarse extrapolation value.

[0091] Taking the quadratic function fitting model as another example, the cumulative displacement data corresponding to the most recent three or five pulses can be selected for curve fitting.

[0092] Assuming the three most recent sampling points correspond to displacement 0 at time 0ms, displacement 3 at time 50ms, and displacement 7 at time 100ms, an approximate accelerating upward curve can be fitted.

[0093] Then, extrapolating the prediction time window to 200ms, the predicted displacement is approximately 13. If the current position reference value is -35℃, and each step corresponds to 1℃, then the target value can be tentatively set as -22℃.

[0094] If the next two pulses indicate that the curve changes from acceleration to deceleration, the extrapolated result after refitting may become -24℃; the quadratic function fitting model is suitable for scenarios where the rotational motion has a clear acceleration-deceleration profile;

[0095] To facilitate the explanation of the input and output organization, a simplified quantization derivation process can be adopted; let the real-time angular velocity extracted within the recent window be... The real-time angular acceleration is 6. The value is 2, and the prediction time window T is 3 sampling periods;

[0096] If a quadratic function fitting model is chosen, a line can be formed. The approximate kinematic curve, where To predict displacement, Current position For real-time angular velocity, For real-time angular acceleration, The independent variable is used to represent time;

[0097] Predict the time window Substitute the value of the independent variable ,when The predicted increment is obtained at that time. If the current position corresponds to a set value of 40, then the target value is 67;

[0098] If the upper limit of the rotary screen device is set to 60, the output value is clipped to 60; if the Kalman filter model is selected, the predicted value of 65 is given first, and then it is corrected to 62 based on the latest actual pulse, and finally clipped to 60 as well.

[0099] Therefore, the role of the model lies not in the formula itself, but in forming an executable link of input features—intermediate curve—target output;

[0100] Regarding the anomaly handling mechanism, if the number of effective pulses in the recent window is insufficient, for example, only 1 or 2 pulses are detected, and the motion curve cannot be stably fitted, then the quadratic function fitting will not be used for the time being, and it will fall back to the first extrapolation based on the most recent effective velocity.

[0101] If the observation noise of the Kalman filter model suddenly increases, for example, if the encoder is jittered due to electromagnetic interference, the observation noise parameter can be temporarily increased to reduce the impact of a single abnormal pulse on the target value.

[0102] If two models run in parallel but the output difference exceeds the preset tolerance, for example, one predicts 50 and the other predicts 63, a conservative mechanism can be triggered to prioritize the target value with a smaller amplitude and closer to the current deceleration trend, or extend the sampling window before outputting the state packet.

[0103] If the calculated target value exceeds the upper or lower limit of the process allowable range, such as the allowable temperature range of the freeze-drying shelf being -60℃ to +40℃, then the value is directly truncated to the boundary value and written into the out-of-bounds flag bit.

[0104] During the pre-freezing stage of the same freeze dryer, the operator wanted to quickly lower the shelf temperature from -20℃ to -45℃; the knob showed a clear accelerating downward trend in the first 150ms, and the knob screen device used a Kalman filter model to predict the target value as -47℃; then it captured a deceleration pulse, and after correction, output -45℃.

[0105] If, in another batch, the operator habitually rotates beyond the preset step size threshold in a single rotation and continuously rotates to the target position, and the rotation curve is closer to a regular parabola, then the rotary screen device can switch to a quadratic function fitting model to obtain more stable prediction results; both models can be used under the same control architecture without changing the main process of rotary screen device sampling and main control device status packet transmission.

[0106] The purpose of this step is to replace simple multiple estimation with an executable kinematic model, thereby improving the accuracy of target value prediction and ensuring that the compressed status packet from the serial port can still accurately express the operator's true adjustment intention.

[0107] In a preferred embodiment of the present invention, the specific method for generating a state packet containing a target value includes: calculating the estimated time to reach the target value based on the real-time angular velocity and the target value; calculating the rate of change of acceleration of the pulse sequence data within a historical preset time window starting from the current moment; searching for the corresponding easing curve type in a preset mapping table reflecting the correspondence between the rate of change of acceleration and the easing curve according to the preset numerical range in which the rate of change of acceleration is located; and encapsulating the estimated time and the easing curve type together with the target value to form a state packet.

[0108] This embodiment provides a state packet generation mechanism; specifically, only the target value is sent to the master control device. Although this can reduce a large number of incremental instructions, there are still technical limitations: the master control device can only receive the final target value information, but lacks the rate of reaching the target value and the transition trajectory parameters.

[0109] In controlled objects such as freeze dryers, the same target value but different transition rhythms will result in significantly different temperature rise shocks, vacuum fluctuations and process stability. Therefore, this embodiment further adds expected time and easing curve types to the state package, so that the main control equipment can reconstruct a control process that is closer to the human-machine operation intention.

[0110] After obtaining the target value, the equipment first calculates the estimated time to reach the target value; this time can be obtained based on the difference between the current position and the target value, the current real-time angular velocity, and necessary safety correction factors.

[0111] For example, the current position corresponds to a set value of -35℃, and the predicted target value is -20℃, with a difference of 15 steps. If the current real-time angular velocity is converted to a movement of 5 steps every 100ms, then the basic estimated time is approximately 300ms.

[0112] If the current angular acceleration is still positive, it means the user is still accelerating, and the estimated time can be shortened appropriately, for example, to 260ms; if it is detected that the user has entered the deceleration zone, it can be extended to 340ms to be closer to the final stopping time.

[0113] In addition to the expected time, this embodiment also calculates the rate of change of acceleration within a preset time window to characterize the urgency or convergence of the operation; for example, if the four most recent acceleration values ​​A1, A2, A3, and A4 are selected as 1, 2, 4, and 4 respectively, the rate of change will show a characteristic of first rising and then stabilizing.

[0114] The corresponding difference results are +1, +2, and 0. In order to map the difference results of the multiple dimensions generated above to the single numerical index required by the preset mapping table, the device side will use preset aggregation calculation rules, such as calculating the arithmetic mean, algebraic sum or extracting the last valid difference value of all difference results within the preset time window, and use it as the final acceleration change rate.

[0115] If the aggregation rule of algebraic sum is adopted, the algebraic sum of the differences of +1, +2, and 0 is +3, so the whole can be classified as a rapid increase type; for another example, if the other group is 4, 2, 1, and 0, the difference result is -2, -1, and -1, and its algebraic sum is -4, so it can be classified as a deceleration convergence type; the equipment side presets a mapping table to map the rate of change interval to several easing curve types;

[0116] For example, when the obtained rate of change of polymerization acceleration is greater than or equal to +1, it is mapped to a curve that is fast at first and then slow; when the rate of change is greater than -1 and less than +1, it is mapped to a linear curve; when the rate of change is less than or equal to -1, it is mapped to a slow start curve.

[0117] The mapping table can be directly embedded in the device program, or it can be issued by the master device and stored in non-volatile memory.

[0118] When encapsulating a status packet, it may include at least the target value field, the estimated time field, the curve type field, and the mode identifier field; for example, a frame of status packet can be expressed as: mode=P, target value=-20℃, estimated time=300ms, curve type=2;

[0119] The curve type = 2 can represent a fast curve followed by a slow curve as agreed upon by both parties. If robustness is required, a package sequence number, timestamp, cyclic redundancy check, and current interface context field can be added to help the main control device identify whether the target value is generated from the temperature page or the pressure page.

[0120] Regarding the fault tolerance mechanism, if the current real-time angular velocity is too low and the difference between the target value and the target value is greater than the preset deviation threshold, causing the estimated time to exceed the set upper limit of the effective transition time, it can be limited to the upper limit, for example, not exceeding 2 seconds, to prevent the main control device from generating a transition curve with an excessively long transition time.

[0121] If the rate of change of acceleration falls exactly on the boundary of two intervals, such as +1 or -1, a more conservative curve type is selected to reduce the risk of misjudgment; if the preset mapping table is missing a certain type of code, or the table lookup fails, the default is to fall back to a linear curve.

[0122] If different target values ​​are obtained by recalculating multiple times within the same prediction window, only one status packet is retained, and the estimated time is recalculated from the current time to prevent the main control device from executing according to the expired schedule.

[0123] If the status packet is too long and exceeds the single-frame serial port protocol limit, the target value and the expected time field will be retained first, and the curve type will be compressed into a short code or replaced with a default value.

[0124] During the freeze dryer's temperature preparation phase, the operator rapidly increased the temperature from -30℃ to near 0℃. The equipment detected that the recent rate of change of acceleration was consistently positive, indicating that its action had obvious high acceleration step characteristics. Therefore, a shorter estimated time and a fast-then-slow curve were given in the status package.

[0125] If, in another stage, the operator makes a low-acceleration negative fine-tuning of the vacuum setting, and the recent rate of change of acceleration is close to zero, the status packet sent will use a longer estimated time and a linear curve; in this way, although both operations ultimately only reach a certain target value, the master control device can execute different transition strategies based on the different packet contents.

[0126] The purpose of this step is to expand the single endpoint information into a combination of endpoint + arrival rhythm + transition mode information, thereby improving the main control equipment's ability to reproduce human-machine adjustment intentions and reducing control abrupt changes caused by execution strategy mismatch.

[0127] In a preferred embodiment of the present invention, a status packet is sent to the master control device via a serial port, so that the master control device receives and parses the target value, the expected time, and the type of the easing curve. Based on the target value, the expected time, and the type of the easing curve, a smooth control curve is generated locally on the master control device. The smooth control curve is used to generate continuous drive signals and output to the controlled device connected to the master control device to drive the controlled device to smoothly transition to the physical state corresponding to the target value.

[0128] This embodiment provides a main control curve reconstruction and execution mechanism; specifically, after adding the expected time and curve type to the aforementioned status packet, if the main control device still simply interprets it as an immediate jump to the target value, the information features compressed by the rotary screen device cannot be converted into a smooth control effect of the main control device, and may even cause a step change in shelf temperature in the freeze dryer.

[0129] Therefore, this embodiment further specifies that after receiving the status packet, the master control device locally generates a smooth control curve and outputs a continuous drive signal accordingly;

[0130] After receiving the status packet, the master control device first performs integrity verification and context parsing to confirm which page the packet came from and which controlled device it corresponds to; then it reads the target value, estimated time, and curve type; for example, the master control device parses the target value as -20℃, the estimated time as 300ms, and the curve type as fast at first and then slow.

[0131] The main control equipment establishes a discrete control sequence based on this; if its internal control cycle is 50ms, then 300ms can be divided into 6 control points; assuming the current set value is -35℃, a set of transition points can be generated, such as -30, -26, -23, -21, -20.5, -20;

[0132] This set of points is not determined solely by a fixed formula; it can also be generated by table lookup, interpolation, or a small trajectory planner. However, it must satisfy the following conditions: the starting point equals the current value, the ending point equals the target value, the total duration is close to the expected time, and the curve shape conforms to the package type.

[0133] After generating a smooth control curve, the main control device further converts each control point into a continuous drive signal. Taking shelf temperature control as an example, the main control device can send each intermediate set value into the existing temperature control loop, and the temperature control loop outputs the heater power percentage, cooling valve opening degree, or hot and cold switching command.

[0134] If the controlled equipment is a vacuum level, the intermediate control point can be converted into the opening and closing signal of the vacuum regulating valve or the start and stop coordination signal of the vacuum pump. Since the main control equipment executes a continuous transition of intermediate value sequence, rather than a target setpoint that undergoes a step change, the physical response of the controlled equipment is smoother.

[0135] To illustrate this process, a simplified deduction can be performed; assume the main control device has a control cycle of 100ms, a current value of 10, a target value of 20, an estimated time of 500ms, and a linear curve type; then the main control device generates 5 intermediate control points: 12, 14, 16, 18, and 20, and issues them sequentially in each cycle;

[0136] If the curve type is changed to fast then slow, it can be changed to 14, 17, 18.5, 19.5, 20; if it is changed to slow start, it can be changed to 11, 13, 16, 18.5, 20. It can be seen that for the same target value and total duration, due to different curve types and different actual control point sequences, the corresponding physical transition process of the equipment is also different.

[0137] Regarding the fault tolerance mechanism, if the status packet received by the main control device fails to be verified, the status packet will not be executed, but the previous stable setting will be maintained, and the rotary screen will be requested to resend it.

[0138] If the expected time field is zero or less than one control cycle, the main control device will generate a transition curve at least according to a preset minimum transition time threshold to avoid instantaneous step jumps. If the target value exceeds the equipment process boundary, such as the shelf temperature exceeding the allowable upper limit, the main control device will take priority based on the local safety boundary. Even if the knob screen device has not completed the trimming, it will not actually drive to the out-of-bounds value.

[0139] If an updated status packet is received during the smooth execution process, the master control device will use the currently executed control point as the new starting point to replan the subsequent curve, instead of executing the old curve first and then switching.

[0140] If there is a downstream execution delay between the master control device and the controlled device, the estimated time can be appropriately increased according to the empirical compensation coefficient to make the physical response more consistent with the local animation display.

[0141] During the secondary drying stage of the freeze dryer, the operator increases the shelf temperature from 10°C to 25°C to accelerate the removal of residual moisture; the rotary screen device status package gives a target value of 25°C, an estimated time of 800ms, and a curve type of soft start;

[0142] Based on this, the main control equipment generates a set curve with relatively small changes in the first part and gradually accelerating in the second part, and then assigns it to the temperature control loop for execution; this can avoid the heating plate suddenly outputting high power in the initial stage and reduce the local temperature difference of the sample.

[0143] If the operator corrects the target value to 22℃, the main control equipment will directly replan from the current curve execution position without waiting for the previous trajectory to end.

[0144] The purpose of this step is to transform the adjustment intention predicted by the rotary screen device into a continuous control trajectory that the main control device can execute, thereby reducing the step impact of the controlled device and keeping the main control execution process consistent with the rhythm of human-machine interaction.

[0145] In a preferred embodiment of the present invention, the steps of executing the incremental real-time transmission strategy specifically include: determining the incremental value according to the pulse direction; encapsulating the incremental value into an incremental pulse instruction; and transmitting the incremental pulse instruction frame by frame to the main control device via a serial port according to the original time interval generated by the pulse sequence data.

[0146] This embodiment provides an incremental real-time transmission mechanism; specifically, the aforementioned prediction mode is suitable for high-speed and large-scale adjustment, but if the prediction mode is used in all scenarios, the controllability during fine-tuning will be sacrificed.

[0147] For example, during the process development phase, freeze dryer operators often only need to fine-tune the shelf temperature from -32°C to -31°C. If the target value with a range greater than the preset range is directly predicted at this time, the setting accuracy will be reduced. Therefore, this embodiment retains and refines the incremental real-time transmission strategy for the fine-tuning stage at low speed and low acceleration.

[0148] After confirming that the current operation meets the low-speed condition, the equipment determines the incremental value according to the direction of each pulse; clockwise can be defined as +1, and counterclockwise can be defined as -1.

[0149] If the step size of some pages is not one engineering unit, for example, each pulse on the vacuum page corresponds to 0.5Pa, then the incremental value can be +0.5 or -0.5. Alternatively, it can be kept in integer pulse form first, and the main control device can convert it according to the page context. The device side encapsulates the incremental value into an incremental pulse instruction.

[0150] The instruction may include at least four parts: page identifier, incremental value, event time difference, and verification field; among which the event time difference is used to maintain the time distribution characteristics of the original operation and avoid the main control device receiving the correct total incremental amount but losing the time distribution information during the operation;

[0151] The key point in this embodiment is to send the data frame by frame according to the original time interval. For example, if the timestamps of three consecutive pulses are 100ms, 180ms, and 260ms, then the adjacent time intervals are all 80ms. The device does not send +3 all at once, but sends three +1 instructions frame by frame at 80ms intervals.

[0152] In this way, the update rhythm of the master control device to the set value is consistent with the operator's hand movements, and the local display and the controlled response are more easily synchronized;

[0153] If the other set of pulse timestamps is 100ms, 140ms, and 260ms, then the time intervals are 40ms and 120ms. The corresponding frame-by-frame transmission rhythm should also be maintained so that the first frame is sent after 40ms and the second frame is sent after waiting for 120ms. This preserves the operation characteristics of initial rapid rotation, short pause in the middle, and then small step-by-step fine adjustment.

[0154] To illustrate this more intuitively, a specific quantization calculation example can be constructed; the current setting value is 50; if the detected pulse sequence is positive, positive, and negative, with time differences of 30ms and 90ms respectively, the device generates three incremental instructions: frame 1 +1, frame 2 +1, and frame 3 -1;

[0155] After the master control device updates the settings in the order of reception, the set value changes in the sequence 51, 52, 51. Since the interval between the second and third frames is longer, the master control device will hold the value 52 for a longer time. This time structure can more realistically reflect the operator's intention to call back after a brief pause.

[0156] Regarding the exception handling mechanism, if a pulse fails to be sent at the original interval due to the serial port being busy, the device can resend it within the range not exceeding the preset delay tolerance; if it exceeds the tolerance, it can be sent in the same batch as the next frame with the original time difference field attached, for the main control device to replay locally.

[0157] If consecutive directions alternate and the time difference is less than the preset anti-shake judgment threshold, for example, +1, -1, +1, and -1 all occur within 20ms, then the anti-shake judgment can be entered first to avoid sending all mechanical noise. If the master control device does not return confirmation, the device can cache a limited number of unconfirmed incremental frames locally.

[0158] When the cache reaches its limit, the most recent incremental information is retained first, or the prediction mode is upgraded and switched if necessary to avoid buffer accumulation. If the current page does not allow fine-grained adjustment, such as some recipe lock pages that only allow full-level switching, the device can map multiple small-step increments into a single level change before sending.

[0159] During the process validation phase of the freeze dryer, the operator observed a slight risk of sample edge collapse and decided to lower the shelf temperature from -28℃ to -30℃ and make a fine adjustment.

[0160] The rotary screen detects that the overall movement is slow and adopts an incremental real-time sending strategy to send small step instructions such as -1-1+1-1 in sequence, while strictly maintaining the time rhythm between each pulse.

[0161] The main control device updates the set value according to this rhythm, and the operator can see the subtle grid-by-grid changes on the local screen and feel the controllability of fine-tuning in the device response;

[0162] The purpose of this step is to preserve the original operating rhythm and step structure in fine-tuning scenarios, thereby improving the accuracy of fine-tuning and avoiding unnecessary amplification of small settings by the prediction mode.

[0163] In a preferred embodiment of the present invention, the step of calculating the real-time angular velocity and real-time angular acceleration based on the pulse direction and pulse timestamp specifically includes: calculating the time difference between two adjacent pulse timestamps;

[0164] Obtain the preset unit angular displacement corresponding to a single pulse of the rotary encoder; combine the pulse direction and divide the preset unit angular displacement by the time difference to obtain the real-time angular velocity; calculate the velocity difference between two adjacent real-time angular velocities; divide the velocity difference by the corresponding time difference to obtain the real-time angular acceleration.

[0165] This embodiment provides a calculation mechanism for angular velocity and angular acceleration. Specifically, the aforementioned strategy switching depends on velocity and acceleration characteristics. If these two characteristics exist only as fuzzy descriptions without specific calculation paths, it is difficult for the device to reliably determine when to enter the prediction mode. Therefore, this embodiment provides a calculation process suitable for direct implementation in embedded rotary screen devices.

[0166] The device first reads the timestamps of two adjacent pulses and calculates the time difference. If the timestamp of the previous pulse is 100ms and the timestamp of the next pulse is 120ms, then the time difference is calculated. It takes 20ms;

[0167] Next, read the unit angular displacement corresponding to a single encoder pulse; this value is determined by the encoder parameters. For example, if there are 20 pulses per revolution, the single pulse angular displacement can be taken as... If the system counts by logical subdivisions, it can also be at a smaller angle;

[0168] Based on the pulse direction, clockwise unit angular displacement can be considered positive and counterclockwise can be considered negative; therefore, real-time angular velocity can be calculated by dividing the unit angular displacement by the time difference.

[0169] As mentioned above and For example, if the direction is clockwise, then the real-time angular velocity is... If the direction is counterclockwise, then it is ;

[0170] After obtaining two consecutive real-time angular velocities, the device can further calculate the angular acceleration; assuming the angular velocity in the previous time period was... The angular velocity in the next time period is The corresponding time difference is still The speed difference is angular acceleration is ;

[0171] If the angular velocity in the next time interval becomes The speed difference is This indicates that the user is decelerating, and the angular acceleration is negative. The device can store the most recent angular velocities and angular accelerations in a small circular buffer for subsequent threshold judgment, prediction model input, and jitter identification.

[0172] To illustrate this more concretely, the following microscopic deduction can be made; let the timestamps of four consecutive pulses be... , , , The directions are all clockwise, and the single-pulse angular displacement is... ;

[0173] The three velocities are as follows: , , ;

[0174] The corresponding two acceleration segments are respectively ,as well as It is evident that the acceleration increases significantly in the latter part, indicating that the user is rapidly accelerating the rotation.

[0175] If the fifth pulse appears after the fourth pulse... Then the next speed segment becomes The corresponding acceleration is This indicates that the user has significantly slowed down; such numerical changes can directly drive policy switching.

[0176] Regarding fault tolerance mechanisms, if the time difference is less than the minimum resolution allowed by the system, for example, due to insufficient timer precision causing the time difference... If the value is close to zero, the speed segment can be truncated to the upper limit or merged into the next pulse segment for recalculation to prevent division by zero or abnormal amplification.

[0177] If the pulse direction reverses between two consecutive calculations, the velocity value will cross zero. In this case, the sign can be retained to accurately distinguish between the two different situations of deceleration to a stop and reverse rotation start.

[0178] Meanwhile, in order to avoid the huge speed difference generated at the moment of direction reversal, which would cause the angular acceleration calculation result to be abnormally large and accidentally trigger the threshold of the intended prediction and transmission strategy, the device side forcibly sets the real-time angular acceleration result to zero in the calculation when the direction reversal is detected, and resumes normal differential calculation after the next pulse arrives and the same-direction speed stabilizes.

[0179] If the unit angular displacement varies depending on the encoder model, the corresponding configuration can be read from the parameter table when the device starts up, avoiding hard-coded configuration in the program; if no new pulse arrives in a short period of time, the device can assume that the speed gradually decays to zero, and reset the acceleration to zero after the timeout threshold to prevent the old value from affecting the strategy judgment for a long time.

[0180] In the same freeze dryer, the temperature page uses a high-resolution encoder with a single pulse corresponding to a logic step of 0.5℃; the vacuum page uses finer logic conversion with a single pulse corresponding to 0.1Pa.

[0181] Although the equipment faces different pages, they all calculate according to the same path of time difference-displacement-velocity-acceleration; when the operator quickly rotates the knob, the temperature page can quickly identify the accelerating upward trend and enter the prediction mode; when the operator slowly adjusts the vacuum level, it continues to stay in the incremental real-time transmission mode.

[0182] The purpose of this step is to provide a clear and reproducible feature calculation basis for subsequent threshold comparison and target value prediction, thereby improving the judgment stability of the entire dynamic switching mechanism.

[0183] Please see Figure 2 A real-time control system for a rotary screen device based on serial communication. The rotary screen device has a local display screen and communicates with the main control device via a serial port. The system includes:

[0184] The data acquisition module is used to acquire pulse sequence data generated by the rotary encoder of the rotary screen device, and extract the pulse direction and pulse timestamp from the pulse sequence data;

[0185] The feature calculation module is used to calculate real-time angular velocity and real-time angular acceleration based on pulse direction and pulse timestamp;

[0186] The strategy judgment module is used to compare the real-time angular velocity and real-time angular acceleration with preset angular velocity thresholds and preset angular acceleration thresholds, respectively.

[0187] The communication and rendering control module is used to execute an incremental real-time transmission strategy when the real-time angular velocity is less than or equal to a preset angular velocity threshold and the real-time angular acceleration is less than or equal to a preset angular acceleration threshold. It sends incremental pulse commands to the main control device through the serial port.

[0188] In addition, when the real-time angular velocity is greater than the preset angular velocity threshold, or the real-time angular acceleration is greater than the preset angular acceleration threshold, the intention prediction sending strategy and the local interface rendering strategy are executed: the sending of incremental pulse commands is blocked, the target value is predicted based on the real-time angular velocity, the real-time angular acceleration and the preset prediction time window, a status packet containing the target value is generated, and the status packet is sent to the main control device through the serial port;

[0189] At the same time, the current user interface state is interrupted from waiting for the serial port feedback confirmation signal, and the preset easing animation function is called to render the interface display state of the local display screen to the target value.

[0190] This embodiment provides a real-time control system for a rotary screen device based on serial communication; specifically, in order to enable the aforementioned method to be implemented in actual devices, this embodiment divides the relevant processing procedures into several functional modules;

[0191] This module division can be achieved through independent hardware circuits, through multi-tasking programs on the same microcontroller, or through a collaborative deployment of the knob screen module and the main control module.

[0192] The data acquisition module is connected to the encoder interrupt port or the polling sampling port to acquire pulse sequences and extract direction and timestamps; the module may include a de-jitter unit to remove interference signals whose amplitude-frequency characteristics exceed a preset noise range from the original edge signal;

[0193] The feature calculation module is connected to the data acquisition module and is responsible for converting direction and timestamp into kinematic features such as velocity and acceleration, and storing the most recent features in the cache area.

[0194] The strategy judgment module reads the features, compares them with the preset threshold, and outputs the current mode flag. This mode flag can at least distinguish between incremental real-time transmission mode and intention prediction transmission mode, and can also be extended to jitter suppression mode and over-limit protection mode, etc.

[0195] The communication and rendering control module is the core of the rotary screen device; when the mode flag is low-speed fine adjustment, this module encapsulates and sends incremental pulse commands according to the original time rhythm.

[0196] When the mode flag is high-speed operation, the module stops subsequent pulse-by-pulse transmission, and the communication and rendering control module directly predicts the target value and generates a status packet containing the target value, and calls the preset easing animation function to execute the easing animation;

[0197] To prevent the local display from becoming disconnected from the main control status, this module can also maintain a set of interface display values ​​and a consistency benchmark value; the consistency benchmark value represents the setting value most recently confirmed by the main control device.

[0198] The value displayed on the interface represents the current frame value of the local animation; when the difference between the two exceeds the preset deviation threshold, for example, if the misalignment time exceeds the preset duration threshold due to communication abnormalities, the resynchronization logic is triggered.

[0199] Taking the micro-process of module collaboration as an example, the acquisition module obtains three pulse events E1, E2, and E3; the feature calculation module calculates the velocity sequences 0.5, 0.8, and 1.1, and the acceleration sequences 0.01 and 0.03.

[0200] The strategy judgment module outputs the prediction mode accordingly; the communication and rendering control module immediately stops the incremental sending queue, encapsulates the current position 40, the predicted target value 55, the estimated time 400ms, and the curve type 2 into a status packet P1, and starts the interface animation A1 at the same time.

[0201] If new pulse events E4 and E5 are received later, and the updated target value is 52, the communication and rendering control module discards the old packet P1 that has not yet been sent or overwrites it with the updated packet P2, and uses the current frame of animation A1 as the starting point of the new animation A2.

[0202] Regarding the fault tolerance mechanism, if the data acquisition module detects that the encoder has no pulse input for a long time, the system remains silent and does not trigger feature calculation repeatedly; if the feature calculation module outputs an abnormal value, such as an out-of-bounds speed abnormal value due to timer overflow, the policy judgment module does not directly accept it, but performs validity verification first.

[0203] If the communication and rendering control module fails to send a status packet in prediction mode, the local interface can continue to display short-range animations, but will prompt for resynchronization after a timeout and will be prohibited from deviating indefinitely from the main control confirmation state; if any module is reset, the system can retrieve the current official settings from the main control device as the display benchmark and calculation starting point after restarting.

[0204] During the overall commissioning of the freeze dryer, the engineers conducted rapid knob tests on the temperature setting page and the vacuum setting page respectively. The data acquisition module first captured high-frequency pulses, the feature calculation module identified obvious acceleration, the strategy judgment module then switched to prediction mode, and the communication and rendering control module sent status packets to the main controller while continuously scrolling the values ​​on the local screen.

[0205] Throughout the process, even though the main control device also has to handle tasks such as temperature control, vacuum interlock, and alarm recording at the same time, the interaction of the rotary screen device remains smooth.

[0206] The purpose of this step is to clarify the boundaries of each function and the interface for collaboration through a modular structure, thereby facilitating system implementation, debugging, and subsequent functional expansion.

[0207] In a preferred embodiment of the present invention, the communication and rendering control module sends a status packet containing the target value to the master control device via a serial port, so that the master control device receives the status packet and parses the target value, generates a smooth control curve locally on the master control device based on the target value, and uses the smooth control curve to generate continuous drive signals and output them to the controlled device connected to the master control device.

[0208] This embodiment provides a system-level master control execution coordination mechanism; specifically, in the aforementioned system architecture, if the rotary screen device only completes prediction and transmission, while the master control side still works in the traditional way of immediately changing a value upon receiving a value, then the entire system can only solve the communication congestion problem, and is not sufficient to completely solve the overshoot and impact problem of the controlled device;

[0209] Therefore, this embodiment further emphasizes the main control device's ability to parse state packets, generate curves, and continuously drive outputs, so that the rotary screen device and the main control device together form a closed-loop control link;

[0210] After entering prediction mode, the communication and rendering control module sends a status packet to the main control device via serial port; the receiving and parsing unit in the main control device reads the status packet and extracts at least the target value field.

[0211] Even if the expected time and curve type are not sent in some simplified implementations, the master control device can generate a default smooth control curve based on the difference between the target value and the current value, combined with local security rules.

[0212] For example, when the difference is lower than the preset deviation threshold, a short-time linear transition is used; when the difference is higher than or equal to the preset deviation threshold, a multi-stage gradual rise strategy is used. If the status packet contains more parameters, the master control device can reconstruct the trajectory in a higher fidelity manner.

[0213] Taking the freeze dryer as an example, the main control device stores the controlled equipment model and process safety constraints locally. When a new target temperature is received, the temperature control loop setpoint is not immediately changed to the endpoint in one step. Instead, the trajectory planner generates several intermediate setpoints and then sends them to the temperature control module cycle by cycle.

[0214] The temperature control module outputs continuous drive signals based on the intermediate setpoint, such as pulse width modulation heating duty cycle, cooling solenoid valve action ratio, or fan speed command; if the controlled equipment is under vacuum, it can output continuous valve position adjustment and pump speed control; thus forming a complete execution path from status packet parsing to continuous drive output.

[0215] A simplified simulation can be performed; the current official setting value of the main control device is 30, and after receiving the status packet, the target value is parsed as 45; the system is preset to smoothly advance in 5 control cycles if the difference is greater than 10, thus generating the intermediate sequence 33, 36, 39, 42, 45; if the control cycle is 200ms, the total transition time is about 1s;

[0216] In each cycle, the main control device sends the corresponding set value to the downstream execution loop and makes fine adjustments based on the actual sensor feedback; in this way, although the knob screen only sends a target value, the main control device can still output a continuously changing drive signal instead of a step control signal.

[0217] Regarding the fault tolerance mechanism, if the status packet received by the main control device fails to be verified, the status packet will not be executed, but the previous stable setting will be maintained, and the rotary screen will be requested to resend it.

[0218] If the expected time field is zero or less than one control cycle, the main control device will generate a transition curve for at least one minimum safe duration to avoid instantaneous step jumps. If the target value exceeds the equipment process boundary, such as the shelf temperature exceeding the allowable upper limit, the main control device will take priority based on the local safety boundary. Even if the rotary screen device has not completed the trimming, it will not actually drive to the out-of-bounds value.

[0219] If an updated status packet is received during the smooth execution process, the master control device will use the currently executed control point as the new starting point to replan the subsequent curve, instead of executing the old curve first and then switching.

[0220] If there is a downstream execution delay between the master control device and the controlled device, the estimated time can be appropriately increased according to the empirical compensation coefficient to make the physical response more consistent with the local animation display.

[0221] When switching freeze dryer recipes, the operator can quickly increase the shelf temperature target via the rotary screen; the rotary screen device recognizes the high-speed operation and only sends the target value information; after receiving it, the main control device generates a smooth setting trajectory that meets the requirements of equipment thermal inertia and sample protection locally, and continuously outputs it to the heating execution unit.

[0222] If the process interlock determines that the current heating rate is too fast, the main control equipment will automatically extend the transition time or limit the upper limit of the target value, and at the same time feed back the adjusted result to the rotary screen device for display; in this way, the system retains the real-time interaction of the rotary screen device, while also ensuring the safety of the physical execution of the main control equipment.

[0223] The purpose of this step is to combine the intention expression of the rotary screen device with the smooth execution capability of the main control side, thereby forming an integrated control system from operation input, serial port transmission to physical output.

[0224] The foregoing has provided a detailed description of one embodiment of the present invention, but this description is merely a preferred embodiment and should not be construed as limiting the scope of the invention. All equivalent variations and modifications made within the scope of the claims of this invention should still fall within the patent coverage of this invention.

Claims

1. A real-time control method for rotary screen devices based on serial communication, characterized in that, The rotary screen device has a local display screen and a rotary encoder, and is connected to the main control device via a serial port. The method includes the following steps: acquiring pulse sequence data generated by the rotary encoder of the rotary screen device, and extracting the pulse direction and pulse timestamp from the pulse sequence data. Calculate the real-time angular velocity and real-time angular acceleration based on the pulse direction and the pulse timestamp; compare the real-time angular velocity and real-time angular acceleration with preset angular velocity thresholds and preset angular acceleration thresholds, respectively; When the real-time angular velocity is less than or equal to the preset angular velocity threshold, and the real-time angular acceleration is less than or equal to the preset angular acceleration threshold, an incremental real-time transmission strategy is executed, and an incremental pulse command is sent to the master control device through the serial port; wherein, the steps of executing the incremental real-time transmission strategy specifically include: The increment value is determined based on the pulse direction; The incremental value is encapsulated into an incremental pulse command; According to the original time interval generated by the pulse sequence data, the incremental pulse command is sent to the main control device frame by frame through the serial port; When the real-time angular velocity is greater than the preset angular velocity threshold, or the real-time angular acceleration is greater than the preset angular acceleration threshold, the intent prediction sending strategy and local interface rendering strategy are executed: the transmission of incremental pulse commands is blocked; starting from the current pulse timestamp, a target value is predicted based on the real-time angular velocity, the real-time angular acceleration, and a preset prediction time window; a status packet containing the target value is generated; and the status packet is sent to the main control device via the serial port; wherein, the specific generation method of the status packet containing the target value includes: Based on the real-time angular velocity and the target value, calculate the estimated time to reach the target value; Calculate the rate of change of acceleration of the pulse sequence data within a historical preset time window starting from the current moment; based on the preset numerical range of the rate of change of acceleration, find the corresponding easing curve type in a preset mapping table that reflects the correspondence between the rate of change of acceleration and the easing curve; The expected time, the easing curve type, and the target value are encapsulated together to form the state packet; Simultaneously, the current user interface state is interrupted from waiting for the serial port feedback confirmation signal, and a preset easing animation function is called to render the interface display state of the local display screen to the target value.

2. The real-time control method for a rotary screen device based on serial communication according to claim 1, characterized in that, The steps for predicting the target value based on the real-time angular velocity, the real-time angular acceleration, and the preset prediction time window specifically include: Obtain the prediction algorithm model pre-configured in the rotary screen device; The real-time angular velocity, the real-time angular acceleration, and the preset prediction time window are input into the prediction algorithm model; The rotational kinematics curve is calculated using the prediction algorithm model, and the target value is output. The prediction algorithm model is either a Kalman filter model or a quadratic function fitting model.

3. The real-time control method for a rotary screen device based on serial communication according to claim 1, characterized in that, The status packet is sent to the main control device via the serial port, so that the main control device can receive and parse the target value, the estimated time, and the easing curve type. Based on the target value, the expected time, and the easing curve type, a smooth control curve is generated locally on the main control device. The smooth control curve is used to generate continuous drive signals and output them to the controlled device connected to the master control device, so as to drive the controlled device to smoothly transition to the physical state corresponding to the target value.

4. The real-time control method for a rotary screen device based on serial communication according to claim 1, characterized in that, The steps for calculating real-time angular velocity and real-time angular acceleration based on the pulse direction and the pulse timestamp specifically include: Calculate the time difference between two adjacent pulse timestamps; Obtain the preset unit angular displacement corresponding to a single pulse of the rotary encoder; By dividing the preset unit angular displacement by the time difference value in conjunction with the pulse direction, the real-time angular velocity is obtained; Calculate the velocity difference between two adjacent real-time angular velocities; The real-time angular acceleration is obtained by dividing the velocity difference by the corresponding time difference.

5. A real-time control system for a rotary screen device based on serial communication, characterized in that, The real-time control method for a rotary screen device based on serial communication according to any one of claims 1-4, wherein the rotary screen device has a local display screen and is connected to the main control device via a serial port, the system comprising: The data acquisition module is used to acquire pulse sequence data generated by the rotary encoder of the rotary screen device, and extract the pulse direction and pulse timestamp from the pulse sequence data; The feature calculation module is used to calculate the real-time angular velocity and real-time angular acceleration based on the pulse direction and the pulse timestamp; The strategy judgment module is used to compare the real-time angular velocity and the real-time angular acceleration with preset angular velocity thresholds and preset angular acceleration thresholds, respectively. The communication and rendering control module is used to execute an incremental real-time transmission strategy when the real-time angular velocity is less than or equal to the preset angular velocity threshold and the real-time angular acceleration is less than or equal to the preset angular acceleration threshold, by sending incremental pulse commands to the main control device through the serial port; wherein, the steps of executing the incremental real-time transmission strategy specifically include: The increment value is determined based on the pulse direction; The incremental value is encapsulated into an incremental pulse command; According to the original time interval generated by the pulse sequence data, the incremental pulse command is sent to the main control device frame by frame through the serial port; Furthermore, when the real-time angular velocity is greater than the preset angular velocity threshold, or the real-time angular acceleration is greater than the preset angular acceleration threshold, an intent prediction sending strategy and a local interface rendering strategy are executed: the transmission of incremental pulse commands is blocked; a target value is predicted based on the real-time angular velocity, the real-time angular acceleration, and a preset prediction time window; a status packet containing the target value is generated; and the status packet is sent to the main control device via the serial port; wherein, the specific method for generating the status packet containing the target value includes: Based on the real-time angular velocity and the target value, calculate the estimated time to reach the target value; Calculate the rate of change of acceleration of the pulse sequence data within a historical preset time window starting from the current moment; based on the preset numerical range of the rate of change of acceleration, find the corresponding easing curve type in a preset mapping table that reflects the correspondence between the rate of change of acceleration and the easing curve; The expected time, the easing curve type, and the target value are encapsulated together to form the state packet; Simultaneously, the current user interface state is interrupted from waiting for the serial port feedback confirmation signal, and a preset easing animation function is called to render the interface display state of the local display screen to the target value.

6. The real-time control system for a rotary screen device based on serial communication according to claim 5, characterized in that, The communication and rendering control module sends a status packet containing the target value to the main control device via the serial port. This enables the main control device to receive the status packet and parse out the target value. Based on the target value, a smooth control curve is generated locally on the main control device. The smooth control curve is used to generate continuous drive signals and output them to the controlled device connected to the master control device.

Citation Information

Patent Citations

  • Optical incremental encoder data processing system and method

    CN111337702A

  • Fault early warning method and system for hang tag gun pin forming based on Internet of Things

    CN121786454A