How to identify transfer function of a motor with IODelay?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a measurement series containing RPM measurements and their specific timestamps.
I tried to measure a step response, so the motors were starting from idle state.
My step was a setpoint of -250 RPM.
Looking at my measurement series I can see the first changes in RPM values after 117 samples (following the recorded timestamps a period of ~932ms)
Here you can look at the curve progression of the actual RPM:

Now I have done three different things to get my transfer function using tfest:
- cutting off all samples before first change could be seen (deleting the first 115 samples)
- using complete measurement series and adding an IODelay to tfest (115 as it is a discrete system)
- letting matlab decide on my iodelay by using NaN as IODelay
I received three different transfer functions.
First result:
I received a transfer function that seems to behave linear.
I am not sure if this is correct to use since I cut off the first samples.
However I'd like to see this as correct since the behaviour is linear.
Additionally I am concerned because of the results of my third approach - more on this later.

Second result:
I am not sure if I understood the documentation correctly but I thought giving the number of samples as input delay works.
Obviously this is not what you want to receive as a transfer function

Third result:
This seems to fit to my measurement series relating to the IODelay.
Somehow the behaviour turned nonlinear.
The IODelay is at about 0.23s. Actually this is what I wanted to see since I expect a delay of 200ms because of some mechanism in the code.
However I am really worried about the nonlinear behaviour and how MATLAB decided to use a IODelay of 0.23s since my measurement series shows first measureable reactions to the RPM at around 932ms.

This is the short snippet I used:
motor_right = iddata(right, right_setpoint, 0.008);
data_est = set(motor_right, 'InputName', 'u2', 'OutputName', 'y2');
tf_motor_right = tfest(data_est, 2, 1); %tfest(data_est, 2, 1, 115); tfest(data_est, 2, 1, NaN);
motor_right_zpk = zpk(tf_motor_right);
If you want to see the equations for the tf please let me know.
Now I dont really know how to trust my results.
Can anyone please help me evaluating these different results?
Thank you alot in advance!
2 commentaires
Réponse acceptée
Paul
le 16 Sep 2023
Hi Erik,
Here's what I tried:
Load the data
load forum.mat
Run the script so I can operate on the same variables. Take note of the warnings ...
identify_motor_behaviour
Assign a time vector using the sampling period, Ts, used to create the iddata objects
t = (0:numel(right_setpoint)-1)*0.008;
Here is the object created by tfest (after changing to zpk form). Note that it is a continous-time system
motor_right_zpk
Try tfest again, but specify the delay. Use the 116th element of the t vector. Might want to revisit the setpoint vector based on the warning, but we'll leave it for now.
motor_right_zpk_new = zpk(tfest(data_est,2,1,t(116)))
Simulate output for original and new systems
y = lsim(motor_right_zpk,right_setpoint,t);
ynew = lsim(motor_right_zpk_new,right_setpoint,t);
Plot and compare
figure
plot(t,right,t,y,t,ynew)
xline(t(116))
legend('data','y','ynew')
ynew looks pretty good.
Again, I'll note that y is NOT the output of a nonlinear system (after all, a zpk object is a representation of a linear system, by definition). It is the output of nonminimum phase system, i.e., motor_right_zpk as a zero in the righthalf plane, which casues the initial "wrong way" response in y.
8 commentaires
Paul
le 22 Sep 2023
You're quite welcome.
I'm afraid I can't offer any insight into deriving the inertia.
Good luck with your project!
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Transfer Function Models dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!