stella.sensor
Class PolynomialConversion

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.sensor.AbstractConversion
                  extended by stella.sensor.AbstractDerivative
                      extended by stella.sensor.PolynomialConversion
All Implemented Interfaces:
Serializable, Cloneable, ConvertToPhysical, PhysicalDerivative, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying
Direct Known Subclasses:
LimitedPolynomialConversion

public class PolynomialConversion
extends AbstractDerivative

A class to convert raw readings into physical quantities. This class uses a polynom, defined with the KEY_POLYNOM key for this behalf. Note that averaging over data events (see DataFactory) is error-free as long as the conversion polynom is linear.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static String DEFPOLYNOM
          Default polynom.
private  Polynom invert
          The polynom used to render raw values from physical ones.
static String KEY_INVERT
          The key pointing to a comma-separated polynom-coefficient string.
static String KEY_POLYNOM
          The key pointing to a comma-separated polynom-coefficient string.
private  Polynom poly
          The polynom used to render the physical value of the sensor.
 
Fields inherited from class stella.sensor.AbstractDerivative
KEY_VALUEDERIVATIVE
 
Fields inherited from class stella.sensor.AbstractConversion
KEY_UNIT, KEY_VALUEFORMAT, KEY_VALUESIGMA
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
PolynomialConversion(Map<String,String> prop)
          Constructs a new polynomial conversion object.
 
Method Summary
 double getDeviation(double x, double std)
          Returns the value of the deviation of the physical value.
 double getPhysical(double x)
          Returns the polynomial approximation of the physical correct value.
 double getPhysicalDerivative(double d1, double raw)
          Returns the value of the first derivative in physically meaningful units.
 double getRaw(double x)
          Returns the polynomial approximation of the raw value.
 double getRawDerivative(double d1, double phys)
          Returns the value of the first raw derivative.
 
Methods inherited from class stella.sensor.AbstractDerivative
getDerivativeValueFormat
 
Methods inherited from class stella.sensor.AbstractConversion
createConversion, getSigmaValueFormat, getUnit, getValueFormat
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, init, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface stella.sensor.ConvertToPhysical
getSigmaValueFormat, getUnit, getValueFormat
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 
Methods inherited from interface util.Initializable
init
 

Field Detail

KEY_POLYNOM

public static final transient String KEY_POLYNOM
The key pointing to a comma-separated polynom-coefficient string.

See Also:
Constant Field Values

KEY_INVERT

public static final transient String KEY_INVERT
The key pointing to a comma-separated polynom-coefficient string.

See Also:
Constant Field Values

DEFPOLYNOM

private static final transient String DEFPOLYNOM
Default polynom. Constant of zero value.

See Also:
Constant Field Values

poly

private Polynom poly
The polynom used to render the physical value of the sensor.


invert

private Polynom invert
The polynom used to render raw values from physical ones.

Constructor Detail

PolynomialConversion

public PolynomialConversion(Map<String,String> prop)
Constructs a new polynomial conversion object.

Method Detail

getDeviation

public double getDeviation(double x,
                           double std)
Returns the value of the deviation of the physical value. Uses the first derivative of the polynominal approximation following
       δf = dp(x)/dx * δx
       

Parameters:
x - The raw reading value.
std - The standard deviation of the raw readings.
Returns:
The physical quantity corresponding to the standard deviation of the raw readings.

getPhysical

public double getPhysical(double x)
Returns the polynomial approximation of the physical correct value.

Parameters:
x - The raw reading value.
Returns:
The physical quantity corresponding to the raw reading.

getRaw

public double getRaw(double x)
Returns the polynomial approximation of the raw value.


getPhysicalDerivative

public double getPhysicalDerivative(double d1,
                                    double raw)
Returns the value of the first derivative in physically meaningful units.

Parameters:
d1 - The numerical derivative from raw values.
raw - The raw reading of the sensor.

getRawDerivative

public double getRawDerivative(double d1,
                               double phys)
Returns the value of the first raw derivative.

Parameters:
d1 - The physical quantity of the first derivative.
phys - The physical quantity.