dk.deepthought.sidious.rules
Class PhotosynthesisRule

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

public class PhotosynthesisRule
extends Rule

Class represents a photosynthesis rule.

It is responsible for maintaining a desired photosynthesis rate.

Author:
Deepthought

Field Summary
private static long calculationCounter
          Used to keep track of the amount of model calculations done by this
private static int CO2_END
           
(package private) static int CO2_INCREMENT
           
(package private) static int CO2_START
           
private static double DESIRED_RATE
           
private static double GLASS_FACTOR
          Value is defaulted in the calculate method.
private static org.apache.commons.logging.Log logger
          Logger for this class
private static RuleProperty ruleProperty
          The RuleProperty of this class
private static double SHADE_FACTOR
          Value is defaulted in the calculate method.
private static int T_END
           
(package private) static int T_START
           
private  double tweakValue
          Value sets the importance of this rule.
 
Constructor Summary
PhotosynthesisRule(SuperLinkID parentID)
           
 
Method Summary
(package private)  double calculateDesire(State state, Step step)
          Returns the desire related to DESIRED_RATE.
(package private)  double calculateMax(double shade, double sun, java.util.ArrayList<java.util.ArrayList<java.lang.Double>> matrix)
          Method calculates the maximum photosynthesis level.
private  double calculateRate(State state)
          Calculates the photosynthesis rate for a given state.
 double desire(State currentState, State newState, Step step)
          Method returns the calculated desire associated with the change from currentState to newState.
static long getCalculationCounter()
          Gets the amount of calculations made by this.
 java.util.Collection<Goal> getGoals()
          Method returns a collection of immediate goals.
 
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
Logger for this class


ruleProperty

private static RuleProperty ruleProperty
The RuleProperty of this class


GLASS_FACTOR

private static final double GLASS_FACTOR
Value is defaulted in the calculate method.

See Also:
Constant Field Values

SHADE_FACTOR

private static final double SHADE_FACTOR
Value is defaulted in the calculate method.

See Also:
Constant Field Values

T_START

static final int T_START
See Also:
Constant Field Values

CO2_START

static final int CO2_START
See Also:
Constant Field Values

CO2_INCREMENT

static final int CO2_INCREMENT
See Also:
Constant Field Values

T_END

private static final int T_END
See Also:
Constant Field Values

CO2_END

private static final int CO2_END
See Also:
Constant Field Values

DESIRED_RATE

private static final double DESIRED_RATE
See Also:
Constant Field Values

tweakValue

private double tweakValue
Value sets the importance of this rule. TODO extract into rule property file


calculationCounter

private static long calculationCounter
Used to keep track of the amount of model calculations done by this

Constructor Detail

PhotosynthesisRule

public PhotosynthesisRule(SuperLinkID parentID)
Method Detail

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

calculateDesire

double calculateDesire(State state,
                       Step step)
Returns the desire related to DESIRED_RATE.

Parameters:
state - the state containing needed sensors
step - the step containing needed adjustables
Returns:
the calculated desire

calculateRate

private double calculateRate(State state)
Calculates the photosynthesis rate for a given state.

Parameters:
state - the state
Returns:
the rate of photosynthesis

calculateMax

double calculateMax(double shade,
                    double sun,
                    java.util.ArrayList<java.util.ArrayList<java.lang.Double>> matrix)
Method calculates the maximum photosynthesis level. All calculated values are stored in the input matrix.

The format of the matrix is:

 Rows = temperature interval
 Columns = CO2 level
 
 [t1=[co2_level_1, co2_level_2, co2_level_3, ... , co2_level_n]]
 [t2=[co2_level_1, co2_level_2, co2_level_3, ... , co2_level_n]]
 [t3=[co2_level_1, co2_level_2, co2_level_3, ... , co2_level_n]]
 ...
 [tm=[co2_level_1, co2_level_2, co2_level_3, ... , co2_level_n]]
 
 Where: 
 CO2_START < n < CO2_END, and 
   T_START < m < T_END 
 
 Increments:
 Temperature increment = 1
 CO2 increment = CO2_INCREMENT
 
 

Parameters:
shade - screen setpoint value
sun - irradiance level
matrix - the matrix to be filled with all calculated values
Returns:
maximum photosynthesis value

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

getCalculationCounter

public static long getCalculationCounter()
Gets the amount of calculations made by this.

Returns:
the calculationCounter


Copyright © Deepthought Development - All Rights Reserved.