chrono::ChFunctionSetpoint Class Reference

Description

Function that returns Y from an externally-provided value, as a ZERO_ORDER_HOLD (zero order hold) block.

This means that the Y value does NOT change if you call GetVal(double x) with different values of x, unless you keep the setpoint Y updated via multiple calls to SetSetpoint(), for example calling SetSetpoint() at each timestep in the simulation loop. Also first two derivatives (speed, accel.) will persist until next SetSetpoint() call. Function of this class are most often functions of time.

#include <ChFunctionSetpoint.h>

Inheritance diagram for chrono::ChFunctionSetpoint:
Collaboration diagram for chrono::ChFunctionSetpoint:

Public Member Functions

 ChFunctionSetpoint (const ChFunctionSetpoint &other)
 
virtual ChFunctionSetpointClone () const override
 "Virtual" copy constructor (covariant return type).
 
virtual double GetVal (double x) const override
 Return the function output for input x. More...
 
virtual double GetDer (double x) const override
 Return the first derivative of the function. More...
 
virtual double GetDer2 (double x) const override
 Return the second derivative of the function. More...
 
virtual void SetSetpoint (double setpoint, double x)
 Set the setpoint, and compute its derivatives (speed, acceleration) automatically by backward differentiation (only if x is called at increasing small steps). More...
 
virtual void SetSetpointAndDerivatives (double setpoint, double setpoint_dx, double setpoint_dxdx)
 Set the setpoint, and also its derivatives. More...
 
double GetSetpoint ()
 Get the last set setpoint.
 
virtual void Update (double x) override
 Update could be implemented by children classes, ex. to launch callbacks.
 
virtual void ArchiveOut (ChArchiveOut &archive_out) override
 Method to allow serialization of transient data to archives.
 
virtual void ArchiveIn (ChArchiveIn &archive_in) override
 Method to allow de-serialization of transient data from archives.
 
- Public Member Functions inherited from chrono::ChFunction
 ChFunction (const ChFunction &other)
 
virtual Type GetType () const
 Return the unique function type identifier.
 
virtual double GetDer3 (double x) const
 Return the third derivative of the function. More...
 
virtual double GetDerN (double x, int der_order) const
 Return the Nth derivative of the function (up to 3rd derivative). More...
 
virtual double GetWeight (double x) const
 Return the weight of the function. More...
 
virtual double GetMax (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the maximum of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetMin (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the minimum of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetMean (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the mean of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetSquaredMean (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the squared mean of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetIntegral (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the integral of the function (or its der_order derivative) over the range [xmin, xmax]. More...
 
virtual double GetPositiveAccelerationCoeff () const
 Compute the positive acceleration coefficient. More...
 
virtual double GetNegativeAccelerationCoeff () const
 Compute the negative acceleration coefficient. More...
 
virtual double GetVelocityCoefficient () const
 Compute the velocity coefficient. More...
 
virtual void OutputToASCIIFile (std::ostream &file, double xmin, double xmax, int samples, char delimiter)
 Store X-Y pairs to an ASCII File. More...
 
virtual ChMatrixDynamic SampleUpToDerN (double xmin, double xmax, double step, int derN=0)
 Sample function on given interval [xmin, xmax], up to derN derivative (0 being the function ouput itself). More...
 
double operator() (double arg) const
 Alias operator of the GetVal function.
 

Additional Inherited Members

- Public Types inherited from chrono::ChFunction
enum  Type {
  BSPLINE, CONSTANT, CONSTACC, CONSTJERK,
  CUSTOM, CYCLOIDAL, DERIVATIVE, FILLET3,
  INTEGRAL, INTERP, LAMBDA, MIRROR,
  OPERATOR, POLY, POLY23, POLY345,
  RAMP, REPEAT, SEQUENCE, SINE,
  SINE_STEP
}
 Enumeration of function types.
 

Member Function Documentation

◆ GetDer()

virtual double chrono::ChFunctionSetpoint::GetDer ( double  x) const
inlineoverridevirtual

Return the first derivative of the function.

Default implementation computes a numerical differentiation. Inherited classes may override this method with a more efficient implementation (e.g. analytical solution).

Reimplemented from chrono::ChFunction.

◆ GetDer2()

virtual double chrono::ChFunctionSetpoint::GetDer2 ( double  x) const
inlineoverridevirtual

Return the second derivative of the function.

Default implementation computes a numerical differentiation. Inherited classes may override this method with a more efficient implementation (e.g. analytical solution).

Reimplemented from chrono::ChFunction.

◆ GetVal()

virtual double chrono::ChFunctionSetpoint::GetVal ( double  x) const
inlineoverridevirtual

Return the function output for input x.

Must be overridden by specialized classes.

Implements chrono::ChFunction.

◆ SetSetpoint()

void chrono::ChFunctionSetpoint::SetSetpoint ( double  setpoint,
double  x 
)
virtual

Set the setpoint, and compute its derivatives (speed, acceleration) automatically by backward differentiation (only if x is called at increasing small steps).

All values will persist indefinitely until next call.

◆ SetSetpointAndDerivatives()

virtual void chrono::ChFunctionSetpoint::SetSetpointAndDerivatives ( double  setpoint,
double  setpoint_dx,
double  setpoint_dxdx 
)
inlinevirtual

Set the setpoint, and also its derivatives.

All values will persist indefinitely until next call.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/functions/ChFunctionSetpoint.h
  • /builds/uwsbel/chrono/src/chrono/functions/ChFunctionSetpoint.cpp