Skip to main content
1-Visitor
May 30, 2018
Question

How to model association pattern using Things

  • May 30, 2018
  • 1 reply
  • 3146 views

I want to implement the below structure in Thingworx.

Device

    - List<Axis> {A1, A2}

    - List<Rotor> {R1, R2, R3}

Axis

    - Position (Number)

    - Temperature (Number)

Rotor

    - Speed (Number)

There is an option to provide a ThingName as a property, however List is not supported.

 

Currently I have modeled the above structure using Infotables.

Device

    - AxisPosition Infotable  eg: {A1X - 26, A1Y - 67, A2X - 56, A2Y - 0}

    - AxisTemperature Infotable eg: {A1 - 156, A2 - 167}

    - RotorSpeed Infotable {R1 - 34, R2 - 45, R3 - 50}

Each infotable will have multiple rows of axis/rotor and position/temp/speed values. And the infotable properties are logged to a ValueStream.

 

However this structure cannot be mapped to a Time series chart, as the ValueStream timestamp is associated with the Device and the chart don't support infotable on any axis.

If List could have been supported, I could have retrieved all the axis/rotor Things of a particular device and then mapped individual properties to the time series chart

 

Can you please suggest how this structure can be alternatively modeled, so that it can be used in a TimeSeriesChart.

 

 

 

1 reply

22-Sapphire I
May 30, 2018

Looks like you are fairly well on your way.

to get the data to chart with your setup, you will need to use the DataChange and Subscription event/subscription to create a service to log the data into a regular stream.

Then of course create a service to pull it out to display properly.

A slightly longer way to do it is to model each as a Thing and relate them to each other in a Network. Which in this use case may not make as much sense.

Finally you could break all of the items out in separate properties and then you can leverage ValueStream

1-Visitor
May 30, 2018

Thanks Pai.

I will have a look on creating a custom service logic to extract the require data using the event and subscriptions. Do you have any code excerpts which depict how to log the data into a regular stream.

I am also interested in checking the Network solution. Do you have any references for the same.

22-Sapphire I
May 30, 2018

If you have access to our Fundamentals course on precision LMS there are examples there.

In the Snippets if you go to datatable/stream/blog/wiki there is an AddStreamEntry example

Networks you should be able to figure out fairly easily, comes with a ton of additional useful services as well.