Computing Integral Errors : Mathematica vs Matlab Simulink
Authors: Housam Binous and Ahmed Bellagi
Computing Integral Errors : Mathematica vs Matlab Simulink
Authors: Housam Binous and Ahmed Bellagi
Authors: Housam Binous and Ahmed Bellagi
ConsidertheclosedloopshowninFigure11.8in[1]=,=,=,=1,and=+(PIcontroller).Here,weassumethatD=0andYsp=1/s.
where
G
p
2
3s+1
G
v
1
2s+1
G
m
1
s+1
K
m
G
c
K
c
1
5s
Reference :
[1] D . E . Seborg, T . F . Edgar, D . A . Mellichamp, and F . J . Doyle III, Process Dynamics and Control, 4 th ed ., Hoboken, NJ : John Wiley & Sons, Inc ., 2017.
[1] D . E . Seborg, T . F . Edgar, D . A . Mellichamp, and F . J . Doyle III, Process Dynamics and Control, 4 th ed ., Hoboken, NJ : John Wiley & Sons, Inc ., 2017.
In[]:=
Kc=q;
In[]:=
Gp=2/(3s+1);Gv=1/(2s+1);Gm=1/(s+1);Gc=Kc+1/(5s);
In[]:=
GcGvGp/(1+GcGvGpGm)//FullSimplify
Out[]=
2(1+s)(1+5qs)
2+5s(2q+(1+s)(1+2s)(1+3s))
Time-domain response
Time-domain response
In[]:=
y[q_?NumericQ]:=InverseLaplaceTransform1s,s,t;(*q=Kc*)
2(1+s)(1+5qs)
2+5s(2q+(1+s)(1+2s)(1+3s))
In[]:=
ym[q_?NumericQ]:=InverseLaplaceTransform1sGm,s,t;
2(1+s)(1+5qs)
2+5s(2q+(1+s)(1+2s)(1+3s))
mresp=ym[1];(*mesuredresponseforKc=1*)
resp=y[1];(*responseforKc=1*)
Thethreeintegralerrors(alltruncatedatt=50inthecalculationshownhere)aredefinedby:IAE=e(t)dt=4.697(theintegraloftheabsolutevalueoftheerror),ISE=dt=2.628(theintegralofthesquarederror),andITAE=te(t)dt=24.715(theintegralofthetime-weightedabsoluteerror).
∞
∫
0
∞
∫
0
2
(e(t))
∞
∫
0
In[]:=
ISE=NIntegrate[(1-mresp)^2,{t,0,50},Method->{Automatic,"SymbolicProcessing"->False}]
Out[]=
2.62866
In[]:=
IAE=Quiet@NIntegrate[Abs[1-mresp],{t,0,50},Method->{Automatic,"SymbolicProcessing"->False}]
Out[]=
4.69659
In[]:=
ITAE=Quiet@NIntegrate[tAbs[1-mresp],{t,0,50},Method->{Automatic,"SymbolicProcessing"->False}]
Out[]=
24.715
Response versus time
In[]:=
p=Plot[resp,{t,0,200},PlotRange->{{0,50},{0,1.4}},PlotStyle->Dashed,Frame->True,GridLines->Automatic,FrameLabel->{Style["t",16,Italic],Style["response",16,Italic]},AspectRatio->1]
Out[]=
img=
;(*fromSimulink*)
In[]:=
Show[p,ImageSize->400{1,1},Prolog->{Raster[ImageData[img,DataReversed->True],{Scaled[{0.0,0.0}],Scaled[{1,1.}]}]},FrameLabel->{Style["t",16,Italic],Style["y",16,Italic]}]
Out[]=
Error versus time
img=
;(*fromSimulink*)
In[]:=
p=Plot[1-mresp,{t,0,200},PlotRange->{{0,50},{-0.4,1.0}},PlotStyle->Dashed,Frame->True,GridLines->Automatic,FrameLabel->{Style["t",16,Italic],Style["error",16,Italic]},AspectRatio->1]
Out[]=