LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Math constants

Solved!
Go to solution

Hellos, 

 

If I tried to connect one of the math constants, I get an error in connection!!

Why? and how to solve this problem ...!!!

0 Kudos
Message 1 of 11
(2,550 Views)

Hi BaJa,

 

did you take the basic tutorials to learn LabVIEW as offered in the header of the LabVIEW board?

 

Then you should have learned those simple 3 steps:

  1. open the context help
  2. move the mouse cursor of that broken wire
  3. read the explanation in the context help window

This is so easy!

 

You also should have learned this one step to create a suitable indicator:

  1. Right-click the output of a function/VI/constant and choose "Create indicator"…

Then you should be able to get this:

Do you spot the difference in those two "numeric" indicators?

 


@BaJa_2020 wrote:

Why? and how to solve this problem ...!!!


There should be a question mark at the end of the last sentence…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(2,546 Views)

Insert a Cast Unit Base (CTRL+Space, "Cast Unit Base", CTRL+i) also works.

 

I'm not sure units are in the tutorials? Still, the help would give a hint.

0 Kudos
Message 3 of 11
(2,522 Views)

Not all the Labview Users like you my friend.

this is the knowledge.. one knows and one doesn't know.

Maybe, one day the beginner will be professional. just need more and more practice.. we working ...

of course, I can show the value of the constant. 

in the attached vi, if I replace the C value in the top left of the block diagram by the numerical value, I will get no errors. 

but if I connect the C from the math constant I get the error like this in the attached vi. 

can you check? 

 

0 Kudos
Message 4 of 11
(2,518 Views)
Solution
Accepted by topic author BaJa_2020

Gerd is teaching you ways to figure out how to solve problems like this yourself using Context Help, and also telling you the problem is that the constant has units associated with it.

 

Units were something added to LabVIEW years ago, but honestly, they just aren't worth the trouble they cause.

 

Here is a simple fix.  On the Numeric >> Conversion, to the lower right is a function called "Cast Base Units".  I think it might be a newer function because I have never seen it before.  (I was looking for the "Convert Unit" that is right next to it.)  Drop the Cast Base Units onto your diagram near you constant.  Delete the first broken wire segment.  Wire the constant into the front, and the output to the remaining broken wire segment.  Leave the top input unwired.  Now all the broken wires will go away since it will convert the m/s units into no units.

 

Then I would go through and look at the conversion dots on you indicators.  The calculations are setup to be extended precision data type, but the indicators are double.  You should convert those to extended so you don't lose precision.

 

However, why are all those indicators hidden on the front panel?  If you aren't showing them, you might as well delete them.  If you do keep them, then right click on the terminal and make the labels visible.  It is bad programming practice to not label your terminals on the block diagram.

 

0 Kudos
Message 5 of 11
(2,503 Views)
Solution
Accepted by topic author BaJa_2020

Hi BaJa,

 


@BaJa_2020 wrote:

of course, I can show the value of the constant. 


It seems you didn't understand what I was trying to teach you: using the context help to understand the reason for broken wires…

 


@BaJa_2020 wrote:

in the attached vi, if I replace the C value in the top left of the block diagram by the numerical value, I will get no errors.  but if I connect the C from the math constant I get the error like this in the attached vi. 


It's the same problem as before: you are mixing wires with different datatypes (due to units) - as is explained in the context help window…

Why do almost all terminals in the block diagram hide their label?

 

You got two more solutions presented by now!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(2,469 Views)

@RavensFan wrote:

Gerd is teaching you ways to figure out how to solve problems like this yourself using Context Help, and also telling you the problem is that the constant has units associated with it.

 

Units were something added to LabVIEW years ago, but honestly, they just aren't worth the trouble they cause.

 

My opinion is different than yours.  I find them quite handy, and very little trouble.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 7 of 11
(2,406 Views)

@paul_cardinale wrote:

@RavensFan wrote:

Gerd is teaching you ways to figure out how to solve problems like this yourself using Context Help, and also telling you the problem is that the constant has units associated with it.

 

Units were something added to LabVIEW years ago, but honestly, they just aren't worth the trouble they cause.

 

My opinion is different than yours.  I find them quite handy, and very little trouble.


I know a few people disagree.  But the only time I ever see them used, they are associated with problems.

They really don't add much value.  If someone is working with calculations that involve units, then they should be able to program the correct conversion factors into the formulas.

0 Kudos
Message 8 of 11
(2,386 Views)

I have this ini file library. Units are great for storing things in mm, mg, m-, and displaying it as m, g, -. Or vice versa. So I use the unit to scale things by 0-n factors of 1000. This is a bonus from the string to variant conversion that came automatically.

 

The alternative would be hell. I can now simply get all control references and get all values automatically. Scaling is done automatically. Without this feature, I'd have to get all labels, get all values, convert the proper values, set all values.

0 Kudos
Message 9 of 11
(2,361 Views)

Hi Paul,

 


@paul_cardinale wrote:

My opinion is different than yours.  I find them quite handy, and very little trouble.

Do some math with units: start with a simple "square" function…

Edit: I just learned there was a bug fix to the square function: (atleast in LV2019) it now (aka "after years") handles units correctly!

But still I use units very seldomly, mostly for indicators where the unit is known at edit time.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 11
(2,349 Views)