wissensbasierte Steuerungen in der Industrie

The advent of Industry 4.0 has brought about a seismic shift in how industries operate, with a particular emphasis on automation, data exchange, and manufacturing technologies. Central to this revolution is the concept of knowledge-based controllers, which leverage the power of artificial intelligence (AI) and machine learning (ML) to enhance decision-making processes and operational efficiency. This blog delves into the essence of knowledge-based controllers within the industrial context, highlighting key findings from systematic reviews and research studies.

The Role of Knowledge-Based Controllers in Industry 4.0

Knowledge-based controllers are systems that utilize knowledge, data, and inference mechanisms to make decisions or control processes. In the context of Industry 4.0, these controllers are pivotal for implementing smart manufacturing and automation processes. They rely on a vast array of data from sensors, machines, and operations to optimize production, reduce downtime, and enhance product quality.

Insights from Recent Research

  1. Integration with Industry 4.0 Technologies: The integration of knowledge management (KM) processes with Industry 4.0 technologies is crucial for leveraging organizational knowledge effectively. A study by Manesh et al. (2021) highlights the trends and intellectual structures of KM in Industry 4.0, underscoring the importance of creating, sharing, and applying knowledge in an interconnected and data-driven environment (Manesh et al., 2021).
  2. Software Architecture and Knowledge-Based Approaches: Li, Liang, and Avgeriou (2013) explore the application of knowledge-based approaches in software architecture, revealing how knowledge management technologies facilitate architectural evaluation and decision-making processes. This underscores the adaptability of knowledge-based systems across different applications, including software development in industrial settings (Li, Liang, & Avgeriou, 2013).
  3. Managerial Challenges and Industry 4.0: Schneider (2018) discusses the managerial challenges posed by Industry 4.0 and proposes a research agenda focused on strategy, planning, cooperation, business models, human resources, and leadership. Knowledge-based controllers are implicit in addressing these challenges by providing data-driven insights for strategic decision-making (Schneider, 2018).
  4. Knowledge Sharing in Global Software Development: Anwar, Rehman, Wang, and Hashmani (2019) emphasize the importance of knowledge sharing in global software development organizations, highlighting barriers and facilitators. Knowledge-based controllers can play a significant role in overcoming these barriers, promoting a culture of knowledge sharing and collaboration (Anwar et al., 2019).

Challenges and Future Directions

  • Data Quality and Integration: Ensuring high-quality, actionable data is integrated seamlessly into knowledge-based systems remains a challenge. Future research should focus on data normalization, validation, and real-time processing techniques.
  • Customization and Scalability: Customizing knowledge-based controllers to fit specific industrial needs while maintaining scalability is crucial. Research should explore modular, adaptable frameworks that can evolve with changing industry requirements.
  • Ethical and Security Considerations: As knowledge-based systems become more autonomous, ethical considerations and security measures must be prioritized. Future developments should incorporate robust security protocols and ethical guidelines to govern AI decision-making processes.
  • Interdisciplinary Collaboration: The development of knowledge-based controllers requires collaboration across disciplines, including AI, engineering, data science, and domain-specific knowledge. Interdisciplinary research teams can drive innovation and ensure that systems are both technically sound and practically relevant.

Conclusion

Knowledge-based controllers represent a cornerstone of the Industry 4.0 revolution, offering unparalleled opportunities for enhancing industrial operations through intelligent decision-making and process control. As the field continues to evolve, focused research and collaboration across disciplines will be vital in overcoming existing challenges and unlocking the full potential of these systems.

Anwendung von „Pipes“ in Python

Pipes sind ein sehr praktisches Mittel, wenn man in Python mehrere unabhängige Prozesse (mit der multiprocessing-Bibliothek) miteinander kommunizieren lassen will.

Das Beispiel besteht aus einem Control-Process, der in Abhängigkeit von Sensordaten irgendwas regeln oder schalten soll. Die Sensordaten werden dabei von einem anderem Prozess (getSensorData) aquiriert. In unserem Fall werden Zufallszahlen im Bereich von 0..99 erzeugt, um Sensordaten zu simulieren. Dieser Prozess wird von dem Controlprozess gestartet, dabei wird auch der Name der Verbindung übergeben. Eine Pipe ist eine Verbindung in nur eine Richtung, sie hat einen Eingang (hier child_conn) und einen“Ausgang“, hier parent_conn. Sie kann nur 2 Prozesse verbinden. Sollen die Daten an mehrere Unterprozesse verteilt werden, muss man „Queue“, ebenfalls aus der bibliothek „multiprocessing“ verwenden.

In dem vorliegenden Beispiel werden die Daten verzögert abgefragt, dies soll die Pufferung der Daten durch die Pipe demonstrieren.

Hier kommt schon mal der lauffähige Quelltext (Python 3.6)

from multiprocessing import Process, Pipe, current_process

from datetime import datetime
import time, random

dta1 = 1

def getSensorData(conn,dta1):
    print("getsensorData gerufen")
    ctr = 0
    while ctr < 10:
        timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        #print("time: ",timestamp)
        time.sleep(1.5)
        dta_1 = random.randint(0,99)
        dta_2 = random.randint(0,99)
        dta_3 = random.randint(0,99)
        conn.send([timestamp, dta_1,dta_2, dta_3])
        ctr += 1

def Control_Proc():
    p = current_process()
    print('Starting:', p.name, p.pid)
    parent_conn, child_conn = Pipe()
    ptemp = Process(name="getSensorData", target=getSensorData,\
    args=(child_conn,dta1))
    ptemp.daemon = True
    ptemp.start()

    while(True):
        while parent_conn.poll():
            timestamp, data_01,data_02, data_03 \
            = parent_conn.recv()
            print(timestamp, " data01: ",data_01, "data_02: "\
            ,data_02, "data_03: ",data_03)
            time.sleep(5)


if __name__ == '__main__':
    Control_Proc()

so sieht das Ergebnis im Entwicklungssystem aus.

Diesen Code findet Ihr auch wieder auf Github:

https://github.com/Rellin-Entwicklung/Piping-Demos/blob/master/Piping_demo.py

optische Füllstandserkennung mittels preiswerter Kamera

An einigen Stelle ist es schwierig, mittels spezieller Füllstandsensorik den Füllstand eines Mediums zu erfassen.

Hat man den freien Blick auf das Medium (z.B.) Glasbehälter, bietet sich hier der Einsatz einer preiswerten Kamera und beispielsweise eines Raspberry-Kleincomputers an.

Mittels der Open Source Bibliothek „Open CV“ (hier in der Version 3) ist ein spezielles Programm schnell erstellt.

Das folgende Bild zeigt den Versuchsaufbau: Eine Glasgefäß ist mit einem Medium gefüllt, welches sich vom Hintergrund abhebt

Im ersten wird von der Webcam ein Foto des Aufbaus aufgenommen.

Dann wird zunächst der eigentlich interessierende Bereich des Bildes ausgewählt.

Im nächsten Schritt wird der interessiende Bereich ausgeschnitten und in ein Graubild gewandelt.

Dann folgt ein Threshold-Prozess, der nur 2 Farben nämlich weiß und schwarz, übrig lässt.

Zählt man jetzt die Pixel, hat man ein Maß für den Füllstand das Problem ist gelöst….

Live-Bild einer Webcam anzeigen mit Python und OpenCV

Ist OpenCV erst einmal auf dem Test-System installiert, hat man unzählige Möglichkeiten, mit Bildern aus welchen Quellen auch immer, zu arbeiten.

Eine Grundaufgabe ist es oft, einfach das Bild einer Webcam auf dem Bildschirm darzustellen

Hierfür habe ich auf Github  https://gist.github.com/tedmiston/6060034 eine elegante Lösung gefunden, die ich Euch hiermit gerne vortstelle. (Vielen Dank an Taylor D. Edmiston)

Vielen Dank an geralt https://pixabay.com/de/tablet-technologie-vorf%C3%BChrung-1704813/  für das Bild zum vorliegenden Beitrag

das lauffähige Python 3.65 / OpenCV3.x Code-Snippet zum Anzeigen des Bildes auf dem Monitor

Interesant in diesem Zusammenhang ist die Rolle von cv2.waitkey(x). Während cv2.waitkey(0) nach jedem angezeigtem Bild auf eine Eingabe wartet, bewirkt jedes andere Argument hier eine flüssige Darstellung des Streams.

import cv2

cam = cv2.VideoCapture(0)
while True:
     ret_val, img = cam.read()
     img = cv2.flip(img, 1)
     cv2.imshow('my webcam', img)
     if cv2.waitKey(1) == 27:
          break  # esc to quit
cv2.destroyAllWindows()

Die Funktion „Webcam Lesen) zum Einbinden in eigene Projekte

"""
Simply display the contents of the webcam with optional 
mirroring using OpenCV 
via the new Pythonic cv2 interface.  Press <esc> to quit.
"""

import cv2


def show_webcam(mirror=False):
    cam = cv2.VideoCapture(0)
while True:
     ret_val, img = cam.read()
     if mirror: 
         img = cv2.flip(img, 1)
     cv2.imshow('my webcam', img)
     if cv2.waitKey(1) == 27: 
          break  # esc to quit
cv2.destroyAllWindows()


def main():
    show_webcam(mirror=True)


if __name__ == '__main__':
    main()

Webcam – Bewegungserkennung mit Python und OpenCV

Wenn man mit einer Webcam eine Szenerie beobachtet, macht es oft Sinn, zu wissen, ob sich irgend etwas in dieser Szenerie tut, also bewegt. Man kann z.B. nach Detektion einer Bewegung ein Bild abspeichern, eine Nachricht absetzen oder weitere Bildanalysen starten. Die Webcam wird also durch ein paar Zeilen Python-Code zu einem Bewegungsmelder, der nach meinen Erfahrungen den Vergleich mit einem passiv-Infrarot – Detektor (Piri, herkömmlicher Bewegungsmelder) nicht scheuen braucht.

In diesem Beitrag will ich Euch ein Code-Snippet für eine lauffähige Lösung vorstellen, die nach Detektion einer Bewegung ein Bild abspeichert. Die Empfindlichkeit der Unterscheidung, ob eine Bewegung erfolgt ist, ist dabei frei wählbar

Das unter Python 3.6 /OpenCV 3.4 lauffähige Code-Snippet für Bewegungserkennung mittels Webcam:

import cv2
import datetime

def diffImg(t0, t1, t2):
    d1 = cv2.absdiff(t2, t1)
    d2 = cv2.absdiff(t1, t0)
    return cv2.bitwise_and(d1, d2)

folder="BV"
message_01 = "not yet"
message_02= "not yet"
cam = cv2.VideoCapture(0)
cam.set(3,1280)
cam.set(4,720)

winName = "Bewegungserkennung"

font = "FONT_HERSHEY_SIMPLEX"
#cv2.namedWindow(winName, cv2.CV_WINDOW_AUTOSIZE)
# Read three images first:

return_value, image = cam.read()
t_minus = cv2.cvtColor(cam.read()[1], cv2.COLOR_RGB2GRAY)

t = cv2.cvtColor(cam.read()[1], cv2.COLOR_RGB2GRAY)

t_plus = cv2.cvtColor(cam.read()[1], cv2.COLOR_RGB2GRAY)

Durchschnitt = 1
n=1


while True:

    t_minus = t

    t = t_plus

    t_plus = cv2.cvtColor(cam.read()[1], cv2.COLOR_RGB2GRAY)
    result_image = diffImg(t_minus, t, t_plus)
    cv2.putText(result_image, 'OpenCV', (100, 500), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), thickness=2)
    cv2.putText(result_image, message_01, (100, 550), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), thickness=2)
    cv2.putText(result_image, "Stop with <ESC> ",(100, 600), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), thickness=2)
    cv2.imshow(winName, result_image)

    print (cv2.countNonZero(diffImg(t_minus, t, t_plus)))

    if cv2.countNonZero(diffImg(t_minus, t, t_plus)) > 305000:
        return_value, image = cam.read()
        # cv2.imwrite("buero" + str(n) + ".png", image)
        cv2.imwrite("{0}/{1:%d%b%Y_%H_%M_%S.%f}.png".format(
            folder, datetime.datetime.utcnow()), image)
        message_01 = str(n) + "  pictures saved"
        n= n+1

    key = cv2.waitKey(10)

    if key == 27:
        cam.release
        cv2.destroyWindow(winName)
        break

Das Ergebnis: Differenzbild wird angezeigt, solange Bewegung stattfindet werden Fotos abgespeichert. Auch die Anzahl der gespeicherten Fotos wird mitgeteilt.

erlogreicher „Selbstversuch“ – bei Bewegung werden Bilder gespeichert.

Diese Lösung hat sich im praktischen Test (Bewegungsmelder im Büro) als recht robust erwiesen und kommt dank gleitender Hintergrund-Durchschnittsbildung auch mit wechselnden Lichtverhältnissen gut zurecht.

Der Lösungsansatz auf Basis Differenzbilder geht auf Matthias Stein (http://www.steinm.com/blog/motion-detection-webcam-python-opencv-differential-images/) zurück, ich habe einige Anpassungen und Erweiterungen bezüglich meiner Applikation vorgenommen.

Anm: Das Titelbild stammt von: https://pixabay.com/de/person-bewegung-beschleunigen-2146508/, vielen Dank an ATDSPHOTO