MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
RampDriveCaller Class Reference

#include <drive_.h>

Inheritance diagram for RampDriveCaller:
Collaboration diagram for RampDriveCaller:

Public Member Functions

 RampDriveCaller (const DriveHandler *pDH, doublereal d1, doublereal d2, doublereal d3, doublereal d4)
 
 ~RampDriveCaller (void)
 
virtual DriveCallerpCopy (void) const
 
virtual std::ostream & Restart (std::ostream &out) const
 
doublereal dGet (const doublereal &dVar) const
 
virtual bool bIsDifferentiable (void) const
 
virtual doublereal dGetP (const doublereal &dVar) const
 
- Public Member Functions inherited from DriveCaller
 DriveCaller (const DriveHandler *pDH)
 
virtual ~DriveCaller (void)
 
virtual doublereal dGet (void) const
 
virtual doublereal dGetP (void) const
 
virtual void SetDrvHdl (const DriveHandler *pDH)
 
virtual const DriveHandlerpGetDrvHdl (void) const
 
virtual void Output (OutputHandler &OH) const
 
virtual void Trace (OutputHandler &OH) const
 
- Public Member Functions inherited from WithLabel
 WithLabel (unsigned int uL=0, const std::string &sN="")
 
virtual ~WithLabel (void)
 
void PutLabel (unsigned int uL)
 
void PutName (const std::string &sN)
 
unsigned int GetLabel (void) const
 
const std::string & GetName (void) const
 
- Public Member Functions inherited from ToBeOutput
 ToBeOutput (flag fOut=fDefaultOut)
 
virtual ~ToBeOutput (void)
 
virtual void OutputPrepare (OutputHandler &OH)
 
virtual void Output (OutputHandler &OH, const VectorHandler &X, const VectorHandler &XP) const
 
virtual flag fToBeOutput (void) const
 
virtual bool bToBeOutput (void) const
 
virtual void SetOutputFlag (flag f=flag(1))
 
- Public Member Functions inherited from Traceable
 Traceable (flag fTrace=0)
 
virtual ~Traceable (void)
 
virtual flag fToBeTraced (void) const
 
virtual void SetTraceFlag (flag f=TRACE)
 

Private Attributes

doublereal dSlope
 
doublereal dStartTime
 
doublereal dEndTime
 
doublereal dInitialValue
 

Additional Inherited Members

- Public Types inherited from DriveCaller
enum  OutputFlags { OUTPUT_VALUE = OUTPUT_PRIVATE << 0, OUTPUT_DERIVATIVE = OUTPUT_PRIVATE << 1 }
 
enum  TraceFlags { TRACE_VALUE = TRACE_PRIVATE << 0, TRACE_DERIVATIVE = TRACE_PRIVATE << 1 }
 
- Public Types inherited from ToBeOutput
enum  { OUTPUT = 0x1U, OUTPUT_MASK = 0xFU, OUTPUT_PRIVATE = 0x10U, OUTPUT_PRIVATE_MASK = ~OUTPUT_MASK }
 
- Public Types inherited from Traceable
enum  { TRACE = 0x01U, TRACE_PUBLIC_MASK = 0x0FU, TRACE_PRIVATE = 0x10U, TRACE_PRIVATE_MASK = ~TRACE_PUBLIC_MASK }
 
- Protected Attributes inherited from DriveCaller
DriveHandlerpDrvHdl
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 

Detailed Description

Definition at line 574 of file drive_.h.

Constructor & Destructor Documentation

RampDriveCaller::RampDriveCaller ( const DriveHandler pDH,
doublereal  d1,
doublereal  d2,
doublereal  d3,
doublereal  d4 
)

Definition at line 466 of file drive_.cc.

References NO_OP.

Referenced by pCopy().

468 : DriveCaller(pDH), dSlope(d1), dStartTime(d2), dEndTime(d3), dInitialValue(d4)
469 {
470  NO_OP;
471 }
doublereal dInitialValue
Definition: drive_.h:579
#define NO_OP
Definition: myassert.h:74
doublereal dStartTime
Definition: drive_.h:577
DriveCaller(const DriveHandler *pDH)
Definition: drive.cc:475
doublereal dEndTime
Definition: drive_.h:578
doublereal dSlope
Definition: drive_.h:576
RampDriveCaller::~RampDriveCaller ( void  )

Definition at line 473 of file drive_.cc.

References NO_OP.

474 {
475  NO_OP;
476 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

bool RampDriveCaller::bIsDifferentiable ( void  ) const
inlinevirtual

Reimplemented from DriveCaller.

Definition at line 628 of file drive_.h.

629 {
630  return true;
631 }
doublereal RampDriveCaller::dGet ( const doublereal dVar) const
inlinevirtual

Implements DriveCaller.

Definition at line 606 of file drive_.h.

References dEndTime, dInitialValue, dSlope, and dStartTime.

607 {
608  doublereal dVal;
609 
610  dVal = dInitialValue;
611  if (dVar > dStartTime) {
612  doublereal dEnd;
613 
614  if (dVar > dEndTime) {
615  dEnd = dEndTime;
616 
617  } else {
618  dEnd = dVar;
619  }
620 
621  dVal += dSlope*(dEnd - dStartTime);
622  }
623 
624  return dVal;
625 }
doublereal dInitialValue
Definition: drive_.h:579
doublereal dStartTime
Definition: drive_.h:577
doublereal dEndTime
Definition: drive_.h:578
doublereal dSlope
Definition: drive_.h:576
double doublereal
Definition: colamd.c:52
doublereal RampDriveCaller::dGetP ( const doublereal dVar) const
inlinevirtual

Reimplemented from DriveCaller.

Definition at line 634 of file drive_.h.

References dEndTime, dSlope, and dStartTime.

635 {
636  if (dVar < dStartTime || dVar > dEndTime) {
637  return 0.;
638  }
639 
640  if (dVar == dStartTime || dVar == dEndTime) {
641  return dSlope/2.;
642  }
643 
644  return dSlope;
645 }
doublereal dStartTime
Definition: drive_.h:577
doublereal dEndTime
Definition: drive_.h:578
doublereal dSlope
Definition: drive_.h:576
DriveCaller * RampDriveCaller::pCopy ( void  ) const
virtual

Implements DriveCaller.

Definition at line 480 of file drive_.cc.

References dEndTime, dInitialValue, dSlope, dStartTime, DriveCaller::pDrvHdl, RampDriveCaller(), and SAFENEWWITHCONSTRUCTOR.

481 {
482  DriveCaller* pDC = 0;
486  return pDC;
487 }
doublereal dInitialValue
Definition: drive_.h:579
doublereal dStartTime
Definition: drive_.h:577
RampDriveCaller(const DriveHandler *pDH, doublereal d1, doublereal d2, doublereal d3, doublereal d4)
Definition: drive_.cc:466
doublereal dEndTime
Definition: drive_.h:578
doublereal dSlope
Definition: drive_.h:576
DriveHandler * pDrvHdl
Definition: drive.h:444
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698

Here is the call graph for this function:

std::ostream & RampDriveCaller::Restart ( std::ostream &  out) const
virtual

Implements DriveCaller.

Definition at line 491 of file drive_.cc.

References dEndTime, dInitialValue, dSlope, and dStartTime.

492 {
493  return out
494  << "ramp, " << dSlope
495  << ", " << dStartTime
496  << ", " << dEndTime
497  << ", " << dInitialValue;
498 }
doublereal dInitialValue
Definition: drive_.h:579
doublereal dStartTime
Definition: drive_.h:577
doublereal dEndTime
Definition: drive_.h:578
doublereal dSlope
Definition: drive_.h:576

Member Data Documentation

doublereal RampDriveCaller::dEndTime
private

Definition at line 578 of file drive_.h.

Referenced by dGet(), dGetP(), pCopy(), and Restart().

doublereal RampDriveCaller::dInitialValue
private

Definition at line 579 of file drive_.h.

Referenced by dGet(), pCopy(), and Restart().

doublereal RampDriveCaller::dSlope
private

Definition at line 576 of file drive_.h.

Referenced by dGet(), dGetP(), pCopy(), and Restart().

doublereal RampDriveCaller::dStartTime
private

Definition at line 577 of file drive_.h.

Referenced by dGet(), dGetP(), pCopy(), and Restart().


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