Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Discrete transfer function controller for servo motor

Hello LabVIEW community,

 

I'm trying to control a servo motor using a discrete transfer function controller and I'm having trouble getting the controller to output values that make sense. I've successfully designed and simulated the transfer function in MATLAB but when I implement the same model in LV, I'm getting values outputted from the controller that are on a scale much larger than expected.

 

I'm using a USB-6211 to read data from a force sensor and then send a PWM signal to the servo based on the desired setpoint function for the force. The servo PWM signal can range from 5% to 5.8%. Unfortunately, I'm unable to specify bounds on the discrete tf controller (I'm able to with PID control) and the output ranges from 0 to 10^30, well outside the 5 to 5.8 range that I desire. Is there any way to specify the output range for the discrete controller?

 

I've attached a zip of the project I'm working on (main VI is TestMain.vi) and pictures of the creation of the tf model and the discrete tf controller. Please let me know if more information is needed, thanks in advance for the help!

0 Kudos
Message 1 of 4
(321 Views)

Have you checked the ordering of the discrete polynomial - the a and b terms - if you are taking the polynomials from Matlab and trying to use in LabVIEW I think they are different - one is in ascending powers of z and the other in descending powers of z (can't rememeber which way around - but documentation will explain)

 

Also, check if you are working with powers of z or powers of z^-1 correctly in both.

 

Also, check that that the sample time is consistent between both.

Consultant Control Engineer
www-isc-ltd.com
0 Kudos
Message 2 of 4
(305 Views)

Thanks for the response Andy, I did check to make sure that the a and b terms were correctly ordered in LabVIEW. I also have used the same sampling time and the powers should be consistent. 

0 Kudos
Message 3 of 4
(299 Views)

OK. Since you are trying to use the discrete transfer function within a feedback controller it can be hard to isolate the problem if you keep it in closed loop. After the initial checks you have done, I would then check that the TF itself is appropriate as a controller.There are plenty of reasons why a controller could go to exponentially large values - even if everything programmed correct:

  • Gains too high - around the whole loop, from measurement, controller, PWM output
  • Positive feedback - have you got the error calculated in the correct way - usually it is SP-PV but depends on you system (whcih direction it moves)
  • Integrators in the control loop - especially if you have two (which could be integral action in PID and integrating effect of motor if controlling position rather than velocity for example)
  • Time delays - especially with high gains
  • Discrete time approximiations - again especially with high gains

 

Break the control loop (i.e. open loop), and apply a small step error to the input of the Controller - do you get what you expect on the output of the Transfer Function.in terms of magnitude, direction and speed of response. If you controller is integrating then it may just keep ramping up - so you need to see how fast it ramps up. Then if that is ok. Look at how the step error translates to a change in your PWM and motor motion again does it change correctly in terms of magnitude, direction and speed.

 

You might find there is a scaling factor needed to be inserted to get the error propapagting around the loop in a sensible fashion.

 

The Key with debugging control loops is to break the loop and understand responses, and start with a sluggishly tuned controller - ideally without integrating or derivative action which can give their own problems.

Consultant Control Engineer
www-isc-ltd.com
0 Kudos
Message 4 of 4
(255 Views)