Main siteMain site  ForumForum  ForumSearch  Private messageEmail contact  RegisterRegister  Log inLog in 
Topic: Scalar to Float pipe converter necessary?
Reply to topic
Author Message
EMebane



Joined: Apr 15, 2019
Posts: 20

PostPosted: Jun 8, 2019 2:55 PM    Post subject: Scalar to Float pipe converter necessary?

Scalar outputs to Float inputs: this often (maybe always?) works.

Is there any need for a pipe converter to go from Scalar to Float, or is the conversion automatic when I connect a Scalar output to a Float input? When is pipe conversion necessary and when can I just connect pipe outputs/inputs without regard for their type?
jarek



Joined: Oct 22, 2007
Posts: 674

PostPosted: Jun 8, 2019 3:06 PM    Post subject:

There is always a converter from Scalar to Float. You don't see it by default when you connect them with a mouse, but it is "in the connection" (which has a different color), you can right click on that connection to see more details. That conversion is a little different (no ScalarToFloat element there) but essentially does the same operation.

It should work in most cases automatically. But if you scalar source is not on the main data stream (from an actual device somewhere up the stream), then you better make sure it does what you want to.

I would recommend to only use Float elements for all float number operations, and Scalars only for integers (like data from serial port or network element). That way the conversion is usually not needed.
EMebane



Joined: Apr 15, 2019
Posts: 20

PostPosted: Jun 9, 2019 3:20 AM    Post subject: Converting from 16 bit to 24 bit Scalar

I get the following error:
Reinit problem in element FFTTransform(329): n: Ouput's number of bits 16can't be less then input's number of bits 24
SubVector warning: max value out of range, 42.0 > 0.0

I am attempting to connect a Ganglion (scalar) to a nested design that has a FFTTransform (scalar) element (the FFTSpectrogram2dS from the samples). It seems that the pipe from my Ganglion is a 16 bit Scalar but the FFTTransform In pipe wants a 24 bit Scalar. Is it possible to convert the bit depth of a Scalar? I tried using a ScalarValue element and an ExpressionEvaluator element but that did not seem to work.

I can use the Float version of the design (FFTSpectrogram2dF) but I want to know if there's a way to do the number bit depth conversion that seems to be needed for the Scalar example.
jarek



Joined: Oct 22, 2007
Posts: 674

PostPosted: Jun 9, 2019 10:21 AM    Post subject:

Ganglion's driver output is 24bit. So that is why this happens. Yes, you can change the bit depth in the FFTTransform element's properties - look for tab "Advanced features" (not advanced properties) and change "Output bits" to a higher value (by default it is 16).

For devices which use more than 16bits I would not recommend to use Scalars.
EMebane



Joined: Apr 15, 2019
Posts: 20

PostPosted: Jun 9, 2019 1:40 PM    Post subject:

Got it. I also needed to change the FFTTransform>Settings>FFT Type to FLOAT instead of NATIVE to get it to work.
Reply to topic