wilberforce / pid-controller Goto Github PK
View Code? Open in Web Editor NEWAn advanced PID controller based on the Arduino PID library
License: GNU General Public License v3.0
An advanced PID controller based on the Arduino PID library
License: GNU General Public License v3.0
in the pid code, the following are defined:
// Constants for backward compatibility
PID.AUTOMATIC = 1;
PID.MANUAL = 0;
I assumed these were to be passed to setMode() - I prefer explicit constants to "magic strings".
However, in setMode(), instead of values 0 and 1, setMode() refers to 1 and 2:
if (Mode == 1 || Mode.toString().toLowerCase() == 'automatic' || Mode.toString().toLowerCase() == 'auto') {
newAuto = 1;
}
else if (Mode == 2 || Mode.toString().toLowerCase() == 'manual') {
newAuto = 0;
}
Shouldn't these correspond?
Hi @wilberforce - thanks for making this library available for Node.js. I'm going to use it to make a kiln controller - the hardware is already done and now I just need to write a server program that lets you set temperature schedules and performs PID control to hit the desired temperatures.
It looks like after PR #2 was merged with an example in the readme file, the corresponding code was not pushed to npm.
As a result, running the example code in the readme against the latest released version (1.0.3) fails as follows:
$ node pid.js
Output : 0 ; Temp : 9.5°c
Output : 0 ; Temp : 9°c
Output : 0 ; Temp : 8.5°c
Output : 0 ; Temp : 8°c
Output : 0 ; Temp : 7.5°c
Output : 0 ; Temp : 7°c
Output : 0 ; Temp : 6.5°c
Output : 0 ; Temp : 6°c
[...]
Output : 0 ; Temp : 1°c
Output : 0 ; Temp : 0.5°c
Output : 0 ; Temp : 0°c
Output : 0 ; Temp : -0.5°c
Output : 0 ; Temp : -1°c
Output : 0 ; Temp : -1.5°c
Output : 0 ; Temp : -2°c
Output : 0 ; Temp : -2.5°c
[...]
Can you please release the latest code on npm so that the example in the readme works as intended?
Note - if there are breaking changes in the new version, then the version number should be bumped to 2.0.0 to adhere to semver, the npm versioning standard.
I'm getting wildly different output results after pulling the 1.0.4 version of PID.compute vs the 1.0.3 version. Comparing the two versions:
1.0.3:
1.0.4:
The output saturator appears to be the root cause, and I am unable to explain why it was changed from this in 1.0.3:
if(output > this.outMax) output = this.outMax; else if(output < this.outMin) output = this.outMin;
to this in 1.0.4:
if (output > this.outMax) { this.ITerm -= (output - this.outMax); output = this.outMax; } else if (output < this.outMin) { this.ITerm += (this.outMin - output); output = this.outMin; }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.