1.0.3 • Published 9 months ago

simple-pid-controller v1.0.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
9 months ago

PID Controller

A Proportional-Integral-Derivative (PID) controller is a control loop feedback mechanism widely used in industrial control systems. This module provides a PID controller implementation in Node.js.

Installation

To install this module, run the following command:

npm install pid-controller

Usage

First, require the module:

const PIDController = require('simple-pid-controller');

Then, create a new PIDController instance. You can optionally provide proportional, integral, and derivative gains:

const controller = new PIDController(1.2, 1, 0.01);

You can set a new target for the controller:

controller.setTarget(34);

And you can update the controller with the current value to get the control output:

let power = controller.update(currentValue);

API

This module exports the PIDController class, which has the following methods:

  • constructor(k_p = 1.0, k_i = 0.0, k_d = 0.0): Constructs a new PIDController.

  • setTarget(target): Sets a new target for the controller.

  • update(currentValue): Updates the controller with the current value and calculates the control output.

Applications

PID controllers are used in a wide variety of applications in industrial control systems and other areas, including:

  • Controlling the temperature of an oven
  • Regulating the speed of a car
  • Managing the flight controls of an airplane
  • Controlling the power output of a generator

By using this module, developers can implement PID control in their Node.js applications without having to understand all of the underlying mathematics.

License

This module is licensed under the Apache License.

Author

Harshad Joshi @ Bufferstack.IO Analytics Technology LLP, Pune

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

10 months ago

1.0.0

10 months ago