Discrete transfer function implementation on hardware explodes to infinity
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I have a very simple transfer function model that works well in Matlab/Simulink. However, when I try to implement it on my actual hardware, the output quickly explodes to infinity.
I'm trying to deploy this model to a PLC running Twincat. Twincat has its own implementation of transfer functions which I have faith it is bug free. I have double checked my calls and I don't believe there is anything wrong (famous last words!).
Could this numeric instability be due to the way that matlab/simulink implements the calculation versus the way that Twincat does it?
Or could it be something related to the type/order of the model? Would state space offer any advantage in terms of numeric stability?
Thanks
#Matlab code
sys = tf([0 0.0611], [1 2.05 0])
sys =
0.0611
------------
s^2 + 2.05 s
Continuous-time transfer function.
sysd = c2d(sys, 0.002)
sysd =
1.22e-07 z + 1.219e-07
----------------------
z^2 - 1.996 z + 0.9959
Sample time: 0.002 seconds
Discrete-time transfer function.
5 Commenti
Mathieu NOE
il 8 Nov 2022
That sounds ok to me
make sure the a and b coefficients are passed in the right order (usual error is when copy paste from ascending vs descending power of z formalism)
Risposte (1)
Bora Eryilmaz
il 7 Dic 2022
Modificato: Bora Eryilmaz
il 7 Dic 2022
Your discrete transfer function has poles (almost) right on the unit circle:
sys = tf([0 0.0611], [1 2.05 0]);
sysd = c2d(sys, 0.002);
pzmap(sysd)
Any slight perturbation of your model coefficients when it is implemented using fixed-point numbers on the PLC would likely make your transfer function unstable.
Also, your model has an integrator (1/s term). So its simulation would go to infinity anyway.
step(sys)
0 Commenti
Vedere anche
Categorie
Scopri di più su Digital Input and Output in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


