Jump to content

PID control demo


planetguy
 Share

Recommended Posts

For a school project, I made a demonstration of PID controllers. It's kind of primitive, but here it is. (Mostly-up-to-date source code here.)

 

When you start it, it creates three windows (since I didn't know how to get everything into one window).

 

The biggest window is the graph. The blue line is the target value, the red line is the controller's output. The green lines (if there are any) are the distance the controller can be pushed by the random noise selected. The straight red line at the bottom is the zero mark, and the red line across the middle is the controller's output.

 

To the right is the help window. It has a list of the parameters that can be changed, and next to each one is a short description of what it does. Note that the "historyLength" parameter is ignored.

 

To the bottom of the graph is the input window. Commands are entered in the form <parameter>=<value>, where parameter is one of the things named in the help window, and value is a (possibly decimal) number. For example, to set the proportional term to 0.9 I would type "p=0.9" and hit enter to run it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...