Skip to Content

Introduction

Rockwell Automation’s FactoryTalk Historian Site Edition is an on-premise application that provides data capture, management and analytical capabilities to help generate improved decision-making. Plant supervisors can view individual historical data for machines, process equipment or production lines on demand.

SAP Leonardo IoT Platform offers device connectivity and management services. It is available for on-premise and cloud. The Leonardo foundation has many components, two most important ones are – SAP IoT Services and Application Enablement (IoT AE in short). The SAP IoT Application Enablement’s Thing APIs are used to define the meta-data for a thing, create a thing instance, send time series and metadata information for the thing. It also facilitates instance based authorization and data visibility with its set of Business Partner API’s. IoT AE API’s work well with SAP IoT Services which offers device management capabilities.

Since the FactoryTalk already manages devices and data payloads, in this scenario we integrate the FactoryTalk historian to the SAP Leonardo Foundation via the IoT AE APIs where we model an Induction Coil as a Thing and persist the time series data.

The high level overview looks like this,

Fig. 1 End to end setup of the landscape

As a prerequisite on the SAP Cloud Platform, we need the Leonardo foundation components – IoT AE tenant. We have used a demo tenant for this. Here we have modeled the Induction Coil as a Thing type with two time-series properties – Temperature and Current. The target is to extract values for these properties from an asset in the FactoryTalk Historian into the Leonardo Foundation.

Option 1

The FactoryTalk server comes with a VantangePoint application which can be used to display Excel reports in a web browser. This tool can be configured to export CSV files from stored data. These files can then be ingested to the SAP Leonardo Foundation via the Integration Framework component which has a file listener and data transformation capabilities. CVS data is converted to XML which is then further transformed to the IoT AE JSON payload structure. It is then ingested into IoT AE via the Thing APIs. This same procedure can be realized using the SAP Cloud platform integration or even using Data Pipelines in the SAP Datahub. However, for this prototype we used the Integration Framework which runs on the Cloud Foundry based SAP Cloud Platform.

We did not install the FactoryTalk in this option, rather we took a sample CSV file with randomized data and tested the experiment.

Fig. 2 Listening for CSV files, converting and ingesting to Leonardo

After the file is read and ingested, a very simple Fiori app was built to visualize the data using the SAP WebIDE. The data in the app on SAP Cloud Platform looks like the following.

Fig. 3 A Simple Master detailed view of a CSV ingested data from the FactoryTalk

Pros & Cons of Option 1

Although exporting the CSV file can be automated, the format of the individual columns can be configured per geographical location.

  • This leads to different types of date fields which can be generated by the Excel Plugin du to locale configurations. As a result, the payload parser has to be adapted to individual locale which can be even error prone on the long run.
  • Secondly, One has to be careful when new columns are added – the parser needs to know them else the columns would not be considered.

Other Options

  1. It is also possible to use the FactoryTalk API’s to write a script which can be uploaded in the VantagePoint application for data extraction and export. This script can be tailored to send a uniform date format like ISO standard for example.
  2. Since the FactoryTalk Historian also uses the PI Server as the base historian, it is also possible to write a .NET based connector which gets the notifications from the Asset Framework using the PI SDK. These notifications can also be ingested to the SAP Leonardo Foundation dynamically.
  3. The Historian also has a OPC DA server which can be used in conjunction with the SAP Plant Connectivity tool at SAP.
  4. The FactoryTalk Historian also has a WebAPI which be another possibility to explore.

There might be still more valid options however, we stuck to option 2 where we wrote a connector (30 lines of code) using the Pi SDK to subscribe to the User database of the Historian. The following section highlights how we did this.

 

Installing the FactoryTalk

We took a new instance of a Windows 2012 Server. We obtained a trail version of the FactoryTalk Historian server 5.01 from Rockwell Automation for learning and testing purposes. The Installation bundle also came with a MSSQL Server, PI Server and the VantagePoint Server. Based on the installation manual, all these artifacts were installed one by one.

At a very high level, the FactoryTalk Historian contains a Server, Client tools and applications. The Server contains the OSIPI Data archive, the Asset Framework and a few PI related components. The picture below explains my understanding of the FactoryTalk Historian. This can vary from the standard architecture of the system.

Fig. 4 High-level overview of the FactoryTalk Historian from my learning

Connecting to this server are a few clients for example the Pi PC and the VantagePoint. Both use the Pi SDK for connectivity and data processing functions. The Pi PC for example contains the System Explorer which can be used to create new tags. First, we started with defining some Tags in the Explorer. For this, we created a User Database called UserDB in the OSI Pi Server.

Fig. 5 Tags inside the Asset Framework of the OSIPi AFService

An element called the Induction Coil was created with two attributes – Current and Temperature. The AFService application was used to create them. Then we exposed these tags to send data via Point Builder. This can be done via the System Management Tool (SMT) of the Pi PC. We took the SinusoidalU for temperature and the CDT158 for the Current as points. We now simulate some data for the two tags we have created in the previous steps.

Fig. 6 Point Builder of the OSISoft PI – SMT Tool

Once these are done, then we used the VantagePoint application to create a new trend. VantagePoint was used to connect to the local FactoryTalk Historian via Sources and open the connections. It also could identify the two tags which were exposed. Once the trend was built, then we published it to the VantagePoint Server as – My Testing. This is now visible also on the dashboard of VantagePoint.

Fig. 7 Visualization of the simulated tag using VantagePoint

 

Data Ingestion

Now we have the basics set up in the FactoryTalk Historian. We now like to subscribe to these tags we created and push this data to the SAP Leonardo. For this, we wrote a simple connector using the OSISoft AF SDK library. We used the OSISoft.AF.* classes for creating new a PI System, a database and a data pipe objects.

PISystems myPISystems = new PISystems();
// can put specific one if you have multiple, but for ease will use default
PISystem myPISystem = myPISystems.DefaultPISystem; 
// can put specific one if you have multiple, but for ease will use default
AFDatabase myDB = myPISystem.Databases.DefaultDatabase; 

AFDataPipe myDataPipe = new AFDataPipe();

Using this data pipe, we get all the tags and can listen to changes on the tags.

foreach (AFElement ele in myDB.Elements)
  {
    myDataPipe.AddSignups(ele.Attributes);
    List<int> zz = new List<int>();
    Console.WriteLine(String.Join("\n", (ele.Attributes as IList<IAFAttribute>).Select(x => x.Name.ToString()).ToArray()));
  }

Once there is data on these tags, the PI server sends a notification for the above sign ups

while (true)
{
  AFListResults<AFAttribute, AFDataPipeEvent> events = myDataPipe.GetUpdateEvents();
  foreach(var afevent in events)
  {
   var json = string.Format("\"Attribute\":{0},\"Value\":{1} ", 
       afevent.Value.Attribute.Name, afevent.Value.Value.ToString());
   var json2 = "{" + json+  "}";

   Console.WriteLine(json2);
   sendValue(json2);
  }
  // probably don't have to sleep, just doing to make it less intensive on resources
  Thread.Sleep(300); 
}

When there was data from these tags, we constructed a JSON payload which was then posted to the SAP Cloud Platform. This is done in the sendValue function above. In the SAP Cloud Platform we transformed the JSON Payload with the right Thing ID’s and ingested them into the IoT AE time series store using the Thing API’s.

Using the WebIDE based templates from IoT Application Enablement, we were able to list the things we modeled there and also visualize the payload that was sent by the FactoryTalk historian. A simple 2 column layout using the  Freestyle template would look like the following with data from the simulated PI Server via Rockwell’s FactoryTalk.

Fig. 8 Visualization of data from the FactoryTalk Historian using the IoT AE Freestyle Template

 

Summary

The FactoryTalk’s Historian was a solid product to work with. It was integrated to the SAP Leonardo Foundation – IoT AE’s Thing API’s using the Integration Framework. We found the Rockwell’s FactoryTalk Historian installation and performance seamless as documented. The OSISoft PI SDKs were an asset for the Integration. Using IoT AE Freestyle templates in the SAP WebIDE, we were able to build a UI app in a matter of few minutes. The entire integration as described above with the installation took us about 6 hours – less than a day. However there was a learning curve as I am very new to the Historian. Perhaps in the days to come there would be interesting projects around these stable products from SAP and Rockwell. For the moment, hope you enjoyed reading the blog. If you happen to try out some stuff for a customer, please do share your thoughts.

 

Acknowledgements

A Special thanks,

To all who helped me at  Rockwell Automation, UK & Germany. They were generous to provide me a test licence where I can play with the above.

To Derek Enders at OSISoft for continuing to share with me his ideas, code snippets and for taking my calls at 5 AM.

And finally the numerous Colleagues at SAP,

Thank you Folks,

Domnic Savio Benedict

23.07.2018

 

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply