leandro.martins Posted September 13, 2021 Share Posted September 13, 2021 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? Tks Link to comment Share on other sites More sharing options...
Eric Hotchkiss Posted September 14, 2021 Share Posted September 14, 2021 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) Motor[1].ServoCtrl=1 Link to comment Share on other sites More sharing options...
leandro.martins Posted September 14, 2021 Author Share Posted September 14, 2021 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) Link to comment Share on other sites More sharing options...
Eric Hotchkiss Posted September 14, 2021 Share Posted September 14, 2021 Are you able to move the encoders separately? Maybe you can unplug one while moving the mechanics so PMAC can only see one move? Link to comment Share on other sites More sharing options...
leandro.martins Posted September 15, 2021 Author Share Posted September 15, 2021 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: Motor[1].pEnc=EncTable[31].a Motor[1].pEnc2=EncTable[25].a 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. Link to comment Share on other sites More sharing options...
steve.milici Posted September 15, 2021 Share Posted September 15, 2021 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. Link to comment Share on other sites More sharing options...
leandro.martins Posted September 15, 2021 Author Share Posted September 15, 2021 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 Link to comment Share on other sites More sharing options...
leandro.martins Posted September 22, 2021 Author Share Posted September 22, 2021 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 Link to comment Share on other sites More sharing options...
Recommended Posts