Package org.yamcs.utils
Class MilStd1750A
- java.lang.Object
-
- org.yamcs.utils.MilStd1750A
-
public class MilStd1750A extends Object
Some Mil1750A encoding/decoding functions. http://www.mssl.ucl.ac.uk/swift/docs/mil-std-1750a.pdf
-
-
Field Summary
Fields Modifier and Type Field Description static long
MAX_FLOAT_VALUE
static int
MAX_FLOAT32_VALUE
static long
MIN_FLOAT_VALUE
static int
MIN_FLOAT32_VALUE
-
Constructor Summary
Constructors Constructor Description MilStd1750A()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
decode32(int milstd)
Decodes a 32 bit MIL-STD 1750A number into a double.static double
decode48(long milstd)
Decodes a MIL-STD 1750A 48 bit number into a double.static int
encode32(double value)
Encodes a double into a MIL-STD 1750A 32 bit number.static long
encode48(double value)
Encode double value to 48 bits 1750A floating point number.
-
-
-
Method Detail
-
encode48
public static long encode48(double value)
Encode double value to 48 bits 1750A floating point number. If the number is too large or too small, theMAX_FLOAT_VALUE
respectivelyMIN_FLOAT_VALUE
are returned This performs some bit operations to transform from IEE 754 binary representation to STD 1750 binary representation. No Math.pow or other expensive operations are used.- Parameters:
value
- - double number- Returns:
- encoded 48 bits number (the first 16 bits of the long are 0)
-
decode48
public static double decode48(long milstd)
Decodes a MIL-STD 1750A 48 bit number into a double.- Parameters:
milstd
- - number to be decoded. Only the last 48 bits are considered, the first 16 are ignored.- Returns:
- - the decoded value
-
encode32
public static int encode32(double value)
Encodes a double into a MIL-STD 1750A 32 bit number. If the number to be encoded is too large or too small, theMAX_FLOAT32_VALUE
respectivelyMIN_FLOAT32_VALUE
are returned- Parameters:
value
-- Returns:
-
decode32
public static double decode32(int milstd)
Decodes a 32 bit MIL-STD 1750A number into a double.- Parameters:
milstd
-- Returns:
-
-