fmincon PI-controller of nonlinear System
3 ビュー (過去 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!
0 件のコメント
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Nonlinear Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!