IoT & Connectivity Tips | ThingWorx & Kepware PTC
Recently active
Step 5: Launch the EMSStep 6: Configure Lua Script Resource (LSR)Step 7: Configure Template File (Properties) Step 5: Launch the EMS 1. Navigate to the microserver directory.cd ..2. Ensure that you have ownership to the executable wsems and executable privileges. To check ownership.Ls -la -rwxrwxr-x 1 pi pi 769058 Jun 9 17:46 wsemsNOTE: The account that owns the wsems executable should be used to log into the Raspberry Pi. 3. Confirm that you have executable privileges by run the following command:sudo chmod 775 wsems4. Run the EMS.sudo ./wsems5. Validate that your EMS successfully connected. Depending on your logger level, your wsems execution should indicate Websocket connected in the log and the following INFO message:[INFO ] 2016-10-11 14:22:54,770 Main: Succesfully connected. Saving .booted config file Troubleshoot Connectivity Issues If the websocket does not connect successfully, check the following: Issue &n
Step 8: Configure Template File (Service)Step 9: Run LSRStep 10: Bind Remote Thing PropertiesStep 11: View Data from Devices Step 8: Configure Template File (Service) Services are implemented as Lua functions. In our Lua script, Services are divided into two pieces. The first is the Service definition which consists of a Service name, inputs and output. The second part of defining a Service is the service code. The Service code is run when you execute the service. Create Service DefinitionOpen the PiTemplate.lua file.Append the service definition to the file.Create a service named GetSystemProperties that gets the system properties (cpu temperature, clock frequencies, voltages) from your Raspberry Pi and updates the respective properties on the Thingworx platform.Specify your output type but not the name because the name of every output from a ThingWorx service is always result. serviceDefinitions.GetSystemProperties( output { baseType="BOOLEAN", description="" }, desc
Step 12: Connect to Temperature SensorStep 13: Next Steps Step 12: Connect to Temperature Sensor This step is optional. Additional instructions are provided for developers who are interested in interfacing with sensors. The DHT11 and DHT22 digital temperature and humidity sensors are inexpensive and available from several sources:AdafruitSparkfunSeeedStudioThe Raspberry Pi does not come with any built-in analog to digital conversion capability and because these sensors are digital they can be interfaced easily with a Raspberry Pi. We will be using a Python library developed by Adafruit that simplifies interfacing with these sensors. Install Adafruit Python Library for Sensors We will use Git to download the Adafruit DHT11 Python from GitHub. Check if Git is already installed by opening a command window and typing the command:gitIf you see a "command not found" error message use this command to install Git:sudo apt-get install git-coreIf you get an error i
To simplify the development of IIoT applications and solutions on the ThingWorx platform, we introduce the concept of Building Blocks. The intent of Building Blocks is to ease the creation of your own solutions and customization of PTC’s solutions. These Building Blocks are domain specific business logic pre-made for reusability, which means you won’t need to build from scratch on ThingWorx and can accelerate your time to value.What do we mean by Building Blocks? Building Blocks are premade components that enable modular software development. They are reusable, replaceable packages of functionality that can be connected into an architecture framework. Building Blocks allow for quicker development and customization of solutions and applications.What are the different types of Building Blocks? Connectors Leverage the same connectors we use for PTC solutions for better overall application performance and seamless transfer of data from disparate devices and systems. Identify the
GUIDE CONCEPTStep 1: Create a DatashapeStep 2: Create a Thing Use the Collection Widget to organize visual elements of your application. GUIDE CONCEPT This project will introduce the Collection Widget. Following the steps in this guide, you will learn to display different values from a single dataset in real-time. We will teach you how to utilize the Collection Widget to generate a series of repeated Mashups for every row of data in a table. YOU'LL LEARN HOW TO Create a Datashape to define columns of a tableCreate a Thing with an Infotable PropertyCreate a base Mashup to display dataUtilize a Collection Widget to display data from multiple rows of a table NOTE: This guide's content aligns with ThingWorx 9.3. The estimated time to complete ALL 3 parts of this guide is 60 minutes. Step 1: Create a Datashape Create a Datashape The Collection Widget uses a Service to dynamically define v
Step 3: Create a Base Mashup Step 3: Create a Base Mashup Now that you have some data, you need to create and configure a Mashup to display the data. Using Mashup Parameters, the Collection Widget will replicate the base Mashup multiple times, correlating to each row of data in the Info Table Property. On the ThingWorx Composer Browse tab, click Visualization > Mashups, + New 2. Keep the default ofResponsive(without selecting any Templates), and click OK 3. In the Name field, enter cwht_base_mashup. 4. If Project is not already set, search for and select PTCDefaultProject. 5. Click Save. Add Widgets to Design At the top, click Design.TIP: You can click the left arrow on the divider between the Browse left-navigation and the Mashu
Step 4: Use Collection WidgetStep 5: Next Steps Step 4: Use Collection Widget At this point, you have created the following Entities: A Thing with data stored in an Info Table Property (columns defined by a Data Shape) A base Mashup (containing Gauge, LED Display, and Text Field Widgets) that displays an individual row of data from the table Now, you need to use the Collection Widget to display this Mashup for every row of data in the table. On the ThingWorx Composer Browse tab, click Visualization > Mashups, + New 2. Keep the default of Responsive with no Templates chosen, and click OK. 3. In the Name field, enter cwht_collection_mashup 4. If Project is not already set, search for and select PTCDefaultProjec
GUIDE CONCEPTStep 1: Completed ExampleStep 2: Download Plugin and SDKStep 3: Install and Configure Build extensions quickly and extend your application functionality with the Eclipse Plugin. GUIDE CONCEPT Extensions enable you to quickly and easily add new functionality to an IoT solution. Extensions can be service (function/method) libraries, connector templates, functional widgets, and more. The Eclipse Plugin for ThingWorx Extension Development (Eclipse Plugin) is designed to streamline and enhance the creation of extensions for the ThingWorx Platform. The plugin makes it easier to develop and build extensions by automatically generating source files, annotations, and methods as well as updating the metadata file to ensure the extension can be imported. These features allow you to focus on developing functionality in your extension, rather than worrying about getting the syntax and format of annotations and the metadata file correct. YOU'LL LEARN
Step 4: Create Extension ProjectStep 5: Add PropertiesStep 6: Create Configuration Table Step 4: Create Extension Project In this tutorial, you will create a ThingWorx extension that retrieves weather information using OpenWeatherMap API.Create AccountIn this part of the lesson, you will create a free account in OpenWeatherMap that creates an AppKey so you can access their REST API.Sign-up for a free account.Log in to your account.Create a new API Key NOTE: We will use this generated API key as a parameter in the REST calls. Create New Extension Project NOTE: Make sure that you are in the ThingWorx Extension Perspective. To verify, you should see a plus icon: in the menu bar. If you don’t see this, you are probably in the wrong perspective. Go back to the previous step to learn how to set the perspective to ThingWorx Extension in Eclipse. Go to File->New->Project.Click ThingWorx->ThingWorx Extension P
Step 7: Add JAR ResourcesStep 8: Create Services Step 7: Add JAR Resources You can add external JARs for use by your extension. Every third-party JAR that is not already included in either the ThingWorx Extension SDK or ThingWorx Core needs to be added to your extension project as a JAR Resource. These JAR resources are added to your metadata.xml as a tag and are used to reference the Java classes in the third-party JAR on which the extension depends. You can either use the Add button or the ThingWorx Menu from the menu bar to add a new JAR resource. By doing so, the JAR is automatically updated in the metadata file and added to the build path.Although ThingWorx allows developers to include jar files for third-party libraries in their code, it is recommended that you avoid adding jar files for common libraries and instead use the jar files that are included with the SDK. Adding jar files to an extension could cause conflicts with jar files already used by the ThingW
Step 9: Create Event and SubscriptionStep 10: Add Composer Entities Step 9: Create Event and Subscription In this section, you will create a mechanism to notify the user when inclement weather occurs. For example, whenever the weather indicates storm/snow/rain, an Event should be triggered. This event is then handled by a service called a Subscription. For this tutorial, while updating weather information inside the service UpdateWeatherInfo,we need to fire an Event: BadWeather when the weather description indicates either storm/snow/rain. This Event is handled by a Subscription: HandleWeather, which is a service that gets called whenever the BadWeather Event is fired. The subscription service HandleWeather updates a property called AlertNotification. Create Event In this part of the lesson, we will create an Event: BadWeather that updates weather information inside the service Upd
The IoT Building Block Design FrameworkBy Victoria Firewind and Ward Bowman, Sr. Director of the IoT EDC Building Block OverviewAs detailed quite extensively on its own designated Help Center page, building blocks are the future of scalable and maintainable IoT architecture. They are a way to organize development and customization of ThingWorx solutions into modular, well-defined components or packages. Each building block serves a specific purpose and exists as independently as possible from other modules. Some blocks facilitate external data integration, some user interface features, and others the manipulation or management of different kinds of equipment. There are really no limits to how custom a ThingWorx solution can be, and customizations are often a major hurdle to a well-oiled dev ops pipeline. It’s therefore crucial for us all to use a standard framework, to ensure that each piece of customization is insular, easy-to-replace, and much more maintainable. This is the foun
Step 2: Create and Configure AlertStep 3: Monitor AlertStep 4: Next Steps Use ThingWorx Advisors to view trends and monitor Alerts.Step 2: Create and Configure Alert Click the grid icon. Select Configuration and Setup, then select the Alert tab.NOTE: If you are using the Demo Factory Simulator, you will see that several alerts have already been configured.To create a new alert, click the Alert tab, then click the + icon.Select the following properties in the Select Tag or Property box:Under Equipment Type, select Asset.Under Equipment, select 1-3_CNCMill.In Properties, click Temperature.Click OK.Set up the following in the Create New Alert pop-up:In the Alert Name text box, type HighTemp.In the Alert Type drop-down, choose Above.In the Value text box, type 34.In the Alert Description text box, type Temperature close to fail
GUIDE CONCEPTStep 1: Configure and View Trends Use ThingWorx Advisors to view trends and monitor Alerts. GUIDE CONCEPT The intent of this guide is to provide instructions to configure trends and alerts in the ThingWorx Advisors. NOTE: This guide's content aligns with ThingWorx 9.3. The estimated time to complete all parts of this guide is 30 minutes. YOU'LL LEARN HOW TO In this guide, you will learn how to:Configure and view trends in machine performanceCreate and configure an alertMonitor an alert Step 1: Configure and View Trends To begin, you will learn how to open up ThingWorx Advisors. In ThingWorx Foundation Composer, click Browse then Visualization > Master then click PTC.Factory.PlantStatus.Master. 2. Next click the View Mashup button. 3. Click the Utility Selector grid in
Step 8: TasksStep 9: File Transfer ExampleStaging DirectoryStep 10: Support Other Platforms Step 8: TasksIf you are using the built-in Tasker to drive data collection or other types of repetitive or periodic activities, create a function for the task. Task functions are registered with the Tasker and then called at the rate specified after they are registered. The Tasker is a very simple, cooperative multitasker, so these functions should not take long to return and most certainly must not go into an infinite loop.The signature for a task function is found in [C SDK HOME DIR]/src/utils/twTasker.h. The function is passed a DATETIME value with the current time and a void pointer that is passed into the Tasker when the task is registered. After creating this function, it will need to be registered using the twApi_CreateTask function after the connection is created. Below shows an example of creating this function, registering this function, and how this function can be used.#define D
Step 5: PropertiesStep 6: Data ShapesStep 7: Events and Services Step 5: PropertiesIn the Delivery Truck application, there are three Delivery Truck Things. Each Thing has a number of Properties based on its location, speed, and its deliveries carried out. In this design, when a delivery is made or the truck is no longer moving, the Property values are updated. The deliveryTruck.c helper C file is based on the DeliveryTruck Entities in the Composer. After calling the construct function, there are a number of steps necessary to get going. For the SimpleThing application, there are a number of methods for creating Properties, Events, Services, and Data Shapes for ease of use.Properties can be created in the client or just registered and utilized. In the SimpleThingClient application, Properties are created. In the DeliveryTruckClient application, Properties are bound to their ThingWorx Platform counterpart. Two types of structures are used by the C SDK to define Properties when
Step 3: Run Sample CodeStep 4: ExampleClient Connection Step 3: Run Sample CodeThe C code in the sample download is configured to run and connect to the Entities provided in the ThingWorxEntitiesExport.xml file. Make note of the IP address of your ThingWorx Composer instance. The top level of the exported zip file will be referred to as [C SDK HOME DIR].Navigate to the [C SDK HOME DIR]/examples/ExampleClient/src directory.Open the main.c source file.Operating System Command Linux/Ubuntugedit main.c OR vi main.cMacopen –e main.cWindowsstart main.cModify the Server Details section at the top with the IP address for your ThingWorx Platform instance and the Application Key you would like to use. Change the TW_HOST definition accordingly.NOTE: By default, TW_APP_KEY has been set to the Application Key from the admin_key in the import step completed earlier. Using the Application Key for the default Administrator is not recommended.
Guide ConceptStep 1: Completed ExamplesStep 2: Environment Setup Use the C SDK to build an app that connects to ThingWorx with persistent bi-directional communication Guide ConceptThis project will introduce more complex aspects of the ThingWorx C SDK and help you to get started with development. Following the steps in this this guide, you will be ready to develop your own IoT application with the ThingWorx C SDK. We will teach you how to use the C programming language to connect and build IoT applications to be used with the ThingWorx Platform. You'll learn how toEstablish and manage a secure connection with a ThingWorx server, including SSL negotiation and connection maintenanceEnable easy programmatic interaction with the Properties, Services, and Events that are exposed by Entities running on a ThingWorx serverCreate applications that can be directly used with your device running the C programming languageBasic concepts of the C Edge SDKHow to use the C E
The New and Improved DGIS Guide to ThingWorx Development Written by Victoria Firewind of the IoT EDC The classic Developing Great IoT Solutions guide has been reskinned and revamped for newer versions of ThingWorx! The same information on how to build a quality IoT application is now available for versions of ThingWorx 9.1+, and now, a complete sample application is included to demonstrate these ideas. Find within the attached archive a PDF with high-level overview information on development and application design geared towards managers and business users, so that everyone can understand the necessary requirements, common terms, and key tips on how to ensure an application is scalable and maintainable right from the very start. Reduce your chances of running into issues between PoC and Go Live by reviewing this information today! Also find within this PDF a series of tutorials which teach not just how to use the ThingWorx software, but which also educate on
Attached (as PDF) are some steps to quickly get started with the Thingworx MQTT Extension so that you can subscribe / publish topics.
In this post, I show how you can downsample time-series data on server side using the LTTB algorithm.The export comes with a service to setup sample data and a mashup which shows the data with weak to strong downsampling. Motivation:Users displaying time series data on mashups and dashboards (usually by a service using a QueryPropertyHistory-flavor in the background) might request large amounts of data by selecting large date ranges to be visualized, or data being recorded in high resolution.The newer chart widgets in Thingworx can work much better with a higher number of data points to display. Some also provide their own downsampling so only the „necessary“ points are drawn (e.g. no need to paint beyond the screen‘s resolution). See discussion here.However, as this is done in the widgets, this means the data reduction happens on client site, so data is sent over the network only to be discarded.It would be beneficial to reduce the number of points delivered to the client beforeh
Question: What should I know about using ThingWorx with InfluxDB to store my time series data? Hi, ThingWorx users! It’s here! Thanks for waiting patiently since my previous post announcing ThingWorx’ new support of InfluxDB as a time series persistence provider. As of our 8.4 release, you can now use InfluxDB to store your ThingWorx time series data with incredible power and ease. Want to learn more? Check out the following FAQs: 1. What is InfluxDB? Who is InfluxData? InfluxDB is a time series database designed to handle high write and query loads. It is meant to be used as a backing store for any use case involving large amounts of timestamped data, like monitoring, application metrics, IoT sensor data, and real-time analytics that you’d find in ThingWorx. InfluxDB is created by InfluxData, an awesome company that we are proud to call a PTC partner. 2. When would I want to use InfluxDB for IIoT? While the ThingWorx IIoT platform
Smoothing Large Data Sets Purpose In this post, learn how to smooth large data sources down into what can be rendered and processed more easily on Mashups. Note that the Time Series Chart widget is limited to load 8,000 points (hard-coded). This is because rendering more points than this is almost never necessary or beneficial, given that the human eye can only discern so many points and the average monitor can only render so many pixels. Reducing large data sources through smoothing is a recommended best practice for ThingWorx, and for data analysis in general. To show how this is done, there are sample entities provided which can be downloaded and imported into ThingWorx. These demonstrate the capacity of ThingWorx to reduce tens of thousands of data points based on a "smooth factor" live on Mashups, without much added load time required. The tutorial below steps through setting these entities up, including the code used to generate the dummy data. Smoothing
Important change in ThingWorx 9.3.2 Since 9.3.2, Transaction behavior depends on the type of database opration: Model operations which acquire a transaction and hold it until the top-level service finishes - same behavior as pre-9.3.2. Once a connection is retrieved for performing model operations, it cannot be released until the service terminates. Data read operations which have been updated to eagerly release their transaction (Data write operations, such as property writes, are always batched and processed asynchronously from a different thread). Performing Data read operations before model operations allows a connection to be retrieved for querying, then released while other work is being completed. Sample services with that use Eager Transactions: DataTable, Stream, ValueStream get/find/query/search The post below is valid for all ThingWorx versions until 9.3.1 TL;DR The transaction API is not exposed as ThingWorx scripting API (Service script). When
ThingWorx Dev Portal users, As you may have heard in prior communication, the ThingWorx Dev Portal Developer Portal | Developer Portal : ThingWorx is being retired. All ThingWorx Dev Portal content will remain accessible until September 28, 2022. Your favorite and the most useful ThingWorx Dev Portal content will be copied into the PTC Community in our IoT Tips board. The Community Team is in the process of making changes to all our “Community Tips” boards. Subscribe and watch for an official announcement on our Community Announcements board about the change. The Community Tips Board changes go into effect on September 1st. You can preview the ThingWorx Developer Portal content being migrated here. Please let us know if you have any questions.
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.