04-29-2015 02:41 AM
hi,
1. I could save some time by doing all calculations in Single Precision.
2. how to change the type of all controls & indicators in all VIs in a project frm double to single
regards
akshay
04-29-2015 03:24 AM - edited 04-29-2015 03:24 AM
Hi,
1. Why do you think you will save some time? Which calculations do you want to perform? Did you perform some (good) benchmarks?
2.
- You can do this manually by right-clicking each control/indicator.
- You can select all controls/indicators on your FP (of a single VI) and set the datatype to SGL at once.
- You could write your own VI scripting routine to change the datatype of all controls…
Again: Are you REALLY sure you want to change to SGL for the whole project?
04-29-2015 03:57 AM
Hi,
well if there are 1 Million calculations going on yes I save time in case of 2 mins I need only 1 min.
I have saved time by using SGL.
04-29-2015 04:04 AM
Hi aparab,
which target do these calculations run on?
What kind of calculations did you perform?
As soon as "more advanced" functions from the math or signal palette come into play you mostly limited to perform your calculations using DBL datatype…
04-29-2015 06:42 AM
I can see you saving a little bit of time by going with SGL, but I wouldn't expect it to be truely measurable. And then you also loose accuracy when going to SGL. Depending on what you are doing that may be acceptable. My other concern is, as GerdW has already stated, which libraries are you using? Many of them are only written for DBL. The coersion is likely more expensive than the possible gain from using SGL.
With that said, if you have scripting enabled, you can use a property node to set the representation of a numeric control/indicator. There is also a VI in the Application->VI Scripting palette called Traverse for GObjects.vi that you will find useful.
04-29-2015 07:55 AM
04-29-2015 09:23 AM
thanks all for the cooeration & fast replies,
I measure voltage amplitude to be specific , min max values & based on that do more measurements .
I divide my waveform into parts atleast 3000 & in each part in the waveform "Y" value is analyzed.
this is time consuming!
from my previous project I had Time value in "Y" & for most calculations I used SGL & as said it saved me a Minute.
so I am trying to implement SGL
It was a far cry to ask to change all DBLs to SGLs
If its possible to change all the Variables of one type to other type , I would like to know that.
04-29-2015 10:00 AM
Some responses are quite negative about SGL here. I agree, when using built-in functions which are only for DBL then it doesn't make sense. But otherwise - of course ONLY if precision is sufficient - SGLs can really save lots of time. We have a tight RT loop with PI controllers, filters and other calculations which would never run at the desired rate when using DBL. We rewrote some built-in analysis VIs for SGL to avoid coercions. Using SGL can really make a big difference!
Back to your actual question: you can select multiple terminals and switch their representation at once from the properties dialog. Or use scripting.
04-29-2015 10:50 AM
04-29-2015 11:04 AM
It's not only about RT. Sometimes you also want calculations to be faster on a Windows machine.
Ever did a histogram calculation on a large array (~1M points) of DBL or SGL? The difference can be seconds... (of course this needs a custom histogram VI, since the built-in one only supports DBL)