KAASM Blog Town

Connect with KAASM for news, updates, company culture, and WinCC OA tips & tricks.

InFluxDB: Parallel Data Logging with WinCC OA NextGen Archiver

By Calvin Hamus | 04/21/2020
Featured in

The New Stuff

With the release of WinCC OA 3.17, one of the most anticipated additions was the inclusion of InfluxDB. Since InfluxDB is based on an open-source architecture it dramatically improves ease of integration and offers some cool new features. The following steps will show you how to set up parallel data logging to a separate instance of InfluxDB on a remote computer.

Here is our simple system setup.

  1. Open System Management Click the Database Configuration button from within your System Management to open your configurations. 
  2. Inside the NGA configuration click on the Backend tab and add a new backend by clicking on the insert below button. 
  3. Give the new backend a name
  4. Select a Profile, the default profile will work fine for this example.
  1. Click the wrench icon to open the settings.
  2. ClickExecutable file:” set it to NGAinfluxBackend.
  1. Next, go to the Database tab on this screen and fill in the connection information to your other instance of InfluxDB. 

NOTE(S): You will need to create the database in your other instance of InfluxDB to reference on this screen.

  1. Select theArchive Groups” tab.
  2. Click on the insert below button to pull up the add Archive Group screen. 
  3. Select the backend you just created and fill out the rest of the options

NOTE(S) You can follow the same settings as the EVENT Group.

  1. Open your Para and add your archive config. Inside the archive config simply click the Insert Below button and select the archive group that we created in the previous steps
  1. Inside of your stand-alone InfluxDB system, you must create a retention policy that is the same name as your Backend and Archive Group within WinCC OA.

One of the benefits of this approach is one database can provide smoothing and the other would contain raw data. You can configure your setup to do this.

Summary

The NGA is a great addition to the WinCC OA platform and will make the way that data is collected in the platform even easier.  For other WinCC OA and InfluxDB ideas, check out our other blogs. For more information or questions, please comment below or contact us!

Read More

WinCC OA: Creating Dashboards with Web Technologies

By Calvin Hamus | 03/26/2020
Featured in

WinCC OA has the ability to embed HTML / JS / CSS into a project. These features are essential for creating modern dashboards.  In this blog, you will explore how to use modern web libraries to interact with WinCC OA. With a few clicks, you can turn WinCC OA into a web server that can do many things, including hosting web pages inside of your project. The easiest way to enable the webserver is to locate the webclient_http.ctl file, then drag and drop the .ctl file onto your WinCC OA Console.  After you’ve added it to your console, you can turn it on like any other Control Manager.

You can deliver HTML / CSS / JS web files, by adding them to the following project directory location. Most of the time your starting file will be an index.html file.

{Path to your Project}\data\html

Connecting your web pages to WinCC OA can be done using standard tools inside of the graphical editor (GEDI) that will allow you to build responsive designs. By using a combination of WinCC OA’s Layout Management and CSS you can build 100% responsive design for all types of devices. In this example, we’ve created a new .xml panel, added the WebView object, and an initialize script that will enable communication between the HTML page and WinCC OA.

Image “A” shows the dashboard via a Quick Client test in a normal-sized view.  The two numbers, 3 and 4, are being read from WinCC OA and will update when the datapoint changes.

Image A

Image “B” shows exact same dashboard code base displayed on a mobile device. 

Image B

HTML / CSS / JS for responsive design has been around for a long time. The toolsets are mature and readily available. If you are looking to create modern applications using WinCC OA, please feel free to contact us for guidance.

For a complete step by step tutorial on this topic please visit our knowledge base article: Using Web Technologies in WinCC OA to Build Dashboards

Read More

DevOps: Continuous Deployment Using Git, Jenkins, and WinCC OA

By Calvin Hamus | 02/24/2020
Featured in ,

Why DevOps with WinCC OA is cool!

In the IT world, you would NEVER, EVER, make edits to a production system without going through proper quality assurance change acceptance. However, in the industrial world, for some reason, it has been acceptable to test and commit changes on production systems without the need for isolated development testing prior to deployment. Shouldn’t we be asking, why?

Is it because…

  • There is not enough time to set up this type of development environment;
  • IT tools are not readily available for use;
  • There is no awareness of DevOps tools or how to use them (know-how);

Understanding that IT and OT worlds are converging at an exponential pace, we need to help educate our industry about DevOps practices and the tools that are readily available in modern SCADA packages like WinCC Open Architecture. In our previous DevOps blog posts, we showed you how to integrate Jenkins and Git into your WinCC OA projects to facilitate automated unit testing. 

In this blog post, we are going to bring it all together by setting up Continuous Deployment utilizing WinCC OA, Git, and Jenkins. This tutorial expects you to have the same set up as in the previous blogs and to have followed the previous tutorials to set up both your Git and Jenkins integration.

Requirements

Step 1: Create a class to hold your Unit Tests

WinCC OA does not natively interact with an outside system like Jenkins to manage development deployments and it is good practice to use something like Unit Tests to determine if your code should be deployed to a production system. I have modified the code from our previous blog post and created a new class to accomplish this. The major changes from this file to the automatically generated one from the High-Speed Programming module is that I am using the base level function of oaAssertEqual() to get the result of pass or fail instead of writing it to the project UI.  I have two tests in this file and both are very simple and I know they will pass, in a real project these would need to be written in a way so that they would help prevent errors.

Step 2: Create a WinCC OA Web Server for Jenkins to hook into

We need some way for Jenkins to integrate into WinCC OA and a webhook is the easiest way to accomplish this.  The following script will start a web server, make a single endpoint available, create an instance of the TstUnitTestDemo class from before, runs the two tests, and return a result.

Step 3: Add your server to your console

The easiest way to do this is to drag the file onto the Console and it will automatically add it.  Make sure that you start the Control Manager.

Step 4: Update your Jenkins file

This Jenkins file has a little bit of logic in it mostly checking if the tests from WinCC OA pass or fail and if they do pass to run a git pull command.

Step 5: Set up a development environment

This is a little bit of a chore because not every file is stored in the Git repository, however, what worked for me was to copy the project to a different computer, deleting the .git folder, git cloning my repository, and then copying those files into my project.  Git cloning will link your repository to your local project.

Step 6: Makes changes and push them to the repository

If everything is set up correctly when you make a push to your git repository Jenkins will recognize the change and execute your scripts. After Jenkins has run the scripts, if you look at your production system you will notice the changes to Scripts or Panels are now live on your production server.

Note(s) and Limitations

This set up is very limiting but exposes the power of these tools working together.  I would also connect something like Slack to your Jenkins to notify your other developers that changes have been made.  Also, this type of Continuous Delivery is only as good as the guidelines in your development team’s practices. If the team is lax on the Unit Tests this will not do you much good.  Another thing to keep in mind is that the git version control set up inside of WinCC OA is built to track changes in panels, pictures, and scripts.

Read More

DevOps: Integrating Jenkins into WinCC OA

By Calvin Hamus | 02/04/2020
Featured in ,

Over the past few weeks, we have been showing how to use DevOps practices and tools inside of WinCC OA. If you are new to this DevOps series of posts, feel free to check out these additional blogs:

What is DevOps?
DevOps: 6 Steps to Integrate Git into WinCC OA
Is TDD the Future of MES/SCADA Development?
DevOps: High-Speed Programming Unit Tests

Today we will take a big step further and integrate Jenkins into the development process. This tutorial expects you to have a few things setup and to understand a few others:

Step 1: Setup Jenkins to Connect to GitHub

The first thing you will need to do is generate a token for Jenkins to use. To do this, you will need to navigate to GitHub to generate a token at https://github.com/settings/tokens/. Create a new token and give it the rights (at minimum) to read the repository.

Once you have completed this setup, you will get a key that looks like this one:

Do not lose this key. You will not be able to get it again.

Step 2: Connect Jenkins to GitHub

Next, you will need to go into your Jenkins server and allow communication from Jenkins to GitHub. Inside the credentials options, you will need to add two new global credentials. One will be a Secret text and the other will be a Username and password.

For the Secret text credential, place the generated key from GitHub into the Secret input field and give it an ID of GitHubToken and hit OK.

Now complete this process again, but this time make it a Username with a password. In this one, you will enter your GitHub username and password.

Once this is done, restart your Jenkins server. Finally, we will establish a connection between GitHub and Jenkins. Click the Configure System from the Manage Jenkins menu option.

Scroll down the screen and find the GitHub server option. Select the Add GitHub Server dropdown, give it a name, and select the GitHubToken we created earlier.

Test the connection and then click Save on the bottom of the page.

Step 3: HTTP Request Plugin

We will be using REST calls to communicate with our WinCC OA instance. Adding in the HTTP Request Plugin makes it very easy to do this. Navigate back to the Manage Jenkins screen and click the Manage Plugins link.

Click on the Available tab and search for HTTP Request Plugin. I already have it installed so I am on the Installed tab.

Step 4: Open WinCC OA and Create a Server to Hook into Jenkins

For ease of use, a file will be included to make this step easier. What UnitTestServer.ctl does is creates a simple HTTP server inside of WinCC OA and open an endpoint for Jenkins to hit. The startTestsRecursive() function is a built-in WinCC OA function that is used to run the Unit Testing for the High-Speed Programming module. One note is that you will need to change the directory in the startTests() function to your own project name where your tests live.

You can download the file here: UnitTestServer.ctl

Next, take this script and add it to your WinCC OA console so it can be started.

If you are successful you should get the following message from the WinCC OA Log Viewer.

Step 5: Make a Jenkinsfile

In your Git repo make a new file called Jenkinsfile. It cannot have an extension. Place it at the same level as your .git folder. I make my Jenkins with two commands that do the exact same thing, but gives an example of how different things can be done at different build processes. Below is the code for a base Jenkinsfile.

Step 6: Create your Jenkins Pipeline

From your Jenkins server select New Item, then select MultiBranch Pipeline on the next screen.

Inside the Pipeline configuration, add the Branch Source GitHub. Select the credential dropdown to be your GitHub login credentials and enter in the repository that you added the Jenkinsfile to int he URL field.

Finally, change your Scan Multibranch Pipeline Triggers to run periodically and click Save at the bottom of the page.

Step 7: Make a Change and Test it Out

With both the Jenkins Pipeline and the UnitTestServer.ctl in WinCC OA running, make a change in your project and push the changes to your GitHub repo. In Jenkins you will see something like this:

In WinCC OA your Log Viewer will show this:

Final Thoughts

This is a simple example and one of the many things that can be done with WinCC Open Architecture, Git, and Jenkins. There are possible ways to streamline this even more with additional plugins and other ways to accomplish the exact same result. Think of this as a starting block that you can use to automate your process even more.

Read More

WinCC OA: Setting up Chronograf with InfluxDB

By Calvin Hamus | 01/16/2020
Featured in

With the release of WinCC OA 3.17, one of the newest and biggest changes is the addition of the NextGen Archiver.  The NextGen Archiver runs on an InfluxDB database and is a great way to store your data.  InfluxDB is one of the fastest-growing time-series databases in the market, which means there are already some fantastic tools that can be used to visualize your data coming out of WinCC OA.  The tool we are going to show today is Chronograf.  Chronograf is the user interface for stand-alone instances of InfluxDB, but can also be used inside of OA.

Note: This tutorial is being done on a Windows machine, if you are using a Mac or Linux the steps may be a bit different.

Step 1

Create a new project inside of WinCC OA. Choose any type of project you want, I used “Legacy”, but make sure you choose the Use NextGenArchiver checkbox.

Step 2

Go to https://portal.influxdata.com/downloads/ and download the latest stable build of Chronograf, currently v1.7.17.

Step 3

Take the two .exe files that get downloaded, place them in a drive that is easy to find and remember, I use C:\Chronograf.  The chronograf.exe will need to be used to start up the server.  Double click the chronograf.exe file to start up the server or you can use the script: DebugN(system(“C:\\Chronograf\\chronograf.exe”)); on an Initialize function, or where you would like to launch the server inside of OA.  The inside of OA option only works if you run the project as an Administrator.

Step 4

Once the Chronograf server is running you can open up a web browser and navigate to http://localhost:8888.

Step 5

Click get started to get to this screen.  Enter in a Connection URL of http://localhost:8086 (this is the default if you changed it update this field).  The username is etm with a password of etm#123 (again this is the default).  Enter a Telegraf DB if you would like.

Step 6

You can press the Skip button on the next two screens.  If everything worked, you should have something like the below image.  You can now use Chronograf to explore your data from inside WinCC OA to visualize it in any way you can think of.

Bonus

Chronograf is a web-based tool we can directly embed it into OA using a WebView object.

About WinCC OA

SIMATIC WinCC OA (OA) is a powerful, flexible, and diverse SCADA/HMI/MES/IIoT platform used to control and monitor industrial applications. The object-oriented platform is able to handle network complexity with ease, allowing for anywhere from 2 to 2,048 distributed control systems to be connected on a single network. Highly customizable, each individual system can be calibrated as a redundant or non-redundant, single, or multi-user system. The software supports a number of device connectivity options that include but not limited to Siemens, Rockwell, Schneider Electric, OPC/OPC UA Standards, MQTT, Web Services, Node-RED, and allows for customized distributions and branding, making it a great platform for software OEMs in addition to end-users.

About InfluxDB

InfluxData, the creators of InfluxDB, delivers a modern Open Source Platform built from the ground up for analyzing metrics and events (time-series data) for DevOps and IoT applications. Whether the data comes from humans, sensors, or machines, InfluxData empowers developers to build next-generation monitoring, analytics, and IoT applications faster, easier, and to scale delivering real business value quickly. Based in San Francisco, InfluxData customers include AutodeskCiscoeBay, and Coupa. Visit https://www.influxdata.com/. Twitter: @influxdb.

Read More

IIoT | Edge: WinCC OA now Supports Node-RED

By Shawn Sandoval | 01/14/2020
Featured in , ,

Inside of WinCC OA version 3.17, Node-RED is natively supported. This is important because this furthers the evolution of Siemens WinCC OA platform to support the ever-growing IIoT device market. To be concise, Node-RED will allow WinCC OA to communicate with an exponential number of sensors and devices directly.

In the WinCC OA graphical editor, you can access Node-RED via the drop-down Tools menu.

This will launch the Node-RED editor. From there you can start working with Node-RED.

WinCC OA Nodes

The WinCC OA installation of the Node-RED application contains proprietary WinCC OA nodes. They work similarly to the corresponding functions in WinCC OA. Here is an example:

Contact us if you would like more details about this feature or leave a comment below. Have fun building with this new tool!

About WinCC OA

SIMATIC WinCC OA (OA) is a powerful, flexible and diverse SCADA/HMI/MES/IIoT platform used to control and monitor industrial applications. The object-oriented platform is able to handle network complexity with ease, allowing for anywhere from 2 to 2,048 distributed control systems to be connected on a single network. Highly customizable, each individual system can be calibrated as a redundant or non-redundant, single, or multi-user system. The software supports a number of device connectivity options that include but not limited to Siemens, Rockwell, Schneider Electric, OPC/OPC UA Standards, MQTT, Web Services, Node-RED, and allows for customized distributions and branding, making it a great platform for software OEMs in addition to end-users.

About Node-RED

From the Node-RED website: Node-RED is a programming tool for wiring together hardware devices, APIs and online services. Primarily, it is a visual tool designed for the Internet of Things, but it can also be used for other applications to very quickly assemble flows of various services.

Node-RED is open-source and was originally created by the IBM Emerging Technology organization. It is included in IBM’s Bluemix (a Platform-as-a-Service or PaaS) IoT starter application package. Node-RED can also be deployed separately using the Node.js application. At present, Node-RED is a JS Foundation project. You can learn more by visiting their site directly @ https://nodered.org/

Read More

WinCC OA: Patch Release 14

By KAASM | 09/27/2019
Featured in ,

Siemens ETM has released V3.16 P14.

Read More

WinCC OA: How to Add Rulers to the Trend Object

By KAASM | 09/05/2019
Featured in

Part of working with an open platform is being able to change or enhance out of the box functionality to meet your needs. This short tutorial will introduce and show you how to add a ruler to WinCC OA.

The WinCC OA trend tool comes with a number of out of the box functions. We will add the following attribute “maxRulerCount” to the WinCC OA trend tool. This attribute specifies how many rulers per trend area can be used. Rulers can be helpful to mark a value(s) and compare the differences over time. To add a ruler to the trend object, copy and paste the following initialize script as seen in the screenshots below.

This attribute comes with the following parameters:

  • area
  • count

“area” is the name of the trend area and “count” is the maximum number of rulers.

Main()
{
    TREND1.maxRulerCount  (0,7);
}

In the following example, the maximum number of available rulers for trend area 0 will be set to 7.

Read More
WinCC OA AEScreen

WinCC OA: How to Change “Came” and “Went” Alert Text

By Shawn Sandoval | 08/15/2019
Featured in

The texts for the alarm direction are defined in the WinCC OA message catalog sc.cat, the keywords are “entered” for the CAME-text and “left” for the WENT-text. If you would like to translate or change the texts which are shown in the AEScreen for the alert direction you have to perform the following steps:

Step 1

Copy the file sc.cat to the language-dependent msg-directory in your WinCC OA project. This file is available with the texts in German, English, and Russian languages. You can find the file here: C:\Siemens\Automation\WinCC_OA\<WinCCOA version>\msg\en_US.utf8


WinCC OA Project Folder

Step 2

Open the file with a text editor.

WinCC OA text editor

Step 3

Change the text for the keywords “entered” and “left”. Verify the change by opening up your AEScreen GEDI\system management\Alarm and Event Screen.

WinCC OA sc.cat file
WinCC OA Verify Text Change

Read More

WinCC OA: Simulator Objects

By Shawn Sandoval | 07/17/2019
Featured in

When developing an HMI/SCADA application, sometimes you may not have access to data sources (i.e. PLC, sensors) however, you still have the need to test your io datapoint connections. In this blog post, I will quickly show you how to set up a WinCC OA Simulator Object. The simulators generate different curve shapes and can, for example, send values for testing purposes instead of a PLC.

Step 1

In the Graphical Editor (GEDI), make sure “Catalog for All Objects” is selected. This will add a panel with a bunch of pre-built objects.

Step 2

Create or use an existing panel and select the data point you would like to simulate. In this example, I created a new panel, added a trend widget, and selected the datapoint that I wanted to simulate.

Step 3

Navigate to “STD_SIMULATORS” located in your catalog of objects. Select the “RandSim” simulation object and add it to your panel. 

Step 4

Save the panel and quick test.

This is a simple exercise to help with awareness of the simulator tools. Learn more about the simulator objects via the WinCC OA online help chapter Graphics editor (GEDI) > STD_symbols > STD_SIMULATORS.

Read More