• 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
    • CDP Linux
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Examples and Tutorials
  • Calculating MTBF with Metrics

Sending Telemetry to Ubidots Examples and Tutorials

Calculating MTBF with Metrics

Introduction

This example shows how to calculate mean time between failures (MTBF) using the MetricsManager system. The tracked run signal for counting hours tracks the RunSignal.Output from a Sine generator with Offset=1.0 and Amplitude=0.1, so the signal stays above the default metric threshold (0.5) all of the time even though it is not constant. A failure pulse rises once every 10 seconds and resets the counter. The MetricsManager is configured inside a dedicated Metrics component.

Project Overview

This example includes:

  • A Tracked run signal routed from RunSignal.Output (Sine, Offset=1.0, Amplitude=0.1). Tags: label=run, asset=pump
  • A Tracked failure signal routed from RunSignal.Failure (square wave, 0.1 Hz, Symmetry=1%). Tag: control=failure
  • A Metrics component (CDPComponent) that hosts the MetricsManager operator.
  • A RealtimeMetricDataSource for realtime values and two metrics: an hour counter and a statistics block.

Metrics Definition

The MTBF calculation is built in two steps:

  • MTBFBase uses MeasureType 3 (Hour Counter) on label=run, resets on control=failure and requires asset=pump.
  • MTBFStats uses MeasureType 5 (Statistics), measures the measures=SampledHours tag emitted by MTBFBase, and requires asset=pump, label=run. MTBFStats also sets the MeasureTag property to mtbf to no longer be measure to avoid circular references. This last step is critical for creting second order metrics that analyze other metrics' outputs.

The MTBFBase metric uses the BeforeReset logging flag so the SampledHours property is updated only on each failure pulse. MTBFStats then computes Mean, Min, Max and Std from those sampled intervals.

The routing is tag-based: application signals publish tags, and the metric definition sets tag values that Measure and Reset reference by name (label and control). The MetricDefinition also adds measure=SampledHours, allowing the statistics metric to target the MTBFBase output property.

Observing Results

After running the system, open Metrics.MetricsManager in CDP Studio and expand MetricNodes. The MTBFStats node will show a Mean value close to 0.00277 hours (~10 seconds).

Sending Telemetry to Ubidots Examples and Tutorials

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

Return to top