Newbie PID advice on a retrofit BenchmanXT - Page 2

1. Re: PID advice on a retrofit BenchmanXT

Hi Steve,

I believe I see what happens. Threads are several c programs that run in turn in a continuous loop with the servo routine executing in between all the threads. The threads service things like the push buttons and potentiometers on the front panel. I think I understand now. At first I thought I would have to combine all these programs into a single master C program but this makes life so much easier!
That is correct the User Threads execute as shown here:

But for efficiency reasons we prefer that you service all of your system in one Thread if possible. See:

I have studied the CNC Spindle overview and I think I understand it but I have a couple of things on which I'm unclear. I see that the example is just a theoretical one and the numbers were chosen for clarity but I'm just not getting it. The example seems to setup the parameters for an easy example such that JOG command (in this example) is a percentage value. i.e. Jog0 = .25 gives a velocity 25% of full speed. "This demonstration Move profile moves at 0.5 counts/sec which results in half of the full DAC output range (1023 counts or 5V analog). " "Any Velocity Range could be used because this is only a theoretical velocity profile and can be scaled to any proportion by the Velocity Feed Forward. 1.0 counts/s is used to keep the math simple" the Jog<N>=<V> command in help says that V is position units per second. So with (V) .5 counts/second x (VFF) 2047 = Appox 1023 or half speed. Does this mean this example can never go full speed since the .5 count /sec will limit the top speed? In my case I have a (theoretical) 5000RPM and the sheets show a 2000 lines per rev encoder so 2000*5000/60) gives 166,667 counts per sec at 5000RPM. I assume this the the value I would use for the Factor definition? And My V in the motion profile should also be 166,667?
First regarding 0.5 counts/sec being half speed: that is only an example. The V max setting is the max Velocity use by default for Moves, but Jogs can still be commanded at any speed.

Yes I think in your case I would scale things differently to make it work similarly open or closed loop. Scale the VFF down such that open loop (PID off) it takes V=166,667 counts/sec to provide full DAC output to go 5000RPM and the encoder runs at ~166,667 counts/sec.

HTH
Regards

2. Re: PID advice on a retrofit BenchmanXT

Tom,

It's beginning to make sense. I was looking at the SetSSOwithPot.c file you send. I wanted to add the FRO pot program to this one since they are both using WaitNextTimeSlice();
The second line is:
"#define TMP 10 // which spare persist to use to transfer data"

I don't see this being used in the program. How does this fit into the program? Will I need to define a Persist for the additional pot?
I thought Maybe in the PC-DSP file:

#define PC_COMM_SET_FRO 5 // Persist+1 is the FRO as a float
#define PC_COMM_SET_FRO_INC 6 // Persist+1 is the factor to change it as float

and

#define PC_COMM_SET_SSO 21 // Persist+1 is the SSO as a float
#define PC_COMM_SET_SSO_INC 22 // Persist+1 is the factor to change it as float

Actually define the individual Persists for these operations. Or are these not related and used for some other function?

Also looking at

External Buttons.c It has "#define ESTOP 26"
But EstopDisablesAll.c has "#define ESTOP_BIT 180"

Are these just arbritrary assignments for examples or is there some significance to 26 and 180?

Thanks again

Steve

Regarding Pots for SSO and FRO see the example:
C:\KMotion433\C Programs\SetFROwithPot.c

And attached a similar example for SSO.

HTH
Regards

3. Re: PID advice on a retrofit BenchmanXT

Hi Steve,

It's beginning to make sense. I was looking at the SetSSOwithPot.c file you send. I wanted to add the FRO pot program to this one since they are both using WaitNextTimeSlice();
The second line is:
"#define TMP 10 // which spare persist to use to transfer data"

I don't see this being used in the program. How does this fit into the program? Will I need to define a Persist for the additional pot?
I thought Maybe in the PC-DSP file:
No the TMP is used for general communication with KMotionCNC by the functions in and included with:

#include "KflopToKMotionCNCFunctions.c"

You shouldn't need to worry about changing or multiple TMP variables.

Also looking at

External Buttons.c It has "#define ESTOP 26"
But EstopDisablesAll.c has "#define ESTOP_BIT 180"

Are these just arbritrary assignments for examples or is there some significance to 26 and 180?
Any Input can be used for things handled in software such as EStop or Limit Switches. Depending on how/where the device is connected will determine which input Bit should be checked by your software.

HTH
Regards

4. Re: PID advice on a retrofit BenchmanXT

Tom,

I'm still working through some issues and need to replace some switches so progress is steady but slow. I am still trying to get my head around one thing in calculating the Factor.
"#define FACTOR (1000/60.0) // to convert RPM to counts/sec (counts/rev / 60.0sec)"
Looking at the formula of (counts/rev / 60.0 sec) is not counts per second If 1000 is the RPM then that formula yields Rev/Sec . If 1000 is counts per rev, then the formula doesn't really give you anything that is useful. Something like 60000 Count Seconds/Rev. So I'm really confused how to calculate the correct Factor. I DO get spindle motion but it spins all the way up so I am guessing the Factor I gave it produces a number so high it drives the spindle at full speed every time. What am I missing?

Thanks

Steve

5. Re: PID advice on a retrofit BenchmanXT

Hi Steve,

The Units should really be:

#define FACTOR (1000/60.0) // to convert RPM to counts/sec (counts/rev / (60.0seconds/1minute))

Example:

Assume GCode specifies S6000 = 6000 RPM
Assume Encoder counts/rev = 1000 counts/rev

First convert 6000RPM to rps by dividing by 60 = 100 revs/second

Now convert revs/second to counts/sec by multiplying by counts/rev

100 revs/second x 1000 counts/rev = 100,000 counts/second

How do you have the axis configured?

Regards

6. Re: PID advice on a retrofit BenchmanXT

Tom,
I currently have the spindle configured as described in the spindle control explanation on the Dynomotion site. I have it set up for Jog control and it's exactly as in the configuration shown. I see the example uses CSS and not sure I need that in a Mill. It does work however. I finally figured out that the Factor needed to be .002 so that the JOG is always a number between -1 and 1 and the machine seems quite happy with that. I checked with a handheld Tach and it looks really good. M3,M4,M5 and S all appear to work correctly. At the end, I issue an M05 and then an M05 M30. These were in my EMC post processor and I have run this file on an EMC machine with no problem so I didn't even know they were there. M30 doesn't do anything in my current KMotionCNC tool setup and I'm not sure why but it may be from issuing the double M05, If I restart the cycle I get X,Y, Z motion but the spindle doesn't run until I INIT the system. I didn't have time to check it this morning but I'll do that in a couple of hours. I'm optimistic but the open loop DAC controlled Spindle seems to allow a slight bit of rotation, maybe 10 RPM and I really need to find a way to make it stop completely. I looked at the deadband but that didn't help and looking at the control map, it looks like deadband only works with PID running. I added the motor encoder to the Threading Spindle settings hoping that might have some effect as feedback but I guess that is only used in an actual threading situation. Any ideas on how to get feedback for the spindle? I feel like I'm overlooking something or that DAC open loop is just not correct but I have not yet seen an example of closed loop for velocity yet. I also tried JOG7 = 0 but the spindle still has a slight rotation. Anything I can try for that?

Thanks for the quick replies you've been giving!
Steve

7. Re: PID advice on a retrofit BenchmanXT

Hi Steve,

You didn't really respond to my last email or provide your configuration. I'm a closed loop guy so I would have gone that direction to get both 0 RPM and also more accurate RPM control.

If you want to go open loop then you will likely need to disable the drive to be stopped. You might read this short article:
Kanalog Hardware Info - Dynomotion

M30 issues an automatic M5 command.

Spindle Feedback should be displayed in all cases not only for Threading operations. Is the Axis Position Changing on the KMotion Axis Screen? Configure the KFLOP Axis channel not the Encoder Channel.

HTH
Regards

8. Re: PID advice on a retrofit BenchmanXT

Tom,
I currently have the spindle in channel 7, No input, DAC Zero PID, 0.5 V, 1 A, 5 J , Feed Forward 2047V and 0A. My Factor is .002 and I am using the Jog programs for M3,M4,M5.
ut that's an aside. the fact is I'd rather use closed loop but I couldn't find any information on how to do that. My X,Y,and Z work perfect but they are seeking a position not a velocity, so I didn't think it was the same. How do you configure closed loop for velocity? I'd much rather use that!
I guess I don't have the spindle feedback configured in KMotionCNC. I see the override bars but that's it. Again, How would I configure that to display on the screen?

Thanks
Steve

9. Re: PID advice on a retrofit BenchmanXT

Hi Steve,

the fact is I'd rather use closed loop but I couldn't find any information on how to do that. My X,Y,and Z work perfect but they are seeking a position not a velocity, so I didn't think it was the same. How do you configure closed loop for velocity? I'd much rather use that!
The Spindle is to be configured exactly the same as your XYZ (if you were to command your X axis to Jog forever at 100,000 counts/sec it could be used as a spindle).

Also every Axis can function fully open loop by relying totally on FF to drive the DAC/motor and use no PID+Filter feedback. Or it can operate fully closed loop by relying on PID+Filter feedback and no FF. Or a mixture of both for optimal results. However one difference is when any closed loop is used then the units of commanded velocity/position must match the units of the measured velocity/position.

I currently have the spindle in channel 7, No input, DAC Zero PID, 0.5 V, 1 A, 5 J , Feed Forward 2047V and 0A. My Factor is .002 and I am using the Jog programs for M3,M4,M5.
Stating channel 7 is ambiguous. I'm guessing you mean Axis Channel 7? If so, what encoder channel is the spindle wired to? Do you have that configured as the InputChan0? Is the Position changing on the KMotion Axis Screen?

We have the most difficult time explaining what should be a simple concept. Let me try this: Imagine you have 8 people in a room and 8 encoder counters. Person #7 is told to watch encoder counter #5. Encoder counter #5 is wired to the Spindle Encoder. Person #7 is then asked what his encoder is doing.

Regards

10. Re: PID advice on a retrofit BenchmanXT

Tom,
Ok I might understand. The difference between seeking a position and a velocity is the command. When seeking a velocity you use the "jog" command. I always configure the axis channel and the encoder channel to the same number. So Axis 7 uses encoder 7. 7 was chosen because I may want to later add an A and possibly a B axis. Having the Spindle at 7 protects it from confusing it with a position VS a velocity system and/or overwriting it with a future A or B. So far, I haven't had any luck with configuring the Spindle as a PID controlled drive. I guess I wasn't sure it was possible and since open looped was relatively easy, it made sense to set that up first. I will experiment tomorrow. With luck that will be all I need to start making chips!
I suppose there is a way to have the Step Response use a Jog instead of a Move? Is that automatic? As always. I really appreciate your help!

Steve

11. Re: PID advice on a retrofit BenchmanXT

Hi Steve,

Check if the #7 Position on the KMotion Axis Screen is changing with the Spindle Motion - 3rd request

I think your problems with trying to tune the Spindle Servo was due to too high FF values. Set them to zero.

To test the Spindle using the Step Response Screen just make a large move. There is also a Velocity Plot Mode.

HTH
Regards

12. Re: PID advice on a retrofit BenchmanXT

Oh, sorry Tom,

Yes the #7 position does track with the Spindle motion. I took your advice and zero'd FF and then used a large move, I think I got it. Need to work on the tuning. It kind of washing machines back and forth looking for Zero. I'll work with it and see where I get.

Thanks
Steve

Posting Permissions

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