Simulating data using the device simulator

In this tutorial, you are simulating data for a device type using the device simulator in the IBM Watson™ IoT Platform service. Later, you create summary and device dashboards to monitor this data.

About this task

In this tutorial, you are creating a sample robot device type and corresponding robot devices by using the Platform Service device simulator. Your simulated device type is available as a device type in Analytics Service. You define a KPI and use a built-in function to calculate the KPI.

Complete these steps to create sample data using the device simulator.

Step 1: Create five simulated robot devices

  1. Log in to the IBM Maximo Asset Monitor user interface for your TenantId.
  2. From the side menu, select Connect.
  3. From the Connect tile, click Connect.
    The Platform Service dashboard opens on the Browse Tab of the Devices page.
  4. From the Platform Service dashboard, click the 0 Simulations running message.
    Tip: If the device simulator is not available, enable device simulation for your user ID.
    1. Log in to Platform Service.
    2. From the main navigation pane, select Settings.
    3. In the Data and Devices section, activate the device simulator.
  5. In the Simulations configuration window that opens, click Create Simulation.
  6. Create a Sample_Robot_Type device type.
  7. Set the event payload to:
     {
        "load": random(371.0,379.5),
        "torque": random(8.5,16.0),
        "speed": random(-0.3,6.7),
        "acc": random(-3.2,5.0),
        "travel_time": random(-3.9,4.6)
     }
    
    Note.
  8. Enable Save events as historical data to make your simulated device state available through an automatically created logical interface and to store the device data in the data lake.
  9. Click Save to create the device type.
  10. In the Simulations window, click 1x and select 5.
  11. Click Create Simulated Devices to create five devices and start sending data.
    Note: The simulated device names derive directly from the device type. For example, the first device that you create is Sample_Robot_Type_1
  12. Verify that the number of events that are sent is increasing.
  13. Verify that device events are sent.
    1. Select the Browse tab.
    2. Enter the name of your device type in the search field.
    3. Choose one of your devices.
    4. Open the State tab.
    5. Select Raw Data as the interface option.
      The simulated values are displayed. The device simulator runs while your Platform Service dashboard session is active. The device simulator does not send data if you are logged out from your session.

Step 2: Explore device metrics for your robots

Verify that a corresponding device type and entities are created in Analytics Service.

  1. Go back to the main IBM Maximo Asset Monitor user interface.
  2. On the side navigation, click Monitor.
  3. On the Device types tab, find your device type.
    The device type name is the same as the device type name that you configured in the simulator.
  4. Select the Data tab and verify that you can see data for the entities.
    The data lake contains historical data and is populated as your devices contribute data. A time lag occurs between when you connect a device for the first time and when the data starts appearing.

Step 3: Create device type KPIs

  1. On the side menu, click Monitor.
  2. On the Device types tab, click your device type and then select the Data tab.
  3. Click Create new.
  4. Click Configure.
  5. Select the PythonExpression function.
  6. Enter the following Pandas expression:
    df["event_1_torque"]*df["event_1_load"]
  7. Click Next.
  8. Give the output metric the name: work_performed
  9. Click Create. Wait a couple of minutes for the scheduled calculations to run and then return to the Data tab and look at your new calculated metric.

Step 4: Add an alert

Add an alert to your device type.

  1. On the side menu, click Monitor.
  2. On the Device types tab, select your device type, and click View.
  3. On the Data tab, click Create new to open the catalog of functions.
  4. Select the AlertHighValue function.
  5. Select work_performed in the input_item drop-down list.
  6. In the upper_threshold field, enter 1000.
  7. In the Severity field, select Medium.
  8. Click Next.
  9. Assign the name work_performed_too_high to the alert.
  10. Click Create.
  11. Wait up to 5 minutes for the pipeline to generate data.

Next steps

You can now add dimensions for your device type.