fmincon PI-controller of nonlinear System

2 Ansichten (letzte 30 Tage)
K0ertis
K0ertis am 2 Okt. 2014
Beantwortet: Alan Weiss am 2 Okt. 2014
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!

Akzeptierte Antwort

Alan Weiss
Alan Weiss am 2 Okt. 2014
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

Weitere Antworten (0)

Kategorien

Mehr zu Nonlinear Optimization finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by