Recently i implemented a JAVA API for WinCC Open Architecture. So, it is possible to implement WinCC OA API Manager in Java. I used this to implement a simple API Manager in Java to connect WinCC OA to MQTT.
MQTT is a machine-to-machine (M2M) “Internet of Things” connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium (http://mqtt.org/).
The example is connected to a WinCC OA datapoint in system 1, sends incoming values through MQTT to HiveMQ (http://www.hivemq.com/try-out/, there is a public available MQTT broker for testing available). Another Java API Manager is subscribed to the MQTT broker, receives the values changes by MQTT and sets it to the WinCC OA system 2…
With a Java-Datalogger we can write events and alerts to different data sinks. For example we can use ElasticSearch and Kibana to discover alerts collected by WinCC OA. Elasticsearch provides full text search, analytics, dashboards. And now it also supports graphs!
“Graph introduces a new way to discover, and explore, the relationships that live in your data. Adding relevance to the process of exploration, a unique combination of graph and search means you can do things like detect fraud, recommend content, and more.” https://www.elastic.co/de/products/graph
Did a first test with Cassandra as NoSQL database store for WinCC OA event logging.
Cassandra was easy to install, pretty good write performance and very good read performance. Compared to e.g. OpenTSDB the CPU load on client and server are higher.
Test-Setup: 5000 values/second, 24h, 392 Mil.Records, One Hyper-V server on an i7 3.1Ghz with 4 Cassandra nodes, each node with two cores, disks on a shared storage space device with 4 disks and raid 0 (i know that’s not a real life scenario for a NoSQL cluster). WinCC OA and the Java-Historian-DB-Logger running on another Hyper-V server on an old i5 CPU 750 @ 2.67 Ghz.
Cassandra Performance Stats
I have implemented a Database Logger for WinCC OA which supports different databases.
I did now a first test to compare some databases with WinCC OA and time series logging.
The logger is writing 1000 values/second to four databases in parallel: MSSQL Server, InfluxDB, Phoenix (based on Hadoop/HBase) and Oracle.
There are now about 160.000.000 values in each database. About 3.600.000 values are added every hour…
Four Ctrl-Scripts are querying data with dpGetPeriod every 10 seconds, random time frames (between 1 and 2 hours of data).
Oracle seems to be slower (i think this is related to my test environment), but the access and response times are stable with growing amount of data in the database.
remark: at 10pm the Oracle DB backup starts.
On a Mac install the Docker Toolbox.
And click on the “DOCKER CLI”
The type: docker run -d -p 3000:3000 –name oa1 vogler/winccoa:influxdb startup
Afterwards you will see your new container and at the preview you can already see the Grafana dashboard, click on it and it will open in your browser.
You have now a running WinCC OA system which is logging some datapoints to the InfluxDB. There is a simple simulation script running which will set random values to Drive1.*
To open the GEDI you have to go to the DOCKER CLI again and type:
bash-3.2$ docker exec -ti oa1 /bin/bash
You now have a bash in the WinCC OA Container. Set the DISPLAY variable to your client (mac). You need a X-Windows-Server on your client (and allow clients to open windows with “xhost +”). At the Mac you may use xquartz: http://www.xquartz.org
dba3d5e6193f:/ # export DISPLAY=macbookpro:0
dba3d5e6193f:/ # gedi &
or type “console”, it will open the WinCC OA Console.
The NoSQL Logger’s configuration file is: /proj/NoSQL/config/config.logger
There you can set the query part of what you wanna log into the InfluxDB. You can specify the FROM clause of a WinCC OA query, also remote queries are possible (if you connect another OA system to this system (distributed system)).
Then you have to restart the NoSQL Database Logger – it is the WCCOAjava program you see in the console. Right, it is implemented in Java with a native API to WinCC OA.
Grafana can be used to create dashboards in a fast and easy way…
Forwarding events from WinCC OA to OpenTSDB, which is based on HBase. Based on OpenTSDB Grafan can be used to build cool dashboards in a very fast way.
Live Example (my photovoltaic data) : http://188.8.131.52/grafana
On my test environment (i7 with 32gb RAM and 8 threads) i was able to push about 20000(!) values per second from my WinCC OA system to my Hadoop/HBase cluster. WinCC OA and the Hadoop Cluster are running on Hyper-V.