fmincon PI-controller of nonlinear System

조회 수: 2 (최근 30일)
K0ertis
K0ertis 2014년 10월 2일
답변: Alan Weiss 2014년 10월 2일
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