X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=CreaPhase.git;a=blobdiff_plain;f=octave_packages%2Fcontrol-2.3.52%2FoptiPIDfun.m;fp=octave_packages%2Fcontrol-2.3.52%2FoptiPIDfun.m;h=7e7e84556de0cfb7c3fde05880ab3ed2dbd82cd2;hp=0000000000000000000000000000000000000000;hb=f5f7a74bd8a4900f0b797da6783be80e11a68d86;hpb=1705066eceaaea976f010f669ce8e972f3734b05 diff --git a/octave_packages/control-2.3.52/optiPIDfun.m b/octave_packages/control-2.3.52/optiPIDfun.m new file mode 100644 index 0000000..7e7e845 --- /dev/null +++ b/octave_packages/control-2.3.52/optiPIDfun.m @@ -0,0 +1,56 @@ +% =============================================================================== +% optiPIDfun Lukas Reichlin July 2009 +% =============================================================================== +% Objective Function +% Reference: Guzzella, L. (2007) Analysis and Synthesis of SISO Control Systems. +% vdf Hochschulverlag, Zurich +% =============================================================================== + +function J = optiPIDfun (C_par) + + % Global Variables + global P t dt mu_1 mu_2 mu_3 + + % Function Argument -> Controller Parameters + kp = C_par(1); + Ti = C_par(2); + Td = C_par(3); + + % PID Controller with Roll-Off + C = optiPIDctrl (kp, Ti, Td); + + % Open Loop + L = P * C; + + % Sum Block: e = r - y + SUM = ss ([1, -1]); % Matlab converts to SS (and back) for MIMO TF connections + + % Group Sum Block and Open Loop + SUML = append (SUM, L); + + % Build System Interconnections + CM = [3, 1; % Controller Input with Sum Block Output + 2, 2]; % Sum Block Negative Input with Plant Output + + inputs = [1]; % Input 1: reference r(t) + outputs = [1, 2]; % Output 1: error e(t), Output 2: output y(t) + + SUML = connect (SUML, CM, inputs, outputs); + + % Simulation + [y, t_y] = step (SUML, t); + + % ITAE Criterion + itae = dt * (t_y.' * abs (y(:, 1))); + + % Sensitivity + S = inv (1 + L); + Ms = norm (S, inf); + + % Objective Function + J = mu_1 * itae + mu_2 * (max (y(:, 2)) - 1) + mu_3 * Ms; + +end % function + +% =============================================================================== +