mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
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 58 of file generalIntegrator.hpp.

#include <ao/sim/generalIntegrator.hpp>

Public Types

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

Public Member Functions

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

Protected Attributes

int m_nModes { 0 }
 The number of modes being filtered.
bool m_openLoop { false }
 If true, then commands are not integrated. Default is false.
int m_openLoopDelay { 0 }
 If > 0, then the loop is open for this time in time steps. Default is 0.
int m_closingRamp { 0 }
int m_closingDelay { 0 }
imageT m_closingGains
 Column-vector of gains used for loop closing as simple integrator.
int m_lowOrders { 0 }
imageT m_gains
 Column-vector of gains.

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 72 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 66 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 75 of file generalIntegrator.hpp.

◆ realT

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

The real data type.

Definition at line 63 of file generalIntegrator.hpp.

Constructor & Destructor Documentation

◆ generalIntegrator()

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

Default c'tor.

Definition at line 282 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 382 of file generalIntegrator.hpp.

References m_closingDelay.

◆ 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 374 of file generalIntegrator.hpp.

References m_closingDelay.

◆ 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 388 of file generalIntegrator.hpp.

References gains(), m_closingGains, MXE_SIZEERR, and mxError.

◆ 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 406 of file generalIntegrator.hpp.

References m_closingGains.

◆ 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 368 of file generalIntegrator.hpp.

References m_closingRamp.

◆ 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 360 of file generalIntegrator.hpp.

References m_closingRamp.

◆ 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 491 of file generalIntegrator.hpp.

References m_gains, m_nModes, MXE_INVALIDARG, and mxError.

Referenced by gains().

◆ 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 503 of file generalIntegrator.hpp.

References m_gains, m_nModes, MXE_INVALIDARG, and mxError.

◆ 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.

References mx::ioutils::convertFromString(), gain(), m_gains, MXE_FILEOERR, and mxError.

◆ 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 528 of file generalIntegrator.hpp.

References gains(), m_gains, MXE_SIZEERR, and mxError.

◆ 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 517 of file generalIntegrator.hpp.

References m_gains.

Referenced by closingGains(), and gains().

◆ 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 287 of file generalIntegrator.hpp.

References m_closingGains, m_gains, m_nModes, and nModes().

◆ 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 570 of file generalIntegrator.hpp.

References m_nModes.

◆ 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 425 of file generalIntegrator.hpp.

References m_lowOrders.

◆ 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 417 of file generalIntegrator.hpp.

References m_lowOrders.

◆ 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 327 of file generalIntegrator.hpp.

References m_nModes.

Referenced by initialize().

◆ 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 340 of file generalIntegrator.hpp.

References m_openLoop.

◆ 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 333 of file generalIntegrator.hpp.

References m_openLoop.

◆ 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 354 of file generalIntegrator.hpp.

References m_openLoopDelay.

◆ 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 346 of file generalIntegrator.hpp.

References m_openLoopDelay.

◆ 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 453 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 431 of file generalIntegrator.hpp.

References m_nModes.

◆ 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 483 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 461 of file generalIntegrator.hpp.

References m_nModes.

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 90 of file generalIntegrator.hpp.

Referenced by closingDelay(), and closingDelay().

◆ 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 93 of file generalIntegrator.hpp.

Referenced by closingGains(), closingGains(), and initialize().

◆ 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 87 of file generalIntegrator.hpp.

Referenced by closingRamp(), and closingRamp().

◆ m_gains

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

Column-vector of gains.

Definition at line 104 of file generalIntegrator.hpp.

Referenced by gain(), gain(), gains(), gains(), gains(), and initialize().

◆ 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 95 of file generalIntegrator.hpp.

Referenced by lowOrders(), and lowOrders().

◆ m_nModes

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

The number of modes being filtered.

Definition at line 81 of file generalIntegrator.hpp.

Referenced by gain(), gain(), initialize(), initMeasurements(), nModes(), setASize(), and setBSize().

◆ 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 83 of file generalIntegrator.hpp.

Referenced by openLoop(), and openLoop().

◆ 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 85 of file generalIntegrator.hpp.

Referenced by openLoopDelay(), and openLoopDelay().


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