585,744 active members*
4,783 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Dynomotion/Kflop/Kanalog > AMC PWM DIR BD30A8 Amps using KFlop PWMs - tuning
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2011
    Posts
    30

    AMC PWM DIR BD30A8 Amps using KFlop PWMs - tuning

    I am moving this discussion from another forum to the CNCZone. It is much easier to read and add attachments etc.

    Recap:
    I am trying to control AMC BD30A8 "Direct PWM" servo amps using the KFlop PWMs and a DIR output.
    I have a single motor hooked up for testing.

    I have started off with the KAnalogInitalPID.mot config, changed the Axis Mode / Output to No Output and have Thread 1 running the code to convert ch0->Output to PWM duty cycle (inverted) and a DIR output. I have the P set to 0.2 with no I or D.

    The motor oscillates badly holding position.
    ----
    Tom, you suggested trying a D of 50. This did help quiet the oscillation, but I am afraid there is something else wrong.
    I set a Dead Band of 5 with a Gain of 0.05 and that quieted the oscillations some.

    Here is the Step Response for a 0 move with D=0.

    Attachment 181827

    To me, this looks like the motor is moving in concert with the Output value.
    IOW, it appears that the Output is telling the motor to oscillate.

    This 0.2 P setting with a very low Max Output is not going to provide any speed or torque for moves.
    I can set the D to 50,100,1000 or 10000 and then I can increase the Max Output. However, if I increase the P to above 0.2, the motor tries to jump off of the table.

    It seems to me I need to know how to get the Output value to stop oscillating in the first place.
    Could this problem have something to do with the position changing opposite the Output value?
    If I change the Gain to -1, the motor runs away until I flip the DIR values in the code. So, this is the correct Encoder and Motor connections.

    If I use the Step response screen to command a Move of 10000, the motor slowly makes one revolution and then returns. The plot shows the position tracks fine without oscillation while moving. Of course, the movement is way too slow.

    What can I do?

    Thanks.

    Attachment 181827

  2. #2
    Join Date
    May 2006
    Posts
    4045
    Hi Dean,

    Remove any Deadband until you get your axis stable. That will be used later.

    With P gain of 0.2 the negative feedback Output will always be exactly -0.2 x Position error. So the output being proportionally opposite is as expected.

    It will require some experimentation to find a stable system. Try the D gain again but try various values until you find a stable system. If necessary try reducing the P gain as well.

    Regards
    TK
    http://dynomotion.com

  3. #3
    Join Date
    Nov 2011
    Posts
    30
    I figured out the problem. Since the PWM is inverted, 100% is supposed to be a steady high. The PWM output still has pulses at 255.
    This causes the motor to turn when the ch->Output is 0, which causes the ch->Output to continuously fight the movement.
    So, I added a threshold define in code (5 for now). Whenever the Output (unsigned) is less than the threshold, I disable the PWM and SetStateBit(PWM_BIT, 1). When Output is greater, I SetStateBit(PWM_BIT, 0) and enable the PWM. This gets rid of the oscillations at stand still.
    There is torque applied when I try to turn the shaft by hand - this is what I was calling "Holding Torque", but obviously that is not the correct term for it. I'm sorry that I was misunderstanding the simple concept of the Output only changing if the position changes and thing it had to flip-flop. I understand now.

    It seems that a SetStateBit=1 overrides the PWM.
    Should I simply leave the PWM Enable Reg set at 1 and just set and clear the bit? Or should I continue to set/clear the PWM Enable Reg and set/clear the IO State Bit?
    Obviously, the logic is simpler if I just SetStateBit. But, I do not want to cause a problem of some kind.

    I have now been able to increase the Max Output, P gain, and D. I am up to P = 1, D = 1000.
    My Move tests for 2s, 1000 Size show sine wave oscillation when position 1000 is reached.
    The rest of the move follows pretty well. This seems like a very small P to me. However, you just stated that I could reduce the P from 0.2. That seems very low for some reason.
    Is there any "normal/average" P and D value ranges? Does a low P affect torque or velocity during a move?
    I am going to study up on that and what the P and D ranges are, how to apply filters, Bode plot analysis etc. etc.. so I do not have to ask so many questions.

    Since the motor is under no load on the bench, I just want to get a preliminary stable tune (backed off to be conservative) before I mount the motor back on the machine for final tuning.

    Thank you very much.

  4. #4
    Join Date
    May 2006
    Posts
    4045
    Hi Dean,

    Very clever of you to just disable the PWM to force 100%. I hadn't realized that we can't get 100% duty cycle but now that I think about it it makes sense. With an 8-bit pwm counter there are 256 clock cycles. If 0 corresponds to 0 clocks high, 255 would correspond to 255 clocks high. Maybe a modulo 255 counter would make more sense.

    SetBit should not override the PWM so I don't understand why you think this. Basically there is an Output Bit that can be set high or low. There is and independent PWM bit that toggles high or low. The PWM Enable bit controls a multiplexor that connects one or the other to the physical pin. So in your situation I would set the Output high (one time). Then simply disable the PWM to have the bit High, or enable the PWM to have it toggle as a PWM.

    It seems like a threshold of 5 would be pretty severe. That would have no output until a value of 5 and then a significant jump in torque without any means of generating lesser torque than 5. So you may want to try reducing this.

    The range of the gains is dependent on your system and many things combined so it is hard to specify a fixed range. I was just suggesting to go to an extremely low gain if you couldn't get stability any other way to find a starting point.

    You forgot to include any plots or your settings.

    Connecting to the machine will make a significant change to the system. Adding pure mass is like turning all the gains down.

    HTH
    Regards
    TK
    http://dynomotion.com

  5. #5
    Join Date
    Nov 2011
    Posts
    30
    I agree that a threshold of 5 is too much - it introduces a kind of dead band. 1 is really all that is needed (with D) to stop the horrible oscillations at stand still.
    I was unable to get a decent tuning on the bench without a load.
    I am sure that I could get a working system with the motor under its normal load and with your help. However, I have a set of Yaskawa drives that have Position mode and AC servo motors (750w) that I have decided to use for to upgrade the mill. The cost is much more, but I think it is worth it. I may use the DC motors and drives for some future project although they are awfully big for anything but moving heavy iron.
    I am going to post a question about encoder feedback to KFlop.

    Thanks for your help.

Similar Threads

  1. KFlop controller to interface w/ Prototrak Servo amps
    By wonderdog5 in forum Dynomotion/Kflop/Kanalog
    Replies: 34
    Last Post: 01-25-2014, 06:48 PM
  2. KFlop/SnapAmp - BDC Servo Beginning Tuning - Oscillations - Tracking Errors
    By PapstDFrisco in forum Dynomotion/Kflop/Kanalog
    Replies: 9
    Last Post: 04-03-2013, 11:09 PM
  3. KFLOP+Kanalog Analog Velocity Servo tuning
    By bradodarb in forum Dynomotion/Kflop/Kanalog
    Replies: 9
    Last Post: 07-01-2012, 01:19 AM
  4. 2.5 amps per phase drive - 2.8 amps per phase bipolar motor ...
    By kochevnik in forum Stepper Motors / Drives
    Replies: 6
    Last Post: 10-23-2006, 04:48 AM
  5. Howto find input amps, from output amps on transformer?
    By sendkeys in forum CNC Machine Related Electronics
    Replies: 7
    Last Post: 07-15-2004, 01:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •