Cannot monitor signal even though it has value in External mode

4 次查看(过去 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:
  1. I can log the signal in the simplest configuration. I can feed a sine wave to my PWM input and read the angular velocity.
  2. 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.
  3. Note that if I just remove the Saturation block, the signals return to the screen.
  4. In another observation, a close-loop P (proportional) contorller works just fine.
  5. 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.
  6. 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 个)

类别

Help CenterFile Exchange 中查找有关 Signal Logging 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by