How can i extract transfer function an unknown nonlinear system? - Electrical Engineering Stack Exchange most recent 30 from electronics.stackexchange.com 2019-07-17T23:22:14Z https://electronics.stackexchange.com/feeds/question/202845 http://www.creativecommons.org/licenses/by-sa/3.0/rdf https://electronics.stackexchange.com/q/202845 0 How can i extract transfer function an unknown nonlinear system? Cem https://electronics.stackexchange.com/users/64449 2015-11-26T07:41:39Z 2018-02-04T14:16:48Z <p>I am trying to do PID control for my electroservo motor system by using nichols ziegler tuning method. My system has SSI encoder output for motor feedback mechanism. I will use this knowledge for control. According to nichols ziegler method i must know transfer function of my system. But i can not find its equation exactly. So how can i extract its transfer function? I need a methodology for this. Can i extract T.F. by using Matlab/Simulink or LAbview? </p> https://electronics.stackexchange.com/questions/202845/-/202891#202891 0 Answer by ozgur for How can i extract transfer function an unknown nonlinear system? ozgur https://electronics.stackexchange.com/users/83675 2015-11-26T13:57:48Z 2015-11-26T13:57:48Z <p>You can definitely try <a href="http://www.mathworks.com/products/sysid/" rel="nofollow">System Identification Toolbox</a> of Matlab. Official page says</p> <blockquote> <p>You can use time-domain and frequency-domain input-output data to identify continuous-time and discrete-time transfer functions, process models, and state-space models.</p> </blockquote> <p>Which is what you are looking for.</p> https://electronics.stackexchange.com/questions/202845/-/202893#202893 0 Answer by vini_i for How can i extract transfer function an unknown nonlinear system? vini_i https://electronics.stackexchange.com/users/81617 2015-11-26T14:06:35Z 2015-11-26T14:06:35Z <p>Your really have two choices.</p> <p>The first, like @LvW suggested, is to use the motor specifications such as in the illustration. This may be bore accurate but also more difficult because not all the specks will be available. </p> <p><a href="https://i.stack.imgur.com/S2rmC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S2rmC.png" alt="enter image description here"></a></p> <p>The second involves what you suggested. By applying a voltage to the motor and recording how its speed behaves. In effect this creates a step response that can be analyzed to find the specs for either a first order or second order system. If the system oscillates then a second order is what you want. If the system does not oscillate then you may be able to use a first order. </p> https://electronics.stackexchange.com/questions/202845/-/202897#202897 1 Answer by Chu for How can i extract transfer function an unknown nonlinear system? Chu https://electronics.stackexchange.com/users/66771 2015-11-26T14:45:40Z 2015-11-26T14:45:40Z <p>Ziegler-Nicholls tuning does not require the TF to be known - that's the whole point of the method.</p> https://electronics.stackexchange.com/questions/202845/-/204226#204226 0 Answer by docscience for How can i extract transfer function an unknown nonlinear system? docscience https://electronics.stackexchange.com/users/65409 2015-12-04T00:44:43Z 2015-12-04T00:44:43Z <p>The concept of <em>Transfer Function</em> is only defined for linear time invariant systems. Nonlinear system models rather stick to time domain descriptions as nonlinear differential equations rather than frequency domain descriptions.</p> <p>But in terms of current-in, speed out, your motor-encoder system is close enough to a linear system that you really don't need to concern yourself with nonlinear aspects (unless you are trying to control shaft angle to micro-radian precision!). </p> <p>Perhaps the easiest way to obtain a linear model is to apply a simple proportional feedback control tuned to get the loop stable, then record input-output data to a step response. Then fit the data to the closed loop transfer function. From the closed loop transfer function you can calculate the open loop transfer function, factor out the proportional gain and <em>voila</em> - your motor model! A simple linear DC motor model looks like: $$\frac{\omega}{i}=\frac{K_T}{Js+B}$$ where $$K_T$$ is the torque constant of the motor, $$J$$ is the motro shaft and load inertia and $$B$$ is the linear viscous damping of the motor bearings</p> <p>Perhaps your motor supplier already specifies these parameters in which case you don't have to test - you can write the model directly.</p> <p>Note that even if you are using a permanent magnet synchronous motor, in feedback with a stiff current controller, the model approaches the model of the DC (brush) motor.</p> https://electronics.stackexchange.com/questions/202845/-/354023#354023 0 Answer by Martin for How can i extract transfer function an unknown nonlinear system? Martin https://electronics.stackexchange.com/users/146295 2018-02-04T14:16:48Z 2018-02-04T14:16:48Z <p>There are two very good methods for estimating transfer functions. Look up moen4 and fitfrd. </p> <p>To use moen4 you need basically input and an output of a test. The algorithm then computes the transfer function that best fits the data. The results tend to be pretty good for some systems, less so for systems that have significant non-linear behavior (for which a linear transfer function does not exist). </p> <p>Here is code that you can use for both frd fit and moen4 fit. You can plot the data of freq_response_frd (frd object) directly using the bode() function to get a bode plot of your input data. Your input data must have sufficient frequency coverage so use a chirp signal that increases with frequency in time and collect the resulting response in another array. Then pass both arrays into the id_model_moen and you will get your transfer function back. </p> <p>I typically limit the frequencies that are analyzed because if you plot the full range returned by fft you will get a lot of noise outside of the range for which you even have test data - so that's useless part of results. </p> <pre><code>function [mag, phase, f] = freq_response_mag_phase(out, in, t, freqlim) dt = (t(end) - t(1)) / (length(t) - 1); NFFT = length(t); Fs = 1.0 / dt; fb = fft(out, NFFT); fa = fft(in, NFFT); f = [0:NFFT-1]*Fs/NFFT * 2 * pi; % find first bin after our test range. We will discard bins after it. ix = ceil(NFFT/2); if(exist("freqlim", "var")) ix = find(f&gt;freqlim,1); end f = f(1:ix); mag = abs(fb(1:ix)) ./ abs(fa(1:ix)); phase = unwrap(angle(fb(1:ix))) - unwrap(angle(fa(1:ix))); end function response = freq_response_frd(out, in, t, freqlim) if(exist("freqlim", "var")) [mag, phase, f] = freq_response_mag_phase(out, in, t, freqlim); else [mag, phase, f] = freq_response_mag_phase(out, in, t); end response = frd(mag .* exp(1i .* phase), f); end function sys_tf = id_model_frd(out, in, t, nr) resp = freq_response_frd(out, in, t); sys = fitfrd(resp, nr); [b, a] = ss2tf(minreal(sys)); sys_tf = tf(b, a); end function sys_tf = id_model_moen(out, in, t, nr) dt = (t(end) - t(1)) / (length(t) - 1); sys = moen4(iddata(out, in, dt), nr); [b,a] = ss2tf(d2c(sys)); sys_tf = tf(b, a); end </code></pre>