dk.deepthought.sidious.rules
Class TemperatureRule

java.lang.Object
  extended by dk.deepthought.sidious.rules.Rule
      extended by dk.deepthought.sidious.rules.TemperatureRule

public final class TemperatureRule
extends Rule

This class represents a temperature rule.

The rule advocates for maintaining a mean temperature, and avoiding temperature boundaries.

Author:
Deepthought

Field Summary
private  double K_MAX
          Coefficient for mathematical calculations
private  double K_MIN
          Coefficient for mathematical calculations
private static org.apache.commons.logging.Log logger
           
private static double MAXVALUE
          Arbitrary max value.
private static RuleProperty ruleProperty
          The RuleProperty of this class
private  SuperLinkID SENSOR_ID
          The ID of the sensor this Rule depends on.
private  double T_MAX
          The max temperature.
private  double T_MEAN
          The mean temperature.
private  double T_MIN
          The min temperature.
 
Constructor Summary
TemperatureRule(SuperLinkID parentId)
          Constructor.
 
Method Summary
(package private)  double calculateDesire(double temperature)
          This method calculates the desire for a given temperature.
static TemperatureRule constructTemperatureRule(SuperLinkID parentID, java.util.Properties properties)
          Static factory for constructing a TemperatureRule with the specified properties.
 double desire(State currentState, State newState, Step step)
          Method returns the calculated desire associated with the change from currentState to newState.
 java.util.Collection<Goal> getGoals()
          Method returns a collection of immediate goals.
(package private)  double total(double curTemperature, double newTemperature)
          Method returns the calculated total desire of the input temperatures.
 
Methods inherited from class dk.deepthought.sidious.rules.Rule
getAdjustableSetting, getAdjustableSettingFromParent, getExplanation, getParentID, getSensorValue, setParentID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final org.apache.commons.logging.Log logger

SENSOR_ID

private final SuperLinkID SENSOR_ID
The ID of the sensor this Rule depends on.


ruleProperty

private static RuleProperty ruleProperty
The RuleProperty of this class


T_MEAN

private final double T_MEAN
The mean temperature.


T_MAX

private final double T_MAX
The max temperature.


K_MAX

private final double K_MAX
Coefficient for mathematical calculations


K_MIN

private final double K_MIN
Coefficient for mathematical calculations


T_MIN

private final double T_MIN
The min temperature.


MAXVALUE

private static final double MAXVALUE
Arbitrary max value.

See Also:
Constant Field Values
Constructor Detail

TemperatureRule

public TemperatureRule(SuperLinkID parentId)
Constructor.

Parameters:
parentId - the id of the parent PlanRequester
Method Detail

constructTemperatureRule

public static TemperatureRule constructTemperatureRule(SuperLinkID parentID,
                                                       java.util.Properties properties)
Static factory for constructing a TemperatureRule with the specified properties.

Parameters:
parentID - the id of the parent PlanRequester
properties - the properties
Returns:
a new TemperatureRule from the given properties

desire

public double desire(State currentState,
                     State newState,
                     Step step)
Description copied from class: Rule
Method returns the calculated desire associated with the change from currentState to newState.

The calculated desire must evaluate to [0,1], where 0 represents no desire for changing state, and 1 represents maximum desire for change.

Some rules are allowed to evaluate to values (much) larger than 1. This exception is only allowed if the outcome of not respecting the rule is fatal.

Specified by:
desire in class Rule
Parameters:
currentState - the current state
newState - the new state
step - the step
Returns:
the calculated desire

total

double total(double curTemperature,
             double newTemperature)
Method returns the calculated total desire of the input temperatures.

Parameters:
curTemperature - current temperature
newTemperature - the new temperature
Returns:
the combined total desire

calculateDesire

double calculateDesire(double temperature)
This method calculates the desire for a given temperature.

Parameters:
temperature - the temperature
Returns:
the desire for the given temperature

getGoals

public java.util.Collection<Goal> getGoals()
Description copied from class: Rule
Method returns a collection of immediate goals.

If there are no immediate goals, an empty collection is returned.

Specified by:
getGoals in class Rule
Returns:
the goals of this rule


Copyright © Deepthought Development - All Rights Reserved.