PI controller parameter optimization method and device, configuration method, terminal and medium
By setting multiple sampling points within the stroke range of the sewing machine presser foot, dynamically adjusting the PI controller parameters, and generating a pulse width modulation signal, the problem of insufficient control accuracy caused by improper PI controller parameter settings is solved, and efficient and high-quality sewing control is achieved.
Patent Information
- Application Number
- CN202511103101.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-07
- Publication Date
- 2025-09-26
AI Technical Summary
Improper PI controller parameter settings in existing sewing machines result in insufficient presser foot lifting control accuracy, affecting sewing efficiency and sewing quality.
By setting multiple height sampling points within the presser foot stroke range of the sewing machine, keeping either the proportional gain KP or the integral gain KI of the PI controller constant, and dynamically adjusting the other parameter, a pulse width modulation control signal is generated to drive the presser foot lifting mechanism. The actual lifting trajectory is obtained through the presser foot height sensor, and the optimized parameters are marked.
The complexity of PI controller parameter optimization is reduced, intelligent parameter configuration is achieved, the universality and robustness of the control strategy are improved, it can adapt to different sewing materials and working conditions, and improve the efficiency and quality of sewing work.
Smart Images

Figure CN120704115A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of sewing machine presser foot control, and relates to a PI controller parameter optimization method and device, a configuration method, a terminal and a medium. Background Art
[0002] In the field of sewing machine presser foot control, the Proportional-Integral-Differential (PID) closed-loop control algorithm is commonly used to achieve precise hovering of the presser foot at any target height. However, the algorithm's control performance is highly dependent on the proper setting of control parameters such as the proportional gain KP and the integral gain KI. Improper settings of these control parameters can lead to insufficient control accuracy during presser foot lifting.
[0003] Specifically, the proportional gain KP determines the controller's response speed. A larger proportional gain KP means the controller can more quickly identify and correct deviations, thereby quickly adjusting the presser foot to the target height. However, an excessively large proportional gain KP may cause system overshoot or even oscillation, affecting system stability and reliability. Conversely, an excessively small proportional gain KP results in a sluggish system response and may produce large steady-state errors. Furthermore, the integral gain KI is designed to reduce the system's steady-state error and improve output accuracy. As the integral gain KI increases, the controller's ability to correct accumulated errors increases, helping to accelerate reaching the setpoint. However, an excessively large integral gain KI can also exacerbate the system's tendency to oscillate. These problems caused by improper control parameter settings not only reduce sewing efficiency but also seriously impact sewing quality and equipment reliability. Summary of the Invention
[0004] The present application provides a PI controller parameter optimization method and device, configuration method, terminal and medium, which are used to solve the problem of insufficient presser foot lifting control accuracy caused by unoptimized PI controller parameters.
[0005] In the first aspect, the present application provides a PI controller parameter optimization method, including: step S100, setting multiple height sampling points within the presser foot stroke range of the sewing machine; step S200, for each of the height sampling points, keeping any one parameter of the proportional gain KP and the integral gain KI of the PI controller constant, and dynamically adjusting the other parameter; step S300, based on the proportional gain KP and the integral gain KI determined in step S200, generating a pulse width modulation control signal to drive the presser foot lifting mechanism of the sewing machine to perform a presser foot lifting action; step S400, obtaining the presser foot displacement signal collected in real time by the presser foot height sensor, and generating an actual presser foot lifting trajectory through signal processing; step S500, if the actual presser foot lifting trajectory is an ideal presser foot lifting trajectory, marking the parameter dynamically adjusted in step S200 as the optimized parameter of the PI controller.
[0006] In an implementation of the first aspect, generating a pulse width modulation control signal based on the proportional gain KP and the integral gain KI determined in step S200 includes: inputting the proportional gain KP and the integral gain KI into an incremental PI control algorithm, and having the incremental PI control algorithm calculate and output an increment of a control variable; the calculation formula of the incremental PI control algorithm is:
[0007] Δu=K p ·(e k -e k-1 )+K i ·e k ;
[0008] where K p represents the proportional gain, K i represents the integral gain, e k represents the error value at the kth sampling moment, e k-1 represents the error value at the (k-1)th sampling moment, and Δu represents the increment of the control amount;
[0009] The increment of the control variable is converted into the pulse width modulation control signal using a preset conversion function.
[0010] In an implementation method of the first aspect, it also includes: selecting multiple sewing machines as test prototypes; executing steps S100 to S500 for each test prototype respectively to obtain the optimization parameters of the PI controller and the pulse width modulation control signal corresponding to each of the test prototypes at each of the height sampling points; performing arithmetic averaging calculations on the optimization parameters of the PI controller corresponding to the same height sampling points of the test prototypes to obtain average optimization parameters; performing arithmetic averaging calculations on the duty cycles of the pulse width modulation control signals corresponding to the same height sampling points of the test prototypes to obtain average duty cycles; and establishing a three-dimensional mapping database based on the height sampling points, the average optimization parameters and the average duty cycles.
[0011] In an implementation of the first aspect, the method further includes: setting the pressure-adjusting nuts of the multiple sewing machines to a middle scale; at the middle scale, the compression amounts corresponding to the pressure-adjusting springs of the multiple sewing machines remain consistent.
[0012] In an implementation method of the first aspect, it also includes: obtaining the rise time, overshoot and oscillation amplitude of the actual lifting trajectory; judging whether all of the following conditions are true: the rise time does not exceed the preset threshold; the overshoot is within the allowable overshoot range; the oscillation amplitude does not exceed the preset threshold; if so, determining that the actual lifting trajectory is an ideal lifting trajectory; otherwise, determining that the actual lifting trajectory is a non-ideal lifting trajectory.
[0013] In an implementation method of the first aspect, it also includes: based on the dynamic time warping algorithm, calculating the similarity measurement value between the actual lifting curve and the preset ideal lifting trajectory; if the similarity measurement value exceeds the preset threshold, the actual lifting trajectory is determined to be an ideal lifting trajectory; otherwise, the actual lifting trajectory is determined to be a non-ideal lifting trajectory.
[0014] In the second aspect, the present application provides a PI controller parameter optimization device, including: a sampling setting module, which is used to set multiple height sampling points within the presser foot stroke range of the sewing machine; a parameter adjustment module, which is used to keep any one parameter of the proportional gain KP and the integral gain KI of the PI controller constant for each of the height sampling points, and dynamically adjust the other parameter; a presser foot lifting module, which is used to generate a pulse width modulation control signal based on the proportional gain KP and the integral gain KI determined in the parameter adjustment module, so as to drive the presser foot lifting mechanism of the sewing machine to perform a presser foot lifting action; a trajectory generation module, which is used to obtain the presser foot displacement signal collected in real time by the presser foot height sensor, and generate an actual presser foot lifting trajectory through signal processing; a parameter marking module, which is used to mark the parameter that has been dynamically adjusted in the parameter adjustment module as the optimization parameter of the PI controller if the actual presser foot lifting trajectory is an ideal presser foot lifting trajectory.
[0015] In a second aspect, the present application provides a PI controller parameter configuration method, comprising: setting a target presser foot height of a sewing machine; driving a presser foot lifting mechanism of the sewing machine to perform a presser foot lifting action multiple times based on a pulse width modulation signal generated by the PI controller; recording the duty cycle of the pulse width modulation signal each time the presser foot is lifted, and obtaining an average duty cycle by arithmetic average calculation; based on the target presser foot height and the average duty cycle, querying a pre-constructed three-dimensional mapping database to obtain the optimization parameters of the PI controller; the three-dimensional mapping database is used to establish a mapping relationship between the presser foot height, the duty cycle and the optimization parameters of the PI controller; and configuring the PI controller based on the queried optimization parameters of the PI controller.
[0016] In a fourth aspect, the present application provides a terminal comprising: a memory for storing a computer program; and a processor for executing the computer program stored in the memory so that the terminal executes any one of the PI controller parameter optimization methods and / or PI controller parameter configuration methods.
[0017] In a fifth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any one of the PI controller parameter optimization methods and / or PI controller parameter configuration methods.
[0018] As described above, the PI controller parameter optimization method and device, configuration method, terminal, and medium described in this application have the following beneficial effects:
[0019] (1) Reduce the complexity of optimizing PI controller parameters;
[0020] (2) The intelligent configuration of PI controller parameters is realized, which significantly improves efficiency;
[0021] (3) A three-dimensional mapping database is constructed based on the averaged data of multiple machines to ensure the wide applicability of the optimized parameters on different sewing machines, thereby greatly improving the universality and robustness of the control strategy;
[0022] (4) It can effectively adapt to the characteristics of different sewing materials and diverse working conditions, providing strong support for the efficient and high-quality development of sewing work. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 Shown is a structural schematic diagram of an industrial sewing machine according to an embodiment of the present application.
[0024] Figure 2 Shown is a flow chart of a PI controller parameter optimization method according to an embodiment of the present application.
[0025] Figure 3 Shown is a schematic diagram of presser foot lifting curves corresponding to different integral gains KI according to an embodiment of the present application.
[0026] Figure 4 Shown is a schematic diagram of presser foot lifting curves corresponding to different integral gains KP according to an embodiment of the present application.
[0027] Figure 5 Shown is a schematic diagram of the presser foot lifting trajectory according to an embodiment of the present application.
[0028] Figure 6 Shown is a schematic diagram of an ideal lifting trajectory according to an embodiment of the present application.
[0029] Figure 7 Shown is a flow chart of a PI controller parameter optimization method according to another embodiment of the present application.
[0030] Figure 8 Shown is a structural schematic diagram of a PI controller parameter optimization device according to an embodiment of the present application.
[0031] Figure 9 Shown is a flowchart of a PI controller parameter configuration method according to an embodiment of the present application.
[0032] Figure 10 Shown is a schematic structural diagram of a terminal according to an embodiment of the present application.
[0033] Component number description
[0034] 11 Presser foot lifter electromagnet
[0035] 12 Presser foot lifting mechanism
[0036] 13 Presser foot
[0037] 14 Pressure regulating spring
[0038] 15 Pressure regulating nut
[0039] 16 Presser foot height sensor
[0040] 20 Sampling Setting Module
[0041] 21 Parameter adjustment module
[0042] 22 Presser foot lifting module
[0043] 23 Trajectory Generation Module
[0044] 24 Parameter Marker Module
[0045] 31 Memory
[0046] 32 processors
[0047] 33 Multimedia Components
[0048] 34 Input / Output (I / O) interfaces
[0049] 35 Communication Components DETAILED DESCRIPTION
[0050] The following describes the embodiments of the present application through specific examples. Those skilled in the art can easily understand the other advantages and effects of the present application from the content disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other unless they conflict.
[0051] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application. Therefore, the illustrations only show components related to the present application and are not drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component can be changed at will, and the component layout type may also be more complicated.
[0052] In actual application scenarios, PI controller parameters need to be dynamically adjusted based on changes in operating conditions. For example, due to the complex and ever-changing operating environment of sewing machines, electromagnets easily generate heat during operation, and this heat generation can affect their performance, thereby affecting the effectiveness of the control parameters. Furthermore, factors such as differences in the scales of different pressure regulating nuts, changes in mechanical friction after long-term use of sewing machines, dimensional changes in mechanical structures due to thermal expansion and contraction, and certain errors in the production and assembly of machine parts can also cause changes in control parameters. Due to the inevitable errors in the production and assembly of machine parts, parameter settings can vary significantly between different devices. Even if parameter calibration is completed at the factory, the original parameters may no longer be applicable with long-term use of the equipment, resulting in a gradual decline in control performance.
[0053] The following embodiments of this application provide a PI controller parameter optimization method and device, configuration method, terminal, and medium. The technical solution of this application can be applied to scenarios such as the motor speed control system, presser foot height control, and thread tension adjustment of sewing machines. By optimizing control parameters, it improves sewing quality and effectively adapts to the characteristics of different sewing materials and diverse working conditions, providing strong support for efficient and high-quality sewing work.
[0054] It should be noted that the control parameters described in the following embodiments of the present application include proportional gain KP and integral gain KI, and the differential gain KD is not within the scope of discussion of the present application.
[0055] See also Figure 1 , which is a schematic diagram of the structure of an industrial sewing machine according to an embodiment of the present application. Figure 1 As shown, the industrial sewing machine in this embodiment includes a presser foot lifting electromagnet 11 , a presser foot lifting mechanism 12 , a presser foot 13 , a pressure adjusting spring 14 , a pressure adjusting nut 15 and a presser foot height sensor 16 .
[0056] Specifically, the presser foot lifting electromagnet 11 is connected to the presser foot 13 via a presser foot lifting mechanism 12, which includes a vertically movable presser foot rod. The lower end of the pressure-adjusting spring 14 acts on the presser foot rod, while the upper end abuts against a scale-marked pressure-adjusting nut 15. The presser foot 13 is fixedly mounted at the end of the presser foot rod, forming a bidirectional force system: the presser foot lifting electromagnet 11 applies an upward pulling force to the presser foot 13 via the presser foot lifting mechanism 12, while the pressure-adjusting spring 14 generates downward pressure via the presser foot rod. During sewing operations, a presser foot height sensor 16 located at the head of the sewing machine can monitor the displacement changes of the presser foot in real time.
[0057] During sewing machine operation, the pedal displacement or pressure signal from the electronic kneerest is converted into an input current signal for the presser foot lifter electromagnet 11. When the operator steps back on the pedal or applies kneerest pressure, the presser foot lifter electromagnet 11 generates a magnetic force under the action of the current, lifting the presser foot 13 upward through the presser foot lifter mechanism 12. In theory, the pedal displacement or kneerest pressure is positively correlated with the height to which the presser foot 13 is lifted. Conversely, when the pedal or kneerest pressure is released, the current to the presser foot lifter electromagnet 11 decreases or is disconnected, causing the presser foot lifter mechanism 12 to descend under the action of gravity. In theory, the distance it descends is positively correlated with the pedal displacement or kneerest pressure. When the pedal or kneerest is fully reset, the presser foot lifter mechanism 12 returns to its initial position.
[0058] It should be noted that the PI controller parameter configuration method and the PI controller parameter optimization method described in this application can be run on various types of hardware devices. The hardware device can be a computer including components such as a memory, a storage controller, one or more microcontrollers (MCU), a peripheral interface, an RF circuit, an audio circuit, a speaker, a microphone, an input / output (I / O) subsystem, a display screen, other output or control devices, and external ports; the computer includes but is not limited to personal computers such as desktop computers, laptops, tablet computers, smart phones, smart TVs, and personal digital assistants (PDAs). In other embodiments, the hardware device can also be a local server or a cloud server. The server can be arranged on one or more physical servers according to various factors such as function and load, or it can be composed of a distributed or centralized server cluster, which is not limited in this embodiment.
[0059] The principles and implementation methods of a PI controller parameter optimization method and device, configuration method, terminal and medium of this embodiment will be explained in detail below, so that those skilled in the art can understand a PI controller parameter optimization method and device, configuration method, terminal and medium of this embodiment without creative work.
[0060] See also Figure 2 , which is a flow chart of a PI controller parameter optimization method according to an embodiment of the present application. Figure 2 As shown, this embodiment provides a PI controller parameter optimization method, including the following steps S100 to S400.
[0061] Step S100: setting a plurality of height sampling points within the presser foot stroke range of the sewing machine.
[0062] In this embodiment, the presser foot travel range of the sewing machine refers to the vertical movement range of the presser foot from the initial position to the target height, and its specific value is determined by the mechanical structure and control system of the sewing machine.
[0063] Specifically, the initial position usually corresponds to the reference position of the presser foot, that is, the initial height when the operator does not trigger the pedal or knee rest device; and the target height depends on the maximum stroke displacement of the pedal or knee rest.
[0064] In actual applications, the determination of the presser foot stroke range needs to consider factors such as sewing thickness requirements and mechanical limit protection. The typical industrial sewing machine presser foot stroke range is between 0 and 15 mm.
[0065] In this embodiment, the height sampling points can be set using the principle of equidistant distribution. For example, a sampling point can be set every millimeter within the presser foot travel range of 0 to 15 mm, resulting in a total of 16 discrete positions. The sampling point density can be adjusted according to the control accuracy requirements. For high-precision sewing applications, the density can be increased to one sampling point every 0.5 mm, while a sparse configuration of one sampling point every 2 mm can be used in general applications. This discrete height sampling method not only simplifies the control algorithm, but also effectively avoids the signal noise problem caused by continuous detection, while providing a clear set value sequence for subsequent parameter adjustment.
[0066] In this implementation, by setting multiple height sampling points, the lifting height of the presser foot can be tracked and controlled more accurately. This method is more adaptable to the needs of sewing machines under different working conditions than the traditional single sampling point.
[0067] Step S200: For each of the height sampling points, keep any one parameter of the proportional gain KP and the integral gain KI of the PI controller constant, and dynamically adjust the other parameter.
[0068] In this embodiment, the PI controller used is an incremental PI controller. This controller calculates the difference between the current control variable and the previous control variable, using the difference as the new control variable. This effectively avoids the error accumulation problem in the integral phase. Its core features include a differential operation mechanism and recursive output calculation.
[0069] The control parameters corresponding to the PI controller include proportional gain KP and integral gain KI. Precise control is achieved through the synergistic effect of these two key parameters. The proportional gain KP refers to the ratio of the output signal to the input signal, and the integral gain KI refers to the integral of the output signal and time.
[0070] When prior knowledge is lacking, initial fixed values can be arbitrarily selected for trial operation during the testing phase. By experimenting with a large number of different fixed values, the effects of parameter changes on the system can be gradually explored and summarized into empirical formulas. Through subsequent dynamic adjustment processes, the system automatically converges to the optimal parameters.
[0071] When the proportional gain KP is fixed (for example, KP=1.2) and the integral gain KI is adjusted, the presser foot lifting curve corresponding to different integral gains KI (for example, 0.05, 0.1, 0.2) is tested at the same target height (for example, 5mm). Figure 3 As shown in the figure, the experimental data clearly demonstrates the effect of the integral gain KI: the purple curve (KI1 = 0.2) shows the fastest response speed, but is accompanied by obvious overshoot and subsequent oscillation; the red curve (KI2 = 0.1) achieves a good balance between speed and stability; and the blue curve (KI3 = 0.05) completely avoids overshoot, but has a longer rise time.
[0072] When the integral gain KI is fixed (such as KI = 0.1) and the proportional gain KP is adjusted, Figure 4 The figure shows the effect of the proportional gain KP: the green curve (KP1 = 2.0) shows a slow but steady rise characteristic, with a rise time of 120ms; the red curve (KP2 = 1.5) completes positioning within 90ms without overshoot; and the blue curve (KP3 = 0.8) reaches the target height in just 60ms, but produces overshoot and continuous oscillation.
[0073] Figure 3 and Figure 4The horizontal axis corresponds to different collection points. These collection points are set at fixed intervals (e.g., 180 microseconds) during the presser foot lifting process. That means presser foot height data is collected every 180 microseconds. The vertical axis represents the collected presser foot height value. At this point, the presser foot height value is actually only the sampled value from the microcontroller's analog-to-digital converter (ADC) and has not yet been converted into the actual height value in millimeters.
[0074] This implementation employs a single-variable strategy of fixing one parameter and adjusting another, decomposing the multidimensional problem into a one-dimensional search problem and significantly reducing the complexity of parameter optimization. For example, by fixing the integral gain KI when testing the impact of the proportional gain KP, the independent effect of the proportional gain on the system's dynamic characteristics can be clearly observed, avoiding the interference caused by the coupling of the two parameters. This step-by-step optimization approach not only reduces the trial-and-error cost of parameter adjustment but also enables engineers to more systematically understand the actual impact of each parameter. Compared to traditional manual parameter adjustment methods, it is more flexible and efficient, and can better adapt to the nonlinear characteristics and external interference of sewing machines.
[0075] Step S300: Based on the proportional gain KP and the integral gain KI determined in step S200, a pulse width modulation (PWM) control signal is generated to drive the presser foot lifting mechanism of the sewing machine to perform a presser foot lifting action.
[0076] In this embodiment, the duty cycle of the PWM control signal determines the driving force of the presser foot lifting mechanism.
[0077] Specifically, a larger duty cycle of the PWM control signal means that the coil in the presser foot lifter electromagnet is energized for a longer period of time per unit cycle. According to the principle of electromagnetic induction, the longer the energization time increases the magnetic field strength generated around the coil, thereby increasing the suction force generated by the electromagnet. This increased suction acts on the presser foot, causing it to lift upward. Conversely, a smaller duty cycle of the PWM control signal means that the coil in the presser foot lifter electromagnet is energized for a shorter period of time per unit cycle, resulting in a weaker magnetic suction force generated by the electromagnet, which reduces the speed at which the presser foot is lifted.
[0078] In an embodiment of the present application, generating a pulse width modulation control signal based on the proportional gain KP and the integral gain KI determined in step S200 includes steps S301 and S302 .
[0079] In step S301, the proportional gain KP and the integral gain KI are input into an incremental PI control algorithm, and the incremental PI control algorithm calculates and outputs an increment of the control variable. The calculation formula of the incremental PI control algorithm is:
[0080] Δu=K p ·(e k -e k-1 )+K i ·e k ;
[0081] where K p represents the proportional gain, K i represents the integral gain, e k represents the error value at the kth sampling moment, e k-1 represents the error value at the (k-1)th sampling moment, and Δu represents the increment of the control amount.
[0082] In step S302, the increment of the control variable is converted into the pulse width modulation control signal using a preset conversion function.
[0083] Step S400: obtaining a presser foot displacement signal collected in real time by a presser foot height sensor, and generating an actual presser foot lifting trajectory through signal processing.
[0084] In this embodiment, the actual presser foot lifting trajectory intuitively reflects the dynamic movement process of the presser foot from the initial position to the target height through the time-height curve.
[0085] The presser foot height sensor continuously captures the presser foot's displacement, with each data point associated with a precise timestamp. These data, arranged in a time series, form the position coordinates of the presser foot at each moment in its motion. By establishing a coordinate system with time as the horizontal axis and displacement as the vertical axis, all data points are mapped onto this plane. Advanced curve fitting technology then seamlessly connects these discrete points into a smooth curve, representing the actual presser foot lift trajectory and enabling precise visualization of the presser foot's motion.
[0086] See also Figure 5 , which is a schematic diagram showing the presser foot lifting trajectory according to an embodiment of the present application.
[0087] The presser foot lifting trajectory can reflect the speed change and stability characteristics of the presser foot during the lifting process. Figure 5 As shown in the figure, the horizontal axis represents time, and the vertical axis represents the displacement of the presser foot. The trajectory begins at the starting point, marking the start of the lifting action. During the continuous movement, the presser foot undergoes a period of oscillation and adjustment, which is reflected in the slight fluctuations of the trajectory line in the figure. Eventually, the presser foot movement gradually stabilizes and precisely converges to the pre-set target height.
[0088] In one embodiment of the present application, the PI controller parameter optimization method described in the present application further includes step S401 and step S404.
[0089] In step S401 , the rise time, overshoot and oscillation amplitude of the actual lifting trajectory are obtained.
[0090] In step S402, determine whether all of the following conditions are true:
[0091] (1) The rise time does not exceed a preset threshold;
[0092] (2) The overshoot is within the allowable overshoot range;
[0093] (3) The oscillation amplitude does not exceed a preset threshold.
[0094] In step S403, if yes, it is determined that the actual lifting trajectory is an ideal lifting trajectory.
[0095] In step S404 , otherwise, it is determined that the actual lifting trajectory is a non-ideal lifting trajectory.
[0096] In this embodiment, the rise time refers to the shortest time required for the trajectory to rise from the initial position to the target height. In theory, a smaller rise time value means that the trajectory can rise quickly, reflecting a good response speed. However, while rising quickly, it is also necessary to ensure that there is no large overshoot, and the oscillation amplitude must remain at a small level throughout the entire rise process. In this case, the actual lifting trajectory can be determined to be the ideal lifting trajectory.
[0097] In another embodiment of the present application, the PI controller parameter optimization method described in the present application further includes step S405 and step S407.
[0098] In step S405 , a similarity measure between the actual lifting curve and a preset ideal lifting trajectory is calculated based on a dynamic time warping (DTW) algorithm.
[0099] In step S406 , if the similarity measurement value exceeds a preset threshold, the actual lifting trajectory is determined to be an ideal lifting trajectory.
[0100] In step S407 , otherwise, it is determined that the actual lifting trajectory is a non-ideal lifting trajectory.
[0101] The ideal lifting trajectory refers to the height-time curve presented when the sewing machine presser foot moves from the initial position to the target height, with optimal time, no overshoot, no oscillation, and one-step completion.
[0102] See also Figure 6, which is a schematic diagram showing an ideal lifting trajectory of an embodiment of the present application. Figure 6 As shown in the figure, during the lifting process, the presser foot can stably reach the predetermined target height, showing good control accuracy. In addition, at the inflection point of the trajectory, the curve achieves a smooth transition, completely avoiding any sharp turns.
[0103] Step S500: If the actual presser foot lifting trajectory is the ideal presser foot lifting trajectory, the parameters dynamically adjusted in step S200 are marked as optimized parameters of the PI controller.
[0104] In other embodiments, if the actual presser foot lifting trajectory is not the ideal presser foot lifting trajectory, it indicates that the currently dynamically adjusted parameters have not yet reached the optimal value. In this case, the parameters need to be readjusted and steps S300 to S500 are repeated until the actual trajectory is consistent with the ideal trajectory, and the optimized parameters of the PI controller are finally determined.
[0105] See also Figure 7 , which is a flow chart of a PI controller parameter optimization method according to another embodiment of the present application.
[0106] like Figure 7 As shown, the PI controller parameter optimization method described in this application also includes the following steps S600 to S110.
[0107] In step S600, a plurality of sewing machines are selected as test samples.
[0108] In this embodiment, the number of test samples can be flexibly set based on actual needs. For example, five sewing machines can be selected as test samples, and this number can be expanded to ten or more as needed. Increasing the number of samples effectively expands the test coverage, comprehensively encompassing different usage scenarios and potential variable factors, thereby significantly improving the applicability and reliability of the test results.
[0109] In step S700 , steps S100 to S500 are respectively executed for each test prototype to obtain the optimized parameters of the PI controller and the pulse width modulation control signal corresponding to each height sampling point of each test prototype.
[0110] Taking five test prototypes (A, B, C, D, and E) as an example, if the proportional gain KP is fixed, the integral gain KI is optimized. Table 1 shows the optimized PI controller parameters and pulse width modulation control signal duty cycle data for these five test prototypes when the height sampling point is 2 mm.
[0111] Table 1. Optimized parameters and duty cycle data of test prototype A at some height sampling points
[0112] Test prototype Integral gain KI PWM control signal duty cycle A 6.9 44.20% B 6.8 43.64% C 6.6 43.83% D 6.8 44.68% E 6.7 43.31%
[0113] In step S800, an arithmetic average calculation is performed on the optimization parameters of the PI controller corresponding to the same height sampling points of each test prototype to obtain an average optimization parameter.
[0114] Specifically, the following formula can be used to calculate the arithmetic average of the integral gains KI of the five test samples when the height sampling point is 2 mm:
[0115]
[0116] It should be noted that the calculation process of the average optimization parameters of the test prototype at other height sampling points is similar to this and will not be described in detail here.
[0117] In step S900, the duty cycles of the pulse width modulation control signals corresponding to the same height sampling points of the test prototypes are arithmetic averaged to obtain an average duty cycle.
[0118] Specifically, the following formula can be used to calculate the arithmetic average of the duty cycle data of the five test samples when the height sampling point is 2 mm:
[0119]
[0120] It should be noted that the average duty cycle calculation process of the test prototype at other height sampling points is similar to this and will not be described in detail here.
[0121] In step S110 , a three-dimensional mapping database is established based on the height sampling points, the average optimization parameters, and the average duty cycle.
[0122] Specifically, the average duty cycle can be divided into several intervals, and then the height sampling points and average optimization parameters can be stored according to the intervals. In this way, each duty cycle interval will have a corresponding set of height sampling points and average optimization parameters. This storage method facilitates the subsequent parameter matching process. When searching for the corresponding optimization parameters based on the duty cycle and height sampling points, the corresponding interval can be quickly located, thereby improving matching efficiency.
[0123] In this embodiment, the primary function of the 3D mapping database is to serve as a search tool. During sewing machine operation, the average optimized parameters within the corresponding duty cycle range can be quickly retrieved from the database based on the target presser foot height or the actual duty cycle detected. This allows the PI controller parameters to be adjusted to ensure stable operation and high-quality output.
[0124] In one embodiment of the present application, the PI controller parameter optimization method described in the present application also includes: setting the pressure-adjusting nuts of the multiple sewing machines to the middle scale; at the middle scale, the compression amounts corresponding to the pressure-adjusting springs of the multiple sewing machines remain consistent.
[0125] Specifically, the scale marked on the pressure-adjusting nut ranges from 2.0 to 3.2. The user manually rotates the pressure-adjusting nut to adjust the compression of the pressure-adjusting spring. As the pressure-adjusting nut is gradually rotated downward, that is, as the scale value on the pressure-adjusting nut increases, the pressure-adjusting spring is compressed more tightly, resulting in a significant increase in the force required to lift the presser foot. Conversely, as the scale value on the pressure-adjusting nut decreases, the pressure-adjusting spring is compressed less, and the force required to lift the presser foot is correspondingly reduced.
[0126] It should be noted that in order to effectively reduce the random influence caused by the difference in the setting of the pressure regulating nut and ensure the consistency and comparability of the test conditions, the middle scale (i.e., scale = 2.6) is used as the standard position of the test in this embodiment to ensure the accuracy and reliability of the experimental data.
[0127] In this implementation, by averaging the test data from multiple sewing machines, parameter deviations caused by individual differences or accidental errors in individual machines can be effectively eliminated, making the resulting control parameters more universal and representative. Furthermore, the three-dimensional mapping database constructed based on the averaged data from multiple machines can cover the common characteristics of different machines, ensuring the wide applicability of the optimized parameters on different sewing machines, thereby significantly improving the universality and robustness of the control strategy.
[0128] It should be noted that the protection scope of the PI controller parameter optimization method described in the embodiment of the present application is not limited to the execution order of the steps listed in this embodiment. All solutions implemented by adding, reducing, or replacing steps in the existing technology based on the principles of the present application are included in the protection scope of the present application.
[0129] See also Figure 8 , which is a schematic diagram showing the structure of a PI controller parameter optimization device according to an embodiment of the present application. Figure 8 As shown, this embodiment provides a PI controller parameter optimization method and device, including a sampling setting module 20, a parameter adjustment module 21, a presser foot lifting module 22, a trajectory generation module 23 and a parameter marking module 24.
[0130] The sampling setting module 20 is used to set a plurality of height sampling points within the presser foot stroke range of the sewing machine.
[0131] The parameter adjustment module 21 is used to keep any one parameter of the proportional gain KP and the integral gain KI of the PI controller constant for each of the height sampling points, and dynamically adjust the other parameter.
[0132] The presser foot lifting module 22 is used to generate a pulse width modulation control signal based on the proportional gain KP and the integral gain KI determined in the parameter adjustment module to drive the presser foot lifting mechanism of the sewing machine to perform a presser foot lifting action.
[0133] The trajectory generating module 23 is used to obtain the presser foot displacement signal collected in real time by the presser foot height sensor, and generate the actual presser foot lifting trajectory through signal processing.
[0134] The parameter marking module 24 is used to mark the parameters dynamically adjusted in the parameter adjustment module as optimized parameters of the PI controller if the actual presser foot lifting trajectory is the ideal presser foot lifting trajectory.
[0135] It should be noted that the structures and principles of the sampling setting module 20, parameter adjustment module 21, presser foot lifting module 22, trajectory generation module 23 and parameter marking module 24 described in this embodiment correspond one-to-one to the steps in the above-mentioned PI controller parameter optimization method, so they will not be repeated here.
[0136] The PI controller parameter optimization device provided in the embodiment of the present application can implement the PI controller parameter optimization method described in the present application, but the implementation device of the PI controller parameter optimization method described in the present application includes but is not limited to the structure of the PI controller parameter optimization device listed in the present embodiment. All structural deformations and replacements of the prior art made according to the principles of the present application are included in the protection scope of the present application.
[0137] See also Figure 9 , which is a flow chart of a PI controller parameter configuration method according to an embodiment of the present application. Figure 9 As shown, this embodiment provides a PI controller parameter configuration method, including the following steps S210 to S250.
[0138] In step S210, a target presser foot height of the sewing machine is set.
[0139] In step S220, based on the pulse width modulation signal generated by the PI controller, the presser foot lifting mechanism of the sewing machine is driven to perform the presser foot lifting action multiple times.
[0140] In step S230, the duty cycle of the pulse width modulation signal is recorded each time the presser foot is lifted, and an average duty cycle is obtained by arithmetic average calculation.
[0141] In this implementation, by performing the presser foot lifting action multiple times and calculating the average duty cycle, the influence of accidental errors on the control parameters is effectively reduced, and the reliability of the parameters is improved.
[0142] In step S240 , based on the target presser foot height and the average duty cycle, a pre-built three-dimensional mapping database is queried to obtain optimized parameters of a PI controller.
[0143] In this embodiment, the three-dimensional mapping database is used to establish a mapping relationship between the presser foot height, the duty cycle, and the optimization parameters of the PI controller.
[0144] It should be noted that the three-dimensional mapping database in this embodiment can be constructed according to the above steps S600 to S110, which will not be repeated here.
[0145] In step S250, the PI controller is configured based on the queried optimization parameters of the PI controller.
[0146] This implementation simplifies the parameter configuration process to a single query by pre-building a database, enabling intelligent parameter configuration and significantly improving efficiency. Furthermore, the database can be continuously updated and expanded based on new data, adapting to more complex operating conditions and demonstrating excellent iterative capabilities.
[0147] It should be noted that the protection scope of the PI controller parameter configuration method described in the embodiment of the present application is not limited to the execution order of the steps listed in this embodiment. All solutions implemented by adding, reducing, or replacing steps in the existing technology based on the principles of the present application are included in the protection scope of the present application.
[0148] See also Figure 10 , which is a schematic diagram showing the structure of a terminal according to an embodiment of the present application. Figure 10 As shown, the present application provides a terminal including a memory 31 and a processor 32 .
[0149] The memory 31 is used to store computer programs.
[0150] The processor 32 is configured to execute the computer program stored in the memory 31 so that the terminal executes any one of the above-mentioned PI controller parameter optimization methods and / or PI controller parameter configuration methods.
[0151] Preferably, the processor 32 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The memory 31 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
[0152] This embodiment further includes one or more of a multimedia component 33 , an input / output (I / O) interface 34 , and a communication component 35 .
[0153] The multimedia component 33 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in a memory or sent through a communication component. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 34 provides an interface between the processor 32 and other interface modules, and the above-mentioned other interface modules may be a keyboard, a mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 35 is used for wired or wireless communication between the timer and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component may include: a Wi-Fi module, a Bluetooth module, an NFC module.
[0154] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices or methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules / units is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules or units, which can be electrical, mechanical or other forms.
[0155] The modules / units described as separate components may or may not be physically separate, and the components displayed as modules / units may or may not be physical modules, that is, they may be located in one place or distributed across multiple network elements. Some or all of the modules / units may be selected according to actual needs to achieve the purpose of the embodiments of the present application. For example, the functional modules / units in the various embodiments of the present application may be integrated into a processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into a single module / unit.
[0156] Those skilled in the art should further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0157] The present application also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement any of the above-mentioned PI controller parameter optimization methods and / or PI controller parameter configuration methods. A person skilled in the art will appreciate that all or part of the steps in the method for implementing the above-mentioned embodiment can be completed by instructing the processor through a program, and the program can be stored in a computer-readable storage medium, wherein the storage medium is a non-transitory medium, such as a random access memory, a read-only memory, a flash memory, a hard disk, a solid-state drive, a magnetic tape, a floppy disk, an optical disc, and any combination thereof. The above-mentioned storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0158] The descriptions of the processes or structures corresponding to the above figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.
[0159] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical concepts disclosed in this application shall be covered by the claims of this application.
Claims
1. A PI controller parameter optimization method, characterized in that: include: Step S100: setting a plurality of height sampling points within the presser foot stroke range of the sewing machine; Step S200: for each of the height sampling points, keep any one of the proportional gain KP and the integral gain KI of the PI controller constant, and dynamically adjust the other parameter; Step S300: Based on the proportional gain KP and the integral gain KI determined in step S200, a pulse width modulation control signal is generated to drive a presser foot lifting mechanism of the sewing machine to perform a presser foot lifting action; Step S400: obtaining a presser foot displacement signal collected in real time by a presser foot height sensor, and generating an actual presser foot lifting trajectory through signal processing; Step S500: If the actual presser foot lifting trajectory is the ideal presser foot lifting trajectory, the parameters dynamically adjusted in step S200 are marked as optimized parameters of the PI controller.
2. The method according to claim 1, characterized in that Generating a pulse width modulation control signal based on the proportional gain KP and the integral gain KI determined in step S200 includes: The proportional gain KP and the integral gain KI are input into the incremental PI control algorithm, and the incremental PI control algorithm calculates and outputs the increment of the control quantity; the calculation formula of the incremental PI control algorithm is: Δu=K p ·(and k -and k-1 )+K i ·and k ; where K p represents the proportional gain, K i represents the integral gain, e k represents the error value at the kth sampling moment, e k-1 represents the error value at the (k-1)th sampling moment, and Δu represents the increment of the control amount; The increment of the control variable is converted into the pulse width modulation control signal using a preset conversion function.
3. The method according to claim 1, characterized in that Also includes: Select several sewing machines as test samples; For each test prototype, perform steps S100 to S500 respectively to obtain the optimized parameters of the PI controller and the pulse width modulation control signal corresponding to each height sampling point of each test prototype; Performing arithmetic average calculation on the optimized parameters of the PI controller corresponding to the same height sampling points of each test prototype to obtain an average optimized parameter; Performing arithmetic averaging on the duty cycles of the pulse width modulation control signals corresponding to the same height sampling points of the test prototypes to obtain an average duty cycle; A three-dimensional mapping database is established based on the height sampling points, the average optimization parameters and the average duty cycle.
4. The method according to claim 3, characterized in that Also includes: The pressure-adjusting nuts of the plurality of sewing machines are all set at a middle scale; at the middle scale, the compression amounts corresponding to the pressure-adjusting springs of the plurality of sewing machines remain consistent.
5. The method according to claim 1, wherein Also includes: Obtaining the rise time, overshoot, and oscillation amplitude of the actual lifting trajectory; Determine whether all of the following conditions are true: The rise time does not exceed a preset threshold; The overshoot amount is within the allowable overshoot range; The oscillation amplitude does not exceed a preset threshold; if so, the actual lifting trajectory is determined to be an ideal lifting trajectory; otherwise, the actual lifting trajectory is determined to be a non-ideal lifting trajectory.
6. The method according to claim 1, characterized in that Also includes: Calculating a similarity measure between the actual lift curve and a preset ideal lift trajectory based on a dynamic time warping algorithm; If the similarity measure exceeds a preset threshold, determining that the actual lifting trajectory is an ideal lifting trajectory; Otherwise, it is determined that the actual lifting trajectory is a non-ideal lifting trajectory.
7. A PI controller parameter optimization device, characterized in that: include: A sampling setting module is used to set multiple height sampling points within the presser foot stroke range of the sewing machine; a parameter adjustment module, configured to maintain constant, for each of the height sampling points, any one of the proportional gain KP and the integral gain KI of the PI controller, and dynamically adjust the other parameter; a presser foot lifting module, configured to generate a pulse width modulation control signal based on the proportional gain KP and the integral gain KI determined in the parameter adjustment module, so as to drive the presser foot lifting mechanism of the sewing machine to perform a presser foot lifting action; The trajectory generation module is used to obtain the presser foot displacement signal collected in real time by the presser foot height sensor and generate the actual presser foot lifting trajectory through signal processing; A parameter marking module is used to mark the parameters dynamically adjusted in the parameter adjustment module as optimized parameters of the PI controller if the actual presser foot lifting trajectory is the ideal presser foot lifting trajectory.
8. A PI controller parameter configuration method, characterized in that: include: Set the target presser foot height on your sewing machine; Based on the pulse width modulation signal generated by the PI controller, the presser foot lifting mechanism of the sewing machine is driven to perform the presser foot lifting action multiple times; Recording the duty cycle of the pulse width modulation signal each time the presser foot is lifted, and calculating the average duty cycle by arithmetic average; Based on the target presser foot height and the average duty cycle, querying the three-dimensional mapping database pre-constructed according to the method of claim 3 to obtain optimized parameters of the PI controller; The three-dimensional mapping database is used to establish a mapping relationship between the presser foot height, the duty cycle and the optimization parameters of the PI controller; The PI controller is configured based on the queried optimization parameters of the PI controller.
9. A terminal, characterized in that: include: a memory for storing a computer program; A processor, wherein the processor is configured to execute the computer program stored in the memory so as to enable the terminal to execute the PI controller parameter optimization method described in any one of claims 1 to 6 and / or the PI controller parameter configuration method described in claim 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the PI controller parameter optimization method according to any one of claims 1 to 6 and / or the PI controller parameter configuration method according to claim 8 are implemented.
Citation Information
Patent Citations
Online feedback parameter optimization method and system of PI system
CN116300405A
Presser foot slow descending control method and system, electronic equipment and sewing machine
CN119372845A