C2000 F28379D controlCard dipping in frequency when using S-funcion builder

1 次查看(过去 30 天)
Hello, I'm using a F28399D controlCard to develop a motor control S-Function, but I need a minimun frequency of 20kHz pulses, so I made the S-Function output a pwm to check the processing frequency, the s-function sample frequency is set to 20kHz. When the pwm is checked it displays a frequency of exactly 500Hz.
So I cleaned the code leaving only the "frequency checking Pwm" and I could check 20kHz. Then I started laying the code "line by line" and I discovered tha a lot of lines have impact on the performance, but this impact is very weird, since it decreases my frequency in integer values.
Example of lines that seem to impact the frequency:
ilaP=xD[0]+Ts[0]*(-(Rr[0]/(sig*l2)+(Rs[0]/(sig*l1)))*xD[0]-p*wm[0]*xD[1]+Rr[0]/(sig*l1*l2)*xD[2]+(p*wm[0]/(sig*l1))*xD[3]+(1/(sig*l1))*Valfa[index]);
ilbP=xD[1]+Ts[0]*(-(Rr[0]/(sig*l2)+(Rs[0]/(sig*l1)))*xD[1]+p*wm[0]*xD[0]+Rr[0]/(sig*l1*l2)*xD[3]-(p*wm[0]/(sig*l1))*xD[2]+(1/(sig*l1))*Vbeta[index]);
Am I doing something wrong?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 C2000 Microcontroller Blockset 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by