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

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

Implements the leaky integrator controller.

Template Parameters
_realTis the floating point type for all calculations.

Definition at line 46 of file leakyIntegrator.hpp.

#include <ao/sim/leakyIntegrator.hpp>

Public Types

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

Public Member Functions

 leakyIntegrator ()
 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 _openLoop flag.
bool openLoop ()
 Get the value of the _openLoop flag.
int closingDelay (int cd)
 Set _closingDelay.
int closingDelay ()
 Get the value of the _closingDelay.
int lowOrders (int lo)
 Set _lowOrders.
int lowOrders ()
 Get the value of the _lowOrders.
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 > &vgains)
 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 leak (int i, realT l)
 Set the leak for a single mode.
int leaks (realT l)
 Set a leak for all modes.
int initMeasurements (commandT &filtAmps, commandT &rawAmps)
 Allocate the provided command structures.
int filterCommands (commandT &filtAmps, commandT &rawAmps, int iterNo)
 Apply the leaky integrator.

Protected Attributes

int _nModes
 The number of modes being filtered.
bool _openLoop
 If true, then commands are not integrated.
int _closingDelay
 If > 0, then the gains are ramped linearly up to this value. Default = 0.
int _lowOrders
imageT _gains
 Column-vector of gains.
imageT _leaks
 Column-vector of leaks.
imageT _commands
 Column-vector past commands.

Member Typedef Documentation

◆ commandT

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

The command type.

Definition at line 57 of file leakyIntegrator.hpp.

◆ imageT

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

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

Definition at line 60 of file leakyIntegrator.hpp.

◆ realT

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

The real data type.

Definition at line 51 of file leakyIntegrator.hpp.

◆ wavefrontT

template<typename _realT>
typedef wavefront<realT> mx::AO::sim::leakyIntegrator< _realT >::wavefrontT

The wavefront data type.

Definition at line 54 of file leakyIntegrator.hpp.

Constructor & Destructor Documentation

◆ leakyIntegrator()

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

Default c'tor.

Definition at line 204 of file leakyIntegrator.hpp.

References _closingDelay, _lowOrders, _nModes, and _openLoop.

Member Function Documentation

◆ closingDelay() [1/2]

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

Get the value of the _closingDelay.

Returns
the current value of _closingDelay.

Definition at line 262 of file leakyIntegrator.hpp.

References _closingDelay.

◆ closingDelay() [2/2]

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

Set _closingDelay.

If _closingDelay > 0, then the gains are ramped linearly up to this value.

Returns
0 on success, a negative integer on error.
Parameters
cdThe new value of _closingDelay

Definition at line 254 of file leakyIntegrator.hpp.

References _closingDelay.

◆ filterCommands()

template<class realT>
int mx::AO::sim::leakyIntegrator< realT >::filterCommands ( commandT & filtAmps,
commandT & rawAmps,
int iterNo )

Apply the leaky integrator.

Returns
0 on success, negative number on error.
Parameters
[out]filtAmpsthe filtered commands
[in]rawAmpsthe raw commands
[in]iterNoThe current iteration number

Definition at line 390 of file leakyIntegrator.hpp.

References _closingDelay, _commands, _gains, _leaks, _lowOrders, and _openLoop.

◆ gain() [1/2]

template<typename realT>
realT mx::AO::sim::leakyIntegrator< 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
[in]ithe mode number

Definition at line 282 of file leakyIntegrator.hpp.

References _gains, _nModes, MXE_INVALIDARG, and mxError.

Referenced by gains().

◆ gain() [2/2]

template<typename realT>
int mx::AO::sim::leakyIntegrator< 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
[in]ithe mode number
[in]gthe new gain value

Definition at line 294 of file leakyIntegrator.hpp.

References _gains, _nModes, MXE_INVALIDARG, and mxError.

◆ gains() [1/3]

template<typename realT>
int mx::AO::sim::leakyIntegrator< 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 _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 337 of file leakyIntegrator.hpp.

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

◆ gains() [2/3]

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

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

The vector must be exactly as long as _nModes.

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

Definition at line 319 of file leakyIntegrator.hpp.

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

◆ gains() [3/3]

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

Set the gain for all modes to a single value.

Returns
0 on success, negative number on error.
Parameters
[in]gthe new gain value

Definition at line 308 of file leakyIntegrator.hpp.

References _gains.

Referenced by gains().

◆ initialize()

template<typename realT>
int mx::AO::sim::leakyIntegrator< 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 217 of file leakyIntegrator.hpp.

References _commands, _gains, _leaks, _nModes, and nModes().

Referenced by unitTest::ao_sim_leakyIntegrator_test::TEST_CASE().

◆ initMeasurements()

template<class realT>
int mx::AO::sim::leakyIntegrator< 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 378 of file leakyIntegrator.hpp.

References _nModes.

◆ leak()

template<typename realT>
int mx::AO::sim::leakyIntegrator< realT >::leak ( int i,
realT l )

Set the leak for a single mode.

Returns
0 on success, negative number on error.
Parameters
[in]ithe mode number
[in]lthe new leak value for this mode

Definition at line 361 of file leakyIntegrator.hpp.

References _leaks.

Referenced by unitTest::ao_sim_leakyIntegrator_test::TEST_CASE().

◆ leaks()

template<typename realT>
int mx::AO::sim::leakyIntegrator< realT >::leaks ( realT l)

Set a leak for all modes.

Returns
0 on success, negative number on error.
Parameters
[in]lthe new leak value to set for all modes

Definition at line 369 of file leakyIntegrator.hpp.

References _leaks.

◆ lowOrders() [1/2]

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

Get the value of the _lowOrders.

Returns
the current value of _lowOrders.

Definition at line 276 of file leakyIntegrator.hpp.

References _lowOrders.

◆ lowOrders() [2/2]

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

Set _lowOrders.

If _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
loThe new value of _lowOrders

Definition at line 268 of file leakyIntegrator.hpp.

References _lowOrders.

◆ nModes()

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

Get the number of modes.

nModes is only set by calling initialize.

Returns
the current value of _nModes

Definition at line 235 of file leakyIntegrator.hpp.

References _nModes.

Referenced by initialize().

◆ openLoop() [1/2]

template<typename realT>
bool mx::AO::sim::leakyIntegrator< realT >::openLoop ( )

Get the value of the _openLoop flag.

Returns
the current value of _openLoop.

Definition at line 248 of file leakyIntegrator.hpp.

References _openLoop.

◆ openLoop() [2/2]

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

Set the _openLoop flag.

If _openLoop is true, then commands are not filtered.

Returns
0 on success, a negative integer on error.
Parameters
olThe new value of _openLoop

Definition at line 241 of file leakyIntegrator.hpp.

References _openLoop.

Member Data Documentation

◆ _closingDelay

template<typename _realT>
int mx::AO::sim::leakyIntegrator< _realT >::_closingDelay
protected

If > 0, then the gains are ramped linearly up to this value. Default = 0.

Definition at line 70 of file leakyIntegrator.hpp.

Referenced by leakyIntegrator(), closingDelay(), closingDelay(), and filterCommands().

◆ _commands

template<typename _realT>
imageT mx::AO::sim::leakyIntegrator< _realT >::_commands
protected

Column-vector past commands.

Definition at line 79 of file leakyIntegrator.hpp.

Referenced by filterCommands(), and initialize().

◆ _gains

template<typename _realT>
imageT mx::AO::sim::leakyIntegrator< _realT >::_gains
protected

Column-vector of gains.

Definition at line 75 of file leakyIntegrator.hpp.

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

◆ _leaks

template<typename _realT>
imageT mx::AO::sim::leakyIntegrator< _realT >::_leaks
protected

Column-vector of leaks.

Definition at line 77 of file leakyIntegrator.hpp.

Referenced by filterCommands(), initialize(), leak(), and leaks().

◆ _lowOrders

template<typename _realT>
int mx::AO::sim::leakyIntegrator< _realT >::_lowOrders
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 72 of file leakyIntegrator.hpp.

Referenced by leakyIntegrator(), filterCommands(), lowOrders(), and lowOrders().

◆ _nModes

template<typename _realT>
int mx::AO::sim::leakyIntegrator< _realT >::_nModes
protected

The number of modes being filtered.

Definition at line 66 of file leakyIntegrator.hpp.

Referenced by leakyIntegrator(), gain(), gain(), initialize(), initMeasurements(), and nModes().

◆ _openLoop

template<typename _realT>
bool mx::AO::sim::leakyIntegrator< _realT >::_openLoop
protected

If true, then commands are not integrated.

Definition at line 68 of file leakyIntegrator.hpp.

Referenced by leakyIntegrator(), filterCommands(), openLoop(), and openLoop().


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