79486533

Date: 2025-03-05 12:52:18
Score: 1
Natty:
Report link

You are right, there are positive and negative values, but you need to convert the energy output by PID into PWM format. Maybe the resolution of your PWM is 10bit=0~1023, and the energy you need is to convert Vout to 0~1023. What you need is the scale conversion formula to convert according to the resolution between your input and output!

Another point, you said there is a problem with positive and negative values. If your output is a DC of V, then when the PID is less than or equal to a negative value, it is zero. You need to limit the output of the PID. This depends on the units or measurements you use!

Of course, it is best to also limit the output of the integral to avoid the existence of uncertain factors. This depends on the situation!

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Warner Tsai