image thumbnail

OptimPID: an optimal PID controller design interface

by

 

OptimPID is a MATLAB based interface and it can be used to optimize PID parameters

multi_step.m
function [sys,x0,str,ts]=multi_step(t,x,u,flag,tTime,yStep)
switch flag,
   case 0 % óʼ
       [sys,x0,str,ts] = mdlInitializeSizes;
   case 3  % źţɶԾź
       sys = mdlOutputs(t,tTime,yStep);
   case {1, 2, 4, 9} % δʹõ flag ֵ
       sys = [];
   otherwise % Ϣ
       error(['Unhandled flag = ',num2str(flag)]);
end;
% when flag=0 ʱгʼ
function [sys,x0,str,ts] = mdlInitializeSizes
sizes = simsizes; % ʼģ
sizes.NumContStates = 0; sizes.NumDiscStates = 0; % ɢ״̬
sizes.NumOutputs = 1; sizes.NumInputs = 0; % ϵͳ·
sizes.DirFeedthrough = 0;% źŲֱӴ䵽
sizes.NumSampleTimes = 1;% 
sys = simsizes(sizes); % ʼ
x0 = []; str = []; % ϵͳijʼ״̬Ϊ
ts = [0 0]; % ģΪģ
%  flag=3 ʱź
function sys = mdlOutputs(t,tTime,yStep)
i=find(tTime<=t); sys=yStep(i(end));

Contact us