cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Data Model Implementation Guide Part 1

No ratings

Data Model Implementation Guide Part 1

 

Overview

 

This project will introduce you to methods for creating the data model that you have designed and are ready to implement. Following the steps in this guide, you will implement the Data Model you've already designed. After having insight into your desired Data Model, this guide will provide instructions and examples on how to build out your application using the ThingWorx platform.

We will teach you how to utilize the ThingWorx platform to implement your fully functional IoT application. NOTE: This guide’s content aligns with ThingWorx 9.3. The estimated time to complete ALL 3 parts of this guide is 60 minutes. All content is relevant but there are additional tools and design patterns you should be aware. Please go to this link for more details.

 

 

Step 1: Completed Example

 

Download the completed files for this tutorial:  DataModelEntities.xml.

The DataModelEntities.xml file provided to you contains a completed example of the completed data model implementation. Utilize this file to see a finished example and return to it as a reference if you become stuck during this guide and need some extra help or clarification. Keep in mind, this download uses the exact names for entities used in this tutorial. If you would like to import this example and also create entities on your own, change the names of the entities you create.

 

Step 2: Data Model Scenario

 

This guide will implement the scenario shown in the Data Model Design guide. Let's revisit our Smart Factory example scenario.

Name

Description

Operations

User to keep the line running and make sure that it’s producing quality products

Maintenance

User to keep machines up and running so that the operator can crank out products

Management

User in charge of dispatching production orders and making sure the quotas are being met

Conveyor Belts

Thing on factory line to pass items along to the next stage

Pneumatic Gate

Thing on factory line

Robotic Arm

Thing on factory line

Quality Check Camera

Final Thing on factory line to ensure quality

In order to add this to our solution, we will want to build a "connector" between ThingWorx and the existing system. These connectors will be Things as well.

  • Internal system connection Thing for Production Order System
  • Internal system connection Thing for Maintenance Request System

Operator

 

Required Functionality

Description

1

File Maintenance Request

2

Get quality data from assets on their line

3

Get performance data for the whole line

4

Get a prioritized list of production orders for their line

5

Create Maintenance Requests

 

Required Information

Description

1

Individual asset performance metrics

2

Full line performance metrics

3

Product quality readings

 

Maintenance

 

Required Functionality

Description

1

Get granular data values from all assets

2

Get a list of maintenance requests

3

Update maintenance requests

4

Set triggers for automatic maintenance request generation

5

Automatically create maintenance requests when triggers have been activated

 

Required Information

Description

1

Granular details for each asset: In order to better understand healthy asset behavior

2

Current alert status for each asset: to know if there is something going wrong with an asset

3

When the last maintenance was performed on an asset

4

When the next maintenance is scheduled for an asset

5

Maintenance request info: Creation date, due date, progress notes

 

Management

 

Required Functionality

Description

1

Create production orders

2

Update production orders

3

Cancel Production orders

4

Access line productivity data

5

Elevate maintenance request priority

 

Required Information

Description

1

Production line productivity levels (OEE)

2

List of open Maintenance requests

 

Overlapping Matrix

 

This matrix represents all of the overlapping Components that are shared by multiple types of Things in our system:

IoTProductMgmt_0-1659126704365.png

 

Unique Matrix

 

This matrix represents the unique Components to each type of Thing:

IoTProductMgmt_1-1659126704370.png

 

 

Step 3: LineAsset Thing Template

 

After prioritizing and grouping common functionality and information, we came up with the list below for the first Thing Template to create, LineAsset with five Properties, one Event, and one Subscription. The breakdown for the LineAsset Thing Template is as follows:

IoTProductMgmt_2-1659126704371.png

 

Follow the below instruction to create this Entity and get the implementation phase of your development cycle going.

 

Line Asset Properties

 

Let's build out our Properties.

  1. In the ThingWorx Composer, click the + New at the top of the screen.

    Line Asset Properties First Image.png

  2. Select Thing Template in the dropdown.
      Line Asset Properties Step 3 Step 2.png

3. In the name field, enter LineAsset and set the Project (ie, PTCDefaultProject).

4. For the Base Thing Template field, select GenericThing.

  Line Asset Properties Step 3 Step 5.png

 5. Click Save.

 6. Switch to the Properties and Alerts tab.

 7. Click the plus button to add a new Property.

 

The Properties for the LineAsset Thing Template are as follows:

Name

Base Type

Aspects

Data Change Type

State

String

Persistent and Logged

ALWAYS

SerialNumber

String

Persistent, Read Only, and Logged

NEVER

LastMaintenance

DATETIME

Persistent and Logged

VALUE

NextMaintenance

DATETIME

Persistent and Logged

VALUE

PowerConsumption

NUMBER, Min Value: 0

Persistent and Logged

ALWAYS

Follow the next steps for all the properties shown in our template property table.

  1. Click Add.
  2. Enter the name of the property (ie, State).
  3. Select the Base Type of the proprty from the dropdown.
  4. Check the checkboxes for the property Aspects.
  5. Select the Data Change Type from the dropdown.
    Table Step 3 Step 5.png

     

  6. Click Done when finished creating the property.

Your properties should match the below configurations.

Table Step 3 Last image.png

 

 

Line Asset Event

 

  1. Switch to the Events tab.
  2. Click Add.

    Line Asset Event Step 3 Step 2.png

  3. Enter the name of the Event (ie, Error).
  4. Select AlertStatus as the Data Shape. This DataShape will allow us to provide simple information including an alert type, the property name, and a status message.
    Line Asset Event Step 3 Step 4.png

     

  5. Click Done.

Your Event should match the below configurations.

      Line Asset Event Step 3 Step 5 (after).png

 

Line Asset Subscription

 

  1. Switch to the Subscriptions tab.
  2. Click Add.

    Line Asset Subscription Step 3 Step 2.png

  3. Check the Enabled checkbox.
  4. Switch to the Inputs tab. Select the name of the Event (ie, Error).

    Line Asset Subscription Step 3 Step 4.png

  5. Click Done.

Your Subscription should match the below configurations.

         Line Asset Subscription Step 3 Step 5 (after).png

 

Challenge Yourself

 

We have left the Subscription code empty. Think of a way to handle Error Events coming from your line asset and implement it in this section.

 

Click here to view Part 2 of this guide. 

Version history
Last update:
‎Sep 21, 2022 02:16 PM
Updated by:
Attachments
Contributors