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

1 回表示 (過去 30 日間)
Arthur Nascimento
Arthur Nascimento 2019 年 11 月 12 日
編集済み: Arthur Nascimento 2019 年 11 月 14 日
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 Center および File ExchangeC2000 Microcontroller Blockset についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by