Microchip
直播中

王桂兰

7年用户 1171经验值
私信 关注
[问答]

Simulink中的模拟与现实之间的差异

亲爱的鲁宾,我在Simulink开发了一个获得正弦PWM的模型。我将正弦曲线的期望频率插入到常数中,这将在查找表索引中进行变换。在查找表中有正弦波的值。在Simulink中运行仿真,我得到了预期的结果:三个正弦波从120个移动到另一个正弦波。然后,如果我设置50MIPS和0.001的固定步长(配置time1)和I编程设备,我得到同样的东西。当我改变MIPS或固定步长(Time1)时,在SIMULINK中,仍然得到一个50Hz的正弦波(如预期的那样),而当我编程时,我得到一个非常低的频率:在5到7赫兹之间或多或少。PPN。在50MIPS和0.001固定步长下,我得到4Hz,如果我改变这些值,LED闪烁在非常低的频率。我不明白问题在哪里。你有什么建议吗?谢谢你。

以上来自于百度翻译


      以下为原文

    Dear Lubin,

I have developed in Simulink the model to obtain a sinusoidal PWM. I insert in the constant the desired frequency of the sinusoid, this will be transformed in the lookup table index. In the lookup table there are the values of a sinusoid.

Running the simulation in Simulink, I obtain what expected: three sinusoids shifted of 120 degree one from the other.

Then, if I set 50MIPS and 0.001 of fixed step size (that configure Timer1) and I program the device, I obtain the same thing that I obtain in Simulink.

Whenever I change the MIPS or the fixed step size (Timer1), in Simulink I still obtain a 50Hz sinusoid (as expected), while when I program the device I obtain a very low frequency: more or less between 5 - 7 Hz.
Also, I have put an LED with 4Hz frequency and the same thing happen. With 50MIPS and 0.001 fixed step size I obtain 4Hz and if I change these values the LED blinks at a very low frequency.

I cannot understand where is the problem. Do you have suggestions?
Thank you.

Best regards,
Filippo
   Attached Image(s)

更多回帖

发帖
×
20
完善资料,
赚取积分