• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Product
    • Design UI
    • Develop
    • Analyze and test
    • Deploy
    • Framework and toolbox
    • Compatibility
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - CDP Core
  • CDPRampTimer
  • 4.12.9

CDPRampTimer Class

The CDPRampTimer is used to get a scaled time-value between 0 and 1 (double value). More...

Header: #include <OSAPI/Timer/Timer.h>
Inherits: CDP::StudioAPI::CDPNode
  • List of all members, including inherited members

Public Functions

CDPRampTimer()
virtual void Create(const char *shortName, CDPBaseObject *pParent)
double Delay()
virtual void Destroy()
double GetScaledRamp()
bool IsRunning()
void Reset(double delay)
void Reset()
void Restart()
void Set()
virtual void Start()
bool TimedOut()

Reimplemented Public Functions

virtual void FillNodeChildren(CDP::StudioAPI::NodeStream &stream) const override
virtual const std::string GetNodeName() const override
virtual std::string GetNodeTypeName() const override
  • 26 public functions inherited from CDP::StudioAPI::CDPNode
  • 22 public functions inherited from CDP::StudioAPI::ICDPNode

Protected Variables

CDPSetting<std::string> m_model
CDPSetting<bool> m_running
CDPSetting<double> m_scaledValue
CDPSetting<double> m_startTime
CDPSetting<double> m_timeElapsed
CDPSetting<bool> m_timedout
CDPSetting<double> m_timeoutDelay

Additional Inherited Members

  • 1 protected function inherited from CDP::StudioAPI::CDPNode

Detailed Description

The CDPRampTimer is used to get a scaled time-value between 0 and 1 (double value).

This timer is good for scaling another value based on a time-value.

If the timer is used in a CDPComponent based class, the timer and it's values may show up in CDP Studio under the component's Timers section if Create() is called. In component's Create(), call myTimer.Create("MyTimer",this), and in component's Destroy(), call myTimer.Destroy().

Note: GetScaledRamp() will never return a value larger than 1.0 no matter how long time has passed.

Usage

  • Add a CDPRampTimer member in your class.
  • Init using Reset(double delay).
  • Call Start()(or Restart()) to start the timer.
  • Call GetScaledRamp() to get a value of type double (0.0<=value<=1.0).

See also CDPTimer, CDPParameterTimer, CDPTimerMs, CDPParameterTimerMs, OSAPIPeriodicTimer, OSAPIOneShotTimer, and CDPTimerCounting.

Member Function Documentation

CDPRampTimer::CDPRampTimer()

Constructs a timer.

[virtual] void CDPRampTimer::Create(const char *shortName, CDPBaseObject *pParent)

Stores shortName, calls parent's RegisterCDPNode() and sets up callback when m_timeoutDelay changes.

double CDPRampTimer::Delay()

Gets the delay in seconds set by Reset(double delay)

[virtual] void CDPRampTimer::Destroy()

Calls parent's UnRegisterCDPNode().

[override virtual] void CDPRampTimer::FillNodeChildren(CDP::StudioAPI::NodeStream &stream) const

Reimplemented from CDPNode::FillNodeChildren().

Writes its CDPSettings to stream.

[override virtual] const std::string CDPRampTimer::GetNodeName() const

Reimplemented from ICDPNode::GetNodeName().

Returns m_timerName

[override virtual] std::string CDPRampTimer::GetNodeTypeName() const

Reimplemented from ICDPNode::GetNodeTypeName().

Returns "CDPRampTimer"

double CDPRampTimer::GetScaledRamp()

Returns a number >= 0.0 and <=1.0 depending on current time and value set in Reset(double delay).

Returns time scaled >= 0.0 and <=1.0

bool CDPRampTimer::IsRunning()

Returns true if timer is running.

void CDPRampTimer::Reset(double delay)

Resets and sets delay timeout in seconds. This corresponds to number of seconds that should be scaled between 0.0 and 1.0.

void CDPRampTimer::Reset()

Resets the timeout timer flag and stop the timer (m_timedout and m_running are set to false).

void CDPRampTimer::Restart()

Resets and starts the timer.

Call this method after GetScaledRamp() returns 1.0 (or TimedOut() returns true), to enable next timeout checking. Equals calling Reset() and Start().

void CDPRampTimer::Set()

Sets m_timedout to true.

[virtual] void CDPRampTimer::Start()

Starts timer.

bool CDPRampTimer::TimedOut()

Returns true if timer is timed out, as calculated in GetScaledRamp().

Member Variable Documentation

CDPSetting<std::string> CDPRampTimer::m_model

This variable holds timer object's modelname ('CDPRampTimer').

CDPSetting<bool> CDPRampTimer::m_running

This variable holds set to true when timer is running.

CDPSetting<double> CDPRampTimer::m_scaledValue

This variable holds scaled time-value between 0 and 1. Updated when GetScaledRamp() is called.

CDPSetting<double> CDPRampTimer::m_startTime

This variable holds value of CDPTimer::Time() when Start()/Restart() is called [s].

CDPSetting<double> CDPRampTimer::m_timeElapsed

This variable holds time elapsed [s] since Start()/Restart(), as calculated by GetScaledRamp() function.

CDPSetting<bool> CDPRampTimer::m_timedout

This variable holds set to true when timer has timed out, when calling GetScaledRamp().

CDPSetting<double> CDPRampTimer::m_timeoutDelay

This variable holds number of seconds untill GetScaledRamp() will return 1.0, set in Reset(double delay).

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2024 CDP Technologies. Privacy and cookie policy.

Return to top