Today is...
Friday, September 22, 2017
Welcome to, the global online
community of automation professionals.
Featured Video...
Featured Video
Wiring and programming your servos and I/O just got a lot easier...
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive
SImulation of PID Controller
How can I display (show) my command, at each sample time of my simulation time? how can I put PID in space state?


I have a process which has Hsys= k/s(1+Ts)
I designed a Pid controller for this process. I have to used space state representation of my system for simulation.

xdot=(I+ Te*A)*xk+ Te*B*uk
yk=C*xk // yk=Ysys

I want to proceed in the same way for pid controller to be able to see, at each time, the output of my pid; ypid= u_sys=uk
I don't know where I have a mistake, cause in the simulation I get wrong things...
x1= integral(e)
x2=e = x1dot
x3= edot= x2dot
e= r-Ysys
e= r- k*u/s(1+Ts)
It will give me: edot*(1+T*s)=-k*u
edot + T* = -k*u*u/T - edot/T*u/T - x3/T

I will then have: matrix A for pid system:
Apid=([0 1 0],[0 0 1 ],[0 0 -1/T])
Bpid= ([0 0 -k/T].transpose()
Cpid=([Ki, Kp, Kd)])