GithubHelp home page GithubHelp logo

pid-controller's Issues

Mismatch between legacy constants and setMode()

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?

Calculation of ITerm is incorrect

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:

screen shot 2016-06-06 at 11 18 15 am

1.0.4:

screen shot 2016-06-06 at 11 16 16 am

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; }

Please release new version on npm

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.