PI Controller Tuning : Contour plots of ISE, IAE and ITAE​
​Authors: Housam Binous and Ahmed Bellagi

MATHEMATICA code below uses NMINIMIZE to fetch best PI controller parameters. To do so it employs the ISE, IAE or the ITAE criteria. The MATHEMATICA command Parallelize is used in order to reduce computation time.
In[]:=
Gc[KP_?NumericQ,TAUI_?NumericQ]:=KP+TAUI/s;​​GT=1/(s+1)/(s+2)/(s+3)
Out[]=
1
(1+s)(2+s)(3+s)
In[]:=
G[KP_?NumericQ,TAUI_?NumericQ]:=GTGc[KP,TAUI]/(1+GTGc[KP,TAUI])
In[]:=
y[KP_?NumericQ,TAUI_?NumericQ]:=InverseLaplaceTransform[1/sG[KP,TAUI],s,t]//Chop;
ISE CRITERIA
In[]:=
f1[KP_?NumericQ,TAUI_?NumericQ]:=Re[Quiet@NIntegrate[(1-y[KP,TAUI])^2,{t,0,30}]//Chop];
In[]:=
NMinimize[f1[KP,TAUI],{KP,TAUI},MaxIterations->10]
Out[]=
{0.696163,{KP20.2936,TAUI5.69173}}
In[]:=
LaunchKernels[]
Out[]=
KernelObject
Local
KernelID: 1
,KernelObject
Local
KernelID: 2
,KernelObject
Local
KernelID: 3
,KernelObject
Local
KernelID: 4

In[]:=
data=Parallelize@Table[{KP,TAUI,f1[KP,TAUI]},{KP,1,30,0.25},{TAUI,1,10,0.25}]
Out[]=
{{{1.,1.,3.43101},{1.,1.25,2.93573},{1.,1.5,2.61281},{1.,1.75,2.38888},{1.,2.,2.22727},{1.,2.25,2.10768},{1.,2.5,2.01796},{1.,2.75,1.95042},{1.,3.,1.9},{1.,3.25,1.86324},
⋯17⋯
,{1.,7.75,2.59575},{1.,8.,2.73996},{1.,8.25,2.90767},{1.,8.5,3.10401},{1.,8.75,3.33525},{1.,9.,3.60879},{1.,9.25,3.93331},{1.,9.5,4.3194},{1.,9.75,4.78101},{1.,10.,5.33777}},
⋯115⋯
,{
⋯1⋯
}}
Full expression not available
(
original memory size:
0.5 MB)
In[]:=
CoolColor[z_]:=RGBColor[10z,1-10z,1];
In[]:=
p1=ListContourPlot[Flatten[data,1],Contours->Join[Table[i0.1,{i,0,20,0.25}]],PlotRange->All,ColorFunctionCoolColor];
In[]:=
Show[p1,Graphics[{Darker@Red,PointSize[0.025],Point[{KP,TAUI}/.{KP->20.2936,TAUI->5.69173}]}],PlotLegendsAutomatic]
Out[]=
IAE CRITERIA
In[]:=
f2[KP_?NumericQ,TAUI_?NumericQ]:=Re[Quiet@NIntegrate[Abs[(1-y[KP,TAUI])],{t,0,30}]//Chop];
In[]:=
NMinimize[f2[KP,TAUI],{KP,TAUI},MaxIterations->10]
Out[]=
{1.28735,{KP11.5836,TAUI5.92557}}
In[]:=
data2=Parallelize@Table[{KP,TAUI,f2[KP,TAUI]},{KP,1,30,0.25},{TAUI,1,10,0.25}]
Out[]=
{{{1.,1.,5.98381},{1.,1.25,4.79915},{1.,1.5,4.00009},{1.,1.75,3.48781},{1.,2.,3.21673},{1.,2.25,3.07253},{1.,2.5,2.99815},{1.,2.75,2.9668},{1.,3.,2.96475},{1.,3.25,2.98432},
⋯17⋯
,{1.,7.75,5.76825},{1.,8.,6.11694},{1.,8.25,6.50685},{1.,8.5,6.9428},{1.,8.75,7.42837},{1.,9.,7.96562},{1.,9.25,8.55483},{1.,9.5,9.19404},{1.,9.75,9.88101},{1.,10.,10.6454}},
⋯115⋯
,{
⋯1⋯
}}
Full expression not available
(
original memory size:
0.5 MB)
In[]:=
p2=ListContourPlot[Flatten[data2,1],Contours->Join[Table[i0.1,{i,0,30,0.5}]],PlotRange->All,ColorFunction->CoolColor];
In[]:=
Show[p2,Graphics[{Darker@Red,PointSize[0.025],Point[{KP,TAUI}/.{KP->11.5836,TAUI->5.92557}]}]]
Out[]=
IAE CRITERIA
In[]:=
f3[KP_?NumericQ,TAUI_?NumericQ]:=Re[Quiet@NIntegrate[tAbs[(1-y[KP,TAUI])],{t,0,30}]//Chop];
In[]:=
NMinimize[f3[KP,TAUI],{KP,TAUI},MaxIterations->10]
Out[]=
{1.52357,{KP7.19957,TAUI4.91172}}
In[]:=
data3=Parallelize@Table[{KP,TAUI,f3[KP,TAUI]},{KP,1,30,0.25},{TAUI,1,10,0.25}]
Out[]=
{{{1.,1.,30.4326},{1.,1.25,18.0515},{1.,1.5,11.3357},{1.,1.75,8.17612},{1.,2.,7.13674},{1.,2.25,6.86265},{1.,2.5,6.92893},{1.,2.75,7.18484},{1.,3.,7.57146},{1.,3.25,8.06125},
⋯17⋯
,{1.,7.75,43.5386},{1.,8.,48.7154},{1.,8.25,54.7371},{1.,8.5,61.7121},{1.,8.75,69.7102},{1.,9.,78.7548},{1.,9.25,88.8103},{1.,9.5,99.7758},{1.,9.75,111.538},{1.,10.,124.939}},
⋯115⋯
,{
⋯1⋯
}}
Full expression not available
(
original memory size:
0.5 MB)
In[]:=
p3=ListContourPlot[Flatten[data3,1],Contours->Join[Table[i,{i,0,30,0.5}]],PlotRange->All,ColorFunction->CoolColor];
In[]:=
Show[p3,Graphics[{Darker@Red,PointSize[0.025],Point[{KP,TAUI}/.{KP->7.19957,TAUI->4.91172}]}]]
Out[]=