Hopsan
IntegratorWithBackup Class Reference
Inheritance diagram for IntegratorWithBackup:
Integrator

Public Member Functions

void initialize (const double timestep, const double u0=0.0, const double y0=0.0)
 
void setBackupLength (int nSteps)
 Setup the number of backup steps to remember (size of the backup buffer)
 
void restoreBackup (size_t nSteps=1)
 Restore the backup at the given step.
 
void backup ()
 Pushes a backup of transfer function states into the backup buffer.
 
double updateWithBackup (double u)
 Make a backup of states and then calls update.
 
- Public Member Functions inherited from Integrator
void initialize (const double timestep, const double u0=0.0, const double y0=0.0)
 
void initializeValues (const double u0, const double y0)
 
double update (const double u)
 Updates the integrator one timestep and returns the new value.
 
double value () const
 Returns the integrator value.
 

Protected Attributes

Delay mBackupU
 
Delay mBackupY
 
- Protected Attributes inherited from Integrator
double mDelayU
 
double mDelayY
 
double mTimeStep
 

Member Function Documentation

◆ backup()

void backup ( )
inline

Pushes a backup of transfer function states into the backup buffer.

Note
Only the delayed states are backed up, not the current value or the coefficients

◆ restoreBackup()

void restoreBackup ( size_t nSteps = 1)
inline

Restore the backup at the given step.

Parameters
[in]nStepsThe number of steps backwards in time to restore (1=last step) must be >=1
Note
The function assumes that the backup buffer has been allocated
See also
setBackupLength

◆ setBackupLength()

void setBackupLength ( int nSteps)
inline

Setup the number of backup steps to remember (size of the backup buffer)

Parameters
[in]nStepsThe number of steps to remember

◆ updateWithBackup()

double updateWithBackup ( double u)
inline

Make a backup of states and then calls update.

Parameters
[in]uThe new input value
Returns
The current transfer function output value after update