fmincon PI-controller of nonlinear System

4 次查看(过去 30 天)
Hi!
I want to optimize two PI-controllers of my simulink model(high nonlinear). I have several constrains of my nonlinear sytem, but I don't know how to insert these into 'fmincon'.
This is my optimization functinon:
function y = fun(x)
% Set parameter of PI- controller of the force
set_param('Sim_10_01/CF/KpF', 'Gain', 'x(1)');
set_param('Sim_10_01/CF/TiF', 'Gain', 'x(2)');
% Set parameter of PI-controller of the pressure
set_param('Sim_10_01/Cp/Kpp', 'Gain', 'x(3)');
set_param('Sim_10_01/Cp/Tip', 'Gain', 'x(4)');
sim('Sim_10_01','SrcWorkspace','current');
y = [moment force pressure acceleration];
I want to optimize the parameters of both PI-controllers for the same output 'acceleration' in relation of the constrains of the moment, force and pressure.
My issue now: I don't know how to insert those constrains, due they are not dependent on x(well somehow yes, but I don't have any mathematical evidence). In fact those constrains have a scalar min- maximum, such for example. -1kN <= force <= 15kN.
Can fmincon handle a vector returning of my fun.m ?
Any idea's?
Thank you!

采纳的回答

Alan Weiss
Alan Weiss 2014-10-2
You can include constraints on acceleration as nonlinear constraints. For example, if you want acceleration to be less than 5, your function would be something like
function [c,ceq] = mynlconst(x)
ceq = [];
% Set parameter of PI- controller of the force
set_param('Sim_10_01/CF/KpF', 'Gain', 'x(1)');
set_param('Sim_10_01/CF/TiF', 'Gain', 'x(2)');
% Set parameter of PI-controller of the pressure
set_param('Sim_10_01/Cp/Kpp', 'Gain', 'x(3)');
set_param('Sim_10_01/Cp/Tip', 'Gain', 'x(4)');
sim('Sim_10_01','SrcWorkspace','current');
c = acceleration - 5;
To put in more than one constraint, just make c a vector:
c(1) = acceleration - 5;
c(2) = force - 10;
c(3) = pressure - 100;
To save time, make sure you use the technique in Objective and Nonlinear Constraints in Same Function.
Alan Weiss
MATLAB mathematical toolbox documentation

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Nonlinear Optimization 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by