Simulink Control Design™ - MathWorks

(Tuis.) #1
and output arguments:


  • c_ineq - Inequality constraints which must satisfy c_ineq <= 0 during trimming,
    returned as a vector.

  • c_eq - Equality constraints which must satisfy c_eq = 0 during trimming, returned
    as a vector.


Each element of c_ineq and c_eq specifies a single constraint. Define the specific
constraints for your application as algebraic combinations of the states, inputs, and
outputs. If there are no custom equality or inequality constraints, return the
corresponding output argument as [].

For this example, to satisfy the conditions of the expected steady state, define the
following custom constraint function.

function [c_ineq,c_eq] = myConstraints(x,u,y)
c_ineq = [];
c_eq = [x(2)-x(3); % Tank1 pressure - Tank2 pressure
x(3)-x(4)+1]; % Tank2 pressure - Tank3 pressure + 1
end

The first entry of c_eq constrains the pressures of Tank1 and Tank2 to be the same value.
The second equality constraint defines the pressure drop between Tank2 and Tank3.

Add the custom constraint function to the operating point specification.

opspec.CustomConstrFcn = @myConstraints;

Trim the model using the revised operating point specification that contains the custom
constraints, and view the trimmed state values.

[op1,rpt1] = findop(mdl,opspec,opt);
op1.States

(1.) scdTanks/Inertia
x: 0
(2.) scdTanks/Tank1
x: 9.33
(3.) scdTanks/Tank2
x: 9.33
(4.) scdTanks/Tank3
x: 10.3

1 Steady-State Operating Points

Free download pdf