Tuesday 17 October 2017

Twincat Gleitender Durchschnitt


SYSBIOS Industrial SDK 02.01.00.01 Benutzerhandbuch Industrial SDK Einführung Das SYSBIOS-basierte Software Development Kit (SDK) für die industrielle Kommunikation ist für die Mikroprozessorfamilie Sitara AM335x und AM437x ARM (mit PRU-ICSS IP) ausgelegt. Das SDK ermöglicht es Kunden, industrielle Kommunikation, Motorsteuerung und Rückmeldung schnell und einfach in ihr System zu integrieren. Durch die Bereitstellung aller grundlegenden System-Software-Komponenten sofort verfügbar, ermöglicht das Kit Entwickler auf ihren Anwendungscode konzentrieren, wo sie die meisten Differenzierung hinzufügen können. Das SDK ist optimiert, um in Echtzeit industrielle Kommunikationsprotokolle wie EtherCAT, Profibus, Profinet, EthernetIP und Motorfeedback-Funktionen wie EnDat, BISS, Sigma Delta Decimation Filter zu unterstützen. Das SDK enthält einen Echtzeit-SYSBIOS-Kernel mit niedrigem Speicherbedarf und Boot-Loader sowie industrielle Anwendungen, um schnell zu starten. Das SYSBIOS Industrial SDK vereint alle Softwarekomponenten und Tools, die für die Entwicklung von SYSBIOS-basierten Anwendungen am ARM benötigt werden. Das SDK unterstützt AM437x IDK und AM335x ICEv2 Hardware-Plattform und enthält die folgenden Open-Source-SYSBIOS Echtzeit-Betriebssystem (RTOS) Bootloader für AM437x IDK und AM335x ICEv2 mit Unterstützung von verschiedenen Peripheriegeräte Bibliothek Peripherietreiber mit SYSBIOS Unterstützung IDK und ICEv2 Probe integriert zu booten Applikationen für IDK und ICEv2 Code Composer Studio integrierte Entwicklungsumgebung (IDE) v.6.1 Beispiel für industrielle Inputoutput Anwendungen über Kommunikationsprotokolle wie EtherCAT Motor und Drive Rückkopplungsmöglichkeiten mit Unterstützung für Schnittstellen wie EnDat, Sigma Delta Decimation Filter etc. Evaluierungsversionen Von Protocol Stacks für industrielle Kommunikation wie EtherCAT, EnDat und viele andere zur Erleichterung der Softwareentwicklung Das Industrial SDK wird unterstützt AM437x IDK und AM335x ICEv2 Ein hochrangiges Blockdiagramm von AM437x IDK ist unten gezeigt. Abbildung 1 AM437x Industrial Development Kit Ein High-Level-Blockdiagramm von AM335x ICEv2 ist unten gezeigt. Abbildung 2 AM335x Industrial Communication Engine v2 Referenzdokumente SDK-Verzeichnisstruktur - Dieser Ordner enthält den Quellcode für die interfacespezifische Schnittstellenimplementierung (zB: Digital OutputsInputs, Flash etc.) - Dieser Ordner enthält den Quellcode für die Motorsteuerung (FOC und IQMATH) Docs - Dieser Ordner enthält die PDF-Versionen der Beispiele für die Versionshinweise, Benutzeranleitung und Getting Started - Dieser Ordner enthält Beispiele, deren Projektdateien, Quell - und Include-Dateien. Benutzer können die Anwendung in CCS mit diesen Dateien erstellen. Weitere Informationen zum Aufbau einer Anwendungsschnittstelle finden Sie im Getting Started Guide - Dieser Ordner enthält die unterstützten Steuergeräte-Schnittstellenquelle, den Header und die Firmware osdrivers - Dieser Ordner enthält Quellcode und Include-Dateien für den SYSBIOS-Treiber für AM437x und eine vorgefertigte Bibliothek. Protokolle - Dieser Ordner enthält unterstützte industrielle Automatisierungsprotokollbibliotheken und Quellcodes und ihre Projektdateien. Starterware - Hierbei handelt es sich um StarterWare-Code, der Device-Abstraction-Layer-Bibliotheken und Peripherie-Level-Sampledemo-Beispiele zur Verfügung stellt, die die Fähigkeiten der Peripheriegeräte auf einer noOS-Plattform demonstrieren. Siehe StarterWare-Tools - Hier finden Sie Werkzeuge zur Unterstützung der Anwendungsentwicklung. Für zB GEL-Dateien. Systemvoraussetzungen AM437x IDK oder AM335x ICEv2 Windows-Host-Maschine mit mindestens 2 GB RAM Micro SD Card Software160 Code Composer Studio Version CCS 6.1.0.00104 Industrie SDK Version 2.1.0.1 SYSBIOS 6.41.4.54160Real Time Operating System XDC-Tool 3.31.2.38core NDK 2.24.2.31 Compiler GNU v4.8.4 (Linaro) Serielle Konsolen-Terminal Anwendung (wie Teraterm, Minicom, HyperTerminal) Das SDK-Setup installiert folgende Elemente in der Maschine. SDK Quelldateien, CCS-Projektdateien, vorgefertigte Bibliotheken und Dokumente Der Installationsprozess verwendet eine Umgebungsvariable namens IASDKHOME, die auf den Speicherort der sdk-Installation festgelegt wird. Diese Variable wird von sdk-Beispielen für Include - und Library-Pfade verwendet. Dies sollte ether als Projekt oder als benutzerdefinierte CCS-Variable definiert werden. Vorgefertigte Binärdateien und Bibliotheken Die SDK-Installation enthält die folgenden vordefinierten Bibliotheken. Diese Bibliotheken können verwendet werden, um Benutzeranwendungen schnell zu erstellen. Libecatslavestackgcc. a 160 - 160 EtherCAT Slave Stapelbibliothek einschließlich PRU Firmwares. SDK Pfad - 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) - Protokollsatzhercatslavestacklibam437x 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) protocolsethercatslavestacklibam335x libethernetipstack. a 160.160.160 -160 EtherNetIP Slave Stack Bibliothek SDK Path - 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) protocolsethernetipadapterstacklibam437x 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) protocolsethernetipadapterstacklibam335x libprofibus. a160160160160160160160160160160160160160 160 -160 Profibus Slave Bibliothek SDK Pfad Stack - 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) protocolsprofibusslavestacklib libprofinetslavestackgcc. a160160160160 160 -160 Profinet Slave-Stackbibliothek SDK Pfad - 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) Protokollsprofinetslavestacklibam437x 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) protocolsprofinetslavestacklibam335x libsnmpcoregcc. a160160160160 160 -160 SNMP Kernstapel Bibliothek SDK Path - 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) protocolssnmpcorestacklibam437x 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) protocolssnmpcorestacklibam335x libsysbiosdriver. a 160- 160 SYSBIOS spezifische Implementierung für Peripheriegeräte und EVM Funktionalität SDK Pfad Zugriff - 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) osdriverslibam437x 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) osdriverslibam335x libboard. a 160- 160 StarterWare Bibliothek für Board Details SDK Pfad - 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) starterwarebinaryboardlibam43xx-evma9ccsam43xxrelease 160 160 160 160 160 160 160 160 160 160 160 160 (IASD - ) starterwarebinaryboardlibam335x-evma8ccsam335xrelease libdal. a 160- 160 Starterware DAL spezifische Initialisierung Bibliothek SDK Path - 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) starterwarebinarydallibam43xx-evma9ccsam43xxrelease 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) starterwarebinarydallibam335x-evma8ccsam335xrelease libdevice. a 160- 160 StarterWare Bibliothek für Peripheriegeräte SDK Path - 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) starterwarebinarydevicelibam43xx-evma9ccsam43xxrelease 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) starterwarebinarydevicelibam335x-evma8ccsam335xrelease libsoc. a 160- 160 StarterWare SOC Bibliothek SDK Path - 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) starterwarebinarysoclibam43xx-evma9ccsam43xxrelease 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) starterwarebinarysoclibam335x-evma8ccsam335xrelease libutils. a 160- 160 Starterware Utils libary SDK Path - 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) starterwarebinaryutilslibam43xx-evma9ccsam43xxrelease 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 (IASDKHOME) starterwarebinaryutilslibam335x-evma8ccsam335xrelease Das SDK enthält keine vordefinierten Binärdateien, jedoch können Binärdateien, die unter Verwendung von SDK-Beispielen erstellt wurden, separat heruntergeladen werden. Alle vorgefertigten Binaries außer dem Bootloader sind boardunabhängig. Bitte beachten Sie die Hinweise zum Download-Link zum Download. Endatdiagnostic - Beispielanwendung, die EnDat-Master-Funktionalität demonstriert. Ethercatslave - Beispielanwendung demonstriert EtherCAT Slave Funktionalität. Ethernetmac - Beispielanwendung demonstriert Ethernet-MAC-Funktionalität über PRU-ICSS. Exampleutils - Beispielanwendung, die verschiedene Peripheriegeräte auf der Platine demonstriert. Motorsteuerung - Beispielanwendung zur Motorsteuerung. Profibusslave - Beispielanwendung demonstriert Profibus-Slave-Funktionalität. Profinetslave - Beispielanwendung demonstriert die Profinet Slave Funktionalität. Sddfguiclient - Beispielanwendung demonstriert SDDF-Funktionalität. SYSBIOS-Treiber Das Industrial SDK stellt eine Treiberbibliothek für den Zugriff auf Geräteperipheriemodule aus einer SYSBIOS-Anwendung bereit. Dies hat die Implementierung von PRU-ICSS NDK NIMU Treiber, PRU-ICSS LLD und ICSS-EMAC LLD Quellen und anderen Dienstprogrammen. 160. Die Projektdateien finden Sie unter IASDKHOMEosdrivers. Für AM3x und AM4x (am335xrelease, am437xrelease) gibt es unterschiedliche Buildkonfigurationen. PRU ICSS Low Level Driver unterstützt die Anwendungstreiber, mit dem PRU Subsystem zu kommunizieren. Dieses Modul verfügt über APIs, die zum Initialisieren von PRU, zum Laden der Firmware und zum Konfigurieren von PRU-ICSS INTC usw. verwendet werden können. Weitere Informationen finden Sie unter osdriversdocs ICSS EMAC LLD (ICSS EMAC Driver) ist eine Ethernet-Treiber-Implementierung über PRU-ICSS. Der Treiber ermöglicht die Ethernet-Fähigkeit des PRU-ICSS mit Hilfe der Firmware. Dieser Treiber verfügt über APIs, die die Kommunikation zwischen allen High Level DriverApplication und EthernetIP oder Profinet Firmware ermöglicht. Der ICSS EMAC-Treiber kann sowohl den EMAC-Modus als auch den Switch-Modus unterstützen (abhängig von der in PRU-ICSS geladenen Firmware). Weitere Informationen finden Sie unter osdriversdocs Das Industrial SDK bietet eine Treiberbibliothek für den Zugriff auf Geräteperipheriemodule aus einer Anwendung. Dies hat Implementierungen für digitale Eingänge, digitale Ausgänge, Flash-Speicher (QSPI und SPI), Rotary Switch und LCD integriert 160 Die Projektdateien finden Sie auf der IASDKHOMEboard. Es gibt verschiedene Build-Konfigurationen für AM3x und AM4x (am335xrelease, am437xrelease) Bootloader Starterware bietet einen einfachen Bootloader, der auf eine MMCSD-Karte kopiert oder auf QSPIflashSPI Flash geflasht werden kann. Nach einem Power-On-Reset kann die MMCSD-Karte oder der Flash bootstrap die Karte booten. Darüber hinaus kann der FlashSD-Karten-Bootloader eine Anwendung von der MMCSD cardFlash auf DDR oder Internes RAM laden und das Steuerelement an die Anwendung übertragen. Dies kann verwendet werden, um eine Applikationsbelastung vom Reset bereitzustellen. Weitere Informationen zum Laden und Erstellen des Bootloaders finden Sie im Starterware-Benutzerhandbuch in starterwaredocs. Folgende Beispiele und die CCS-Projektdateien sind im IA-SDK-Installationspaket enthalten. Einzelheiten zum Importieren und Erstellen von Beispielanwendungen in CCS finden Sie im Handbuch SYSBIOS Industrial SDK Getting Started .160 Die Projektdateien finden Sie unter IASDKHOMEexamples. Es gibt verschiedene Baugruppen für AM3x und AM4x (am335xrelease, am437xrelease) Unterstützte Boards Die Jumper J18 und J19 müssen entsprechend eingestellt werden, um den CPSW - oder ICSS-Modus zu wählen. Pin2 und Pin3 müssen für den ICSS Modus und Pin1 und Pin2 für den CPSW Modus angeschlossen werden. EnDat-Diagnose EnDat ist eine bidirektionale Schnittstelle für Positionsgeber. Beim EnDat-Betrieb erhält der EnDat-Master Positionsinformationen vom EnDat-Positionsgeber. Die EnDat-Diagnoseanwendung für SYSBIOS demonstriert den EnDat-Masterbetrieb am AM437x. Diese Anwendung wird mit einer Terminalschnittstelle gesteuert, die eine serielle über USB-Verbindung zwischen dem PC-Host und dem EVM verwendet. Schließen Sie ein USB-Kabel zwischen dem PC und dem EVM an. Eine serielle Terminalanwendung (wie teraterm hyperterminal minicom) wird dann auf dem Wirt durchgeführt. Wählen Sie zum Konfigurieren die serielle Schnittstelle aus, die dem über USB über das EVM emulierten Port entspricht. Die serielle Schnittstelle des Hosts sollte auf 115200 Baud, keine Parität, 1 Stopbit und keine Durchflussregelung konfiguriert sein. EnDat-Geber an Bordsteckverbinder J10 anschließen. EnDat-Encoder können an den Onboard-Steckverbinder J10 (Kanal 0) oder zusätzliche Transceiver-Schaltkreise angeschlossen werden, um Kanal 1 oder 2 zu verwenden (siehe Hinweis) Der EnDat-Treiber verfügt über einen definierten Satz von APIs, um die EnDat Master-Schnittstelle freizulegen. Die Diagnose ruft diese APIs auf, um EnDat zu initialisieren, den Host-Trigger-Modus zu konfigurieren, den Kanal auszuwählen und die Firmware auszuführen. Sobald diese Schritte ausgeführt werden, wartet der Treiber darauf, dass die EnDat initialisiert wird. Dann wird die Taktfrequenz auf 200 KHz gesetzt (da die Ausbreitungsverzögerung noch nicht kompensiert ist) und erhält die Encoderdetails einschließlich Seriennummer, Positionsauflösung usw. und Anzeigen auf der Konsole. Basierend darauf, ob Encoder 2,2 oder 2,1-Typ ist, setzt es die Uhr entweder auf 8 MHz oder 1 MHz. Bei der Konfiguration der Uhr über 1 MHz wird die Laufzeitverzögerung mit Hilfe der automatisch geschätzten Laufzeitverzögerung berücksichtigt (Benutzer kann sie auch überschreiben) Sobald die Initialisierung abgeschlossen ist, stellt die Diagnose dem Benutzer ein selbsterklärendes Menü zur Verfügung. Es werden zwei Arten von Menüoptionen dargestellt. Ein Typ (1-14) sendet einen EnDat-Befehl nach EnDat 2.2-Spezifikation. Der andere Typ (100-107) erlaubt es dem Anwender, die Taktfrequenz, verschiedene Timing-Parameter, die Simulation des Motorregelkreises mit dem 2.1-Befehl sowie den 2.2-Befehl mit Sicherheit (redundante Positionsinformation) zu konfigurieren, auf Dauerbetrieb umzuschalten und Rohdaten zu überwachen. Nachdem der Benutzer einen EnDat-Befehl ausgewählt hat, fragt die Diagnose nach weiteren Einzelheiten, um den Befehl zu definieren, und führt eine grundlegende Verständnisüberprüfung der benutzerdefinierten Werte durch. Dann wird die EnDat-API aufgerufen, um den Befehl zu verarbeiten. Der empfangene EnDat wird mit den definierten APIs verarbeitet. Das Ergebnis wird dann dem Benutzer präsentiert. HINWEIS: Um Kanal 1 oder 2 funktionsfähig zu machen, sind zusätzliche Transceiver-Schaltungen wie in 2 erforderlich (dies macht aber auch den SD-Boot nicht funktionsfähig) und R541 auf AM437x IDK muss entfernt werden. EtherNetIP HINWEIS 1: 160 Die permanente Speicherung der EthernetIP-Geräteparameter ist aktiviert und in SPI Flash bei verschiedenen Offsets, wie in der Datei eipmain. h definiert, gespeichert. HINWEIS 2: Um die ACD-Adresse (Address Conflict Detection) in der Anwendung zu unterstützen, wird eine Legacy-Methode verwendet Zum Konfigurieren von NDK-Parametern. Bei diesem Ansatz wird die Konfiguration von NDK unter Verwendung der Konfigurations-APIs und nicht des Konfigurationswerkzeugs von XGCONF innerhalb von CCS durchgeführt. Dies ist, weil eine Konfiguration, die durch XGCONF-Tool hinzugefügt wird, überschrieben wird. Weitere Informationen zu diesem Ansatz finden Sie im Link. ANMERKUNG 3: 160 Für die Durchführung der im ODVA-Konformitätsprüfbericht angegebenen Subnetzmasktests (Test 4.1) ist ein Neubau des NDK erforderlich. Das Makro INCLUDEACDSUPPORT muss in der Datei NDKINSTALLDIRpackagestindkstackllilliin. c definiert werden. Dann wird das NDK umgebaut ANMERKUNG 4: 160Die EthernetIP-Anwendung kann geändert werden, um als Switch-Anwendung zu arbeiten, indem die EthernetIP-Abhängigkeiten entfernt werden. Die Schritte zum Erstellen der Switch-Anwendung finden Sie hier HINWEIS 5: 160Die NDK-Leistung des ICSS-Emac-Treibers kann durch Erhöhen der Warteschlangengröße (Prioriy Queue 4 bei EthernetIP) verbessert werden. Um diese Verbesserung zu aktivieren, ändern Sie den Makro QUEUE4SIZE in icssswitch. h von 97 (3KB) auf 194 (6KB). Es ist jedoch wichtig, dass die gesamte Warteschlangengröße nicht mehr als 12 KB beträgt. Das Beispiel ist eine Demo-Applikation des EtherNetIP-Adapters, die auf dem Molex-EtherNetIP-Stack auf dem NDK TCPIP stack160160 basiert. Das EtherNetIP ist ein industrieller Netzwerkstandard, der kommerzielle Standard-Ethernet-Kommunikations-Chips und physikalische Medien nutzt. Das EtherNetIP verwendet ein offenes Protokoll (CIP) auf der Anwendungsschicht. Dieses Beispiel ist eine begrenzte Demo-Anwendung, die beschränkt ist, so dass ein Benutzer es nur für eine Stunde ausführen darf. Die EtherNetIP-Adapteranwendung wird über die Implementierung von Low-Latency-Cut-Through-Switches auf ICSS 160 implementiert. Das Ethernet-System für industrielle Kommunikationssubsysteme (ICSS) unterstützt einen DLR - (Device Level Ring) - Knoten, der ein von ODVA spezifiziertes Ringredundanzprotokoll ist Dieser Implementierung sind Unterstützungen 200 us Beacon Intervall und 400 us Beacon Timeout Intervall Unterstützt Lerntabelle Exception für Supervisor Dynamischer Start und Stop. Benutzer kann DLR on the fly aktivieren oder deaktivieren Keine Benutzerkonfiguration erforderlich. Die Ringparameter werden einzeln konfiguriert. 160 Die ACD-Adresse (Address Conflict Detection) ist im Beispiel aktiviert. Beim Start überprüft die Anwendung das im SPI-Flash gespeicherte ACD-Freigabebit (bei Offset SPIEEPROMACDOFFSET). Wenn deaktiviert, startet die Anwendung sofort, andernfalls wartet sie, bis der Link hochgefahren ist. Sobald die Verbindung hergestellt ist, wird der ACD-Mechanismus gestartet. Die IP-Adresse wird erhalten, sobald die ARP-Prüfung abgeschlossen ist und keine doppelte IP-Adresse erkannt wird. Diese Anwendung erlaubt es dem Benutzer, die folgenden Aktionen auszuführen und kann über die serielle Konsole konfiguriert werden Start-Modus Start-Stack im IO-Austausch Modus Stopp-Modus Stoppen IO-Austausch-Modus Run-Modus In diesem Modus IO Daten werden mit Scanner ausgetauscht Idle-Modus - keine Daten Austausch mit Scanner. Nur Kommunikation. Copy-in-out-Modus Kopieren Sie die Daten vom Scanner in die OUT-Daten. Inkrement-Modus Stack erhöht die OUT-Daten periodisch. IP-Adresse ändern - IP-Adresse des Gerätes kann manuell konfiguriert werden. Löschen des nichtflüchtigen Speichers - Diese Option löscht die gespeicherten Gerätekonfigurationen aus dem nichtflüchtigen Speicher. Die für das ODVA CTT verwendete stc-Datei wird zusammen mit der Anwendung im stc-Ordner zur Verfügung gestellt. Die EDS-Datei für die Applikation befindet sich unter (IASDKHOME) protocolsethernetipadaptereds. Die EthernetIP-Anwendung verwendet eine Modulstatus-LED U1 auf IDK und D1 auf ICE V2) und eine Netzwerkstatus-LED U2 auf IDK und D2 auf ICE V2). Für eine schnelle Prüfung und Demonstration der EtherNetIP-Funktionalität kann ein EIPTool, erhältlich von Molex, verwendet werden, um CIP-Verbindungen herzustellen und CIP-Attribute abzufragen oder einzustellen. Weitere Informationen zur Verwendung von EIPTool mit einer Beispielanwendung finden Sie hier Einsatz von EIPTool mit AM335x EtherNetIP Adapter Applikation Einsatz auf ICE V2 Für den Betrieb mit dem ICE V2,160 müssen die Jumper J18 und J19 auf ICSS eingestellt sein. Pin2 und Pin3 sind für den ICSS-Modus angeschlossen.160 Ethernet MAC Dieses Beispiel ist eine Ethernet-Dual-Mac-Implementierung. Die Anwendung verfügt über zwei MAC-Instanzen mit jeweils unabhängiger IP-Adresse. Standardmäßig wird die IP-Adresse übernommen. Die IP-Adresse der Instanz 2 (Port 2) wird über die CFG-Datei konfiguriert. Im Stack init hook Callback ist die IP-Konfiguration der Instanz 1 (Port1) zugeordnet. Dieses Beispiel läuft auf dem ICSS-EMAC-Treiber und verwendet NDK als TCPIP-Stack. Die Ethernet-MAC-Anwendung ist abhängig von libsysbiosdriver. a, libboardsupport. a und einigen Starterware-libs. Sobald die Anwendung geladen ist, werden die Details auf der Uart-Konsole gedruckt. Die Tricolor-LED (U1 auf IDK und D1 auf ICEv2) blinkt grün, um anzuzeigen, dass die Anwendung läuft Dual-Mac-Anwendung verwendet den ICSS-EMAC-Treiber im emac-Modus. Hier funktionieren beide Firmwares, die auf beiden PRUs laufen, unabhängig voneinander, sodass die Applikation auch als Single MAC modifiziert werden kann. Der ICSS-EMAC-Treiber muss entsprechend für den DualSingle-MAC-Modus initialisiert werden. Weitere Informationen finden Sie im Abschnitt SYSBIOS-Treiber. Darüber hinaus gibt es einige Änderungen im QoS-Schema. Von den vier Empfangs-Warteschlangen sind zwei für jeden Ethernet-MAC reserviert. So stehen die Warteschlangen 1 und 2 exklusiv für Port 1 EMAC zur Verfügung, während Queue 3 und 4 nur für PORT2 EMAC verfügbar sind. Auf dem Übertragungsweg gibt es keine Änderung und vier Warteschlangen stehen für jeden Port zur Verfügung. ANMERKUNG 1: SDK Unterstützt zwei unterschiedliche Versionen der EtherCAT-Anwendung. 1 .160Einfache Demo-Anwendung160 - Eine EtherCAT-Beispielanwendung, die mit einer vorgebauten EtherCAT-Stapelbibliothek (libecatslavestackam437x. a) erstellt wurde. Dies ermöglicht eine begrenzte Entwicklung unter Verwendung der SSC5.10-Stapelbibliothek über eine Probenanwendungsschnittstelle, die einen 32-Bit-Eingang und einen 32-Bit-Ausgang bereitstellt. Eine Objekt-Wörterbuch-Anpassung ist in dieser Auswertungsversion nicht möglich. Dies ist die Standardkonfiguration für EtherCAT. Die Projektdateien für diese Anwendung finden Sie in (IASDKHOME) examplesethercatslave. Die Beispielanwendung wird in der Quelle ausgeliefert, der EtherCAT-Stack wird jedoch nur im Objektformat geliefert. 2.160160Full Feature Demo Application160160-160 Dies ist eine vollwertige Anwendung und bietet volle Flexibilität und Konfigurierbarkeit. Diese Anwendung benötigt jedoch Zugriff auf die gesamte Stackquelle. Gemäß den SLA-Begriffen kann TI den Stack (Beckhoff Slave Sample Code) nicht im Quellformat verteilen. Um diese Anwendung zu erstellen, muss der Benutzer den SSC 5.10-Quellcode von der ETG-Website erhalten und den bereitgestellten Patch verwenden. Die Projektdateien für diese Anwendung finden Sie unter (IASDKHOME) protocolsethercatslaveecatappl. Bitte beachten Sie die Details in späteren Abschnitten. Weitere Informationen finden Sie im Abschnitt "Building Full Feature EtherCAT" dieses Dokuments. Diese Anwendung160 enthält die Motorsteuerungsfunktionalität HINWEIS 2: 160 Beide EtherCAT-Anwendungen unterstützen die nichtflüchtige Speicherung von ESI-EEPROM. Die Anwendung schreibt die Daten in den nichtflüchtigen QSPI-Speicher nur in den INIT - und PREOP-Zuständen. Dies kann bei der voll funktionsfähigen Anwendung deaktiviert oder aktiviert werden, indem das EEPROMSPI-Makro in tiescbsp. h definiert wird. Diese Funktion kann nicht in begrenzter Demo geändert werden Dieser Ordner hat TI EtherCAT Slave einfache Demo-Anwendung zusammen mit Konfigurations-XML-Datei. Der Benutzer kann das CCS6-Projekt mit dem Namen EtherCAT starten und erstellen. Nach erfolgreicher Erstellung wird eine Datei EtherCATti. bin erzeugt (in sdkexamplesEtherCATslaveDebugGNU). Dies kann auf QSPI geflasht oder auf SD-Karte kopiert werden. Weitere Informationen zum Erstellen einer Anwendung finden Sie im Getting Started Guide. Alternativ kann ethercat. out von CCS zu A8 (AM335x) oder A9 (AM437x) geladen werden. Diese Anwendung zeigt die EtherCAT-Schnittstelle, LED-Lichtsteuerungen. Wenn die vollwertige EtherCAT-Anwendung verfügbar ist, zeigt die Anwendung auch eine Motorsteuerungsanwendung. Die Motorsteuerungsanwendung demonstriert eine sensorgesteuerte dreiphasensensorische feldorientierte Steuerung (FOC) für einen einzelnen Permanentmagnet-Synchronmotor (PMSM) unter Verwendung der AM337x-ADCs (Standard) oder Sigma-Delta-Dezimierungsfilterung (erfordert zusätzliche Modulator-AMP-Schnittstellenkarte 3 und ADCSDDF-Makro) Muss im Projekt definiert werden) und optional die EnDat 2.2 Master-Schnittstelle mit einem EnDat-Encoder an den Motor angeschlossen. Die Motorsteuerungsanwendung wurde mit einem Permanentmagnetmotor (BLY171D-24V-4000, Anaheim Automation) validiert. Dieser ist mit einem EnDat 2.2 Encoder (ROQ 437, Heidenhain) gekoppelt. Bei dieser Demonstration wird der Motorantrieb vom IDK über die drei Klemmen von J17 zur Verfügung gestellt. Wenn kein Geber verwendet wird oder ein Geber vorhanden und an der längeren Welle des Motors befestigt ist, sind die Anschlüsse vom EVM zum Motor: Das rote Kabel vom Motor sollte an J17-1 angeschlossen werden. Das schwarze Kabel vom Motor sollte an J17-2 angeschlossen werden. Der gelbe Draht des Motors sollte an J17-3 angeschlossen werden. Wenn der Geber an der kürzeren Welle des Motors befestigt ist, sind die Verbindungen vom EVM zum Motor: Der gelbe Draht des Motors sollte an J17-1 angeschlossen werden. Das schwarze Kabel vom Motor sollte an J17-2 angeschlossen werden. Das rote Kabel vom Motor sollte an J17-3 angeschlossen werden. Der Geber sollte an den Steckverbinder J10 angeschlossen werden. Wenn eine Sigma-Delta-Dezimierungsfilterung verwendet wird, wird AM437x IDK J17-1,2 amp 3 mit dem Negativ des Kanals 3 bzw. 2 amp 1 der Modulator-Karte verbunden. Dann betrachten Sie positiven Anschluss des Kanals 3, 2 Ampere 1 als J17-1, 2 Ampere 3 und machen die Verbindungen, wie im obigen Absatz erwähnt. Um die TI-EtherCAT-Slave-Beispiel-App zu testen, kann man TwinCAT oder einen anderen kompatiblen EtherCAT-Master verwenden. Im Folgenden finden Sie die Schritte zur Verwendung von TI-Slave mit TwinCAT. Weitere Details zur TwinCAT-Konfiguration finden Sie hier. Installieren von TwinCAT3 (Eine Monatsauswertung steht auf der Beckoff-Website TwinCAT 3 Download zur Verfügung.) Wählen Sie den Installationsmodus für eXtended Automation Engineering (XAE) Kopieren Sie sdkexamplesethercatslaveesiTiEtherCATLib. xml zu ltDrivegt: TwinCAT3.1ConfigIoEtherCAT-Ordner Starten Sie den TwinCAT XAE (VS2010) Erstellen Sie ein neues TwinCAT-XAE-Projekt: Datei gt Neues gt-Projekt gt TwinCAT-Projekt Goto TwinCAT gt Echtzeit-kompatible Geräte anzeigen und TwinCAT RT Ethernet-Zwischentreiber installieren Für die beste Leistung wird empfohlen, eine kompatible NIC-Karte mit der Bezeichnung "Unterstützte Netzwerksteuerung" zu verwenden Schließen Sie das CAT5 - Ethernet - Kabel vom TwinCAT PC an den EtherCAT INPort0 (J1 in AM335x, J6 in AM437x) von IDK an, falls dies der Fall ist, bitte immer überprüfen, ob der Ethernet - Adapter unter installierten und betriebsbereiten Geräten aufgeführt ist Verbinden Sie die Verbindung zu EtherCAT OUTPort1 (J2 in AM335x. J9 in AM437x) mit Port0 des nächsten IDKs. Für den letzten IDK in der Kette wird Port1 offen gelassen. Im Solution Explorer gehen Sie zu Ihrem neuen TwinCAT Projekt gt I0 gt mit der rechten Maustaste Device1 (EtherCAT) gt wählen Sie Scan-Boxen. Wenn die Scan-Boxen ausgegraut sind, wählen Sie TWINCAT gt Restart TwinCAT (Konfigurationsmodus) Die TI-Box n (ti-esc) wird automatisch erkannt. Bei der Ausführung von TwinCAT 2 unter Windows XP - Wählen Sie nun Device1 (EtherCAT) und goto Aktionen gt Wählen Sie SetReset TwinCAT in den Konfigurationsmodus oder verwenden Sie die Tastenkombination SHIFT-F4. Alternativ - Wenn Sie TwinCAT 3 unter Windows 7 ausführen - Wählen Sie nun Device1 (EtherCAT) und dann TwinCAT und dann Reload Devices. Es erscheint ein Dialog, in dem Sie die Load IO Devices fragen. Wählen Sie Yes Next. Dadurch wird der TI ESC in den OP-Modus versetzt. Alternativ können Sie Toggle Free Run State verwenden. Die Anwendung sollte zeigen, Digital-Out-LEDs 1 bis 8 auf Ein. Dies zeigt an, dass Slave im INIT-Zustand ist. Der EtherCAT-Gerätezustand kann durch Auswahl eines Gerätes (Doppelklick auf Gerät) und Auswahl der Registerkarte Online angezeigt werden. Das Gerät sollte sich im OP-Zustand befinden, ohne verlorene Frames oder TxRx-Fehler. Wenn ein anderer Modus oder Fehler angezeigt wird, kann die Schnittstelle mit Schritt 7 neu initialisiert werden. Beim Start setzt die Anwendung die LEDs 1 bis 8 auf EIN. Dies zeigt an, dass Slave im INIT-Zustand ist. Abbildung 2 TwinCAT Status Control Display Der Benutzer kann Digital Out LEDs mit TwinCAT steuern. Wählen Sie TI-Box n (ti-esc) gtDO Ausgänge gt LED1-8, um die Ausgangs-LEDs zu steuern. 1. Die LEDs werden durch Auswahl einer LED N eingestellt und wählen dann die Registerkarte Online. 2. Die LED wird ein - und ausgeschaltet, indem Sie schreiben und den Wert auf 1 bzw. 0 einstellen. Abbildung 3 TwinCAT-LED-Steuerungsanzeige Um den Motor mit TwinCAT zu steuern (nur in der vollen Anwendung verfügbar), 1. Die Motordrehzahl wird durch Auswahl von 160TI Boxn (ti-esc) gtMotorausgänge-gtData und Auswahl der Registerkarte Online eingestellt. Die Drehzahl kann zwischen 1000 (für 4000 U / min in Vorwärtsrichtung) und -1000 (4000 U / min in Gegenrichtung) eingestellt werden. Dieses gleiche Datenfeld dient auch als Positionseingang (im Lageregelmodus). Im Positionsmodus entspricht eine 0 0 Grad, während eine 1000 360 Grad entspricht. 2. Der Wert wird in den Regler eingegeben, indem Sie die Taste Schreiben wählen, einen Wert eingeben und OK wählen. Abbildung 4 TwinCAT Motor Control Display Das Feld Command ermöglicht die Einstellung der lsw-Variablen. Das Feld "Count" erlaubt die Einstellung der msw-Variablen. Beachten Sie hierzu das Blockschaltbild für die Darstellung der Variablenfunktion lsw amp msw. Die Grundeinstellung für die Motorsteuerung FOC ist LEVEL4 (geschlossene Drehzahlschleife mit EnDat-Stellungsrückmeldung). Die Build-Ebene kann mit BUILDLEVEL in foc. h geändert und dann das Projekt neu erstellt werden. In LEVEL4 sind die Variablen lsw und speed. Der Standardwert für lsw ist 0. Für einen offenen Geschwindigkeitsregelsatz lsw auf 1. Stellen Sie lsw auf 2 für eine geschlossene Drehzahlschleife ein. Abbildung 5 TwinCAT FOC Level 4 Bei LEVEL5 sind die Steuergrößen lsw und angle. In dieser Konfiguration wird lsw 0 (Voreinstellung) die Positionsregelung ausgeschaltet. Um die Positionsregelung zu aktivieren, setzen Sie lsw auf 1 oder 2. 1. Wie bereits beschrieben, wird die Position durch Auswahl von TI-Box (TIESC-00n) - gt Motorausgänge - gt Daten und Auswahl der Registerkarte Online eingestellt. Die Position kann auf einen Wert zwischen 0 und 1000 eingestellt werden. Eine 0 entspricht 0 Grad, während eine 1000 360 Grad entspricht. Der Wert wird in die Steuerung eingegeben, indem Sie die Schaltfläche Schreiben wählen, einen Wert eingeben und OK wählen. Abbildung 6 TwinCAT FOC Level 5 LEVEL6 ist eine Kombination aus LEVEL4 amp LEVEL5. In Stufe 6 sind die Steuergrößen msw, lsw, Geschwindigkeit und Winkel. Wenn msw 0 (Voreinstellung), arbeitet der FOC im Geschwindigkeitsregelungsmodus. Verwenden Sie in diesem Modus die Einstellungen für lsw und speed, wie zuvor in LEVEL4 beschrieben. Die Winkeleingabe wird nicht verwendet, wenn msw 0 ist. Um den Positionsregelsatz msw 1 einzuschließen. In diesem Modus arbeitet die Winkelsteuerung wie in LEVEL5 beschrieben. In dieser Konfiguration werden die Geschwindigkeits - und lsw-Einstellungen ignoriert. Beispiel Utils Die Beispiel Utils-Anwendung veranschaulicht, wie auf eine Peripherie von einer SYSBIOS-Anwendung aus zugegriffen werden kann. Diese Anwendung zeigt digitale Ausgänge, digitale Eingänge, Drehschalter und Flash-Speicher (SPI auf ICEv2 und QSPI auf IDK). Diese Anwendung nutzt auch das LCD-Panel auf ICEv2. Beim Laden der Anwendung erscheint ein Menü auf dem UART-Terminal, um verschiedene Peripheriegeräte auszulösen. Diese Anwendung ist abhängig von der libsysbiosdriver. a, libboardsupport. a und ein paar Starterware libs. Die Projektdateien für diese Bibliotheken sind im SDK enthalten und können mit jeder erforderlichen Modifikation neu erstellt werden. Nach dem Ändern und Erstellen von Bibliotheken sollten Benutzer die Anwendung erneut erstellen. Motorsteuerung Die Motorsteuerungs-Demo demonstriert eine sensorgesteuerte dreiphasensensorische Feldorientierte Regelung (FOC) eines einzelnen Permanentmagnet-Synchronmotors (PMSM) mit den AM337x ADCs (Standard) oder Sigma-Delta-Dezimierung (erfordert zusätzliche Modulator-Amp-Schnittstellenkarte 4 und ADCSDDF-Makro muss im Projekt definiert werden) und optional die EnDat 2.2-Master-Schnittstelle und ein EnDat-Encoder an den Motor angeschlossen. Der FOC-Algorithmus sorgt für eine reibungslose Geschwindigkeitsregelung mit hoher Dynamik. Der FOC-Algorithmus wandelt die 3-Phasen-Wechselstrommessungen auf d-q-Achsenwerte um, die die Steuerung von Drehmoment und Fluss erlauben. Diese Anwendung erfordert, dass der USB-Port des EVM mit dem Host-PC verbunden ist, um eine UART über USB-Verbindung zwischen dem EVM und dem Host-PC zu ermöglichen. Eine serielle Terminalanwendung (wie teraterm hyperterminal minicom) wird dann auf dem Wirt durchgeführt. Um das Terminal zu konfigurieren, wählen Sie die serielle Schnittstelle, die dem über USB über das EVM emulierten Port entspricht. Die serielle Schnittstelle des Hosts sollte auf 115200 Baud, keine Parität, 1 Stopbit und keine Durchflussregelung konfiguriert sein. Der Motorantrieb wird vom IDK über die drei Klemmen von J17 zur Verfügung gestellt. If no encoder is used or an encoder is available and attached to the longer shaft of the motor, then the connections from the EVM to the motor are: The Red wire from the motor should be connected to J17-1. The Black wire from the motor should be connected to J17-2. The Yellow wire of the motor should be connected to J17-3. Alternatively, if the encoder is attached to the shorter shaft of the motor, then the connections from the EVM to the motor are: The Yellow wire of the motor should be connected to J17-1. The Black wire from the motor should be connected to J17-2. The Red wire from the motor should be connected to J17-3. The encoder should be to be connected to the onboard M12 connector J10. If sigma delta decimation filtering is used, AM437x IDK J17-1,2 amp 3 to be connected to negative of channel 3, 2 amp 1 of modulator card respectively. Then consider positive terminal of channel 3, 2 amp 1 as J17-1, 2 amp 3 and make the connections as mentioned in the above paragraph. The Motor control application has been validated using a Permanent Magnet Motor (BLY171D-24V-4000, Anaheim Automation). This is coupled to an EnDat 2.2 encoder (ROQ 437, Heidenhain). The motor can be controlled via terminal console. If an EnDat encoder is attached - Upon executing the run command the terminal window will display. Figure 8 EnDat Display when Encoder is Attached If an EnDat encoder is not attached - Upon executing the run command the terminal window will display. Building Full Feature EtherCAT Application Building Full Feature SNMP stack Building Bootloader Generating Executable Binary - Post Build Script Technical Support and Product UpdatesContact and Coil Nearly In Control There8217s a certain class of product for which you8217re much better off to buy online. Specifically, you8217re looking for things that are commodities (but not dollar-store items), durable, small, and lightweight. Here are some things where you8217ll find a much better deal on e-Bay, etc.: Brother-compatible labeling Tape (aka TZ-Tape) as low as 5cartridge Ink Cartridges Button cell batteries (leading brand CR20328217s for less than 1 ea.) AAA Duracell batteries, packs of up to 100 Car lighter USB adapters (especially the high power 2.4 amp ones) All electronic parts, obviously For AA batteries, apparently there8217s evidence that Costco8217s Kirkland brand AA batteries are actually rebranded Duracell batteries, so I can8217t find a better price than them online. Since practically all electronics parts are made in China, you can get them on AliExpress for extremely low prices and you can usually get free shipping. I regularly purchase Arduino compatible or ESP8266 boards, prototyping supplies, power supplies and sensors mail order from AliExpress with free shipping, all for less than 10, sometimes as low as 1.80 with free shipping, and the only down-side is that you have to wait a month or two. If you need it faster, and it8217s a more popular item, it8217s likely there8217s a small importer that has some for sale on e-Bay in your own country, for a slight markup. This is true for batteries, chargers, ink and tape cartridges and usually for popular microcontroller boards. Over the past year I8217ve been working on a TwinCAT 3 Tutorial. and with the posting of the 13th chapter about the TwinCAT 3 Scope View. I8217m considering it 8220complete.8221 I8217ve covered all the major topics that I wanted to cover. Writing a tutorial like this was actually a learning experience for myself. Before I made any statement about the software I tried to validate my assumptions first, and many times I learned that I had preconceived notions about how it worked which may not have been completely accurate. If you8217re a TwinCAT 3 programmer, then you need to know your tool set inside and out. If you8217re not sure how something works, it8217s best to setup a quick test and try it out. That8217s one of the advantages of PC-based software: if you want to run a test, your office PC is a laboratory environment. Write some code and run it. Thank you to everyone who offered feedback on the existing sections, and to those of you who kept pushing me to continue writing more. I sincerely hope this can be that missing link to take people from the world of traditional PLCs into the more interesting and ultimately more powerful world of PC-based control. It looks like TwinCAT 3 has a viable future ahead of it. Interest seems to be growing over time (according to Google Trends, anyway): That makes TwinCAT 3 a valuable skill to learn if you8217re an integrator, and an interesting technology to investigate for existing plants. Staring down the barrel of a big automation programming project is intimidating. It8217s hard to even know where to start. Even when you8217ve done a few before, you8217re only marginally more confident the next time. I have quite a few big automation programming projects under my belt, so I think I can generalize the process a bit. Here goes: 1. Get the Prints There8217s almost no point in starting to program unless you have an almost final set of electrical drawings. If you don8217t have them yet, push for them, and go do something else productive until you get them. 2. Create a Functional Specification You don8217t always have to write out a functional specification, but it at least needs to exist very clearly in your head. If at any point, you don8217t know exactly how the machine is supposed to work in excruciating detail, stop writing code and go figure it out. Ask stakeholders, talk to operators, whatever it takes. Functional specifications are best written as a list of 8220user stories8221. If you8217re not sure what a functional spec should look like, check out Painless Functional Specifications by Joel Spolsky. 3. Shamelessly Copy Identify what other projects you can find with logic that you can steal. Any code that works in another machine has the advantage of already being debugged. Don8217t re-invent the wheel. (At the same time, never blindly copy logic without understanding it. Copying the code by re-typing it one rung at a time is still faster than writing it from scratch, and it8217s a form of software review.) 4. Structure Your Project Now you break open the ladder logic programming software and start creating your project. Pick your CPU type, setup the IO cards based on the electrical drawings. Map your inputs. Plan out your program by creating programs or routines for each functional unit of the machine. Setup your fault summary rungs and your alarm logic. 5. Write the Manual Mode Logic PLC logic is typically written 8220bottom up.8221 Manual mode logic is the lowest level of logic because it deals directly with individual functions in the machine. Advance cylinder. Retract cylinder. Home axis. Jog axis. While you8217re writing the manual mode, this is when you take extreme care making sure that actions are interlocked so the machine can8217t crash. If you8217re using the Five Rung Pattern. this means paying attention to what goes in the Safe rung. Does cylinder A always have to advance before cylinder B can advance The Safe rungs should reflect that. Make sure that even in manual mode, the operator (or you) can8217t break the machine. Make sure to hook your faults and alarms into the applicable fault summary rungs and alarm logic. 6. Write Part Tracking Logic Now that manual mode is complete, write the logic that tracks parts (and their state) through the machine. Remember, you should be able to run the machine in manual mode, and the part tracking should (ideally) work correctly. I know this isn8217t always the case but surprisingly part tracking in manual mode can work 95 of the time. That means part tracking works based on the state of the machine. Closing the gripper with the robot in the pick position and the part present in fixture sensor on should latch a bit 8220remembering8221 that the gripper has a part in it. Once you8217ve written your part tracking logic, go back and use the part tracking and state bits to condition your Safe rungs. Don8217t let the operator (or you) mistakenly open the gripper if the gripper has a part and isn8217t in a safe position to let go of the part. Of course, you may need to add a way to manually override this (that8217s what output forcing was created for), but in most cases you want to prevent improper operation. Part of writing the part tracking logic is adding 8220ghost buster8221 screens. Operators often need to remove parts from a cell, and if the machine can8217t detect their removal, then you have to provide the operator with a way to clear these 8220ghosts.8221 At this point you8217re actually ready to dump the program in and start testing out the machine electrically and mechanically. While it8217s ideal to have a fairly complete program when you go onsite, we all know that8217s not always entirely possible. At the very least you want to get to this point before startup begins. 7. Write the Auto Mode Logic The complexity of your auto mode logic depends on what type of machine you8217re programming. You8217ll always need a cycle start and a cycle stop feature. Even if you8217re in auto mode, you usually don8217t want the machine to start until the operator specifically tells it to start. Once it8217s running, we call this 8220in auto cycle.8221 In simple machines, you can write the auto logic by filling in the Trigger rungs in your Five Rung logic. Start by putting the In Cycle contact at the beginning of the rung, and then writing logic after that which expresses when the action should take place. For instance, an advance reject part cylinder8217s Trigger rung could be as simple as In Cycle, Part Present, and Part Rejected. As long as the Part Present tracking bit gets cleared once the cylinder is in the advanced position, then this is all the auto mode logic you need for this motion. Have the retract Trigger rung be In Cycle, No Part Present and Not Retracted. More complicated machines need more complicated auto mode logic. If your machine has to perform a series of steps (even if some of them are in parallel) then consider using the Step Pattern. If your machine needs to choose between several possible courses of action (commonly seen in a storage and retrieval system) then consider using the Mission Pattern . It8217s hard to write correct logic. Review your functional specification, point by point, and make sure your logic meets all of the requirements. Check your logic for errors. A fresh look often uncovers incorrect assumptions, typos, and outright mistakes. The earlier you find and fix problems, the easier they are to fix. Make a list of everything you have to do during startup. Starting up a machine is time consuming and therefore expensive. Anything you can do to prepare saves you time and money. Good luck, and keep your fingers out of the pinch points This information is for a Fanuc R30-iA, RJ3-iA or RJ3-iB controller but might work with other ones. If you8217re looking for a way to send the robot world TCP position (X, Y, Z, W, P, R) over to the PLC, it8217s not actually that difficult. The robot can make the current joint and world position available in variables, and you can copy them to a group output in a background logic task. There is one caveat though: the values only update when you8217re running a program. They don8217t update while jogging. However, there is a work-around for this too. First you should make sure that the feature to copy the position to variables is enabled. To get to the variables screen, use MENU, 0 (Next), 6 (System), F1 (Type), Variables . Find this variable and set it to 1 (or True): SCRGRP1.mposenb The name of that variable is Current position from machine pulse Now create a new robot program, and in it write the following: GO1:X POS(SCRGRP1.MCHPOSX10) GO2:Y POS(SCRGRP1.MCHPOSY10) GO3:Z POS(SCRGRP1.MCHPOSZ10) GO4:W ANG(SCRGRP1.MCHPOSW100) GO5:P ANG(SCRGRP1.MCHPOSP100) GO6:R ANG(SCRGRP1.MCHPOSR100) Note that I8217ve multiplied the X, Y, and Z positions by 10, so you will have to divide by 10 in your PLC. Likewise I multiplied the W, P, and R angles by 100, so divide by 100 in the PLC. To run this program in the background, use MENU, 6 (Setup), F1 (Type), 0 (Next), BG Logic . Configure it to run your new program as a background task. Obviously you need to send these group outputs to the PLC. EthernetIP is great for this, but you can use hardwired interlocks too. You need to make sure that you have enough bits to handle the full range of motion. A 16-bit integer should work pretty well for all of these. Note that the robot will happily send negative numbers to a group output as two8217s complement, so make sure you map the input to the PLC as a signed 16-bit integer (a. k.a. INT in most PLCs). For the X, Y, and Z positions, a 16-bit integer will give you from 3276.7 mm to -3276.8 mm of total range. For the W, P, and R angles you8217ll get 327.67 deg to -327.68 deg. For most applications this is good (remember this is TCP, not joint angles). Please check that these are suitable though. As I said, these numbers don8217t update while you8217re jogging, and won8217t update until the robot starts a move in a program. One little trick is to do a move to the current position at the start of your program: PR100:SCRATCHLPOS J PR100:SCRATCH 10 FINE This starts sending the position without moving the robot. In my programs I typically enter a loop waiting for an input from the PLC, and inside this loop I turn a DO bit on and off. The PLC detects this as a 8220ready for command8221 heartbeat, and as long as the PLC sees this pulsing, then it knows the program is running and the position data is valid. Another trick you can use is to detect when the robot has been jogged: The name of this variable is Robot jogged . The description from the manual is: 8220When set to TRUE, the robot has been jogged since the last program motion. Execution of any user program will reset the flag.8221 That8217s how you get the world position of the TCP into the PLC. If you just want joint angles, you can use SCRGRP1.MCHANGn as the variable, where 8220n8221 is the joint number. Important note . The IO will probably change asynchronously to the program scan, so what you want to do is make a copy of the X, Y, Z, W, P, R values coming into the PLC and compare the current values to the values from the last scan. If they haven8217t changed, then update your actual values, otherwise throw them away because they might not be valid. If you have a fast scanning PLC and IO then you should still be able to keep up with the robot even during a fast move. If you have a slow scan time on your PLC, then you might only get valid stable values when the robot is stopped. Now what if you want to know what the TCP position is relative to one of your user frames The robot controller doesn8217t seem to give you access to this, but the PLC can at least calculate the X, Y, and Z positions of the TCP in your user frame itself, given the world position and the user frame parameters. First you need to find the accurate user frame parameters. Under the normal frames screen you can only get one decimal point of accuracy, but you need the full 3 decimal points to have your numbers in the PLC match the user frame position given in the robot. You can find these accurate positions in a variable: use MENU 8211 0,6 (SYSTEM) 8211 F1 (TYPE) 8211 Variables 8211 MNUFRAME1,9 8211 F2 (DETAIL) . The second index in square bracket is the frame number, so MNUFRAME1,1 is frame one and MNUFRAME1,2 is frame 2. Copy these numbers down exactly. Here8217s the math for calculating the TCP relative to your user frame. All variables are LREAL (which is a 64-bit floating point variable). I don8217t know if you can use a regular 32-bit float or not. Result is your TCP in user frame. Point is your point in world frame (from the robot) and Frame is the accurate user frame data you copied from the MNUFRAME variable. Result. Xmm : Point. Xmm - Frame. Xmm Result. Ymm : Point. Ymm - Frame. Ymm Result. Zmm : Point. Zmm - Frame. Zmm RadiansW : DegreesToRadians(-Frame. Wdeg) CosOfAngleW : COS(RadiansW) SinOfAngleW : SIN(RadiansW) RadiansP : DegreesToRadians(-Frame. Pdeg) CosOfAngleP : COS(RadiansP) SinOfAngleP : SIN(RadiansP) RadiansR : DegreesToRadians(-Frame. Rdeg) CosOfAngleR : COS(RadiansR) SinOfAngleR : SIN(RadiansR) Fanuc applies rotations WPR as W (around Z), P (around Y), R (around X) AROUND Z temp : Result. Xmm Result. Xmm : Result. Xmm CosOfAngleR - Result. Ymm SinOfAngleR Result. Ymm : Result. Ymm CosOfAngleR temp SinOfAngleR AROUND Y temp : Result. Zmm Result. Zmm : Result. Zmm CosOfAngleP - Result. Xmm SinOfAngleP Result. Xmm : Result. Xmm CosOfAngleP temp SinOfAngleP AROUND X temp : Result. Ymm Result. Ymm : Result. Ymm CosOfAngleW - Result. Zmm SinOfAngleW Result. Zmm : Result. Zmm CosOfAngleW temp SinOfAngleW Note that DegreesToRadians() is just PIdeg180 . Run that on your PLC and check that the values in your Result variable match the user frame TCP position reported on the teach pendant. I haven8217t gotten around to calculating the W, P, and R angles of the TCP in user frame yet. Currently I just look at W, P, and R in world frame if I need to know if I8217m 8220pointed at8221 something. If you get the math to work for W, P, and R, I8217d really appreciate if you could share it. In recent years I8217ve been interested in the effects of automation on our economy and our society. Throughout history every advance in technology has brought more wealth, health, and opportunity to pretty much everyone. With every revolution people changed jobs but their lives got significantly better. When farms mechanized, workers moved into the city and got factory jobs, and Henry Ford8217s assembly lines made use of this labor to great effect. Early factories needed labor in great quantities and as industrial processes became more efficient at utilizing labor, the value of human labor rose and the demand kept increasing. So did pay. Factory workers up through the 708217s could afford a nice house to raise a family, a big car, and even a boat or nice vacations. Since the 708217s however, the purchasing power of a factory worker or even a bank teller has been pretty flat. These are two professions that have seen the most advances in automation in the last 30 years, due to industrial robots and automated tellers. If automation makes workers more productive, why aren8217t we seeing that translate into purchasing power There are two types of technological improvements at work here. A farmer with a tractor is very productive compared to one with a horse and plow. The displaced farm workers who went to the city were given the tools of the industrial revolution: steam engines, motors, pumps, hydraulics, and so forth. These technologies amplified the value of human labor. That8217s the first kind of technological improvement. The second kind is the automated teller or the welding robot. The older technology adds value even to the lowest skilled employees, but the new technology is reducing their value and the new jobs require significantly higher skill levels. There8217s something about this new revolution that8217s just8230 different . The demand for low skill labor is drying up. The increasing divide between the 8220haves8221 and the 8220have-nots8221 has been documented extensively. Some divide is good and promotes the economy and productivity. Too much separation is a recipe for significant problems. I8217m not the only one worrying about this issue, and as I8217ve followed it over the last few years I8217ve been surprised by the amount of interest in a Guaranteed Minimum Income or some such plan. Basically it involves getting rid of every low-income assistance plan such as social security, welfare, minimum wage laws, etc. and creating a single universal monthly benefit that everyone is entitled to. Some people are talking about a number as high as 24,000 per year per adult. Considering that the 2015 federal poverty level in the US is just below 12,000 for a single adult, you can see that 24,000 per adult isn8217t just a trifling amount. For comparison, a little Googling tells me that the US GDP per capita is around 55,000. Think about that for a second. You8217re talking about guaranteeing almost 45 of the productivity output of the country to be distributed evenly across all adults . One presumes you would also provide some extra money per child in a household, but to be fair the 8220per capita8221 figure includes kids too. It8217s possible. Sure seems a bit crazy though. Is it practical Won8217t some people choose not to work Will productivity go down It turns out that we8217ve done some experimenting with this type of program in Canada called MINCOME. The results were generally positive. There was a small drop in hours worked by certain people, mostly new mothers and teenagers. These costs were offset in other areas: 8220in the period that Mincome was administered, hospital visits dropped 8.5 percent, with fewer incidents of work-related injuries, and fewer emergency room visits from car accidents and domestic abuse.8221 More teenagers graduated. There was less mental illness. I8217m fiscally conservative, but I8217m mostly pragmatic. It8217s only my years of exposure to automation, technology and working in factories that makes me ask these questions. Not only do I believe that people should contribute, I believe that people need to contribute for their own happiness and well-being. That8217s why I don8217t think paying people to sit at home is the ultimate solution. The elephant in the room is this: as technology improves, a greater proportion of the population will simply be unemployable . There, I said it. I know it8217s a disturbing thought. Our society is structured around the opposite of that idea. Men are particularly under pressure to work. The majority of the status afforded to men in our society comes from their earning potential. The social pressure would still be there to work, even as a supplement to a guaranteed minimum income, so we still need to find something for those people to do. Perhaps if we expand the accepted role of men in society then we can fill that need with volunteer work. Maybe. What8217s the right answer I don8217t know. For lack of a better term, the 8220American Dream8221 was accessible to anyone if you were willing to work hard and reinvest that effort into yourself. Not everyone did that, but many people created significant fortunes for themselves after starting in the stockroom and working their way up. That security gave people a willingness to take risks and be entrepreneurial. Proponents of the idea say that a minimum income would bring back that innovative edge. Entrepreneurs could try new ideas repeatedly until they found one that worked, and not worry about their family starving. With your basic necessities met, you could start to realize your potential.. I do know that as we continue down this road of increasing automation, we can8217t be leaving a greater and greater proportion of the populace without the basic resources they need to survive. Do we expect them to grow their own food On what land Do we expect them to do a job that I could program a robot to do, if the robot8217s average cost is only 10,000year Do you have some valuable job we can retrain them to do One that pays enough to support a family Look, I don8217t like the alternatives either, but it8217s better than an armed revolt.

No comments:

Post a Comment