LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to estimate transfer function from real measurements data (Partially known)

Solved!
Go to solution

Hello,

 

I would like to find transfer function of my real time system. I put in the attachment as test.txt (time, stimuli, response). I have some troubles to find the transfer function of my system. Basically I send a signal to the piston pump and I drive the motor of the piston, then I read the flow rate on the flowmeter. The flow we can write as derivative of the motion multiply surface of the piston Q=dh/dt*A. We can notice that phase starts from about plus 90 degrees (estimation1.vi look at phase). As in my system is a derivative my transfer function should be something like ( for example for second order) b2s^2+b1s+0 / a2s^2+a1s+a0 and etc. I made a vi but Labview cannot find anything reasonable. Maybe somebody has an idea to improve my vi?

 

Thank you for any help.

 

Best regards,

Kamil 

Download All
0 Kudos
Message 1 of 23
(4,716 Views)

Hello Nemesis,

 

I have had a look at your VI, but one thing that surprises me is that you do not seem to use your first column (time) in any of your calculations.

 

I did see you used fixed parameters, but your time array does not seem to be 100% equidistant.

Are you allowed to extrapolate this behavior that way?

 

Can you give me some more information about the units you're measuring?

This wll allow me to further check where things might be going wrong.

 

Other question:

 

I see you're using state space models?
Are you familiar with the theory behind this?

 

 

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
Message 2 of 23
(4,674 Views)

Hello Thierry,

 

Thank you for replay. I will try to replay to your questions.

 

1) Yes, I do not use time anyway. I noticed that something is wrong. I will try to fix it.

 

2 - 3)  I wrote a vi in Labview that simulate sinusoidal wave and send it to the piston pump as a position. The signal is sent in V (0-10 V equals -12 to 12 mm). Then I read the signal on the flowmeter, normally it is 4-20 mA and then I convert it to V. (I checked in flowmeter how is correspond voltage for minimum and maximum flow e.i. 4 and 20 mA) Then my stimuli signal and response signal is in V. After that, the signal is saved on USB stick with frequency 100Hz (dt 0.01s). Actually my signal has some noises and does not reconstruct perfect wave signal. Therefore I saved about 10 times signal for each frequency (0.1 to 10/15Hz) and then I post-process in Matlab (look in the attachment for the equations). X(t) input signal, y(t) output. Then, I was trying to find transfer function manually by looking at the potential poles and zeros. It sometimes took me some time by I got it well. (Look in the attachment mag1,ph1). Unfortunately, the last configuration of my system gave me the results with those I have some trouble to find a good and stable transfer functions. Even if I I can find something like in the attachment (mag2,ph2) it needs very high order of transfer functions and then I have problem to put in Labview for further control. I tried something like in attachment (estimation_TF.vi) with TF the estimation function but I often got an unstable function for my data. I added the last measured results.(test003.txt)

 

It is my first touch with estimation methods in Labview. Actually, I use Matlab for calculations and post-processing. If the methods are similar between Matlab and Labview then I can say that I know something about state space models. Anyway I will be glad to hear something new or probably something that I do not know. As we renewed license for Labview and I got addition modules I thought that it could be a great opportunity to try something new that can speed up my work or even makes it easier and better, more efficient.  

 

I will be glad if you will be able to help me.

 

Best regards,

Kamil

 

Download All
0 Kudos
Message 3 of 23
(4,667 Views)

Additional attachments1.

Download All
0 Kudos
Message 4 of 23
(4,666 Views)

Additional attachments2

0 Kudos
Message 5 of 23
(4,665 Views)

Hello Nemesis,

 

How does your system physically look like?

Do you have a schematic of the components you're using?

 

How are you measuring your system?

Are you using anti-aliasing filters?

Is it possible to do another measurement with a different excitation?


Is there a specific reason you're using a swept sine?

Are you sure your system is behaving linear?

What type (num. and den. order ) of transfer function are you expecting (or did you have before)?

 

Is there a certain theorem you have to follow to obtain "correct" results?

 

One thing that was incorrectly done in your original calculation was the used window length.

To be able to correvtly compare your results you should take the window length for the FRF equal to the length of the input signals X and Y for your TF model estimate.

 

PS: I was able to get a transfer function as result, but please also take into account the high standard deviation on the calculated FRF. That's why you're experiencing an unstable system.

PPS: Please don't mind the looks of the code, because it was just meant to show a comparison.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
Message 6 of 23
(4,640 Views)

Hello,

 

1) Unfortunately I cannot post the schematic of my system.

 

2) I have NI hardware: NI9024, NI9112, NI9265, NI9203, NI9215, NI9217, NI9263, NI9472 and NI9481. I do not use any additional special filters. There are filters in the electromagnetic flowmweter or the linear motor but I send the sinusoidal wave to the linear motor through the NI9263 and then I read flow on the NI9203. I just re-scaled the flowmeter signal from mA to V.

 

I can put a different excitation signal but I will not have typical response like for other systems. The step or something like that does not work with this system therefore I work with sinus signal.

 

3) I put the signal response for f=0.1Hz and f=10Hz in the attachment. My post-processing has for a task to average the noises and any other perturbations.

 

I believe and I know that the system is hardly linear. In my system I have pipes that are not rigid. They are soft such as a silicone pipe. If we simple compare hydraulic system to the electric one we can write that it is like a RLC system for each of a pipe (a picture).  We have friction effect, viscous effect, compliance effect and viscoelastic effect of pipes. Then 7 parts of these kind of system with different resonance plus another equipment sych as pumps, valves etc.

 

I got before a good estimation with num = 5 (s^4) and den = 8 (s^7).

 

4) It is difficult to find a good theorem for my system. I will have to put somehow the Navier-Stokes equations if I want to do it what I think is quite difficult.

 

Actually it is difficult to put any initial data. Now I based on the previous transfer function. num = 1.226e-006 s^4 + 0.0001119 s^3 + 0.00206 s^2 + 0.07692 s + 0, den = 5.676e-011 s^7 + 3.633e-009 s^6 + 4.23e-007 s^5 + 1.453e-005 s^4 + 0.0006311 s^3 + 0.01016 s^2+ 0.1717 s + 1.

 

Kamil

 

 

 

Download All
0 Kudos
Message 7 of 23
(4,627 Views)

Hello Nemesis,

 

I'm kind of surprised by your answer.

If the system is not linear, then why do you want to use a Transfer Function to characterize it.

 

Is it possible to do measurements with a different amplitude for the sinewave?

Reducing the amplitude (and therefor also the power) of the signal could also reduce the non-linearities you're observing.

 

Would this be possible or would you then no longer be able to adequately "stimulate" the signal.

 

Can you send me the data that you could correctly use to produce a transfer function in Matlab?

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
Message 8 of 23
(4,612 Views)

Hello ThiCop,

 

I have already done it. It is quite small amplitude that I am using. I sent you my data (in columns: f(rad/s), mag(dB), phase(deg)).

 

I put also a vi to construct a signal in time domain. Just pay an attention that the data has to be amplitude instead of magnitude.

 

Kamil

Download All
0 Kudos
Message 9 of 23
(4,609 Views)

hello Kamil,

 

I'm not able to open this VI.

The results file also seems to be empty.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
Message 10 of 23
(4,590 Views)