Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PID issue with negative error #4

Open
keck9939 opened this issue Mar 3, 2018 · 5 comments
Open

PID issue with negative error #4

keck9939 opened this issue Mar 3, 2018 · 5 comments

Comments

@keck9939
Copy link
Contributor

keck9939 commented Mar 3, 2018

If the error term in the PID calculation is negative, I believe the PID calculation falls apart. For example, if iLimit is 1.0 and iSource is 1.1, it calculates grossSetPoint = 0, fineSetPoint = 65533. Since for iSource = 0.9 you get grossSetPoint = 1 and fineSetPoint = 2, and for 0 error you get 0, there is clearly something wrong (the PID output should be a continuous function of the input). Looking at the code, it is clear there was no thought given to handling negative PID output. While it is possible the load may appear to operate correctly, I strongly suspect it is subject to overshoot and instability.

@calston
Copy link

calston commented Apr 22, 2018

I think this is the same issue I’m reproducing when the supply current limits and the I value goes below the loads limit setting. Your fix is a total rewrite though, which is a bit hard to review although probably not unwarranted given the quality

But since apparently no one at Sparkfun cares about this product sucking horribly maybe we should just fork this off to a different project so PRs actually go anywhere?

@keck9939
Copy link
Contributor Author

I rewrote it since I found there were a number of short comings and I wanted to add a mAh computation to use it to evaluate batteries. I forked it (keck9939/Variable_Load), but I am a GitHub newbie so I was hoping Sparkfun would respond to my pull request so I didn't have to become a maintainer. I doubt it is a hot seller which may explain Sparkfun's lack of interest. I would not have bought it if I didn't already have experience with PSoCs since I figured I'd want to modify it.

@calston
Copy link

calston commented Apr 23, 2018

I also intended to modify it but was not expecting how expensive that would be.

@keck9939
Copy link
Contributor Author

FYI, the cheapest way to get a programmer is to buy one of the Cypress PSoC dev boards. For example the CY8KIT-059 is $15. It includes a breakaway KitProg which can be used to program the Sparkfun board. Much cheaper than buying a MiniProg. And you might even find a use for the dev board (PSoCs rock!)

@calston
Copy link

calston commented Apr 23, 2018

I've ordered one of those but $15 turns into much more with customs and shipping to the middle of nowhere here... I do have some other things I want to do with that spare PSoC - opensource Analog SHARC interface, because that programmer is loooooodicrously expensive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants