How to identify transfer function of a motor with IODelay?
11 次查看(过去 30 天)
显示 更早的评论
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 个评论
Paul
2023-9-14
Hi Erik,
If you're willing, you should attach the data file (.mat file is fine) using the paperclip icon in the Insert menu. That way others can try to recreate and then modify your results.
I think you meant non-minimum phase, rather than nonlinear.
采纳的回答
Paul
2023-9-16
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 个评论
Paul
2023-9-22
You're quite welcome.
I'm afraid I can't offer any insight into deriving the inertia.
Good luck with your project!
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Transfer Function Models 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!