IoT & Connectivity Tips | ThingWorx & Kepware PTC
Recently active
In this video we show a simple mashup and services in order to display the ThingPredictor's real time scoring results. This video applies to ThingWorx Analytics 7.4 to 8.1 Updated Link for access to this video: Showing ThingWorx Analytics Manager's results (ThingPredictor) in a Mashup
Disclaimer: example was provided by Hatcher Chad - chad@onfarmsystems.com // // For this example, we'll have an Math service // which takes two numbers, and an operation. // The result will be that operation performed on the two inputs. // // We either need an Application Key, // or user credentials to perform the reads and writes. // App keys are a little safer. // In this demo, we'll store it on the Entity as a Property. var appKey = me.appKey; // // The service name needs to be unique and not already in use. var serviceName = "MyMath"; // // What are the inputs to the service? // We'll define them nicely here, but manipulate this object later. var parameters = { "op" : "STRING", "x" : "NUMBER", "y" : "NUMBER" }; // // What datatype does the service return? // If
In this blog I will be testing with the WindchillSwaggerConnector, but most of the steps also apply to the generic SwaggerConnector. Overview The WindchillSwaggerConnector enables the connection to the Windchill REST endpoints through the Swagger (OpenAPI) specification. It is a specialized implementation of the SwaggerConnector. See Integration Connectors for documentation. It relies on three components : Integration Runtime : microservice that runs outside of ThingWorx and has to be deployed separately, it uses Web Socket to communicate with the ThingWorx platform (similar to EMS). Integration Subsystem : available by default in 7.4 (not extension needed) Integration Connectors (WindchillSwaggerConnector) : available by default in 7.4 (not extension needed) Currently, in 7.4, the WindchillSwaggerConnector does not support SSO with Windchill (it is more targeted for a "gateway type" integration). Note that the PTC Navigate PDM apps are usi
Modbus is a commonly used communications protocol that allows data transfer between computers and PLCs. This is intended to be a simple guide on setting up and using a Modbus PLC Simulator with ThingWorx.ThingWorx provides Modbus packages for Windows, Linux and Linux ARM. The Modbus Package contains libraries and lua files intended to be used along with the Edge Microserver.Note: The Modbus package is not intended as an out of the box solutionRequirements:ThingWorx PlatformEdge MicroserverModbus PackageModbus PLC SimulatorIn this guide, a free Modbus PLC Simulator is used. Here is the direct download link for their v8.20 binary release.Configuring the EMS:The first step is to configure the EMS as a gateway. This is done via adding an auto_bind section in the config.json:"auto_bind": [ { "name": "ModbusGateway", "gateway": true}]This creates an ephemeral Thing that only exists when the EMS is running.The next step is to modify the config.lua to inclu
Let us consider that we have 2 properties Property1 and Property2 in Thing Thing1 which we want to update using UpdatePropertyValues service.In our service we will use a system defined DataShape NamedVTQ which has following field definitions:In Thing1 create a custom service like following:var params1 = { infoTableName : "InfoTable", dataShapeName : "NamedVTQ"};// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(NamedVTQ)var InputInfoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params1);var now = new Date();// Thing1 entry objectvar newEntry = new Object();newEntry.time = now; // DATETIME - isPrimaryKey = truenewEntry.quality = undefined; // STRINGnewEntry.name = "Property1"; // STRINGnewEntry.value = "Value1"; // STRINGInputInfoTable.AddRow(newEntry);newEntry.name = "Property2"; // STRINGnewEntry.value = "Value2"; // STRINGInputInfoTable.AddRow(newEntry);var params2 =
All of the entities and data in storage entities(Stream, ValueStream, DataTable, Wiki, Blog) are kept in Persistence Provider, to enhance the storage volume of Thingworx, it is advised to use bigger Persistence Provider (PostgreSQL or Cassandra rather than Neo4j and H2), move and keep certain part of data in external database or set up a second Persistence ProviderData Storage entities (Stream, ValueStream, DataTable) and Collaboration entities (Wiki, Blog) can be assigned to the new Persistence Provider to keep the Business DataThe original Persistence Provider (upon installation) will be freed from large data input and respond faster, and only holds the Model Data (entity information)Small Persistence Provider like H2 or Neo4j, which does not require extra steps to setup in the Thingworx installation process, cannot set up a second Persistence Provider (they don't have .bat files to configure the database)Here is an example for setting up a second PostgreSQL (may also applicable for
One recurring question that comes up after a customer has been using the scripting capabilities of the Axeda Platform for some time is how to create function libraries that are reusable, in order to reduce the amount of copy and pasting (and testing) that is done to create new functionality. Below I demonstrate a mechanism for how to accomplish this. Some things that are typically included in such a library are:Customized ExtendedObject access methods (CRUD) - ExtendedObjects must be created before they can be used, so this can be encapsulated per customer requirementsDataItem manipulationGathering lists of Assets based on criteriaAccessing the ExternalCredentialsBridgeFor those unfamiliar with Custom Objects I suggest some resources at the end of this document to get started. The first thing we want to do is create a script that is going to be our "Library of Functions":FunctionLibrary.groovy: class GroovyChild { String hello() { &n
Performance and memory issues in ThingWorx often appear at the Java Virtual Machine (JVM) level. We can frequently detect these issues by monitoring JVM garbage collection logs and thread dumps.In this first of a multi-part series, let's discuss how to analyze JVM garbage collection (GC) logs to detect memory issues in our application.What are GC logs? When enabled on the Apache server, the logs will show the memory usage over time and any memory allocation issues (See: How to enable GC logging in our KB for details on enabling this logging level). Garbage Collection logs capture all memory cleanup operations performed by the JVM. We can determine the proper memory configuration and whether we have memory issues by analyzing GC logs.Where do I find the GC logs? When configured as per our KB article, GC logs will be written to your Apache logs folder. Check both the gc.out and the gc.restart files for issues if present, especially if the server was restarted when experiencin
Connection server + InfluxDB + Grafana work together can display connection server metrics in graphic chartsDownload and set up connection serverDownload InfluxDB and configure InfluxDBedit <influxdb home>\influxdb.conf fileNote: [admin] is InfluxDB admin login page, [http] is Grafana connected settings, [graphite] is connection server connected settingsRun influxd.exe file with below commands (windows cmd)<path>/influxd -config <path>/influxdb.confRun influx.exe file with below commands (in my case the port is 8008)<path>/influx -port 8008Start connection serverLogin to InfluxDB by using URL http://localhost:8018. Choose Database graphite and Query SHOW MEASUREMENTSNote: There should be many connection server metricsDouble click grafana-server.exe file (<path>/grafana-4.2.0.windows-x64/grafana-4.2.0/bin)Login to Grafana with URL http://localhost:3000The default login username and password is admin/adminCreate a new Data SourceNote: Type, Url and Database
You can control the Tracking Indicator that is used to mark the ThingMark position. The Tracking Indicator is a green hexagon, in the screenshot below the red arrow points to it.You can control the display of this tracking indicator via the Display Tracking Indicator property of the ThingMark widget:But you can also get fancier. Here is an exmaple that shows the tracking indicator for 3 seconds when the tracking has started and then hides it automatically. To achieve such a behavior you'll have to use a bit of Javascript. We'll first create a function hideIn3Sec() in the javascript section of our view and then add it to the javascript handler of the Tracking Acquired event of the ThingMark widget.Step 1:Here is the code for copy/paste convenience:$scope.hideIn3Sec=function(){ // The $timeout function has two arguments: the function to execute (defined inline here) // and the time in msec after which the function is invoked. $timeout( function hide(){
This is using the simplest structure to do a look through an infotable. It's simple but it avoids having to use row indexes and cleans up the code for readability as well. //Assume incoming Infotable parameter names "thingList" for each (row in thingList.rows) { // Now each row is already assigned to the row variable in the loop var thingName = row.name; } You can also nest these loops (just use a different variable from "row"). Also important to note to not add or remove row entries of the Infotable inside the loop. In this case you may end up skipping or repeating rows in the loop since the indexes will be changed.
Let's consider that we have two Streams Stream1 and Stream2 with same DataShape StreamDS.DataShape StreamDS has two fields Id (number) and Name (string).We want to copy all the entries from Stream1 to Stream2.Steps:1. Open Stream1 Stream in Composer and run GetStreamEntriesWithData service.2. In the popup click on Create DataShape from Result option to create a new DataShape GetStreamEntriesDS.3. Create a Service and use JavaScript like below (Added Comments for Details):// Create Temporary Infotable to hold output of GetStreamEntriesWithData Servicevar paramsForInfotable = { infoTableName: "InfoTable" /* STRING */, dataShapeName: "GetStreamEntriesDS" /* DATASHAPENAME */};// result: INFOTABLEvar InfotableForCopy = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(paramsForInfotable);//Save output of GetStreamEntriesWithData Service to Temporary Infotable InfotableForCopyvar paramsForGetStreamEntriesWithDataService = { oldestFirst: false /* BOOLEAN */,
In the process of working with a customer, I was curious as to the throughput of a file sent via the Axeda Connected Content feature to one of the Axeda Agent Gateways. I took a random 50 megabyte blob of data (/dev/urandom) and sent it to one of my test Gateways via a Package deployment:DEBUG xgEnterpriseProxy: Enterprise Queue EmptyINFO xgSM: ... Download percent done = 11%INFO xgSM: ... Download percent done = 21%INFO xgSM: ... Download percent done = 31%INFO xgSM: ... Download percent done = 41%INFO xgSM: ... Download percent done = 51%INFO xgSM: ... Download percent done = 61%INFO xgSM: ... Download percent done = 71%INFO xgSM: ... Download percent done = 81%INFO xgSM: ... Download percent done = 91%INFO xgSM: ... Downloa
<p>We live in a connected world where we can (want!) to receive instant updates and notifications. ThingWorx leverages the power of Web 2.0 and its Always-On technology to deliver that, but our friendly SMS providers have also provided an easy and powerful way that can be used to deliver SMS notifications right to your phone. Email to Text!</p><div>Set up a 'notification' Thing using our MailServer Template, set up your outgoing e-mail server and you are now ready to invoke the 'SendMessage' service on a given event. All you need now is the email address of your SMS number, which you can find by following this link: <a href="http://sms411.net/how-to-send-email-to-a-phone/" target="_blank"><span style="font-size:8.5pt;line-height:115%;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">Listof e-Mail to SMS addresses</span></a></div><p class="MsoNormal"><o:p></o:p></p><div><p class="M
Twilio extends the ThingWorx functionality to send SMS and voice messages in variety of languages. Starting from scratch I'll cover the steps required to setup the Twilio extension and the basic account registration (trial version) and setup at Twilio.comTwilio allows registering with the trial account, which comes with $15 as initial account balance, something which is quite useful for testing the initial setup and testing of Twilio extension in conjunction to ThingWorx.Prerequisite1. Sign up, if not already done, with Twilio.com for free trail account2. Configure the account to setup a verified phone number to receive text and voice messages, free trial account allows setting up 1 verified phone number that can receive text and voice messagesNote: See What's the difference between a verified phone number and a Twilio phone number?3. Choose and configure a Twilio phone number capable of sending text and voice messages, free trial account allows setting up of 1 Twilio number which will
It usually happens that we need to copy a large file to ThingWorx server periodically, and what's worse, the big file is changing(like a log file). This sample give a simpler way to implement. The main idea in the sample is: 1. Lower the management burden from ThingWorx server and instead it put all the work in edge SDK side 2. Save network burden with only uploading the incremented file and append it to the older file on ThingWorx server Java SDK version in this sample: 6.0.1-255
Here is a demo that uses repeater widget and smart grid widget to display a nested table.Note: This demo is for testing use.Create a datashape for the nested datatable named DataTableStructureCreate DataShape named InfoStructure for ObjCreate the nested datatable named DataTableTest as belowCreate a service named AddObjInput as below in this datatableCrate a Mashup named RepeaterMshAdd widgets like textbox, label, button and smart grid on the mashupThere are some parameters we added before, please bind them to the widgets that we just added to the mashupAdd DataTableTest service AddOrUpdateDataTableEntry to the mashup. Bind textbox and smart grid edited table to AddOrUpdateDataTableEntry parameter. Bind button click event to trigger the service AddOrUpdateDataTableEntryThe smart grid widget need a special attribute named TableDefinitionThis demo sample is{"columns":[{"name":"PrimarySchool","type":"text","display":"PrimarySchool"},{"name":"SecondarySchool","type":"text","display":
This is just a quick note/reminder that starting 7.4, the utilities installation process has slightly changed.Several extensions are no longer bundled with ThingWorx Utilities and must be downloaded from the ThingWorx Marketplace and installed separately. For more information, see the “Prerequisites” topic in the ThingWorx Utilities Installation Guide: http://support.ptc.com/WCMS/files/172616/en/ThingWorxUtilitiesInstall.pdfThe following extensions must be installed prior to installing ThingWorx Utilities available at ThingWorx IoT Marketplace○ Google Maps Widget ○ Mail Extension ○ Web Sockets Tunnel Widget and Library
AboutThis is the third part of a ThingBerry related blog post series.ThingBerry is ThingWorx installed on a RaspBerry Pi, which can be used for portable demonstrations without the need of utilizing e.g. customer networks. Instead the ThingBerry provides its own custom WIFI hotspot and allows Things to connect and send / receive demo data on a small scale.In this particual blog post we'll discuss on how to setup the ThingBerry for encrypted communication and trust via certificates. We will create a custom Root and Intermediate Certificate Authority as well as a server specific certificate.More information on the theory of Trust & Encryption can be found here: Trust &amp; Encryption - TheoryAs the ThingBerry is a highly unsupported environment for ThingWorx, please see this blog post for all related warnings.Preparing the environmentTo get started and keep all the working materials safe and secure within the scope of the pi user account, let's start creating a workspace directory
Do you trust me?if (true) { why }else { !why } Communication between client and server can be encrypted or not.Communication between client and server can be between trusted parties or not.Both statements are independant of each other.There's no need to trust a server - but still traffic can be encrypted.There's no need to encrypt traffic - but still a server can be trusted.For secure and safe communication in an IoT environment encryption as well as trust should be an integral part of exchanging data.TrustCertificates and Chains of TrustTrust establishes the identity of the parties involved, e.g. is server I'm contacting really the server it pretends to be?This can be ensured with server certificates. On the other hand, client certificates ensure that the client is actual the client it pretends to be.This can be used as an authentication approach and if the identity of the server as well as the client is confirmed, this is also known as mutual authentica
Unless created and owned by the Administrator user, by default MySQL Database Thing will not connect to the database as it requires certain permissions on the user.In order for a user other than an administrator to create a working database thing, they need three permissions (in addition to the typical subsystem and resource permissions - refer to https://www.youtube.com/watch?v=HzFqxvgHtpI&index=8&list=PLz1ppcU_kaneagUT9qgQfz3HByf6-9zTF )::Visibility to the Database Thing Template.Execute service permission on the EncryptPropertyValue service in the Encryption Services resource.Visibility to the DatabaseThing Thing Package.Typically to track down permissions issue, the most convenient and easy way is to use browser developer tools. For example in Chrome, developer tools can be used to view the API calls being sent by Composer, and the errors sent in response. ThingWorx Composer doesn’t expose Thing Packages, so in order to set visibility to the DatabaseThing Thin
Wanting to build a simple environment with ThingWorx, using a Raspbery Pi mini-computer and an Edge MicroServer (EMS), one has to bear in mind some apparently insignificant tips, that can make a huge difference in a well-connected platform. The Raspbery Pi can have either a few sensors attached on it and/or a Sense HAT integrated with it. A Sense HAT is an add-on board for Raspbery Pi that has an 8x8 LED matrix, a five-button joystick and a sensor, gyroscope. Tips: The ThingWorx guide "Connecting ThingWorx EMS with Rasberry Pi Quickstart" can be expanded to read Sense HAT specific sensor informationA Sense HAT integrated with Raspberry Pi can be accessed from anywhere, using the existing APIs to read/writeGetting location information while using the Pi board (because The Sense HAT doesn't have this feature): The Raspberry Pi has several USB ports, therefore inserting a USB GPS can be used as a workaround for connecting and reading location information (or the GPIO pins coul
This is part 3 out of 3 videos on Getting Started with ThingWorx Analytics During this video you will learn: Executing a “Signals” Job Getting the results of the “Signals” Job Executing a “Training Model” Job Getting the results of the “Training Model” Job Updated Link for access to this video: Getting Started with ThingWorx Analytics: Part 3 of 3
In this blog I will be covering the initial setup of ThingWorx Android SDK with a sample app (supplied with the Android SDK) and set it up with a web based revision control system like Bitbucket's (free account plan). I'll also be covering quick information on how to enable the HTTPS connection for the ThingWorx server on Windows platform. This will allow for secured connection to the ThingWorx server from the Android application.Do note this is only a reference guide for setting it up with revision control system, you’re free to choose to setup the Android Studio without Bitbucket or with any other revision control system. It’ll be just fine to have a local Git/SVN/Perforce etc. to manage the code repository, setting Android Studio with Bitbucket is officially not supported.Pre-requisite:1. Download and unzip the ThingWorx Android SDK from https://support.ptc.com 2. An account with Bitbucket is required3. Download and install Android StudioProject Setup1. Unzip the downloaded Android
This blog addresses a few points that are related to scoring with ThingWorx Analytics. It, particularly, brings a clearer understanding of the concepts behind the values of the scores that are generated when performing a scoring job. Scoring Outputs: It is important to note that when training an analytics model, the method is to create a generalizable model from a relatively small training dataset. By its nature, we expect the training process to see a limited subset and not an exhaustive list of all possible values for many constraints, especially for time and practicality. As such, these generalized models will be expected to handle unseen data in the form of new combinations or values outside of previously observed ranges (more on this below). One common way to see scores that exceed the observed ranges in training, under the assumption that the goals are continuous, is to use prescriptive scoring. Prescriptive scoring attempts to find o
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.