A method and system for adaptive PID control of ship heading under rudder constraints
By adjusting the PID control law with adaptive integral weight, the integral saturation problem in traditional PID control is solved, thereby improving the stability and adaptability of heading control, reducing servo energy consumption, and maintaining the simplicity of the PID controller.
Patent Information
- Application Number
- CN202611288212.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-24
- Publication Date
- 2026-11-17
AI Technical Summary
Traditional PID control is prone to integral saturation problems when maintaining a ship's course, resulting in increased course overshoot, prolonged settling time, and insufficient servo motor execution capability, making it difficult to adapt to large-angle changes of course and external disturbances.
An adaptive integral weighted PID control law is adopted, which dynamically adjusts the weight of the integral term based on state variables such as heading angle error, heading angle error rate of change, actual rudder angle, and actual rudder speed, to ensure that the integral term is smoothly adjusted within the servo constraints.
This reduces overshoot caused by the accumulation of integral terms, lowers servo energy consumption, improves the stability and adaptability of heading control, and maintains the structural simplicity of the PID controller.
Smart Images

Figure CN123113292A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ship course maintenance control technology, and in particular to a ship course adaptive PID control method and system under steering gear constraints. Background Technology
[0002] Ship course maintenance control is an important component of ship automatic maneuvering systems. Its main task is to automatically generate steering commands based on the deviation between the target course and the actual course, enabling the ship to maintain the predetermined course as much as possible under external disturbances such as wind, waves, and currents. Proportional-Integral-Derivative (PID) control is a commonly used method in ship course maintenance control due to its simple structure, convenient parameter tuning, and mature engineering implementation.
[0003] However, for controlled objects with large inertia and slow response, such as ships, traditional PID control is prone to the problem of continuous accumulation of the integral term under conditions of large heading angle errors or persistent disturbances. When the steering command output by the PID reaches the rudder angle limit but the integral term continues to accumulate, integral saturation is likely to occur, leading to increased heading overshoot, prolonged settling time, and even increased servo motor workload. Simultaneously, it may also generate steering commands that are physically difficult to achieve, causing the control result to deviate from the actual autopilot operation. Especially during large-angle changes of direction, strong external disturbances, or changes in ship model parameters, insufficient servo motor execution capability will further exacerbate the mismatch between the PID output and the actual rudder angle response.
[0004] To address the integral saturation problem in traditional PID control, researchers have successively introduced methods such as sliding mode control, active disturbance rejection control, fuzzy control, neural network control, and adaptive control. These methods have certain advantages in handling nonlinear characteristics, model uncertainties, and complex disturbances, but they typically require the introduction of more state variables, observers, rule bases, training data, or optimization parameters, resulting in relatively complex control structures and higher difficulties in engineering implementation and parameter tuning. Furthermore, improved strategies such as integral separation, integral limiting, conditional integration, or anti-integral saturation have been introduced. These strategies are logically simple, easy to implement in engineering, and can improve the overshoot and settling time of traditional PID control to some extent. However, these strategies do not adequately consider servo constraints and fail to implement continuous and smooth adjustment of the integral action based on the servo's actuation capability. Summary of the Invention
[0005] In view of this, it is necessary to provide a method, system, controller and ship for adaptive PID control of ship heading under steering gear constraints, so as to improve the stability and adaptability of PID control by enabling the integral action to be dynamically adjusted according to the ship's heading state and steering gear execution constraints while retaining the advantages of PID control in terms of simplicity and ease of implementation.
[0006] To address the aforementioned problems, in a first aspect, the present invention provides a ship heading adaptive PID control method under steering gear constraints, comprising:
[0007] The adaptive integral weight is determined based on the ship's state variables in the current control cycle; wherein, the state variables include: heading angle error, rate of change of heading angle error, actual rudder angle, and actual rudder speed; the closer any of the state variables is to its corresponding constraint, the smaller the adaptive integral weight;
[0008] The integral term in the PID control law is corrected according to the adaptive integral weight, and the first steering command output by the PID control law is obtained.
[0009] The course of the vessel is controlled according to the first steering command.
[0010] Secondly, the present invention also provides a ship heading adaptive PID control system under steering gear constraints, comprising:
[0011] An adaptive integral weight calculation module is used to determine the adaptive integral weight based on the ship's state variables in the current control cycle; wherein, the state variables include: heading angle error, rate of change of heading angle error, actual rudder angle, and actual rudder speed; the closer any of the state variables is to its corresponding constraint, the smaller the adaptive integral weight;
[0012] The PID control module is used to correct the integral term in the PID control law according to the adaptive integral weight, and to obtain the first steering command output by the PID control law.
[0013] The execution module is used to control the course of the vessel according to the first steering command.
[0014] Thirdly, the present invention also provides a controller, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the above-mentioned adaptive PID control method for ship heading under steering gear constraints.
[0015] Fourthly, the present invention also provides a ship including the controller described above.
[0016] The beneficial effects of this invention are:
[0017] This invention determines adaptive integral weights based on the ship's state variables during the current control cycle. These state variables include: heading angle error, rate of change of heading angle error, actual rudder angle, and actual rudder speed. The closer any state variable is to its corresponding constraint, the smaller the adaptive integral weight. By adjusting the integral term in the PID control law through adaptive integral weights, the invention achieves two main benefits: firstly, it reduces the influence of the integral term when the heading angle error is large or changes rapidly, preventing the integral term from prematurely or excessively participating in control during rapid transitions, thus reducing overshoot caused by the accumulation of the integral term; secondly, it also reduces the influence of the integral term when the actual rudder angle or actual rudder speed is close to its corresponding constraint, thereby suppressing PID output, mitigating the mismatch between PID output and the actual actuation capability of the servo motor, reducing the action burden of the servo motor under large-angle changes or disturbances, reducing unnecessary rudder angle energy consumption, and improving the smoothness of the servo motor control process.
[0018] Furthermore, the integral term of this invention can dynamically change with the heading response state and the steering constraint state, thus maintaining adaptability and robustness when external disturbances or changes in ship model parameters occur.
[0019] Furthermore, this invention is still based on the PID control framework, only adding adaptive integral weight calculation in the integral adjustment stage, without changing the basic closed-loop structure of the ship's autopilot system. Therefore, while improving control performance, this invention maintains the advantages of the PID controller, such as simple structure, clear parameter meaning, and ease of embedding into existing autopilot control systems. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart illustrating an embodiment of the adaptive PID control method for ship heading under steering gear constraints provided by the present invention.
[0022] Figure 2 This is a schematic diagram of adaptive integral weight calculation provided by the present invention;
[0023] Figure 3 The directional conditional anti-saturation logic diagram provided for this invention;
[0024] Figure 4 The Simulink simulation experimental model diagram provided by this invention;
[0025] Figure 5The heading response comparison diagram under parameter perturbation conditions provided by this invention; Figure 5 (a) is a comparison chart showing response times from 0 to 800 s. Figure 5 (b) is a magnified comparison chart with response times of 250-400s;
[0026] Figure 6 The comparison chart of integral weight changes under parameter perturbation conditions provided by this invention;
[0027] Figure 7 A comparison chart of the comprehensive performance of fixed threshold PID and adaptive integral weight PID under parameter perturbation conditions provided by the present invention;
[0028] Figure 8 A comparison chart of the integral shutdown duration of fixed threshold PID and adaptive integral weight PID under five working conditions provided by the present invention;
[0029] Figure 9 A schematic diagram of an embodiment of the ship heading adaptive PID control system under rudder constraint provided by the present invention;
[0030] Figure 10 This is a schematic diagram of another embodiment of the ship heading adaptive PID control system under steering gear constraints provided by the present invention. Detailed Implementation
[0031] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.
[0032] 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 a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0033] In the description of the embodiments of this invention, unless otherwise stated, "a plurality of" means two or more. The terms "first," "second," etc., used in the embodiments of this invention are used to distinguish similar objects, and are not used to describe a specific order or sequence, nor to indicate or imply their relative importance or implicitly specify the number of indicated technical features. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, and the number of objects is not limited; for example, a first object can be one or more.
[0034] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0035] Reference Figure 1 The diagram illustrates a flowchart of an embodiment of the adaptive PID control method for ship heading under steering gear constraints provided by the present invention. The method includes:
[0036] S101, determine the adaptive integral weight based on the ship's state variables in the current control cycle; wherein, the state variables include: heading angle error, rate of change of heading angle error, actual rudder angle, and actual rudder speed; the closer any state variable is to its corresponding constraint, the smaller the adaptive integral weight.
[0037] The heading control inputs and feedback status information of the vessel in the current control cycle can be obtained first. The heading control inputs include the target heading angle. This information can be provided by the heading setting device, the upper track control system, or the navigation system. Feedback status information includes the actual heading angle. Actual rudder angle Actual rudder speed Maximum permissible rudder angle Maximum permissible rudder speed Control cycle and proportional gain in PID control Integral gain Differential gain The actual heading angle is obtained from a compass, inertial navigation system, or heading measurement device; the actual rudder angle and actual rudder speed are obtained from a rudder angle feedback device, rudder control unit, or rudder angle sensor; the maximum permissible rudder angle, maximum permissible rudder speed, control cycle, and PID parameters are pre-configured or stored in the controller.
[0038] Then, calculate the heading angle error: , k represents the kth control cycle, which is also the current control cycle.
[0039] When considering the heading angle span or When calculating the heading angle error, the following method is used, employing the shortest directional angle difference:
[0040]
[0041] After adopting the shortest directional angular difference, the sign of the error indicates the shortest turning direction, and the absolute value of the error indicates the minimum heading deviation along that direction. The input and output of the above trigonometric functions are both in radians; when the target heading, actual heading, and error threshold are expressed in degrees, they should first be converted to radians for calculation, and then converted back to degrees after calculation.
[0042] Calculate the rate of change of the heading angle error:
[0043]
[0044] in, This represents the rate of change of the current heading angle error. This represents the heading angle error from the previous control cycle. This is for control period purposes. This indicator is used to determine whether the heading angle error is increasing rapidly, decreasing rapidly, or stabilizing.
[0045] Then, the adaptive integral weights are determined based on the heading angle error, the rate of change of the heading angle error, the actual rudder angle, and the difference between the actual rudder speed and their corresponding constraints. The smaller the difference, the smaller the adaptive integral weight. The constraint corresponding to the actual rudder angle is the maximum permissible rudder angle. The actual rudder speed corresponds to the maximum permissible rudder speed. These two constraints are determined by the actuation capability of the ship's actuators; the constraints corresponding to the heading angle error and the rate of change of the heading angle error can be automatically set according to the actual control situation of the ship. Furthermore, the specific method for determining the adaptive integral weights can be determined by looking up a pre-built mapping table, or calculated using a preset function; this embodiment does not impose specific restrictions on the determination method.
[0046] S102, the integral term in the PID control law is corrected according to the adaptive integral weight, and the first steering command output by the PID control law is obtained.
[0047] The integral term can be corrected using the following formula:
[0048]
[0049] in, This is the integral term for the current control cycle; This is the integral term actually used in the previous control cycle; For adaptive integral weights; This refers to the heading angle error; To control the cycle. This formula is obtained through Adjust the magnitude of the current cycle heading angle error written into the integral term.
[0050] The output of the PID control law is obtained using the following formula:
[0051]
[0052] in, The output of the PID control law can be a rudder angle command.
[0053] S103, control the ship's course according to the first steering command.
[0054] This embodiment can be applied to controllers on ships, more specifically, to PID controllers; it can also be applied to electronic devices for simulating ship course-keeping control.
[0055] In summary, this embodiment can achieve the following beneficial effects: (1) It can reduce the influence of the integral term when the heading angle error is large or the error changes rapidly, so that the integral term does not participate in the control too early or too strongly during the rapid transition phase of the ship, thereby reducing the overshoot caused by the accumulation of the integral term. (2) It can also reduce the influence of the integral term when the actual rudder angle or actual rudder speed is close to its corresponding constraint, thereby suppressing the PID output, alleviating the problem of mismatch between the PID output and the actual executable capability of the rudder, and at the same time reducing the action burden of the rudder under large-angle turning or disturbance conditions, reducing unnecessary rudder angle energy consumption, and improving the stability of the rudder control process. (3) The integral term can change dynamically with the heading response state and the rudder constraint state. Therefore, it can still maintain adaptability and robustness when external disturbances or changes in ship model parameters occur. (4) It is still based on the PID control framework, only adding adaptive integral weight calculation in the integral adjustment link, without changing the basic closed-loop structure of the ship's automatic steering system. Therefore, this embodiment improves the control performance while maintaining the advantages of simple PID controller structure, clear parameter meaning, and easy embedding into existing automatic steering control systems.
[0056] One improvement method for addressing the integral saturation problem in traditional PID control is the fixed threshold integral separation method. This method typically determines whether the integral action is enabled or disabled based on whether the heading angle error exceeds a set threshold, with the integral action often exhibiting a 0 / 1 switch behavior. When the heading angle error enters the threshold range, the integral action may directly revert from the disabled state to the fully enabled state, easily causing abrupt changes in control action.
[0057] Therefore, in some embodiments of the present invention, the constraint corresponding to the heading angle error includes a first error threshold and a second error threshold, wherein the second error threshold is less than the first error threshold; S101 includes:
[0058] When the absolute value of the heading angle error is greater than the first error threshold, the basic error weight is set to 0.
[0059] When the absolute value of the heading angle error is less than or equal to the first error threshold and greater than the second error threshold, the error base weight gradually changes to 1 as the absolute value of the heading angle error decreases.
[0060] When the absolute value of the heading angle error is less than or equal to the second error threshold, the basic error weight is set to 1.
[0061] The adaptive integral weight is determined based on the basic error weight, the rate of change of the heading angle error, the actual rudder angle, and the actual rudder speed; when the basic error weight is 0, the adaptive integral weight is 0.
[0062] Specifically, first, a second error threshold is set. and the first error threshold Both conditions are met:
[0063]
[0064] Among them, the first error threshold and the second error threshold are adopted with respect to the heading angle error. Same unit of angle. Ensure that the basic error weights are within the small error range (0- ), transition zone ( - ) and large error region (> There are clear segmentation ranges between them.
[0065] Then, the basic error weights are calculated based on the heading angle error. :
[0066] When the absolute value of the heading angle error is greater than the first error threshold, If the value is 0, the adaptive weight is 0, thus disabling the integral effect.
[0067]
[0068] When the absolute value of the heading angle error is greater than the second error threshold and less than or equal to the first error threshold, As the absolute value of the heading angle error decreases, it gradually changes from 0 to 1 in a linear relationship, and the adaptive weight value also increases accordingly, gradually restoring the integral effect.
[0069]
[0070] When the absolute value of the heading angle error is less than or equal to the second error threshold, considering only the impact of the heading angle error, the integral action is considered as complete recovery:
[0071]
[0072] This embodiment uses a three-stage calculation method to determine the basic error weight, which allows the integral action to be turned off during large errors, gradually restored as the error decreases, and fully involved in control during small errors. Compared to the fixed threshold integral separation method, this approach avoids the integral action from jumping directly from 0 to 1.
[0073] In some embodiments of the present invention, the step of determining the adaptive integral weight based on the error base weight, the rate of change of the heading angle error, the actual rudder angle, and the actual rudder speed includes:
[0074] Based on the rate of change of heading angle error, determine the normalization index of the rate of change of error, and determine the attenuation factor of the rate of change of error based on the normalization index of the rate of change of error.
[0075] Based on the actual rudder angle and its corresponding constraints, determine the rudder angle saturation level, and then determine the rudder angle constraint attenuation factor based on the rudder angle saturation level.
[0076] Based on the actual rudder speed and its corresponding constraints, determine the degree of rudder speed constraint, and then determine the rudder speed constraint attenuation factor based on the degree of rudder speed constraint.
[0077] The adaptive integral weight is obtained by multiplying the basic error weight, the error rate of change attenuation factor, the rudder angle constraint attenuation factor, and the rudder speed constraint attenuation factor together and then limiting the range of their values.
[0078] Specifically, the larger the normalized index of the error change rate, the smaller the error change rate decay factor. The mapping relationship between the two can be achieved through piecewise functions, lookup table functions, fuzzy rules, or other monotonically decaying functions. This embodiment does not impose specific restrictions on the way this mapping relationship is expressed.
[0079] Similarly, the degree of rudder angle saturation is negatively correlated with the rudder angle constraint attenuation factor, and the degree of rudder speed constraint is negatively correlated with the rudder speed constraint attenuation factor. The mapping relationship is constructed with reference to the above-mentioned error change rate normalization index and error change rate attenuation factor.
[0080] In one example, refer to Figure 2 The process of calculating each decay factor using a monotonically decaying function, and calculating the adaptive integral weight based on each decay factor, is as follows:
[0081] Define rudder angle saturation level:
[0082]
[0083] in, The rudder angle saturation level is the k-th control cycle; min(·) is a function that takes the smaller value. This is the actual rudder angle; This is the maximum permissible rudder angle. It is limited to [0,1], and the closer its value is to 1, the closer the actual rudder angle is to or has reached the rudder angle limit.
[0084] Define the degree of rudder speed constraint:
[0085]
[0086] in, The degree of rudder speed constraint in the k-th control cycle; This is the actual rudder speed; The maximum permissible rudder speed; min(·) is used to limit the result to no more than 1. The closer it is to 1, the closer the servo motor's movement speed is to the servo speed constraint.
[0087] Define the normalized index of error rate of change:
[0088]
[0089] in, This is a normalized index for the rate of change of error; This represents the rate of change of heading angle error; As the normalization benchmark for the rate of change of error, the units are... same; Used to limit the index to [0,1]. The larger the value, the faster the current heading angle error changes.
[0090] Calculate the error rate of change decay factor based on the error rate of change normalization index:
[0091]
[0092] in, The error rate of change weighting coefficient satisfies:
[0093] in, This is the error rate attenuation factor; This is the weighting coefficient for the rate of change of error; This is a normalized index for the rate of change of error. (Constraints) ensure It decreases as the error changes more rapidly, while remaining within the range of [0,1].
[0094] When the rate of change of error is large Reduce this to decrease the integral effect during the system's rapid transition phase.
[0095] Calculate the rudder angle constraint attenuation factor based on the rudder angle saturation level:
[0096]
[0097] in, The rudder angle constraint weighting coefficient satisfies:
[0098] in, This is the rudder angle constraint attenuation factor; This refers to the rudder angle constraint weighting coefficient. This represents the saturation level of the rudder angle. Constraint: 0 ≤ ≤1 ensures that the integral weight is smaller as the rudder angle gets closer to the limit, and avoids the attenuation factor from becoming negative.
[0099] When the actual rudder angle is close to the maximum rudder angle limit The integral effect is reduced to prevent it from continuing to increase and causing a mismatch between the controller output and the actual execution capability of the servo.
[0100] Calculate the rudder speed constraint attenuation factor based on the degree of rudder speed constraint:
[0101]
[0102] in, The rudder speed constraint weighting coefficient satisfies:
[0103] in, The rudder speed constraint attenuation factor; This is the weighting coefficient for the rudder speed constraint; The degree of constraint on rudder speed. The integral effect is weakened as the actual rudder speed approaches the upper limit.
[0104] When the servo motor's movement speed approaches the maximum servo speed Reduce the speed to avoid excessively violent servo movements.
[0105] Calculate the adaptive integral weights:
[0106] Calculate the adaptive integral weights based on the basic error weights, the error rate of change attenuation factor, the rudder angle constraint attenuation factor, and the rudder speed constraint attenuation factor:
[0107]
[0108]
[0109] Adaptive integral weights satisfy:
[0110] in, The adaptive integral weight for the k-th control cycle; , , and These are the basic error weight, the error rate of change attenuation factor, the rudder angle constraint attenuation factor, and the rudder speed constraint attenuation factor, respectively; max(0,·) and min(1,·) together restrict the adaptive integral weight within [0,1]. The final integral weight can be reduced when any state variable approaches the constraint.
[0111] In summary, when the heading angle error is large, the error changes rapidly, the actual rudder angle is close to saturation, or the actual rudder speed is close to the constraint, Automatic descent; when the heading angle error is small, the error change is gradual, and the servo motor still has an operational margin. Gradually recovering. This achieves adaptive adjustment of the integral action.
[0112] In some embodiments of the present invention, in addition to using product-type integral weights, adaptive integral weights can also be calculated using exponential functions:
[0113]
[0114] in, This is a natural exponential function; a, b, c, and d are all positive weighting coefficients; where a is in the reciprocal of the heading angle unit to ensure the exponential term is dimensionless, and b, c, and d are dimensionless coefficients used for adjustment. , , and The importance of; , , and These represent the absolute value of the heading error, the normalized index of the error change rate, the degree of rudder angle saturation, and the degree of rudder speed constraint, respectively. , , and Increasing any parameter in the equation will reduce the integral weight through exponential decay.
[0115] Some existing methods for preventing integral saturation freeze the integral directly when the output is saturated, without distinguishing whether the integral term helps the system escape saturation. This approach may lead to excessive integral freezing, affecting the system's recovery speed.
[0116] Therefore, in some embodiments of the present invention, S103 includes:
[0117] Limit the amplitude of the first steering command to obtain the amplitude-limited candidate output;
[0118] Subtract the amplitude-limiting candidate output from the first steering command to obtain the signed saturation difference, and use the product of the saturation difference and the heading angle error as the directional saturation criterion.
[0119] When the directional saturation criterion is greater than 0, the integral term of the previous control cycle is kept unchanged, and the PID control law is recalculated based on the retained integral term to obtain the second steering command. The second steering command is then limited to generate the command rudder angle.
[0120] When the directional saturation criterion is less than or equal to 0, the amplitude limiting candidate output is used as the command rudder angle;
[0121] The ship's course is controlled by the commanded rudder angle.
[0122] Specifically, refer to Figure 3 The first steering command, that is This is used to determine whether the PID requirement exceeds the servo motor's executable range.
[0123] right Perform rudder angle limiting to obtain candidate outputs for limiting:
[0124]
[0125] in, For the first steering command Candidate output after applying rudder angle limiting; It is a saturation function; This is the maximum permissible rudder angle. This indicates the acceptable candidate commands under the servo angle constraint.
[0126] Calculate the saturation difference:
[0127]
[0128] in, This represents the saturation difference. When... =0 indicates that no rudder angle limiting has occurred; when When ≠0, its symbol indicates the direction of the control output exceeding the limit.
[0129] Calculate the directional saturation criterion:
[0130]
[0131] in, This serves as a directional saturation criterion. This represents the saturation difference. This represents the heading angle error. The sign of the product of the two is used to determine whether the heading angle error is still driving the control output towards deeper saturation.
[0132] If the following conditions are met: This indicates that the direction of the current unlimited control output exceeding the limit is consistent with the direction of the heading angle error. Continuing to update the integral will push the control output towards deeper saturation. At this point, the integral state is frozen (integral term is frozen). Substituting the frozen integral state into the PID control law yields the second steering command output by the PID control law. It should be noted that parameters such as the heading angle error in the PID control law are still updated normally; only the integral state is frozen.
[0133] Among them, when When the value is greater than 0, the saturation difference is in the same direction as the heading angle error; continuing to write into the integral term will deepen the saturation. Therefore, let... This means maintaining the integral state of the previous control cycle and implementing directional anti-saturation freezing.
[0134] If the following conditions are met: This indicates that the control output is not saturated, or that the heading angle error direction helps the control output exit saturation. In this case, integral update or backoff is allowed. .
[0135] Among them, when When ≤0, the control output is not saturated, or the current error direction helps to exit saturation; therefore, let It accepts the corrected integral state as described above, allowing the integral to be updated normally or to roll back in the direction of exiting saturation.
[0136] Calculate the current unlimited control output based on the updated integral state, when... At that time, it was the second steering command. At that time, it was the first steering command:
[0137]
[0138] in, To adopt the final integration state Recalculated unlimited PID output; , , , and The meaning is the same as the definition above. This formula is used to generate the current unlimited control output after completing the directional anti-saturation judgment.
[0139] Limit the rudder angle of the current unlimited control output to generate a command rudder angle:
[0140]
[0141] in, The final restricted command rudder angle; This is the current output without amplitude limiting control; Maximum permissible rudder angle; This is the rudder angle limiting function. As input to the servo actuator.
[0142] In summary, this embodiment constructs a directional saturation criterion. ,when When this occurs, it indicates that the error is still driving the control output towards deeper saturation; at this point, the integral is frozen. When the direction of error is not saturated, it indicates that the output is not saturated or that the error direction is conducive to exiting saturation. In this case, integral updates or rollbacks are allowed. Through this directional judgment, this embodiment can more accurately distinguish between the two states of "continuing to push for saturation" and "conducive to exiting saturation", avoiding unnecessary integral freezing and improving the system's ability to recover from a rudder angle-limited state.
[0143] In some embodiments of the present invention, the method further includes:
[0144] Before calculating the directional saturation criterion, a directional correction coefficient is set in advance based on whether the positive direction of the rudder angle is consistent with the positive direction of the heading angle error; when they are consistent, the directional correction coefficient is +1, and when they are inconsistent, the directional correction coefficient is -1.
[0145] The steps for using the product of the saturation difference and the heading angle error as the directional saturation criterion include:
[0146] The product of the direction correction factor, the saturation difference, and the heading angle error is used as the directional saturation criterion.
[0147] Specifically, the heading angle error can be positive or negative, and its sign indicates the direction; a positive value indicates the positive direction. For example, a heading angle error of 10° means that the correction direction is 10° to the right, which is 10° in the positive direction.
[0148] Rudder angles can be positive or negative, with the sign indicating direction; a positive value indicates the positive direction. For example, a 10° right rudder means turning the rudder 10° to the right. In this case, the direction of the rudder turn is consistent with the correction method, meaning the positive direction of the rudder angle is consistent with the positive direction of the heading angle error.
[0149] The direction correction factor is a predetermined sign coefficient: +1 is taken when the positive direction of the rudder angle is consistent with the positive direction of the heading angle error, and -1 is taken when they are inconsistent; the direction correction factor is multiplied by the saturation difference and the heading angle error to obtain the directionality saturation criterion under the unified sign convention.
[0150] In some embodiments of the present invention, the method further includes:
[0151] Within the current control cycle, the discrete command rudder angle generated by the amplitude limit is converted into a continuous signal and input to the pre-built servo model, which then generates the actual rudder angle in continuous time.
[0152] The actual rudder angles over continuous time are simultaneously input into the ship's heading response model, and the actual rudder angle, turning angular velocity, and heading angle are obtained at the next sampling time for use in the next control cycle.
[0153] Specifically, the controller will command the rudder angle Input the servo model. The servo model is in the control range [t]. k ,t (k+1) The continuous actual rudder angle δ(t) is generated within the time interval, and at the next sampling time t (k+1) The discrete actual rudder angle δ(k+1) is obtained. The servo model can be a first-order inertial model, or a servo model containing dead zone, hysteresis, rudder speed limit, rudder angle limit, or servo element. Any model that can provide the actual rudder angle and rudder angle change rate can be used in this invention. In one example, the servo model is a first-order inertial model, expressed as follows:
[0154]
[0155] And satisfy: and .
[0156] in, Servo time constant, in seconds; The actual rudder angle over a continuous time period t; This represents the rate of change of the actual rudder angle with respect to time. This is the final constrained command rudder angle output by the controller. This equation describes the dynamic lag between the command rudder angle and the actual rudder angle using a first-order inertial element.
[0157] The servo motor first commands the rudder angle according to the first-order inertial dynamic response, and then simultaneously satisfies the constraints of maximum rudder angle and maximum rudder speed, resulting in... That is the actual rudder angle acting on the ship model.
[0158] The value at the next sampling time is recorded as δ(k+1) and fed back to the controller to enter the calculation of the next control cycle, thus forming a closed-loop heading hold control.
[0159] To distinguish between adjacent control cycles, in discrete control implementation, the sampling time t is... k and t (k+1) The states are denoted as δ(k), r(k), ψ(k) and δ(k+1), r(k+1), ψ(k+1), respectively. The controller at sampling time t... k Output discrete command rudder angle The command generates a continuous command rudder angle through a discrete-continuous first-order hold process. and in the control interval [t k ,t (k+1)Input the servo motor model; the servo motor model generates continuous actual rudder angles δ(t), which simultaneously affect the ship's heading response model. Reach sampling time t. (k+1) At that time, δ(k+1), r(k+1), and ψ(k+1) are sampled respectively and fed back to the controller for calculation in the next control cycle. The signal is a continuous-time command signal, where δ(t), r(t), and ψ(t) are continuous-time states, and δ(k), r(k), and ψ(k) are discrete values at the corresponding sampling times.
[0160] The ship's heading response model can be a first-order Nomoto model, a second-order Nomoto model, a ship response model identified through experiments, a simplified model from the Mathematical Modeling Group (MMG), or other ship motion models that can describe the relationship between rudder angle and heading response. The Nomoto model (also known as the Nomoto model or a first-order linear ship maneuvering model) is a first-order linear response model describing a ship's turning motion in the horizontal plane. It simplifies the ship's maneuverability to a first-order hysteresis response of the bow roll rate to the rudder angle.
[0161] In one example, the ship's heading response model is a first-order Nomoto model, expressed as follows:
[0162]
[0163]
[0164] Where T is the ship following index or time constant, in seconds; This refers to the angular acceleration during bow turning; ω is the ship's bow turning angular velocity; K is the ship's yaw gain; This is the actual rudder angle; The external equivalent disturbances, calculated and normalized to the bow angular velocity channel by factors such as wind, waves, and currents, have the same dimensions as the bow angular velocity. The two equations describe the low-frequency dynamics from rudder angle to bow angular velocity and the integral relationship from bow angular velocity to heading angle, respectively.
[0165] The first formula calculates the bow dynamics based on the actual rudder angle and external disturbances, while the second formula integrates the bow angular velocity to obtain the actual heading, thus forming a closed-loop feedback.
[0166] The transfer function from rudder angle to bow angular velocity in the first-order Nomoto model, neglecting disturbances, can be further rewritten as:
[0167]
[0168] Where s is the complex variable of the Laplace transform; and These are the bow angular velocities. Compared with actual rudder angle The Laplace transform of the transfer function; K is the cyclotronic gain. This transfer function represents the first-order inertial response from rudder angle to bow angular velocity when external disturbances are ignored.
[0169] The transfer function from rudder angle to heading angle is:
[0170]
[0171] in, Actual heading angle The Laplace transform of ; s is the complex variable of the Laplace transform. In the denominator... This indicates that the heading angle is the integral result of the turning angular velocity.
[0172] Actual heading calculated using the ship heading response model Feedback is sent to the controller to begin calculations for the next control cycle, thus forming a closed-loop heading hold control.
[0173] This embodiment can be applied to simulation experiments of ship heading control. Actual rudder angles and headings are not obtained from sensors on the ship, but rather through iterative updates between the rudder model and the ship heading response model. The rudder actuator, the ship heading response model, and their closed-loop feedback relationship can be specifically represented in the Simulink simulation model, as shown in the Simulink simulation model. Figure 4 As shown.
[0174] The invention will be illustrated below using a specific simulation experiment as an example:
[0175] The ship's heading response model uses a first-order Nomoto model, the servo motor model uses a first-order inertial model, and the control system uses a closed-loop simulation model built with MATLAB / Simulink. In the simulation, the following can be considered: , , , , .
[0176] Where K=0.08 is the ship yaw gain used in this embodiment; The ship's time constant; The servo time constant; Maximum permissible rudder angle; The above values represent the maximum permissible rudder speed. These values are used to construct a simulation example and do not limit the application of this invention to other ship types and rudder parameters.
[0177] Possible PID parameters: , , .
[0178] in, , and These represent the proportional, integral, and derivative gains used in the simulation examples. These three factors together determine the strength of instantaneous error correction, steady-state deviation elimination, and error variation suppression.
[0179] The adaptive integral weight parameters can be:
[0180] in, and These are the second error threshold and the first error threshold, respectively. This serves as the benchmark for normalizing the rate of change of error; , and These are the error change rate, rudder angle constraint, and rudder speed constraint attenuation coefficient, respectively. These parameters are used to form the continuous integral weight change in the embodiment.
[0181] The above parameters can be adjusted according to the specific ship type, steering gear performance, speed and control quality requirements.
[0182] In simulation verification, various operating conditions can be set, including no-disturbance step, sinusoidal-disturbance step, random-disturbance step, large-angle directional change, and model parameter perturbation. Simulation results can be used to verify the effectiveness of this invention in reducing heading overshoot, improving integral recovery smoothness, reducing rudder angle energy, and enhancing adaptability to parameter changes. A comparison of heading responses under parameter perturbation conditions is provided. Figure 5 As shown; the integral weight changes under parameter perturbation conditions are as follows: Figure 6 As shown, the comprehensive performance comparison of fixed-threshold PID and adaptive integral weight PID under parameter perturbation conditions is as follows: Figure 7 As shown; the integral shutdown duration of the two improved PID controllers under five operating conditions is compared, for example... Figure 8 As shown.
[0183] Reference Figure 5(a) Under the parameter perturbation condition with a 20% increase in the ship's time constant T, the settling times of the traditional PID, fixed threshold PID, and adaptive integral weight PID are 430.6 s, 303.5 s, and 282.1 s, respectively, and the steady-state errors are 0.032086°, 0.006435°, and 0.003326°, respectively. Compared with the traditional PID, both improved PIDs significantly reduce the steady-state deviation and shorten the settling process; compared with the fixed threshold PID, the adaptive integral weight PID shortens the settling time by 7.05% and reduces the steady-state error by 48.32%. Figure 5 (b) shows a magnified view of 250–400 s to illustrate the error evolution in the later stage of the response. The traditional PID has not yet fully entered steady state at the end of this interval. The steady-state error marked in the figure comes from the statistical window at the end of the simulation. Figure 6 The integral weight curve also shows that the fixed threshold PID uses a switching mode of 0 or 1, while the integral weight of the present invention recovers continuously in the range of [0,1], which is beneficial to reduce the sudden changes when the integral is reinvested.
[0184] Reference Figure 7 With the corresponding index of the fixed-threshold PID as 100%, the adjustment time, steady-state error, and rudder angle energy index of the present invention under parameter perturbation conditions are 92.95%, 51.68%, and 99.61%, respectively. Therefore, the main improvement of the present invention lies in the adjustment time and steady-state error; the rudder angle energy index is basically equivalent to that of the fixed-threshold PID. However, this does not constitute a claim that the present invention is superior to the fixed-threshold PID in all individual indicators.
[0185] Reference Figure 8 Under five operating conditions, the integral off-duration of the fixed-threshold PID and the adaptive integral weight PID decreased from 62.5 s to 45.7 s, 61.1 s to 45.0 s, 62.5 s to 45.7 s, 72.1 s to 58.8 s, and 65.4 s to 48.6 s, respectively, representing a reduction of 18.4% to 26.9%. Here, the integral off-duration corresponds to the integral off-duration index (IntegralDisableDuration), which represents the time during which the integral action is turned off or significantly weakened due to integral separation or low integral weight, and does not represent the anti-saturation freeze time of directional conditions; the anti-saturation capability of directional conditions should be analyzed in conjunction with the anti-saturation freeze duration index (AntiWindupFreezeDuration). Traditional PID does not contain integral separation and adaptive integral weight mechanisms, and its integral off-duration index (IntegralDisableDuration) is defined as 0, therefore it is not included. Figure 8 Compare.
[0186] Reference Figure 9This diagram illustrates a structural schematic of an embodiment of the ship heading adaptive PID control system under rudder constraints provided by the present invention. The system 900 includes:
[0187] The adaptive integral weight calculation module 901 is used to determine the adaptive integral weight based on the ship's state variables in the current control cycle; wherein, the state variables include: heading angle error, rate of change of heading angle error, actual rudder angle, and actual rudder speed; the closer any of the state variables is to its corresponding constraint, the smaller the adaptive integral weight;
[0188] The PID control module 902 is used to correct the integral term in the PID control law according to the adaptive integral weight, and obtain the first steering command output by the PID control law.
[0189] The execution module 903 is used to control the course of the ship according to the first steering command.
[0190] In one embodiment, system 900 further includes:
[0191] The target heading input module is used to acquire or set the target heading. The target heading can be set by the pilot or output by the ship's trajectory planning system, navigation system, or upper control system.
[0192] The actual heading measurement module is used to obtain the ship's actual heading. The actual heading can be obtained by a compass, inertial navigation system, satellite navigation system, or other heading measurement devices.
[0193] The heading error calculation module is used to calculate the heading angle error based on the target heading angle and the actual heading angle, and to calculate the error change rate based on the heading angle error of adjacent control cycles.
[0194] The servo status evaluation module is used to calculate the degree of servo angle saturation and the degree of servo speed constraint based on the actual servo angle, the actual servo angle change rate, the maximum servo angle, and the maximum servo speed.
[0195] Execution module 903 includes:
[0196] The directional conditional integral anti-saturation module is used to determine whether to freeze the integral state based on unlimited output, limited output, and heading error. Integral integration is frozen when the direction of the control output exceeding the limit coincides with the direction of the heading error; integral updates or rollback are allowed when the control output is not saturated, or when the error direction helps to exit saturation.
[0197] The servo actuator module is used to output the actual servo angle according to the commanded servo angle, and to simulate the servo inertia, maximum servo angle limit and maximum servo speed limit.
[0198] The ship heading response module is used to calculate the ship's bow turning angular velocity and actual heading based on the actual rudder angle and equivalent external disturbances, and to feed the actual heading back to the heading error calculation module.
[0199] Reference Figure 10 This diagram illustrates another ship heading adaptive PID control system under rudder constraints provided by the present invention. The control process of the control system is as described above.
[0200] It should be noted that the implementation principles or processes of the above modules can be referred to the aforementioned implementation examples of the ship heading adaptive PID control method under steering gear constraints, and will not be elaborated here.
[0201] In one embodiment, the present invention also provides a controller, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, it implements the above-described adaptive PID control method for ship heading under rudder constraints.
[0202] In one embodiment, the present invention also provides a vessel including the controller described above. The vessel further includes an actuator for controlling the vessel's course in response to the output of the controller.
[0203] In one embodiment, the present invention also provides a computer-readable storage medium storing a computer program that, when executed by the processor, implements the steps of any of the above-described adaptive PID control methods for ship heading under servo constraints.
[0204] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.
[0205] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for adaptive PID control of ship heading under rudder constraints, characterized in that, include: The adaptive integral weight is determined based on the ship's state variables in the current control cycle; wherein, the state variables include: heading angle error, rate of change of heading angle error, actual rudder angle, and actual rudder speed; the closer any of the state variables is to its corresponding constraint, the smaller the adaptive integral weight; The integral term in the PID control law is corrected according to the adaptive integral weight, and the first steering command output by the PID control law is obtained. The course of the vessel is controlled according to the first steering command.
2. The adaptive PID control method for ship heading under steering gear constraints according to claim 1, characterized in that, The constraints corresponding to the heading angle error include a first error threshold and a second error threshold, wherein the second error threshold is less than the first error threshold. The process of determining adaptive integral weights based on the ship's state variables in the current control cycle includes: When the absolute value of the heading angle error is greater than the first error threshold, the error base weight is determined to be 0. When the absolute value of the heading angle error is less than or equal to the first error threshold and greater than the second error threshold, the error base weight gradually changes to 1 as the absolute value of the heading angle error decreases. When the absolute value of the heading angle error is less than or equal to the second error threshold, the error base weight is determined to be 1. The adaptive integral weight is determined based on the error base weight, the rate of change of the heading angle error, the actual rudder angle, and the actual rudder speed; wherein, when the error base weight is 0, the adaptive integral weight is 0.
3. The adaptive PID control method for ship heading under steering gear constraints according to claim 2, characterized in that, The step of determining the adaptive integral weights based on the error base weights, the rate of change of the heading angle error, the actual rudder angle, and the actual rudder speed includes: Based on the rate of change of heading angle error, a normalization index for the rate of change of error is determined, and an error rate of change attenuation factor is determined based on the normalization index for the rate of change of error. Based on the actual rudder angle and its corresponding constraints, determine the rudder angle saturation level, and then determine the rudder angle constraint attenuation factor based on the rudder angle saturation level. Based on the actual rudder speed and its corresponding constraints, determine the degree of rudder speed constraint, and determine the rudder speed constraint attenuation factor based on the degree of rudder speed constraint. The adaptive integral weight is obtained by multiplying the error base weight, the error rate of change attenuation factor, the rudder angle constraint attenuation factor, and the rudder speed constraint attenuation factor together and then limiting the range of their values.
4. The adaptive PID control method for ship heading under steering gear constraints according to claim 3, characterized in that, The step of determining the error rate of change attenuation factor based on the error rate of change normalization index includes: The error rate of change attenuation factor is calculated using the following formula: in, This is the error rate of change attenuation factor; This is the weighting coefficient for the rate of change of error; This is a normalized index for the rate of change of error; The determination of the rudder angle constraint attenuation factor based on the rudder angle saturation degree includes: The rudder angle constraint attenuation factor is calculated using the following formula: in, The rudder angle constraint attenuation factor; This refers to the rudder angle constraint weighting coefficient; The degree of rudder angle saturation; The step of determining the rudder speed constraint attenuation factor based on the degree of rudder speed constraint includes: The rudder speed constraint attenuation factor is calculated using the following formula: in, The rudder speed constraint attenuation factor; This is the weighting coefficient for the rudder speed constraint; The degree of rudder speed constraint; the error change rate weighting coefficient, the rudder angle constraint weighting coefficient, and the rudder speed constraint weighting coefficient are all greater than or equal to 0 and less than or equal to 1.
5. The adaptive PID control method for ship heading under steering gear constraints according to claim 1, characterized in that, The control of the ship's course according to the first steering command includes: The first steering command is limited to obtain a limited candidate output. Subtract the amplitude-limiting candidate output from the first steering command to obtain a signed saturation difference, and use the product of the saturation difference and the heading angle error as the directional saturation criterion. When the directional saturation criterion is greater than 0, the integral term of the previous control cycle is kept unchanged, and the PID control law is recalculated based on the retained integral term to obtain the second steering command. The second steering command is then limited to generate the command rudder angle. When the directional saturation criterion is less than or equal to 0, the amplitude limiting candidate output is used as the command rudder angle; The ship's course is controlled according to the commanded rudder angle.
6. The adaptive PID control method for ship heading under steering gear constraints according to claim 5, characterized in that, The method further includes: Before calculating the directional saturation criterion, a directional correction coefficient is set in advance based on whether the positive direction of the rudder angle is consistent with the positive direction of the heading angle error; when they are consistent, the directional correction coefficient is +1, and when they are inconsistent, the directional correction coefficient is -1. The step of using the product of the saturation difference and the heading angle error as the directional saturation criterion includes: The product of the direction correction coefficient, the saturation difference, and the heading angle error is used as the directional saturation criterion.
7. The adaptive PID control method for ship heading under steering gear constraints according to claim 5, characterized in that, The method further includes: Within the current control cycle, the discrete command rudder angle is converted into a continuous signal and then input to the pre-built servo model, so that the servo model outputs the actual rudder angle in continuous time. The actual rudder angles under the continuous time are simultaneously input into the pre-built ship heading response model, and the actual rudder angle, turning angular velocity and heading angle are obtained at the next sampling time for use in the next control cycle.
8. A ship heading adaptive PID control system under rudder constraints, characterized in that, include: An adaptive integral weight calculation module is used to determine the adaptive integral weight based on the ship's state variables in the current control cycle; wherein, the state variables include: heading angle error, rate of change of heading angle error, actual rudder angle, and actual rudder speed; the closer any of the state variables is to its corresponding constraint, the smaller the adaptive integral weight; The PID control module is used to correct the integral term in the PID control law according to the adaptive integral weight, and to obtain the first steering command output by the PID control law. An execution module is used to control the course of the vessel according to the first steering command.
9. A controller, characterized in that, The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the ship heading adaptive PID control method under steering gear constraints as described in any one of claims 1 to 6.
10. A ship, characterized in that, Includes the controller as described in claim 9.
