How to identify transfer function of a motor with IODelay?
6 vues (au cours des 30 derniers jours)
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.
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.
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
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!
Paul le 16 Sep 2023
Here's what I tried:
Load the data
Run the script so I can operate on the same variables. Take note of the warnings ...
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
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
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.