Current turning capabilities status

More
13 years 6 days ago #40308 by emcPT
Currently we have almost all things figured out about the servos, and now the VFD arrived and we are testing the spindle.

I am quite happy with the working motor; high speed is obtained but deceleration is taking too long. I think it will be solved with a braking resistor.

My current issue is about the PID settings.

Background:
0-2500 rpm is the objective that I can achieve with 0 to 10VDC on the VFD. This is done.
I have encoder feedback that is also working and connected to the PID (I think). The output is made from a mesa, using the PWMGEN.
I tested a lot of settings on the PID values (only in P I and FF0) and until now I get a unstable operation or a stable operation that in the end does not do what I think it should. As I get the unstable operation, I believe that the PID is at least working as I get different outputs changing the PID settings.

The problem:
If I set the spindle speed to S100; it will achieve that speed (what is good), but if I put a load on the spindle, it will tend to stop. In fact I can totally stop it. My poor knowledge about the PID tells me that if the speed gets lower than the desired speed, the PID should compensate it and should increase the output value analog value, so that it will counterbalance the fact that the input speed is lower than the desired speed.

I have checked the pwmgen.03.value; and I can see that the value changed with the load, this is, I think it is really trying to compensate and that the PID is working - but necessarily in a not enough "powerful" because the compensation is not enough to get the desired output (in this case that the spindle do not stop).

The relevant part of the HAL:
Code:
setp hm2_5i20.0.pwmgen.03.output-type 1 setp hm2_5i20.0.pwmgen.03.scale [SPINDLE_9]OUTPUT_SCALE # ---ABS functions set up loadrt abs count=3 addf abs.0 servo-thread # analog output addf abs.1 servo-thread # Real spindle speed display addf abs.2 servo-thread # Commanded spindle speed display # ---Encoder feedback signals/setup--- setp hm2_5i20.0.encoder.03.counter-mode 0 setp hm2_5i20.0.encoder.03.filter 1 setp hm2_5i20.0.encoder.03.index-invert 0 setp hm2_5i20.0.encoder.03.index-mask 0 setp hm2_5i20.0.encoder.03.index-mask-invert 0 setp hm2_5i20.0.encoder.03.scale [SPINDLE_9]ENCODER_SCALE net spindle-revs <= hm2_5i20.0.encoder.03.position motion.spindle-revs net spindle-index-enable <=> hm2_5i20.0.encoder.03.index-enable <=> motion.spindle-index-enable net spindle-vel-fb-rps hm2_5i20.0.encoder.03.velocity => motion.spindle-speed-in #PID for spindle setp pid.s.Pgain [SPINDLE_9]P setp pid.s.Igain [SPINDLE_9]I setp pid.s.FF0 [SPINDLE_9]FF0 # ---setup spindle control signals--- net spindle-brake <= motion.spindle-brake net spindle-at-speed => motion.spindle-at-speed net spindle-vel-cmd-rps => motion.spindle-speed-out-rps => pid.s.command net spindle-vel-fb-rps pid.s.feedback net fwd motion.spindle-forward => hm2_5i20.0.7i84.0.2.output-06 net rvs motion.spindle-reverse => hm2_5i20.0.7i84.0.2.output-07 net spindle-on motion.spindle-on hm2_5i20.0.pwmgen.03.enable pid.s.enable net pid-out pid.s.output => abs.0.in net pid-abs abs.0.out => hm2_5i20.0.pwmgen.03.value

and the PID settings:
Code:
#******************** # Spindle #******************** [SPINDLE_9] P = 2 # (tested with 1 2 3 10 30 50 ...) from +-60 up the spindle commands do not work, and normally it clamps to the max speed to all speeds set I = 0 D = 0.0 FF0 = 60 ENCODER_SCALE = -1440 # encoder is 360 ppr OUTPUT_SCALE = -2500

Please Log in or Create an account to join the conversation.

More
13 years 6 days ago #40329 by PCW
What is the PID output when it runs away?

I suspect what is happening is this:

When you have the P gain high enough the PID output swings negative after an overshoot but since you have the absolute component the actual VFD control voltage is positive for a negative PID output so now instead of negative feedback in the loop, you have positive feedback and it runs away. (If my theory is correct, you will find the the PID output is full negative in the runaway condition)

This is definitely an unsafe situation so at the minimum I would shut things down on excessive PID error (and put the spindle commanded speed through a limit component to limit its rate of change so that the control loop can follow the command)

Maybe someone who has implemented closed loop spindle control can post some hal code for a more complete and working closed loop spindle control.

There ought to be some fairly standard HAL boilerplate for this

Please Log in or Create an account to join the conversation.

More
13 years 6 days ago #40333 by andypugh

emcPT wrote: 0-2500 rpm is the objective that I can achieve with 0 to 10VDC on the VFD. This is done.
I have encoder feedback that is also working and connected to the PID (I think).


First get it working as well as you can with P and I both zero. FF0 should be capable of doing very nearly the whole job.
In fact I am not all that convinced that closed-loop is even necessary with a VFD.

Then I suspect that part of your problem is as PCW has explained.

Please Log in or Create an account to join the conversation.

More
13 years 5 days ago #40341 by emcPT

PCW wrote: What is the PID output when it runs away?


It clamps to the max, so 10V in the analog output, so it should be doing exacly what you are saying. This is definitly a bad PID, and as I said in my post it only happens with a large P value = bad PID tunning.
For now it is not unsafe as the machine is under testing.

andypugh wrote: In fact I am not all that convinced that closed-loop is even necessary with a VFD.

This one I really did not expected, and it is for sure not my case.
In all of my parts I use constant surface speed, so it is necessary to have the spindle at the speed required by the controller. It is allowed to have a bit of variation, but as my test showed the PID is not working as expected. The rest of the PID's in my system for the servos are working ok, and I only have the P=1 set up.

PID settings applyed to my machine - this my also help others:

If i understand correctly the FF0 will place on the output the corresponding value for desired speed as a fixed value.
As example if I consider that I want a speed of 250rpm and my scale is from 0 to 2500 rpm, the FF0 will place on the output 10% of the output signal (in my case is 0-10V) so the FF0 will be responsable for placing in the output 1V. I am not sure why I have 60 in FF0 but it is sure related with 60seconds (1 minute).
So the FF0 (and the FF1 and FF2) will place on the outcomming value of the PID a value that not takes in account the feedback value.

So, if I ask for 250rpm, the analog value will be 1V, if the spindle is rotating at 0rpm; or 10rpm or 1000rpm (this would be enough, if the VFD was able to rotate the motor without the loss of torque, for example at low speeds).

Now, if P=1 with the same settings what would happen if the same spindle set speed is at 250rpm and the real spindle speed is at 0rpm? My basic math would say:

Final output (in volts from the mesa card) = 1V (due to the FF0 explained before) + 1 (from P) * (desired speed - actual speed)

now, and I probably I am wrong, the desired speed - actual speed are managed in relation with the output scale (in my case 2500), so the final formula should be:

Final output (in volts from the mesa card) = 1V (due to the FF0 explained before) + 1 (from P) * (1V - 0V)

and the PID output would be 2V.

This is correct? (I do not think so), because if it is, I am not getting this result on the machine.

Please Log in or Create an account to join the conversation.

More
13 years 5 days ago #40344 by andypugh

emcPT wrote:

andypugh wrote: In fact I am not all that convinced that closed-loop is even necessary with a VFD.

This one I really did not expected, and it is for sure not my case.
In all of my parts I use constant surface speed, so it is necessary to have the spindle at the speed required by the controller.


My lathe only has a 1kW motor, and I don't run PID. I get constant surface speed, and no real problem with the spindle slowing under cuts.
This is with the "standard" setup where the pwmgen.scale is set to 1500 (rpm) and the 10V speed of the VFD is set to 100Hz.
So, M3 S750 = 50% PWM = 5V = 50Hz. And that is the speed that the motor runs at.

As you increase the load on an induction motor is slows slightly relative to the VFD frequency, but not _very_ much.
If you look at this diagram: www.mindconnection.com/images/library/mo...nduction%20Motor.jpg then you can either accept the increase in slip and decrease in speed as the torque increases, or you can attempt to use a PID to increase the frequency, in effect rotating the A and B lines clockwise so that the motor speed is constant with torque. This is the slip compensation described in the article that that diagram came from: www.mindconnection.com/library/electrical/motorslip.htm

I don't know what the typical "slip" is of an induction motor at full load, but I think it is only a few %. So all the PID can do is give you that last few % of cutting speed accuracy. And you will probably find yourself experimenting by several 10s of % of spindle speed when looking for the best machining results.

So, this is why I am saying that PID may not be necessary with an induction motor and VFD setup.

Actually, I am not 100% sure that your motor isn't permanent magnet. In that case there is no slip, and the motor should run at exactly the speed that the VFD is set to.

It is allowed to have a bit of variation, but as my test showed the PID is not working as expected. The rest of the PID's in my system for the servos are working ok, and I only have the P=1 set up.

The servo PIDs are controlling motor speed (or torque) to achieve a position. When the position is correct, the motor can turn off and the position stays correct. (that is, zero position error -> zero P-term -> zero PID output)
For the spindle you have velocity in and velocity out. It is _not_ correct to turn the motor off when the speed is correct, because the motor will then slow down. So, the "P" term is not the most important part of your spindle PID controller.

So, as I said, first get the speed control as good as you can using _only_ the FF0 term, with everything else at zero. This is equivalent to the open-loop spindle control that I use on my lathe. You probably then need just a bit of I-gain to compensate for the errors. You may not want any P-gain at all.

But I think that PCW is on the right track when he says that your runaway is due to the "abs" functions.

Consider the situation when you have only a P-term and you command a spindle speed that is lower than the current speed. The PID output is negative, because the error is negative. But the abs-function converts the negative PID output to a positive voltage to the VFD. The motor speeds up. The error is now bigger, so the PID calculates an even bigger negative value, which the abs function makes in to an even bigger voltage command to the vfd…

If The P-term is small and the FF0 term is large, you won't see this, because (FF0 + (negative)P ) will still be a positive number.

But for a VFD-controlled spindle I am fairly sure that what you want is just FF0 and I, no P or D.

Please Log in or Create an account to join the conversation.

More
13 years 5 days ago #40354 by emcPT
Under load the motor will drop speed, that is for sure. The speed drop is much more evident in low speeds, even if I did not (until now) browsed all the respective parameters about the work at low speeds available in the VFD. Since this is not my first experience with VFD at low speeds (5 Hz; 10 Hz), I was hoping to get the most out of the available feedback - that works very well.

My lathe only has a 1kW motor, and I don't run PID. I get constant surface speed, and no real problem with the spindle slowing under cuts.
This is with the "standard" setup where the pwmgen.scale is set to 1500 (rpm) and the 10V speed of the VFD is set to 100Hz.
So, M3 S750 = 50% PWM = 5V = 50Hz. And that is the speed that the motor runs at.


In my case I also have it linear and without any PID compensation the output (with no load) fails the desired speed at most 100 rpm in 2500 rpm; or 15 rpm at 200 rpm. The issue is really the work under load at low speeds were the motor will display less torque.

The servo PIDs are controlling motor speed (or torque) to achieve a position. When the position is correct, the motor can turn off and the position stays correct. (that is, zero position error -> zero P-term -> zero PID output)
For the spindle you have velocity in and velocity out. It is _not_ correct to turn the motor off when the speed is correct, because the motor will then slow down. So, the "P" term is not the most important part of your spindle PID controller.

So, as I said, first get the speed control as good as you can using _only_ the FF0 term, with everything else at zero. This is equivalent to the open-loop spindle control that I use on my lathe. You probably then need just a bit of I-gain to compensate for the errors. You may not want any P-gain at all.

But I think that PCW is on the right track when he says that your runaway is due to the "abs" functions.

Consider the situation when you have only a P-term and you command a spindle speed that is lower than the current speed. The PID output is negative, because the error is negative. But the abs-function converts the negative PID output to a positive voltage to the VFD. The motor speeds up. The error is now bigger, so the PID calculates an even bigger negative value, which the abs function makes in to an even bigger voltage command to the vfd…

If The P-term is small and the FF0 term is large, you won't see this, because (FF0 + (negative)P ) will still be a positive number.

But for a VFD-controlled spindle I am fairly sure that what you want is just FF0 and I, no P or D.

Very good info there. Will test extensily and will post the results.
I would really want a compensation so that the desired speed is quite similar to the real speed, even on load.

What is your profession, if I may ask?

Please Log in or Create an account to join the conversation.

Time to create page: 0.136 seconds
Powered by Kunena Forum