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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

ThingWorx Solutions in Food Industry Part 1

100% helpful (1/1)

 

Learn how to create solutions the can help take you to the next level

 

 

Guide Concept

 

This project will introduce more complex aspects of the ThingWorx application and solution building.

 

Following the steps in this guide, you will develop your own IoT application or get a jump start in how to utilize ThingWorx for your needs.

 

We will teach you how to create a focused rules engine or service level logic to be used with the ThingWorx Platform.

 

 

You'll learn how to

 

  • Create automated processing, data, and endpoints that can handle that data without manual interaction
  • Use services, alerts, and subscriptions to increase performance
  • Begin making your data model and cornerstone entities to understand how a complex business logic is built

 

NOTE:  The estimated time to complete this guide is 60 minutes

 

 

Step 1: Completed Example

 

Download the attached FoodIndustry.zip and extract/import the contents. These are to be used as you work through this learning path. For the completed example, download the FoodIndustryComplete.zip. Unzip the download and import the Entities included.

 

In this tutorial we walk you through a real-world scenario for a food company looking to improve their processes. We manufacture the best sausages in town! We sell directly to people and through participating store locations. The focus will be to provide meaningful data for decision making, constant updates on food quality, logistics, transparency, and safety. See the below table for the list of mashups that we will create in this guide and included in the download.

 

 Name                           Description
Fizos.LandingPageThe main page that showcases highlights and possibly important information
Fizos.DeliveriesA look into product delivery and logistics
Fizos.AlertsDetails about any important actionable information
Fizos.Factory.UserA user to be used for our automated process

 

There is a large set of Entities provided in this download. The application created in this guide is a part of a final version of what we will create throughout this learning path. If you have not learned about Services, Events/Alerts, and Subscriptions, please take a walk through our Implementing Services, Events, and Subscriptions.

 

This guide will begin the base of our data model, create data for our factories, and show how we can create automated processes using that data. We will then expand on these items as we move forward in this learning path.

 

 

Step 2: Utilizing IoT in the Food Industry

 

Whenever creating a product in ThingWorx, you should evaluate whether to create them using the data model (Things, Thing Templates, Thing Shapes, etc) or create them using Data Tables and Data Shapes. You have to decide the method that works best for you. One way to think about this is whether to have a single ThingWorx entity to encapsulate your product data OR having so many products (especially when easily volatile), that you rather track it at a higher level.

 

In our scenario, we won't need to track sausages as the individual level, so we can track the machines creating, holding, and packaging them. This also allows for us to run analytics on the data and export the data into our favorite tools to further process the data.

 

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

      select_new.png

       

    2. Select Data Shape in the dropdown.

      create_new_datashape.png

 

 

3. In the name field, enter Fizos.DataShapes.Products. This data shape will form high level information about our differing products as a whole.

4. Set the Project (ie, PTCDefaultProject) and click Save to store all changes.

new_product_datashape.png

 

 

5. Click on the Field Definitions tab.

6. Click the + Add button and enter Name in the Name field of the new Field Definition. 

create_name_field.png

 

7. Setup your Field Definitions to match the below definitions:

 Name      Base Type       Aspects
IDIntegerPrimary Key. Default 0. Minimum 0.
NameStringN/A
StateStringN/A
SKUStringN/A
PriceNumberMinimum 0.
MassNumberDefault 0. Minimum 0.
VolumeNumberDefault 0. Minimum 0.

 

product_fields.png

 

We now have the data shape for products. We can go two different routes here as we create the data table for the products. We can make one data table for ALL company products or we can create a data table for each machine that houses these products. If you wanted the latter options, you could have the machine properties and services assocoated directly on the data table. This is a great option to condense the number of entities being used.

 

The level of granularity or simplicity is up to you. For this guide, we'll keep things simple and have one data table for all products. When we create the machine entities, we will have a table of the product IDs to help keep track of what products are contained in the machine.

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

    select_new.png

     

  2. Select Data Table in the dropdown and select Data Table in the prompt.

    create_new_datatable.png

     

  3. In the pop-up, select Data Table.

    select_datatable.png

     

  4. In the name field, enter Fizos.DataTables.Products. All of our product line will fit this abstract entity.

  5. For the Data Shape field, select Fizos.DataShapes.Products.

  6. Set the Project field with an existing Project (ie, PTCDefaultProject) and click Save to store all changes.

    create_name_field.png

     

We now have our setup complete for company products. Now let's create a DataShape for any Event involving this product template.

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

    select_new.png

     

  2. Select Data Shape in the dropdown.

    create_new_datashape.png

     

  3. In the name field, enter Fizos.ProductsEvent and in the Project field, select an existing Project (ie, PTCDefaultProject). All of our product line will use this DataShape as an alert/event.

  4. Click Save to store all changes, then click Edit. Performed the steps used earlier to create the below properties for the Fizos.ProductsEvent Data Shape:
 Name           Base Type        Aspects
StateStringN/A
SKUStringN/A
PriceNumberMinimum 0.
NameStringN/A

 

new_product_ds.png

 

Now let's create a Thing Template, Stream, and a ValueStream to track some of what is happening with our products at a high level. The ValueStream will automatically track our data. The Stream, we will add data in the latter sections.

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

      select_new.png

       

    2. Select Thing Template in the dropdown.

      create_new_thingtemplate.png

 

3. In the name field, enter Fizos.Products as the name and GenericThing as the Base Thing Template.

4. Select a Project (ie, PTCDefaultProject) and click Save to store all changes.

setup_products_template.png

 

 

 

Now, our new Stream.

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

      select_new.png

       

    2. Select Stream in the dropdown.

      create_new_stream.png

 

3. Select Stream in the pop-up.

select_stream.png

 

4. In the name field, enter Fizos.ProductsStream and set the Project field (ie, PTCDefaultProject).

5. In the Data Shape field, select Fizos.ProductsEvent.

setup_products_stream.png

 

6. Click Save to store all changes.

       

Now, the Value Stream.

 

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

      select_new.png

       

    2. Select Value Stream in the dropdown.

      create_new_valuestream.png

 

3. Select ValueStream in the pop-up.

select_valuestream.png

 

4. In the name field, enter Fizos.ProductsValueStream.

5. Set the Project field (ie, PTCDefaultProject) and click Save to store all changes.

products_value_stream.png

 

6. Open the Fizos.Products Thing Template and set the Fizos.ProductsValueStream as the Value Stream.

set_value_stream.png

 

We're all set with high level tracking of all of our products. At this point, we can start the creation of the entity that will help provide the business logic for all products.

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

      select_new.png

       

    2. Select Thing in the dropdown.

      create_new_thing.png

       

    3. In the name field, enter Fizos.ProductsBusinessLogic. All of our product line will fit this abstract entity.

    4. For the Base Thing Template field, select GenericThing and set the Project field to an existing Project (ie, PTCDefaultProject).

    5. Click Save to store all changes.

      new_product_logic.png

       

    6. Click on the Services tab.

    7. Click the + Add button and create the two Services below.
 Name                          InputReturn Type           Override Async  Desc
InspectFactoryInteger - factoryIDNothingYesYesStart an inspection for a specific factory
ReceiveInspectionJSON - report/ String - guidNothingYesYesLog/Store an inspection for a specific factory

 

At this point, you have the building blocks to begin your industry business logic and rules engine. In the next section, we'll do more development and further build out our model.

 

 


Click here to view Part 2 of this guide.

 

Version history
Last update:
‎Mar 07, 2023 03:01 PM
Updated by:
Labels (1)
Attachments
Contributors