## System Identification. Do not pass go, do not collect $200 until you learn how to do this

## System Identification. Do not pass go, do not collect $200 until you learn how to do this

(OP)

System identification should be the first topic of a controls course. I have made it clear that without having a good open loop transfer function none of the cool tricks like pole placement or other ones you may think of are useless. I use to give people on sci.engr.control for tweaking gains and drinking coffee while waiting for the results when back in the 1990s I knew controller gains can be calculated IF one knows the open loop transfer function. System identification is not that hard. It can be done easily using a free control software package like Scilab.

The trick to system identification is to start with an open loop model that should approximate how the system will react to open loop control signals. The general type of system should be known. For instance whether the system is integrating ( type 1, position, tank lvel ) or non-integrating ( type 0, temperature or velocity ) and how many poles it has. Other variables that need to be determine are things like offset and dead time. Now a differential equation can be written for the system but the coefficients for the state variables, dead time, offset and gain are unknown. That's OK. The differential equation is the most important part of this phase.

The second part is to excite the open loop system by varying the control signal in a way that will provide the most information about gains and time constants etc. There is no best way to do this but in general changing the control signal between different level somewhat rapidly and recording the response works well. Some systems use square waves but that can be awfully harsh on the equipment. If you use square waves control signals while identifying a hydraulic system with a 50 ton coil of steel on if you will p!$$ people off. Sine waves and ramps will do if the system you are trying to identify doesn't respond that fast in the first place. The result of this phase is have a record of time, control signal and the feed back (PV)

The third part is to make a good guess for the variables that need to be identified and uses them to calculate the estimate response for the trial model. Usually the first estimated response is awful. One judges how awful the response is by using the sum of square error between the estimated response and the measured response. When I first tried this my software faulted because the sum of squared errors exceed the maximum value for a floating point value so be careful.

Next one needs a method of changing the values of the variables so that the sum of squared error is minimized. This may take many trials unless an algorithm like Levenberg-Marquardt or BFGS is used. There are a few different algorithms that can quickly find the values that will minimize the sum of square errors. I like two I mentioned. If the final sum of square errors is small then you know you have a good model. If it isn't then the general form of the chosen model may not be correct or there may be a non-linearity. I like to use differential equations because I can write non-linear differential equations. I don't expect customers to know how many poles their system has so we run the the system identifier with models find which general form of the model is best. In general more poles the better but one must sanity check the result. One method mentioned in my control books was least squares. Least squares didn't work so well. What I can tell is that the authors have NEVER been in the field making real systems work. This is a general complaint I have about professors and why they shouldn't be allowed to teach students.

So I have made two videos. One is for a simple example of system identification. It is too easy but it would probably work for many simple motor systems.

The simple video

https://www.youtube.com/watch?v=qzr6eL90Aok

The second video is more realistic in that I add noise to make identification hard. I also use a more complicated open loop system. If you notice I use the same open loop transfer function that was used by the instructor's video in the root locus video.

https://www.youtube.com/watch?v=lermULNDz3M

If you want to see the results then

https://www.youtube.com/watch?v=Ba1yJhvOmvc

I was not testing my auto tuning program. I was testing the screen capture software I use but I decided to keep the video because it is short.

Notice the control signal.

If it looks like I radiate a little contempt for that teach with out being in the trenches you are not mistaken.

The trick to system identification is to start with an open loop model that should approximate how the system will react to open loop control signals. The general type of system should be known. For instance whether the system is integrating ( type 1, position, tank lvel ) or non-integrating ( type 0, temperature or velocity ) and how many poles it has. Other variables that need to be determine are things like offset and dead time. Now a differential equation can be written for the system but the coefficients for the state variables, dead time, offset and gain are unknown. That's OK. The differential equation is the most important part of this phase.

The second part is to excite the open loop system by varying the control signal in a way that will provide the most information about gains and time constants etc. There is no best way to do this but in general changing the control signal between different level somewhat rapidly and recording the response works well. Some systems use square waves but that can be awfully harsh on the equipment. If you use square waves control signals while identifying a hydraulic system with a 50 ton coil of steel on if you will p!$$ people off. Sine waves and ramps will do if the system you are trying to identify doesn't respond that fast in the first place. The result of this phase is have a record of time, control signal and the feed back (PV)

The third part is to make a good guess for the variables that need to be identified and uses them to calculate the estimate response for the trial model. Usually the first estimated response is awful. One judges how awful the response is by using the sum of square error between the estimated response and the measured response. When I first tried this my software faulted because the sum of squared errors exceed the maximum value for a floating point value so be careful.

Next one needs a method of changing the values of the variables so that the sum of squared error is minimized. This may take many trials unless an algorithm like Levenberg-Marquardt or BFGS is used. There are a few different algorithms that can quickly find the values that will minimize the sum of square errors. I like two I mentioned. If the final sum of square errors is small then you know you have a good model. If it isn't then the general form of the chosen model may not be correct or there may be a non-linearity. I like to use differential equations because I can write non-linear differential equations. I don't expect customers to know how many poles their system has so we run the the system identifier with models find which general form of the model is best. In general more poles the better but one must sanity check the result. One method mentioned in my control books was least squares. Least squares didn't work so well. What I can tell is that the authors have NEVER been in the field making real systems work. This is a general complaint I have about professors and why they shouldn't be allowed to teach students.

So I have made two videos. One is for a simple example of system identification. It is too easy but it would probably work for many simple motor systems.

The simple video

https://www.youtube.com/watch?v=qzr6eL90Aok

The second video is more realistic in that I add noise to make identification hard. I also use a more complicated open loop system. If you notice I use the same open loop transfer function that was used by the instructor's video in the root locus video.

https://www.youtube.com/watch?v=lermULNDz3M

If you want to see the results then

https://www.youtube.com/watch?v=Ba1yJhvOmvc

I was not testing my auto tuning program. I was testing the screen capture software I use but I decided to keep the video because it is short.

Notice the control signal.

If it looks like I radiate a little contempt for that teach with out being in the trenches you are not mistaken.

Peter Nachtwey

Delta Computer Systems

http://www.deltamotion.com

http://forum.deltamotion.com/

## RE: System Identification. Do not pass go, do not collect $200 until you learn how to do this

## RE: System Identification. Do not pass go, do not collect $200 until you learn how to do this

- Make sure the system isn't under feedback control and is operating around the control point
- Inject a desired input signal (Peter mentioned several of these above; it should have enough frequency content to stimulate all modes (i.e., poles and zeros) of interest
- Record the desired output signal(s)
- Preprocess the I/O data (Remove means, trends, filter if noisy, separate into estimation and validation data sets, etc.)
- Choose a type of dynamic model (Linear, e.g., transfer function, state space, ARX, ARMAX, Box-Jenkins, etc., or nonlinear, e.g., Hammerstein-Wiener)
- Select dynamic model properties (e.g., for a transfer function, choose the order of numerator, order of denominator, dead time, etc.)
- Estimate values for the parameters of the dynamic model (computer routines do this as Peter described above, possibly using data ranges input by the user) to complete the model
- Validate the dynamic model's behavior against the actual system by injecting input validation data and comparing model output validation data to system output validation data
- If the estimated model is adequate (up to the engineer to decide this), stop. If not, iterate on steps 5-8 (and possibly repeat all steps if necessary).

This may sound easy; in practice, it is very difficult to do well. It also chews up engineering budget, so it needs to be built into any quotes. The model found is often limited in its operating range, and so other models may need to be found at other operating points, especially when modeling highly nonlinear systems using piecewise methods.(this usually involves examining the residuals for autocorrelation and cross-correlation exceeding limits)

xnuke

"Live and act within the limit of your knowledge and keep expanding it to the limit of your life." Ayn Rand,

Atlas Shrugged.Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.

## RE: System Identification. Do not pass go, do not collect $200 until you learn how to do this

I have a few Mathcad worksheets made up for tank level control. I got into a real p!ss!ing contest on LinkedIn about this years ago. I was helping a student with a tank level control problem where there was a pump that supplied water to tank 1 that had a fixed orifice on the both that flowed into tank 2. Tank two also had a fixed orifice on the bottom. The goal was to control the level in tank 2.

It wasn't obvious to whether tank two's level could be control. After much guessing by many people I decided to break out my Mathcad and do the simulation. It should be easy to model tank level control. This topic is good because covered things like time constants. There were some that suggested filling the tank up and waiting for 63% of the water to flow out. This was wrong. There were some that just said use trial and error. I got upset with these guys. Sure trial and error would work but does a student go to college just to learn what a million monkeys could do? I insisted that the math be done. Why, not because the math is required to control level but because the math IS NECESSARY to model the system. How else is one going to know how tall or wide the tanks must be or the flow of the pump? One doesn't go to college to learn how to tweak gain and drink coffee while waiting. One goes to college to learn how to design the systems. That should require modeling but sadly I have NEVER seen a transfer function attached to a system unless I did the system identification.

I will brush off these Mathcad worksheets and add them to my Peter Ponders PID channel.

Pump curves are not a problem.

This a problem. The pump should be IDed separately or hold the manufacturer to the specifications. Worst case parameters may need to be used for modeling.

It depends upon the complexity and the ability to use differential equations.

This is an article about a simulation I did. There were two diaphragm ( who was the nut case that came up with that spelling? ) pumps pumping fuel to a high pressure header. The was a simulation for the outer pressure loop controlling the speed of the inner two pump loops.

The department of energy had been working on this system for 2 years. The design was faulty. If took about 15 hrs to model the system and work out gains that would work and under what conditions the fuel injection system would work.

http://machinedesign.com/hydraulics/electrohydraul...

The fuel would compress 30% as it was pressurized from 150 psi to 43000psi at which point the fuel would finally flow through the check valve to the pressure header.

There were many non-linear differential equations. Even the bulk modulus of the fuel changed with pressure so instead of being a constant it was a function.

The department of energy got the Mathcad simulation so they could do their own calculations in the future.

15 hrs is not that much compared to wasting all that time.

Peter Nachtwey

Delta Computer Systems

http://www.deltamotion.com

http://forum.deltamotion.com/

## RE: System Identification. Do not pass go, do not collect $200 until you learn how to do this

Yes, I cringe too when someone thinks that trial-and-error is engineering. NOT. Engineering is applied math. Feedback control in particular seems to be a subject which causes anger in a few people for some odd reason. Maybe they made a D in that course. Once I was going over a motor drive concept with another engineer. We were discussing little details like the bandwidth we need with average current mode control. The president of the company broke in with an email: "I'M SICK AND TIRED OF HEARING CLOSED LOOP CONTROL. WE ARE GOING TO RUN THE MOTORS OPEN LOOP". It was very obvious to me and the other engineer that it would be simply goofy to try to run this system open loop. I've heard similar, but not as rude, comments in the past about feedback control. Very few people I meet understand even the basics but they certainly are opinionated about it.

Sounds like you've run into similar people.

Darrell Hambley P.E.

SENTEK Engineering, LLC

## RE: System Identification. Do not pass go, do not collect $200 until you learn how to do this

Not really. These types of people won't buy expensive motion controllers they don't they need.

Peter Nachtwey

Delta Computer Systems

http://www.deltamotion.com

http://forum.deltamotion.com/