Approximating Differential Equation on the Basis of Measured Values



Good question. The goal is to find the transfer function that best estimates plant's response. Normally one captures the process variable, PV, as a function of the control output, CO, and time. In JCH's data the CO is a step jump of one.
If you use AB PLC's then you can save the PV as a function of CO in a trend file.
So why bother? If you know the plant transfer function then one can calculate the PID gains that will provide almost any desired response. Calculating the PID gains is a different issue but the difficult part is finding the plant transfer function. After that calculating the PID gains is easy. See www.controlguru.com for the formulas for calculating the gains.
Andrew, I don't see how you calculated H(t). It doesn't look right, but the transfer function

is pretty good for a two pole solution. See this ftp://ftp.deltacompsys.com/public/NG/Mathcad%20-%20SysID%20JCH%20Andrew.pdf You can see that your solution is different from mine but that could be because you used a different evaluation function. I basically use the sum of squared errors or divide that by the number of points to get a mean sum of squared error..
You should know that JCH posted actual transfer funciton back on Oct 28. The actual plant is 5 repeated poles with a time constant of 0.123.
Are you familiar with Runge Kutta and optimizing functions? So far we are only at the beginning stages. Issues that haven't been covered yet include offsets in the plant transfer function, using foricing functions other than 1, and dead time.
Peter Nachtwey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Peter, The relationship between H(s) and H(t) is a direct translation from the laplace domain to the time domain. If you plot them together, you will see that they are identical.
Andy
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

I am not sure if I understand what is being asked here. Are we trying to find the equation which produced that set of data? Or are we trying to find a differential equation for which that set of data is the solution?
I'll assume that we are looking for the equation which defines this set of data:
In the s domain, this set of data can be approximated by the following:
H(s) = 8.94 ------------------------- s^2 + 4.91 + 8.94
In the time domain, this is equivalent to:
H(t) = 1 - 1.75*e^(2.45t)*cos(1.71t-55)
Is this what is being asked for here?

Your's equivalent to
1 H(s) = ----------------------- 0.112*s^2 + 0.549*s + 1
My approximation for 2nd order
1 H(s) = ----------------------- 0.103*s^2 + 0.421*s + 1
That is similar to your solution.
See difference to 5th order: http://home.arcor.de/janch/janch/_news/20071118-odeapproximation /
--
Regards/Gre http://home.arcor.de/janch/janch/menue.htm
Jan C. Hoffmann eMail aktuell: snipped-for-privacy@nospam.arcornews.de
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
I looked up the 5th order equation. It is clearly a perfect fit. My second order solution was easy. All you need to define a second order system is the natural frequency and the damping ratio. You can find that with a small amount of analysis from the data. But I also assumed that it was a 2nd order system. I have a couple of questions?
1. How would you know it was a 5th order system? 2. How do you find the parameters for a 5th order system? 3. What is the time domain response? 4. Other than a good math problem (which is always a good thing), why would you model a system as 5th order when a 2nd order approximation is apparently close enough?
andy
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

I didn't at first. JCH said that we should limit the number of poles to 3. First I plotted JCH's data and I can tell by the inflection that is was at least 3 or more probably 5. It takes only a few seconds to try many options and compare the error. The model with the smallest error between the actual and estimated data is usually the right one.

All the poles were at the same location so it was easy. I use a optimizer function that minimizes the error between the actual and estimated data. In the link below this function is called Minerr. Scilab also has lsqrsolve and optim that do the same things.

I posted a link to my solution on Oct 22. ftp://ftp.deltacompsys.com/public/NG/Mathcad%20-%20SysID%20JCH.pdf notice it took little effort to change n and find a new solution. When the error stops getting smaller what is left is noise and un- modeled non-linear features. The equation for the time domain response follows a pattern. I don't normally use equations in the time domain though. I usually use a state space method or RK4 to integrate the differential equation(s). Note the (s).

That is a good question too. Is a second order approximation good enough? I think this question deserves its own thread though. A second order approximation may be good in some cases but not others. This is an opinion, not fact and the answer may depend on the definition of what is good enough. I don't think, but haven't shown, a second order approximation is good enough in JCH's example because all the poles are at the same place. There are no dominate poles with the other three being high frequency poles that will barely affect the system. In any case wouldn't you want to know were the poles are before you decide to ignore them? I know that I can design a better controller for JCH's 5 pole system knowing it is a 5 pole system than if I assume there are only two or three poles. Even if you only have a PLC with a PID I still think you are better off knowing reality
I use system identification in motion control. Most system can be modeled as a type 1 first or second order system. Try my test data. Try the easy on first with only 26 points. Both sets are more typical of what one sees in a motion control application than JCH's test data.
It is about time some the lurker come out. I can tell by the down loads from my ftp site that this thread isn't being ignored.
Peter Nachtwey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

I looked up the 5th order equation. It is clearly a perfect fit. My second order solution was easy. All you need to define a second order system is the natural frequency and the damping ratio. You can find that with a small amount of analysis from the data. But I also assumed that it was a 2nd order system. I have a couple of questions?
1. How would you know it was a 5th order system? 2. How do you find the parameters for a 5th order system? 3. What is the time domain response? 4. Other than a good math problem (which is always a good thing), why would you model a system as 5th order when a 2nd order approximation is apparently close enough?

JCH
1. One produces a set of data for F(s)=(T^n*s^n + 1) Order = n (e.g. 6) T = 1 Values at 10% and 90% for n = 2...6 Then using approximation methods you can find out where the data came from.
2. See 4.
3. See http://home.arcor.de/janch/janch/_news/20071118-odeapproximation / [x=time]
4. Second order ODE approximation is less accurate. Using programmable devices you can go a step further if 'precision is necessary'. The entire control loop can be calculated. You can use all the coefficients (e.g. n=5) of the ODE. This are values that cannot be measured but used. Tuning 3 PID plus 5 ODE parameters is very difficult. But all can be done off line on a computer. Even the PID parameters can be automatically found off line.
Few days ago I approximated a 5th order model with 3rd order ODE. That may be of advantage for some applications. http://home.arcor.de/janch/janch/_control/20071028-orderchange /
See the example using the mentioned process tranfer function (5th order): http://home.arcor.de/janch/janch/_news/20071118-control5thorder /
Note: If comparing you should consider the bench mark scheme I used. This makes loop controls much more difficult if the setpoint is moved (e.g. position control).
--
Regards/Gre http://home.arcor.de/janch/janch/menue.htm
Jan C. Hoffmann eMail aktuell: snipped-for-privacy@nospam.arcornews.de
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.