IoT & Connectivity Tips | ThingWorx & Kepware PTC
Recently active
Guide ConceptStep 1: Learning Path OverviewStep 2: Create GatewayStep 3: Connect to FoundationStep 4: Bind Industrial TagStep 5: TroubleshootingStep 6: Next Steps Learn how to connect ThingWorx Kepware Server to Foundation. Guide Concept This guide will teach you how to create a backend Data Model in ThingWorx Foundation that works with ThingWorx Kepware Server to collect data from an Allen-Bradley PLC and send it to ThingWorx Foundation. You'll learn how to Create a Data Model in ThingWorx Foundation that accepts information from ThingWorx Kepware Server NOTE: The estimated time to complete this guide is 30 minutes Step 1: Learning Path Overview Assuming you are using this guide as part of the Rockwell Automation Learning Path, then you have now completed each of the following installations: Connected Components WorkbenchThingWorx Kepware ServerThingWorx Foundation (for Windows) You’ve also connected an Allen-Bradley
GUIDE CONCEPTStep 1: Connection Process Keys to utilizing the C and Java SDK for ThingWorx application development GUIDE CONCEPT This project will introduce to coding examples utilized for SDKs to be used with Java and C. You can also use the Java SDK for Android development. Following the steps in this guide, you will be better prepared to creating your own application using one of our SDKs. We will teach you how to handle Properties, Entities, data, make Service calls and creating Remote Services. YOU'LL LEARN HOW TO How to create, update, and retrieve Property values Utilize Data Shapes for handling data and triggering Events Construct Info Tables for Services and retrieving data after Service calls Add key features of an edge/remote application NOTE: The estimated time to complete this guide is 30 minutes. Step 1: Connection Process he ThingWorx SDKs follows a three-step process
Step 2: Java Properties Step 2: Java Properties In the ThingWorx environment, a Property represents a data point, which has a: Name Value Timestamp Quality (optional) Define Properties You can define attributes, base types and other aspects of ThingWorx properties. Attributes The table below provides information on the different attributes that are used to define a property. Attribute Details name Specifies the name of the property that will appear in ThingWorx when users browse to bind the related Thing. description Provides additional information for the property. baseType Specifies the type of the property. For a list of base types supported by the SDK, refer to the BaseTypes chart below. BaseTypes The table below provides information on the different types of properties that can be created in ThingWorx. BaseType Primitive Description BOOLEAN BooleanPrimitive True or false
Step 2: Java Properties (cont.)Step 3: Java - Data ShapesStep 4: Java - Info Tables Step 2: Java Properties (cont.) Annotation @ThingworxPropertyDefinitions(properties = { @ThingworxPropertyDefinition(name = "Temperature", description = "Current Temperature", baseType = "NUMBER", category = "Status", aspects = { "isReadOnly:true" }), @ThingworxPropertyDefinition(name = "Pressure", description = "Current Pressure", baseType = "NUMBER", category = "Status", aspects = { "isReadOnly:true" }), @ThingworxPropertyDefinition(name = "FaultStatus", description = "Fault status", baseType = "BOOLEAN", category = "Faults", aspects = { "isReadOnly:true" }), @ThingworxPropertyDefinition(name = "InletValve", description = "Inlet valve state", baseType = "BOOLEAN", category = "Status", aspects = { "isReadOnly:true" }), @ThingworxPropertyDefinition(name = "TemperatureLimit", description = "Temperature fault limit", baseType = "NUMBER", category = "Faults", aspects = { "
Step 5: Java - EventsStep 6: Java - Services Step 5: Java - Events While connected to the server, you can trigger an event on a remote Thing. The code snippet from the Simple Thing example below shows how to use a ValueCollection to specify the payload of an event, and then trigger a FileEvent on a remote Thing. Create Event The two implementations of the VirtualThing.defineEvent method are used to create an event definition ThingWorx Platform.@ThingworxEventDefinitions(events = { @ThingworxEventDefinition(name = "SteamSensorFault", description = "Steam sensor fault", dataShape = "SteamSensor.Fault", category = "Faults", isInvocable = true, isPropertyEvent = false) })public void defineEvent(String name, String description, String dataShape, AspectCollection aspects) { EventDefinition eventDefinition = new EventDefinition(name, description); eventDefinition.setDataShapeName(dataShape); if (aspects != null) { eventDefinition.setAspects(aspect
Step 7: C - Entities and Functions Step 7: C - Entities and Functions All SDKs require a RemoteThing be created in ThingWorx in order to communicate. If many Things are to be created with the same properties, services, and events, we recommend that a Thing Template be derived from one of the supplied RemoteThing templates. NOTE: The macros are all defined in the twMacros.h header file. Define ThingShape ThingShapes are used in the ThingWorx object-oriented Data Model and used to create Things later on. In order to create a ThingShape, you can do so with the provided macros. In order to define a ThingShapes using a macro, you will use TW_DECLARE_SHAPE or TW_SHAPE.TW_DECLARE_SHAPE("SteamLocation","Address Shape","UniqueNameSpace"); Define ThingTemplate ThingTemplates are used in the ThingWorx object oriented Data Model and used to create Things later on. In order to create a ThingTemplate, you can do so with the
Step 8: C - Properties Step 8: C - Properties In the ThingWorx environment, a Property represents a data point, which has a: NameValueTimestampQuality (optional) Define Properties You can define attributes, base types and other aspects of ThingWorx properties. Attributes The table below provides information on the different attributes that are used to define a property. Attribute DetailsnameSpecifies the name of the property that will appear in ThingWorx when users browse to bind the related Thing.descriptionProvides additional information for the property.baseTypeSpecifies the type of the property. For a list of base types supported by the SDK, refer to the BaseTypes chart below. BaseTypes The table below provides information on the different types of properties that can be created in ThingWorx. BaseType DescriptionTW_NOTHINGAn empty value.TW_STRINGA modified UTF8 encoded string. Data and length are stored
Step 8: C - Properties (cont.)Step 9: C - Data Shapes Step 8: C - Properties (cont.) Register Properties Registering properties and services with the API: Tells the API what callback function to invoke when a request for that property or service comes in from ThingWorx.Gives the API information about the property or service so that when ThingWorx browses the Edge device, it can be informed about the availability and the definition of that property or service.If you used the TW_PROPERTY macro, your property has been registered. If using function calls, to register a property, use the twApi_RegisterProperty. The documentation for this function can be found in [C SDK HOME DIR]/src/api/twApi.h. NOTE: If you used the provided Macros to create your property, it has already been registered. Bind the Thing in order for your property to be bound. An example of registering a property is as follows: twApi_RegisterProperty(TW_THING, “SimpleThi
Step 10: C - Info TablesStep 11: C - EventsStep 12: C - Services Step 10: C - Info Tables Infotables are used for storing and retrieving data from service calls. An infotable has a DataShapeDefinition that describes the names, base types, and additional information about each field within the table. In order to create an Infotable, you can do so with the provided macros or functions. Define With Macros In order to define Infotables using a macro, use TW_MAKE_INFOTABLE or TW_MAKE_IT. Both macros can be used interchangeably. NOTE: The macros are all defined in the twMacros.h header file.twInfoTable* it; it = TW_MAKE_IT( TW_MAKE_DATASHAPE(DATSHAPE_NAME_SENSOR_READINGS, TW_DS_ENTRY("ActivationTime", TW_NO_DESCRIPTION ,TW_DATETIME), TW_DS_ENTRY("SensorName", TW_NO_DESCRIPTION ,TW_NUMBER), TW_DS_ENTRY("Temperature", TW_NO_DESCRIPTION ,TW_NUMBER), TW_DS_ENTRY("Pressure", TW_NO_DESCRIPTION ,TW_NUMBER), TW_DS_ENTRY("FaultStatus", TW_NO_DE
Step 13: C - Support Other PlatformsStep 14: Next Steps Step 13: C - Support Other Platforms If you are using a platform that is different than the options provided in the CMake configurations or in the C SDK configurations, you can add your own computer type. CMake has its own custom toolchain support that enables you to add your computer to the CMake configurations. Go to the CMake Toolchain.NOTE: The C SDK provides a CMakeList.txt file that contains the setup instructions for the C SDK. Make changes only if you have verified the configurations and compiler information.Create a CMakeList.txt file based on your OS inside the folder in which you would like to setup your application.Modify the Platform Configuration section of the CMakeList.txt file to add your personal computer architecture if it is not already listed.Ensure your configurations are in your application's CMakeList.txt file. An example of the Pla
Guide ConceptStep 1: VideoStep 2: Next Steps Explore the ThingWorx Foundation IoT application-building platform in a convenient video format. Guide Concept This project will introduce you to the principles of ThingWorx Foundation by creating a working web application, guided by a convenient video. Following the steps in this guide, you will create the building blocks of your first application for the Internet of Things (IoT). You will use ThingWorx Composer to create Thing Templates, which are then used to create Things that model the application domain. A simulator is imported to generate time-series data that is saved to a Value Stream. After modeling the application in ThingWorx Composer, you'll use Mashup Builder to create the web application Graphical User Interface (GUI). You'll learn how to Create a Thing Shape, Thing Template, and ThingStore data in a Value StreamDownload and install a data simulatorCreate an application UI NO
Guide ConceptStep 1: VideoStep 2: Next Steps Watch a video tutorial on utilizing the Mashup Builder to create a User Interface (UI) for your IoT application. Guide Concept This project will introduce the ThingWorx Mashup Builder through the use of an instructional video.Following the steps in this video-guide, you will learn how to use this tool to create a Graphical User Interface (GUI) for your IoT Application.We will teach you how to rapidly create and update a Mashup, which is a custom visualization built to display data from devices according to your application's business and technical requirements. You'll learn how to Create new MashupsChoose a Static or Responsive layoutAdd Widgets to your MashupBind data Services to Widgets in your MashupCreate a functional GUI with applied usage of Widgets and Services NOTE: The estimated time to complete this guide is 30 minutes Step 1: Video Click the link below to enjoy the vi
GUIDE CONCEPTStep 1: Learning Path OverviewStep 2: New MashupStep 3: Add WidgetsStep 4: Add DataLearn how to create a web application to monitor and control an Allen-Bradley PLC. GUIDE CONCEPT This guide will create a ThingWorx Foundation Mashup GUI to monitor and control an Allen-Bradley PLC connected via ThingWorx Kepware Server. YOU'LL LEARN HOW TO Create a MashupAdd WidgetsAccess backend data via Mashup Data ServicesTie data to WidgetsCreate a simple web application that monitors and controls a PLC NOTE: The estimated time to complete all parts of this guide is 30 minutes. Step 1: Learning Path Overview Assuming you are using this guide as part of the Rockwell Automation Learning Path, then you have now completed each of the following installations: Connected Components WorkbenchThingWorx Kepware ServerThingWorx Foundation (for Windows) You've also connected an Allen-Bradely PLC to Connected Components Workbench and then
Step 5: Tie Data to WidgetsStep 6: View MashupStep 7: TroubleshootingStep 8: Next Steps Step 5: Tie Data to Widgets The Mashup now has access to the backend data via get/set Data Services. In this step, you will tie these Data Services to the Checkbox Widgets to pull and push information. Click the Data tab in the upper right Under GetProperties, click and drag the arrow next to Channel2_myPLC_Coil2 onto the Left Checkbox.On the Select Binding Target pop-up, click State. Click the Data tab againDrag Channel2_myPLC_Coil3 onto the right Checkbox.On the Select Binding Target pop-up, click State. Enable Automatic Updates The GetProperties Mashup Data Service will now propagate the State of Coil2 and Coil3 from the PLC onto these Checkbox Widgets. The GetProperties Service will be called automatically when the Mashup loads, so the Checkboxes states will be
GUIDE CONCEPTStep 1: ScenarioStep 2: Create MashupStep 3: Add WidgetsStep 4: Add DataStep 5: Bind DataStep 6: View MashupStep 7: Next Steps Create an Engine Failure Prediction GUI to warn about customer issues. GUIDE CONCEPT This guide will use ThingWorx Foundation's Mashup Builder to create a Graphical User Interface (GUI) to display results from Analytics Manager comparisons of your analytical model to real-time data. Following the steps in this guide, you will learn how to utilize Widgets and backend data to quickly visualize customer failure conditions. YOU'LL LEARN HOW TO Create a MashupAdd Widgets to represent different dataBring Backend Data into the MashupTie data to WidgetsView Analytical Results in a convenient GUI NOTE: The estimated time to complete all parts of this guide is 30 minutes. Step 1: Scenario In this guide, we're finishing up with the MotorCo scenario where an engine can fail catastrophically in a lo
GUIDE CONCEPTStep 1: ScenarioStep 2: Create MashupStep 3: Set LayoutStep 4: Adjust Header Enhance your Engine Failure-Prediction GUI. GUIDE CONCEPT This guide will use ThingWorx Foundation’s Mashup Builder to create a more advanced Graphical User Interface (GUI) than the one we originally created to display results from Analytics Manager’s engine-failure predictions. Following the steps in this guide, you will learn how to utilize Widgets and backend data to more completely visualize customer failure conditions. YOU'LL LEARN HOW TO Create a Mashup with a HeaderDivide your Mashup into Sub-sectionsUse a Contained Mashup to reuse developmentStore historical data in a Value SteamDisplay historical data in a Time Series ChartShow spreadsheet data via a Grid WidgetTie Mashup controls into the ThingWorx backend NOTE: The estimated time to complete all parts of this guide is 60 minutes. Step 1: Scenario In this guide, we’re t
Step 5: Contained MashupStep 6: Add Chart Step 5: Contained Mashup Our Minimum Viable Product (MVP) Mashup which we created in the last guide did have valid information. Being able to display the inputs coming from the engine, as well as the analytical results coming from ThingWorx Analytics, are certainly items we don’t want to lose in this new, more complete Mashup. Rather than recreating that work from scratch, we’ll simply include that previous Mashup in one of our sub-section via the Contained Mashup Widget. 1. Click on the top-left section to select it, and ensure that you’re on the Widgets tab in the top-left. 2. Drag-and-drop a Contained Mashup Widget onto the top-left section. 3. With the Contained Mashup Widget selected, return to the Properties tab in the bottom-left. 4. Scroll down and locate the 
Step 7: Add GridStep 8: Add ControlsStep 9: View MashupStep 10: Next Steps Step 7: Add Grid It might also be helpful to display the data you've used to build the ThingWorx Analytics model. In the future, this might be split out into an entirely separate page/Mashup that is exclusively devoted to backend model creation, but that would be beyond the scope of this guide. For now, we'll simply display that collected data via the Grid Widget 1. On the EEFV_Mashup, drag-and-drop a Grid Advanced Widget onto the bottom-left Canvas section.. 2. On the top-right Data tab, click the green </> button beside Things_EdgeThing.Note that this will open the Add Data pop-up, but with EdgeThing pre-selected. 3. In the Services Filter field, type getproperties. 4. Click the right-arrow beside GetProperties to add it to Selected
GUIDE CONCEPTStep 1: ScenarioStep 2: Modify config.lua Use the Edge MicroServer (EMS) to simulate an engine with vibration sensors. GUIDE CONCEPT The Edge MicroServer (EMS) facilitates connectivity from Edge devices to ThingWorx Foundation. It’s often easier, though, to start development with simulated Edge values rather than hooking up sensors. This guide will show you how to simulate vibration values of an engine using the EMS. YOU'LL LEARN HOW TO Modify an EMS TemplateProvision Thing Properties and Values from an EMS rather than FoundationSend information from an EMS to FoundationStore large amounts of data in an InfoTable PropertyCreate a simulator for testing NOTE: The estimated time to complete all parts of this guide is 30 minutes. Step 1: Scenario MotorCo manufactures, sells, and services commercial motors. Recently, MotorCo has been developing a new motor, and they already have a working prototype. H
Step 5: Create InfoTable Step 5: Create InfoTable Now that we have connected values coming from our EMS engine simulator, we want a method of permanent storage whenever we feel it's appropriate to take a sample. From repeated sampling, we'll be able to build up a historical record usable for both manual inspection, as well as automatic analysis via ThingWorx Analytics (though ThingWorx Analytics is beyond the scope of this guide). To hold these records, we'll use an Info Table Property. But any time that you create an Info Table, you first need a Data Shape to format the columns. Click Browse > MODELING > Data Shapes. At the top-left, click + New. In the Name field, type esimDataShape. If Project is not already set, search for and select PTCDefaultProject.At the top, click Field Definitions. We now want to add a separate Field Defini
Step 3: Modify YourEdgeThingTemplate.luaStep 4: Modify EdgeThing Step 3: Modify YourEdgeThingTemplate.lua Now that the task rate has been decreased to 1000ms (one second), we can create a series of Thing Properties. In Windows, navigate to C:\CDEMO_EMS\etc\custom\templates. In your prefered text-editor, open YourEdgeThingTemplate.lua. We now want to add several lines of Lua code to define some Properties for EdgeThing. You’ll do some with some references that are pre-built into the EMS, primarily the properties structure. Working with the engine R&D team, their plan is to place two vibration sensors on the proptype engine. In addition, each vibration sensor will have five frequency bands. As such, we’ll need ten Properties to represent the vibration readings. In addition, we also want a Property that will record whether or not the engine is currently experiencing the low grease condition. This will be entered via manual-inspection at the sam
Step 6: Record DataStep 7: Next Steps Step 6: Record Data Now that we have a place to permanently store the values coming from the EMS engine simulator,we'll write a Service to take samples and place them within the Info Table. Part of that Service, though, will be incrementing the identifier, so we'll need to create one last Property. Ensure that you're on the Properties and Alerts tab of EdgeThing.At the top-left, click + Add. In the Name field of the slide-out on the right, type identifier.Change the Base Type to NUMBER.Click Persistent.Click Has Default Value.In the Has Default Value field, type 0. At the top-right, click the "Check" button for Done.At the top, click Save. Store the Property Values With all the pieces in place, we can now create our Service to add entries to our Info Table Property. At the top of EdgeThing, clic
Step 3: Configure EMSStep 4: Connect EMS Step 3: Configure EMS Now that you have "installed" (i.e. downloaded, unzipped, and moved to an appropriate location) the EMS on your Windows computer, it needs to be configured. The primary method of doing so is via the config.json and config.lua files. In this step, we'll create these files and paste some JSON / Lua configuration into them. Navigate to the C:\CDEMO_EMS\etc directory. Right-click inside the folder’s white-space and select New -> Text Document. Change the name of New Text Document.txt to config.json.Here are instructions on how to configure your computer to display file extensions if you are not currently doing so. Click Yes in the Rename Popup to confirm the file extension change. Open config.json in your preferred text editor.NOTE: You wil
Step 5: Verify ConnectivityStep 6: Next Steps Step 5: Verify Connectivity The EMS is now attempting to talk to the ThingWorx platform. However, ThingWorx does not have detailed information about the Edge device that is attempting to connect to it, so it will show up in the Unbound category. Open ThingWorx Composer. On the left, click Monitoring. Click STATUS > Remote Things. Click Unbound. Confirm that you see the EdgeThing listed in the Unbound section.NOTE: The name EdgeThing comes from the config.lua script. EdgeThing is simply the name that is in that script, hence the name that you see in ThingWorx. To change the name of the device, you could stop both wsems.exe and luaScriptResource.exe, edit config.lua to use a different Thing name other than EdgeThing, and then restart both of the WSEMS programs. At that point, the Thing showing up in Remote Thin
GUIDE CONCEPTStep 1: ScenarioStep 2: Create a TimerStep 3: Subscribe to the TimerStep 4: Data Acquisition Use a Timer to record mass amounts of test data, and then export it as a Comma-Separated Values file. GUIDE CONCEPT Having an Edge MicroServer (EMS) Engine Simulator has allowed you to begin work on using ThingWorx Foundation for instrumenting a prototype engine. However, the end goal is not to inspect the data manually, but to have ThingWorx Analytics perform an automatic notification for any issues. In this guide, you’ll create a Timer to generate thousands of data points, and then export the dataset as a Comma-Separated Values (.csv) file for future use in building an analytical model of the engine. YOU'LL LEARN HOW TO Create a TimerSubscribe to a Timer to Trigger a ServiceGenerate Mass Amounts of Test DataImport the CSV Parser ExtensionCreate a File RepositoryExport the Test Data as a Comma-Separated Values (.csv) fileDownload from
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.