Public Member Functions | Protected Attributes | List of all members

Allows to work with piecewise-continous function defined over a scalar time interval. More...

#include <curve.hpp>

Public Member Functions

returnValue add (double tStart, double tEnd, const DVector constant)
 
returnValue add (const VariablesGrid &sampledData, InterpolationMode mode=IM_LINEAR)
 
returnValue add (double tStart, double tEnd, const Function &parameterization_)
 
 Curve ()
 
 Curve (const Curve &arg)
 
returnValue discretize (const Grid &discretizationGrid, VariablesGrid &result) const
 
returnValue evaluate (double t, double *result) const
 
returnValue evaluate (double t, DVector &result) const
 
returnValue evaluate (double tStart, double tEnd, VariablesGrid &result) const
 
int getDim () const
 
int getNumIntervals () const
 
returnValue getTimeDomain (double tStart, double tEnd) const
 
returnValue getTimeDomain (const uint &idx, double tStart, double tEnd) const
 
BooleanType isContinuous () const
 
BooleanType isEmpty () const
 
BooleanType isInTimeDomain (double t) const
 
Curve operator() (uint idx) const
 
Curveoperator= (const Curve &arg)
 
 ~Curve ()
 

Protected Attributes

uint dim
 
Gridgrid
 
uint nIntervals
 
Function ** parameterization
 

Detailed Description

Allows to work with piecewise-continous function defined over a scalar time interval.

The class Curve allows to setup and evaluate piecewise-continous functions that are defined over a scalar time interval and map into an Vectorspace of given dimension.

\author Boris Houska, Hans Joachim Ferreau

Definition at line 52 of file curve.hpp.

Constructor & Destructor Documentation

BEGIN_NAMESPACE_ACADO Curve::Curve ( )

Default constructor.

Definition at line 45 of file curve.cpp.

Curve::Curve ( const Curve arg)

Copy constructor (deep copy).

Definition at line 53 of file curve.cpp.

Curve::~Curve ( )

Destructor.

Definition at line 72 of file curve.cpp.

Member Function Documentation

returnValue Curve::add ( double  tStart,
double  tEnd,
const DVector  constant 
)

Adds a constant piece to the curve. If other pieces of the curve have previously
been added, the start time "tStart" of the time interval [tStart,tEnd] should
contain the last time-point of the curve piece which has been added before.
The curve is not required to be continous at the boundaries of its intervals.
Note that the dimension of the constant input vector should have the same
dimensions as previously added curve pieces. If no other piece has been added
before, only tStart < tEnd is required, while the dimension of the curve will
be set to the dimension of the vector, which is added.

Parameters
tStartstart of the time interval of the curve piece to be added.
tEndend of the time interval to be added.
constantthe constant value of the curve on the interval [tStart,tEnd].

Returns
SUCCESSFUL_RETURN
RET_TIME_INTERVAL_NOT_VALID
RET_INPUT_DIMENSION_MISMATCH

Definition at line 143 of file curve.cpp.

returnValue Curve::add ( const VariablesGrid sampledData,
InterpolationMode  mode = IM_LINEAR 
)

Adds new curve pieces, which are given in a sampled form (VariablesGrid). In
order to store the curve pieces as continous functions the sampled data will be
interpolated depending on an interpolation mode. Note that the number of
intervals, which are added, will depend on this interpolation mode. The default
interpolation mode is "IM_LINEAR", i.e. linear interpolation. In this case the
number of added intervals is coinciding with the number of intervals of the
VariablesGrid, which is passed. For the dimension of the variables grid as well
the grid's start- and endpoint the same policy as for the other "add" functions
applies, i.e. the dimension should be equal to previously added pieces and the
time intervals should fit together.

Parameters
sampledDatathe data in sampled form to be interpolated and added.
modethe interploation mode (default: linear interpolation)

Returns
SUCCESSFUL_RETURN
RET_TIME_INTERVAL_NOT_VALID
RET_INPUT_DIMENSION_MISMATCH

Definition at line 158 of file curve.cpp.

returnValue Curve::add ( double  tStart,
double  tEnd,
const Function parameterization_ 
)

Adds a new piece to the curve, which is defined on the time interval
[tStart,tEnd] to be added. The function, which is passed as an argument of this
routine, should be the parameterization of the piece of curve to be added. Note
that the input function "parameterization" is only allowed to depend on the time.
If the parameterization depends e.g. on DifferentialStates, Controls etc. an
error message will be returned. As for the other "add" routines the dimension of
function as well as the time interval should fit to the previously added curve
pieces.

Parameters
tStartstart of the interval to be added.
tEndend of the time interval to be added.
parameterization_the parameterization of the curve on this interval.

Returns
SUCCESSFUL_RETURN (if successful)
RET_TIME_INTERVAL_NOT_VALID (if the time interval is not valid)
RET_INPUT_DIMENSION_MISMATCH (if the dimension or dependencies are wrong)

Definition at line 215 of file curve.cpp.

returnValue Curve::discretize ( const Grid discretizationGrid,
VariablesGrid result 
) const

Evaluates the curve at specified grid points and stores the result in form of a
VariablesGrid. Note that all time points of the grid, at which the curve should be
evaluated, must be contained in the domain of the curve. This domain can be
obtained with the routine "getTimeDomain( double tStart, double tEnd )".

Parameters
discretizationGrid(input) the grid points at which the curve should be evaluated.
result(output) the result of the evaluation.


Returns
SUCCESSFUL_RETURN (if the evaluation was successful.)
RET_INVALID_TIME_POINT (if at least one of the grid points is out of domain.)
RET_MEMBER_NOT_INITIALISED (if the curve is empty)

Definition at line 392 of file curve.cpp.

returnValue Curve::evaluate ( double  t,
double *  result 
) const

Evaluates the curve at a given time point. This routine will store
the result of the evaluation into the double *result. Note that
this double pointer must be allocated by the user. Otherwise,
segmentation faults might occur, which can not be prevented by
this routine. For not time critical operations it is recommended to
use the routine

evaluate( const double t, const DVector &result )

instead, which will throw an error if a dimension mismatch occurs.
However, the routine based on double* is slightly more efficient.
In order to make the allocation correct, use the routines isEmpty()
and getDim() first to obtain (or check) the dimension.

Parameters
t(input) the time at which the curve should be evaluated.
result(output) the result of the evaluation.


Returns
SUCCESSFUL_RETURN (if the evaluation was successful.)
RET_INVALID_ARGUMENTS (if the double* result is NULL.)
RET_INVALID_TIME_POINT (if the time point t is out of range.)
RET_MEMBER_NOT_INITIALISED (if the curve is empty)

Definition at line 314 of file curve.cpp.

returnValue Curve::evaluate ( double  t,
DVector result 
) const

Evaluates the curve at a given time point. This routine will store
the result of the evaluation into the DVector &result.

Parameters
t(input) the time at which the curve should be evaluated.
result(output) the result of the evaluation.


Returns
SUCCESSFUL_RETURN (if the evaluation was successful.)
RET_INVALID_TIME_POINT (if the time point t is out of domain.)
RET_MEMBER_NOT_INITIALISED (if the curve is empty)

Definition at line 357 of file curve.cpp.

returnValue Curve::evaluate ( double  tStart,
double  tEnd,
VariablesGrid result 
) const

Evaluates the curve at a given time interval. This routine will store
the result of the evaluation into the VariablesGrid &result.
Returns as entries in result exactly those nodes of the curve for which the
node times are contained in the interval [tStart,tEnd]

No interpolation is used.

Parameters
tStart(input) the start time at which the curve should be evaluated.
tEnd(input) the end time at which the curve should be evaluated.
result(output) the result of the evaluation.


Returns
SUCCESSFUL_RETURN (if the evaluation was successful.)
RET_INVALID_TIME_POINT (if the time point t is out of domain.)
RET_MEMBER_NOT_INITIALISED (if the curve is empty)

Definition at line 379 of file curve.cpp.

int Curve::getDim ( ) const
inline

Returns the dimension of the curve. Please note that this routine will return
-1 for the case that the curve is empty (cf. the routine isEmpty() ).

Returns
the dimension of the curve or -1.
int Curve::getNumIntervals ( ) const
inline

Returns the number of intervals, on which the pieces of the curve
are defined.

Returns
the number if intervals.
returnValue Curve::getTimeDomain ( double  tStart,
double  tEnd 
) const

Returns the time domain of the curve, i.e. the time points tStart and tEnd between
which the curve is defined.

Returns
SUCCESSFUL_RETURN
RET_MEMBER_NOT_INITIALISED (if the curve is empty.)

Definition at line 410 of file curve.cpp.

returnValue Curve::getTimeDomain ( const uint idx,
double  tStart,
double  tEnd 
) const

Returns the time domain of a piece of the curve, i.e. the interrval [tStart,tEnd] on
which the piece with number "idx" is defined.

Parameters
idx(input) the index of the curve piece for which the time domain is needed.
tStart(output) the start time of the requested interval.
tEnd(output) the end time of the requested interval.

Returns
SUCCESSFUL_RETURN (if the domain is successfully returned.)
RET_INDEX_OUT_OF_BOUNDS (if the index "idx" is larger than getNumIntervals())
RET_MEMBER_NOT_INITIALISED (if the curve is empty.)

Definition at line 424 of file curve.cpp.

BooleanType Curve::isContinuous ( ) const
inline

Returns whether the curve is continous.

Returns
BT_TRUE if the curve is continous.
BT_FALSE otherwise.
BooleanType Curve::isEmpty ( ) const
inline

Returns whether the curve is empty.

Returns
BT_TRUE if the curve is empty.
BT_FALSE otherwise.
BooleanType Curve::isInTimeDomain ( double  t) const

Returns the time domain of the curve, i.e. the time points tStart and tEnd between
which the curve is defined.

Returns
SUCCESSFUL_RETURN
RET_MEMBER_NOT_INITIALISED (if the curve is empty.)

Definition at line 445 of file curve.cpp.

Curve Curve::operator() ( uint  idx) const

Definition at line 114 of file curve.cpp.

Curve & Curve::operator= ( const Curve arg)

Assignment operator (deep copy).

Definition at line 85 of file curve.cpp.

Member Data Documentation

uint Curve::dim
protected

Definition at line 302 of file curve.hpp.

Grid* Curve::grid
protected

Definition at line 304 of file curve.hpp.

uint Curve::nIntervals
protected

Definition at line 301 of file curve.hpp.

Function** Curve::parameterization
protected

Definition at line 303 of file curve.hpp.


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


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:35:23