Page 1 of 1

question about signal data type

Posted: Thu May 26, 2011 8:08 am
by Amélie
Hello,

I am developping a driver and I just encountered something curious :
in the Designer, the type of signal samples is float64, so I though no precision would be lost if the driver acquires double precision data.
But in the driver, the buffer that has to be filled with these samples and sent to the callback function contains float32 samples.
I'm not sure but it seems to me that samples are cast from float32 to float64 in ovpCGenericNetworkAcquisition.cpp.
Why this choice ? If a simple precision is enough, why are samples transformed into float64 in the Designer ?

Thank you,
Amélie

Re: question about signal data type

Posted: Thu May 26, 2011 9:10 am
by jlegeny
Hello Amélie,

Since I have not yet developed a driver my answer might be imprecise but I suppose that different acquisition devices use different precision for the data they read from the hardware. As the designer has to be compatible with all of them (and hopefully those in the future as well, provided someone develops a driver) it has to work with the maximal precision. The drivers themselves can simply use the precision of the device.

Best regards
Jozef

Re: question about signal data type

Posted: Fri May 27, 2011 7:04 am
by Amélie
Hello Jozef

I agree with you, it's great that the designer allows double precision. But my acquisition device also provides double precision data, and this precision is lost in the driver, which requires simple precision data. This is what I do not understand.

Best regards,
Amélie

Re: question about signal data type

Posted: Fri May 27, 2011 9:06 am
by yrenard
Dear Amelie,

the reason is that the data going from acquisition server to designer uses TCP connection which possibly occurs on different machines and even more on distant machines. So it has been considered that 32 bits floats would be enough for acquisition as this would reduce the network stress a half. Getting back to the designer, the successive operations that occur in the different boxes can hurt the precision so it has been considered that 64 bits floats would be better. This data transmission is only local and does not stress much on the transport layer.

Hope this answers your questions :)
Yann

Re: question about signal data type

Posted: Fri May 27, 2011 9:32 am
by Amélie
I found it was a strange choice, now I understand.

Thank You Yann !