Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How can I control two outputs with a single PID-controller?

  1. Jun 25, 2015 #1
    Overview
    I'm trying to levitate a constrained permanent magnet with 2 electromagnets. I'm having trouble conceptualizing the control system for such an operation.

    Setup
    The permanent magnet is fixed onto a horizontal pendulum and is repelled by an electromagnet above and repelled by an electromagnet below. The pendulum is attached to a rotary encoder that provides the absolute angle of the pendulum with respect to the horizontal.

    Goal
    Given a desired angle (relative to the horizontal), I need to change change the voltage going to each electromagnet. For example, if I want the pendulum to be at +25 degrees, the control system would increase voltage to the electromagnet below the pendulum and decrease voltage to the electromagnet above the pendulum, resulting in a net upwards force.

    Problem
    I was advised to use a PID controller. I'd heard of, but never used, a PID controller, so I researched them a bit online, and I understand the general idea--it's just like somebody adjusting water temperature before showering. However, my intuition tells me that I cannot use a single PID loop to control the two electromagnets because I'd be using a single input to solve two outputs. It'd be like saying f(x) = y1 and f(x) = y2 where f is a linear function. Since that's not possible for a linear function--and PIDs are linear control systems--then I cannot control 2 motors with a single PID controller.

    Am I right? If so, could you point me towards how people have solved similar problems? I feel like this is a common problem with control systems.

    If I'm wrong, could you provide an example?

    Many thanks!
     
  2. jcsd
  3. Jun 26, 2015 #2

    Hesch

    User Avatar
    Gold Member

    Could you sketch the system, for example labelling the magnets M1, M2, M3 or whatever? It will then be much easier to comment the system, referring to these labels/names.

    Are you using digital control ( encoder ) or analog control?
     
  4. Jun 26, 2015 #3

    donpacino

    User Avatar
    Gold Member

    You should still follow Hesch's advice, but im going to try and point some things out

    Your feedback mechanism is the measured angle. You want to match that to the desired angle.

    The difference of those two signals will give you your error. It is this error that you then use the controller on. This is to determine how much actuation is needed to bring the error to zero. After that you address the actuation of your system, in this case increasing and decreasing the voltage to electromagnets, assuming they are the same and linear. If not, after your first pid controller, you will need to map out what voltage vs force will be for the various angles you can have.
    does that make sense?
     
  5. Jun 26, 2015 #4
    I added some visuals.

    @Hesch : I'm not sure what you mean by digital/analog. I'm using an absolute rotary encoder that outputs an analog voltage if that's what you're asking. I acquire it's data using a DAQ and set the electromagnet voltages via a LabVIEW-controlled power supply.

    @donpacino : What do you mean by "assuming they are the same and linear"--are you referring to the voltage of the electromagnets? If so, they will not be the same because em2 will have to be stronger than em1 to also overcome gravity. So I'm going to have to figure out the gains completely by trial and error?
     
  6. Jun 26, 2015 #5

    Hesch

    User Avatar
    Gold Member

    mgds6.png

    I don't understand why you not just connect em1 and em2 in series in such a way that the polarity as of m1 is switched, so that the em's are helping each other instead of working against each other. The direction of the force can be controlled by changing the direction of the current, and you will need only one PID since there is only one output.
    Digital control is when using a (digital) computer to compute the control loop. The computer samles signal values at a sample frequency of say 200Hz,
    ( sample period = 5ms ), and calculates the output within say 0.5ms. In the remaining 4.5ms the computer will do other jobs ( e.g. controlling another plant ).

    Contrary an analog controller will do "analog calculations" by means of amplifiers, resistors and capacitors.

    Be aware of the number of poles in the control loop: By mental arithmetic I can count 4 poles:

    * pid
    * self-induction in the em's
    * force/acceleration → velocity
    * velocity → position

    So I think you'll need something like a PI2D3 controller to make the loop stable, and without too much noise. That will be hard.
    I'd recommend making an inner loop in the controller, that will control the current in the em's. You then build this current loop into a bigger loop.
    In this way you solve one problem at a time ( here the time-constant in the em's ). You will get a much more rigid and robust system in this way.
    Yes, you may have ( will have ) problems with linearity, and if you had used a digital controller, it would be very easy to create a map/look-up-table for linearization.

    Should you one day have the opportunity to study digital controllers, I'd recommend that. You'll see what they can do.
     
    Last edited: Jun 26, 2015
  7. Jun 26, 2015 #6
    My current repulsion/repulsion setup barely works because the permanent magnet snaps up to the electromagnet's magnetic housing (as in the outer housing of the electromagnet is magnetic). Thus, when I have an attraction/repulsion setup with my electromagnets, my permanent magnet would tend to snap even more! However, I guess a PID controller that is sufficiently-tuned can handle this.

    Re: Analog vs. Digital: I'm using a PID vi in LabVIEW, so I'm using a digital controller. Correct?

    Given 4 poles, how did you get PI2D3?

    Also, in another thread, you tried helping someone with calculating the strength of an electromagnet. Is there a model, like Newton's theory of universal gravity or Coulomb's law for electrostatic forces, that would enable me to calculate the strength of a particle's magnetic field at a distance?
    If I knew the magnetic field or force strength at a distance, then I could work backwards to find the voltage necessary to create that field and program my control loop that way.
     
  8. Jun 27, 2015 #7

    Hesch

    User Avatar
    Gold Member

    Well, I'm an old ( and experienced ) man, so I guessed. :smile:

    I just mentally "see" this root-locus as for the system, all these curves spreading out in all directions: If a PID is requested, you have these 4 poles. You can control the 4 curves coming from the poles by 2 - 3 zeroes, but these zeroes will create a lot of noise, so it's better to reserve en extra pole to dampen this noise and then keep to 3 zeroes.

    Thus PI2D3.

    Making a printet circuit board ( PCB ), it's better to have too many knobs to adjust than too few ( you can always short-circuit a PI-function if it's not needed ).

    Root locus ( 11 poles ):
    image117.png
     
    Last edited: Jun 27, 2015
  9. Jun 27, 2015 #8

    Hesch

    User Avatar
    Gold Member

    I don't know anything about particles voltage creating a magnetic field strength?

    I've heard people speaking of such particles, but have anybody found one? I regard a magnetic field to be a circulation field, and thus is not emitted by some particle, having some "starting point". But "show" me one of these particles. ( I'm saying: The earth is flat as a pancake :smile: ).

    As for the control loop: Stick to root locus. That's a very heavy tool, and it works.
     
  10. Jun 27, 2015 #9

    Hesch

    User Avatar
    Gold Member

    Exactly: Show them what you can do. That's the spirit. :wink: ( Maybe you can make some mechanical stop that prevents the magnets to snap ( some non-magnetic material glued to the poles of the em's ). A hit will give you a fine = -1 point ).
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: How can I control two outputs with a single PID-controller?
  1. PID Control (Replies: 3)

  2. PID control doubt (Replies: 1)

Loading...