LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Polar to Re/Im Unit Bug?

Polar to Re Im Unit BUG.png 

 

While explaining basic household electrical distribution I ran across this annoyance demonstrated by the above snippet.  Apparently x = r*cos(theta) looses the Volts unit of Rho.  Strangely, Just adding the extra Rube Goldberg code to pass through  Rho Theta to Complex then Complex to Re/Im works fine.  

@Altenbach Is it Rube Goldberg if you have to do it and it uses a complex datatype?


"Should be" isn't "Is" -Jay
Message 1 of 12
(1,171 Views)

Can you attach your code in LabVIEW 2020?

 

Curiously, all my math is unitless, I never use unit!

 

Looking at your picture, which one works? (disabled or enabled?). Where is "Rho"? Can't that be simplified further? US households are not 3 phase, at least not where I live.

 

0 Kudos
Message 2 of 12
(1,130 Views)

@altenbach wrote:

Can't that be simplified further?


This gives the same result and works fine with units;

 

altenbach_0-1688380746545.png

 

(I guess the Polar to RE/IM Is bugged for units. IRRC it got added much later, and maybe nobody bothered to implement unit handling?)

Message 3 of 12
(1,123 Views)

@altenbach wrote:

Can you attach your code in LabVIEW 2020?

 

Curiously, all my math is unitless, I never use unit!

 

Looking at your picture, which one works? (disabled or enabled?). Where is "Rho"? Can't that be simplified further? US households are not 3 phase, at least not where I live.

 


Actually, US households have three phases at the weatherhead drop (mostly).  Typically your lights run off Phase A between Hot A and Neutral at 120V typical, and the outlets are split between Hot B and Hot C to ballance the load on all three phases.  Large Loads (Dryers, HVAC units and Electric Ranges etc...) are wired to all three phases and Ground (where Ground is wired to Neutral at the Circuit Breaker Box) and the Voltage seen between any two phases is "208 3 Phase."   Just as demonstrated to my friend with pictures a protractor and compass with the calculations done in LabVIEW rather than by hand. 

 

Yes, he didn't believe that the circle of 1.2 inches and the 120deg radii yielded scant 2.1 inch sides of the equallaeral triangle described by three chords.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 12
(1,083 Views)

@altenbach wrote:

@altenbach wrote:

Can't that be simplified further?


This gives the same result and works fine with units;

 

altenbach_0-1688380746545.png

 

(I guess the Polar to RE/IM Is bugged for units. IRRC it got added much later, and maybe nobody bothered to implement unit handling?)


The Units attach for "Y" but are missing on "X"  

x = r*cos(theta)

y = r*sin(theta)

from the help those are the calculations used.  if "r" (or Rho if you please) has a Unit x and y should have the same Unit as r is simply multiplied by a ratio.


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 12
(1,080 Views)

@JÞB wrote:

Actually, US households have three phases at the weatherhead drop (mostly). 

 

Household is typically split phase in the US.

(Never seen 3 phase on residential, but maybe there are regional differences. 3 phase is typical for commercial units (and e.g. households in Europe))

 

Less than two years ago, I upgraded my electrical panel to allow more room for heat pumps and car charger, etc. and everything got replaced, including wiring from the pole to the weather head (3 wires: 1 neutral and two 120V differing in phase by 180 degrees). For many years already, I monitor my home consumption and solar production using Sense, which would not (i.e. not really) be compatible with a three-phase system.

0 Kudos
Message 6 of 12
(1,065 Views)

In the case of this home, the three phase drop is evident from the Circuit Breaker gang bars.  They trip 3 breakers hence 208 3phase is available in the box.  Of course, the distribution lines ( not the huge transmission lines) are within 100yrds of the back door and the residence was last updated in the 1960s. (The wall oven model was produced between 1960 and 1966 so, it is older than me)


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 12
(1,045 Views)

Back to the original topic 


@JÞB wrote:

Polar to Re Im Unit BUG.png 

  Apparently x = r*cos(theta) looses the Volts unit of Rho.  Strangely, Just adding the extra Rube Goldberg code to pass through  Rho Theta to Complex then Complex to Re/Im works fine.  

 


Can we get a Blue bar to investigate this so it can be tracked?  Is it a bug?  How long has it been this way? Or is my math that far off?


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 12
(862 Views)

Hey, JÞB, I think it's a kinda-bug.  I noticed in your disabled code the wire coming from Re-Im to Polar has a Broken Wire (which also shows up in LabVIEW 2019, so it's not a "new feature"), while if you use Polar to Complex and then Complex to Re-Im, it works.

 

Explanation (by a dues-paying member of the MAA) -- in Re-Im to Polar, Re and Im are both "Cartesian" (my klunky label) components that are going to be combined into a complex quantity which will have a "gain" and a "phase", with the gain being a "quantity" and phase being (sort-of) "time-related".  Well, in Re-Im to Polar, you only give the Unit label to Re, not to Im, yet they are both (sort-of) the same thing, either both need to be labeled or neither.  But that's not what you want -- you want to say that 120V is the (dimensioned) Amplitude, and Phase is a (hmm, how to say this) "phase", a sort-of time-like quantity.  Can't mix Apples and Oranges.  Whereas in Re-Im to Polar, both Re and Im are of "mixed races", that is, they are a little bit of Volts and a little bit of a time-like quantity.  [End Furious Handwaving].

 

Bob Schor

0 Kudos
Message 9 of 12
(818 Views)

@Bob_Schor wrote:

Hey, JÞB, I think it's a kinda-bug.  I noticed in your disabled code the wire coming from Re-Im to Polar has a Broken Wire (which also shows up in LabVIEW 2019, so it's not a "new feature"), while if you use Polar to Complex and then Complex to Re-Im, it works.

 

Explanation (by a dues-paying member of the MAA) -- in Re-Im to Polar, Re and Im are both "Cartesian" (my klunky label) components that are going to be combined into a complex quantity which will have a "gain" and a "phase", with the gain being a "quantity" and phase being (sort-of) "time-related".  Well, in Re-Im to Polar, you only give the Unit label to Re, not to Im, yet they are both (sort-of) the same thing, either both need to be labeled or neither.  But that's not what you want -- you want to say that 120V is the (dimensioned) Amplitude, and Phase is a (hmm, how to say this) "phase", a sort-of time-like quantity.  Can't mix Apples and Oranges.  Whereas in Re-Im to Polar, both Re and Im are of "mixed races", that is, they are a little bit of Volts and a little bit of a time-like quantity.  [End Furious Handwaving].

 

Bob Schor


Not quite Bob.  That's why I looked up the details in the help file.  Polar to Re/Im actually implements the Polar to Cartesian translation as:

X=r*cos(theta)

Y=r*sin(theta) keeping everything on the same planar surface as the Polar coordinates.   If anything... Real should be identical and keep the same unit as "r" and an imaginary part "Z" would be =r*-sin(theta) on the orthogonal plane and away from you.

 

See here

And update your MAA subscription 😀

 

The snippet attached in my post has the buggy behavior in the disabled case.  It's broken because the units are mismatched at the addition node for the real output of Polar to Re/Im.  Strangely the Im part DOES correctly retain the Volts Unit.

 

In essence,  everything related to magnitude must retain the same Unit.  You can have X,Y,Z in a space or Rho,Theta, Phi.  A unit sphere will always be either:

X^2+Y^2+Z^2=1

OR 

Rho=1

 

On a plane containing the spheres origin you of course get a unit circle as either X^2+Y^2=1 in Cartesian form or, r=1 in polar form. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 12
(812 Views)