Package org.yamcs.utils
Class MilStd1750A
java.lang.Object
org.yamcs.utils.MilStd1750A
Some Mil1750A encoding/decoding functions.
http://www.mssl.ucl.ac.uk/swift/docs/mil-std-1750a.pdf
-
Field Summary
Modifier and TypeFieldDescriptionstatic long
static int
static long
static int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.
-
Field Details
-
MAX_FLOAT_VALUE
public static long MAX_FLOAT_VALUE -
MIN_FLOAT_VALUE
public static long MIN_FLOAT_VALUE -
MAX_FLOAT32_VALUE
public static int MAX_FLOAT32_VALUE -
MIN_FLOAT32_VALUE
public static int MIN_FLOAT32_VALUE
-
-
Constructor Details
-
MilStd1750A
public MilStd1750A()
-
-
Method Details
-
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 IEEE 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:
-