Git Product home page Git Product logo

pid-controller's Introduction

PID Controller

A Universal Windows Runtime Component that implements a very simple proportional-integral-derivative controller.

Installation

Step 1: Create a new project!

  1. In Visual Studio select File -> New -> Project

  2. Select your language of choice. The PID Controller is a Universal Windows Runtime Component, meaning it is compatable with C++, C#, or JavaScript.

  3. Select the "Windows" option under the language you selected and choose "Blank App (Universal Windows)".

Step 2: Add the PidController project to your solution

  1. Clone the PID Controller repository or download the zip file.

  2. Right-click on your solution in the Solution Explorer and select Add -> Existing Project

  3. Navigate to your local copy of the PID Controller repository and select PidController.csproj

  4. Right-click on References in your main project within the solution. Select Add Reference

  5. Under the "Projects" tab, select PidController

  6. Rebuild your solution by selecting Build -> Rebuild All

Example

For an example of this code being used to control motor RPM see our Closed-Loop Control Demo.

Constructor

PidController controller = new PidController(float GainProportional, float GainIntegral, float GainDerivative, float OutputMax, float OutputMin);
  • GainProportional - The proportional gain in the feedback loop
  • GainIntegral - The integral gain in the feedback loop
  • GainDerivative - The derivative gain in the feedback loop
  • OutputMax - The maximum value the ControlVariable property can return
  • OutputMin - The minimum value the ControlVariable property can return

Properties

Property Type Access Description
GainProportional double get/set The proportional gain in the feedback loop
GainIntegral double get/set The integral gain in the feedback loop
GainDerivative double get/set The derivative gain in the feedback loop
OutputMax double get The maximum value the ControlVariable function can return
OutputMin double get The minimum value the ControlVariable function can return
IntegralTerm double get Tracks the accumulated error in the control loop
ProcessVariable double get/set Current value of the process under control
ProcessVariableLast double get Last stored value of the process under control
SetPoint double get/set The desired value of the process under control

Functions

Function Return Type Description
ControlVariable(TimeSpan timeSinceLastUpdate) double The control variable that drives the process under control, depending on the amount of time that passed since the last time it was called

Tuning

There are lots of resources online for learning how to tune a PID controller. For a quick primer see the Wikipedia entry on manual tuning.

===

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

pid-controller's People

Contributors

hansmbakker avatar sidwarkd avatar ooeygui avatar tommallama avatar bfjelds avatar iotgirl avatar zfields avatar

Watchers

James Cloos avatar Martin Dahlstedt avatar

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.