• 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
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - Automation
  • ScalingOperator
  • 5.0.0

ScalingOperator Class

(Automation::ScalingOperator)

A ScalingOperator scales input value to output value using interpolation between scaling points. This allows CDP Components to work with known/engineering values (and not values tied to a particular hardware) and helps to decouple the system. More...

Header: #include <ScalingOperator>
Inherits: CDPOperator<T>
  • List of all members, including inherited members

Public Functions

ScalingOperator(const CDPPropertyBase &in)
virtual ~ScalingOperator()

Reimplemented Public Functions

virtual void Configure(XMLPrimitive *pScalingOperatorXML) override
virtual void Create(const char *shortName, CDPBaseObject *pParent) override
virtual void Destroy() override
virtual void FillNodeChildren(CDP::StudioAPI::NodeStream &stream) const
virtual unsigned int Process() override
  • 18 public functions inherited from CDPOperator
  • 17 public functions inherited from CDPOperatorBase
  • 49 public functions inherited from CDPBaseObject
  • 27 public functions inherited from CDP::StudioAPI::CDPNode
  • 22 public functions inherited from CDP::StudioAPI::ICDPNode

Reimplemented Protected Functions

virtual bool AddChild(const std::string &name, const std::string &typeName, const std::string &configuration) override
virtual bool RemoveChild(const std::string &name) override
  • 1 protected function inherited from CDP::StudioAPI::CDPNode

Additional Inherited Members

  • 1 public variable inherited from CDPOperatorBase
  • 1 static public member inherited from CDPBaseObject
  • 1 protected function inherited from CDP::StudioAPI::CDPNode
  • 8 protected variables inherited from CDPOperator
  • 5 protected variables inherited from CDPOperatorBase
  • 10 protected variables inherited from CDPBaseObject

Detailed Description

A ScalingOperator scales input value to output value using interpolation between scaling points. This allows CDP Components to work with known/engineering values (and not values tied to a particular hardware) and helps to decouple the system.

Internally, the scaling points are sorted by InValue, lowest first. Whenever a scaling point is updated, the scaling points are re-sorted and the slopes between them are recalculated. It is possible to have as many scaling points as memory allows.

Properties

Property NameDescription
InterpolationInterpolation method to use.
InverseWhen set to true, then ScalingPoint InValues and OutValues would be treated in inverse. Useful to set after copy-pasting existing ScalingOperator configuration with need to make the copy to scale in reverse compared to the original.

Available Interpolation Methods

Interpolation methodMinimum number of ScalingPoints neededDescription
Linear2Linear interpolation (default method)
Makima4Modified Akima interpolation. This method interpolates between ScalingPoints via cubic Hermite polynomials whose slopes are chosen by a modification of a geometric construction proposed by Hiroshi Akima. The modification was proposed by Cosmin Ionita.
PCHIP4Piecewise Cubic Hermite Interpolating Polynomial. This method interpolates between ScalingPoints via cubic Hermite polynomials whose slopes are chosen so that the resulting interpolant is monotonic. Proposed by Fritsch and Carlson.
BaryRatio34Barycentric Rational interpolation with approximation order = 3. This is a high-accuracy interpolation method proposed by Floater and Hormann. This method generates very stable interpolation, unless some ScalingPoints are very close to eachother, and some ScalingPoints are very far.
BaryRatio56Barycentric Rational interpolation with approximation order = 5. This is a high-accuracy interpolation method proposed by Floater and Hormann. This method generates very stable interpolation, unless some ScalingPoints are very close to eachother, and some ScalingPoints are very far.

Extrapolation

When input value is out of the range of configured ScalingPoints output value is calculated as follows:

Interpolation methodHow out-of-range input value is scaled
Linear, BaryRatio3 and BaryRatio5Output value is calulated using extrapolation (estimate) based on the nearest ScalingPoints.
Makima, PCHIPValue corresponding to the nearest ScalingPoint is outputted. No extrapolation is done.

Note: Having fewer scalingpoints than required by the interpolation method will cause the operator to just bypass all values (no scaling).

Note: As the ScalingOperator uses CPU computing power to do complex scalings, keep ScalingPoint number low and interpolation method on Linear if your system CPU power is very limited.

Example

To eliminate the deadband area of a valve output signal, the following scaling points could be set up:

Input Value (CDP side)Output Value (Valve side)Description
-1-32768Maximum value 'when opening to the left'
-0.00001-1040The value -0.00001 causes a slight flow. (The valve does not give flow between values -1030 and 1100)
00We don't want flow when signal is 0
0.000011100The value 0.00001 causes a slight flow. (The valve does not give flow between values -1030 and 1100)
132767Maximum value 'when opening to the right'

Different Interpolation Methods Example

Below is an example plot of the outputs of ScalingOperators with different interpolation methods with following ScalingPoints, assuming that constantly increasing ramp signal from -1 to 1 is in their input:

Input ValueOutput Value
-1-200
-0.85-100
-0.15-10
00
0.1510
0.85100
1200

See also ScalingPoint.

Member Function Documentation

ScalingOperator::ScalingOperator(const CDPPropertyBase &in)

Constructs a ScalingOperator with input in.

[virtual] ScalingOperator::~ScalingOperator()

Destructs the ScalingOperator

[override virtual protected] bool ScalingOperator::AddChild(const std::string &name, const std::string &typeName, const std::string &configuration)

[override virtual] void ScalingOperator::Configure(XMLPrimitive *pScalingOperatorXML)

Reimplemented from CDPBaseObject::Configure().

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

Reimplemented from CDPBaseObject::Create().

[override virtual] void ScalingOperator::Destroy()

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

Reimplemented from CDPNode::FillNodeChildren().

[override virtual] unsigned int ScalingOperator::Process()

Reimplemented from CDPOperatorBase::Process().

Returns STATUS_OK.

[override virtual protected] bool ScalingOperator::RemoveChild(const std::string &name)

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 2025 CDP Technologies. Privacy and cookie policy.

Return to top