IntegrableNumber Class Template Reference

#include <C:/Work/specialnumbers_svn/NumberLib/NumbersLib/IntegrableNumber.h>

Inheritance diagram for IntegrableNumber:

AbstractFilteredNumber UpdateableNumber

List of all members.


Detailed Description

template<class T, unsigned int sampleCount, unsigned int maxOrder>
class luma::numbers::IntegrableNumber< T, sampleCount, maxOrder >

An integral number is a number that keeps track of itw own integrals.

\[ y_n = \Sigma x_n = \frac{\sum_{i= n - m + 1}^n x_{n}t_{n}}{\sum_{i = n - m + 1}^nt_n} \]

This class complements the DifferentiableNumber class.

Parameters:
T The type that underlies this IntegrableNumber. Typically float.
m The number of samples to store
n The order of the integrable

Definition at line 29 of file IntegrableNumber.h.


Public Member Functions

void forceValue (T x, float elapsedTime=1.0f)
 Forces this integrable number into a long term srteady state.
getSample (int i) const
 This returns the nth sample stored.
getValue (unsigned int order) const
 Returns the integral of order specified for this IntegrableNumber.
 IntegrableNumber (T initialValue)
void setValue (T x, float elapsedTime=1.0f)
 Sets the value of this IntegrableNumber, and recalculates all integrals.

Private Attributes

CyclicNumber< int > mCurrentIndex
mCurrentValue
mInitialValue
mSamples [sampleCount]
IntegrableNumber< T,
sampleCount, maxOrder-1 > 
mSum
float mTimeSamples [sampleCount]
float mTotalTime

Constructor & Destructor Documentation

IntegrableNumber ( initialValue  )  [inline]

Parameters:
initialValue zero of type T, returned by all calls of getValue that this number cannot calculate.

Definition at line 87 of file IntegrableNumber.h.

References IntegrableNumber::mSamples, and IntegrableNumber::mTimeSamples.


Member Function Documentation

void forceValue ( x,
float  elapsedTime = 1.0f 
) [inline]

Forces this integrable number into a long term srteady state.

The alpsed time is the time elapsed between samples. For example, if this integrable number (with say, 10 samples) is forced to a value of 10, with elapsed time of 1.0f, then the sum would be 100. If the elapsed time is 3, then the sum would be 300.

Definition at line 122 of file IntegrableNumber.h.

References IntegrableNumber::mCurrentValue, IntegrableNumber::mInitialValue, IntegrableNumber::mSamples, IntegrableNumber::mSum, and IntegrableNumber::mTotalTime.

Referenced by PIDBufferedNumber::forceValue().

T getSample ( int  i  )  const [inline]

This returns the nth sample stored.

Note that sample[0] is not necesarily the oldest sample. This method is used for testing, and should not be generally not be used in production code.

Definition at line 163 of file IntegrableNumber.h.

References IntegrableNumber::mSamples.

Referenced by PIDBufferedNumber::getSample().

T getValue ( unsigned int  order  )  const [inline, virtual]

Returns the integral of order specified for this IntegrableNumber.

Parameters:
order 
  • if 0, the current value is returned
  • if 1, the integral of the variable is returned
  • if 2, the double integral of the value is returned
  • if order > n, the initialValue (0) is returned.

Implements AbstractFilteredNumber.

Definition at line 144 of file IntegrableNumber.h.

References IntegrableNumber::mCurrentValue, IntegrableNumber::mInitialValue, and IntegrableNumber::mSum.

Referenced by PIDBufferedNumber::getValue().

void setValue ( x,
float  elapsedTime = 1.0f 
) [inline, virtual]


Member Data Documentation

CyclicNumber<int> mCurrentIndex [private]

T mCurrentValue [private]

T mInitialValue [private]

T mSamples[sampleCount] [private]

IntegrableNumber<T, sampleCount, maxOrder - 1> mSum [private]

float mTimeSamples[sampleCount] [private]

float mTotalTime [private]


The documentation for this class was generated from the following file:

Generated on Sun Sep 21 20:49:08 2008 for Numbers by  doxygen 1.5.6