Programming Reference:PhysicalUnit Class
- 1 Location
- 2 Synopsis
- 3 Methods
- 4 Properties
- 5 Magnitude Prefixes
- 6 See also
An object of type PhysicalUnit represents a linear mapping from physical units to raw numbers, and an expected range of values. Apart from its use in conjunction with signal values, this class is also used for element or channel indexing when appropriate, e.g. to map a frequency value to a spectral bin (element index).
The constructor initializes a PhysicalUnit object to the identity mapping.
Resets the PhysicalUnit object to identity mapping.
Tests whether a string is valid as a physical value. This is the case if the string represents
- a plain number,
- a plain number followed with an optional magnitude prefix, and the physical unit's symbol, without separating white space, such as "10.3ms",
- an arithmetic expression involving numbers and arithmetic operators, optionally followed with a unit string, such as "(5/4)muV".
Transforms a physical value into a raw number as defined by the object's offset, gain, and symbol properties.
Transforms a raw number into a physical value as defined by the object's offset, gain, and symbol properties.
Writes/reads offset, gain, and symbol properties into/from the specified std::iostream objects, enclosed into braces, and separated with space characters.
number Offset (rw), Gain (rw)
Offset and gain value defining the linear relation between raw and physical values. Consistently with the definition of the SourceChOffset and SourceChGain parameters, the relation between raw and physical value is
PhysicalValue = ( RawValue - Offset ) * Gain
string Symbol (rw)
The symbol of the physical unit, such as "s" for seconds, "V" for Volts, etc., without magnitude prefix. For signal visualizations, units are displayed in the visualization window.
number RawMin, RawMax (rw)
Minimum and maximum of an expected range of values. For signals, this is used to adapt ranges in visualization windows, with the ValueUnit's range determining signal scaling, and the ElementUnit's range determining the number of elements displayed in the visualization window.
The PhysicalUnit class recognizes the following magnitude prefixes: