Motor-controller model diverges when defects are added

Hello there, I’m kind of new to scilab so I’ll introduce myself: I’m Shon_Shon, I’m a college student studying awesome control, robotics and informatics stuff, and I found scilab because of xcos and it’s use for modeling systems.
I am currently doing a proyect where I model a permanent magnet synchronous motor and a controller with a reduced observer for it based on a guide given to me by a teacher. It works really well when the sensors and modulator are ideal, but as soon as I added second order transfer functions to the sensors and modulator it all went unstable. I need to make the sensor extremely fast for the system to barely converge. Some of my classmates did the project in simulink and theirs didn’t have that problem.
I added lot’s of graphs to see what is going on, but apparently it just starts like a small vibration in the current that grows more with each cycle until it eats the original signal.
The reference signal is the integral of a triangle curve that starts at 0, goes up, goes down and returns to 0.

I just don’t know what to do.
I’ll send the system models with and without delays so you can compare them, and also a functions file you need to execute before simulating.
If any wizard out there could take a look, say “Elemental, dear Watson” and tell me why it’s diverging I would be extremely grateful.
park.sce (1.3 KB) (functions file)
prueba_integracion_moduladores_4_err.zcos (45.2 KB) (model that diverges)
prueba_integracion_moduladores_2.zcos (39.7 KB) (model that doesn’t)

Hello,

Frankly speaking, this is hard to see what could be happening in a complex diagram like this. What I can say, is that there is an instability which prevents to simulate the system with good precision (trying to decrease relative and absolute tolerance of the solver does not help). I think that the problematic subsystem is the second order

wn_ang^2/s^2+2*wn_ang*s+wn_ang^2

if you multiply wn_ang by 2 (wn_ang = 4000*3*9) then there is no instability, but the closer to 2000*3*9, the larger the instability, i.e. see below for wn_ang = 2100*3*9:



It’s not a problem of Xcos vs. Simulink here but rather a misconception in your system, I hope my brief analysis above can help you to find where.

S.

1 Like

Thanks a lot.
I briefly considered a resonance of some kind it, but my classmates showing me their models working alright dispelled it for me. Thanks a lot for taking the time to review this.
I’ll try finetuning the frecuencies to avoid the instabilities.
If it works I’ll update this thread with another post.
Thanks again for experimenting with my model to find these things out, I’ll take the time to answer other questions I have the knowledge for too. :orange_heart: