What is a “Thing” in Thingworx Composer?

thingworx-ptc-logo

What is  a “Thing”?

A Thing is defined by Thingworx as a representation of a business process in terms of properties and business logic. For example, a locomotive would be represented not in terms of static information such as dimensions, color and weight but in terms of dynamic business-relevant such as its current location, pulling capacity and maintenance status.

What Makes Things Interesting?

Things are only interesting if they have characteristics that interest us. To extend the locomotive analogy, a train that is running on time and about to reach my station is probably more interesting than one still an hour away. It is even more interesting if it is going to my destination. These characteristics are called Properties in Thingworx.

How Do Things Talk?

A train is famous for blowing it’s horn or whistle. The interest level of a train whistle’s can vary by distance or whether you are waiting for a train or standing on the tracks. But there is no indication in a whistle that indicates which train the whistle comes from or necessarily why it was blown. Things address these limitations by providing a rich system of events, alerts and subscriptions.

Events: When Things Happen To Things

A Thing Property can have an Event defined. This is a business rule where an action can be taken when a property changes in a certain way. Such as a train that is more than 5 minutes behind schedule.

Alerts: We Care When Certain Things Happens

Events can trigger a message to the next station which could display an updated arrival time on a schedule display. They can also be used (along with additional rules and location data) to calculate what speed increase is required to catch up before arriving at the next station and supress sending a late arrival message.

Subscriptions: Only Some of Us Care

Telling a system what alerts are wanted ensures that only information of interest is sent. Instead of standing by the train arrival display, commuters use an app to subscribe to updated arrival times so they can sit in the coffee shop and wait for a jingle when they have a couple minutes left to board. This requires subscribing to alerts for your train at your planned departure time.

When to use:

  • Where a specific representation of an instance of an asset that combines properties, processes and business logic is needed.
  • Things are also often used to provide a single instance of internal application services, such as a utility function holder.

A Thing Example

Thingworx Thing Icon

A Thing is represented by this default icon in the Composer Editor Home Menu. The most basic Thing is one based on GenericThing. This is as basic a Thing as you can define. It inherits the properties and services that are required for any Thing, much like an interface would define required properties and methods of a Class.

thingDetails4

Extending a Thing

Things are only useful when you define specific properties, services, alerts and alarms on them. You can do this using built-in capabilities inherited from the Generic Thing.

To clearly illustrate how the these features interact to provide functionality I will show how to exercise all aspects of a Thing using only custom features:

  • Create a Thing Property
  • Create a Thing Service
  • Create a Service Event
  • Create a Thing Subscription
  • Integrate a Thing into a Mashup

Custom Property

To add a custom property to a Thing, create a new Thing that inherits Generic Thing. Click the Properties link from the Left menu. Refer to the screen shot below. We will add a boolean property because it is a simple switch.

Thing Custom Property

Thing Custom Property

Thing Service

A Service is an implementation of a rule in a Thing that can manipulate data. Rules are written in Javascript by default. See the screenshot for how to program a service that switches an input boolean value to the opposite of its current value. The data can come from a Thing property.

Thing Service

Thing Service

Subscriptions

Subscriptions are used to respond to particular events. In this example I subscribe to an data change event on my Thing when the property value is flipped to false.

Thing Subscription

Thing Subscription

Using a Thing in a Mashup

There isn’t a “Thing Widget” that can be dragged onto a layout in Thingworx Composer. Specific aspects of a Thing can be added to a Mashup via a combination of widgets and data services. This can add up to a selective rendition of the aspects of a thing that focuses on the aspects of it that are important for a particular viewer.

How Thing Appears in Mashup

How Thing Appears in Mashup

Wiring Mashup Events

Wiring Mashup Events

Using data to set Widget

Using data to set Widget

Setting Alerts

Alerts can be added to each property of a Thing. They can be set to fire when a condition is met. In this case, when macProperty is false.

Add Alerts to Properties

Add Alerts to Properties

Alerts Manager

Alerts Manager

Viewing Alerts

Alerts can be subscribed to in order to set other properties, send emails, SMS, and other communications. The following screens show the event Monitor tab recording the alerts fired when macProperty was set to false by clicking the checkbox in the Mashup.

An Alert Displayed in the Alert Monitor

An Alert Displayed in the Alert Monitor

An Unacknowledged Alert

An Unacknowledged Alert

No Acknowledged Alert Yet

No Acknowledged Alert Yet

alertsTabAcknowledge

Acknowledge The Alert

Alert Acknowledgement Confirmed

Alert Acknowledgement Confirmed

Acknowledged Alert

Acknowledged Alert

New Alert

A New Alert

Alert History

Alert History

You may also like...

2 Responses

  1. vybhav says:

    what is difference between thing , thingshape, thing template

    • David J McClelland says:

      Thing Template: A Thing Definition (properties, services) that can be reused with additional details per Thing. Example: Define all common properties of a connected device in Thing Template, and put Serial Number property in each Thing based on the template. A Thing is always an instance of a Thing Template: Generic Thing Template is the default.

      Thing Shape: An entity that contains a description of the properties and methods (services) to be used by / provided by a Thing. Similar to an abstract class.

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha loading...

This site uses Akismet to reduce spam. Learn how your comment data is processed.