mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
mx::AO::sim::generalIntegrator< _realT > Class Template Reference

template<typename _realT>
class mx::AO::sim::generalIntegrator< _realT >

Implements a general integrator controller.

Todo:

document the math for the G.I.

document the filter coefficients, etc.

Template Parameters
_realTis the floating point type for all calculations.

Definition at line 38 of file generalIntegrator.hpp.

#include <ao/sim/generalIntegrator.hpp>

Public Types

typedef _realT realT
 The real data type. More...
 
typedef std::complex< realTcomplexT
 The real data type. More...
 
typedef wfMeasurement< realTcommandT
 The wavefront data type. More...
 
typedef Eigen::Array< realT, Eigen::Dynamic, Eigen::Dynamic > imageT
 The image type, used here as a general storage array. More...
 

Public Member Functions

 generalIntegrator ()
 Default c'tor. More...
 
int initialize (int nModes)
 Allocate and initialize all state. More...
 
int nModes ()
 Get the number of modes. More...
 
int openLoop (bool ol)
 Set the m_openLoop flag. More...
 
bool openLoop ()
 Get the value of the m_openLoop flag. More...
 
int openLoopDelay (int cr)
 Set the open loop delay. More...
 
int openLoopDelay ()
 Get the value of the m_openLoopDelay. More...
 
int closingRamp (int cr)
 Set the closing ramp. More...
 
int closingRamp ()
 Get the value of the m_closingRamp. More...
 
int closingDelay (int cd)
 Set the closing delay. More...
 
int closingDelay ()
 Get the value of the m_closingDelay. More...
 
int closingGains (const std::vector< realT > &gains)
 Set the simple integrator gains to use during closing. More...
 
int closingGains (realT g)
 Set the simple integrator gain to use for all modes during closing. More...
 
int lowOrders (int lo)
 Set m_lowOrders. More...
 
int lowOrders ()
 Get the value of the m_lowOrders. More...
 
int setASize (int n)
 Set the size of the IIR vector (the a coefficients) More...
 
int setA (int i, const imageT &a)
 Set the IIR coefficients for one mode. More...
 
int setBSize (int n)
 Set the size of the FIR vector (the b coefficients) More...
 
int setB (int i, const imageT &b)
 Set the FIR coefficients for one mode. More...
 
realT gain (int i)
 Get the gain for a single mode. More...
 
int gain (int i, realT g)
 Set the gain for a single mode. More...
 
int gains (realT g)
 Set the gain for all modes to a single value. More...
 
int gains (const std::vector< realT > &gains)
 Set the gains for all modes, using a vector to specify each gain. More...
 
int gains (const std::string &ogainf)
 Set the gains for all modes, using a file to specify each gain. More...
 
int initMeasurements (commandT &filtAmps, commandT &rawAmps)
 Allocate the provided command structures. More...
 

Protected Attributes

int m_nModes {0}
 The number of modes being filtered. More...
 
bool m_openLoop {false}
 If true, then commands are not integrated. Default is false. More...
 
int m_openLoopDelay {0}
 If > 0, then the loop is open for this time in time steps. Default is 0. More...
 
int m_closingRamp {0}
 If > 0, then gains are famped linearly up to m_closingGains over this interval in time steps. Default is 0. This is relative m_openLoopDelay. More...
 
int m_closingDelay {0}
 If > 0, then the simple integrator,with m_closingGains is used up to this timestep. This is relative m_openLoopDelay. Default = 0. More...
 
imageT m_closingGains
 Column-vector of gains used for loop closing as simple integrator. More...
 
int m_lowOrders {0}
 If > 0, then this sets the maximum mode number which is filtered. All remaining modes are set to 0. Default = 0. More...
 
imageT m_gains
 Column-vector of gains. More...
 

Member Typedef Documentation

◆ commandT

template<typename _realT >
typedef wfMeasurement<realT> mx::AO::sim::generalIntegrator< _realT >::commandT

The wavefront data type.

The command type

Definition at line 53 of file generalIntegrator.hpp.

◆ complexT

template<typename _realT >
typedef std::complex<realT> mx::AO::sim::generalIntegrator< _realT >::complexT

The real data type.

Definition at line 47 of file generalIntegrator.hpp.

◆ imageT

template<typename _realT >
typedef Eigen::Array< realT, Eigen::Dynamic, Eigen::Dynamic> mx::AO::sim::generalIntegrator< _realT >::imageT

The image type, used here as a general storage array.

Definition at line 56 of file generalIntegrator.hpp.

◆ realT

template<typename _realT >
typedef _realT mx::AO::sim::generalIntegrator< _realT >::realT

The real data type.

Definition at line 44 of file generalIntegrator.hpp.

Constructor & Destructor Documentation

◆ generalIntegrator()

Default c'tor.

Definition at line 274 of file generalIntegrator.hpp.

Member Function Documentation

◆ closingDelay() [1/2]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::closingDelay

Get the value of the m_closingDelay.

Returns
the current value of m_closingDelay.

Definition at line 377 of file generalIntegrator.hpp.

◆ closingDelay() [2/2]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::closingDelay ( int  cd)

Set the closing delay.

If m_closingDelay > 0, then the simple integragor is used until this timestep.

Returns
0 on success, a negative integer on error.
Parameters
[in]cdThe new value of m_closingDelay

Definition at line 369 of file generalIntegrator.hpp.

◆ closingGains() [1/2]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::closingGains ( const std::vector< realT > &  gains)

Set the simple integrator gains to use during closing.

Returns
0 on success
< 0 on error
Return values
-1on vector size mismatch
Parameters
[in]gainsvector of gains.

Definition at line 383 of file generalIntegrator.hpp.

◆ closingGains() [2/2]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::closingGains ( realT  g)

Set the simple integrator gain to use for all modes during closing.

Returns
0 on success
< 0 on error

Definition at line 401 of file generalIntegrator.hpp.

◆ closingRamp() [1/2]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::closingRamp

Get the value of the m_closingRamp.

Returns
the current value of m_closingRamp.

Definition at line 363 of file generalIntegrator.hpp.

◆ closingRamp() [2/2]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::closingRamp ( int  cr)

Set the closing ramp.

If m_closingRamp > 0, then the gains are ramped linearly up to m_closingGains over this timer interval in timesteps. Requires m_closingDelay > 0.

Returns
0 on success, a negative integer on error.
Parameters
[in]crThe new value of m_closingRamp

Definition at line 355 of file generalIntegrator.hpp.

◆ gain() [1/2]

template<class realT >
realT mx::AO::sim::generalIntegrator< realT >::gain ( int  i)

Get the gain for a single mode.

Returns
the gain value if mode exists.
Return values
0if the mode doesn't exist.
Parameters
iThe mode number

Definition at line 487 of file generalIntegrator.hpp.

◆ gain() [2/2]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::gain ( int  i,
realT  g 
)

Set the gain for a single mode.

Returns
0 on success, negative number on error.
Return values
0if the mode doesn't exist.
Parameters
iThe mode number
gThe new gain value

Definition at line 499 of file generalIntegrator.hpp.

◆ gains() [1/3]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::gains ( const std::string &  ogainf)

Set the gains for all modes, using a file to specify each gain.

The file format is a simple ASCII single column, with 1 gain per line. Must be exactly as long as m_nModes.

Returns
0 on success, negative number on error.
Return values
-1if file open fails
Parameters
[in]ogainfthe name of the file, full path

Definition at line 546 of file generalIntegrator.hpp.

◆ gains() [2/3]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::gains ( const std::vector< realT > &  gains)

Set the gains for all modes, using a vector to specify each gain.

The vector must be exactly as long as m_nModes.

Returns
0 on success, negative number on error.
Return values
-1on vector size mismatch
Parameters
[in]gainsvector of gains.

Definition at line 525 of file generalIntegrator.hpp.

◆ gains() [3/3]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::gains ( realT  g)

Set the gain for all modes to a single value.

Returns
0 on success, negative number on error.
Parameters
gThe new gain value

Definition at line 514 of file generalIntegrator.hpp.

◆ initialize()

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::initialize ( int  nModes)

Allocate and initialize all state.

Returns
0 on success, a negative integer otherwise.
Parameters
[in]nModesthe number of modes to be filtered

Definition at line 281 of file generalIntegrator.hpp.

◆ initMeasurements()

template<class realT >
int mx::AO::sim::generalIntegrator< realT >::initMeasurements ( commandT filtAmps,
commandT rawAmps 
)

Allocate the provided command structures.

Used by the calling system to allocate the commands being passed between components.

Returns
0 on success, negative number on error.
Parameters
filtAmpsThe structure to contain the filtered commands
rawAmpsThe structure to contain the raw commands

Definition at line 571 of file generalIntegrator.hpp.

◆ lowOrders() [1/2]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::lowOrders

Get the value of the m_lowOrders.

Returns
the current value of m_lowOrders.

Definition at line 420 of file generalIntegrator.hpp.

◆ lowOrders() [2/2]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::lowOrders ( int  lo)

Set m_lowOrders.

If m_lowOrders > 0, then this sets the maximum mode number which is filtered. All remaining modes are set to 0.

Returns
0 on success, a negative integer on error.
Parameters
[in]loThe new value of m_lowOrders

Definition at line 412 of file generalIntegrator.hpp.

◆ nModes()

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::nModes

Get the number of modes.

nModes is only set by calling initialize.

Returns
the current value of m_nModes

Definition at line 322 of file generalIntegrator.hpp.

◆ openLoop() [1/2]

template<typename realT >
bool mx::AO::sim::generalIntegrator< realT >::openLoop

Get the value of the m_openLoop flag.

Returns
the current value of m_openLoop.

Definition at line 335 of file generalIntegrator.hpp.

◆ openLoop() [2/2]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::openLoop ( bool  ol)

Set the m_openLoop flag.

If m_openLoop is true, then commands are not filtered.

Returns
0 on success, a negative integer on error.
Parameters
[in]olthe new value of m_openLoop

Definition at line 328 of file generalIntegrator.hpp.

◆ openLoopDelay() [1/2]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::openLoopDelay

Get the value of the m_openLoopDelay.

Returns
the current value of m_openLoopDelay.

Definition at line 349 of file generalIntegrator.hpp.

◆ openLoopDelay() [2/2]

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::openLoopDelay ( int  cr)

Set the open loop delay.

If m_openLoopDelay > 0, then the loop is open for this period in time-steps Requires m_closingDelay > 0.

Returns
0 on success, a negative integer on error.
Parameters
[in]crThe new value of m_openLoopDelay

Definition at line 341 of file generalIntegrator.hpp.

◆ setA()

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::setA ( int  i,
const imageT a 
)

Set the IIR coefficients for one mode.

Returns
0 on success, negative number on error.
Parameters
[in]ithe mode number
[in]athe IIR coefficients for this mode

Definition at line 448 of file generalIntegrator.hpp.

◆ setASize()

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::setASize ( int  n)

Set the size of the IIR vector (the a coefficients)

This allocates m_a to be m_nModes X n in size.

Returns
0 on success, negative number on error.
Parameters
[in]nthe number of IIR coefficients

Definition at line 426 of file generalIntegrator.hpp.

◆ setB()

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::setB ( int  i,
const imageT b 
)

Set the FIR coefficients for one mode.

Returns
0 on success, negative number on error.
Parameters
[in]ithe mode number
[in]bthe IIR coefficients for this mode

Definition at line 478 of file generalIntegrator.hpp.

◆ setBSize()

template<typename realT >
int mx::AO::sim::generalIntegrator< realT >::setBSize ( int  n)

Set the size of the FIR vector (the b coefficients)

This allocates m_b to be m_nModes X n in size.

Returns
0 on success, negative number on error.
Parameters
[in]nthe number of FIR coefficients

Definition at line 456 of file generalIntegrator.hpp.

Member Data Documentation

◆ m_closingDelay

template<typename _realT >
int mx::AO::sim::generalIntegrator< _realT >::m_closingDelay {0}
protected

If > 0, then the simple integrator,with m_closingGains is used up to this timestep. This is relative m_openLoopDelay. Default = 0.

Definition at line 72 of file generalIntegrator.hpp.

◆ m_closingGains

template<typename _realT >
imageT mx::AO::sim::generalIntegrator< _realT >::m_closingGains
protected

Column-vector of gains used for loop closing as simple integrator.

Definition at line 74 of file generalIntegrator.hpp.

◆ m_closingRamp

template<typename _realT >
int mx::AO::sim::generalIntegrator< _realT >::m_closingRamp {0}
protected

If > 0, then gains are famped linearly up to m_closingGains over this interval in time steps. Default is 0. This is relative m_openLoopDelay.

Definition at line 70 of file generalIntegrator.hpp.

◆ m_gains

template<typename _realT >
imageT mx::AO::sim::generalIntegrator< _realT >::m_gains
protected

Column-vector of gains.

Definition at line 84 of file generalIntegrator.hpp.

◆ m_lowOrders

template<typename _realT >
int mx::AO::sim::generalIntegrator< _realT >::m_lowOrders {0}
protected

If > 0, then this sets the maximum mode number which is filtered. All remaining modes are set to 0. Default = 0.

Definition at line 76 of file generalIntegrator.hpp.

◆ m_nModes

template<typename _realT >
int mx::AO::sim::generalIntegrator< _realT >::m_nModes {0}
protected

The number of modes being filtered.

Definition at line 64 of file generalIntegrator.hpp.

◆ m_openLoop

template<typename _realT >
bool mx::AO::sim::generalIntegrator< _realT >::m_openLoop {false}
protected

If true, then commands are not integrated. Default is false.

Definition at line 66 of file generalIntegrator.hpp.

◆ m_openLoopDelay

template<typename _realT >
int mx::AO::sim::generalIntegrator< _realT >::m_openLoopDelay {0}
protected

If > 0, then the loop is open for this time in time steps. Default is 0.

Definition at line 68 of file generalIntegrator.hpp.


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