LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

System Identification and Controller Design

Dear all,

I have an unknown system, that I want to control using a PID controller. To realize this, I want to use the system identifications tools in Labview to estimate the system's transfer function, tune a PID controller to desired values and implement it. So far so good, using the system identification toolbox, I am able to get the transfer functions using the stimulus and response of the system that I have stored. Next, I can go to e.g. Simulink, simulate the closed loop and tune my controller. This works, but, I would like to have it more convinient using only one Labview VI.

 

Looking through the examples, I found "continuous transfer function model of a DC motor", that does exactly what I want to estimate the transfer function using stimulus and response.

Next, I found the example "CDEx Design and Implement PID Controller.vi", that allows me to enter the transfer function I have and than tune the controller.

Basically, my goal is to combine both VIs, so that I load stimulus and response waveforms, and than, in one VI, estimate the model AND tune a PID controller. I tried this in the attached VI "control", however, I cant connect the output of the estimation and the input of the PID tuning part.
 Does anybody know, how to combine this?

 

Even better would be combining the system identification part with the example "CDEx PID Design with Dimensionless Alpha".

 

Thank you for any help, I hope it's clear what I try to do 🙂

 

 

 

0 Kudos
Message 1 of 8
(3,816 Views)

Update an the problem.

The VI attached shows where I am at. The file data.txt shows my stimulus and response signal:

 

the stimulus is more or less a ramp increasing from ca. 25 to 45, the response is a more or less a ramp decreasing from 7 to ca. 1.

 

When selecting "loaded from file" in the VI and loading data.txt , the stimulus and response are shown an the graphs.


Now, the SI Estimate Transfer Function.VI should return the corresponding transfer function of the system based on stimulus and input.

In this case something like

 

     0.111627

-----------------------

0.0336957 s +1.

 

Can this be true? Shouldn't the gain at least be negative, as the response is decreasing?

 

Next, I want to tune the PID controller, to get a desired step response of the closed loop system. But again, the result do not seem logic.

 

Any help is highly appreciated.

Cheers

Jack

Download All
0 Kudos
Message 2 of 8
(3,794 Views)

Hey Jack,

That transfer function looks reasonable to me (although you may get better accuracy with a higher order system). If you take the inverse laplace transform of that equation you get an exponentially decaying function (with a negative slope). Could you give a little more detail on what issues you are running into with the PID controller?

 

 

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 3 of 8
(3,757 Views)

Jack, I don't have time to look at your stuff in detail, but an important aspect of successful system identification is to make sure the stimulus signal has sufficient frequency content (which not only means its shape, but also sample period and duration) to excite the dominant dynamics of the system under test. This is why step stimulus signals are often used, as they contain a sufficiently broad range of frequencies.

 

Also, if you are doing something like a motor where a fixed voltage produces a speed and a ramping position output, if you do system identification between volts and position then you will just be identifying the integrating process between speed and position - which is not such a useful thing to do, and will make it more difficult to identify any interesting higher order dynamics.

 

Other things that may help:

  • Start with the simplest model you can, and only increase if you need those higher order dynamics
  • The type of model you are fitting (OE, Box Jenkins, ARX) can also impact the suitability of the model.
  • Make signal zero mean or zero initial value, or estimate a bias term within model

Finally - do a sanity check on your models it is very easy when using such algorithms to just accept what they produce, but there are plenty of pitfalls which can make the system identification give skewed results.

 

 

Consultant Control Engineer
www-isc-ltd.com
0 Kudos
Message 4 of 8
(3,747 Views)

Hi there, thanks for the answers!

 

One of my updated problems is the follogwing:

 

Using the VI "control_problem2", I can Identify my system, and tune my PID controller to get a desired step response. This seems to work fine and does exactly what I want: obtain suitable PID-parameters.

However, my actual problem does not require a step response. The ssetpoint is a constant (lets say 5). After the system, there is a distrubing input added: a ramp signal with slope=1 that remains constant when reaching 10, just as an example.

In the VI "simulation", I tired exacly that. However, in my transfer function block, I want to have the transfer function from above. As soon as I enter it, the code if faulty.

 

Thanks a lot for any help!

 

 

Download All
0 Kudos
Message 5 of 8
(3,718 Views)

Hey Jack,

What do you mean when you say that the code is faulty? I am able to open the transfer function block in your code and change the coefficients to match this equation:

 

     0.111627

-----------------------

0.0336957 s +1.

 

 

I can then run the VI and everything seems to work as expected. Am I missing something here?

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 6 of 8
(3,714 Views)

Thanks still for the responses!

Its been some time but I still have problems with the system ident.

 

Kevin, I am not the control systems expert, but I think the TF is not correct, it should have a negative k .. (k / (a*s+b).

I tried to verifythe TF, using the code attached: I input the (more or less) same ramp that I used to get the TF, and the output is nothing like the response I used to get the TF. Its a positive ramp, which is what I would expect from a TF like the one above.

 

Where is my mistake here...

 

thanks,

Jack

0 Kudos
Message 7 of 8
(3,646 Views)

Hey Jack,

 

In your data set is the stimulus really increasing from 21-45 or is that actually time? If it is time then you don't want to use it as the stimulus input of the SI Estimate Transfer function model - you would want to use a step response or something similar.  

 

This manual(http://www.ni.com/pdf/manuals/371001c.pdf) provides some useful information on getting started with the Sys ID toolkit (although I will admit it is a bit lengthy).  One thing mentioned here (page 2-9) that you will probably want to do is to remove the offset from your input data (Sys ID does not do any normalization on its own).

 

I have also attached an example which uses Velocity of a DC motor (where you use Position) and uses Sys ID tools to get an estimate the PID coefficients. This may be a good reference for what you are trying to accomplish.

 

 

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 8 of 8
(3,635 Views)