FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
CRamp Class Reference

#include <CRamp.h>

+ Inheritance diagram for CRamp:
+ Collaboration diagram for CRamp:

Public Member Functions

 CRamp (std::string sSimObjectName, ISimObjectCreator *pCreator)
 The constructor sets the pointer to the output object and the parser object.
 
- Public Member Functions inherited from CSrcBase
 CSrcBase (std::string sSimObjectName, ISimObjectCreator *pCreator)
 The constructor.
 
virtual ~CSrcBase ()
 The destructor.
 
virtual void OdeFcn (const double dT, const double *const adX, double *const adXDot) const
 Calculates the state derivatives.
 
- Public Member Functions inherited from fhsim_base::SignalBlock
 SignalBlock (const std::string &name, ISimObjectCreator *creator, PortWidthRule rule=PortWidthRule::DefaultOne)
 

Protected Member Functions

void CalcOutput (const double dT, const double *const adX)
 Calculations of the output signals.
 
- Protected Member Functions inherited from CSrcBase
bool ReadTwinParameters (std::string sTagA, double dDefaultA, std::string sTagB, double dDefaultB, std::vector< double > &vals, ISimObjectCreator *pCreator)
 Utility function to read a parameter with two possible representations or units.
 
virtual const double * Signal (const double dT, const double *const adX)
 The output signal.
 
virtual const double * SignalDot (const double dT, const double *const adX)
 The derivative of the output signal.
 
- Protected Member Functions inherited from fhsim_base::SignalBlock
int PortWidth () const
 The number of elements in the signals of the block (the parameter PortWidth).
 
std::vector< double > ReadScalarOrVector (ISimObjectCreator *creator, const std::string &name, double defaultValue) const
 
std::vector< double > ReadScalarOrVector (ISimObjectCreator *creator, const std::string &name) const
 

Protected Attributes

std::vector< double > m_adStartValues
 
std::vector< double > m_adStopValues
 
std::vector< double > m_adStartTimes
 
std::vector< double > m_adStopTimes
 
- Protected Attributes inherited from CSrcBase
std::vector< double > m_outDot
 The derivative of the output signal (the output signal is m_out).
 
- Protected Attributes inherited from fhsim_base::SignalBlock
std::vector< double > m_out
 The output buffer, PortWidth() elements. A block may resize it, for example to the width of an output port that differs from PortWidth.
 

Additional Inherited Members

- Public Types inherited from fhsim_base::SignalBlock
enum class  PortWidthRule { DefaultOne , Required }
 Whether the parameter PortWidth must be in the input file. More...
 
- Static Public Member Functions inherited from fhsim_base::SignalBlock
static int ReadCount (ISimObjectCreator *creator, const std::string &name, int defaultValue)
 
static int ReadCount (ISimObjectCreator *creator, const std::string &name)
 As above for a count that must be in the file.
 

Detailed Description

Author
Karl-Johan Reite and Vegar Johansen

This is a ramp simObject. It has no input port, and has two output ports with a scalar or vector signal. One is the ramp signal, and the other is the signal's derivative. The initial value, the final value, the start time and the end time are decided by input parameters at run-time.

Simobject name for use in input file: Src/Ramp

Parameters
ParameterDefaultComment
PortWidth1The number of elements in the signal.
StartValue0The start value of the output port. This may either be a scalar, or a comma separated list referring to the different elements of the signal.
StopValue1The stop value of the output port. This may either be a scalar, or a comma separated list referring to the different elements of the signal.
StartTime0The time at which the ramp starts. Before it the output is StartValue. This may either be a scalar, or a comma separated list referring to the different elements of the signal.
StopTime1The time at which the ramp ends, of any sign, and not before StartTime. After it the output holds StopValue. This may either be a scalar, or a comma separated list referring to the different elements of the signal.

Member Function Documentation

◆ CalcOutput()

void CRamp::CalcOutput ( const double  dT,
const double *const  adX 
)
protectedvirtual

Implements CSrcBase.

Member Data Documentation

◆ m_adStartTimes

std::vector<double> CRamp::m_adStartTimes
protected

The time at which the ramp starts. Before it the output is StartValue. This may either be a scalar, or a comma separated list referring to the different elements of the signal.

◆ m_adStartValues

std::vector<double> CRamp::m_adStartValues
protected

The start value of the output port. This may either be a scalar, or a comma separated list referring to the different elements of the signal.

◆ m_adStopTimes

std::vector<double> CRamp::m_adStopTimes
protected

The time at which the ramp ends, of any sign, and not before StartTime. After it the output holds StopValue. This may either be a scalar, or a comma separated list referring to the different elements of the signal.

◆ m_adStopValues

std::vector<double> CRamp::m_adStopValues
protected

The stop value of the output port. This may either be a scalar, or a comma separated list referring to the different elements of the signal.


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