To learn how deep learning works I decided to implement a Multilayer Neural Network with Backpropagation by my own in Clojure (I did NOT use a library like Tensor Flow or Deeplearning4j). The link between Clojure and the SCADA system WinCC OA is oa4j. With that connection the Neural Network can be used and trained with sensor data collected by the SCADA system …
Category Archives: Allgemein
Clojure connected to WinCC OA…
Because Clojure is a JVM language, oa4j can be used to connect to WinCC Open Architecture.
(def manager (new JManager)) (defn callback [values] (let [v (reduce #(+ %1 %2) (map #(.getValueObject %) values))]; (dpSet :ExampleDP_Trend1. v))) (defn -main [& args] (.init manager (into-array args)) (.start manager) (dpSet {:ExampleDP_Arg1. 2.0 :ExampleDP_Arg2. 3.0}) (println (clojure.string/join "," (dpGet [:ExampleDP_Arg1. :ExampleDP_Arg2.]))) (let [c (dpConnect [:ExampleDP_Arg1. :ExampleDP_Arg2.] callback)] (Thread/sleep 180000) (.disconnect c)) (.stop manager))
Full example can be found here.
WinCC OA on Docker…
Here you will find Dockerfiles for WinCC OA: https://github.com/vogler75/winccoa-images
Matrix Multiplication in Clojure…
Clojure code for matrix multiplication (source: Rosetta Code) … short & smart…
(def mmul (fn [a b] (let [nested-for (fn [f x y] (map (fn [a] (map (fn [b] (f a b)) y)) x)) transpose (fn [m] (apply map vector m))] (nested-for (fn [x y] (reduce + (map * x y))) a (transpose b))))) (def ma [[1 2 3 4] [4 3 2 1]]) (def mb [[1] [2] [3] [4]]) (defn -main [& args] (println (mmul ma mb)))
Siemens IoT2000 and WinCC OA….
Got an IoT2040 from Siemens. It is Arduino compatible and runs on Yocto Linux. ETM managed to compile the SCADA System WinCC Open Architecture on it, additionally we used a MQTT server (mosquitto), Node-Red with MQTT, and a MQTT Driver for WinCC OA written in Java… runs well. Just connected a simple LED and a Button with Node-Red, those can now be controlled by WinCC OA. Because WinCC OA runs on it, it can be used to connect a wide range of different devices (a lot of drivers are available for WinCC OA).
Perfect as an Edge device to collect data from the field… Industrial IoT with Siemens!
Talk to WinCC OA Scada System with Amazon Alexa…
Created a Alexa Skill in the Amazon Cloud, connected it to an endpoint which is a WinCC OA Control Manager and let it control devices which are connected to the Scada system with natural speech…
Azure NoSQL DocumentDB Cloud Logging with WinCC OA…
DocumentDB : “NoSQL service for highly available, globally distributed apps—take full advantage of SQL and JavaScript over document and key-value data without the hassles of on-premises or virtual machine-based cloud database options.”
Microsofts DocumentDB supports the MongoDB protocol, so it is possible to write values from WinCC OA to the Azure Cloud with a MongoDB Database Logger.
WinCC OA for Java (oa4j)
is now available at GitHub: https://github.com/vogler75/oa4j
Observing WinCC OA Logs with Elasticsearch and Logstash…
With Logstash we can collect the logs of WinCC OA systems and write it to Elasticsearch. Multiple WinCC OA system’s can be observed with a central log database…
With Kibana the logs can be easily discovered – I now see errors what i haven’t seen before in my system…
In parallel the log messages are written to Apache Kafka. With Apache Spark we can now observe the log streams and detect anomalies… a very simple observation could be to just simple count the amount of log messages per timeframe …
WinCC OA logstash configuration file: winccoa-logstash-conf
WinCC OA connected to Apache Kafka…
A WinCC OA Driver to connect WinCC OA to Apache Kafka (input & output).
Available on Github https://github.com/vogler75/oa4j