LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with INF

Solved!
Go to solution

Hello,

 

I am with a problem regarding the calculation of capacitator reactance (XC=1/WC), i have a problem when my capacitator is 0 ( i can adjust the value with a knob) the display number will be INF, because i am dividing for 0.

 

Is there a way to display 0 when this happens?

When capacitator is 0 i want to display that my XC is also 0 and it keeps displaying INF.

 

Thanks in advance,

 

Montjack

0 Kudos
Message 1 of 9
(2,393 Views)

Just check for zero and conditionally substitute a different code path. Can you show us your code?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 2 of 9
(2,368 Views)

I was able to switch the maximum to display at max 16 bits (32768), even tho it wont display INF, but it will display the 32768, which doesnt solve at all my problem.

 

The problem is that by showing the max number it will affect all my program, that is why i need to fix this issue.

 

Thanks,

 

Montjack

0 Kudos
Message 3 of 9
(2,363 Views)

Hi Montjack,

 

IF divisor == 0 THEN
  result := 0
ELSE
  result := dividend/divisor
ENDIF

Have you tried to implement this simple algorithm in LabVIEW?

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 4 of 9
(2,353 Views)

You could also just set the input range of the knob such that zero is not allowed.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 5 of 9
(2,346 Views)
Solution
Accepted by topic author Montjack

Hi Montjack,

 

please post your questions here in the forum, using PMs isn't the right way!

Why do you use FXP datatype as shown in your PM?

 

I give you a hint on how to implement the algorithm:

check.png

Btw. to calculate the reciprocal you could find a specialized function called reciprocal😄

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 6 of 9
(2,343 Views)

Thank you for the help, i managed to do it 🙂

WC-Solution.png

0 Kudos
Message 7 of 9
(2,332 Views)

What's the point of the weird output configuration? Just keep it all DBL!


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 8 of 9
(2,328 Views)

It was when i was trying different data types 🙂 I will change, Thank you 🙂

0 Kudos
Message 9 of 9
(2,324 Views)