stella.parameter
Class RefractionModel

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.parameter.AbstractParameter
                  extended by stella.parameter.AbstractValue
                      extended by stella.parameter.RefractionModel
All Implemented Interfaces:
Cloneable, Parameter, CommandLineProviding, ParameterDepending, Value, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, Reloadable, ResourceSupplying

public class RefractionModel
extends AbstractValue
implements ParameterDepending, Reloadable, CommandLineProviding

A paramter that combines necessary environment data to allow the determination of the refraction. This parameter is intended for use with the EnvironmentConfig command that tells the TCS about current weather values.
As of version 1.0, this parameter combines the temperature and the barometric pressure. For use with the EnvironmentConfig command, rely on the getCommandLine() method. The parameter itself returns the correction factor to the refraction index (n-1) in a simple model.

   n(T,p)-1=(n0-1)·(p(1+(0.7868-0.01178T)·10-6·p))/961.096(1+0.003661T),
   
where T is in degrees Celcius and p is in mbar. The refraction index of the air at 15C and a pressure of 1013mbar is n0. The influence of the air humidity is roughly 6 orders of magnitude below the influence of the temperature and the pressure and therefore neglected.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
static String DEFNAME
          The default name of the parameter.
static double DEFNOMINALPRESS
          The default nominale value of the pressure.
static double DEFNOMINALTEMP
          The default nominale value of the temperature.
private static String DEFPRESSURE
          The default name of the pressure parameter.
private static String DEFTEMPERATURE
          The default name of the temperature parameter.
static String KEY_NOMINALPRESS
          The nominale value of the pressure.
static String KEY_NOMINALTEMP
          The nominale value of the temperature.
static String KEY_PRESSURE
          The name of the pressure to use.
static String KEY_TEMPERATURE
          The name of the temperature parameter to use.
private static double P2
          The p^2 parameter.
private static double P2T
          The T*p^2 parameter.
private static double PDENOM
          The p-parameter, denominator.
private  Value press
          The pressure value.
private static double TDENOM
          The denominator part depending on T.
private  Value temp
          The value of the temperature.
 
Fields inherited from class stella.parameter.AbstractParameter
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWN
 
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.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
RefractionModel(Map prop)
          Constructs a new refraction model.
 
Method Summary
 String getCommandLine()
          Returns the command line ready to use for the EnvironmentConfig command.
 Number getValue()
          Returns the correction factor to (n-1) for the given temperature and pressure.
 void registerParameter(Parameter tp)
          Registers a parameter to the refraction model.
 double rescanned(String key, String old, String newval)
          As any parameter depending instance we fail if the parameter we depend on is now a different one.
 Number setValue(Number val)
          Sets the hour angle of the actual target.
 
Methods inherited from class stella.parameter.AbstractValue
get, set
 
Methods inherited from class stella.parameter.AbstractParameter
createParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, init, register, setName, toString
 
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, 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, setObject, setProperties, setProperty, stringProperties
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.Reloadable
reload
 
Methods inherited from interface stella.Parameter
getFormatted, getName, getString
 
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
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

KEY_TEMPERATURE

public static final String KEY_TEMPERATURE
The name of the temperature parameter to use.

See Also:
Constant Field Values

KEY_PRESSURE

public static final String KEY_PRESSURE
The name of the pressure to use.

See Also:
Constant Field Values

KEY_NOMINALTEMP

public static final String KEY_NOMINALTEMP
The nominale value of the temperature.

See Also:
Constant Field Values

KEY_NOMINALPRESS

public static final String KEY_NOMINALPRESS
The nominale value of the pressure.

See Also:
Constant Field Values

DEFNAME

public static final String DEFNAME
The default name of the parameter.

See Also:
Constant Field Values

DEFTEMPERATURE

private static final String DEFTEMPERATURE
The default name of the temperature parameter.

See Also:
Constant Field Values

DEFPRESSURE

private static final String DEFPRESSURE
The default name of the pressure parameter.

See Also:
Constant Field Values

DEFNOMINALTEMP

public static final double DEFNOMINALTEMP
The default nominale value of the temperature.

See Also:
Constant Field Values

DEFNOMINALPRESS

public static final double DEFNOMINALPRESS
The default nominale value of the pressure.

See Also:
Constant Field Values

P2

private static final double P2
The p^2 parameter.

See Also:
Constant Field Values

P2T

private static final double P2T
The T*p^2 parameter.

See Also:
Constant Field Values

PDENOM

private static final double PDENOM
The p-parameter, denominator.

See Also:
Constant Field Values

TDENOM

private static final double TDENOM
The denominator part depending on T.

See Also:
Constant Field Values

temp

private Value temp
The value of the temperature.


press

private Value press
The pressure value.

Constructor Detail

RefractionModel

public RefractionModel(Map prop)
Constructs a new refraction model. Please note that the names of the temperature and pressure provided in the properties must match the parameter names, not sensor names.

Method Detail

rescanned

public double rescanned(String key,
                        String old,
                        String newval)
As any parameter depending instance we fail if the parameter we depend on is now a different one.

Specified by:
rescanned in interface Reloadable
Overrides:
rescanned in class AbstractParameter

registerParameter

public void registerParameter(Parameter tp)
Registers a parameter to the refraction model. First, the parameter to register must be a DataValue. If this is the case, its name is matched against the KEY_TEMPERATURE and KEY_PRESSURE properties. In case of matching name, a local reference to the value is stored.
Note that the parameters must supply physical values, i.e. Celcius for the temperature and mbar for the pressure.

Specified by:
registerParameter in interface ParameterDepending

getValue

public Number getValue()
Returns the correction factor to (n-1) for the given temperature and pressure. This class is mainly used with a EnvironmentConfig command, which uses the getCommandLine() method instead.

Specified by:
getValue in interface Value
Returns:
A value close to one or one if temp or press are missing.

setValue

public Number setValue(Number val)
                throws UnsupportedOperationException
Sets the hour angle of the actual target. This is a read-only variable, therefore this method throws an UnsupportedOperationException.

Specified by:
setValue in interface Value
Throws:
UnsupportedOperationException

getCommandLine

public String getCommandLine()
Returns the command line ready to use for the EnvironmentConfig command. The PILAR-software expects pressure in Pa, not mbar, therefore the desired conversion is directly applied here as the pressure is converted into a string.

Specified by:
getCommandLine in interface CommandLineProviding