

caixiaofeng
Staff group-
Content Count
147 -
Joined
-
Last visited
Content Type
Profiles
Forums
PLC programming technology and HMI interface design Simplified Chinese database
- PLC AND HMI SIMPLIFIED CHINESE ARTICLES
- PLC AND HMI SIMPLIFIED CHINESE ARTICLE Comments
- PLC AND HMI SIMPLIFIED CHINESE ARTICLE Reviews
PLC and HMI Brand Database
- PLC AND HMI BRANDS INTRODUCTIONS
- PLC AND HMI BRAND INTRODUCTION Comments
- PLC AND HMI BRAND INTRODUCTION Reviews
PLC programming technology and HMI interface design English database
- PLC AND HMI ENGLISH ARTICLES
- PLC AND HMI ENGLISH ARTICLE Comments
- PLC AND HMI ENGLISH ARTICLE Reviews
PLC programming technology and HMI interface design Russian database
- PLC AND HMI RUSSIAN ARTICLES
- PLC AND HMI RUSSIAN ARTICLE Comments
- PLC AND HMI RUSSIAN ARTICLE Reviews
Spanish database on PLC programming techniques and HMI interface design
- PLC AND HMI SPANISH ARTICLES
- PLC AND HMI SPANISH ARTICLE Comments
- PLC AND HMI SPANISH ARTICLE Reviews
German database on PLC programming technology and HMI interface design
- PLC AND HMI ARTICLES IN GERMAN
- PLC AND HMI ARTICLE IN GERMAN Comments
- PLC AND HMI ARTICLE IN GERMAN Reviews
Downloads
Store
Gallery
Blogs
Calendar
Videos
Everything posted by caixiaofeng
-
Zweihandsteuerungslogik mit SPS
caixiaofeng posted A plc and hmi article in German in PLC programming learning
In diesem Artikel geht es um die Programmierung einer Zweihandsteuerung, die in der Pressenindustrie verwendet wird. Der Zweck dieses Programms ist die Sicherheit, um tödliche Unfälle zu verhindern. Unten sehen Sie ein Bild, wie die Presse aussieht und warum uns Sicherheit wichtig ist. Wie Sie sehen können, gibt es Druckknöpfe, mit denen die Presse gesteuert wird. Die Mittelplatte wird gegen die Oberfläche des Werkstücks gedrückt, wenn wir die Druckknöpfe drücken. Die beiden Druckknöpfe müssen gleichzeitig gedrückt werden, um die Presse zu bedienen, wie in der folgenden Animation gezeigt. Wenn der Bediener mit einer Hand den Knopf drückt und mit der anderen Hand die Platte gegen die Oberfläche drückt, kann er sich verletzen. Die starke Kraft beim Drücken einer Platte kann leicht die Hände einklemmen, wenn der Bediener versucht, Dinge in Eile zu manövrieren. Unten habe ich das Programm erklärt, das verwendet wird, um solche Vorfälle mithilfe des Siemens TIA Portals zu verhindern. Hier in der folgenden Abbildung ist eine Presse mit zwei Eingängen und einem Ausgang dargestellt. Eingänge sind mit dem digitalen Eingangsmodul (DI) der SPS verbunden und ein einzelner Ausgang ist mit dem digitalen Ausgangsmodul (DO) verbunden. Nachfolgend finden Sie eine Liste der für das Programm verwendeten Ein- und Ausgänge. Eingänge: Druckknopf (PB_1): I0.0 Druckknopf (PB_2): I0.2 Ausgänge: Druckmaschinenausgang: Q0.0 Zweihandsteuerungslogik Logikbeschreibung Netzwerk 1: Hier sind zwei Druckknöpfe PB_1 und PB_2 in Reihe geschaltet. Wenn beide Druckknöpfe gleichzeitig gedrückt werden, wird das Signal durch den NC-Kontakt des Timers T0 geleitet und aktiviert den Ausgang. Netzwerk 2: Wenn nun ein einzelner Druckknopf, entweder PB_1 oder PB_2, gedrückt wird, wird der Einschaltverzögerungstimer (S_ODT) des Timers T0 aktiviert, hier in unserem Fall nach 5 Sekunden. Hier wird der NC-Kontakt des Ausgangs der Presse auch nach dem Druckknopf verwendet, denn wenn der Ausgang eingeschaltet ist, kann der Timer nicht aktiviert werden. Der Ausgang der Maschine wird also nur aktiviert, wenn beide Knöpfe gleichzeitig gedrückt werden. -
Steuerung mehrerer Pumpen mit SPS
caixiaofeng posted A plc and hmi article in German in PLC programming learning
Schreiben Sie das SPS-Programm zur Steuerung mehrerer Pumpen mit speicherprogrammierbaren Steuerungen. Wir haben zwei Eingangspumpen, die zum Füllen eines Tanks verwendet werden. Stellen Sie sicher, dass die Pumpen während ihrer Lebensdauer gleich lange laufen. Steuerung mehrerer Pumpen mit SPS Programmlogik: Entwickeln Sie ein Kontaktplanlogikprogramm gemäß der unten angegebenen Logik. Der Start-/Stopp-Druckknopf dient zur Steuerung der beiden Eingangspumpenmotoren P1 und P2. Die Start-/Stopp-Druckknopfstation wird betätigt, um Pumpe P1 zu steuern. Wenn der Tank voll ist, wird der Ablasspumpenmotor P3 automatisch gestartet und läuft, bis der Niedrigstandsensor betätigt wird. Nach dreimaligem Füllen des Tanks durch Pumpe P1 wechselt die Steuerung automatisch zu Pumpe P2. Die Betätigung des Start-/Stopp-Druckknopfs steuert jetzt Pumpe P2. Nach dreimaligem Füllen des Tanks durch Pumpe P2 wird die Sequenz wiederholt. SPS-Programm: Programmbeschreibung: Sprosse 0000: Start/Stop PB mit Speicher B3:0/0 verriegelt. Sprosse 0001: B3:0/0 aktiviert, um B3:0/1 einzuschalten, was bedeutet, dass PUMPE P1 (O:0/0) eingeschaltet wird, wenn der Niedrigpegelsensor (I:0/3) eingeschaltet wird und der Hochpegelsensor (I:0/2) ausgeschaltet ist. B3:0/1 ist mit dem Niedrigpegelsensor verriegelt, da Pumpe P1 nicht abgeschaltet werden sollte, sobald das Wasser zu steigen beginnt. Sprosse 0002: Speicherkontakte werden verwendet, um PUMPE P1 (O: 0/0) mit Zähler (C5:0) einzuschalten. Da wir den Pumpenbetrieb von P1 auf P2 verschieben werden, werden zwei Zähler verwendet, um zwischen Pl und P2 zu wechseln. Zähler C5:1 wird verwendet, um PUMPE P2 (O:0/2) einzuschalten. Sprosse 0003 & 0004: B3:0/0 aktiviert, um B3:0/2 einzuschalten, was PUMPE P3 (O:0/1) einschaltet, wenn der Hochpegelsensor (I:0/2) eingeschaltet wird und der Niedrigpegelsensor (I:0/3) ausgeschaltet ist. B3:0/2 ist mit dem Hochpegelsensor verriegelt, da Pumpe P3 nicht ausgeschaltet werden sollte, sobald der Wasserstand zu sinken beginnt. Sprosse 0005: Wenn Pumpe 3 (O: 0/1) läuft, schaltet der Niedrigpegelsensor ein, wodurch Pumpe P3 ausgeschaltet und Pumpe P1 (O:0/0) eingeschaltet wird. Sprosse 0006: Beide Zähler werden zurückgesetzt, sobald das Fertigbit des zweiten Zählers (C5:1) eingeschaltet wird. Fazit: Wir können dieses Beispiel verwenden, um die Programmierlogik in AB PLC zu verstehen. -
So steuern Sie VFD mit PLC unter Verwendung von Ladder Logic
caixiaofeng posted A plc and hmi article in German in PLC programming learning
Dies ist ein vollständiges Tutorial über PLC Ladder Logic zur Steuerung von Frequenzumrichtern (VFD) zur Motordrehzahlregelung mit Drehzahlauswahl über das lokale Feldbedienfeld oder SCADA-Grafiken. Ausführungsschritte: Erstellen Sie eine Steuerungs- und Leistungszeichnung Inbetriebnahme und Parameterprogrammierung in VFD Erstellen Sie ein PLC-Programm Erstellen Sie ein SCADA-Design Wie steuern Sie VFD mit SPS? Steuerungs- und Leistungsdiagramm Inbetriebnahme und Parameterprogrammierung in VFD Die Inbetriebnahme ist für die ordnungsgemäße Funktion von VFD erforderlich. Erforderliche Parameter wie Motortypenschilddetails, Eingangsspannung, Motortyp und Frequenz sollten während der Schnellinbetriebnahme in VFD eingegeben werden. Nach erfolgreicher Schnellinbetriebnahme ist es nun an der Zeit, die erweiterte Inbetriebnahme zu installieren. Diese Inbetriebnahme ist erforderlich, um die Details aller digitalen und analogen Ein- und Ausgänge anzugeben, wie Informationen über digitale Eingänge des Startbefehls und des Geschwindigkeitsauswahlbefehls Informationen über digitale Ausgänge wie den Status des laufenden Antriebs und des Antriebsfehlers usw. Informationen über analoge Eingänge wie Geschwindigkeitseingang 1 und Geschwindigkeitseingang 2 Informationen über analoge Ausgänge wie Strom und Frequenz des Motors SPS-Programm Netzwerk 1: In diesem Netzwerk 1 prüfen wir, ob der VFD startbereit ist. Dieses Signal wird ausgegeben, wenn alle Bedingungen in Ordnung sind und Sicherheits- und Leistungsrückmeldungen aktiv sind. Netzwerk 2: Im Netzwerk 2 wird beim Drücken der Starttaste das VFD Drive_DO-Bit gesetzt, wenn Ready_to_Start und kein Fehler vorliegen. Netzwerk 3: Dies ist die Stopplogik. Wenn die Stopptaste gedrückt wird, wird das Drive_DO-Bit zurückgesetzt. Netzwerk 4: In diesem Netzwerk 4 ist diese Logik aus Sicherheitsgründen erforderlich, sobald das Drive_DO-Bit gesetzt wird und falls der VFD aufgrund eines Fehlers nicht funktioniert, wird nach einer vordefinierten Wartezeit (hier betrachten wir sie als Run_FB_Time) das Drive_DO-Bit zurückgesetzt und ein Fehler generiert. Diesen Fehler können Sie vom SCADA bestätigen, nachdem der Fehler auf der Feldseite behoben wurde. Netzwerk 5: In diesem Netzwerk 5 wird das Drive_DO-Bit zurückgesetzt und ein Fehler generiert, wenn der VFD mehr Strom verbraucht und einen Überlastungsfehler ausgibt. Diesen Fehler können Sie vom SCADA bestätigen, nachdem der Fehler auf der Feldseite behoben wurde. Netzwerk 6: Dies ist der digitale Ausgang zur Drehzahlauswahl. Wenn Sie den Drehzahleingang als lokal auswählen, wird das Drehzahlauswahlbit nicht aktiviert, was zu einem fehlenden Speed_DO führt, und wenn Sie den Drehzahleingang als Remote auswählen, wird das Drehzahlauswahlbit aktiviert, was zu einem vorhandenen Speed_DO führt. SCADA-Design Normalzustand Dies ist der Normalzustand des Motors. Es liegt kein Fehler vor und das Bereit-Bit ist ebenfalls im Normalzustand. Auch die Drehzahlauswahl befindet sich im LOKALEN Modus. Laufzustand Dieser Zustand zeigt an, dass das Bereit-Bit hoch ist und der Motor ohne Fehler läuft. Fehlerzustand Ein Fehler-Bit ist hoch und der Motor zeigt ebenfalls einen Fehlerzustand an. Hinweis: In einigen Branchen wird auch Gelb verwendet, um den Fehlerzustand anzuzeigen. Rot wird verwendet, um den Motorstoppzustand anzuzeigen. -
Wie verwendet man SPS mit SQL-Datenbank?
caixiaofeng posted A plc and hmi article in German in PLC programming learning
In der heutigen Welt der industriellen Automatisierung sind Daten ein sehr wichtiger Bestandteil. Sofortige Daten aus Quellen zu erhalten und sie für verschiedene Zwecke zu verwenden, ist genauso wichtig wie das Ausführen eines Systems. Normalerweise weiß jeder, wie man SCADA in verschiedene Datenbanksysteme wie SQL-Server integriert. Viele ignorieren jedoch die Leistungsfähigkeit von SPS bei der Integration in Datenbanken. Auch sie können für diesen Zweck verwendet werden. SPS mit SQL-Datenbank Wenn wir SPS verwenden, können Programmierer in Notfallsituationen wie SCADA-Ausfällen damit arbeiten und ihre Arbeit erledigen, indem sie sie entsprechend codieren. In diesem Beitrag erfahren Sie, wie man SPS mit SQL-Datenbank verwendet. Für diejenigen, die mit SQL Server nicht vertraut sind: Es handelt sich um ein Datenbankverwaltungstool, das eine große Menge an Daten sequenziell in Echtzeitformat speichert, und Abfragen werden entweder über eine externe Quelle wie eine SPS geschrieben, um Daten abzurufen. Um Daten darin zu speichern, wird Logik in die SPS geschrieben, die bei Ausführung Daten in SQL speichert. Dies ist ein einfaches Konzept, dessen Vorteile im weiteren Verlauf des Beitrags näher erläutert werden. Scheduler PLC Nehmen wir an, Sie haben ein sehr großes System, in das der Bediener täglich Hunderte von Zeitplänen für die Ausführung bestimmter Funktionen eingeben muss. Anstatt umfangreiche Codierungen und Variablen in der SPS zu verwenden, um in SCADA eingegebene Daten zu speichern und sie zu verwenden, sobald die Zeit gekommen ist, geben Sie einfach alle variablen Daten jedes Mal, wenn ein neues Rezept erstellt wird, über die SPS an den SQL-Server weiter. SQL speichert Datum und Uhrzeit der eingegebenen Werte in Echtzeit und gibt den Bedienern die Möglichkeit, sie nach Datum und Uhrzeit gefiltert auszuwählen. Beispielsweise hat SQL fünf Einträge vom 1. bis 5. Oktober für verschiedene Arten von eingegebenen Plänen. Der Vorteil besteht darin, dass der Bediener einen beliebigen Eintrag auswählen und dann das System ausführen kann. Wenn SQL nicht vorhanden wäre, müsste er nur eine Option ausführen, entweder den 1. Oktober oder ein anderes Datum. Oder er müsste den Speicher von SCADA oder PLC nutzen, was eine Verschwendung von Daten und Codierung wäre. Dasselbe wird durch SQL Server einfacher. Ein weiterer Vorteil ist, dass die SCADA-Codegröße reduziert wird und für andere Zwecke verwendet werden kann. Die Planung wird in vielen Anwendungen verwendet und die Verwendung von PLC dafür zusammen mit SQL macht das System effizienter. Sequenzierung Stellen Sie sich eine Anlage mit 10 Sequenzen vor. Jede Sequenz verfügt über einen Barcodeleser, um die Aktion für das gewünschte Produkt zu starten. Wenn der Barcode in SCADA gelesen wird, dann wird der entsprechende Datenfeed an PLC oder kurz SCADA gesendet, was das Medium zum Einleiten der Kommunikation zwischen PLC und Daten ist; dann verbinden Sie PLC einfach direkt mit SQL. SQL kommuniziert direkt mit PLC, um Barcodes und andere Daten zum Starten oder Stoppen einer Sequenz zu bestimmen. Solche Massendaten aus Anlagensequenzen helfen, die Codierung in SCADA zu reduzieren und machen das System schneller bedienbar. Da PLC mit Codierung für Sequenzoperationen geschrieben ist, warum verbinden Sie es nicht direkt mit SQL und verwenden das System? Mehrere PLCs synchronisieren Es gibt viele Anwendungen, bei denen eine PLC an einem Standort Daten von einem anderen PLC-Standort benötigt, um eine Arbeit zu erledigen. Auch in diesem Fall wird traditionell SCADA verwendet, um alle SPS zu integrieren und zu verwalten. In diesem Fall werden die Daten über Datum und Uhrzeit von SQL synchronisiert, wenn die SPS direkt mit dem SQL-Server verbunden sind. Dadurch werden die Probleme der Synchronisierung mehrerer SPS über RTC (Echtzeituhr) eliminiert. Außerdem kommuniziert die SPS direkt mit anderen SPS, um Daten anzufordern oder über den SQL-Server bereitzustellen. Jeder Alarm oder jedes Ereignis in einer SPS wird auch an andere SPS übermittelt und hilft bei der Verfolgung von Echtzeitaufzeichnungen. Handshaking Beim Handshaking wird eine Partei von der anderen Partei bestätigt, dass der Auftrag abgeschlossen wurde. Im Grunde ist dies eine erforderliche Antwort, damit die Partei mit ihrer anderen Arbeit beginnen kann. Diese Methode funktioniert gut mit SPS und SQL-Servern. Der SQL-Server kann direkt mit der SPS kommunizieren, indem er Ereignisbenachrichtigungen in Echtzeit oder Alarmbenachrichtigungsdaten in Echtzeit sendet. Das bedeutet, dass die Fertigstellung des Auftrags 3 Tage gedauert hat. Anschließend wird die Abschlussbestätigung als separates Ereignis an die SPS gesendet. Da sie auch 3 Tage an Daten enthält, kann der Bediener den gesamten Vorgang problemlos in SCADA-Berichten anzeigen. Handshake ist also ein wichtiger Grund für die direkte Kommunikation zwischen SPS und SQL. Grundlagen der SPS-Datenbank Stellen Sie mithilfe einer Middleware oder eines Gateways eine Verbindung zwischen der SPS und der SQL-Datenbank her, die die Kommunikation zwischen industriellen Netzwerkprotokollen und Datenbanksprachen erleichtert. Wählen Sie ein Kommunikationsprotokoll aus, das sowohl die SPS als auch die SQL-Datenbank verstehen, z. B. OPC UA, Modbus TCP oder ein anderes von Ihrer SPS und Middleware unterstütztes Protokoll. Konfigurieren Sie die SPS zum Senden und Empfangen von Daten, indem Sie die erforderlichen Parameter, Register oder Tags einrichten, aus denen gelesen oder in die geschrieben wird. Dies kann die Programmierung der SPS mithilfe der entsprechenden Software umfassen, um sicherzustellen, dass sie für den Datenaustausch bereit ist. Richten Sie die SQL-Datenbank ein, indem Sie eine neue Datenbank erstellen oder eine vorhandene konfigurieren, um Daten von der SPS zu speichern. Definieren Sie Tabellen, Spalten und Datentypen, die mit der von der SPS gesendeten Datenstruktur übereinstimmen. Ordnen Sie jeden SPS-Datenpunkt dem entsprechenden Feld in der SQL-Datenbank zu. Stellen Sie sicher, dass die Datentypen kompatibel sind und dass die Zuordnung für die Anforderungen der Anwendung logisch ist. Implementieren Sie die Datenübertragungslogik mithilfe von Skripten oder in der Datenbank gespeicherten Prozeduren. Bestimmen Sie, wie oft Daten übertragen werden sollen, unter welchen Bedingungen und ob die Übertragung durch Ereignisse oder nach einem Zeitplan ausgelöst werden soll. Testen Sie die Kommunikation zwischen der SPS und der SQL-Datenbank gründlich. Suchen Sie nach Fehlern oder Datenabweichungen und stellen Sie sicher, dass sich das System unter verschiedenen Bedingungen wie erwartet verhält. Überwachen Sie das System kontinuierlich auf Betriebsintegrität, Datengenauigkeit und Anomalien. Richten Sie Warnungen oder Benachrichtigungen für Systemfehler oder wichtige Ereignisse ein. Überprüfen und aktualisieren Sie das System regelmäßig nach Bedarf, um Änderungen im SPS-Setup, der Datenbankstruktur oder zusätzlichen Anforderungen Rechnung zu tragen. Halten Sie die Dokumentation für alle Systemänderungen auf dem neuesten Stand. Stellen Sie sicher, dass sowohl für die SPS als auch für die SQL-Datenbank Sicherheitsmaßnahmen vorhanden sind, um sie vor unbefugtem Zugriff und Datenlecks zu schützen. Erwägen Sie die Implementierung von Verschlüsselung, Firewalls und sicheren Zugriffsprotokollen. -
Vergleichsanweisungen in der SPS-Programmierung
caixiaofeng posted A plc and hmi article in German in PLC programming learning
Vergleichsanweisungen in der SPS werden verwendet, um Wertepaare zu testen und die logische Kontinuität einer Sprosse zu prüfen. Vergleichsanweisungen sind daher selten, wenn überhaupt, die letzten Anweisungen auf einer Sprosse. Arten von Vergleichsanweisungen Nehmen wir beispielsweise an, dass eine LES-Anweisung mit zwei Werten präsentiert wird. Wenn der erste Wert kleiner als der zweite ist, ist die Vergleichsanweisung wahr. Gleich-Anweisung (EQU) Verwenden Sie die EQU-Anweisung, um zu testen, ob zwei Werte gleich sind. Wenn Quelle A und Quelle B gleich sind, ist die Anweisung logisch wahr. Wenn diese Werte nicht gleich sind, ist die Anweisung logisch falsch. Quelle A muss eine Adresse sein. Quelle B kann entweder eine Programmkonstante oder eine Adresse sein. Werte werden in Zweierkomplementform gespeichert. Ungleich-Befehl (NEQ) Verwenden Sie den NEQ-Befehl, um zu testen, ob zwei Werte ungleich sind. Wenn Quelle A und Quelle B ungleich sind, ist der Befehl logisch wahr. Quelle A muss eine Adresse sein. Quelle B kann entweder eine Programmkonstante oder eine Adresse sein. Werte werden in Zweierkomplementform gespeichert. Kleiner-als-Befehl (LES) Verwenden Sie den LES-Befehl, um zu testen, ob ein Wert (Quelle A) kleiner als ein anderer (Quelle B) ist. Wenn Quelle A kleiner als der Wert an Quelle B ist, ist der Befehl logisch wahr. Quelle A muss eine Adresse sein. Quelle B kann entweder eine Programmkonstante oder eine Adresse sein. Werte werden in Zweierkomplementform gespeichert. Kleiner-als-oder-gleich-Befehl (LEQ) Verwenden Sie den LEQ-Befehl, um zu prüfen, ob ein Wert (Quelle A) kleiner oder gleich einem anderen (Quelle B) ist. Wenn der Wert an Quelle A kleiner oder gleich dem Wert an Quelle B ist, ist der Befehl logisch wahr. Quelle A muss eine Adresse sein. Quelle B kann entweder eine Programmkonstante oder eine Adresse sein. Werte werden in Zweierkomplementform gespeichert. Größer-als-Befehl (GRT) Verwenden Sie den GRT-Befehl, um zu prüfen, ob ein Wert (Quelle A) größer als ein anderer (Quelle B) ist. Wenn der Wert an Quelle A größer als der Wert an Quelle B ist, ist der Befehl logisch wahr. Größer-als-oder-gleich-Befehl (GEQ) Verwenden Sie den GEQ-Befehl, um zu prüfen, ob ein Wert (Quelle A) größer oder gleich einem anderen (Quelle B) ist. Wenn der Wert an Quelle A größer oder gleich dem Wert an Quelle B ist, ist die Anweisung logisch wahr. Maskierter Vergleich auf Gleichheit (MEQ) Verwenden Sie die MEQ-Anweisung, um Daten an einer Quelladresse mit Daten an einer Vergleichsadresse zu vergleichen. Die Verwendung dieser Anweisung ermöglicht es, Teile der Daten durch ein separates Wort zu maskieren. Quelle ist die Adresse des Werts, den Sie vergleichen möchten. Maske ist die Adresse der Maske, durch die die Anweisung Daten verschiebt. Die Maske kann ein hexadezimaler Wert sein. Vergleich ist ein ganzzahliger Wert oder die Adresse der Referenz. Wenn die 16 Datenbits an der Quelladresse gleich den 16 Datenbits an der Vergleichsadresse sind (abzüglich maskierter Bits), ist die Anweisung wahr. Die Anweisung wird falsch, sobald sie eine Nichtübereinstimmung erkennt. Grenzwerttest-Anweisung (LIM) Verwenden Sie die LIM-Anweisung, um Werte innerhalb oder außerhalb eines angegebenen Bereichs zu testen, je nachdem, wie Sie die Grenzwerte festlegen. Die Werte für Untergrenze, Test und Obergrenze können Wortadressen oder Konstanten sein, beschränkt auf die folgenden Kombinationen: Wenn der Testparameter eine Programmkonstante ist, müssen sowohl der Untergrenze- als auch der Obergrenze-Parameter Wortadressen sein. Wenn der Testparameter eine Wortadresse ist, können die Untergrenze- und Obergrenze-Parameter entweder eine Programmkonstante oder eine Wortadresse sein. Wahr/Falsch-Status der LIM-Anweisung Wenn die Untergrenze einen Wert hat, der gleich oder kleiner als die Obergrenze ist, ist die Anweisung wahr, wenn der Testwert zwischen den Grenzwerten liegt oder gleich einem der Grenzwerte ist. Wenn die Untergrenze einen Wert hat, der größer als die Obergrenze ist, ist die Anweisung falsch, wenn der Testwert zwischen den Grenzwerten liegt. -
Erweiterte SPS-Programmierung für die Sortierung fehlerhafter Teile
caixiaofeng posted A plc and hmi article in German in PLC programming learning
Erweiterte SPS-Programmierung zur Sortierung defekter Teile, um zwischen guten und schlechten Teilen zu unterscheiden und diese dann über Förderbänder zu transportieren. Erweiterte SPS-Programmierung zur Sortierung defekter Teile Die folgende Simulation zeigt die Identifizierung guter und schlechter Produkte und die Sortierung der Produkte anhand ihrer Qualität mithilfe der SPS-Kontaktplanlogik. Die Förderbänder werden zum Transport der Produkte verwendet. Die Förderbänder werden gestartet und gestoppt, wenn die Produkte auf das Förderband geliefert werden und während des Bohrvorgangs. Die Bohrmaschine wird zum Bohren der Produkte gemäß der Konstruktion verwendet. Manchmal kann der Bohrvorgang die Produkte beschädigen. Ein Sensor erkennt die Qualität der Produkte und ein Schieber wird verwendet, um die schlechten Produkte in einen anderen Lagerbehälter zu schieben. SPS-Ein- und Ausgänge Die folgende Tabelle listet die erforderlichen Ein- und Ausgänge des SPS-Systems auf. Typ Gerätenr. Gerätename Betrieb Eingang X0 Bohren EIN während des Bohrens. Eingang X1 Teil wird gebohrt Ein Teil wird zugeführt, wenn Y0 eingeschaltet ist: Ein großer Metallwürfel. Eingang X2 Richtig gebohrt EIN, wenn das Teil richtig gebohrt ist. Das vorherige Ergebnis wird gelöscht, wenn das Bohren beginnt. Eingang X3 Falsch gebohrt EIN, wenn das Teil am linken Ende erkannt wird. Eingang X4 Sensor EIN, wenn das Teil am rechten Ende erkannt wird. Eingang X5 Sensor EIN, wenn das Teil vor dem Schieber erkannt wird. Eingang X10 Sensor EIN, wenn das Teil nicht richtig gebohrt ist. Das vorherige Ergebnis wird gelöscht, wenn das Bohren beginnt. Ausgabe Y0 Versorgungskommando Wenn Y1 eingeschaltet ist, bewegt sich das Förderband vorwärts. Ausgabe Y1 Förderband vorwärts Wenn Y3 eingeschaltet ist, bewegt sich das Förderband vorwärts. Ausgabe Y2 Beginnen Sie mit dem Bohren Beginnt mit dem Bohren, wenn Y2 eingeschaltet ist (ein Prozesszyklus, der nicht zwischendurch gestoppt werden kann). Ausgabe Y3 Förderband vorwärts Fährt aus, wenn Y5 eingeschaltet ist, und ein, wenn Y5 ausgeschaltet ist. Der Schieber kann nicht mitten im Hub angehalten werden. Ausgabe Y5 Pusher Fährt aus, wenn Y5 eingeschaltet ist, und ein, wenn Y5 ausgeschaltet ist. Der Schieber kann in der Mitte des Hubs nicht angehalten werden. Programmbeschreibung Dieses Projekt zielt darauf ab, mithilfe von Sensoren zwischen guten und defekten Teilen zu unterscheiden und sie entsprechend zu sortieren. Das Projekt besteht aus zwei Hauptbereichen: Gesamtsteuerung und Bohrsteuerung. Gesamtsteuerung Auf dem Bedienfeld befindet sich ein Druckknopf namens PB1 (X20). Wenn Sie PB1 drücken, löst dies den Befehl „Zufuhr“ (Y0) für den Trichter aus, wodurch dieser Teile zuführt. Wenn Sie PB1 loslassen, wird der Befehl „Zufuhr“ deaktiviert und der Trichter angehalten. Auf dem Bedienfeld befindet sich ein Schalter namens SW1 (X24). Wenn Sie SW1 einschalten, beginnen die Förderbänder, sich vorwärts zu bewegen. Wenn Sie SW1 ausschalten, werden die Förderbänder angehalten. Bohrsteuerung Besprechen wir nun die Steuerung des Bohrers: Wenn der Teil unter dem Bohrsensor (X1) im Bohrer aktiviert wird, hält das Förderband an. Der Bohrvorgang beginnt, wenn der Befehl „Bohrung starten“ (Y2) aktiviert wird. Es stoppt, wenn der Bohrsensor (X0) aktiviert wird. Nach einem vollständigen Bohrzyklus wird, wenn „Bohrung starten“ (Y2) aktiviert wird, entweder der Sensor „Richtig gebohrt“ (X2) oder „Falsch gebohrt“ (X3) ausgelöst. Beachten Sie, dass der Bohrer nicht mitten im Betrieb gestoppt werden kann. In dieser SPS-Simulation wird jedes dritte Teil als defekt betrachtet (ein Teil mit mehreren Löchern fällt ebenfalls in die Kategorie „defekt“). Wenn der Sensor „Teil erkennen“ (X10) im Schieber ein defektes Teil identifiziert, stoppt das Förderband und der Schieber bewegt das Teil auf das „Defekt“-Fach. Denken Sie daran, dass der Schieber vollständig ausgefahren wird, wenn der Betätigungsbefehl für ihn EIN ist. Wenn der Befehl AUS ist, fährt der Schieber vollständig ein. Ein Teil, das die Prüfung besteht, wird weiter auf dem Förderband zum „OK“-Fach am rechten Ende geführt. SPS-Programmierung -
Shift Bit Register in PLC
caixiaofeng posted A plc and hmi english article in PLC programming learning
There are many instructions in PLC that help in executing the logic in a simplified way. Instructions come in various categories like arithmetic, comparison, logical, controller, etc. For example, a simple addition instruction for adding two variables comes in the arithmetic category. So, similarly, many types of instructions are available in a PLC logic. One such instruction which is widely used in PLC programming is shift instruction. It comes in the category of numerical processing. In this article, we will learn the concept of shift bit register instruction in PLC programming. Shift Bit Register in PLC As the name implies, a shift instruction is a command for shifting bits of a word by some predefined position. For example, you have a word of 16 bits. You want to move bit number 3 from its current fourth position to the seventh position. So, whenever a shift command pulse is given, the bit will shift in each trigger from the fourth position to the seventh position. In that continuity, the bit in the fifth position will move to the eighth position; and the bit in the third position will move to the sixth position. So, here, you are shifting the bits in a group by the number of positions you define. Shift Instruction Shift instructions come in two types – shift and rotate. Let us have a look at the rotate instruction. Consider a syntax – %MW10:= SHL (%MW12, 4). %MW10 is the destination memory word and %MW12 is the source memory word. Refer to the below image. In %MW10, when a first trigger for shift left is given, bit0 shifts to bit1, and so on. This result is stored in %MW12. When such triggers are given four times, ultimately, bit 0 will shift finally to bit 4, and so on. The end result is stored in %MW12 anyways and you get a final answer of the bits shifted by four positions from the source word. But, one thing to remember is, with each shift, the preceding bit is filled with value 0. This you can see clearly in the image. After the first shift, the first bit in %MW12 is 0. So, after four shifts, the end result will be – 0000 1101 1100 0000. This shift can thus be either right or left. One more type of shift comes in PLC; the earlier one added zeroes from the preceding position, but this second type keeps the value of the first bit (MSB for right and LSB for left) as it is. This is called arithmetic shifting. So, if the value of the first bit (MSB for right and LSB for left) initially before the shift was 1, then the last bit will remain as 1 only and the zeroes will be added from the second preceding bit up to how many times the shift command is given. It is to be noted that the last bit which is shifted is always stored in a carry bit. Rotate Instruction The second type is rotate instruction. Consider the syntax – %MW10:= ROL (%MW12, 4). %MW10 is the destination memory word and %MW12 is the source memory word. We will use the same above image for reference. Rotate instruction, as the name defines, just rotates the bits by how many positions you define. Compared to shift instruction where zero was added after every preceding bit; here, the bits are just shifted in the same sequence as it is in the left direction. So, suppose you have a source word of – 1100 1010 1100 0101; then, after a trigger of 4 positions, the end result will be – 1010 1100 0101 1100. The same logic works in the right direction. The last bit shifted is also stored in a carry bit. One more type comes in the rotate category. Here, instead of shifting only 16 bits, the carry bit to is rolled over. This means, the last bit is shifted to the carry bit, and the carry bit will then be shifted to the first bit, and so on. In the earlier type, the last bit was only stored in the carry bit. -
SIEMENS Siemens S7-1200 PLC Hardware Configuration
caixiaofeng posted A plc and hmi english article in PLC programming learning
S7-1200 PLC is a compact, modular, and cost-effective solution that offers a wide range of features and flexibility for small to mid-sized automation applications. These features include communication options, memory, CPU performance, and IOs configuration. When you have a process that you need to control, you should choose the PLC and configure it to best fit your process requirements. In this article, we will discuss the hardware configuration of S7-1200 PLC and we will give an example of how to configure it in the Siemens Tia portal. Contents: What is the hardware configuration of a PLC? Importance of hardware configuration. Simple project example. How to configure our PLC with the given example? Hardware configuration of CPU. IOs hardware configuration. HMI configuration. Conclusion. What is the hardware configuration of a PLC? The hardware configuration refers to the specific components of the PLC, such as the CPU, memory, input/output (I/O) modules, communication ports, power supply, and any additional modules or accessories that may be needed and added to the system. The hardware configuration of a PLC also includes enabling or disabling some of the CPU features, depending on the device, its capabilities, and the requirements of your process. The hardware configuration steps for a PLC typically involve the following: Select the appropriate PLC model based on the application requirements. Identify the input/output requirements for the system, which include the type and number of sensors, actuators, and other devices that will be connected to the PLC. Choose the communication protocol and network topology that will be used to connect the PLC to other devices and systems. Determine the power supply requirements for the PLC and its peripherals. Mount the PLC in an appropriate location and connect all the necessary cables and wires. Configure the PLC software to communicate with the hardware components and set up the appropriate logic and control functions. The specific steps for hardware configuration may vary depending on the PLC model and the application requirements, but these are the basic steps that are typically involved in the process. In this article, we will talk about the hardware configuration that is done in the TIA Portal platform. That means we will assume that you know your application and that you have already chosen your PLC model and the Power supply to feed it. You can refer back to previous articles where we discuss how to choose the PLC and power supply that best fits your application. Importance of Hardware Configuration in PLC Proper hardware configuration ensures the system is reliable and robust. If the hardware components are not configured correctly, they may not work as intended, resulting in system failures or errors Hardware configuration affects the performance of the system. By choosing the right hardware components and configuring them appropriately, the system can operate at maximum efficiency and speed and can handle a high volume of inputs and outputs. Hardware configuration impacts the scalability and flexibility of the system. The choice of hardware components and their configuration should take into consideration future expansion or modifications to the system, to ensure that the system can easily accommodate changes or upgrades. Hardware configuration affects the cost of the system. By selecting the appropriate hardware components and configuration, unnecessary costs can be avoided, and the overall cost of the system can be minimized. S7-1200 Hardware Configuration We will assume a simple PLC project and see how we can configure the PLC into our project before we start writing our code. Temperature Control System for a Reactor using PLC The project involves controlling the temperature of a reactor using a PLC. The system should measure the temperature of the reactor and adjust the temperature by controlling the flow of a cooling fluid. The project uses four thermocouples to measure the temperature, two solenoid valves to control the flow of the cooling fluid, and a motor to drive the impeller of the reactor. I/O Configuration Inputs: Thermocouples 1 – 4: these are 4 analog inputs that measure the temperature at different locations inside the reactor. Emergency Stop Pushbutton: This is a digital input that is used to stop the system in case of an emergency. Temperature Set Point Potentiometer: This is an analog input that allows the operator to set the desired temperature setpoint. Outputs: Solenoid Valve 1 and 2: these are 2 digital outputs that control the flow of the cooling fluid through the reactor pipes. Motor Control: This is a digital output that controls the speed and direction of the motor that drives the impeller. Heater Control: This is a digital output that controls the heating system of the reactor. System Operation: The system waits for the operator to set the temperature setpoint using the potentiometer. The PLC reads the temperature setpoint and compares it to the current temperature of the reactor, which is measured by the four thermocouples. If the reactor temperature is below the setpoint, the PLC activates the heater control output to increase the temperature. If the reactor temperature is above the setpoint, the PLC activates one of the solenoid valve outputs to increase the flow of the cooling fluid and decrease the temperature. The PLC continuously monitors the temperature and adjusts the heater and cooling systems to maintain the desired setpoint. The PLC also controls the motor that drives the impeller to mix the contents of the reactor. If the emergency stop pushbutton is pressed, the PLC deactivates all the outputs and stops the system. The PLC project can be further expanded and modified to include additional functionality, such as alarms, data logging, or remote monitoring, depending on the specific requirements of the project. However, we will not care about coding the PLC logic of this system, rather we will use this example to explain how to hardware configure the PLC to fit our project. This includes: Selecting the PLC CPU. Selecting the IO modules. Assigning the input and output tags to the hardware modules. Assigning an IP to the PLC for communication. Assigning a protection password. Configuring the local time of the PLC. Configuration the HMI and set the connection with PLC. How to configure PLC with the given example? Below we will discuss the basic PLC project creation with the required hardware. The hardware configuration of the CPU: Selecting the CPU: When you start a new project in TIA Portal, you should configure a new device and add it to your project. See picture 1. Picture 1. Configure a device for your project As you can see from the previous picture, the TIA portal already shows you that the first step should be configuring a new device. In the previous article, we discussed how to choose the PLC that fits your process, so we will not mention that here again, for our project as it is a simple project we will choose the CPU 1214C AC/DC/RLY. See picture 2. Picture 2. Add a new controller to the project CPU Properties: Depending on the CPU that you have selected for your project, different CPU features and properties will be available. You can enable or disable these features depending on your needs. Some of the features will need extra configuration to be made. See picture 3. Picture 3 – Properties of CPU As you can see in the previous picture there are many properties that you can set for your CPU in the project. We will mention some of these properties which you will need to configure in each project you make, some other properties are used only in special cases. Communication: This is a very important configuration for any PLC project; your project will most probably have different modules and devices that need to talk to each other. Setting up the communication between your PLC and these devices is important for your project. By selecting the CPU you already have defined how the communication will be. Some CPU only works with Profinet, some only work with Profibus and some have the ability to use both. The selected PLC for this example only works with Profinet. From the Profinet interface you will set the IP address for your PLC, this IP should be unique in the project; you can’t use the same IP for two different modules. See picture 4. Picture 4 – Profinet interface Cycle time: This is another important property for your PLC, as you know; the cycle time of your program will depend on how much code you have written and how long it will take the PLC to execute this code. In the cycle time properties, you can set the cycle monitoring time, if the PLC takes longer than this set time to execute the program, then the PLC will give an error. See picture 5. From this property you can also determine the minimum cycle time for your CPU, you can do that if you triggered the “Enable minimum cycle time for cyclic OBs”. You then can write the minimum cycle time that you want, and the PLC will adjust its performance to match this time. Off course this time is limited by the CPU performance capability, so you can’t lower this time below a certain limit. Picture 5 – Cycle time Property System and clock memory bits: System memory bits and clock memory bits are built-in bits inside the CPU that the operating system used to indicate certain events in the PLC. For example, there is a memory bit that will change to TRUE only at first scan or a memory bit that will be TRUE if diagnostic status changes, there are also some dedicated clock memory bits like a bit representing a clock of 10Hz or a bit representing a clock of 2Hz. These bits can be very useful in some applications and can save a lot of programming code to obtain the same functionality. See picture 6. picture 6 – Enable system and clock memory bits You can enable the use of one or both memory bytes; you can also determine the address of these bytes as you can see from the picture. Time of Day: Another very important property of your PLC is setting the time inside your PLC. In almost any project you make, you will need to know the real-time to be able to assign certain actions with different dates. In the previous article, we talked about local and system times inside the PLC and how to use them. This property of the CPU allows you to set the local time to the time zone that you want. See picture 7. Picture 7 – Local time property Protection and security: From this property, you can determine the access level and password protection for your PLC. See picture 8. Picture 8 – Protection and security property The previously mentioned properties are the most commonly configured properties with almost any PLC project you would do. There are some other properties that are less likely to be used with simple programs such as Web servers and OPC UA. The next step in the Hardware configuration of your project is configuring the IOs. IOs hardware configuration: Another important step of your project is the configuration of your IOs, which means deciding how many IO modules you need and what kind of IO modules you need. When deciding about your IOs, you should consider some key points like having some spare IO points and choosing the IO modules that fit the input sensors and output actuators inside your project. See picture 9. Picture 9 – Adding analog input module As we mentioned in our example project, we have 4 thermocouples used as analog inputs to my PLC, so I need to add an analog input module with at least 4 input channels because the selected PLC only has 2 analog input channels. Another thing is that the thermocouple is a special type of analog input that requires a dedicated input module. That is why we chose the AI 8xTC module, which has 8 input channels dedicated to being used with thermocouples; we choose the 8-channel module and the 4 to have spare channels for future use in case we need to expand our project. If you go to the properties of the AI 8xTC module you will see that you can configure each input channel individually, you can choose the type of thermocouple, scale of measurement, and other properties. See picture 10. Picture 10 – Configuring input module Next, you will need to define your IOs tags and assign each input or output you have to a proper IO point in your PLC or in the IO modules. See picture 11. Picture 11 – Assign input tags Then you continue to assign the rest of the inputs and outputs tags, see pictures 12 and 13. Picture 12 – Assign input tags for the PLC Picture 13 – Assign output tags to your project HMI Configuration Your PLC project will probably need an HMI, after selecting your HMI there are different configurations you can make. In this article, we will only show how to configure the communication between the HMI and the PLC. As you see from the previous picture, you select an HMI by adding a new device and then select an HMI. See picture 14. Picture 14 – Selecting an HMI There are different ways to set the communication between the HMI and the PLC, but the easiest way is through the network view page. See picture 15. Picture 15 – Setting HMI connection Inside the network view page, you can set the connection between the HMI and the PLC by simply clicking on the small green square representing Profinet from the HMI and dragging it to the PLC. TIA Portal will then draw a green line between the two modules and it will automatically give the HMI an IP address to set the communication between them. Conclusion Hardware configuration is a very critical step of any PLC project. The proper hardware configuration of your PLC will ensure that the needed functionalities of the project are met. Hardware configurations include selecting IO modules, enabling or disabling certain CPU properties, and configuring different devices like HMI with your PLC. -
What are Analog Inputs? – Analog Signals Processing in PLC
caixiaofeng posted A plc and hmi english article in PLC programming learning
In this article, we will talk about analog input signals processing in PLC and how can we handle these signals in the automation process. Contents: What are analog input signals? Input analog processing in S7-1200 and 1500. Input analog processing in S7-300 and 400. Which are best for control? – analog or digital signals Conclusion. What are Analog Input Signals? Before we dive into how to handle analog input signals in TIA Portal, let’s start by understanding analog inputs first. Any automation system needs input signals to understand the status of the process to be able to take decisions that will keep the process running and stable. These input signals are either discrete or digital input signals which are in the form of 0 or 1 values. The other type of input is the analog signals. An Analog signal is simply a continuous representation of a physical quantity in your system, so if you need to monitor temperature or pressure in your process, an analog signal will give you continuous and instantaneous values that correspond to the real changes in the physical quantity. Analog signals are provided in many standard forms, but most commonly the 0-10V or the 4-20mA. It will depend on the type of analog sensor you are using, and it will also dictate the type of PLC analog module that you can use. Assume an analog pressure sensor that has a measuring range of 0-10 bar and an output in the form of 4-20mA. Usually, an analog signal will have a linear relationship between the measured physical quantity and the corresponding output. That means if the sensor is measuring a 0 bar it will give a 4mA signal and if it is measuring a 10 bar it will give a 20mA signal and the same in between will also be linear. See picture 1. Picture 1 – Analog signal representation. The PLC still can’t understand the 4-20mA of the physical quantity, and here comes the use of the analog module of the PLC. The analog module will make another transformation to this representation so the PLC can actually understand it. The analog module will convert the analog mA measurements into digital values that depend on the type of the module, but for Siemens PLC, these values are always in the range of 0 – 27648. So if the sensor is mearing 0 bar the output will be 4mA and it will be converted to 0 value inside the PLC. See picture 2. Picture 2 – Analog to digital conversion of the input signal The PLC will then convert the 0-27648 values into the equivalent physical measurement depending on your programming which we will get to later. See picture 3. Picture 3 – The scaled measured value inside the PLC. The analog processing of temperatures is quite different because the temperature sensor behavior with the physical changes is not linear as would a level or a pressure sensor do. That is why there are standardized tables for the different types of temperature sensors that tell which temperature corresponds to which sensor value. That is why with temperature measurement you would select special types of input modules of your PLC where these standard tables are internally defined and you directly get the temperature value corresponding to the sensor measurement. That is why you can’t find a temperature sensor that has a voltage or current measurement range written on it. You will only find the sensor type written, for example, PT100, PT1000, KTY84, PTC, and so on. Analog Input Processing in S7-1200 and 1500 To see how we handle analog signals in modern S7 family PLC, let’s start by creating a new project and adding an S7-1200 CPU. We will also add an analog input/output module. See picture 4. Picture 4 – Adding an analog input module. Now, let’s define our input signal tag, we will assume a pressure sensor that can measure pressure between 0 and 10 bars and gives a corresponding signal between 4 and 20mA. We will define that input signal in the first tags of the input module. See picture 5. Picture 5 – Define the input signal tag. As we said before, the input module can work with different input signals, whether it is 0-10V or 4-20mA, so we need to assign the right configuration for our sensor. As we said the pressure signal is given in the form of 4-20mA so we will configure our input channel to that. See picture 6. Picture 6 – Configure the input channel Now that we finished the hardware configuration part, we will start programming our handling code. To do so, we will create a function FC so we can reuse it each time we have an analog signal to process. Inside this FC we will create the logic which will handle the analog signal and convert it into the physical measured value. In TIA Portal there are predefined instructions that we can use to do just that, these instructions are the NORM_X and the SCALE_X instructions. See picture 7. Picture 7 – NORM_X and SCALE_X instructions As you can see, the NORM_X will normalize the analog input into a value between 0 and 1, and then the SCALE_X will be used to scale this normalized value to the range of the measured physical value, which in our sensor case between 0 and 10 bars. We used a function FC instead of writing our code directly in the main OB1 to make our code reusable with any analog signal. Each time I have a new analog input signal I will just drag and drop the FC block into our main OB1 and just write the associated parameters of the required input. See picture 8. Picture 8 – Drag and drop your FC. When you drag and drop the FC into your main OB1, you will be asked to provide the associated parameter of this function call. In our case, the input signal is the pressure sensor and the ScaledMIN and ScaledMAX are the measurement value range of 0-10 bars. See picture 9. Picture 9 – Assigning the function parameters to our pressure sensor. If I have a new analog input, then I won’t have to recreate the PLC logic again, I will just drag and drop the FC into the main OB1 and assign the new sensor parameters. Let’s assume that we now have a new analog sensor for measuring the level inside a water tank between 0 and 100 % of the tank. We will do the same steps as we did before, starting with defining the new input tag. See picture 10. Picture 10 – Define new level sensor Next, we will configure the input channel for the level sensor as we did in picture 6. We will assume the same configuration. Next, we will just drag and drop the FC we created and just assign the parameters of the level sensor. See picture 11. Picture 11 – Reusing the FC with the level sensor. As you can see from the previous picture, this is one of the many advantages of using functions FCs in your logic as it helped reduce the amount of programming we made. Now you have a generic code that can be reused many times with any input analog signal you can need in your PLC project. See the next simulation for input signals processing in Siemens PLC. Analog Inputs in S7-300 and S7-400 To see how we handle analog signals in older S7 family PLCs like S7-300, let’s start by creating a new project and adding an S7-300 CPU. The PLC chosen already have enough analog input channels, so we won’t add any analog modules. See picture 12. Picture 12 – Add an S7-300 PLC. Then we will define the new analog sensor tag, we will assume a pressure sensor that has a measuring range between 0 and 100 bar and an output of 4-20mA. We will configure the PLC input channel as we did before with the S7-1200 to fit our analog input sensor. See picture 13. Picture 13 – Configure the input channel. Now to the PLC coding part, the instruction in s7-300 that is used to handle analog processing is different from the s7-1200. In the S7-1200 PLCs, we have to use NORM_X and SCALE_X. but with the S7-300 we don’t have the normalized instruction, only a SCALE instruction is used. See picture 14. Picture 14 – SCALE instruction in S7-300 As you can see from the previous picture, the SCALE instruction in S7-300 is kind of similar to the NORM_X and SCALE_X instructions combined together. There is one more clear difference which is the BIPOLAR input. The BIPOLAR input is used to indicate if the value at the IN parameter is to be interpreted as bipolar or unipolar. The parameter can assume the following values: BIPOLAR = 1 then the input integer value is assumed to be between -27648 and +27648. For example, when the analog sensor gives us an output in the range of -10V to +10V BIPOLAR =0 then the input integer value is assumed to be between 0 and 27648. For example, when the sensor gives us an output in the range of 0-10V And this is simply how to handle analog input signals in both S7-1200 and S7-300 PLCs. Which are Best for Control? – Analog or Digital Signals Look, both signals are critical and useful for any automation system, but I personally prefer to use the analog signals if I can, because having analog signals measurements for the process’s physical quantities will give me continuous monitoring of process parameters which will enable me to better track and control my process. Also, having continuous monitoring of the parameters will enable me to set different control logic for different signal values, it will make it easier to have a value range for controlling the process and another value ranges for alarms and warnings of the process deviating from normal operation. Conclusion An Analog signal is a continuous representation of a physical quantity in your system. Analog inputs are most commonly provided in the 0-10V or 4-20mA range. Analog signal processing means converting the analog 4-20mA signal into a range of values that corresponds to the real physical quantity and that the PLC can understand. In the modern S7 family of PLCs like S7-1200, handling analog signals is done using the NORM_X and the SCALE_X instructions. In the older S7 family of PLCs like S7-300, handling the analog signals is done using the SCALE instruction, which is basically a combination between the NORM_X and the SCALE_X instructions. -
SIEMENS How does Siemens obtain a program backup from a physical PLC?
caixiaofeng posted A plc and hmi english article in PLC programming learning
In this article, we will show how to take a program backup from the physical PLC to your computer using the Siemens Tia portal software. Contents: Why would You need to take a backup? How to take a backup from PLC? Notes about Backup from PLC Conclusion Why would You need to take a Backup? Imagine if you accidentally deleted your software from the PC while working on it. Or maybe you need to make an update to certain process software that has been running for 10 years and you no longer have the software code. Instead of rewriting the whole code from scratch, it will be easier to just upload the current code and make your changes to it. In this article, we will show how to easily upload the software contained inside the PLC to your PC. How to Take a Backup from PLC? TIA Portal with the new Siemens controllers S7-1200 and S7-1500 provides more advantages when taking a backup compared to them when you are working with older controllers like S7-300 or S7-400, with older controllers you would take the backup but it will not show any comments or addressing details, the software will work just fine but it will be difficult to read or understand. With the newer PLC controllers, you can now upload both the code and all associated addressing and comments, which will make reading the code very simple and make any updates to it possible. Steps to upload the software from the PLC Create a new project, but unlike what we do usually we will not add a new device rather we will press the Online and choose “upload device as a new station”. See picture 1. Picture 1 – Upload the device as a new station. This will take you to upload the device into the PG/PC window. See picture 2. Picture 2 – Upload device window. You need to choose the type of PG/PC interface as shown in the last picture and then press Start search. When the search is done, you will see all the devices that were found by your software. Note that, it’s not necessary to only find PLCs; you will also be able to find HMIs, IO modules, and every other communication module that the software can detect. See picture 3. Picture 3 – Scan complete and devices found. After the scan is complete, you can select the PLC that you need to upload and then press Upload. This will start uploading the software from the PLC to your TIA Portal. See picture 4. Picture 4 – Upload from PLC is complete. As you can see from the previous picture, the complete project saved on the PLC will be uploaded into your TIA Portal. Even with all the comments and addresses. See picture 5. Picture 5 – PLC project is uploaded As you can see, the whole PLC project was uploaded from the PLC to your PC. With all the blocks, comments, and project configurations. Notes about Backup from PLC If your PC and the PLC have different IP addresses, the TIA Portal will ask you to assign a new IP for your PC that matches the addressing of the PLC and it will even do that automatically, if you allow it. If the project on the PLC is password protected, you will be asked to write this password before the upload step starts, if you can’t provide the right password, then the upload will not start. Make sure you know that password if any. Sometimes, the TIA Portal will find your PLC, but can’t upload the project, due to different reasons, for example, the project on the PLC is written in a different TIA Portal version than what you are using right now. Either way, the reason for failed upload will be shown to you, and you can upload once these reasons are cleared. Conclusion You can upload the project on the PLC to your PC using TIA Portal. If the PLC is s7-1200 or s7-1500 the project will be uploaded with all the associated addressing and comments. If there is any reason preventing TIA Portal from uploading the project, this reason will be shown to you by TIA Portal and you can upload once you fix the problem. -
SIEMENS How to Update the Firmware Version of your PLC? – TIA Portal
caixiaofeng posted A plc and hmi english article in PLC programming learning
In a previous article, we talked about the firmware version of your PLC and how to handle errors that might happen due to a firmware mismatch between your project in the TIA Portal and your actual PLC. In this article, we will show how to update the firmware version of your PLC. Contents: What is a firmware version? Why firmware version can cause me trouble? How to know the firmware version of your hardware PLC? How to handle firmware version errors? How to update the firmware version of your PLC? Conclusion. What is a firmware version? As we explained in a previous article, the firmware of a PLC or a PLC module (IOs, Communication modules, etc.) is simply the internal software installed in the PLC which is responsible for what the hardware can actually do. A PLC with an older firmware version will have fewer features and internal capabilities than a newer firmware version PLC. Pictures 1 and 2 show you how the same hardware PLC will have different features and performance capabilities with different firmware versions installed. Picture 1. Firmware version V4.0 Picture 2. Firmware version V4.4 You can see that the CPU is now having more features added just by updating to a higher firmware version. With the higher firmware V4.4, the CPU now has OPC UA among other features added to its performance capabilities. Why Firmware Version Can Cause Trouble? You will select your PLC in TIA Portal according to one of two points: You already have purchased the hardware PLC, so you will select the same PLC that you actually have in the TIA Portal project. You still haven’t purchased a PLC, so you will select a PLC in TIA Portal that meets your requirement then you will buy it later. In either of the two cases, if the firmware version of the PLC selected in the TIA Portal project is different from the firmware version of the actual hardware you will have a problem. And in some PLCs, your program won’t even be downloaded to the hardware PLC. So, you should always make sure that the firmware version of the actual PLC matches the PLC selected in TIA Portal. It is worth mentioning to know that if the firmware version selected in TIA Portal is older than the actual PLC, you won’t face any troubles with your program, you will lose some of the PLC features and capabilities, but your program will work fine. Troubles will appear if the opposite is true, if the firmware version selected in TIA Portal is newer than the actual PLC, then you will have a problem. That is why if you don’t know the firmware version of your hardware, you should select the older version in the TIA Portal project. How to Know the Firmware Version of Hardware PLC? We can know the firmware version of the hardware PLC that we have by one of two methods: From the PLC itself: The firmware version of any PLC or PLC module is always written somewhere on the hardware device. From the TIA Portal software: Using the TIA Portal software, you can connect your PLC to your TIA Portal and search for the device then you can find the firmware version of the hardware device. We showed how to do that in the previous article. How to Handle Firmware Version Errors? If the firmware version of the actual hardware PLC is older than the version of the PLC selected in the TIA Portal project this will cause firmware errors, and to solve these errors we can try one of the following approaches: we can select the PLC in the TIA Portal project to be with the same or older firmware version as the actual PLC. We showed that in the previous article. we can update the firmware version of the actual hardware PLC to a higher firmware version than the selected one in your project or at least to the same firmware version. And that is the scope of this article. How to Update the Firmware Version of your PLC? You can update the firmware version of your PLC in two ways: Online using TIA Portal. Off-line using Siemens Memory Card SMC. Update the firmware Online using TIA Portal: You don’t need to have an existing project open in the TIA Portal, just you need the TIA Portal software and connect the PLC to your PC. See picture 3. Picture 3. Open Tia Portal without creating a new project. When you open TIA Portal, go to online access, choose the suitable communication adapter between your PLC and your PC, and then press update accessible devices to search for your PLC. See picture 4. Picture 4. Find your PLC. After the PLC is found as you can see in the previous picture, open the PLC folder and press online and diagnosis to see the PLC firmware version. See picture 5. picture 5. The current firmware version of PLC. NOW, to update the firmware version, press the Firmware Update attribute. See picture 6. picture 6. Firmware update page. As you can see, when you press the Firmware Update attribute, you can see the current firmware update which is V4.1.3, and also you can see the Firmware Loader where you can browse for the firmware version that you want to install. Off course you have to have the firmware version on your PC first, which means we need to download the firmware version. To download the firmware version, you should log in to your Siemens account, if you don’t have one you can easily create a new account, but it will take 1 or 2 days to be activated. After that, you can search for the firmware version for your PLC. In our case, we have an S7-1200 CPU 1214C AC/DC/RLY and we will search for its firmware version using its article number. See picture 7. Picture 7. Search for the firmware version of your PLC. After that download the firmware version you want to install, in our case, we want to update our PLC to V4.4.0, so we will download this version to our PC. See picture 8. picture 8. Download V4.4.0 The downloaded file will be a zip file, you should unzip the file to get the firmware version data file and then go back to the Firmware Loader attribute and click browse to search for the firmware version. See picture 9. picture 9. Search for the firmware version file. Don’t worry about making a mistake at this step, because if the firmware version is not compatible with the PLC, you won’t be able to run the update. See picture10. picture 10. The update will not continue if the firmware doesn’t match. As you can see, when we tried to upload a firmware version for a 1215C CPU into our PLC with a 11214C CPU, it gave an error that the file is not suitable for the PLC. NOW, click browse again, but this time search for the correct firmware version. See picture 11. picture 11. No error message when the firmware version is correct. As you can see, when we choose a suitable firmware version, there was no error message and we can now press Run Update to start updating our PLC. A Firmware update window will appear once you start the update process and a success message will appear at the end, if the update went smoothly. See pictures 12 and 13. picture 12. A firmware update is running. Picture 13. firmware update finished successfully. Now that the firmware version is updated, refresh your communication by re-pressing Update Accessible Devices and checking the PLC firmware version. You will find the PLC is now of firmware version V.4.4.0 instead of V4.1.3, and that means we managed to update the firmware version of our PLC. See picture 14. Picture 14. Firmware is updated to V4.44.0 And that is how we update the firmware version of our PLC using TIA Portal. Offline using Siemens Memory Card SMC: The other method that can be used to update the firmware of our PLC is by using the SIEMENS memory card SMC. To do so, we just have to download the firmware version we want to use then we will copy the firmware version from our PLC to the SMC and then insert the SMC into the dedicated slot in the PLC. The next time the PLC is powered on, the firmware will be updated. Conclusion You can update the firmware version using the TIA portal software or the SIEMENS SMC memory card. Make sure you are choosing the firmware version exactly right, if there is a mismatch between PLC and TIA Portal the update will not start. -
SIEMENS Programming and Tuning PID Controller in PLC – Siemens TIA Portal
caixiaofeng posted A plc and hmi english article in PLC programming learning
In a previous article, we talked about what a PID is, and we also explained the different parameters of a PID and how the system would react to changing these parameters. In this article, we will show how to program, configure and tune a PID in your TIA Portal project. Contents: How to add a PID to your logic? How to configure the PID? Basic setting process value setting Advanced setting How to perform tuning of the PID? Pre-tuning of the PID Fine-tuning What are the different tuning methods of PIDs? How to add a PID to your logic? In TIA Portal and almost every other PLC platform, you don’t have to program a PID controller as the TIA Portal already has built-in blocks for PIDs. To add a PID into your logic you just have to simply drag and drop the PID block into your code and just start configuring it for your system. Adding PID into your code is very simple, however, there is a very important point you should take into your consideration. This is the execution interval of your PID. As you know the main execution cycle is happening inside Main Cyclic OB1 and the cycle time of the OB1 depends on a lot of factors, like how long your code is, mathematical calculations in your code, and also for loops and sequences, all of these different factor would make the cycle time of your OB1 not only might it make it long but also it will make it different each cycle, depending on the coding you have. That means if you called your PID block inside the main OB1, the PID execution will depend on the cycle time of your OB1, and that is not a best practice approach. PIDs are usually used to control physical parameters like pressures, temperatures, or speeds and that means your controller needs to be very fast in figuring out any change in your process value and taking fast reactions to counter-effect this change and give you a smooth stable control that a PID should have. So if the PID is added to the main OB1 and is affected by its execution time, it might need to action delays and it will make your system not stable. What to do? A best practice is to call your PID block in a cyclic interrupt OB and set the cycle time of this cyclic interrupt to whatever value you see fit for your system, usually in the range of milliseconds depending on your application. That means, if you set the cyclic interrupt for example to 1 millisecond your PID will be called and executed every millisecond regardless of where the main OB1 cycle is. So, to add a PID into your logic we start by adding a new cyclic interrupt OB and give it a proper name. See picture 1. Picture 1. Adding a cyclic interrupt into your project. You can see from the picture that we set the cyclic time to 1000 microseconds or 1 milliseconds. So our PID will be called and executed every millisecond. Now that you added your cyclic OB to the project, you can simply drag and drop the PID block. You can find it in the Instructions tab/Technology/PID control/Compact PID. See picture 2. Picture 2. Adding the PID block. Now, add your system parameters to the PID block, the input, output, and setpoint. See picture 3. Picture 3. Assign your PID parameters. Did you notice from the last picture, you have 2 different inputs and 3 different outputs, what are those? Input: This is your input value of your process parameter in real actual physical quantities, we will use our tank simulation system, so the input here in that case is the tank fill level in liters. That means you have made your analog input scaling somewhere else in your project and you just supply the PID with the actual fill level in liters. Input_PER: This is the input value of your process parameter but comes from the analog input module. That means it will not be scaled and it will be in the range of 0-27648 and the scaling of the input will be done inside the PID. Output: In this case, the PID will give you the controller output value in the range of 0% to 100% of the maximum output value. Output_PER: The same as input_PER, the PID will give the output in the form of 0-27648. Output_PWM: In this case, the PID will give its output signal in the form of ON/OFF pulses, so either there is an output or not. And the output value is then 100% when it is ON and 0% when it is OFF. We will use the same tank simulation system we used before, and as you can see from the previous picture, we used the Input and Output_PER as our simulation is built this way. How to configure the PID? To enter the configuration view of the PID, you can either click the configuration tab in the project tree or from the small configuration icon above the PID block itself. See picture 4. Picture 4. Entering configuration view. This will take you to the functional view where you can configure the different settings of your PID. See picture 5. Picture 5. Controller type setting. The first configuration is the controller type, and here you can choose what type of control you want to use, you have a lot of options from the shown drop-down menus like temperature, pressure, length, and many more. You can also set it to general, where the system will see your values as %. In our system, we are controlling water liters inside a tank, so we will choose volume. You can also set the Manual/Auto mode of the PID. Next, you want to configure the input/output parameters. See picture 6. Picture 6. Input/output parameters. Here you can choose from the different types of inputs or outputs as we explained before. As we said we will use the Input and Output_PER. Next, you need to configure your process value setting. See picture 7. Picture 7. Process value limit. In this step, you will set the low and high limits of your process value. If you choose the Input type. Then this setting will be open to change, and you can set the limits of your process. In our case, the tank limits are 0 to 50 liters. So we set it to these values. Note that, if you choose the Input_PER this setting won’t be available to you and you can only set your process limit from the next tab. See picture 8. Picture 8. Process value scaling. If you use the Input_PER, then as you see from the previous picture you can set your process value limit with respect to the 0-27648 scaling you have. If you want to set up a warning when your process value hit a low or a high limit, then you can configure that in the process value monitoring tab. See picture 9. Picture 9. Process value monitoring. Next in the setting list you will find the PWM limits, see picture 10. Picture 10. PWM limits in here you can set the minimum ON and OFF time of your output, imagine you have a pump or a valve in your system that the PID is controlling through a PWM output, you don’t want the PID to just give your pump a train of a very fast based ON/OFF behavior because that will probably cause your pump to burn out. So you can tell the PID from this setting to turn the pump on for a minimum time before closing it and vice versa. You can have the same control with your PID if you don’t have PWM output from the next setting, the output value limits. See picture 11. Picture 11. Output value limits. You can control the low and high limits of your control output, for example, you can make the low limit 20% and that will make the PID run the pump for at least 20% of its flow. So your control range will be from 20% to 100%. Finally and most importantly, you can set your PID parameters in the configuration mode from the next tab, the PID parameters tab, see picture 12. Picture 12. PID parameters. Here you can write the tuning parameters for your PID gains P, I, and D in case you know them or in case you made the tuning yourself and you have the parameters from elsewhere. You can also choose to decide to use a PID or just a PI controller. If you don’t have these parameters, you can upload them automatically after you make tuning to your PID. How to Perform Tuning of the PID? Now that you finished your PID configuration, you can tune your controller just as easily from the commissioning tab in the project tree. See picture 13. Picture 13. Commissioning your PID On the commissioning page, you have your screen divided into 3 parts, the upper page is where you can start pre-tuning and fine-tuning the PID. In the middle, you will have a graph area to show you the real-time response of your system. You can see the controller output and the process value. And each time the set point changes, you will see the behavior of your PID to catch this new set point. Even if the set point didn’t change but for example the demand from our tank supply is increased, you will see the PID reaction to supply that demand and also keep the set point at its required value. In the third area, you will have the online status of your controller and you can also decide the operating mode of your PID. See the following simulation video showing the auto-tuning procedure of the PID in the TIA Portal. From the video, you can see that after pre-tuning is done, our PID found the P, I, and D parameters to best suit our system. You can see that when the set point or the outflow changes the controller will react very quickly to bring the set point back to the required values. You can now upload your tuning parameters directly into your project with a simple button click, see picture 14. Picture 14. Upload your parameters. Once you have uploaded your parameters, you can find them in the PID parameters tab in the configuration view. See picture 15. Picture 15. PID parameters. The next step should be to perform a fine-tuning procedure to the PID from the same commissioning view, however, because we don’t have a real system and we are just simulating the behavior of the tank and pump using mathematical calculations we can’t do the fine-tuning step. When you have a real system you can make the fine-tuning where your PID will try to find the parameters that will give the system a better response and even eliminate the overshoot of your process value and directly reach the set point. In the future, if we have a real system, we can show what it looks like. What are the different Tuning Methods of PID Controller? You don’t have to make the tuning of your PID using TIA Portal; there are many different methods that try to find the best PID parameters for your system. It is mostly mathematical methods based on trial and error. I would recommend using the auto-tune feature in TIA Portal. But here are some of the methods used to achieve the same parameters. Heuristic tuning. Ziegler-Nichols tuning method Cohen-Coon tuning method Kappa-Tau tuning method Lambda tuning method And a few others. Conclusion Use a cyclic interrupt with your PIDs. Configure your PID to best suit your system. The auto-tune feature in TIA Portal is very useful and effective. -
What is Distributed IO? – Decentralized Peripherals in PLC
caixiaofeng posted A plc and hmi english article in PLC programming learning
In this article we will talk about decentralized Peripherals or distributed IOs, we are not going to look into the TIA Portal, we are just going to discuss what is Distributed IOs and why we need it. Contents: What are External Peripherals or distributed IOs? A simple example to explain the need for Distributed IOs. o 1 machine with a PLC on the machine. o 1 machine with the PLC is far away in a safe place. o 2 or more machines with the same PLC o having an already installed machine with different IO modules (GSD files) conclusion External Peripherals Distributed IO devices, are devices used in automation and control systems. They act as intermediaries between the central controller (PLC) and different sensors and actuators installed in your automation process. Imagine them as messengers that collect information from sensors and deliver commands to actuators. Distributed IO This distributed approach simplifies wiring, instead of having all the wires go directly to the PLC, you install these distributed IO devices at the machine side. They collect information from sensors (like temperature or movement) and send commands to actuators (like motors or valves). This makes the whole system work smoothly, with less wiring, and it’s also easier to manage and expand which results in improving system flexibility. In the next section, we will use some examples to explain the idea and the need for the Distributed IO in a simpler way. Simple example to explain the need for Distributed IO Let’s assume that we have a production machine, this machine is controlled via a PLC, any type of PLC, see picture 1. Picture 1. Production machine controlled via a PLC. As you can see, the PLC controlling the machine is installed on the field at the machine side. As we know PLCs are designed to be able to operate at harsh environments, so it is not totally a bad idea to install the PLC at the machine side, as we know it will be able to withstand the different operating conditions related to the machine, wither it is high ambient temperature, humidity, vibration, etc. Now, what if we need to modify our process and increase the control we have over the machine, meaning we need to increase the number of inputs and outputs of the machine, this will mean that we will need to get a bigger PLC with higher number of IOs, or at least we will need to add IOs modules to the current PLC. You should know that adding extra IO modules to the current PLC will depend on the PLC you have chosen for your project because each PLC has the maximum number of IOs that you can add it to the PLC. So if the extra number of IOs that we need will exceed the maximum number of IOs I can add to the PLC, then I will have to get a bigger PLC, and it will mean rewriting your software to the new PLC or at least migrating your project. See picture 2. picture 2. Bigger PLC for new machine extension. So, with the new extension, we had to get a bigger PLC. NOW, we said that the PLC can be installed in the field and it is designed to withstand harsh environments, but usually, that is not what is done, and usually, the PLC is installed far away in a well-conditioned and protected place like an MCC room. This means that every Input or output signal of our process will have to be connected from the machine side to the PLC is the MCC room, so if I have 100 IOs signals then I will have to pull 100 signal cables between the machine and the PLC. And if I need to make any future extension I will have to pull the extra new cables. See picture 3. Picture 3. Installing the PLC inside the MCC room. As you can see, we now have to pull a cable between the PLC and the machine for each IO signal that we have in our process. This can be acceptable in a small machine with a small number of IOs, but not so much with a large process that has many IOs. Because this will include pulling a large number of cables, this will increase the cost of this process and also will introduce new problems that need to be taken care of, like cable raceways, EMC compatibility, cable trays, and more extra considerations. And here is where the External Peripherals or Distributed IO modules become very useful. See picture 4. Picture 4. Using Distributed IO device. A distributed IO module is simply an IO module that can be installed at the machine side to collect all inputs of the process and send it to the PLC and also gets the output signal from the PLC and sends it to related actuating devices. As you can see from the picture, the connection between the PLC and the machine is now done by pulling a communication cable between the Distributed IO device and the PLC. Distributed IO devices have many communication capabilities, in our example, we assumed a Profinet communication, hence the green color. Using a Distributed IO device will give you the advantage of extending your process IOs without needing to install a larger PLC. You will just add the new IOs to your device and the communication between the PLC is still the same using the Profinet or any other communication method. You can even have a completely new machine controlled with the same PLC, you will just have to pull a new communication cable from the PLC to the new machine. See picture 5. picture 5. Controlling 2 machines with the same PLC. As you can see, to control a completely new machine with my PLC, I would only need one additional communication cable from the PLC and the machine. Offcourse you need to make sure that your PLC capabilities can handle processing and controlling the two machines. One more thing, Distributed IOs can be used with different PLC brands, meaning I can use different brands of distributed IOs with Siemens PLC. See picture 6. picture 6. Using different brands of Distributed IOs. As you can see in the picture one machine is using a SIEMENS distributed IO device and the other machine is using a Schneider distributed IO device and both of them will be controlled via the same PLC. Conclusion Distributed IO devices are used to extend the reach of a control system, allowing for the connection of a large number of sensors and actuators over long distances. Distributed IOs reduces the amount of wiring required compared to a traditional machine-PLC signal connection. It’s easy to add or remove devices in a distributed IOs system, making it highly scalable and reliable. -
How to Configure Distributed IO in a PLC Project?
caixiaofeng posted A plc and hmi english article in PLC programming learning
In a previous article, we gave a simple introduction to the concept of Distributed IO devices, what are they, and why we need them. In this article, we will show how to configure a distributed IO device in our PLC project. As usual, we are focused on the Siemens and TIA Portal systems, so we will show that using Siemens ET200S distributed IO. Contents: Hardware Configuration of Distributed IO Devices. Assign the IO module to a controller. Download the Configuration to the actual hardware Module. Hardware Configuration of Distributed IO Devices The hardware configuration of any Distributed IO device simply means assigning that IO device to a certain controller in your project, so that the Input signal from this IO will go to that PLC and the output command will come from that PLC. Let’s add a PLC to our project and see how we can proceed. See picture 1. picture 1. Add PLC to our project. As you can from the PLC we just added, the PLC already has some centralized IOs, but in this article, we assume that we have a part of the machine that is far away and I need to connect to the PLC, in that case, we would use a Distributed IO device that will be installed at the machine part and it will have all the IOs related to that part of the machine and the Distributed IO device will then communicate with the PLC via a suitable type of communication method like Profinet or Profibus. Distributed IO in a PLC Project Let’s add our ET200S device. See picture 2. picture 2. Add the IO module you need. As you can see from the picture, there are a lot of different IO modules you can choose from depending on your application. We will choose the standard ET200S module. See picture 3. picture 3. Drag and drop the ET200s module As you can see from the picture, just drag and drop the IO module into the Network view of your project. Note that we choose the Profinet interface for the IO module to be the same as our PLC. After adding the ET200S module to our project we can start adding our inputs and outputs modules to the ET200S, you can find all the IOs compatible with the chosen module from the hardware catalog bar on the right, see picture 4. picture 4. Add the IOs to the ET200S. As you can see from the picture, I can add the IOs by dragging and dropping them to the empty areas. The maximum number of IOs I can use with the ET200S depends on the type and specification of it. To add your inputs and outputs modules, just drag it and drop it from the hardware catalog on the right, see picture 5. picture 5. Drag and drop the IOs you need. Assign the IO module to a controller Now, that you added the Distributed IO module to your project, you will notice that the IO device is not assigned or connected to any Controllers. See picture 6. Picture 6. The added IO module is not assigned to PLC. Another way to see that the Distributed IO module is not assigned to any controllers is that there are no addresses assigned to my IOs. As it is not connected to any controllers, see picture 7. picture 7. Addresses are not defined. As you can see in the picture, there I and O addresses area are blank, indicating they are yet to be assigned to a controller. So we need to assign the IO module to a PLC. To assign the IO module to a controller, we need to go to Network view, select the IO module, then right click and press the “Assign to new DP master/IO controller”, see picture 8. picture 8. Assign the IO module to a controller. After you press the “Assign to new DP master/IO controller”, the select IO controller window will appear, where you can choose the PLC you want to assign the IO module to, in our project we only have one controller, so the window will show only one option. See picture 9. picture 9. Select IO controller window. Once you press OK, the IO module will be assigned to the PLC. And now, if you check the device view of the IO module, you will find the inputs and outputs now have been assigned addresses in the project, which means they are now belong to a certain PLC controller. See picture 10. Picture 10. IO module now have assigned addresses. Download the Configuration to the actual hardware Module And that is how you can select and configure a distributed IO module and assigned it to a PLC in your project. However, there is something that you should know, YES, we did assigned our IO module to the PLC, but that was only done in the software side (TIA Portal). The actual Hardware IO device still doesn’t know it is assigned to that PLC. That means If I downloaded my project to the PLC it will be complied and downloaded successfully, but when the PLC need to contact with the IO device to get an input or give an output command it won’t be able to find the device, even though there is a communication cable between the two. And an error will be given by the PLC. To solve this, I have to do something called “ASSIGN DEVICE NAME” To do that, just right click on the IO device and press assign device name, this will open the following window, see picture 11. picture 11. Assign device name. When you click the assign device name the “assign PROFINET device name” window will appear. See picture 12. picture 12. Assign device name window. This procedure is done with hardware devices, but as we don’t have the hardware component and only simulating we can’t see it here. But, simply when you choose the PC/PG interface and click update you should find your IO device, then you just choose assign device name to assign the device name to the actual IO hardware module. Once that is done, you can now use this IO device as a normal IO of the PLC. And you can find the IO module inside the PLC project tree because now it is part of the PLC. See picture 13. Picture 13. The IO module belongs to PLC project tree. -
Distributed IO Sharing Between PLC Systems
caixiaofeng posted A plc and hmi english article in PLC programming learning
In previous articles, we introduced the concept of distributed IO modules, and how to configure an IO module with a PLC. In this article, we will show how to do Distributed IO Sharing Between PLC Systems. Contents: Problem description. Sharing the IO device with two PLCs. Assigning different internal modules to PLCs. Problem description In the previous article, we showed how we can connect and configure a distributed IO module with a PLC and control the IO points of the Distributed module through that PLC. In this article, we discuss the case when we need to use the same distributed IO module with two different PLCs. See picture 1. Picture 1. Two different PLC projects. Distributed IO Sharing Between PLC Systems Imagine that we need to share the inputs and outputs points of the distributed module between the two PLCs. Sharing a distributed IO module between two PLCs is possible but not all modules can do that, but most modern ones can. Another way to share the information would be to get all the information from the distributed IO to one PLC and establish communication between the two PLCs and then exchange the needed data. This will be shown in another article. In the distributed IO device (IO device_1) we have configured many IO modules such as 4DIx24VDC module, 8DOx24VDC module, 2DIx24VDC module, and some more modules. See picture 2. picture 2. Different IO modules in our IO device. Sharing the IO device with two PLCs In this article, we will assume as you see from the picture that we want to control the 4DIx24VDC module and 8DOx24VDC module through PLC_1 and I want to control the 2DIx24VDC module and, 2DOx24VDC module from PLC_2. So I want to share the different modules between the two PLCs, hence the name-sharing devices. As you can see in picture 1, the distributed IO device (IO device_1) is already an extension of PLC_1 as we set that up in the previous article, but we also need to make it an extension of PLC_2 so it can be shared between the two PLCs. See picture 3. picture 3. IO device is an extension of PLC_1 Usually, when doing that we would have each PLC on a different TIA Portal project, but as we don’t have real hardware devices, we will just use one TIA Portal software project to show how to share the distributed IO module between the two PLCs. We have one project with two PLCs. And we need to assign the IO device_1to the PLC_1 and PLC_2 To do that, copy the module in the Network view and paste it to have two modules in your project. See picture 4. picture 4. Copy and paste the IO device. Now, we need to assign this IO device to the PLC_2, as we did with PLC_1 in the last article. See picture 5. picture 5. Assign the module to PLC_2 NOW, if you try to download your project to both PLCs, the PLC_1 will be able to find the IO module. However, PLC_2 will not be able to find the IO module because there is no actual hardware module that is named IO device_2, we have only one hardware IO device and from last article it was configured with the name IO device_1 that is why the PLC_2 will not find the IO device. See picture 6. picture 6. Connection is made through Device Network Name. So, we need to give the same device network name to both IO modules, see picture 7. picture 7. Network device name As you can see, the Network Device Name for the IO module is IO device_1, see picture 8 for the other IO module. picture 8. Network Device Name for the 2nd IO module. Here, the network name is IO device_2. We need to give both IO modules the same name so both PLCs can find it and connect to it. Unclick the automatic name generation option so we can change the name and make both of them IO device_1, also make sure that all information inside the red area is the same in both modules. See picture 9. picture 9. Unclick the automatic generation option. Check pictures 10a and 10b after we changed the information to be the same for both modules. Picture 10a. 2nd IO module. Picture 10b. 1st IO module Now that the two IO modules are identical, both PLCs can find and communicate with the IO module. See picture 11. picture 11. Both PLCs can find the IO module. Up until this point, we were assuming that both PLCs are within the same TIA Portal project. But, in case we are sharing the IO module with a controller in another TIA Portal project, we will do the same as before but we will add an extra step. In this step, we will go to the properties of the IO module and change the shared device IO cycle option as you see in picture 12. picture 12. IO controller outside the project As you can see from the picture, if the two PLCs are of different TIA Portal projects, we will change the value inside the red box to 1. As we have both PLCs in the same project we will keep it zero. Now that both PLCs can see and communicate with the IO device, we need to tell the IO module, which internal modules should communicate with which PLC. As we mentioned in picture 2, we need a 4DIx24VDC module and 8DOx24VDC module to communicate withPLC_1 and I want to control the 2DIx24VDC module and 2DOx24VDC module from PLC_2. We can do that by following the following steps. Assigning different internal modules to PLCs Start by going to the properties of the IO device_1, you will find that all internal modules of the IO device belong to PLC_1. See picture 13. picture 13. Shared device of the IO module. As you can see from the picture, accessing all internal modules of the IO device is assigned to PLC_1, but as we mentioned before we need the last two internal modules 2DIx24VDC module and 2DOx24VDC module to be accessed by PLC_2. To do so, just right-click the module you want and unselect the PLC_1 option, and make it blank to indicate that this module will be controlled through a different controller. See picture 14. picture 14. Unselect internal modules. If you check the device overview of the IO device_1 after you unselect the PLC_1 option, you will see that those internal modules have no addressing assigned with the PLC_1 indicating they belong somewhere else. See picture 15. picture 15. No addressing for modules not assigned to PLC_1 NOW, I need to assign those two modules to the IO device_2 for PLC_2. By doing the same steps as before, go to the shared device properties of the , and assign only the two needed modules with PLC_2. See picture 16. picture 16. Assign needed modules to PLC_2 Now that the 2DIx24VDC module and 2DOx24VDC module are assigned to PLC_2, if you check the device overview you will find their addressing with PLC_2 as we want. See picture 17. picture 17. Addressing belong to PLC_2 That is how we can share one IO module between two PLCs, whether they are in the same TIA Portal project or in two different projects. -
PLC Program to Drain Same Products from Two Tanks
caixiaofeng posted A plc and hmi english article in PLC programming learning
This is a PLC Program to drain the same products from two tanks. Learn the PLC programming with this simple example. Drain the Same Products from Two Tanks Problem Description Two tanks are filled with same products. Draining materials from these two tanks is depended on the requirement of storage tank. Implement logic for this system in PLC using ladder diagram. Problem Diagram PLC Example Solution Here two tanks are used for the system. For level measurement, two sensors are used (level low sensors). As shown in figure we use here two pumps for transferring the materials from tanks (Tank 1 & Tank 2) to storage tanks. Here we will use level transmitter for storage tank level measurement. PUMP 1 & PUMP 2 will be controlled by level transmitter feedback. Here we used two pumps for smooth operation. Both pumps will be operated when level of the storage tanks is detected below its limit. Note:-Here we are consider simple automation for this system. Level transmitter is used in this system and it will measure the level of the storage. Storage tank is taken of 500cm height for simplicity and level transmitter feedback is 4 to 20mA. We will use PLC S7-300 for this application. We will use scaling for programming purpose. List of I/Os List of inputs Cycle START:- I0.0 Cycle STOP :- I0.1 Level low of tank 1 :- I0.2 Level of tank 2 :- I0.3 List of outputs Pump 1 :- Q0.0 Pump 2 :- Q0.1 M memory Cycle ON bit :- M0.0 Analog value from the transmitter :- MW10 (INT) Analog value from the transmitter :- MD100 (DINT) Multiplication value :- MD104 Actual water level (cm) :- MD108 PLC Ladder Diagram for draining the same products from two tanks Program Explanation For this application, we used S7-300 PLC and TIA portal software for programming. Network 1: we used latching circuit for cycle ON (M0.0) output.it can be started by pressing START PB (I0.0) and stop by pressing STOP PB (I0.1). Network 2: Here actual count or value coming from the transmitter is current (4 to 20mA) so by using analog input channel in the PLC we can convert it into digital count. This digit is in INT (MW10) format so we need to convert it into DINT (MD100) for calculation or multiplication. Network 3: DINT value (MD100) is multiplied with max height (500cm) of the tank for calculation purpose. Network 4: Multiplied value (MD104) is divided by max count of the analog module (27648).And final actual height is stored in MD108. Network 5: Here we used comparator for PUMP 1 (Q0.0).During requirement of the material PUMP 3 will be operated by operator, water level height will decrease. So as per our automation or system we need to fill storage tank, pump 1 will be started if water level is less than its limit (here we have taken 480cm). Note:- PUMP 1 should be stop if level low (I0.2) of the tank 1 is detected. Network 6: Here we used comparator for PUMP 2 (Q0.1). During requirement of the material PUMP 3 will be operated by operator, water level height will decrease. So as per our automation or system we need to fill storage tank, pump 2 will be started if water level is less than its limit (here we have taken 480cm). Note:- PUMP 2 should be stop if level low (I0.3) of the tank 2 is detected. During all function cycle should be ON. Note:- Above application may be different from actual application. This example is only for explanation purpose only. We can implement this logic in other PLC also. This is the simple concept of drainage system, we can use this concept in other examples also. All parameters considered in example are for explanation purpose only, parameters may be different in actual applications. Also all interlocks are not considered in the application. Result -
Heating and Mixing of Products using PLC Example Tutorial
caixiaofeng posted A plc and hmi english article in PLC programming learning
This is a PLC Program for automatic heating and mixing of products. Learn the PLC programming with this example for engineering students. Heating and Mixing of Products Problem Description Make an automatic system in which two materials are collected in one tank. All materials are to be mixed till they achieve a predefined set point of temperature. Make a ladder program in S7-1200 PLC for this application. Problem Diagram Problem Solution We can solve this problem by using simple logic. For this system consider two separate level switches to detect the level of two different materials (Lets say Material A & Material B). Also consider one level switch for empty level detection. For controlling the level we can use single acting valve (fully open and fully close type). For mixing, agitator is used and it is connected with motor shaft. Heater and temperature sensor are installed inside the tank. Here materials are mixed until it reaches the set point of temperature and after mixing, outlet valve (Q0.4) will be operated to drain the mixed products. List of Inputs & Outputs Inputs List Cycle START :- I0.0 Cycle STOP :- I0.1 Level of material B :- I0.2 Level of material A :- I0.3 Empty level switch :- I0.4 Temperature sensor :- I0.5 Outputs List Inlet valve 1 :- Q0.0 Inlet valve 2 :- Q0.1 Agitator motor :- Q0.2 Heater :- Q0.3 Outlet valve :- Q0.4 M Memory M0.0 :- Cycle ON PLC Program for heating and mixing of product Program Explained In this problem, we will consider S7-1200 PLC and TIA portal software for programming. Network 1: This network shows simple latching circuit for cycle ON and cycle OFF. Normally Open (NO) contact of cycle START button (I0.0) and NC contact of cycle STOP button (I0.1) for cycle activation. Network 2: This network is to operate Inlet Valve 1(Q0.0). It is operated when Low Level of the tank is detected (I0.4). And it is closed when Level Material A is detected by a switch with address (I0.3). START PB (I0.0) also connected in parallel so if low level not detected, inlet valve can be started by pressing START PB (I0.0). Network 3: This network is to operate inlet valve 2 (Q0.2).It is operated when material A is filled with its desired level. When cycle is running and level of material A is detected, inlet valve 2 (Q0.1) will be ON. Network 4: This network is to operate agitator motor and heater. When tank is full with material A and material B, heater (Q0.3) and agitator motor (Q0.2) will be ON. Network 5: When entire mixing process and heating are completed, outlet valve (Q0.4) will be ON. NC contact of empty level switch (I0.4) is used to stop the outlet valve when tank is empty. Note :- Above logic is for explanation of certain application only. The diagram is for representation purpose, actual system might be different form this system. Result -
PLC Program for Security Alarm System
caixiaofeng posted A plc and hmi english article in PLC programming learning
This is the PLC Program for Alarm Security Systems. Learn the PLC programming with this example problem. Alarm Security System Problem Description Make burglar alarm system program in S7-1200 PLC for the house. Consider one house, in this we want to arrange automatic burglar alarm security system. Alarm should be ON when any person will be detected by the motion sensor. Problem Diagram Problem Solution We can solve this problem by using simple logic. Here we can use two sensors, one motion sensor and second window sensor. Window sensor is the loop of wires. The motion sensor is designed such that when person is detected in a house or room, then the sensor will be activated (change its state to 1 or true) Here important point in window sensor is that current is always passing until the breakage occurs in the glass. Hence output always true and when someone will try to break the window glass, current will not flow in the circuit. List of Inputs and Outputs Inputs List System START :- I0.0 System STOP :- I0.1 Motion detector :- I0.2 Window sensor :- I0.3 Alarm stop button :- I0.4 Outputs List Alarm :- Q0.0 M Memory M0.0 :- Master coil. M0.1 :- Alarm on condition. PLC Ladder Diagram for Alarm Security System Program Description In this problem we will consider S7-1200 PLC and TIA portal software for programming. Network 1: This network shows simple latching circuit for system ON and system OFF. we used Normally Open (NO) contact of system START button (I0.0) and NC contact of system STOP button (I0.1) for system activation. Network 2: When system is activate and motion sensor (I0.2) detects the person entry, alarm on (M0.1) condition will be ON and it will activate the alarm (Q0.0). Normally NC contact of window sensor (I0.3) is used in parallel so in normal condition it is true. If breakage of glass or window condition is detected, window sensor (I0.3) input goes false and it will activate the alarm condition (M0.1). Network 3: In this network latching circuit is used for alarm (Q0.0). If alarm condition is detected (M0.1), alarm will be ON and it can be stopped by pressing alarm STOP PB (I0.4). Note :- Above logic is for explanation purpose only. We can implement this example by using hard wired relay logic also. S7-1200 PLC system is so costly for this simple system. Result -
PLC Program for Flow Totalizer
caixiaofeng posted A plc and hmi english article in PLC programming learning
Make a PLC program to implement a totalizer for the flow meter. The flow meter has 4-20mA output that represents 0 to 100 liters/hour fuel flow in a pipe. PLC Program for Flow Totalizer By using this logic, we can calculate total fuel passed from the pipe. When the totalizer value reaches 5000 liters, then automatically it should be reset or we can reset the value using the RESET button. Problem Solution We can solve this problem by simple logic. Here we consider a flow meter for measuring the fuel with a maximum flow rate of 100 liters/hour. Here we will convert this flow rate from L/H to L/Sec by using DIV instruction for calculation. After that by using 1 second clock pulse, we will store this value in another memory location and every second new value will be added & updated. Here for example we consider the max value for the totalizer to be 5000 liters so after this value totalizer should be RESET. So we will compare this value with the actual value and reset it automatically or we will provide a RESET button to reset the totalizer value. List of Inputs/Outputs Inputs List Reset:- I0.0 M Memory M0.5:- 1 second (1s) clock pulse M1.2:- Positive edge of clock pulse MD10:- Memory word for final output (L/H) of flow meter MD18:- Memory word for final output (L/Sec) of flow meter MD22:-Total liters addition MD26:-Total fuel in liter Ladder Diagram for Totalizer Program Explained In this problem, we will consider S7-300 PLC and TIA portal software for programming. Network 1: Here we have taken final output value of the flow meter in L/H (MD10). By using DIV instruction we converted L/H flow into L/sec and final value stored in MD18. Network 2: Here clock pulse of 1s (M0.5) will add value every second and store the result in memory word MD22. Network 3: Here we moved value of MD22 in MD26 (total fuel in liter) for display purpose. Network 4: In this network we need to reset totalizer. If total fuel is greater than 5000 (5000 value is for example purpose, it is depended on flow meter configuration & it’s range ) then totalizer count should be zero automatically or we can reset by pressing RESET button (I0.0). Note: The above logic is for explanation purpose only. Here we have considered only final output of the scaling, so we have not mentioned 4-20mA scaling in the logic. Result -
PLC Timer Programming Examples – TON, TOF, TP and TONR
caixiaofeng posted A plc and hmi english article in PLC programming learning
PLC Timer Programming Examples – TON, TOF, TP and TONR Discuss about PLC Timer Programming Examples: Different PLC Timers are TON, TOF, TP, and TONR. PLC Timer Instructions and PLC Timer logic examples. PLC Timer Programming Implementation of IEC timers (TON, TOF, TP &TONR) in S7-1200 PLC using TIA Portal. In many applications, there is a requirement to control time or signal flow. For example, a valve, or a motor might need to be controlled to operate for a particular interval of time, switched ON after some time interval or after some delay. Problem Diagram Problem Solution For this problem, we will use IEC timers (TON, TOF, TP &TONR) in S7-1200 PLC with examples. There are a number of different forms of timers that can be found in PLCs. As shown in the above diagram, ON delay timer which becomes ON after a particular time delay. Off delay timers are ON for a fixed period of time after turning OFF input. Pulse timer switches ON or OFF for a fixed period of time. Accumulator timer is which records time intervals. Here consider the example of four motors and four SWITCHES for an explanation of timers. We need to start three motors in different ways. The first motor will start after a 10 sec delay, the second motor will start immediately and off after a 10 sec delay and the third motor will start with a pulse and off with a 10-second delay. The fourth motor will run for a total of 10 sec. List of Inputs/Outputs Inputs List SWITCH 1: I0.0 SWITCH 2: I0.1 SWITCH 3: I0.2 SWITCH 4: I0.3 Reset: I0.4 Outputs List MOTOR 1: Q0.0 MOTOR 2: Q0.1 MOTOR 3: Q0.2 MOTOR 4: Q0.3 PLC Ladder diagram for Timers We can use the Generate-ON-delay or ON delay timer instruction to delay the setting of the Q output by the programmed duration PT. The instruction is started when the result of the input IN changes from 0 to 1 (positive edge). You can monitor the current time value at the ET output of the Timer block. The timer value starts at T#0s and ends when the value of duration PT is reached. The ET output is reset as soon as the signal state at the IN input changes to 0. We can use the Generate off-delay or off-delay timer instruction to delay resetting of the Q output by the programmed duration PT. The Q output is set when the result of the logic operation (RLO) at input IN changes from 0 to 1 (positive signal edge). We can monitor the current time value at the ET output. We can use the Generate pulse instruction to set the output Q for a programmed duration. The instruction is started when the result of the input IN changes from 0 to 1 (positive edge). Programmed time (PT) begins when the instruction starts. In this timer even if a new positive edge is detected, the signal state at the output Q is not affected as long as the PT time duration is running. The Time accumulator instruction or accumulator timer is used to accumulate time values within a period set by the programmed time (PT) parameter. When the signal state at input IN changes from 0 to 1 (positive edge), the instruction is executed, and the duration PT starts. In this case, the Q parameter remains set to 1, even when the signal state at the IN parameter changes from 1 to 0″(negative edge). The R input resets the output Q. Program Description In this problem we will consider S7-1200 PLC and TIA portal software for programming. Network 1: In this network we have used ON delay timer (generate on delay) for MOTOR 1(Q0.0). When the status of the SWITCH 1(I0.0) changes from 0 to 1 the timer instruction will be executed and it will activate the MOTOR 1(Q0.0) after 10s delay. Network 2: In this network we have used off delay timer (generate off delay) for MOTOR 2(Q0.1). When the status of the SWITCH 2(I0.1) changes from 0 to 1 the timer instruction will be executed and it will activate the MOTOR 2(Q0.1) immediately. Also when the SWITCH 2(I0.1) status changes back to 0 then programmed time (PT) will start and after time MOTOR 2(Q0.1) will be OFF. Network 3: In this network we have used pulse timer (generate pulse) for MOTOR 3(Q0.2). When the status of the SWITCH 3(I0.2) changes from 0 to 1 the timer instruction will be executed and it will activate the MOTOR 3(Q0.2) immediately. In this case even new positive edge is detected, the status of the MOTOR 3(Q0.2) is not affected as long as programmed time (PT) is running. Network 4: In this network we have used accumulator timer (accumulator time) for MOTOR 4(Q0.3).When the status of the SWITCH 4(I0.3) changes from 0 to 1 the timer instruction will be executed and MOTOR 4(Q0.3) will start after 10s. The MOTOR 4(Q0.2) will remain ON, even when the input status changes back to 0.The Reset (I0.4) is necessary to reset the timer or accumulated time. Runtime Test Cases -
How to Control VFD with PLC using Ladder Logic?
caixiaofeng posted A plc and hmi english article in PLC programming learning
This is a complete tutorial about PLC ladder logic to control variable frequency drive (VFD) for motor speed control with speed selection from Field Local Panel or SCADA graphics. Execution Steps : Prepare a Control and Power drawing Commissioning and Parameters Programming in VFD Prepare a PLC program Prepare a SCADA design How to Control VFD with PLC ? Control and Power Diagram Commissioning and Parameters Programming in VFD Commissioning is needed for the proper function of VFD. Necessary parameter like Motor Nameplate details, Input Voltage, Motor Type, Frequency should be entered in VFD during quick commissioning. After successful quick commissioning, now it’s a time to install the advanced commissioning. This commissioning is needed to give the details of all the digital and analog inputs and outputs, like Information about Digital inputs of Start command and Speed Selection command Information about Digital Outputs like Status of Drive Running and Drive in Fault etc. Information about Analog Inputs like Speed Input 1 and Speed Input 2 Information about Analog Outputs like Current and Frequency of Motor PLC Program Network 1 : In this Network 1, we are checking whether the VFD is ready to start. This signal will come when all the conditions are healthy as well as safety and power feedbacks are active. Network 2 : In the Network 2, When start button is pressed, VFD Drive_DO bit will be set, if Ready_to_Start and No Error will be there. Network 3 : This is the stop logic, When stop button is pressed it will reset the Drive_DO bit. Network 4 : In this Network 4, this logic is required for safety as soon as Drive_DO bit will set and if any case VFD will not operate due to any fault then after predefined wait time, here we considered it as Run_FB_Time, it will reset the Drive_DO bit and generate Error. This Error you can acknowledge from the SCADA after resolving the error from the field side. Network 5 : In this Network 5, If the VFD is taking more current and gives overload error, then it will reset Drive_DO bit and generate Error. This Error you can acknowledge from the SCADA after resolving the error from the field side. Network 6 : This is the speed selection Digital output, if you select speed input as a local then it will not activate Speed Selection bit resulting Speed_DO absent and if you select speed input as a remote then it will activate Speed Selection bit resulting Speed_DO present. SCADA Design Normal State This is the normal state of motor. There is no error as well as Ready bit is also in normal state. Also the speed selection is in LOCAL mode. Running State This state shows that Ready bit is high and motor is running without any error. Error State There is an error bit is high and motor also showing error condition. Note : In some industries, Yellow color also used to indicate the error condition. Red color is used to indicate motor stop condition. -
What is Ladder Diagram Programming ?
caixiaofeng posted A plc and hmi english article in PLC programming learning
Ladder Diagram (LD) Programming The most common language used to program PLCs is Ladder Diagram (LD), also known as Relay Ladder Logic (RLL). This is a graphical language showing the logical relationships between inputs and outputs as though they were contacts and coils in a hard-wired electromechanical relay circuit. This language was invented for the express purpose of making PLC programming feel “natural” to electricians familiar with relay-based logic and control circuits. While Ladder Diagram programming has many shortcomings, it remains extremely popular in industries automation. Every Ladder Diagram program is arranged to resemble an electrical diagram, making this a graphical (rather than text-based) programming language. Ladder diagrams are to be thought of as virtual circuits, where virtual “power” flows through virtual “contacts” (when closed) to energize virtual “relay coils” to perform logical functions. None of the contacts or coils seen in a Ladder Diagram PLC program are real; rather, they act on bits in the PLC’s memory, the logical interrelationships between those bits expressed in the form of a diagram resembling a circuit. being edited on a personal computer: Ladder Diagram Programming The following computer screenshot shows a typical Ladder Diagram program. Contacts appear just as they would in an electrical relay logic diagram – as short vertical line segments separated by a horizontal space. Normally-open contacts are empty within the space between the line segments, while normally-closed contacts have a diagonal line crossing through that space. Coils are somewhat different, appearing as either circles or pairs of parentheses. Other instructions appear as rectangular boxes. Each horizontal line is referred to as a rung, just as each horizontal step on a stepladder is called a “rung.” A common feature among Ladder Diagram program editors, as seen on this screenshot, is the ability to color-highlight those virtual “components” in the virtual “circuit” ready to “conduct” virtual “power.” In this particular editor, the color used to indicate “conduction” is light blue. Another form of status indication seen in this PLC program is the values of certain variables in the PLC’s memory, shown in red text. For example, you can see coil T2 energized at the upper-right corner of the screen (filled with light blue coloring), while coil T3 is not. Correspondingly, each normally-open T2 contact appears colored, indicating its “closed” status, while each normally-closed T2 contact is uncolored. By contrast, each normally-open T3 contact is uncolored (since coil T3 is unpowered) while each normally-closed T3 contact is shown colored to indicate its conductive status. Likewise, the current count values of timers T2 and T3 are shown as 193 and 0, respectively. The output value of the math instruction box happens to be 2400, also shown in red text. Color-highlighting of Ladder Diagram components only works, of course, when the computer running the program editing software is connected to the PLC and the PLC is in the “run” mode (and the “show status” feature of the editing software is enabled). Otherwise, the Ladder Diagram is nothing more than black symbols on a white background. Not only is status highlighting very useful in de-bugging PLC programs, but it also serves an invaluable diagnostic purpose when a technician analyzes a PLC program to check the status of real-world input and output devices connected to the PLC. This is especially true when the program’s status is viewed remotely over a computer network, allowing maintenance staff to investigate system problems without even being near the PLC! -
What is Human Machine Interface (HMI) ?
caixiaofeng posted A plc and hmi english article in HMI interface design
Programmable logic controllers are built to input various signal types (discrete, analog), execute control algorithms on those signals, and then output signals in response to control processes. By itself, a PLC generally lacks the capability of displaying those signal values and algorithm variables to human operators. A technician or engineer with access to a personal computer and the requisite software for editing the PLC’s program may connect to the PLC and view the program’s status “online” to monitor signal values and variable states, but this is not a practical way for operations personnel to monitor what the PLC is doing on a regular basis. In order for operators to monitor and adjust parameters inside the PLC’s memory, we need a different sort of interface allowing certain variables to be read and written without compromising the integrity of the PLC by exposing too much information or allowing any unqualified person to alter the program itself. One solution to this problem is a dedicated computer display programmed to provide selective access to certain variable’s in the PLC’s memory, generally referred to as Human-Machine Interface, or HMI. HMIs may take the form of general-purpose (“personal”) computers running special graphic software to interface with a PLC, or as special-purpose computers designed to be mounted in sheet metal panel fronts to perform no task but the operator-PLC interface. This first photograph shows an example of an ordinary personal computer (PC) with HMI software running on it: The display shown here happens to be for monitoring an example, a vacuum swing adsorption (VSA) process for purifying oxygen extracted from ambient air. Somewhere, a PLC (or collection of PLCs) is monitoring and controlling this VSA process, with the HMI software acting as a “window” into the PLC’s memory to display pertinent variables in an easy-to-interpret form for operations personnel. The personal computer running this HMI software connects to the PLC(s) via digital network cables such as Ethernet. Note : An older term for an operator interface panel was the “Man-Machine Interface” or “MMI.” This next photograph shows an example of a special-purpose HMI panel designed and built expressly to be used in industrial operating environments: These HMI panels are really nothing more than “hardened” personal computers built ruggedly and in a compact format to facilitate their use in industrial environments. Most industrial HMI panels come equipped with touch-sensitive screens, allowing operators to press their fingertips on displayed objects to change screens, view details on portions of the process, etc. Technicians and/or engineers program HMI displays to read and write data via a digital network to one or more PLCs. Graphical objects arrayed on the display screen of an HMI often mimic real-world indicators and switches, in order to provide a familiar interface for operations personnel. A “pushbutton” object on the face of an HMI panel, for example, would be configured to write one bit of data to the PLC, in a manner similar to a real-world switch writing one bit of data to the PLC’s input register. Modern HMI panels and software are almost exclusively tag-based, with each graphic object on the screen associated with at least one data tag name, which in turn is associated to data points (bits, or words) in the PLC by way of a tag name database file resident in the HMI. Graphic objects on the HMI screen either accept (read) data from the PLC to present useful information to the operator, send (write) data to the PLC from operator input, or both. The task of programming an HMI unit consists of building a tag name database and then drawing screens to illustrate the process to as good a level of detail as operators will need to run it. An example screenshot of a tag name database table for a modern HMI is shown here: The tag name database is accessed and edited using the same software to create graphic images in the HMI. As per this example you can see several tag names (e.g. START PUSHBUTTON, MOTOR RUN TIMER, ERROR MESSAGE, MOTOR SPEED) associated with data points within the PLC’s memory (in this example, the PLC addresses are shown in Modbus register format). In many cases the tag name editor will be able to display corresponding PLC memory points in the same manner as they appear in the PLC programming editor software (e.g. I:5/10, SM0.4, C11, etc.). An important detail to note in this tag name database display is the read/write attributes of each tag. Note in particular how four of the tags shown are read-only: this means the HMI only has permission to read the values of those four tags from the PLC’s memory, and not to write (alter) those values. The reason for this in the case of these four tags is that those tags refer to PLC input data points. The START PUSHBUTTON tag, for instance, refers to a discrete input in the PLC energized by a real pushbutton switch. As such, this data point gets its state from the energization of the discrete input terminal. If the HMI were to be given write permission for this data point, there would likely be a conflict. Suppose input terminal on the PLC were energized (setting the START PUSHBUTTON bit to a “1” state) and the HMI simultaneously attempted to write a “0” state to the same tag. One of these two data sources would win, and other would lose, possibly resulting in unexpected behavior from the PLC program. For this reason, data points in the PLC linked to real-world inputs should always be limited as “read-only” permission in the HMI’s database, so the HMI cannot possibly generate a conflict. The potential for data conflict also exists for some of the other points in the database, however. A good example of this is the MOTOR RUN bit, which is the bit within the PLC program telling the real-world motor to run. Presumably, this bit gets its data from a coil in the PLC’s Ladder Diagram program. However, since it also appears in the HMI database with read/write permission, the potential exists for the HMI to over-write (i.e. conflict) that same bit in the PLC’s memory. Suppose someone programmed a toggling “pushbutton” screen object in the HMI linked to this tag: pushing this virtual “button” on the HMI screen would attempt to set the bit (1), and pushing it again would attempt to reset the bit (0). If this same bit is being written to by a coil in the PLC’s program, however, there exists the distinct possibility that the HMI’s “pushbutton” object and the PLC’s coil will conflict, one trying to tell the bit to be a “0” while the other tries to tell that bit to be a “1”. This situation is quite similar to the problem experienced when multiple coils in a Ladder Diagram program are addressed to the same bit. The general rule to follow here is never allow more than one element to write to any data point. In my experience teaching PLC and HMI programming, this is one of the more common errors students make when first learning to program HMIs: they will try to have both the HMI and the PLC writing to the same memory locations, with weird results. One of the lessons you will learn when programming large, complex systems is that it is very beneficial to define all the necessary tag names before beginning to lay out graphics in an HMI. The same goes for PLC programming: it makes the whole project go faster with less confusion if you take the time to define all the necessary I/O points (and tag names, if the PLC programming software supports tag names in the programming environment) before you begin to create any code specifying how those inputs and outputs will relate to each other. Maintaining a consistent convention for tag names is important, too. For example, you may wish to begin the tag name of every hard-wired I/O point as either INPUT or OUTPUT (e.g. INPUT PRESSURE SWITCH HIGH, OUTPUT SHAKER MOTOR RUN, etc.). The reason for maintaining a strict naming convention is not obvious at first, since the whole point of tag names is to give the programmer the freedom to assign arbitrary names to data points in the system. However, you will find that most tag name editors list the tags in alphabetical order, which means a naming convention organized in this way will present all the input tags contiguously (adjacent) in the list, all the output tags contiguously in the list, and so on. Another way to leverage the alphabetical listing of tag names to your advantage is to begin each tag name with a word describing its association to a major piece of equipment. Take for instance this example of a process with several data points defined in a PLC control system and displayed in an HMI: If we list all these tags in alphabetical order, the association is immediately obvious: Exchanger effluent pump Exchanger effluent temp out Exchanger preheat pump Exchanger preheat temp in Exchanger preheat valve Reactor bed temp Reactor feed flow Reactor feed temp Reactor jacket valve As you can see from this tag name list, all the tags directly associated with the heat exchanger are located in one contiguous group, and all the tags directly associated with the reactor are located in the next contiguous group. In this way, judicious naming of tags serves to group them in hierarchical fashion, making them easy for the programmer to locate at any future time in the tag name database. You will note that all the tag names shown here lack space characters between words (e.g. instead of “Reactor bed temp”, a tag name should use hyphens or underscore marks as spacing characters: “Reactor bed temp”), since spaces are generally assumed by computer programming languages to be delimiters (separators between different variable names). Like programmable logic controllers themselves, the capabilities of HMIs have been steadily increasing while their price decreases. Modern HMIs support graphic trending, data archival, advanced alarming, and even web server ability allowing other computers to easily access certain data over wide-area networks. The ability of HMIs to log data over long periods of time relieves the PLC of having to do this task, which is very memory-intensive. This way, the PLC merely “serves” current data to the HMI, and the HMI is able to keep a record of current and past data using its vastly larger memory reserves. If the HMI is based on a personal computer platform (e.g. Rockwell RSView, Wonderware, FIX/Intellution software), it may even be equipped with a hard disk drive for enormous amounts of historical data storage. Some modern HMI panels even have a PLC built inside the unit, providing control and monitoring in the same device. Such panels provide terminal strip connection points for discrete and even analog I/O, allowing all control and interface functions to be located in a single panel-mount unit. -
PLC System Documentation
caixiaofeng posted A plc and hmi english article in PLC programming learning
The PLC documentation is a very important engineering record of the process control steps, and, as with all technical descriptions, accurate detailed engineering records are essential. Without accurate drawings, changes and modifications needed for upgrading and diagnostics are extremely difficult or impossible. Every wire from the PLC to the monitoring and control equipment must be clearly marked and numbered at both ends, and recorded on the wiring diagram. The PLC must have complete up-to-date ladder diagrams (or other approved language), and every rung must be labeled with a complete description of its function. The essential documents in a PLC System are: 1. System overview and complete description of control operation; 2. Block diagram of the units in the system; 3. Complete list of every input and output, destination, and number; 4. Wiring diagram of I/O modules, address identification for each I/O point, and rack locations; 5. Ladder diagram with rung description, number, and function. It is also necessary to have the ability to simulate the ladder program off-line on a personal computer, or in a background mode in the PLC, so that changes, upgrades, and fault simulations can be performed without interrupting the normal operation of the PLC, and the effects of changes and upgrades can be evaluated before they are incorporated. -
PLC Programming Examples on Industrial Automation
caixiaofeng posted A plc and hmi english article in PLC programming learning
Develop PLC Programming Examples on Industrial Automation according to the logic given below, A Saw, Fan and oil pump all go ON when a start button is pressed. If the saw has operated less than 20s, the oil pump should go off when the saw is turned off and the fan is to run for an additional 5s after the shutdown of the saw. If the saw has operated for more than 20s, the fan should remain on until reset by a separate fan reset button and the oil pump should remain on for an additional 10 s after the saw is turned off. Write a PLC program that will implement this process. PLC Programming Examples Program Description: Rung 0000: Start/Emergency Stop PB latched with memory B3:0/0. Rung 0001: B3:0/0 enabled to turn on Saw (O: 0/0), Fan (O: 0/1 ) and Oil pump (O:0/2). Normally closed contact of Stop switch is in series Saw output to turn off. Fan reset switch and Timer T4:0 is connected to turn off Fan when condition meets. Timer T4:2 done a bit and memory bit is to turn off the oil pump. Rung 0002: When the stop is pressed, according to the logic mentioned in point 2, Fan output (O: 0/2) needs to turn off after 5s. Comparator block restricts the timer T4:0 to run after the 20s of Saw operation. Rung 0003: Timer T4:1 runs when the start is pressed. When the stop is pressed at any point after the 20s, Saw output will go off. After 10s, the oil pump will go off. This operation is done by Timer T4:2. Timer T4:0 done bit is used to restrict the Timer T4:1 operation when T4:0 is ON. Rung 0004: Less than a comparator block is used to perform the logic mentioned in point 2, to turn off Fan when saw output operation was less than 20s. Program Output: Now we see the simulation of above ladder logic for different conditions as mentioned below. When Start PB is pressed When Stop switch pressed before the 20s When Stop switch pressed after the 20s When Fan reset switch is pressed Conclusion: We can use this example to understand the programming logic in Allen Bradley PLC.