7
\$\begingroup\$

I have gone through several PID implementations and its tuning tutorials, documents and all. The Best tuning tutorial was PID-without-a-PhD.pdf . But has not been of much help. I can say it works some.

I am working on a Magnetic Levitation project. Please go through the link (Barry's Maglev) for an example. I am able to levitate the magnet keeping an aluminium plate below. Current progress: Video.

I want to perform it without the aluminium plate.

My question is how to start with graph plotting and all. I've seen and been attracted towards the graph only. Say take the PID-without-a-PhD.pdf file and just look at the plotted graphs. How to get that? which open tool to start with?

I have tried building and working on some self made graph plotting tool. The plotting against time is not satisfying, and hence the gain determination.

[If there are any self explanatory auto-tune algorithm available! : this is not my question now.]

I want to restart fresh with hard systematic approach. Any help will be god like helpful. I don't want to go with trail-n-error method. As that didn't help.

I am using AtMega2560, a coil, a stack of 2 neodymium magnet, a nicely working H-Bridge.

....Update1....

Also a hall sensor for feedback.

........

....Update2....

Now I have its transfer function with me. I am studying LTI Transient-Response Analysis using Python. The issue is I have a matrix of transfer functions. I might be wrong because what is called what, I don't know exactly. Will learn it soon.

........

\$\endgroup\$
6
  • \$\begingroup\$ What is the hall effect sensor measuring? Do you have direct measurement of ball position? In the last maglev system I worked with it as done with photo detectors and LEDs - IR I believe. \$\endgroup\$
    – AngryEE
    Feb 17, 2012 at 17:34
  • \$\begingroup\$ Yes I am measuring the position directly. The unit is not distance for now. But yes I can relate the sensor output with distance. Which is not needed currently. In short the system can know where the ball is, magnet rather. :) N its nice that you already have experience in Maglev. \$\endgroup\$
    – Rick2047
    Feb 18, 2012 at 9:07
  • \$\begingroup\$ If you have only one sensor (displacement sensor) and one actuator (force), then you should have only one transfer function. Why/how do you have a matrix of transfer functions? \$\endgroup\$
    – nibot
    Feb 20, 2012 at 9:05
  • \$\begingroup\$ @nibot Because gravity is exerting another force. So total two forces and one sensor. :) \$\endgroup\$
    – Rick2047
    Feb 20, 2012 at 16:01
  • \$\begingroup\$ The force of gravity is constant. And, you don't control it. So: no transfer function. \$\endgroup\$
    – nibot
    Feb 21, 2012 at 9:10

3 Answers 3

5
\$\begingroup\$

Generally in industry this would be done with Matlab. If you're trying it on your own you have a few different options as far as numerical calculation/graph plotting software is concerned. First among them is SciLab - a program very like Matlab but open source and free. There are a couple of toolboxes that may or may not provide useful functions for designing and analyzing control systems: Control Design Tool (very popular it seems) and ADS CoLiSyS (much less popular).

Otherwise you could try NumPy or SciPy which have some numerical/graphing capabilities but no control system toolboxes.

Edit: As for tuning a PID controller using a well-known method... you may be out of luck. You can try methods like Ziegler-Nichols but since you're working with an unstable system (the ball will fall without feedback control) you can't do what the method recommends (ie, 'turn off' integral and derivative gains to tune proportional alone, then assign integral and derivative gains as a multiple of proportional gain). However, if you can create a controller that simply stabilizes the ball at a set point (a disturbance rejection controller - the disturbance being gravity) then you can add in your PID controller in series and tune it that way once the system is stable. But it seems your overall goal is to make a controller that will simply stabilize the ball and not, for instance, make it follow a square wave or sinusoid input. So that may not be a worthwhile approach. Keep in mind that what you're doing is by no means basic controls and simplistic approaches don't necessarily apply. Good luck.

\$\endgroup\$
7
  • \$\begingroup\$ m so sorry .. I forgot to mention the hall sensor input to the PID. I am also using a hall sensor. I am also updating the same above. \$\endgroup\$
    – Rick2047
    Feb 17, 2012 at 4:53
  • \$\begingroup\$ You forgot Octave, that I've read to be more similar to Matlab, is free software and with Octave-forge has a number of toolboxes, almost surely also the control systems one. \$\endgroup\$
    – clabacchio
    Feb 17, 2012 at 7:40
  • \$\begingroup\$ I was under the impression that Scilab was created by castaways from Matlab itself. I'll bet they're both pretty close though. Everyone copies the leader... \$\endgroup\$
    – AngryEE
    Feb 17, 2012 at 14:55
  • \$\begingroup\$ Octave is closer to older versions of Matlab. Interface is pure command-line. Octave's sytax is meant to be almost completely Matlab-compatible. SciLab has more GUI features, and less direct Matlab compatibility. SciLab seems to be more aligned with instructional uses. Either one probably has everything you need to do basic PID system simulations. \$\endgroup\$
    – The Photon
    Feb 17, 2012 at 17:45
  • \$\begingroup\$ Should also add that Octave was originally developed for Unix/Linux and the Windows version is not entirely bug-free. SciLab seems to have better Windows compatibility (However I've used Octave more than SciLab). \$\endgroup\$
    – The Photon
    Feb 17, 2012 at 17:50
0
\$\begingroup\$

Have a look at 20-sim, they have a free version available, there are many toolboxes (also for controller design and LTI systems) and the latest version 4.4 has scripting with Matlab and Octave as well. Here's their site: http://www.20sim.com

\$\endgroup\$
0
\$\begingroup\$

Not open source, but CircuitLab will do the plotting in the time and frequency domain as you require. You can compose the feedback loop graphically using either circuit elements or Laplace transform blocks, and then measure the response and tweak your PID parameters to make sure you get a stable result! For example, see Laplace transform step response and Bode plot.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.