Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Averaging encoders
Hello all,

I am controlling a direct-drive 3-phase brushless that have 2 encoders, disposed 180 degrees apart from each other.

To minimize the eccentricity errors from the encoder's scale, I'm trying to take the average of both to use as position feedback, but when I post-processed the data from Motor[1].ActPos, Gate3[0].Chan[0].ServoCapt (main encoder), Gate3[1].Chan[0].ServoCapt (auxiliar encoder), it seems it is using only the Gate3[0].Chan[0].ServoCapt as the source.

// Encoder Table - Averaging encoders settings

EncTable[31].type = 8 // Addition of two sources

EncTable[31].pEnc = Gate3[0].Chan[0].ServoCapt.a // Ch. 1
EncTable[31].pEnc1 = Gate3[1].Chan[0].ServoCapt.a // Ch. 5
EncTable[31].index1 = 0
EncTable[31].index2 = 0
EncTable[31].index3 = 0
EncTable[31].index4 = 0
EncTable[31].index5 = 0
EncTable[31].ScaleFactor = (1/2)*(1/256)

Is there some point that I'm missing?

I issued a $$$*** and downloaded the following code on my PMAC. My motor position moves from either encoder. Are you sure the code is downloaded and those are the current values in PMAC? Type the name of a structure element in the terminal to check it's value.

EncTable[1].type = 8
EncTable[1].pEnc = Gate3[0].Chan[0].ServoCapt.a
EncTable[1].pEnc1 = Gate3[0].Chan[1].ServoCapt.a
EncTable[1].index1 = 0
EncTable[1].index2 = 0
EncTable[1].index3 = 0
EncTable[1].index4 = 0
EncTable[1].index5 = 0
EncTable[1].ScaleFactor = (1/2)*(1/256)
Hello Eric

I checked the values of the structures and it seems as expected (first image)

Using the fft of the plot tool of the IDE, we can see that there are some frequencies that appear in Gate3[1].Chan[0].ServoCapt doesn´t have the same amplitude as the Motor[1].ActPos frequencies (second image)

On another hand, when we plot the fft of Gate3[0].Chan[0].ServoCapt and Motor[1].ActPos all the curve is superimposed (third image)

Attached Files Image(s)
Are you able to move the encoders separately? Maybe you can unplug one while moving the mechanics so PMAC can only see one move?
It´s not possible to move by hand, so the only way is to disconnect one of the encoders, but for this, I will need to reconfigure some registers

Now is as it follows:


EncTable[31] is configured as the previous post, trying to make the average
And EncTable[25] is using only Gate3[1].Chan[0] as source.

Unfortunately, the system will be available for tests next Monday.

Eric, is it possible to have some relation in use Gate3[0] and Gate3[1] in the average operation? Or maybe the or the number of EncTables?

Thanks for the attention.
Just a thought here …

In a Type 8 ECT entry, pEnc and pEnc1 typically do not point directly to the encoders’ hardware channels but to the ECT entries of each of the processed encoders’ hardware channels:
EncTable[m].type = 1
EncTable[m].pEnc = Gate3[0].Chan[0].ServoCapt.a
. . .
EncTable[l].type = 1
EncTable[l].pEnc = Gate3[1].Chan[0].ServoCapt.a
. . .
EncTable[l].type = 8
EncTable[n].pEnc = EncTable[m].PrevEnc.a
EncTable[n].pEnc1 = EncTable[l].PrevEnc.a

This should be done anyway to prevent any “roll-over” issues with the source HDW.

Maybe the ECT behaves in an unexpected way when looking directly at the HDW.
It makes sense

We already did some implementations doing in this way, but for other reasons.

I will make the modifications and test it as soon as I get the system available again.

Thanks for the help Steve
Just to give a feedback

The application doesn't work because this system is closing the servo-loop on the phase interrupt, so it's not using the EncTables

I will re-evaluate the solution and get the pros and cons of this approach

Thanks again

Forum Jump:

Users browsing this thread: 1 Guest(s)