How-To Guides
Analytics Guides

Use the Online and Offline Percentage KPI

6min

The Online and Offline Percentage KPI is a raw number indicating how long a sensor was functional and how long it was offline.

User Scenario

Review the following scenario for the online and offline KPI processor. Then, using an input processor, you will simulate PLC data and use this KPI to have more detailed knowledge of the time.

At a busy automotive manufacturing plant, the production line relies on a critical sensor to monitor engine performance. The maintenance team uses the online and offline percentage KPI to track the sensor's functionality. For instance, if the sensor was operational for 550 minutes but offline for 25 minutes during a specific shift, the team analyzes this data to optimize maintenance schedules and ensure continuous production efficiency.

Step 1: Add a Device

Follow the steps to Connect a Device and configure the following parameters:

  • Device Type: Simulator
  • Driver Name: Generator
  • Enable Alias Topics: Select the checkbox.

Step 2: Add Tags

After connecting the device, add the following tag. See Add Tags to learn more.

Tag 1: tag1

  • Name: Select S - Random value generator.
  • Value Type: Select float64.
  • Polling Interval: Enter 1.
  • Tag Name: Enter tag1.

Step 3: Create Analytics Flow

You can now create the analytics flows using data from the device and tag you previously created.

To create an analytics flow with the Online and Offline Processor functions:

  1. In Litmus Edge, navigate to Analytics.
  2. On the analytics canvas, click Add processor. The Create a processor dialog box displays.

    The Add processor option
    The Add processor option
    
  3. Select DataHub Subscribe.
  4. In the Topic field, click the Search icon, select the device you previously created, and then select the alias topic for tag1.

    Create a Processor dialog box
    Create a Processor dialog box
    
  5. Click Save.
  6. Click Add processor again and select the Online and Offline Percentage processor. The following information defines this function:
    • Unit: Time units for displaying online/offline status.
    • resetOnStatus: If you enable this parameter, the KPI will reset every time the status changes from ON or OFF.
    • Device Reset: Enable this parameter to reset everything when the device changes.
    • Time Interval: If the tag publishes at the expected interval, it is better to disable this timer by entering 0 in the field.
    • Click Save.

      Edit a Processor dialog box
      Edit a Processor dialog box
      
  7. Connect the DataHub Subscribe processor (tag: tag1) to the Online and Offline Percentage processor with a wire and use the events connection.
  8. On the analytics canvas, click Save.

The configured analytics flows should look like the following:

Completed Flows Canvas
Completed Flows Canvas


Step 4: View Output of Processor

Click the View icon in the Online and Offline Percentage processor to view the output values.

The output shows the offline and online durations along with the timestamp indicating when the device was last offline. It also provides the total time elapsed since the KPI was initiated.

Output of Online and Offline Percentage processor
Output of Online and Offline Percentage processor