12-22-2023 10:28 AM
I have an application in the future where I'll need to use a resolver electrical transformer to measure the angular position of a device. In preparation, since I've never used this type of device, I wanted to model the signals I expect to see in LabVIEW and see if I can back calculate the angular position. I was successful, but it involved using some code I found online that I don't fully understand. I understand what LabVIEW is doing, but I don't understand why the resolver's sine and cosine signals have to be processed that way.
I've attached the code I developed for this emulation. It begins with generating the excitation voltage to the resolver, and then generating the sine and cosine outputs from the resolver for one full rotary revolution. From my research, I should just need to take the arctangent of sine/cosine at any given point to get the angular position. I tried doing that, but it was showing me 2 to 3 revolutions instead of the one revolution I expected to see. I implemented the code I found while searching around, and it gave me an angular position output that I expect. It starts at 0 degrees, and then goes to 360 degrees for one full rotary revolution. The code in question is in the blue for loop in the attached code.
My question is if anyone has experience doing these types of calculations for resolvers, and if so, is the questionable code the best way to do that calculation? Is there an easier way? Can anyone explain the underlying math principles? Thanks in advance for the help.
Solved! Go to Solution.
12-22-2023 11:09 AM
Hi jamgar,
@jamgar90 wrote:
My question is if anyone has experience doing these types of calculations for resolvers, and if so, is the questionable code the best way to do that calculation? Is there an easier way? Can anyone explain the underlying math principles? Thanks in advance for the help.
The company I'm working for produces such resolvers and I created the "end of line" testing routine…
Your images in the block diagram already contain all the information you need: position can be derived by calculating the arctan of the Sine and Cosine signal. What is questionable to you?
12-22-2023 12:05 PM
Hi GerdW,
Thank you for taking a look.
The part of the code I don't understand is where the sine and cosine signals are negated, and then passed through a select function that passes the negated signals when the excitation voltage is greater than or equal to zero before the arctangent is performed. I understand what the code is doing, but I don't understand why it has to be done, specifically the negation and selection functions. Everything that I found online simply says to take the arctangent of sine/cosine.
I've created a new version of my code that shows the working code (which includes the negation and selection from the original VI), and the code I thought would have worked (displayed in Incorrect Angular Position on front panel).
12-22-2023 01:38 PM
Hi jamgar,
the arctan is only defined for a range of ±90° (or ±pi/2). That check for negative values of the excitation sinewave avoids ambiguities in the result of the arctan…
@jamgar90 wrote:
I've created a new version of my code that shows the working code (which includes the negation and selection from the original VI), and the code I thought would have worked (displayed in Incorrect Angular Position on front panel).
Your "incorrect" result has steps of 180° (or Pi), whenever the excitation changes its sign: coincidence?
12-23-2023 06:38 AM
Hi GerdW,
Thank you for pointing me in the right direction. I understand now. The generated raw resolver sine and cosine signals are indeterminate in regard to whether they are sin(x) and cos(x) or sin(-x) and cos(-x). They need to be "demodulated" by the LabVIEW code I was unsure about to make them sin(-x) and cos(-x) before performing the arctangent. Without doing this, I get the 180-degree step changes you pointed out.
It became clear to me when I plotted the "demodulated" signals with the original sine and cosine signals. This is shown in the revised attached code.
03-25-2024 02:55 PM
GerdW,
I've finally gotten around to getting a real resolver to do some testing with and was hoping you could help me with the data analysis portion. I've attached a VI that contains real measured data and the analysis I'm using in an attempt to get the angular position. The data was gathered with the resolver stationary, so in theory I should be getting a steady state angular position output from my calculation. But I'm seeing jumps in the angular position that I can't explain.
I wish I had more specific questions. I'm really just feeling out what you think of the collected data and the calculations I'm performing. Thanks again for your assistance.