Main Content

Design Optimization Using Lookup Table Requirements for Gain Scheduling (GUI)

This example shows how to tune parameters in a lookup table in a model that uses gain scheduling to adjust the controller's response to a plant that varies. Model tuning uses theResponse Optimizer应用程序。

Ship Steering Model

Open the Simulink® model.

open_system('sdoShipSteering')

This model implements the Nomoto model which is commonly used for ship steering. The dynamic characteristics of a ship vary significantly with factors such as the ship speed. Therefore the rudder controller should also vary with speed, in order to meet requirements for steering the ship.

To keep the ship on course, a control loop compares the ship's heading angle with the reference heading angle, and a PD controller sends command signals to the rudder. The Ship Plant block implements the Nomoto model, a second order system whose parameters vary with the ship's speed. The ship is initially traveling at its maximum speed of 15 m/s, but it will slow down when the reference trajectory specifies a turn in the water. This turning, along with the force of the engine, is used by the Force Dynamics block to compute the speed of the ship over time. The Kinematics block computes the trajectory of the ship.

Open the Controller block by double clicking it.

When the speed changes, the ship plant also changes. Therefore the PD controller gains need to change, and speed is used as the scheduling variable. The controller is in the formK(1 + sTd)whereKis the overall gain andTdis the time constant associated with the derivative term. Gain scheduling is implemented using lookup tables, and the table data are specified byKandTd. These are vectors which specify different values for different speeds. The different speeds are specified in the lookup table breakpoint vectorsbpKandbpTd.

Design Problem

The reference specifies that at 200 seconds, the ship should turn 180 degrees and reverse course. One requirement is that the ship heading angle needs to match the reference heading angle within an envelope. For the safety and comfort of passengers, a second requirement is that the total acceleration of the ship needs to stay within a bound of 0.25 g's, where 1 g is the acceleration of gravity at Earth's surface, 9.8 m/s^2.

The controller parameter vectorsKandTdwill be design variables, and will be tuned to try to meet the requirements. If it is not possible to meet both requirements, then the lookup table breakpointsbpKandbpTdwill also be used as design variables. In that case, we will need to specify an additional requirement thatbpKandbpTdmust be monotonically strictly increasing, because this is required for breakpoint vectors in Simulink lookup tables.

Open the Response Optimizer

In theAppstab, clickResponse OptimizerunderControl Systems.

指定设计要求

指定的要求which must be satisfied. First, the ship should follow the reference trajectory. Since the reference is essentially a step change from 0 to 180 degrees, you specify a step response envelope for the ship heading angle. In the toolstrip, clickNewand selectStep Response Envelope. Set the initial value to 0 and the final value to pi radians. Set the step time to 200 seconds. Set the rise time as 75 seconds and the rise percent to 85%. Set the settling time to 200 seconds and the settling percent to 1%. Set the percent overshoot to 5%. To specify that this requirement applies to the ship heading, click +.

In the Simulink model click the ship heading signal, which is the output of theShip Plantblock. Select this signal in the Create Signal Set dialog, and click the arrow button to make it the designated signal, and click OK.

The second requirement is that for the safety and comfort of passengers, the total acceleration should not exceed 0.25 g's at any time. The total acceleration is composed of two components, a tangential component along the direction of the ship's motion, and a normal (horizontal) component. The requirement that total acceleration not exceed 0.25 g's corresponds to requiring that in the phase plane of tangential and normal acceleration, this ship's trajectory remain within a circle of radius 0.25*9.8.

In the toolstrip, clickNewand selectEllipse Region Constraint. Specify the name asSafeAccel, and the semi-axis length for both signals as 0.25*9.8 = 2.45. To specify that the requirement applies to the tangential acceleration of the ship, click theSelectbutton. In the Simulink model click the tangential acceleration signal, which is output from theKinematicsblock. Select this signal in the Create Signal Set dialog, and click the arrow button to make it the designated signal, and click OK. Similarly, to specify that the requirement applies to the normal acceleration of the ship, in the Ellipse Region Constraint dialog click the other Select button, and use the Create Signal Set dialog to specify the normal acceleration signal.

Specify Design Variables

Specify the design variables to be tuned by the optimization in order to satisfy the requirements. In the toolstrip, click the selection box next toDesign Variables Setand then clickNew. Select the gains of the PD controller,KandTd, and click the arrow button to designate them as design variables. Use -0.1 for all entries in the value of theKvector, and use 50 for all entries in the value of theTdvector, and click OK. If the requirements can't all be satisfied, then later the breakpoint vectorsbpKandbpTdcan also be tried as design variables.

Optimize Lookup Table Data

During optimization, the Simulink solver may generate a warning if the size of the time step becomes too small. Temporarily suppress this warning.

warnState = warning('query','Simulink:Engine:SolverMinStepSizeWarn'); warning('off','Simulink:Engine:SolverMinStepSizeWarn');

In theResponse Optimizer, clickOptimize. The ship heading angle does not meet the required step response envelope, as can be seen in the step response plot in theResponse Optimizerapp and in the Optimization Progress dialog, where the value at the last iteration is still positive, which indicates violation of the requirement. The requirement for safe acceleration is also not met, as seen in the Optimization Progress dialog, where the value at the last iteration is also positive.

Optimize Lookup Table Data and Breakpoints

To try to meet the design requirements, use the optimization result from above as the start point, and tune additional variables. Add breakpointsbpKandbpTdas design variables. The ship's maximum speed is 15 m/s, and during turning it may slow to 60% of the maximum speed, or 9 m/s. Set the breakpoint initial values to be equally spaced between 9 and 15 m/s. Constrain the breakpoint minimum values to 9 m/s, and constrain the breakpoint maximum values to 15 m/s.

Breakpoints in the Simulink lookup table block must be strictly monotonically increasing. Add this to the design requirements.

In theResponse Optimizer, clickOptimize. This time the ship heading angle meets the required step response envelope, as can be seen in the step response plot inResponse Optimizerapp and in the Optimization Progress dialog, where the value at the last iteration is negative, which indicates the requirement is satisfied. The requirement for safe acceleration is also satisfied, as seen in the Optimization Progress dialog, where the value at the last iteration is also negative. Similarly, the lookup table breakpoints satisfy the monotonic requirements.

在这个例子中,这艘船与sh植物多种多样ip speed, so the controller gains also needed to vary. Gain scheduling was implemented using lookup tables. By tuning the gains and breakpoint values in the controller, the ship was able to follow the reference heading angle, while also constraining total acceleration to ensure a safe and comfortable ride for passengers.

Related Examples

To learn how to optimize the lookup tables in the gain scheduled controller using thesdo.optimizecommand, seeDesign Optimization Using Lookup Table Requirements for Gain Scheduling (Code).

% Close the model and restore state of warnings.bdclose('sdoShipSteering') warning(warnState);% restore state of warning

Related Topics