Cannot monitor signal even though it has value in External mode
3 次查看(过去 30 天)
显示 更早的评论
I have made a custom hardware using Arduino Leonardo which drives a DC motor with a rotary encoder. I have also made a custom Simulink block to drive my motor using Matlab system custom block which takes a PWM value and returns the angular velocity of the motor's shaft. I'm using the official Arduino support package.
The problem is that on certain occasions, I cannot plot the signals even though they have valid values. The signal is there, but I can't log it. The following are a few of my observations:
- I can log the signal in the simplest configuration. I can feed a sine wave to my PWM input and read the angular velocity.
- Now let's just add a minor detail. I now add a clamped noise signal to my input. Bear in mind that the sampling time of the Random Number block is set to -1, otherwise Simulink throws me an error. Now the motor is still running as expected but the signals are vanished.
- Note that if I just remove the Saturation block, the signals return to the screen.
- In another observation, a close-loop P (proportional) contorller works just fine.
- But as soon as I add a simple low-pass filter at the output of the motor block, the signals vanish again. Note that although the signals cannot be measured they are still there. Because the behavior of the motor changes when I tune my P coefficient and the closed-loop controller is indeed working.
- When I use Simulink's PID(s) block instead of using a Multiply block for my P controller, the closed-loop controller still works but I can't log the signals.
In summary, a variety of blocks such as PID(s), LPF, Saturation, and many more disrupt signal logging which doesn't make sense to me.
I've tried many things but still haven't figured out what to do.
Thanks.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Signal Logging 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!