Data Rounded/Truncated on Local DataSource Parameter (HTTP API)

65 views
Skip to first unread message

Misael Gaytan

unread,
May 12, 2025, 5:45:12 PMMay 12
to yamcs
Hello,
I'm running into an issue where data is being rounded/truncated when sending to a parameter of DataSource type "Local" via the HTTP API.

I created a Local parameter through the HTTP API named "testparam1", and it is of type "float64_t", which is a 64-bit float as shown in this image:
float64_t.png
When I attempt to set this parameter to 88.141988885 via the HTTP API, it is truncated to 88.14199 shown here:
http_truncate.png
When setting this value through the website's "Set Value" button, the value is also truncated:
setvalue_input.png
setvalue_result.png
Is there a way to push to this local parameter via the HTTP API without truncation or rounding? Other float64_t parameters do not encounter this issue when data is sent via UDP.

Thank you

fabia...@spaceapplications.com

unread,
May 13, 2025, 5:53:03 AMMay 13
to yamcs
Your screenshots show the raw type ("Data encoding").
I believe the "Size in bits" of your engineering type may be 32 instead of 64.

Your screenshots seem to come from an older version of Yamcs, in later versions the MDB pages show the additional property "Size in bits".

Regardless, not all numbers can be stored exactly in a fixed-size float.

Misael Gaytan

unread,
May 13, 2025, 11:22:29 AMMay 13
to ya...@googlegroups.com
Thanks for the quick response, how do I make the size in bits 64 or how can I create a DoubleParameterType as it doesn't exist but is suggested in the documentation.

Here is my current type definition for the float type above:

<Float parameter type name="float64_t">
<Unit set/>
<Float data encoding size in bits="64"/>
</Float parameter type>


Misael Gaytan

--
You received this message because you are subscribed to the Google Groups "yamcs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yamcs+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/yamcs/0b86348e-95d5-466b-b2f2-05fb0cb2a0ffn%40googlegroups.com.

fabia...@spaceapplications.com

unread,
May 14, 2025, 2:43:59 AMMay 14
to yamcs
On FloatParameterType you can set sizeInBits="64"

M Ashwin Srivaths

unread,
May 29, 2025, 6:29:36 AMMay 29
to yamcs
Hey Guys, I also faced a similar problem.
In the DataTypes sheet of the MDB, I had set the raw type to float, the engineering type to float and encoding to  64(bits).
In the packet data, I observed that the raw value was correct but the engineering value had been truncated to a 32 bit float value.
On further anaysis, I found in the documentation that engineering types directly map to java types and have predefined encoding length unlike raw types that can have any encoding length.
(https://docs.yamcs.org/yamcs-server-manual/mdb/loaders/sheet/data-types/#datatypes-sheet)

float engineering type directly maps to 32 bit floating point number - it corresponds to float in Java.
For the engineering type to be a 64 bit floating point number, you must set the engineering type to double (64 bit floating point number - it corresponds to double in Java).
The raw type and encoding length can remain float and 64(bits) respectively.

If the encoding specefied is greater than the engineering type length (internally mapping to a java variable), then the parameter will undergoe narrowing conversion and there will be loss in precession.

Reply all
Reply to author
Forward
0 new messages