AutotunerPID Toolkit | ![]() ![]() |
PID_STRUCTURE Structure selection for a ISA PID regulator. REGSTRUCT = PID_STRUCTURE(MODEL,REQSTRUCT) returns the ``best'' structure for the regulator, assuming that the controlled plant can be described with a FOPDT model. MODEL is a structure with the description of the process model with the fields {m L T} (parameters of a FOPDT model M(s) = m*exp(-sL)/(1+s*T)). The structure may be computed through the function setting the flag REQSTRUCT to 'AUTO', or may be constrained to a particular one by setting the flag REQSTRUCT to 'PI' or 'PID' respectively. The structure selection is performed only if a FOPDT model of the process is given, otherwise the PID structure is selected. If the control problem is intrinsically difficult the PID structure is selected, and a warning message is prompted. Author: William Spinelli (wspinell@elet.polimi.it) Copyright 2004 W.Spinelli $Revision: 1.0 $ $Date: 2004/02/27 12:00:00 $
0001 function regStruct = pid_structure(model,reqStruct) 0002 %PID_STRUCTURE Structure selection for a ISA-PID regulator. 0003 % 0004 % REGSTRUCT = PID_STRUCTURE(MODEL,REQSTRUCT) returns the ``best'' 0005 % structure for the regulator, assuming that the controlled plant can be 0006 % described with a FOPDT model. 0007 % MODEL is a structure with the description of the process model with the 0008 % fields {m L T} (parameters of a FOPDT model M(s) = m*exp(-sL)/(1+s*T)). 0009 % The structure may be computed through the function setting the flag 0010 % REQSTRUCT to 'AUTO', or may be constrained to a particular one by 0011 % setting the flag REQSTRUCT to 'PI' or 'PID' respectively. 0012 % 0013 % The structure selection is performed only if a FOPDT model of the 0014 % process is given, otherwise the PID structure is selected. If the 0015 % control problem is intrinsically difficult the PID structure is 0016 % selected, and a warning message is prompted. 0017 % 0018 % Author: William Spinelli (wspinell@elet.polimi.it) 0019 % Copyright 2004 W.Spinelli 0020 % $Revision: 1.0 $ $Date: 2004/02/27 12:00:00 $ 0021 0022 if nargin < 2 0023 reqStruct = 'AUTO'; 0024 end 0025 0026 switch reqStruct 0027 case 'PI' 0028 % override selection 0029 regStruct = 'PI'; 0030 0031 case 'PID' 0032 % override selection 0033 regStruct = 'PID'; 0034 0035 case 'AUTO' 0036 if isfield(model,'m') 0037 % selection performed only if a FOPDT model is provided 0038 m = model.m; L = model.L; T = model.T; 0039 0040 % compute the ultimate frequency 0041 wmin = (-pi/2)/L; % lower bound 0042 wmax = (-pi)/L; % upper bound 0043 w = real(logspace(log10(wmin),log10(wmax),1024)); 0044 phaseM = angle(m*exp(-j*L*w)./(1+j*w*T)); 0045 wu = w(find(phaseM==min(phaseM))); 0046 0047 k1 = 1/abs(m*exp(-j*L*wu)/(1+j*wu*T)); 0048 th1 = L/T; 0049 0050 if th1>1 & k1<1.5 0051 regStruct = 'PI'; 0052 msgbox('Bad results expected','AutotunerPID','warn'); 0053 elseif (th1>0.6 & th1<1) & (k1>1.5 & k1<2.25) 0054 regStruct = 'PI'; 0055 elseif th1<0.6 & k1>2.25 0056 regStruct = 'PID'; 0057 else 0058 regStruct = 'PID'; 0059 msgbox('Bad results expected','AutotunerPID','warn'); 0060 end 0061 else 0062 regStruct = 'PID'; 0063 end 0064 0065 otherwise 0066 msgbox('Unknown structure','AutotunerPID','warn'); 0067 regStruct = 'PID'; 0068 end
![]() | pid_isatd | pid_tuning | ![]() |