60
AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ASIMON2D Version 1.1 Seite 1 von 30 Beispielprogramm S7-300 / S7-400 Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x / Basis V2.x / V1.x "ASIMON2D" (FB 102) Version 1.1 Dokumentation Ausgabe 08/2007

Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

Embed Size (px)

Citation preview

Page 1: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 1 von 30

Beispielprogramm S7-300 / S7-400

Diagnose-Baustein AS-i Sicherheitsmonitor

Erweitert V2.x / Basis V2.x / V1.x

"ASIMON2D" (FB 102)

Version 1.1

Dokumentation Ausgabe 08/2007

Page 2: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 2 von 30

Inhaltsverzeichnis 1 Gewährleistung, Haftung und Support ............................................................................................. 4

2 Einstellungen in der Konfiguration des Sicherheitsmonitors............................................................ 5 2.1 Datenauswahl ........................................................................................................................... 5 2.2 Bausteinindex-Zuordnung......................................................................................................... 5

3 Beschreibung des Funktionsbausteins FB102 "ASIMON2D" .......................................................... 6 3.1 Bausteinparameter.................................................................................................................... 7

3.1.1 Eingangsparameter ........................................................................................................... 7 ASIMON_in_0 [Pointer] ........................................................................................... 7 ASIMON_out_0 [Pointer] ......................................................................................... 8 ASIMON_out_0_PQ_area [Pointer]......................................................................... 9 enable_write_out_PQ_area [Bool]......................................................................... 10 DataSelect_All_Devices [Bool] .............................................................................. 11 ASi_master_type_Link20E [Bool] .......................................................................... 12 ASi_Slave_Fault [Bool] .......................................................................................... 12 ASi_Power_Fault [Bool]......................................................................................... 12 Profibus_Fault [Bool] ............................................................................................. 12 reset [Bool]............................................................................................................. 12 enable_copy_diagnosis [Bool] ............................................................................... 13 indirect_copy_diagnosis [Bool] .............................................................................. 13 memory_copy_diagnosis [ANY]............................................................................. 13 ASIMON_diag_stop_address [Pointer].................................................................. 14 ASIMON_diag_stop_active [Bool] ......................................................................... 14 ASIMON_diag_stop_invert [Bool] .......................................................................... 14 freeze_ASIMON_automat [Bool] ........................................................................... 14 freeze_ASIMON_manual [Bool]............................................................................. 14 unfreeze_if_chann_1_off [Bool] ............................................................................. 14 unfreeze_if_chann_2_off [Bool] ............................................................................. 14 unfreeze_if_device_wait [Bool] .............................................................................. 14

3.1.2 Ausgangsparameter ........................................................................................................ 16 retval [Int] ............................................................................................................... 16

diag_done_puls_general [Bool] ............................................................................. 17

diag_done_puls_tripped_1 [Bool] .......................................................................... 17

diag_done_puls_tripped_2 [Bool] .......................................................................... 17

Channel_1_off [Bool] ............................................................................................. 18

Channel_2_off [Bool] ............................................................................................. 18

Config_Mode [Bool] ............................................................................................... 18

Startup_Phase [Bool]............................................................................................. 18

Com_Error [Bool] ................................................................................................... 18

Page 3: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 3 von 30

ASIMON_diag_stop_Tracing .................................................................................... 18

copy_error [Bool] ................................................................................................... 18

copy_retval [Int] ..................................................................................................... 18

3.1.3 Ein-/Ausgangsparameter (IN-OUT) ................................................................................. 19 Channel_1_tripped [Bool] ...................................................................................... 19

Channel_2_tripped [Bool] ...................................................................................... 19

diagnosis_done [Bool] ........................................................................................... 19

diagnosis_error [Bool]............................................................................................ 19

3.1.4 KOP-FUP-Parameter....................................................................................................... 19 ENO [Bool] ............................................................................................................. 19

3.2 Struktur der Diagnosedaten "ASIMON2_UDT"...................................................................... 20 status_function_block ............................................................................................... 21

status_monitor .......................................................................................................... 22

status_channel [1] status_channel [2] ...................................................................... 22

quantity [1] / quantity [2].......................................................................................... 23

device [m].channel_info ............................................................................................ 23

device [m].status....................................................................................................... 23

3.3 Laufzeit des Diagnose-Funktionsbausteins ............................................................................ 24 3.3.1 Laufzeit bei Datenauswahl = nach Freigabekreisen sortiert............................................ 24 3.3.2 Laufzeit bei Datenauswahl = alle Devices ....................................................................... 24 3.3.3 Laufzeit bei Abschaltung.................................................................................................. 24

4 Allgemeines zum Beispielprogramm.............................................................................................. 26 4.1 Station "FB102"....................................................................................................................... 26 4.2 Station "DP-AS-i Link20E" ...................................................................................................... 27 4.3 Station "AS-i CP343-2" ........................................................................................................... 28

5 Übersicht über die Programmstruktur der Stationen "DP-AS-i Link20E" und "AS-i CP343-2" ...... 29 5.1 Startbaustein OB100............................................................................................................... 29 5.2 Alarmbausteine OB82 (für Modulfehler) und OB86 (für Profibusfehler, nur in

Station "DP-AS-i Link20E").................................................................................................. 29 5.3 Fehlerbausteine OB85 (Fehler beim Aktualisieren des Prozessabbilds) und

OB122 (Fehler bei Peripheriezugriff)................................................................................... 29 5.4 Zyklisches Programm OB1 ..................................................................................................... 29

6 Anpassen des Beispielprogramms an ein reales Projekt:.............................................................. 30 Im OB82:................................................................................................................... 30

Im OB86 (nur in Station "DP-AS-i Link20E"): ........................................................... 30

Im OB1...................................................................................................................... 30

Im FC121 (bzw. FC122 usw., nur in Station "AS-i CP343-2").................................. 30

Im FC127 (Anlauf-Programm) ................................................................................. 30

Im FB117 .................................................................................................................. 30

Page 4: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 4 von 30

1 Gewährleistung, Haftung und Support Für die in diesem Dokument enthaltenen Informationen übernehmen wir keine Gewähr. Unsere Haftung, gleich aus welchem Rechtsgrund, für durch die Verwendung der in diesem Diagnose-Bausteinen und Programmbeispielen beschriebenen Beispiele, Hinweise, Programme, Projektierungs- und Leistungsdaten usw. verursachte Schäden ist ausgeschlossen, soweit nicht z.B. nach dem Produkthaftungsgesetz in Fällen des Vorsatzes, der grober Fahrlässigkeit, wegen der Verletzung des Lebens, des Körpers oder der Gesundheit, wegen einer Übernahme der Garantie für die Beschaffenheit einer Sache, wegen des arglistigen Verschweigens eines Mangels oder wegen Verletzung wesentlicher Vertragspflichten zwingend gehaftet wird. Der Schadensersatz wegen Verletzung wesentlicher Vertragspflichten ist jedoch auf den vertragstypischen, vorhersehbaren Schaden begrenzt, soweit nicht Vorsatz oder grobe Fahrlässigkeit vorliegt oder wegen der Verletzung des Lebens, des Körpers oder der Gesundheit zwingend gehaftet wird. Eine Änderung der Beweislast zu Ihrem Nachteil ist hiermit nicht verbunden. Wichtiger Hinweis Die Diagnose-Bausteine und Programmbeispiele sind unverbindlich und erheben keinen Anspruch auf Vollständigkeit hinsichtlich Konfiguration und Ausstattung sowie jeglicher Eventualitäten. Die Diagnose-Bausteine und Programmbeispiele stellen keine kundenspezifische Lösungen dar, sondern sollen lediglich Hilfestellung bieten bei typischen Aufgabenstellungen. Sie sind für den sachgemäßen Betrieb der beschrieben Produkte selbst verantwortlich. Diese Diagnose-Bausteine und Programmbeispiele entheben Sie nicht der Verpflichtung zu sicherem Umgang bei Anwendung, Installation, Betrieb und Wartung. Durch Nutzung dieser Diagnose-Bausteine und Programmbeispiele erkennen Sie an, dass Siemens über die oben beschriebene Haftungsregelung hinaus nicht für etwaige Schäden haftbar gemacht werden kann. Wir behalten uns das Recht vor, Änderungen an diesen Diagnose-Bausteinen und Programmbeispielen jederzeit ohne Ankündigung durchzuführen. Bei Abweichungen zwischen den Vorschlägen in diesen Diagnose-Bausteinen und Programmbeispielen und anderen Siemens Publikationen, wie z.B. Katalogen, Handbüchern, hat der Inhalt der anderen Dokumentation Vorrang. Weitere Informationen erhalten sie im Internet unter: http://support.automation.siemens.com/WW/view/de/25239870

Page 5: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 5 von 30

!

2 Einstellungen in der Konfiguration des Sicherheitsmonitors

2.1 Datenauswahl

• Parameter DataSelect_All_Devices muss korrekt eingestellt werden! Siehe Beschreibung des Parameters auf Seite 10.

• Bei falscher Einstellung können die Daten nicht korrekt interpretiert werden.

2.2 Bausteinindex-Zuordnung

• Ab Version 2.11 (asimon V2 plus) bietet das PC-Konfigurationsprogramm ASIMON die Möglichkeit der individuellen Bausteinindex-Zuordnung für die AS-i Diagnose. Dabei kann der Bereich für den Diagnoseindex umgeschaltet werden zwischen "0 - 47" und "32 - 79".

• Der im folgenden beschriebene Diagnose-Baustein kann mit beiden Einstellungen arbeiten, jedoch wird bei der Einstellung "0 - 47" automatisch bei allen Device-Nummern der Wert 32 addiert. D.h. das Device 0 erscheint im Diagnose-Baustein als Device 32, das Device 1 erscheint als 33 usw.

• Bei der Einstellung "32 - 79" werden die Device-Nummern unverändert übernommen. Es wird deshalb empfohlen, die Einstellung "32 - 79" anzuwählen.

Page 6: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 6 von 30

3 Beschreibung des Funktionsbausteins FB102 "ASIMON2D" Dieser Funktionsbaustein dient als Kommunikationsschnittstelle zwischen AS-i Sicherheitsmonitor (Version 2 Typ "Erweitert", Version 2 Typ "Basis", oder Version 1) und einer S7-300/400 Steuerung und liest die Diagnosedaten aus dem Sicherheitsmonitor in einen Datenbereich der CPU ein.

FB 102 "ASIMON2D"

ASIMON_in_0 retval

ASIMON_out_0 diag_done_puls_general

ASIMON_out_0_PQ_area diag_done_puls_tripped_1

enable_write_out_PQ_area diag_done_puls_tripped_2

DataSelect_All_Devices Channel_1_off

ASi_master_type_Link20E Channel_2_off

ASi_Slave_Fault Config_Mode

ASi_Power_Fault Startup_Phase

Profibus_Fault Com_Error

Reset ASIMON_diag_stop_Tracing

enable_copy_diagnosis copy_error

indirect_copy_diagnosis copy_retval

memory_copy_diagnosis

ASIMON_diag_stop_address

ASIMON_diag_stop_active

ASIMON_diag_stop_invert

freeze_ASIMON_automat

freeze_ASIMON_manual

unfreeze_if_chann_1_off

unfreeze_if_chann_2_off

unfreeze_if_device_wait

Channel_1_tripped [in-out]

Channel_2_tripped [in-out]

diagnosis_done [in-out]

diagnosis_error [in-out]

Page 7: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 7 von 30

3.1 Bausteinparameter

3.1.1 Eingangsparameter Die Parameter des Funktionsbausteins werden im Instanz-Datenbaustein automatisch gespeichert. Daher ist es für Eingangsparameter, die sich während der Laufzeit nicht ändern, vollkommen ausreichend, wenn diese Parameter nur im Anlauf-OB100 etc. eingelesen werden. Änderungen an den Parametern müssen dann nur an einer Stelle im Programm durchgeführt werden. Da die Parameter nicht in jedem Zyklus neu übergeben werden müssen, wird auch CPU-Laufzeit eingespart. Dies betrifft vor allem die Parameter ASIMON_in_0, ASIMON_out_0, ASIMON_out_0_PQ_area, enable_write_out_PQ_area, DataSelect_All_Devices, ASi_master_type_Link20E, ASIMON_diag_stop_address. Beim Parameter reset (siehe Beschreibung unten) ist ein einmaliges Anlegen der Konstante TRUE im Anlauf-OB100 etc. ausreichend, da reset ohne Beschaltung wie ein FALSE ausgewertet wird.

ASIMON_in_0 [Pointer] • Dieser Parameter muss mit dem AS-i Eingangs-Bit 0 des Sicherheitsmonitors

beschaltet werden. • Der Parameter bezieht sich auf die 4 SPS-Eingangs-Bits entsprechend der AS-i

Slave-Adresse des Sicherheitsmonitors. Siehe Einstellung im PC-Konfigurationsprogramm ASIMON unter "Bearbeiten" >> "Monitor/Businformationen" >> "Diagnose/Service" >> " AS-Interface-Diagnose " >> " Monitor-Basisadresse".

• Der Funktionsbaustein verwendet das angegebene Bit sowie die darauf folgenden 3 Bits zur Kommunikation mit dem Sicherheitsmonitor.

• Der Parameter kann sich auf einen beliebigen Speicherbereich der SPS beziehen. Beispiele: ASIMON_in_0 := E14.4

ASIMON_in_0 := DB20.DBX1.0 (inklusive DB-Nummer!) • Der Parameter kann sich auch auf den Peripheriebereich beziehen. In diesem Fall

wird automatisch und unmittelbar das komplette Peripherie-Eingangsbyte (bzw. -Eingangswort) geladen und die relevanten Bits ausgewertet. Vorteil: Die Zeitverzögerung der Eingangsabbild-Aktualisierung durch das SPS-Betriebssystem entfällt, und es kann eine schnellere Diagnoseabfolge erreicht werden. Zu beachten: Bei Peripherieausfall und nicht geladenem Zugriffsfehler-OB122 schaltet die SPS in STOP. Siehe auch Parameter ASi_master_type_Link20E und Profibus_Fault .

Beispiel: ASIMON_in_0 := P#P129.0 ergibt intern: Lade PEB129 und Auswerten der Byte-Bits xx.0 bis xx.3 (falls ASi_master_type_Link20E :=

TRUE) Lade PEW128 und Auswerten der entsprechenden 4 Bits (falls ASi_master_type_Link20E := FALSE)

• Wird als Parameter ein bereichsinterner Zeiger übergeben, so wird dieser Parameter automatisch wie ein Zeiger auf den Peripheriebereich ausgewertet.

Beispiel: ASIMON_in_0 := P#129.0 entspricht ASIMON_in_0 := P#P129.0

Page 8: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 8 von 30

• Wird als Parameter keine Bit-Adresse übergeben, so wird dieser Parameter wie ein Zeiger auf das Bit 0 der angegebenen Adresse ausgewertet.

Beispiele: ASIMON_in_0 := EB14 oder ASIMON_in_0 := EW14 oder ASIMON_in_0 := ED14 entspricht ASIMON_in_0 := E14.0

• Der Parameter wird nur in der Initialisierungsphase ausgewertet. Siehe Beschreibung bei Parameter reset.

• Nicht erlaubt sind: - Datenbaustein-Bezug ohne Angabe der DB-Nummer (ergibt Fehlermeldung)

Falsch: ASIMON_in_0 := DBX1.0 (DB-Nummer fehlt) ASIMON_in_0 := DIX1.0 (DB-Nummer fehlt)

• Bit-Adressen xx.5, xx.6, xx.7 sind nicht sinnvoll, da sie einen Überlauf in das nachfolgende Byte erzeugen. Hier wird keine Fehlermeldung ausgegeben.

Falsch: ASIMON_in_0 := E14.5 (Bit-Adresse ergibt Überlauf)

ASIMON_out_0 [Pointer] • Dieser Parameter muss mit dem AS-i Ausgangs-Bit 0 des Sicherheitsmonitors

beschaltet werden. • Der Parameter bezieht sich auf die 4 SPS-Ausgangs-Bits entsprechend der AS-i

Slave-Adresse des Sicherheitsmonitors. Siehe Einstellung im PC-Konfigurationsprogramm ASIMON unter "Bearbeiten" >> "Monitor/Businformationen" >> "Diagnose/Service" >> " AS-Interface-Diagnose " >> " Monitor-Basisadresse".

• Der Funktionsbaustein verwendet das angegebene Bit sowie die darauf folgenden 3 Bits zur Kommunikation mit dem Sicherheitsmonitor.

• Der Parameter kann sich auf einen beliebigen Speicherbereich der SPS beziehen. Ausnahme: Der Parameter darf sich nicht auf den Peripheriebereich beziehen.

Beispiele: ASIMON_out_0 := A14.4 ASIMON_out_0 := DB20.DBX17.0 (inklusive DB-Nummer!)

• Wird als Parameter ein bereichsinterner Zeiger übergeben, so wird dieser Parameter automatisch wie ein Zeiger auf den Ausgangsabbildbereich ausgewertet.

Beispiel: ASIMON_out_0 := P#14.4 entspricht ASIMON_out_0 := P#A14.4

• Wird als Parameter keine Bit-Adresse übergeben, so wird dieser Parameter wie ein Zeiger auf das Bit 0 der angegebenen Adresse ausgewertet.

Beispiele: ASIMON_out_0 := AB14 oder ASIMON_out_0 := AW14 oder ASIMON_out_0 := AD14 entspricht ASIMON_out_0 := A14.0

• Der Parameter wird nur in der Initialisierungsphase ausgewertet. Siehe Beschreibung bei Parameter reset.

• Nicht erlaubt sind: - Datenbaustein-Bezug ohne Angabe der DB-Nummer (ergibt Fehlermeldung) - Bezug auf den Peripheriebereich (ergibt Fehlermeldung)

Falsch: ASIMON_out_0 := DBX33.0 (DB-Nummer fehlt) ASIMON_out_0 := DIX33.0 (DB-Nummer fehlt) ASIMON_out_0 := P#P129.0 (Peripheriebereich nicht erlaubt!)

• Bit-Adressen xx.5, xx.6, xx.7 sind nicht sinnvoll, da sie einen Überlauf in das nachfolgende Byte erzeugen. Hier wird keine Fehlermeldung ausgegeben.

Falsch: ASIMON_out_0 := A14.5 (Bit-Adresse ergibt Überlauf)

Page 9: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 9 von 30

ASIMON_out_0_PQ_area [Pointer] • Dieser Parameter ermöglicht das unmittelbare Schreiben der 4 AS-i Ausgangs-Bits

des Sicherheitsmonitors auf den Peripherieausgangsbereich. Hiermit kann eine schnellere Diagnoseabfolge erreicht werden, da die Zeitverzögerung der Abbild/Ausgangs-Aktualisierung durch das SPS-Betriebssystem entfällt.

• Achtung: Das Schreiben auf den Peripherieausgangsbereich erfolgt immer byteweise (falls ASi_master_type_Link20E := TRUE) oder wortweise (falls ASi_master_type_Link20E := FALSE). D.h. es werden immer auch die benachbarten Ausgangsbits im Byte bzw. Wort auf die Peripherie geschrieben. Falls das unmittelbare Schreiben auf die Peripherie nicht erwünscht ist, muss der Parameter enable_write_out_PQ_area := FALSE eingestellt werden.

• Zu beachten bei Nutzung des Peripherieausgangsbereichs: Bei Peripherieausfall und nicht geladenem Zugriffsfehler-OB122 schaltet die SPS in STOP. Siehe auch Parameter Profibus_Fault .

• Interner Ablauf (für SPS-Spezialisten), falls ASi_master_type_Link20E := TRUE) : Es wird automatisch berechnet, in welchem Byte sich das Bit befindet, das am Parameter ASIMON_out_0_PQ_area angegeben ist ("Peripherieausgangsbyte"). Ebenso wird das Byte berechnet, auf das sich der Parameter ASIMON_out_0 bezieht ("Ausgangsabbildbyte"). Anschließend wird das "Ausgangsabbildbyte" auf das "Peripherieausgangsbyte" geschrieben.

Beispiel 1: ASIMON_out_0 := A14.4 ASIMON_out_0_PQ_area := P#P14.4 belegt zunächst Bits A14.4 bis A14.7 mit neuen Diagnosedaten und führt anschließend die folgende Befehlssequenz durch: L AB14 // "Ausgangsabbildbyte" laden T PAB14 // "Peripherieausgangsbyte" schreiben

Beispiel 2: ASIMON_out_0 := DB20.DBX33.0 ASIMON_out_0_PQ_area := P#P129.0 belegt zunächst Bits DBX33.0 bis DBX33.4 in DB20 mit neuen Diagnosedaten und führt anschließend die folgende Befehlssequenz durch: L DB20.DBB33 // "Ausgangsabbildbyte" laden T PAB129 // "Peripherieausgangsbyte" schreiben // Hinweis: Anschließend führt die SPS selbsttätig einen // Abgleich des System-Ausgangsabbilds durch, falls vorhanden: // T PB129 // System-Ausgangsabbild nachführen

• Interner Ablauf (für SPS-Spezialisten), falls ASi_master_type_Link20E := FALSE) : Es wird automatisch berechnet, in welchem Wort (mit gerader Adresse) sich das Bit befindet, das am Parameter ASIMON_out_0_PQ_area angegeben ist ("Peripherieausgangswort"). Ebenso wird das Wort berechnet, auf das sich der Parameter ASIMON_out_0 bezieht ("Ausgangsabbildwort"). Anschließend wird das "Ausgangsabbildwort" auf das "Peripherieausgangswort" geschrieben.

Beispiel 1: ASIMON_out_0 := A14.4 ASIMON_out_0_PQ_area := P#P14.4 belegt zunächst Bits A14.4 bis A14.7 mit neuen Diagnosedaten und führt anschließend die folgende Befehlssequenz durch: L AW14 // "Ausgangsabbildwort" laden T PAW14 // "Peripherieausgangswort" schreiben

Beispiel 2: ASIMON_out_0 := DB20.DBX33.0 ASIMON_out_0_PQ_area := P#P129.0 belegt zunächst Bits DBX33.0 bis DBX33.4 in DB20

Page 10: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 10 von 30

mit neuen Diagnosedaten und führt anschließend die folgende Befehlssequenz durch: L DB20.DBW32 // "Ausgangsabbildwort" laden T PAW128 // "Peripherieausgangswort" schreiben // Hinweis: Anschließend führt die SPS selbsttätig einen // Abgleich des System-Ausgangsabbilds durch, falls vorhanden: // T PW128 // System-Ausgangsabbild nachführen

• Aus obigen Beispielen ist ersichtlich, dass das "Ausgangsabbildbyte/wort" in einem beliebigen Speicherbereich (außer Peripherie) der SPS liegen kann (nicht zwingend im System-Ausgangsabbild). Ebenso kann das "Peripherieausgangsbyte/wort" in einem beliebigen Speicherbereich der SPS liegen, es muss dann jedoch nötigenfalls per Anwenderprogramm auf den System-Peripherieausgangsbereich geschrieben werden.

• Dieser Parameter muss mit dem Bit 0 im Peripherieausgangsbereich beschaltet werden, das dem AS-i Ausgangs-Bit 0 des Sicherheitsmonitors (gemäß Parameter ASIMON_out_0 ) entspricht.

• Der Parameter soll sich sinnvollerweise auf den Peripheriebereich beziehen. Er kann sich jedoch auf einen beliebigen Speicherbereich der SPS beziehen.

Beispiele: ASIMON_out_0_PQ_area := P#P14.4 ASIMON_out_0_PQ_area := P#P129.0

• Wird als Parameter ein bereichsinterner Zeiger übergeben, so wird dieser Parameter automatisch wie ein Zeiger auf den Peripherieausgangsbereich ausgewertet.

Beispiel: ASIMON_out_0_PQ_area := P#129.0 entspricht ASIMON_out_0_PQ_area := P#P129.0

• Wird als Parameter keine Bit-Adresse übergeben, so wird dieser Parameter wie ein Zeiger auf das Bit 0 der angegebenen Adresse ausgewertet.

• Der Parameter wird nur in der Initialisierungsphase ausgewertet. Siehe Beschreibung bei Parameter reset.

• Nicht erlaubt sind: - Datenbaustein-Bezug ohne Angabe der DB-Nummer (ergibt Fehlermeldung)

• Bit-Adressen xx.5, xx.6, xx.7 sind nicht sinnvoll, da sie einen Überlauf in das nachfolgende Byte erzeugen. Hier wird keine Fehlermeldung ausgegeben.

• Siehe auch Beschreibung der Parameter enable_write_out_PQ_area und ASi_master_type_Link20E .

enable_write_out_PQ_area [Bool] • Dieser Parameter gibt an, ob unmittelbar auf den Peripherieausgangsbereich

geschrieben werden soll. • Der Parameter beeinflusst nicht den unmittelbaren Lesezugriff auf den

Peripherieeingangsbereich (siehe Parameter ASIMON_in_0 ). • Der Parameter sollte mit FALSE belegt werden, wenn dem Anwender der Unterschied

zwischen Ausgangsabbild und Ausgangsperipherie nicht klar ist. • Falls der Diagnose-Funktionsbaustein am Ende des zyklischen Programms (OB1)

aufgerufen wird, ist die Zeitverzögerung der Abbild-Aktualisierung durch das SPS-Betriebssystem minimal. In diesem Fall wird empfohlen, den Parameter mit FALSE zu belegen.

• Wenn enable_write_out_0_PQ_area := FALSE :

dann werden keine Daten auf den Peripherieausgangsbereich geschrieben. Dennoch muss am Parameter ASIMON_out_0_PQ_area eine gültige Bit-Adresse angegeben werden (ansonsten Fehlermeldung in Initialisierungsphase).

Beispiel: ASIMON_out_0_PQ_area := DB1000.DBX0.0 enable_write_out_0_PQ_area := FALSE Der Funktionsbaustein greift nicht auf den angegebenen Datenbaustein zu. Der Datenbaustein muss nicht vorhanden sein.

Page 11: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 11 von 30

• Wenn enable_write_out_0_PQ_area := TRUE :

dann werden Daten unmittelbar auf den Peripherieausgangsbereich geschrieben. Die Funktionsweise ist unter Parameter ASIMON_out_0_PQ_area beschrieben. Zu beachten bei Nutzung des Peripherieausgangsbereichs: Bei Peripherieausfall und nicht geladenem Zugriffsfehler-OB122 schaltet die SPS in STOP. Siehe auch Parameter Profibus_Fault .

DataSelect_All_Devices [Bool] • Dieser Parameter gibt an, in welchem Datenformat die Diagnosedaten vom

Sicherheitsmonitor erwartet werden. • Der Wert des Parameters muss zwingend identisch sein mit der Einstellung im PC-

Konfigurationsprogramm ASIMON unter "Bearbeiten" >> "Monitor/Businformationen" >> "Diagnose/Service" >> " AS-Interface-Diagnose " >> "Datenauswahl".

• Bei falscher Einstellung können die Daten nicht korrekt interpretiert werden.

• DataSelect_All_Devices := FALSE muss eingestellt werden bei Verwendung eines Sicherheitsmonitors ab Version 2.0 und Einstellung Datenauswahl = nach Freigabekreisen sortiert. In anderen Sprachen entspricht diese Einstellung: Data selection = sorted by OSSD Choix de données = séparés par circuit de validation Elección de datos = separados por circuito de habilitación Selezione die dati = separati per circuito di abilitazione Bei Verwendung eines Sicherheitsmonitors Version 1.x (d.h. Sicherheitsmonitor Version < 2.0) muss immer FALSE eingestellt werden.

• DataSelect_All_Devices := TRUE muss eingestellt werden bei

Verwendung eines Sicherheitsmonitors ab Version 2.0 und Einstellung Datenauswahl = alle Devices In anderen Sprachen entspricht diese Einstellung: Data selection = all devices Choix de données = tous les composants Elección de datos = todos los dispositivos Selezione die dati = tutti i componenti

• Hinweis:

Die Einstellung im PC-Konfigurationsprogramm ASIMON beeinflusst den Umfang der übertragenen Diagnosedaten: Bei Einstellung "Datenauswahl = nach Freigabekreisen sortiert" werden nur Devices übertragen, die in der Hauptlinie (Darstellungsebene 1) eines Freigabekreises liegen. Devices, die lediglich in der Vorverarbeitung definiert sind und z.B. als Eingangsinformationen für ODER-Gatter dienen, werden in den Diagnosedaten nicht angezeigt. Ein Sicherheitsmonitor Version 1.x überträgt seine Daten immer in diesem Format. Bei Einstellung "Datenauswahl = alle Devices" werden alle Devices übertragen, also auch Devices, die lediglich in der Vorverarbeitung definiert sind (z.B. als Eingangs-informationen für ODER-Gatter). Ein Sicherheitsmonitor ab Version 2.x bietet die Option, seine Daten in diesem Format zu übertragen. Im Normalfall wird empfohlen, einen Sicherheitsmonitor ab Version 2.x auf "Datenauswahl = alle Devices" einzustellen, damit die SPS auf den Gesamtumfang der Diagnose zugreifen kann. Der Diagnose-Funktionsbaustein hinterlegt die Diagnosedaten in der SPS immer in der gleichen Struktur, unabhängig von der Einstellung im PC-Konfigurationsprogramm ASIMON. Der Parameter DataSelect_All_Devices muss jedoch korrekt eingestellt sein!

Page 12: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 12 von 30

• Der Parameter sollte nicht im laufenden Diagnosebetrieb geändert werden. Ansonsten erfolgt ein einmaliges Durchlaufen der Initialisierungsphase, siehe Beschreibung bei Parameter reset.

ASi_master_type_Link20E [Bool] • Dieser Parameter bestimmt, ob der AS-i Master bei unmittelbarem Zugriff auf den

SPS-Peripheriebereich byteweise oder wortweise angesprochen wird. Auf die weitere Verarbeitung der Daten hat der Parameter keinen Einfluss.

• Die Einstellung muss den technischen Daten des AS-i Masters entsprechen. • Bei ASi_master_type_Link20E := FALSE erfolgen Peripheriezugriffe im

Wort-Format. Diese Einstellung ist z.B. gültig für die AS-i Master CP343-2 (P) und CP342-2.

• Bei ASi_master_type_Link20E := TRUE erfolgen Peripheriezugriffe im Byte-Format. Diese Einstellung ist z.B. gültig für alle AS-i Links: Link20E, Link20, Link Advanced, usw.

• Der Parameter wird nur dann ausgewertet, wenn der Parameter ASIMON_in_0 sich auf den Peripherieeingangsbereich bezieht, und/oder der Parameter ASIMON_out_0_PQ_area sich auf den Peripherieausgangsbereich bezieht.

• Insbesondere beim Peripherieausgangsbereich muss evt. im Anwenderprogramm beachtet werden, dass bei ASi_master_type_Link20E := FALSE insgesamt 16 Bit im Peripherieausgangsbereich überschrieben werden, während bei ASi_master_type_Link20E := TRUE insgesamt 8 Bit im Peripherieausgangsbereich überschrieben werden. Das unterschiedliche Leseverhalten im Peripherieeingangsbereich kann vom Anwenderprogramm ignoriert werden.

• Der Parameter wird nur in der Initialisierungsphase ausgewertet. Siehe Beschreibung bei Parameter reset.

ASi_Slave_Fault [Bool]

ASi_Power_Fault [Bool]

Profibus_Fault [Bool]

reset [Bool] • Am Parameter ASi_Slave_Fault soll eine Fehlermeldung übergeben werden mit

Bedeutung TRUE = Ausfall AS-i Slave Sicherheitsmonitor. • Am Parameter ASi_Power_Fault soll eine Fehlermeldung übergeben werden mit

Bedeutung TRUE = Ausfall AS-i Spannung (oder sonstiger allgemeiner AS-i Ausfall). • Am Parameter Profibus_Fault soll eine Fehlermeldung übergeben werden mit

Bedeutung TRUE = Ausfall der Kommunikation zum AS-i Master. • Der Parameter reset muss bei Hochlauf der SPS-CPU (OB100 etc.) einmalig TRUE

werden, damit der Funktionsbaustein nach beliebiger Vorgeschichte korrekt mit der Diagnoseübertragung starten kann.

• Besonderheit:

Der Wert des Parameters reset wird baustein-intern automatisch auf FALSE rückgesetzt, wenn der Parameter am Baustein nicht beschaltet wird (reset := __ ). Damit kann der Parameter z.B. im Hochlauf-OB100 mit der Konstanten TRUE beschaltet werden, während er im Zyklischen Aufruf OB1 unbeschaltet bleibt.

• Voraussetzung für die Übertragung der Diagnosedaten ist, dass die AS-i Slave-

Adresse des Sicherheitsmonitors vom AS-i Master angesprochen werden kann, und

Page 13: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 13 von 30

dass die SPS-CPU mit dem AS-i Master korrekt verbunden ist. Bei Ausfall der Kommunikation muss die Diagnosesequenz abgebrochen werden. Bei Wiederkehr muss die Diagnosesequenz neu initialisiert werden.

• Falls einer der 4 Parameter ASi_Slave_Fault := TRUE oder ASi_Power_Fault := TRUE oder Profibus_Fault := TRUE oder reset := TRUE ist, wird die Diagnosesequenz abgebrochen. In diesem Zustand werden keine Eingangsdaten gelesen und es werden keine Ausgangsdaten geschrieben. Dadurch wird u.a. vermieden, dass bei einem Geräteausfall fortlaufend der Zugriffsfehler-OB122 aufgerufen wird.

• Sobald alle 4 Parameter ASi_Slave_Fault := FALSE und ASi_Power_Fault := FALSE und Profibus_Fault := FALSE und reset := FALSE werden, durchläuft der Funktionsbaustein einmalig eine Initialisierungsphase und anschließend werden kontinuierlich Diagnosedaten eingelesen.

• Zusätzlich wird die Initialisierungsphase ständig durchlaufen, solange der Parameter reset := TRUE ist.

• Die Initialisierungsphase wird auch dann einmalig angestossen, wenn die baustein-interne Zeitüberwachung (Watchdog) feststellt, dass während einer laufenden Diagnosesequenz längere Zeit (2000 ms) keine Daten mehr vom Sicherheitsmonitor empfangen werden.

• In der Initialisierungsphase (und nur dann) werden folgende Parameter ausgewertet und zur weiteren Verwendung baustein-intern abgelegt: ASIMON_in_0, ASIMON_out_0, ASIMON_out_0_PQ_area, ASi_master_type_Link20E, ASIMON_diag_stop_address.

enable_copy_diagnosis [Bool]

indirect_copy_diagnosis [Bool]

memory_copy_diagnosis [ANY] • Die drei Parameter steuern die Weitergabe der Diagnosedaten an einen beliebigen

Datenbereich der SPS. • Am Parameter memory_copy_diagnosis muss ein Zeiger vom Typ ANY angelegt

werden, der den Zielbereich für die Diagnosedaten angibt. Die Diagnosedaten umfassen insgesamt 182 Byte Länge. Falls der angegebene Zielbereich kleiner ist (z.B. 102 Byte Länge), dann werden entsprechend weniger Daten weitergegeben (im Beispiel Byte-Bereich 0..181), d.h. der obere Datenbereich wird abgeschnitten. Falls der angegebene Zielbereich größer ist, dann werden dennoch nur 182 Byte weitergegeben, der überstehende Bereich wird nicht beachtet. Hinweis: Zur Weitergabe der Diagnosedaten wird baustein-intern die Systemfunktion SFC 20 BLKMOV aufgerufen.

• Bei indirect_copy_diagnosis := FALSE bezeichnet der Zeiger am Parameter memory_copy_diagnosis direkt den Zielbereich der Diagnosedaten. Bei indirect_copy_diagnosis := TRUE übergibt der Zeiger am Parameter memory_copy_diagnosis einen Datenbereich von 10 Byte Länge, in dem ein Zeiger vom Typ ANY steht, der dann den Zielbereich für die Diagnosedaten angibt. Damit kann der Zielbereich für die Diagnosedaten bei Bedarf variabel eingestellt

Page 14: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 14 von 30

!

!

werden. Achtung: Im Anwenderprogramm muss der übergebene Datenbereich tatsächlich einen gültigen ANY-Zeiger enthalten! Ansonsten ist das Ergebnis der Kopierfunktion vollkommen zufällig, was zu gefährlichen Reaktionen führen kann.

• Damit die Diagnosedaten auf den Zielbereich kopiert werden, muss enable_copy_diagnosis := TRUE gesetzt sein. Die Kopierfunktion wird nur dann aufgerufen, wenn eine komplette Diagnosesequenz beendet ist. D.h. es wird immer ein konsistenter Diagnosedatensatz übergeben. Zusätzlich wird die Kopierfunktion auch dann aufgerufen, wenn eine Diagnosesequenz abgebrochen wurde (z.B. bei ASi_Slave_Fault := TRUE etc.); in diesem Fall sind die Diagnosedaten nicht vollständig. Bei enable_copy_diagnosis := FALSE wird die Kopierfunktion nie aufgerufen. Die Ausgangsparameter (und IN-OUT-Parameter) des Funktionsbausteins werden jedoch aktualisiert und können ausgewertet werden. Die Diagnosedaten könnten über Lesezugriffe auf den Instanzdatenbaustein ausgewertet werden; da die internen Daten nicht konsistent sind, wird dieser Zugriff nicht empfohlen.

ASIMON_diag_stop_address [Pointer]

ASIMON_diag_stop_active [Bool]

ASIMON_diag_stop_invert [Bool]

freeze_ASIMON_automat [Bool]

freeze_ASIMON_manual [Bool]

unfreeze_if_chann_1_off [Bool]

unfreeze_if_chann_2_off [Bool]

unfreeze_if_device_wait [Bool] • Die acht Parameter steuern die Funktion "Diagnosehalt" des Sicherheitsmonitors ab

Version V2.x Ein Sicherheitsmonitor in Version V1.x unterstützt diese Funktion nicht und ignoriert diese Parameter.

• Die Funktion "Diagnosehalt" "friert" (freeze) den Zustand eines beliebigen Devices ein, wenn das Device eine Abschaltung registriert hat. D.h. auch wenn das Device später wieder einschalten könnte, verbleibt es im Aus-Zustand bzw. genauer: es verharrt im Zustand "Warten" (Farbanzeige GELB im Diagnosemodus des PC-Programms ASIMON, entsprechend Status-Code 2 in den SPS-Diagnosedaten, wie bei Warten auf Vorortquittierung).

• Ein "eingefrorenes" Device kann wieder freigeschaltet werden (unfreeze), indem die Haltebedingung der Diagnosehalt-Funktion ausgeschaltet wird.

• Das oben beschriebene "Einfrieren" ist nur dann möglich, wenn die Haltebedingung der Diagnosehalt-Funktion eingeschaltet ist.

• Mit der Funktion "Diagnosehalt" kann eine sehr kurzzeitige Abschaltung eines Devices von der Diagnose registriert werden, die ansonsten zwar zum Abschalten des Freigabekreises führen würde, jedoch nicht in der Diagnose erkennbar wäre.

• Achtung: Die Funktion "Diagnosehalt" kann das Wiedereinschalten eines Freigabekreises des Sicherheitsmonitors verzögern, da die Devices vorher erst wieder freigeschaltet werden müssen (unfreeze).

Page 15: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 15 von 30

Im Zusammenhang mit ODER-Gattern etc. kann die Funktion "Diagnosehalt" sogar zur unerwünschten Abschaltung eines Freigabekreises führen, da jeder einzelne Status eines Gatter-Eingangs eingefroren wird und die resultierende Summe der evt. eingefrorenen Eingänge zum Abschalten des Gatter-Ausgangs führen kann.

• Die Funktion "Diagnosehalt" kann im PC-Konfigurationsprogramm ASIMON unter "Bearbeiten" >> "Monitor/Businformationen" >> "Diagnose/Service" >> "Diagnosehalt" aktiviert werden (siehe auch Handbuch zum Sicherheitsmonitor). Es wird empfohlen, diese Funktion nur zur Fehlersuche zu aktivieren. Insbesondere bei Verwendung von ODER-Gattern etc. sollte die Funktion nicht aktiviert werden (wie oben beschrieben).

• Im PC-Konfigurationsprogramm ASIMON muss bei aktivierter Diagnosehalt-Funktion eine AS-i Slave-Adresse inklusive Bitadresse angegeben werden. Zur Verwendung mit dem Diagnose-Funktionsbaustein sollte als Bitadresse ein Ausgang angegeben werden, damit dieser von der SPS gesteuert werden kann. Die Option "Invertiert" sollte abgeschaltet bleiben. Hintergrund: Bei SPS-STOP sind alle Ausgänge im Zustand 0 und damit auch der Diagnosehalt abgeschaltet. Der Sicherheitsmonitor kann nicht durch "eingefrorene" Devices blockiert werden. Die Anlage kann dann evt. Handbetrieb ohne SPS betrieben werden.

• Damit der Funktionsbaustein die Diagnosehalt-Bedingung ansteuern kann, muss der Parameter ASIMON_diag_stop_active := TRUE sein. Bei ASIMON_diag_stop_active := FALSE wird die Diagnosehalt-Funktion nicht bearbeitet; das mit dem Parameter Parameter ASIMON_diag_stop_address definierte Ausgangsbit wird nicht geändert.

• Der Parameter ASIMON_diag_stop_address definiert das SPS-Ausgangs-Bit der

Diagnosehalt-Funktion (entsprechend der Einstellung im PC-Konfigurationsprogramm ASIMON). Der Parameter kann sich auf einen beliebigen Speicherbereich der SPS beziehen. Ausnahme: Der Parameter darf sich nicht auf den Peripheriebereich beziehen. Wird als Parameter ein bereichsinterner Zeiger übergeben, so wird dieser Parameter automatisch wie ein Zeiger auf den Ausgangsabbildbereich ausgewertet.

Beispiel: ASIMON_diag_stop_address := P#6.7 entspricht ASIMON_diag_stop_address := P#A6.7

Wird als Parameter keine Bit-Adresse übergeben, so wird dieser Parameter wie ein Zeiger auf das Bit 0 der angegebenen Adresse ausgewertet. Der Parameter ASIMON_diag_stop_address wird nur in der Initialisierungsphase ausgewertet. Siehe Beschreibung bei Parameter reset. Nicht erlaubt sind: - Datenbaustein-Bezug ohne Angabe der DB-Nummer (ergibt Fehlermeldung) - Bezug auf den Peripheriebereich (ergibt Fehlermeldung)

Falsch: ASIMON_diag_stop_address := DBX35.0 (DB-Nummer fehlt) ASIMON_diag_stop_address := DIX35.0 (DB-Nummer fehlt) ASIMON_diag_stop_address := P#P129.0 (Peripheriebereich nicht erlaubt!)

• Der Parameter ASIMON_diag_stop_invert muss der Einstellung im PC-

Konfigurationsprogramm ASIMON entsprechen: Falls Option "Invertiert" abgeschaltet ist (empfohlen), dann muss ASIMON_diag_stop_invert := FALSE eingestellt sein. Falls Option "Invertiert" angewählt ist, dann muss ASIMON_diag_stop_invert := TRUE eingestellt sein.

Page 16: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 16 von 30

• Wenn beide Parameter freeze_ASIMON_automat := FALSE und freeze_ASIMON_manual := FALSE , dann ist die Diagnosehalt-Bedingung dauerhaft abgeschaltet, d.h. der Sicherheitsmonitor "friert" keine Devices ein.

• Wenn der Parameter freeze_ASIMON_automat := FALSE ist, dann kann die Diagnosehalt-Bedingung mit freeze_ASIMON_manual := TRUE manuell eingeschaltet werden, damit der Sicherheitsmonitor Devices "einfriert". Die Wiederfreigabe (unfreeze) muss dann ebenfalls manuell erfolgen! Die Parameter unfreeze_if_chann_1_off, unfreeze_if_chann_1_off, unfreeze_if_device_wait werden in diesem Fall nicht beachtet.

• Wenn der Parameter freeze_ASIMON_automat := TRUE ist, dann verwaltet der Funktionsbaustein die Steuerung der Diagnosehalt-Bedingung automatisch. Der Parameter freeze_ASIMON_manual wird in diesem Fall nicht beachtet. Es gelten dann folgende Verhaltensregeln: Die Diagnosehalt-Bedingung wird zunächst eingeschaltet, d.h. der Sicherheitsmonitor kann Devices "einfrieren". Grundsätzlich gilt dann: Nachdem die Diagnose erkannt hat, dass beide Freigabekreise abgeschaltet haben, wird die Diagnosehalt-Bedingung ausgeschaltet (unfreeze), d.h. der Sicherheitsmonitor kann evt. wieder einschalten. Zusätzlich gilt: Falls Parameter unfreeze_if_chann_1_off := TRUE ist, wird die Diagnosehalt-Bedingung auch dann ausgeschaltet (unfreeze), wenn Freigabekreis 1 abgeschaltet hat (unabhängig vom Zustand im Freigabekreis 2).

• Falls Parameter unfreeze_if_chann_2_off := TRUE ist, wird die Diagnosehalt-Bedingung auch dann ausgeschaltet (unfreeze), wenn Freigabekreis 2 abgeschaltet hat (unabhängig vom Zustand im Freigabekreis 1).

• Falls Parameter unfreeze_if_device_wait := TRUE ist, wird die Diagnosehalt-Bedingung auch dann periodisch ausgeschaltet (unfreeze), wenn in der laufenden Diagnosesequenz erkannt wurde, dass sich mindestens 1 Device im Zustand "Warten" (status = 2) befindet. Periodisch ausschalten bedeutet hier, dass die Diagnosehalt-Bedingung jeweils 100 ms ausgeschaltet wird und dann wieder 100 ms eingeschaltet wird. Somit können zwar nicht mehr alle kurzzeitigen Device-Abschaltungen registriert werden, aber "eingefrorene" Devices, die nicht direkt zum Abschalten des Freigabekreises führen (z.B. einzelne Gatter-Eingänge), werden evt. im laufenden Betrieb wieder freigegeben (unfreeze).

3.1.2 Ausgangsparameter Die Ausgangsparameter des Funktionsbaustein müssen nicht zwingend abgefragt werden. Sie bieten Informationen über den Zustand der Diagnoseabfolge und des Sicherheitsmonitors und können bei Bedarf im Anwenderprogramm verwendet werden.

retval [Int] • Der Parameter informiert über den Zustand des Diagnose-Funktionsbausteins.

Er sollte als 4-stelliger Hexadezimal-Wert gelesen werden. • Das höchstwertige Bit zeigt an, dass ein Fehlerzustand gemeldet wird,

z.B. 8xxx (hex) = Fehlermeldung. Die zweithöchste Hexadezimalstelle zeigt an, auf welchen Bausteinparameter sich die Meldung bezieht,

Page 17: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 17 von 30

z.B. x1xx (hex) = Meldung bezieht sich auf 1.Parameter ( ASIMON_in_0 ). Die weiteren Hexadezimalstellen enthalteneine Fehler- bzw. Meldungsnummer.

• Folgende Werte von retval sind definiert: 8010 hex: Zeitüberwachung hat angesprochen, keine Kommunikation zum Sicherheitsmonitor 8020 hex interner Fehler / Kein request aktiv 813A hex: Parameter ASIMON_in_0, DB-Nummer fehlt 8225 hex: Parameter ASIMON_out_0, Peripheriebereich nicht erlaubt 823A hex: Parameter ASIMON_out_0, DB-Nummer fehlt 833A hex: Parameter ASIMON_out_0_PQ_area, DB-Nummer fehlt 8E25 hex: Parameter ASIMON_diag_stop_address, Peripheriebereich nicht erlaubt 8E3A hex: Parameter ASIMON_diag_stop_address, DB-Nummer fehlt 8701 hex Diagnosesequenz abgebrochen, Parameter ASi_Slave_Fault := TRUE 8801 hex Diagnosesequenz abgebrochen, Parameter ASi_Power_Fault := TRUE 8901 hex Diagnosesequenz abgebrochen, Parameter Profibus_Fault := TRUE 8D01 hex Diagnosedaten konnten nicht kopiert werden, Unzulässiger Bereich an Parameter memory_copy_diagnosis, siehe Fehlermeldung in Parameter Copy_Retval 8D02 hex Diagnosedaten konnten nicht kopiert werden, Indirekter Parameter memory_copy_diagnosis kann nicht übernommen werden, siehe Fehlermeldung in Parameter Copy_Retval 8D03 hex Diagnosedaten konnten nicht kopiert werden, der ANY-Zeiger, auf den der indirekte Parameter memory_copy_diagnosis verweist, zeigt auf Unzulässigen Bereich, siehe Fehlermeldung in Parameter Copy_Retval 8D04 hex Diagnosedaten konnten nicht kopiert werden, der indirekte Parameter memory_copy_diagnosis verweist auf einen zu kurzen Bereich (kein ANY-Zeiger) 7A01 hex Kein Fehler, Parameter RESET := TRUE 00xx hex: Kein Fehler, xx ist die Anzahl der Aufrufe, die der Funktionsbaustein auf eine Antwort des Sicherheitsmonitors wartet. xx = 0: keine Verzögerung/optimaler Diagnosedurchlauf, falls xx >0: dann evt. direkte Peripheriezugriffe bei Parameter ASIMON_in_0 und/oder ASIMON_out_0_PQ_area angeben

diag_done_puls_general [Bool] • Der Parameter wird für einen Zyklus TRUE, wenn eine Diagnosesequenz erfolgreich

abgeschlossen oder mit Fehler abgebrochen wurde. Damit kann eine Weiterverarbeitung der Diagnosedaten angestoßen werden.

diag_done_puls_tripped_1 [Bool] • Der Parameter wird für einen Zyklus TRUE, wenn eine Diagnosesequenz erfolgreich

abgeschlossen oder mit Fehler abgebrochen wurde, und in dieser Diagnosesequenz eine Abschaltung (Übergang EIN auf AUS) in Freigabekreis 1 registriert wurde. Damit kann z.B. eine Archivierung der Diagnosedaten angestoßen werden.

diag_done_puls_tripped_2 [Bool] • Der Parameter wird für einen Zyklus TRUE, wenn eine Diagnosesequenz erfolgreich

abgeschlossen oder mit Fehler abgebrochen wurde, und in dieser Diagnosesequenz eine Abschaltung (Übergang EIN auf AUS) in Freigabekreis 2 registriert wurde. Damit kann z.B. eine Archivierung der Diagnosedaten angestoßen werden.

Page 18: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 18 von 30

Channel_1_off [Bool] • Der Parameter ist TRUE, wenn Freigabekreis 1 konfiguriert und abgeschaltet ist.

Der Parameter wechselt seinen Zustand unmittelbar, wenn der Status des Monitors eingelesen wurde (nicht erst am Ende der Diagnosesequenz). Der Parameter ist auch dann TRUE, wenn sich der Sicherheitsmonitor im Konfigurationsmodus oder Hochlauf befindet.

Channel_2_off [Bool] • Der Parameter ist TRUE, wenn Freigabekreis 2 konfiguriert und abgeschaltet ist.

Der Parameter wechselt seinen Zustand unmittelbar, wenn der Status des Monitors eingelesen wurde (nicht erst am Ende der Diagnosesequenz). Der Parameter ist auch dann TRUE, wenn sich der Sicherheitsmonitor im Konfigurationsmodus oder Hochlauf befindet.

Config_Mode [Bool] • Der Parameter ist TRUE, wenn sich der Sicherheitsmonitor im Konfigurationsmodus

(nicht im Hochlauf) befindet. Der Parameter wechselt seinen Zustand unmittelbar, wenn der Status des Monitors eingelesen wurde (nicht erst am Ende der Diagnosesequenz).

Startup_Phase [Bool] • Der Parameter ist TRUE, wenn sich der Sicherheitsmonitor im Hochlauf befindet.

Der Parameter wechselt seinen Zustand unmittelbar, wenn der Status des Monitors eingelesen wurde (nicht erst am Ende der Diagnosesequenz).

Com_Error [Bool] • Der Parameter ist TRUE, wenn die Kommunikation zum Sicherheitsmonitor

unterbrochen ist.

ASIMON_diag_stop_Tracing • Der Parameter ist TRUE, wenn die Diagnosehalt-Bedingung eingeschaltet ist,

d.h. der Sicherheitsmonitor "friert" ein Device ein, wenn es abgeschaltet hat.

copy_error [Bool] • Der Parameter ist TRUE, wenn beim Kopieren der Diagnosedaten (siehe Parameter

memory_copy_diagnosis ) ein Fehler aufgetreten ist. Siehe dann Parameter copy_retval und retval .

copy_retval [Int] • Der Parameter übergibt den RETVAL-Status der baustein-intern aufgerufenen

Systemfunktion SFC20 BLKMOV. Die Bedeutung der Statusmeldungen ist der Beschreibung der Systemfunktion zu entnehmen. Ausnahme: Es wird copy_retval = 80FF (hex), wenn der indirekte Parameter memory_copy_diagnosis auf einen zu kurzen Bereich (kein ANY-Zeiger) verweist; in diesem Fall wird die Systemfunktion nicht aufgerufen und der Ersatzwert 80FF übergeben. Der Parameter ist nur dann auszuwerten, falls copy_error = TRUE.

Page 19: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 19 von 30

3.1.3 Ein-/Ausgangsparameter (IN-OUT) Die Ein-/Ausgangsparameter des Funktionsbaustein werden baustein-intern nur gesetzt (auf TRUE). Das Rücksetzen (auf FALSE) muss im Anwenderprogramm erfolgen.

Channel_1_tripped [Bool] • Der Parameter wird auf TRUE gesetzt, wenn eine Abschaltung

(Übergang EIN auf AUS) in Freigabekreis 1 registriert wurde. Der Parameter sollte nach erfolgter Auswertung im Anwenderprogramm auf FALSE zurückgesetzt werden.

Channel_2_tripped [Bool] • Der Parameter wird auf TRUE gesetzt, wenn eine Abschaltung

(Übergang EIN auf AUS) in Freigabekreis 2 registriert wurde. Der Parameter sollte nach erfolgter Auswertung im Anwenderprogramm auf FALSE zurückgesetzt werden.

diagnosis_done [Bool] • Der Parameter wird auf TRUE gesetzt, wenn eine Diagnosesequenz erfolgreich

abgeschlossen wurde. Der Parameter sollte nach erfolgter Auswertung im Anwenderprogramm auf FALSE zurückgesetzt werden.

diagnosis_error [Bool] • Der Parameter wird auf TRUE gesetzt, wenn eine Diagnosesequenz mit Fehler

abgebrochen wurde. Der Parameter sollte nach erfolgter Auswertung im Anwenderprogramm auf FALSE zurückgesetzt werden.

3.1.4 KOP-FUP-Parameter

ENO [Bool] • Der Parameter wird auf TRUE gesetzt, wenn eine Diagnosesequenz erfolgreich

abgeschlossen oder mit Fehler abgebrochen wurde, und die Diagnosedaten erfolgreich kopiert wurden (siehe Parameter memory_copy_diagnosis ). Damit kann eine Weiterverarbeitung der Diagnosedaten angestoßen werden.

• In AWL entspricht der Parameter dem Binärergebnis BIE.

Page 20: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 20 von 30

3.2 Struktur der Diagnosedaten "ASIMON2_UDT"

Die über den Parameter memory_copy_diagnosis übergebenen Diagnosedaten umfassen maximal 182 Byte.

Im folgenden wird die Struktur dieses Datenblocks beschrieben.

Die Datenstruktur wird als Anwenderdefinierter Datentyp (UDT) "ASIMON2_UDT" zur Verfügung gestellt.

Der Diagnose-Funktionsbaustein "ASIMON2D" verwendet intern im statischen Datenbereich asimon die gleiche Datenstruktur.

Die Struktur besteht aus 3 Bereichen:

DIAG (102 Byte) enthält die eigentlichen Diagnosedaten des Sicherheitsmonitors.

INFO (8 Byte) enthält zusätzliche Informationen aus dem Diagnose-Funktionsbaustein.

TIME_STAMP (72 Byte) enthält Zeitstempel-Informationen im Format Date_and_Time (DT) zu verschiedenen Ereignissen.

Diagnosedaten-Struktur

Bereich DIAG Byte Bedeutung Byte Bedeutung

n status_function_block n+1 status_monitor

n+2 status_channel [1] n+3 status_channel [2]

n+4 quantity [1] n+5 quantity [2]

n+6 device [32].channel_info n+7 device [32].status

n+8 device [33].channel_info n+9 device [33].status

n+10 device [34].channel_info n+11 device [34].status

n+… device […].channel_info n+… device […].status

n+98 device [78].channel_info n+99 device [78].status

n+100 device [79].channel_info n+101 device [79].status

Bereich INFO n+102 max_device_in_channel [1].index n+103 max_device_in_channel [1].status

n+104 max_device_in_channel [2].index n+105 max_device_in_channel [2].status

n+106 retval (Integer)

n+108 info_bits

Bereich TIME_STAMP n+110 DT: actual_time

Laufende Zeit im Funktionsbaustein

n+118 DT: OSSD_1_off Zeitpunkt der letzten Abschaltung von Freigabekreis 1

n+126 DT: OSSD_1_on Zeitpunkt der letzten Einschaltung von Freigabekreis 1

n+134 DT: OSSD_2_off Zeitpunkt der letzten Abschaltung von Freigabekreis 2

Page 21: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 21 von 30

n+142 DT: OSSD_2_on Zeitpunkt der letzten Einschaltung von Freigabekreis 2

n+150 DT: Config_Mode_asimon Zeitpunkt der letzten Umschaltung in den Konfigurationsmodus (kein Hochlauf)

n+158 DT: Startup_Phase_asimon Zeitpunkt des letzten Hochlaufs des Sicherheitsmonitors

n+166 DT: Fault_or_Error_FB Zeitpunkt der letzten Kommunikationsabbruchs

n+174 (...181)

DT: Startup_Diagnosis_FB Zeitpunkt des letzten Wiederanlaufs des Funktionsbausteins

status_function_block Die 8 Bits in diesem Byte haben folgende Bedeutung:

DataSelect_All_Devices Bit (n+0).0: Kopie des Parameters DataSelect_All_Devices.

data_doublecheck Bit (n+0).1: Die Diagnosesequenz wird nochmals durchlaufen, die Daten sind eventuell nicht konsistent.

data_ready_tripped_ch_1 Bit (n+0).2: Die Diagnosesequenz wurde komplett beendet, in dieser Diagnosesequenz wurde eine Abschaltung (Übergang EIN auf AUS) in Freigabekreises 1 registriert.

data_ready_tripped_ch_2 Bit (n+0).3: Die Diagnosesequenz wurde komplett beendet, in dieser Diagnosesequenz wurde eine Abschaltung (Übergang EIN auf AUS) in Freigabekreises 2 registriert.

diagnosis_done Bit (n+0).4: Die Diagnosesequenz wurde erfolgreich abgeschlossen.

diagnosis_error Bit (n+0).5: Die Diagnosesequenz wurde abgebrochen.

Channel_1_off Bit (n+0).6: Freigabekreis 1 ist ausgeschaltet.

Channel_2_off Bit (n+0).7: Freigabekreis 2 ist ausgeschaltet.

Page 22: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 22 von 30

status_monitor Das Datenbyte "status_monitor" beschreibt den Gesamtzustand des Sicherheitsmonitors. Es kann Werte zwischen 8 und 15 annehmen. Die Bedeutung der Werte ist in der folgenden Tabelle beschrieben:

status_monitor Wert dezimal Wert binär (d3 d2 d1 d0) Bedeutung

8 1 0 0 0 beide Kreise eingeschaltet

9 1 0 0 1 Kreis 1 aus / Kreis 2 ein

10 1 0 1 0 Kreis 1 ein / Kreis 2 aus

11 1 0 1 1 beide Kreise aus

12 1 1 0 0 Konfigurationsbetrieb (Power On / Reset)

13 1 1 0 1 Konfigurationsbetrieb (Stop-Zustand, Bearbeitung mit PC-Programm möglich)

14 1 1 1 0 Konfigurationsbetrieb (reserviert)

15 1 1 1 1 Konfigurationsbetrieb (fataler Gerätefehler, Reset oder Austausch erforderlich)

Im Konfigurationsbetrieb sind beide Kreise ausgeschaltet.

status_channel [1] status_channel [2]

Das Datenbyte "status_channel [1]" beschreibt den Zustand von Freigabekreis 1. Das Datenbyte "status_channel [2]" beschreibt den Zustand von Freigabekreis 2. Es können Werte zwischen 0 und 7 angenommen werden. Die Bedeutung der Werte ist in der folgenden Tabelle beschrieben:

status_channel [1] / status_channel [2] Wert dezimal Wert binär (d3 d2 d1 d0) Bedeutung LED-Zustand am Monitor

0 0 0 0 0 Kreis ist eingeschaltet

grün

1 0 0 0 1 Kreis ist bereit zum Einschalten, wartet auf Start-Bedingung

gelb + rot

2 0 0 1 0 Kreis ist ausgeschaltet

rot

3 0 0 1 1 Kreis ist aus, Service-Taste erforderlich.

rot blinkend

4 0 1 0 0 reserviert

5 0 1 0 1 reserviert

6 0 1 1 0 reserviert

7 0 1 1 1 reserviert

Page 23: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 23 von 30

quantity [1] / quantity [2] Das Datenbyte "quantity [1]" gibt die Anzahl der ausgelösten Devices im Freigabekreis 1 an. Das Datenbyte "quantity [2]" gibt die Anzahl der ausgelösten Devices im Freigabekreis 2 an.

device [m].channel_info Diese 48 Datenbytes geben für jedes Device an, in welchem Freigabekreis sie konfiguriert sind.

device [m].channel_info Wert dezimal Wert binär (d3 d2 d1 d0) Bedeutung

0 0 0 0 0 Device ist in der Vorverarbeitung enthalten oder nicht konfiguriert

1 0 0 0 1 Device ist in Freigabekreis 1 enthalten

2 0 0 1 0 Device ist in Freigabekreis 2 enthalten

3 0 0 1 1 Device ist in beiden Freigabekreisen enthalten

device [m].status Diese 48 Datenbytes beschreiben den Zustand der einzelnen Devices in den Freigabekreisen. Pro Device (m = 32...79) existiert ein Datenbyte "status". Es können Werte zwischen 0 und 7 angenommen werden. Die Bedeutung der Werte ist in der folgenden Tabelle beschrieben. Hinweis: Der Wert status=2 wird auch dann eingenommen, wenn ein Device aufgrund von Diagnosehalt "eingefroren" wurde.

device [m].status Wert dezimal Wert binär (d3 d2 d1 d0) Bedeutung Farb-Anzeige in

PC-Software ASiMon

0 0 0 0 0 Device ist eingeschaltet

grün

1 0 0 0 1 Device ist ein, Abschalt-Timer gestartet

grün blinkend

2 0 0 1 0 Device wartet auf Vor-Ort-Quittierung bzw. Startbedingung

gelb

3 0 0 1 1 Device (zweikanalig abhängig) wurde einkanalig betätigt; Test (aus → ein) erforderlich, auch bei "Anlauftest"

gelb blinkend

4 0 1 0 0 Device hat abgeschaltet (reguläre Abschaltung)

rot

5 0 1 0 1 Device (zwangsgeführt) hat einkanalig abgeschaltet, oder Fehler bei Schützkontrolle. Service-Taste erforderlich.

rot blinkend

6 0 1 1 0 Device - Kommunikationsfehler zwischen AS-i Modul und Sicherheitsmonitor

grau

7 0 1 1 1 Sicherheitsmonitor befindet sich im Konfigurationsbetrieb

---

Page 24: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 24 von 30

3.3 Laufzeit des Diagnose-Funktionsbausteins

Der FB102 "ASIMON2D" benötigt mehrere Zyklen für eine vollständige Diagnose-Sequenz.

Abhängig vom Zustand des Sicherheitsmonitors ist folgende Anzahl von Aufruf-Zyklen nötig.

3.3.1 Laufzeit bei Datenauswahl = nach Freigabekreisen sortiert a) Bei Monitorzustand "Beide Kreise eingeschaltet" oder "Konfigurationsbetrieb" sind 2 Aufrufe nötig:

2 Zyklen "Grundlast"

b) Bei allen anderen Monitorzuständen ist die Anzahl der Aufrufe abhängig von der Anzahl der ausgelösten Devices.

Die Aufruf-Anzahl kann wie folgt berechnet werden:

2 Zyklen "Grundlast"

+ 2 Zyklen zum Einlesen der Zustände der beiden Freigabekreise

+ M x 4 Zyklen, mit M = Anzahl der tatsächlich ausgelösten Devices in Freigabekreis 1, falls 7 oder mehr Devices in Kreis 1 ausgelöst haben, wird M = tatsächliche Anzahl + 1.

+ N x 4 Zyklen, mit N = Anzahl der tatsächlich ausgelösten Devices in Freigabekreis 2, falls 7 oder mehr Devices in Kreis 2 ausgelöst haben, wird M = tatsächliche Anzahl + 1.

3.3.2 Laufzeit bei Datenauswahl = alle Devices Die Aufruf-Anzahl kann wie folgt berechnet werden:

2 Zyklen "Grundlast"

+ 2 Zyklen zum Einlesen der Zustände der beiden Freigabekreise

+ M x 4 Zyklen, mit M = Anzahl der tatsächlich ausgelösten Devices im Sicherheitsmonitor (ohne Aufteilung in Freigabekreis 1 bzw. Freigabekreis 2), falls 7 oder mehr Devices in Kreis 1 ausgelöst haben, wird M = tatsächliche Anzahl + 1.

Nach der Initialisierungsphase muss der Funktionsbaustein einmalig auslesen, wie die Devices den beiden Freigabekreisen zugeordnet sind (channel_info):

+ N x 4 Zyklen, mit N = Anzahl der konfigurierten Devices in Freigabekreis 1 und Freigabekreis 2, falls 7 oder mehr Devices konfiguriert sind, wird N = tatsächliche Anzahl + 1.

3.3.3 Laufzeit bei Abschaltung Bei Erkennen einer Abschaltung (Abschaltflanke in Kreis 1 oder Kreis 2) wird unter gewissen Bedingungen (1, siehe unten) automatisch eine weitere Diagnose-Sequenz durchlaufen, um Prellvorgänge auszufiltern. Dadurch verdoppelt sich eventuell die Anzahl der Aufrufe.

Da der Sicherheitsmonitor zwei Freigabekreise hat, kann eventuell ein dritter Durchlauf einer Diagnose-Sequenz nötig sein: Falls bei der Erstabfrage einer Abschaltung nur ein Freigabekreis eine Abschaltflanke hatte, und während der Zweitabfrage-Sequenz wird eine Abschaltflanke am anderen Freigabekreis erkannt, dann erfolgt unter gewissen Bedingungen (1, siehe unten) automatisch ein dritter Durchlauf der Diagnose-Sequenz.

Page 25: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 25 von 30

1 : Bedingung für die Zweit- bzw. Drittabfrage: Im Moment der Abschaltung wurde für den Kanalstatus ein Wert device[m].status = 1, 2,oder 3 eingelesen. Da sich diese Werte in der nächsten Abfragesequenz z.B. auf den Wert 4 stabilisieren können (Prellvorgang), wird die Abfrage automatisch wiederholt.

Page 26: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 26 von 30

4 Allgemeines zum Beispielprogramm Das Beispielprogramm besteht aus 3 unabhängigen Teilen / Stationen. Aus diesen Stationen kann die für das jeweilige reale Projekt passende Station ausgewählt werden. Die ausgewählte Station kann komplett kopiert und für das reale Projekt weiter ausprogrammiert werden, oder es werden nur die benötigten Bausteine in ein bestehendes Projekt übernommen und angepaßt. Die anderen Stationen müssen nicht verwendet werden.

4.1 Station "FB102" Diese Station enthält nur den Diagnosebaustein FB 102 "ASIMON2D" und den Konvertierungsbaustein FB109 "CONVASI1" ohne weitere Einbindung in ein S7-Programm. Zusätzlich sind zwei Anwenderdefinierte Datentypen (UDT) enthalten. "ASIMON2_UDT beschreibt die Diagnosedaten-Struktur, die der FB 102 "ASIMON2D" verwendet. "ASIMON1_UDT beschreibt die Diagnosedaten-Struktur, wie sie im "ehemaligen" FC 101 "ASIMON_DIAG" verwendet wurde. Mit Hilfe des Konvertierungsbausteins FB109 "CONVASI1" kann die Datenstruktur "ASIMON2" für Kompatibilitätszwecke in die Datenstruktur "ASIMON1" übergeführt werden.

Page 27: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 27 von 30

4.2 Station "DP-AS-i Link20E" Diese Station enthält eine SPS mit Profibus-Master (CPU 315-2DP mit integrierter Profibus-Schnittstelle) mit unterlagertem AS-i System (über DP/AS-i Link 20E) inklusive AS-i Sicherheitsmonitor. Zur universellen Verwendung des Beispiels enthält die Station zwei Link20E: (a) Profibus-Adresse 3, Diagnose-Adresse 1022, Diagnosealarm freigegeben,

logische Basisadresse 0, (b) Profibus-Adresse 4, Diagnose-Adresse 1021, Diagnosealarm freigegeben,

logische Basisadresse 32, sowie zwei AS-i Sicherheitsmonitore: (aa) AS-i Slave-Adresse 28, angeschlossen an Link20E (a),

entspricht Adressen E14.4 - 14.7 und A14.4 - 14.7,

(bb) AS-i Slave-Adresse 29, angeschlossen an Link20E (a), entspricht Adressen E14.0 - 14.3 und A14.0 - 14.3.

Das Programm der Station liefert 2 getrennte Diagnosedaten-Strukturen:

• Systemdiagnose des AS-i Masters (d.h. welcher AS-i Slave ist ausgefallen), • Diagnose des Sicherheitsmonitors (d.h. welches Sicherheitsmodul hat ausgelöst).

Nicht benötigte Programmteile können weggelassen werden, d.h. wenn z.B. nur 1 Sicherheitsmonitor vorhanden ist, muß auch nur 1 Monitor-Diagnose durchgeführt werden. Sind z.B. 3 Sicherheitsmonitore vorhanden, kann durch Einfügen von weiteren Kopien der entsprechenden Bausteine das Programm relativ einfach angepasst werden. Hinweis: Konfiguration mit DP/AS-i LINK Advanced Die Station "DP-AS-i Link20E" kann - bei entsprechender Anpassung in HW Konfig - auch für eine Konfiguration mit DP/AS-i LINK Advanced verwendet werden. Bei Verwendung eines Doppelmasters muss der FB100 "AS-i System Diagnose" jeweils pro AS-i Strang einmal aufgerufen werden. Jeder Strang benötigt seinen eigenen Instanz-DB, wie wenn zwei Einzelmaster verwendet würden.

Page 28: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 28 von 30

4.3 Station "AS-i CP343-2" Diese Station enthält eine SPS ohne Profibus-Master (CPU 314) mit AS-i System (über CP 343-2) inklusive AS-i Sicherheitsmonitor. Zur universellen Verwendung des Beispiels enthält die Station zwei CP 343-2: (a) logische Basisadresse 256 (mit Prozessabbild ab Adresse 64, siehe nächster Absatz), (b) logische Basisadresse 272 (mit Prozessabbild ab Adresse 96, siehe nächster Absatz),. Die CPU 314 besitzt ab Basisadresse 128 kein Prozessabbild. Damit dennoch bitweise auf die AS-i Daten zugegriffen werden kann, wird am Beginn des zyklischen Programms (OB1) jeweils manuell ein Prozessabbild ab Adresse 64 erzeugt. Es wird davon ausgegegangen, dass dieser Bereich nicht von gesteckten Modulen (im Rack) belegt wird. Andernfalls muß das Prozessabbild in einen anderen Bereich verschoben oder in einem Datenbaustein gebildet werden. Sowie zwei AS-i Sicherheitsmonitore: (aa) AS-i Slave-Adresse 28, angeschlossen am ersten CP 343-2 (a),

entspricht Adressen E78.4 - 78.7 und A78.4 - 78.7 (jedoch Peripherieadresse PEB 270 / Bit 4-7),

(bb) AS-i Slave-Adresse 29, angeschlossen am zweiten CP 343-2 (b), entspricht Adressen E78.0 - 78.3 und A78.0 - 78.3 (jedoch Peripherieadresse PEB 270 / Bit 0-3).

Das Programm der Station liefert 2 getrennte Diagnosedaten-Strukturen:

• Systemdiagnose des AS-i Masters (d.h. welcher AS-i Slave ist ausgefallen), • Diagnose des Sicherheitsmonitors (d.h. welches Sicherheitsmodul hat ausgelöst).

Nicht benötigte Programmteile können weggelassen werden, d.h. wenn z.B. nur 1 Sicherheitsmonitor vorhanden ist, muß auch nur 1 Monitor-Diagnose durchgeführt werden. Sind z.B. 3 Sicherheitsmonitore vorhanden, kann durch das Einfügen weiterer Kopien der entsprechenden Bausteine das Programm relativ einfach angepasst werden. Hinweis: Konfiguration mit CP 343-2 P Die Station "AS-i CP343-2" kann - bei entsprechender Anpassung in HW Konfig - auch für eine Konfiguration mit CP 343-2 P verwendet werden.

Page 29: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 29 von 30

5 Übersicht über die Programmstruktur der Stationen "DP-AS-i Link20E" und "AS-i CP343-2"

5.1 Startbaustein OB100 Aufruf von FC127

Inhalt FC127 • Verzögerung des Programmstarts um einige Sekunden (zum Einschwingen aller

Spannungen usw.), • Initialisierung der Diagnose der Sicherheitsmonitore, • erstes Einlesen der Systemdiagnose der AS-i-Master (mit FB100).

5.2 Alarmbausteine OB82 (für Modulfehler) und OB86 (für Profibusfehler, nur in Station "DP-AS-i Link20E") Aufruf von FB100

• Einlesen der Systemdiagnose der AS-i-Master und Abspeicherung in DB101 (für ersten AS-i Master), DB102 (für zweiten AS-i Master), usw.

5.3 Fehlerbausteine OB85 (Fehler beim Aktualisieren des Prozessabbilds) und OB122 (Fehler bei Peripheriezugriff)

• Kein Programmcode enthalten, muß evt. vom Anwender programmiert werden.

5.4 Zyklisches Programm OB1 Liest das Eingangsprozessabbild ein (nur in Station "AS-i CP343-2"), damit bit-weiser Zugriff auf Eingänge möglich wird.

• FC121 für ersten AS-i Master, ruft FB120 mit DB121 auf. • FC122 für zweiten AS-i Master, ruft FB120 mit DB122 auf.

Ruft weitere Programmteile zum Anlagenbetrieb auf • muß vom Anwender programmiert werden

Ruft Meldebaustein FB117 (mit DB117) auf • Beispiel für die Ausgabe von Meldungen aufgrund der Diagnose, Meldungen müssen

vom Anwender angepasst werden.

Ruft FB102 mit DB111 auf für Diagnose des ersten Sicherheitsmonitors Ruft FB102 mit DB112 auf für Diagnose des zweiten Sicherheitsmonitors (falls vorhanden)

Schreibt das Ausgangsprozessabbild zur Peripherie (nur in Station "AS-i CP343-2"), damit bit-weiser Zugriff auf Ausgänge möglich wird.

• FC121 für ersten AS-i Master, ruft FB120 mit DB121 auf. • FC122 für zweiten AS-i Master, ruft FB120 mit DB122 auf.

Page 30: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400

ASIMON2D Version 1.1 Seite 30 von 30

6 Anpassen des Beispielprogramms an ein reales Projekt:

Im OB82: • Basisadresse der AS-i Master eintragen (pro Master 1 Aufruf des FB100) • Instanz-DB am FB100 auswählen (DB101, DB102, ...)

Im OB86 (nur in Station "DP-AS-i Link20E"): • Basisadresse sowie Diagnoseadresse (siehe HW Konfig/DP-Slave-Eigenschaften)

der AS-i Master eintragen (pro Master 1 Aufruf des FB100) • Instanz-DB am FB100 auswählen (DB101, DB102, ...)

Im OB1 • Parameter am FB102 anpassen

Im FC121 (bzw. FC122 usw., nur in Station "AS-i CP343-2") Bei neueren SIMATIC CPUs kann die Basisadresse des CP343-2 in HW-Konfig in einen Peripheriebereich unterhalb von 256 gelegt werden. Der Aufruf von FC121 (bzw. FC122 usw.) ist in diesem Falle unnötig, da die E/A-Daten somit direkt ins Prozess-Abbild gelegt werden können.

• Am FB120 Parameter "Image_base_address" muß die Basisadresse des gewünschten 16-Byte-Bereichs im Ein/Ausgangsabbild eingetragen werden.

• In den folgenden Netzwerken müssen die Doppelwort-Adressen der Peripherie und des Prozessabbilds angepasst werden.

• Das gewählte Prozessabbild wird für jeden Zugriff auf Ein/Ausgangsdaten des AS-i Systems verwendet, sowohl bei der Diagnose als auch im restlichen Anwenderprogramm.

Im FC127 (Anlauf-Programm) • Initialisierung aller Diagnosebausteine (pro Master 1 Initialisierung) • Basisadresse der AS-i Master eintragen (pro Master 1 Aufruf des FB100) • Instanz-DB am FB100 auswählen (DB101, DB102, ...) • Parameter am FB102 anpassen

Im FB117 • Meldungen nach Bedarf programmieren.

Hinweis: Konfiguration mit DP/AS-i LINK Advanced Die Station "DP-AS-i Link20E" kann - bei entsprechender Anpassung in HW Konfig - auch für eine Konfiguration mit DP/AS-i LINK Advanced verwendet werden. Bei Verwendung eines Doppelmasters muss der FB100 "AS-i System Diagnose" jeweils pro AS-i Strang einmal aufgerufen werden. Jeder Strang benötigt seinen eigenen Instanz-DB, wie wenn zwei Einzelmaster verwendet würden. Zu beachten: Ein PROFIBUS Ausfall eines Doppelmasters erzeugt nur einen Aufruf des OB86, der beide AS-i Stränge betrifft: Beim gehenden Ereignis sollte der FB100 für jeden AS-i Strang aufgerufen werden (mit eigenem Instanz-DB), damit die Diagnosedaten aktualisiert werden.

Page 31: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 1 of 30

Example Program S7-300 / S7-400

Diagnosis Block AS-i Safety Monitor

Extended V2.x / Basic V2.x / V1.x

"ASIMON2D" (FB 102)

Version 1.1

Documentation Release 08/2007

Page 32: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 2 of 30

Contents 1 Warranty, Liability and Support ........................................................................................................ 4

2 Settings in the configuration of the safety monitor ........................................................................... 5 2.1 Data selection ........................................................................................................................... 5 2.2 Device index assignment .......................................................................................................... 5

3 Description of the Function Block FB102 "ASIMON2D" .................................................................. 6 3.1 Function Block Parameters....................................................................................................... 7

3.1.1 Input Parameters ............................................................................................................... 7 ASIMON_in_0 [Pointer] ........................................................................................... 7 ASIMON_out_0 [Pointer] ......................................................................................... 8

ASIMON_out_0_PQ_area [Pointer]......................................................................... 9

enable_write_out_PQ_area [Bool]......................................................................... 10

DataSelect_All_Devices [Bool] .............................................................................. 11

ASi_master_type_Link20E [Bool] .......................................................................... 12

ASi_Slave_Fault [Bool] .......................................................................................... 12

ASi_Power_Fault [Bool]......................................................................................... 12

Profibus_Fault [Bool] ............................................................................................. 12

reset [Bool]............................................................................................................. 12

enable_copy_diagnosis [Bool] ............................................................................... 13

indirect_copy_diagnosis [Bool] .............................................................................. 13

memory_copy_diagnosis [ANY]............................................................................. 13

ASIMON_diag_stop_address [Pointer].................................................................. 14

ASIMON_diag_stop_active [Bool] ......................................................................... 14

ASIMON_diag_stop_invert [Bool] .......................................................................... 14

freeze_ASIMON_automat [Bool] ........................................................................... 14

freeze_ASIMON_manual [Bool]............................................................................. 14

unfreeze_if_chann_1_off [Bool] ............................................................................. 14

unfreeze_if_chann_2_off [Bool] ............................................................................. 14

unfreeze_if_device_wait [Bool] .............................................................................. 14 3.1.2 Output Parameters .......................................................................................................... 16

retval [Int] ............................................................................................................... 16

diag_done_puls_general [Bool] ............................................................................. 17

diag_done_puls_tripped_1 [Bool] .......................................................................... 17

diag_done_puls_tripped_2 [Bool] .......................................................................... 17

Channel_1_off [Bool] ............................................................................................. 18

Channel_2_off [Bool] ............................................................................................. 18

Config_Mode [Bool] ............................................................................................... 18

Startup_Phase [Bool]............................................................................................. 18

Com_Error [Bool] ................................................................................................... 18

Page 33: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 3 of 30

ASIMON_diag_stop_Tracing .................................................................................... 18

copy_error [Bool] ................................................................................................... 18

copy_retval [Int] ..................................................................................................... 18

3.1.3 Input/Output Parameters (IN-OUT).................................................................................. 19 Channel_1_tripped [Bool] ...................................................................................... 19

Channel_2_tripped [Bool] ...................................................................................... 19

diagnosis_done [Bool] ........................................................................................... 19

diagnosis_error [Bool]............................................................................................ 19

3.1.4 LAD / FBD Parameters .................................................................................................... 19 ENO [Bool] ............................................................................................................. 19

3.2 Structure of the "ASIMON2_UDT" Diagnosis Data................................................................. 20 status_function_block ............................................................................................... 21

status_monitor .......................................................................................................... 22

status_channel [1] status_channel [2] ...................................................................... 22

quantity [1] / quantity [2].......................................................................................... 23

device [m].channel_info ............................................................................................ 23

device [m].status....................................................................................................... 23

3.3 Runtime of the Diagnosis Function Block ............................................................................... 24 3.3.1 Runtime with Data Selection = Sorted by OSSD............................................................. 24 3.3.2 Runtime with Data Selection = All Devices...................................................................... 24 3.3.3 Runtime with Switch-Off .................................................................................................. 24

4 General Information on the Example Program .............................................................................. 26 4.1 "FB102" Station....................................................................................................................... 26 4.2 "DP-AS-i Link20E" Station ...................................................................................................... 27 4.3 "AS-i CP343-2" Station ........................................................................................................... 28

5 Overview of the Program Structure of the "DP-AS-i Link20E" and "AS-i CP343-2" Stations ........ 29 5.1 Startup OB100 ........................................................................................................................ 29 5.2 Alarm OB82 (for Module Errors) and OB86 (for Profibus Errors, only in "DP-AS-i

Link20E" Station) ................................................................................................................. 29 5.3 Error OB85 (Process Image Update Error) and OB122 (Peripheral Access

Error).................................................................................................................................... 29 5.4 Cyclic Program OB1................................................................................................................ 29

6 Adaptation of the Example Program to a Real Project: ................................................................. 30 In the OB82:.............................................................................................................. 30

In the OB86 (only in "DP-AS-i Link20E" station): ..................................................... 30

In the OB1................................................................................................................. 30

In the FC121 (or FC122, etc., only in "AS-i CP343-2" station)................................. 30

In the FC127 (Start-Up Program) ............................................................................ 30

In the FB117 ............................................................................................................. 30

Page 34: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 4 of 30

1 Warranty, Liability and Support We do not accept any liability for the information contained in this document. We do not accept liability, whatever the legal basis, for any damages arising from the use of examples, notes, programs, configuration and performance data etc. described in these diagnosis blocks and program examples, except where we are obliged to by the German Product Liability Act or in cases of willful damage or gross negligence, injury to life, body or health, breach of guarantee for the condition of products or items assumed by us, fraudulent concealment of a defect or breach of a substantial contractual obligation. However, claims arising from a breach of a condition which goes to the root of the contract shall be limited to the foreseeable damage which is intrinsic to the contract, unless caused by intent or gross negligence or based on mandatory liability for injury of life, body or health. The above conditions are not meant to change the burden of proof to the detriment of the user. Important Note The diagnosis blocks and program examples are not binding and do not claim to be complete regarding the circuits shown, equipping and any eventuality. The diagnosis blocks and program examples do not represent customer-specific solutions. They are only intended to provide support for typical applications. You are responsible in ensuring that the described products are correctly used. These diagnosis blocks and program examples do not relieve you of the responsibility in safely and professionally using, installing, operating and servicing equipment. When using these diagnosis blocks and program examples, you recognize that Siemens cannot be made liable for any damage/claims beyond the liability clause described above. We reserve the right to make changes to these diagnosis blocks and program examples at any time without prior notice. If there are any deviations between the recommendations provided in these diagnosis blocks and program examples and other Siemens publications – e.g. Catalogs, manuals – the contents of the other documents have priority. Additional information is available on the Internet at: http://support.automation.siemens.com/WW/view/en/25239870

Page 35: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 5 of 30

!

2 Settings in the configuration of the safety monitor

2.1 Data selection

• The parameter DataSelect_All_Devices must be set according to the settings in the ASIMON configuration program. See parameter description on page 10.

• With false settings, the data cannot be interpreted correctly.

2.2 Device index assignment

• As from version 2.11 (asimon V2 plus) the PC configuration program ASIMON provides the option for an individual device index assignment for AS-i diagnosis. There is the possibility to select the range for the diagnosis index between "0 - 47" and "32 - 79".

• The diagnosis function block specified below can handle both settings, but with setting "0 - 47" the value 32 is added to all device numbers. So in the diagnosis block, the device 0 appears as device 32 , the device 1 appears as 33 etc.

• With setting "32 - 79" the device numbers are transferred without any changes. Thus it is recommended to select the setting "32 - 79".

Page 36: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 6 of 30

3 Description of the Function Block FB102 "ASIMON2D" This function block serves as a communication interface between the AS-i safety monitor (Version 2, type "Extended", Version 2, type "Basic", or Version 1) and an S7-300/400 control which reads the diagnosis data from the safety monitor and transfers the data to the CPU’s data section.

FB 102 "ASIMON2D"

ASIMON_in_0 retval

ASIMON_out_0 diag_done_puls_general

ASIMON_out_0_PQ_area diag_done_puls_tripped_1

enable_write_out_PQ_area diag_done_puls_tripped_2

DataSelect_All_Devices Channel_1_off

ASi_master_type_Link20E Channel_2_off

ASi_Slave_Fault Config_Mode

ASi_Power_Fault Startup_Phase

Profibus_Fault Com_Error

Reset ASIMON_diag_stop_Tracing

enable_copy_diagnosis copy_error

indirect_copy_diagnosis copy_retval

memory_copy_diagnosis

ASIMON_diag_stop_address

ASIMON_diag_stop_active

ASIMON_diag_stop_invert

freeze_ASIMON_automat

freeze_ASIMON_manual

unfreeze_if_chann_1_off

unfreeze_if_chann_2_off

unfreeze_if_device_wait

Channel_1_tripped [in-out]

Channel_2_tripped [in-out]

diagnosis_done [in-out]

diagnosis_error [in-out]

Page 37: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 7 of 30

3.1 Function Block Parameters

3.1.1 Input Parameters The function block’s parameters are automatically stored in the instance data block. For input parameters which are not subjected to changes during the runtime, it is therefore absolutely sufficient to be read in only during start-up OB100, etc. Thus, parameter changes need only be carried out in one program section. As the parameters need not be newly transferred for each cycle, also CPU runtime is reduced. The following parameters are particularly affected thereby: ASIMON_in_0, ASIMON_out_0, ASIMON_out_0_PQ_area, enable_write_out_PQ_area, DataSelect_All_Devices, ASi_master_type_Link20E, ASIMON_diag_stop_address. With the reset parameter (refer to the description below), a one-time creation of the TRUE constant in the start-up OB100, etc. is sufficient as a reset without circuit connection is evaluated like a FALSE.

ASIMON_in_0 [Pointer] • This parameter must be connected to the safety monitor’s AS-i input bit 0. • The parameter refers to the 4 PLC input-bits in accordance with the safety monitor’s

AS-i slave address. Refer to the settings in the ASIMON PC configuration program under “Edit" >> "Monitor/Bus Information" >> "Diagnosis/Service" >> "AS-Interface Diagnosis" >> "Monitor Basic Address".

• The function block uses the specified bit as well as the 3 bits following this bit for communication with the safety monitor.

• The parameter may refer to any storage section of the PLC. Examples: ASIMON_in_0 := E14.4

ASIMON_in_0 := DB20.DBX1.0 (including DB number!) • The parameter may also refer to the peripheral section. In this case, the complete

peripheral input byte (or input word) is automatically and immediately loaded and the relevant bits are evaluated. Advantage: The time delay caused by the input image update of the PLC operating system is dispensed with and a faster diagnosis succession can be attained. Please observe: With peripheral failures and unloaded access errors OB122, the PLC switches to STOP. Also refer to the parameters ASi_master_type_Link20E and Profibus_Fault .

Example: ASIMON_in_0 := P#P129.0 internally results in: Loading PEB129 and evaluation of byte bits xx.0 to xx.3 (if ASi_master_type_Link20E :=

TRUE) Loading PEW128 and evaluation of the respective 4 bits (if ASi_master_type_Link20E := FALSE)

• If a section-internal pointer is assigned as parameter, this parameter is automatically evaluated like a pointer on the peripheral section.

Example: ASIMON_in_0 := P#129.0 corresponds to ASIMON_in_0 := P#P129.0

Page 38: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 8 of 30

• If no bit address is assigned as parameter, this parameter is evaluated like a pointer on the bit 0 of the specified address.

Examples: ASIMON_in_0 := EB14 or ASIMON_in_0 := EW14 or ASIMON_in_0 := ED14 correspond to ASIMON_in_0 := E14.0

• The parameter is only evaluated during the initiation phase. Refer to the parameter description under reset.

• Non-permissible settings: - Data block reference without specification of the DB number (results in error message)

False: ASIMON_in_0 := DBX1.0 (DB number missing) ASIMON_in_0 := DIX1.0 (DB number missing)

• Bit addresses such as xx.5, xx.6, xx.7 are not reasonable as they generate an overrun into the following byte. Here, no error message is output.

False: ASIMON_in_0 := E14.5 (Bit address results in overrun)

ASIMON_out_0 [Pointer] • This parameter must be connected to the safety monitor’s AS-i output bit 0. • The parameter refers to the 4 PLC output bits in accordance with the safety monitor’s

AS-i slave address. Refer to settings in the ASIMON PC configuration program under “Edit" >> "Monitor/Bus Information" >> "Diagnosis/Service" >> "AS-Interface Diagnosis" >> "Monitor Basic Address".

• The function block uses the specified bit as well as the 3 bits following this bit for communication with the safety monitor.

• The parameter may refer to any storage section of the PLC. Exception: The parameter must not refer to the peripheral section.

Examples: ASIMON_out_0 := A14.4 ASIMON_out_0 := DB20.DBX17.0 (including DB number!)

• If a section-internal pointer is assigned as parameter, this parameter is automatically evaluated like a pointer on the output image section.

Example: ASIMON_out_0 := P#14.4 corresponds to ASIMON_out_0 := P#A14.4

• If no bit address is assigned as parameter, this parameter is evaluated like a pointer on the bit 0 of the specified address.

Examples: ASIMON_out_0 := AB14 or ASIMON_out_0 := AW14 or ASIMON_out_0 := AD14 correspond to ASIMON_out_0 := A14.0

• The parameter is only evaluated during the initiation phase. Refer to the parameter description under reset.

• Non-permissible settings: - Data block reference without specification of the DB number (results in error message) - Reference to the peripheral section (results in error message)

False: ASIMON_out_0 := DBX33.0 (DB number missing) ASIMON_out_0 := DIX33.0 (DB number missing) ASIMON_out_0 := P#P129.0 (Peripheral section non-permissible!)

• Bit addresses such as xx.5, xx.6, xx.7 are not reasonable as they generate an overrun into the following byte. Here, no error message is output.

False: ASIMON_out_0 := A14.5 (Bit address results in overrun)

Page 39: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 9 of 30

ASIMON_out_0_PQ_area [Pointer] • This parameter facilitates the direct writing of the safety monitor’s 4 AS-i output bits on

the peripheral output section. With this, a faster diagnosis succession can be attained as the time delay caused by the image/output update of the PLC operating system is dispensed with.

• Caution: Writing on the peripheral output section is always done byte-wise (if ASi_master_type_Link20E := TRUE) or word-wise (if ASi_master_type_Link20E := FALSE). I.e. also the neighboring output bits in the byte or the word are written on the peripheral. If direct writing on the peripheral is unwanted, the enable_write_out_PQ_area := FALSE parameter must be set.

• Please observe for use of the peripheral output section: With peripheral failures and unloaded access errors OB122, the PLC switches to STOP. Also refer to the Profibus_Fault parameter.

• Internal succession (for PLC experts), if ASi_master_type_Link20E := TRUE) : The byte in which the bit specified in the ASIMON_out_0_PQ_area parameter (“peripheral output byte”) is located is automatically calculated. In addition, the byte which the ASIMON_out_0 parameter refers to is calculated ("output image byte"). Following this, the “output image byte” is written on the “peripheral output byte”.

Example 1: ASIMON_out_0 := A14.4 ASIMON_out_0_PQ_area := P#P14.4 initially assigns bits A14.4 to A14.7 with new diagnosis data and then carries out the following command sequence: L AB14 // Load "output image byte" T PAB14 // Write "peripheral output byte"

Example 2: ASIMON_out_0 := DB20.DBX33.0 ASIMON_out_0_PQ_area := P#P129.0 initially assigns bits DBX33.0 to DBX33.4 in DB20 with new diagnosis data and then carries out the following command sequence: L DB20.DBB33 // Load "output image byte" T PAB129 // Write "peripheral output byte" // Note: Following this, the PLC automatically carries out an // update of the system output image if available: // T PB129 // Update system output image

• Internal succession (for PLC experts), if ASi_master_type_Link20E := FALSE) : The word (with even address) in which the bit specified in the ASIMON_out_0_PQ_area parameter (“peripheral output word”) is located is automatically calculated. In addition, the word which the ASIMON_out_0 parameter refers to is calculated (“output image word”). Following this, the “output image word” is written on the “peripheral output word”.

Example 1: ASIMON_out_0 := A14.4 ASIMON_out_0_PQ_area := P#P14.4 initially assigns bits A14.4 to A14.7 with new diagnosis data and then carries out the following command sequence: L AW14 // Load "output image word" T PAW14 // Write "peripheral output word"

Example 2: ASIMON_out_0 := DB20.DBX33.0 ASIMON_out_0_PQ_area := P#P129.0 initially assigns bits DBX33.0 to DBX33.4 in DB20 with new diagnosis data and then carries out the following command sequence: L DB20.DBW32 // Load "output image word"

Page 40: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 10 of 30

T PAW128 // Write "peripheral output word" // Note: Following this, the PLC automatically carries out an // update of the system output image if available: // T PW128 // Update system output image

• The above examples show that the “output image byte/word” can be located in any storage section (except for the peripheral) of the PLC (not necessarily in the system output image). Moreover, the “peripheral output byte/word” may be located in any storage section of the PLC, if required, however, it must then be written on the system peripheral output section via the user program.

• This parameter must be connected to the bit 0 in the peripheral output section which corresponds to the safety monitor’s AS-i output bit 0 (in accordance with the ASIMON_out_0 parameter).

• Ideally, the parameter should refer to the peripheral section. It may, however, also refer to any storage section of the PLC.

Examples: ASIMON_out_0_PQ_area := P#P14.4 ASIMON_out_0_PQ_area := P#P129.0

• If a section-internal pointer is assigned as parameter, this parameter is automatically evaluated like a pointer on the peripheral output section.

Example: ASIMON_out_0_PQ_area := P#129.0 corresponds to ASIMON_out_0_PQ_area := P#P129.0

• If no bit address is assigned as parameter, this parameter is evaluated like a pointer on the bit 0 of the specified address.

• The parameter is only evaluated during the initiation phase. Refer to the parameter description under reset.

• Non-permissible settings: - Data block reference without specification of the DB number (results in error message)

• Bit addresses such as xx.5, xx.6, xx.7 are not reasonable as they generate an overrun into the following byte. Here, no error message is output.

• Also refer to the description of the parameters enable_write_out_PQ_area and ASi_master_type_Link20E .

enable_write_out_PQ_area [Bool] • This parameter indicates whether writing is to be done directly on the peripheral

output section. • The parameter does not affect the direct read access to the peripheral output section

(refer to the ASIMON_in_0 parameter). • If the user is not familiar with the difference between output image and output

peripheral, this parameter should be assigned with FALSE. • If the diagnosis function block is called up at the end of the cyclic program (OB1), the

time delay caused by the image update of the PLC operating system is minimal. In this case, it is recommendable to assign the parameter with FALSE.

• If enable_write_out_0_PQ_area := FALSE :

Then, no data are written on the peripheral output section. Still, a valid bit address must be specified for the ASIMON_out_0_PQ_area parameter (otherwise error message during the initiation phase).

Example: ASIMON_out_0_PQ_area := DB1000.DBX0.0 enable_write_out_0_PQ_area := FALSE The function block does not access the specified data block. The data block need not be available.

Page 41: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 11 of 30

• If enable_write_out_0_PQ_area := TRUE : Then, the data are directly written on the peripheral output section. The principle is described under the ASIMON_out_0_PQ_area parameter. Please observe for use of the peripheral output section: With peripheral failures and unloaded access errors OB122, the PLC switches to STOP. Also refer to the Profibus_Fault parameter.

DataSelect_All_Devices [Bool] • This parameter specifies the data format in which the diagnosis data are to be

transmitted from the safety monitor. • The parameter’s value must be imperatively identical with the settings in the ASIMON

configuration program under "Edit" >> "Monitor/Bus Information" >> "Diagnosis/Service" >> "AS-Interface Diagnosis" >> "Data Selection".

• With false settings, the data cannot be interpreted correctly.

• DataSelect_All_Devices := FALSE must be set when safety monitors of Version 2.0 or later are used with the setting “Data selection = Sorted by OSSD”. In other languages, this corresponds to the setting: Datenauswahl = nach Freigabekreisen sortiert Choix de données = séparés par circuit de validation Elección de datos = separados por circuito de habilitación Selezione die dati = separati per circuito di abilitazione When safety monitors of Version 1.x (i.e. safety monitors of a version < 2.0) are used, FALSE must always be set.

• DataSelect_All_Devices := TRUE must be set when safety monitors of Version 2.0

or newer are used with the setting “Data selection = All Devices” In other languages, this corresponds to the setting: Datenauswahl = alle Devices Choix de données = tous les composants Elección de datos = todos los dispositivos Selezione die dati = tutti i componenti

• Note:

The setting in the ASIMON PC configuration program affects the volume of the transmitted diagnosis data: With the "Data selection = Sorted by OSSD" setting, only devices which are located in the main line (representation level 1) of a release circuit are transmitted. Devices which are merely defined in the pre-processing and are, e.g. used as input information for OR gates, are not displayed in the diagnosis data. Safety monitors of Version 1.x always transmit data in this format. With the "Data selection = All devices" setting, all devices are transmitted, i.e. also devices which are merely defined in the pre-processing (e.g. as input information for OR gates). Safety monitors of Version 2.x or later offer the option of transmitting data in this format. It is normally recommended to set safety monitors of Version 2.x or later to "Data selection = All devices" in order to enable the PLC to access the total volume of diagnosis data. The diagnosis function block stores the diagnosis data in the PLC in a constant structure, independent of the settings in the ASIMON PC configuration program. The DataSelect_All_Devices parameter must, however, be set correctly!

• The parameter should not be changed during running diagnosis operation. Otherwise, a one-time passing through the initiation phase is carried out, refer to the parameter description under reset.

Page 42: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 12 of 30

ASi_master_type_Link20E [Bool] • This parameter determines whether the AS-i master is addressed byte-wise or word-

wise when the PLC peripheral section is directly accessed. This parameter has no influence on the further data processing.

• The setting must correspond to the technical data of the AS-i master. • With ASi_master_type_Link20E := FALSE, peripheral access is realized in word

format. This setting is, for example, valid for the AS-i masters CP343-2 (P) and CP342-2.

• With ASi_master_type_Link20E := TRUE, peripheral access is realized in byte format. This setting is, for example, valid for all the AS-I Links: Link20E, Link20, Link Advanced, etc.

• The parameter is only evaluated if the ASIMON_in_0 parameter refers to the peripheral input section, and/or the ASIMON_out_0_PQ_area parameter refers to the peripheral output section.

• Particularly with the peripheral output section, it may be necessary to observe in the user program that with ASi_master_type_Link20E := FALSE , a total of 16 bits are overwritten in the peripheral output section, while with ASi_master_type_Link20E := TRUE , a total of 8 bits are overwritten in the peripheral output section. The differing reading behavior in the peripheral input section may be ignored by the user program.

• The parameter is only evaluated in the initiation phase. Refer to the parameter description under reset.

ASi_Slave_Fault [Bool]

ASi_Power_Fault [Bool]

Profibus_Fault [Bool]

reset [Bool] • At the ASi_Slave_Fault parameter, an error message with the meaning TRUE =

failure AS-i slave safety monitor is to be transmitted. • At the ASi_Power_Fault parameter, an error message with the meaning TRUE =

failure AS-i voltage (or other general AS-i failure) is to be transmitted. • At the Profibus_Fault parameter, an error message with the meaning TRUE =

communication failure with AS-i master is to be transmitted. • The reset parameter must, during start-up of the PLC-CPU (OB100, etc.), become

TRUE once in order to ensure that the function block can correctly start the diagnosis transmission after any history.

• Particularity:

The value of the reset parameter is block-internally automatically reset to FALSE if the parameter at the function block is not specified by an actual parameter (reset := __ ). Thus, the parameter can, e.g. during start-up OB100, be specified by constant TRUE while it remains unspecified during the cyclic call-up OB1.

• The prerequisite for the transmission of diagnosis data is the addressability of the

safety monitor’s AS-i slave address by the AS-i master and the correct connection of the PLC-CPU with the AS-i master.

Page 43: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 13 of 30

With communication failures, the diagnosis sequence must be terminated. Upon recovery, the diagnosis sequence must be newly initiated.

• If one of the 4 parameters is ASi_Slave_Fault := TRUE or ASi_Power_Fault := TRUE or Profibus_Fault := TRUE or reset := TRUE, the diagnosis sequence is terminated. In this state, no input data are read and no output data are written. Among other things, this avoids a continuous call-up of the access error OB122 upon device failure.

• As soon as all 4 parameters become ASi_Slave_Fault := FALSE and ASi_Power_Fault := FALSE and Profibus_Fault := FALSE and reset := FALSE, the function block passes a one-time initiation phase and the diagnosis data are then continuously read in.

• In addition, the initiation phase is continuously passed as long as the parameter reset := TRUE.

• A one-time passing of the initiation phase is also triggered if the block-internal time monitoring (watchdog) detects that during a running diagnosis sequence, no data are any longer received by the safety monitor over a longer time period (2,000 msec).

• During the initiation phase (and only during this phase), the following parameters are evaluated and stored block-internally for further use: ASIMON_in_0, ASIMON_out_0, ASIMON_out_0_PQ_area, ASi_master_type_Link20E, ASIMON_diag_stop_address.

enable_copy_diagnosis [Bool]

indirect_copy_diagnosis [Bool]

memory_copy_diagnosis [ANY] • The three parameters control the transmission of the diagnosis data to any data

section of the PLC. • A type ANY pointer which specifies the target section for the diagnosis data must be

created for the memory_copy_diagnosis parameter. The diagnosis data comprise a total length of 182 bytes. If the specified target section is smaller (e.g. 102 bytes length), a respectively smaller data volume is transmitted (n the example byte section 0..181), i.e. the upper data section is cut off. If the specified target section is larger, still only 182 bytes are transmitted, the surplus section is not accounted for. Note: For the transmission of the diagnosis data, the SFC 20 BLKMOV system function is called up block-internally.

• With indirect_copy_diagnosis := FALSE, the pointer at the memory_copy_diagnosis parameter directly specifies the target section of the diagnosis data. With indirect_copy_diagnosis := TRUE, the pointer at the memory_copy_diagnosis parameter transmits a data section with a length of 10 bytes via a type ANY pointer which then specifies the target section of the diagnosis data. With this, the target section for the diagnosis data can be variably adjusted according to the respective needs.

Page 44: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 14 of 30

!

!

Caution: In the user program, the transmitted data range must contain an actually valid ANY pointer! Otherwise, the result of the copy function is completely random which can lead to dangerous reactions.

• For the diagnosis data to be copied to the target section, the enable_copy_diagnosis := TRUE parameter must be set. The copy function is only called up upon completion of a complete diagnosis sequence. This means that the transmitted diagnosis data sets are always consistent. In addition, the copy function is also called up if a diagnosis sequence is terminated (e.g. with ASi_Slave_Fault := TRUE , etc.); in this case, the diagnosis data are incomplete. With enable_copy_diagnosis := FALSE, the copy function is never called up. The function block’s output parameters (and IN-OUT parameters) are, however, updated and can be evaluated. The diagnosis data could be evaluated via read access to the instance data block; as the internal data are inconsistent, such access is not recommended.

ASIMON_diag_stop_address [Pointer]

ASIMON_diag_stop_active [Bool]

ASIMON_diag_stop_invert [Bool]

freeze_ASIMON_automat [Bool]

freeze_ASIMON_manual [Bool]

unfreeze_if_chann_1_off [Bool]

unfreeze_if_chann_2_off [Bool]

unfreeze_if_device_wait [Bool] • The eight parameters control the “Diagnosis Stop” function of safety monitors of

Version V2.x or later. Safety monitors of Version V1.x do not support this function and ignore these parameters.

• The "Diagnosis Stop" function "freezes" the state of any device if the device has registered a switch-off. I.e. also if the device could switch back on later, it remains in the off state or, more exactly: it remains in the “Waiting” state (color display YELLOW in the diagnosis mode of the ASIMON PC program, corresponding to status code 2 in the PLC diagnosis data, as with waiting for on-site acknowledgement).

• A “frozen” device can be released (“unfrozen”) by switching off the stop condition of the diagnosis stop function.

• The “freezing” procedure described above is only possible if the stop condition of the diagnosis stop function is switched on.

• With the “Diagnosis Stop” function, a very short-term switch-off of a device can be registered by the diagnosis which would otherwise lead to a switch-off of the release circuit, however, would not be detectable in the diagnosis.

• Caution: The “Diagnosis Stop” function may delay the reconnection of one of the safety monitor’s release circuits as the devices must be released beforehand (unfrozen). In connection with OR gates, etc. the “Diagnosis Stop” function can even lead to an

Page 45: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 15 of 30

unwanted disconnection of a release circuit as each individual state of a gate input is frozen and the resulting sum of the possibly frozen inputs may lead to a disconnection of the gate output.

• The “Diagnosis Stop” function can be activated in the ASIMON PC configuration program under "Edit" >> "Monitor/Bus Information" >> "Diagnosis/Service" >> "Diagnosis Stop" (also refer to the safety monitor’s manual). It is recommended to only activate this function for troubleshooting. This function should particularly not be activated with the use of OR gates, etc. (as described above).

• In the ASIMON PC configuration program, an AS-i slave address including a bit address must be specified when the diagnosis stop function is activated. For use with the diagnosis function block, an output should be specified as bit address in order for this output to be controlled by the PLC. The “Inverted” option should remain switched off. Background: With PLC-STOP, all outputs in state 0 and thus also the diagnosis stop function are switched off. The safety monitor cannot be blocked by “frozen” devices. The system may then possibly be operated in manual mode without PLC.

• In order for the function block to be able to control the diagnosis stop condition, the parameter must be ASIMON_diag_stop_active := TRUE. With ASIMON_diag_stop_active := FALSE, the diagnosis stop function is not processed; the output bit defined by the ASIMON_diag_stop_address parameter is not changed.

• The ASIMON_diag_stop_address parameter defines the PLC output bit of the

diagnosis stop function (in accordance with the settings of the ASIMON PC configuration program). The parameter may refer to any storage section of the PLC. Exception: The parameter must not refer to the peripheral section. If a section-internal pointer is assigned as parameter, this parameter is automatically evaluated like a pointer on the output image section.

Example: ASIMON_diag_stop_address := P#6.7 corresponds to ASIMON_diag_stop_address := P#A6.7

If no bit address is assigned as parameter, this parameter is evaluated like a pointer on the bit 0 of the specified address. The ASIMON_diag_stop_address parameter is only evaluated during the initiation phase. Refer to the parameter description under reset. Non-permissible settings: - Data block reference without specification of the DB number (results in error message) - Reference to the peripheral section (results in error message)

False: ASIMON_diag_stop_address := DBX35.0 (DB number missing) ASIMON_diag_stop_address := DIX35.0 (DB number missing) ASIMON_diag_stop_address := P#P129.0 (Peripheral section non-permissible!)

• The ASIMON_diag_stop_invert parameter must correspond to the settings of the

ASIMON PC configuration program: If the “Inverted” option is switched off (recommended), the ASIMON_diag_stop_invert := FALSE parameter must be set. If the “Inverted” option is selected, the ASIMON_diag_stop_invert := TRUE parameter must be set.

Page 46: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 16 of 30

• With both parameters freeze_ASIMON_automat := FALSE and freeze_ASIMON_manual := FALSE , the diagnosis stop condition is permanently switched off, i.e. the safety monitor does not “freeze” any devices.

• With the parameter freeze_ASIMON_automat := FALSE, the diagnosis stop condition can be manually activated with freeze_ASIMON_manual := TRUE in order for the safety monitor to “freeze” devices. The release (unfreeze) must then also be effectuated manually! The parameters unfreeze_if_chann_1_off, unfreeze_if_chann_1_off, unfreeze_if_device_wait are not accounted for in this case.

• With the parameter freeze_ASIMON_automat := TRUE, the function block automatically manages the control of the diagnosis stop condition. The freeze_ASIMON_manual parameter is not accounted for in this case. This case is subject to the following behavior rules: The diagnosis stop condition is initially switched on, i.e. the safety monitor can “freeze” devices. General principle: After the diagnosis function has detected the switch-off of both release circuits, the diagnosis stop condition is switched off (unfrozen), i.e. the safety monitor may possibly switch back on. Additional principle: With the parameter unfreeze_if_chann_1_off := TRUE, the diagnosis stop condition is also switched off (unfrozen) if release circuit 1 has switched off (irrespective of the state of release circuit 2).

• With the parameter unfreeze_if_chann_2_off := TRUE, the diagnosis stop condition is also switched off (unfrozen) if release circuit 2 has switched off (irrespective of the state of release circuit 1).

• With the parameter unfreeze_if_device_wait := TRUE, the diagnosis stop condition is also switched off (unfrozen) periodically if the running diagnosis sequence has detected at least 1 device in the “Waiting” state (state = 2). In this context, periodical switch-off means that the diagnosis stop condition is switched off for periods of 100 msec respectively and is then switched back on for 100 msec respectively. With this, not all short-term device switch-offs can be registered any longer, yet, “frozen” devices which do not directly lead to a switch-off of the release circuit (e.g. individual gate inputs) are released during the running operation (unfrozen).

3.1.2 Output Parameters The function block’s output parameters need not imperatively be queried. They offer information on the state of the diagnosis sequence and the safety monitor and can be used in the user program in accordance with the requirements.

retval [Int] • The parameter informs on the state of the diagnosis function block.

It should be read as 4-digit hexadecimal value. • The top value bit shows the signaling of an error state,

e.g. 8xxx (hex) = error message. The second-top value shows the block parameter which the message refers to, e.g. x1xx (hex) = message refers to the first parameter ( ASIMON_in_0 ). The further hexadecimal places contain an error or message number.

Page 47: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 17 of 30

• The following values of retval are defined: 8010 hex: Time monitoring has responded, no communication with the safety monitor 8020 hex Internal error / No request active 813A hex: Parameter ASIMON_in_0, DB-number missing 8225 hex: Parameter ASIMON_out_0, peripheral section non-permissible 823A hex: Parameter ASIMON_out_0, DB-number missing 833A hex: Parameter ASIMON_out_0_PQ_area, DB-number missing 8E25 hex: Parameter ASIMON_diag_stop_address, peripheral section non-permissible 8E3A hex: Parameter ASIMON_diag_stop_address, DB-number missing 8701 hex Diagnosis sequence termination, parameter ASi_Slave_Fault := TRUE 8801 hex Diagnosis sequence termination, parameter ASi_Power_Fault := TRUE 8901 hex Diagnosis sequence termination, parameter Profibus_Fault := TRUE 8D01 hex Diagnosis data could not be copied, non-permissible section at the parameter memory_copy_diagnosis, refer to error message in the parameter Copy_Retval 8D02 hex Diagnosis data could not be copied, indirect parameter memory_copy_diagnosis cannot be accepted, refer to error message in the parameter Copy_Retval 8D03 hex Diagnosis data could not be copied, the ANY pointer referring to the indirect parameter memory_copy_diagnosis points to non-permissible section, refer to error message in the parameter Copy_Retval 8D04 hex Diagnosis data could not be copied, the indirect parameter memory_copy_diagnosis refers to a too short section (no ANY pointer) 7A01 hex No error, parameter RESET := TRUE 00xx hex: No error, xx is the number of call-ups for which the function

block waits for a response by the safety monitor. xx = 0: no delay/optimal diagnosis sequence, if xx >0: Possibly specify direct peripheral access with parameter ASIMON_in_0 and/or ASIMON_out_0_PQ_area

diag_done_puls_general [Bool] • The parameter becomes TRUE for one cycle if a diagnosis sequence has been

successfully completed or terminated by an error. With this, a further processing of the diagnosis data can be initiated.

diag_done_puls_tripped_1 [Bool] • The parameter becomes TRUE for one cycle if a diagnosis sequence has been

successfully completed or terminated by an error and a switch-off (transition ON to OFF) in release circuit 1 was registered in this diagnosis sequence. With this, e.g. an archiving of the diagnosis data can be initiated.

diag_done_puls_tripped_2 [Bool] • The parameter becomes TRUE for one cycle if a diagnosis sequence has been

successfully completed or terminated by an error and a switch-off (transition ON to OFF) in release circuit 2 was registered in the diagnosis sequence. With this, e.g. an archiving of the diagnosis data can be initiated.

Page 48: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 18 of 30

Channel_1_off [Bool] • The parameter is TRUE if release circuit 1 is configured and switched off.

The parameter immediately changes its state upon read-in of the monitor’s state (not only upon diagnosis sequence completion). The parameter is also TRUE when the safety monitor is in the configuration or start-up mode.

Channel_2_off [Bool] • The parameter is TRUE if release circuit 2 is configured and switched off.

The parameter immediately changes its state upon read-in of the monitor’s state (not only upon diagnosis sequence completion). The parameter is also TRUE when the safety monitor is in the configuration or start-up mode.

Config_Mode [Bool] • The parameter is TRUE when the safety monitor is in the configuration mode (not in

start-up mode). The parameter immediately changes its state upon read-in of the monitor’s state (not only upon diagnosis sequence completion).

Startup_Phase [Bool] • The parameter is TRUE when the safety monitor is in the start-up mode.

The parameter immediately changes its state upon read-in of the monitor’s state (not only upon diagnosis sequence completion).

Com_Error [Bool] • The parameter is TRUE if the communication with the safety monitor is interrupted.

ASIMON_diag_stop_Tracing • The parameter is TRUE if the diagnosis halt condition is switched on, i.e. the safety

monitor “freezes” a device upon switch-off.

copy_error [Bool] • The parameter is TRUE if an error occurs when copying the diagnosis data (refer to

parameter memory_copy_diagnosis ). Then refer to parameters copy_retval and retval .

copy_retval [Int] • The parameter transmits the RETVAL state to the block-internally called-up system

function SFC20 BLKMOV. The meaning of the state messages is available in the description of the system function. Exception: The parameter becomes copy_retval = 80FF (hex) if the indirect parameter memory_copy_diagnosis refers to a too short section (no ANY pointer); in this case, the system function is not called up and the replacement value 80FF is transmitted. The parameter must only be evaluated if copy_error = TRUE.

Page 49: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 19 of 30

3.1.3 Input/Output Parameters (IN-OUT) The input/output parameters of the function block are only set block-internally (to TRUE). The resetting (to FALSE) must be initiated in the user program.

Channel_1_tripped [Bool] • The parameter is set to TRUE if a switch-off was registered

in release circuit 1 (transition ON to OFF). After evaluation, the parameter should be reset to FALSE in the user program.

Channel_2_tripped [Bool] • The parameter is set to TRUE if a switch-off was registered

in release circuit 2 (transition ON to OFF). After evaluation, the parameter should be reset to FALSE in the user program.

diagnosis_done [Bool] • The parameter is set to TRUE upon successful completion of

a diagnosis sequence. After evaluation, the parameter should be reset to FALSE in the user program.

diagnosis_error [Bool] • The parameter is set to TRUE upon termination of a diagnosis

sequence by an error. After evaluation, the parameter should be reset to FALSE in the user program.

3.1.4 LAD / FBD Parameters

ENO [Bool] • The parameter is set to TRUE upon successful completion of

a diagnosis sequence or upon termination of a diagnosis sequence by an error after successful copying of the diagnosis data (refer to parameter memory_copy_diagnosis ). With this, a further processing of the diagnosis data can be initiated.

• In STL, the parameter corresponds to the binary result BR.

Page 50: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 20 of 30

3.2 Structure of the "ASIMON2_UDT" Diagnosis Data

The diagnosis data transmitted via the memory_copy_diagnosis parameter maximally comprise 182 bytes.

The structure of this data block is described in the following.

The data structure is provided as user-defined data type (UDT) "ASIMON2_UDT".

The "ASIMON2D" diagnosis function block internally uses the same data structure in the static data section asimon.

The structure consists of 3 sections:

DIAG (102 bytes) contains the actual diagnosis data of the safety monitor.

INFO (8 bytes) contains additional information from the diagnosis function block.

TIME_STAMP (72 bytes) contains time stamp information on various events in the Date_and_Time (DT) format.

Diagnosis Data Structure

DIAG Section Byte Meaning Byte Meaning

n status_function_block n+1 status_monitor

n+2 status_channel [1] n+3 status_channel [2]

n+4 quantity [1] n+5 quantity [2]

n+6 device [32].channel_info n+7 device [32].status

n+8 device [33].channel_info n+9 device [33].status

n+10 device [34].channel_info n+11 device [34].status

n+… device […].channel_info n+… device […].status

n+98 device [78].channel_info n+99 device [78].status

n+100 device [79].channel_info n+101 device [79].status

INFO Section n+102 max_device_in_channel [1].index n+103 max_device_in_channel [1].status

n+104 max_device_in_channel [2].index n+105 max_device_in_channel [2].status

n+106 retval (Integer)

n+108 info_bits

TIME_STAMP Section n+110 DT: actual_time

Running time in the function block

n+118 DT: OSSD_1_off Time of the last switch-off of release circuit 1

n+126 DT: OSSD_1_on Time of the last switch-on of release circuit 1

n+134 DT: OSSD_2_off Time of the last switch-off of release circuit 2

Page 51: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 21 of 30

n+142 DT: OSSD_2_on Time of the last switch-on of release circuit 2

n+150 DT: Config_Mode_asimon Time of the last switch-over to the configuration mode (no start-up)

n+158 DT: Startup_Phase_asimon Time of the last start-up of the safety monitor

n+166 DT: Fault_or_Error_FB Time of the last communication termination

n+174 (...181)

DT: Startup_Diagnosis_FB Time of the last re-start of the function block

status_function_block The 8 bits contained in this byte have the following meaning:

DataSelect_All_Devices Bit (n+0).0: Copy of the parameter DataSelect_All_Devices.

data_doublecheck Bit (n+0).1: The diagnosis sequence is passed through once more, the data are possibly inconsistent.

data_ready_tripped_ch_1 Bit (n+0).2: The diagnosis sequence has been completed, in this diagnosis sequence, a switch-off (transition ON to OFF) was registered in release circuit 1.

data_ready_tripped_ch_2 Bit (n+0).3: The diagnosis sequence has been completed, in this diagnosis sequence, a switch-off (transition ON to OFF) was registered in release circuit 2.

diagnosis_done Bit (n+0).4: The diagnosis sequence was successfully completed.

diagnosis_error Bit (n+0).5: The diagnosis sequence was terminated.

Channel_1_off Bit (n+0).6: Release circuit 1 is switched off.

Channel_2_off Bit (n+0).7: Release circuit 2 is switched off.

Page 52: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 22 of 30

status_monitor The "status_monitor" data byte describes the overall state of the safety monitor. It may assume values between 8 and 15. The meaning of the values is described in the following table:

status_monitor Decimal value Binary value (d3 d2 d1 d0) Meaning

8 1 0 0 0 Both circuits switched on

9 1 0 0 1 Circuit 1 off / circuit 2 on

10 1 0 1 0 Circuit 1 on / circuit 2 off

11 1 0 1 1 Both circuits switched off

12 1 1 0 0 Configuration mode (power on / reset)

13 1 1 0 1 Configuration mode (stop state, processing with PC program possible)

14 1 1 1 0 Configuration mode (reserved)

15 1 1 1 1 Configuration mode (fatal device error, reset or replacement required)

In the configuration mode, both circuits are switched off.

status_channel [1] status_channel [2]

The "status_channel [1]" data byte describes the state of release circuit 1. The "status_channel [2]" data byte describes the state of release circuit 2. Values between 0 and 7 may be assumed. The meaning of the values is described in the following table:

status_channel [1] / status_channel [2] Decimal value Binary value (d3 d2 d1 d0) Meaning LED state at monitor

0 0 0 0 0 Circuit is switched on

green

1 0 0 0 1 Circuit is ready for switch-on, waiting for start condition

yellow + red

2 0 0 1 0 Circuit is switched off

red

3 0 0 1 1 Circuit is switched off, service key required

red flashing

4 0 1 0 0 Reserved

5 0 1 0 1 Reserved

6 0 1 1 0 Reserved

7 0 1 1 1 Reserved

Page 53: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 23 of 30

quantity [1] / quantity [2] The "quantity [1]" data byte specifies the number of tripped devices in release circuit 1. The "quantity [2]" data byte specifies the number of tripped devices in release circuit 2.

device [m].channel_info These 48 data bytes specify the release circuit in which they are configured for each device.

device [m].channel_info Decimal value Binary value (d3 d2 d1 d0) Meaning

0 0 0 0 0 Device is contained in the pre-processing or not configured

1 0 0 0 1 Device is contained in release circuit 1

2 0 0 1 0 Device is contained in release circuit 2

3 0 0 1 1 Device is contained in both release circuits

device [m].status These 48 data bytes describe the state of the individual devices in the release circuits. One “status” data byte is provided per device (m = 32...79). Values between 0 and 7 can be assumed. The meaning of the values is described in the following table. Note: The status=2 value is also assumed if a device was “frozen” due to the diagnosis stop function.

device [m].status Decimal value Binary value (d3 d2 d1 d0) Meaning Color display in the

AsiMon PC software

0 0 0 0 0 Device is switched on

green

1 0 0 0 1 Device is switched on, switch-off timer started

green flashing

2 0 0 1 0 Device waits for on-site acknowledgement or start condition

yellow

3 0 0 1 1 Device (two-channel dependent) was operated one-channeled; test (off → on) required, also with “start-up test "

yellow flashing

4 0 1 0 0 Device has switched off (regular switch-off)

red

5 0 1 0 1 Device (positively driven) has switched off one-channeled, or contactor control error. Service key required

red flashing

6 0 1 1 0 Device communication error between the AS-i module and the safety monitor

grey

7 0 1 1 1 The safety monitor is in the configuration mode

---

Page 54: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 24 of 30

3.3 Runtime of the Diagnosis Function Block

The function block FB102 "ASIMON2D" requires several cycles for a complete diagnosis sequence.

Depending on the state of the safety monitor, the following number of call-up cycles is required.

3.3.1 Runtime with Data Selection = Sorted by OSSD a) With the “both circuits switched on” or “configuration mode” monitor state, 2 call-ups are required:

2 cycles "basic load"

b) With all other monitor states, the number of call-ups depends on the number of tripped devices.

The call-up number can be calculated as follows:

2 cycles " basic load "

+ 2 cycles for read-in of the states of the two release circuits

+ M x 4 cycles, with M = number of actually tripped devices in release circuit 1, if 7 or more devices have tripped in circuit 1, M = actual number + 1.

+ N x 4 cycles, with N = number of actually tripped devices in release circuit 2, if 7 or more devices have tripped in circuit 2, M = actual number + 1.

3.3.2 Runtime with Data Selection = All Devices The call-up number can be calculated as follows:

2 cycles "basic load"

+ 2 cycles for read-in of the states of the two release circuits

+ M x 4 cycles, with M = number of actually tripped devices in the safety monitor (without division into release circuit 1 or release circuit 2), if 7 or more devices have tripped in circuit 1, M = actual number + 1.

After the initiation phase, the function block must once read out the assignment of the devices to the two release circuits (channel_info):

+ N x 4 cycles, with N = number of configured devices in release circuit 1 and release circuit 2, if 7 or more devices are configured, N = actual number + 1.

3.3.3 Runtime with Switch-Off When a switch-off is detected (switch-off flank in circuit 1 or circuit 2), a further diagnosis sequence is automatically passed through under certain conditions (1, see below) in order to filter bounce events. Due to this, the number of call-ups may double.

As the safety monitor has two release circuits, a third passing through a diagnosis sequence may possibly be required: If, during the first query of a switch-off, a switch-off flank was only detected in one release circuit and, during the second query sequence, a switch-off flank is detected in the other release circuit, an automatic third passing through the diagnosis sequence may be initiated under certain conditions (1, see below).

Page 55: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 25 of 30

1 : Condition for a second or third query: In the moment of switch-off, a value device[m].status = 1, 2,or 3 was read in for the channel state. As these values may stabilize, e.g. to the value 4 during the next query sequence (bounce event), the query is automatically repeated.

Page 56: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 26 of 30

4 General Information on the Example Program The example program consists of 3 independent components / stations. From these stations, the station suitable for the respective real project can be selected. The selected station can be completely copied and further programmed for the real project or only the required blocks can be copied into an existing project and then adapted. The other stations need not be used.

4.1 "FB102" Station This station only contains the Diagnosis Block FB 102 "ASIMON2D" and the Conversion Block FB109 "CONVASI1" without further integration into an S7 program. Additionally, two user-defined data types (UDT) are contained. "ASIMON2_UDT” describes the diagnosis structure used by the FB 102 "ASIMON2D". "ASIMON1_UDT” describes the diagnosis structure used by the “former” FC 101 "ASIMON_DIAG". With the help of the Conversion Block FB109 "CONVASI1", the "ASIMON2" data structure can be converted into the "ASIMON1" data structure for compatibility purposes.

Page 57: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 27 of 30

4.2 "DP-AS-i Link20E" Station This station contains a PLC with Profibus master (CPU 315-2DP with integrated Profibus interface) with a subordinate AS-i system (via DP/AS-i Link 20E), including an AS-i safety monitor. For a universal applicability of the example, the station contains two Link20E: (a) Profibus address 3, diagnosis address 1022, diagnosis alarm release,

logical basic address 0, (b) Profibus address 4, diagnosis address 1021, diagnosis alarm release,

logical basic address 32, as well as two AS-i safety monitors: (aa) AS-i slave address 28, connected to Link20E (a),

corresponds to addresses E14.4 - 14.7 and A14.4 - 14.7,

(bb) AS-i slave address 29, connected to Link20E (a), corresponds to addresses E14.0 - 14.3 and A14.0 - 14.3.

The program of the station provides 2 separate diagnosis data structures:

• System diagnosis of the AS-i master (i.e. the failed AS-i slave), • Diagnosis of the safety monitor (i.e. which safety module has tripped).

Non-required program components may be ignored, i.e. if, for example, only 1 safety monitor is available, only 1 monitor diagnosis needs to be carried out. If, for example, 3 safety monitors are available, the program can be relatively easily adapted by inserting further copies of the respective blocks. Hint: Configuration with DP/AS-i LINK Advanced The station "DP-AS-i Link20E" can also be used for a configuration with DP/AS-i LINK Advanced - by corresponding adaption in HW Config. When using a double master, the FB100 "AS-i System Diagnose" has to be called once per each AS-i line. Each line needs its own instance DB, as if you would use two single masters.

Page 58: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 28 of 30

4.3 "AS-i CP343-2" Station This station contains a PLC without Profibus master (CPU 314) with AS-i system (via CP 343-2), including an AS-i safety monitor. For a universal applicability of the example, the station contains two CP 343-2: (a) Logical basic address 256 (with process image as of address 64, refer to next paragraph), (b) Logical basic address 272 (with process image as of address 96, refer to next paragraph),. The CPU 314 features no process image as of basic address 128. To enable a bit-wise access to the AS-i data despite this, a process image as of address 64 is manually generated at the beginning of each respective cyclic program (OB1). It is assumed that this section is not occupied by plugged modules (in the rack). Otherwise, the process image must be shifted to a different section or generated in a data block. as well as two AS-i safety monitors: (aa) AS-i slave address 28, connected to the first CP 343-2 (a),

corresponds to addresses E78.4 - 78.7 and A78.4 - 78.7 (however, peripheral address PEB 270 / bit 4-7),

(bb) AS-i slave address 29, connected to the second CP 343-2 (b), corresponds to addresses E78.0 - 78.3 and A78.0 - 78.3 (however, peripheral section PEB 270 / bit 0-3).

The program of the station provides 2 separate diagnosis data structures:

• System diagnosis of the AS-i master (i.e. the failed AS-i slave), • Diagnosis of the safety monitor (i.e. which safety module has tripped).

Non-required program components may be ignored, i.e. if, for example, only 1 safety monitor is available, only 1 monitor diagnosis needs to be carried out. If, for example, 3 safety monitors are available, the program can be relatively easily adapted by inserting further copies of the respective blocks. Hint: Configuration with CP 343-2 P The station "AS-i CP343-2" can also be used for a configuration with CP 343-2 P - by corresponding adaption in HW Config.

Page 59: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 29 of 30

5 Overview of the Program Structure of the "DP-AS-i Link20E" and "AS-i CP343-2" Stations

5.1 Startup OB100 Call-up of FC127

Contents FC127 • Delay of the program start by several seconds (for transient reaction of all voltages,

etc.), • Initiation of the safety monitors’ diagnosis, • Initial read-in of the system diagnosis of the AS-i-masters (with FB100).

5.2 Alarm OB82 (for Module Errors) and OB86 (for Profibus Errors, only in "DP-AS-i Link20E" Station) Call-up of FB100

• Read-in of the system diagnosis of the AS-i masters and storage in DB101 (for first AS-i master), DB102 (for second AS-i master), etc.

5.3 Error OB85 (Process Image Update Error) and OB122 (Peripheral Access Error)

• No program code contained, possibly needs to be programmed by the user.

5.4 Cyclic Program OB1 Reads in the input process image (only in station "AS-i CP343-2"), to enable a bit-wise access to inputs.

• FC121 for first AS-i master, calls up FB120 with DB121. • FC122 for second AS-i master, calls up FB120 with DB122.

Calls up further program components for system operation • Must be programmed by the user

Calls up message block FB117 (with DB117) • Example for the output of messages due to the diagnosis; messages must be adapted

by the user.

Calls up FB102 with DB111 for diagnosis of the first safety monitor. Calls up FB102 with DB112 for diagnosis of the second safety monitor (if available).

Writes the output process image on the peripheral (only in station "AS-i CP343-2") to enable a bit-wise access to the outputs.

• FC121 for the first AS-i master, calls up FB120 with DB121. • FC122 for the second AS-i master, calls up FB120 with DB122.

Page 60: Diagnose-Baustein AS-i Sicherheitsmonitor Erweitert V2.x ... · AS-i Sicherheitsmonitor V2.x (Erweitert / Basis) Diagnose mit S7-300 / S7-400 ... Bei Peripherieausfall und nicht geladenem

AS-i Safety Monitor V2.x (Extended / Basic) Diagnostics with S7-300 / S7-400

ASIMON2D Version 1.1 Page 30 of 30

6 Adaptation of the Example Program to a Real Project:

In the OB82: • Enter basic address of the AS-i masters (1 call-up of the FB100 per master) • Select instance DB at the FB100 (DB101, DB102, ...)

In the OB86 (only in "DP-AS-i Link20E" station): • Enter the basic and the diagnosis address (refer to HW Config/ DP Slave properties)

of the AS-i masters (1 call-up of the FB100 per master). • Select instance DB at the FB100 (DB101, DB102, ...)

In the OB1 • Adapt parameters at the FB102.

In the FC121 (or FC122, etc., only in "AS-i CP343-2" station) With recent SIMATIC CPUs, in HW Config you can select a base address of CP343-2 in the periphery area below 256. In this case, the call of FC121 (or FC122 etc.) is unnecessary, as the I/O data can be directly accessed in the process image.

• At the FB120 "Image_base_address" parameter, the basic address of the desired 16-byte section in the input/output image must be entered.

• In the downstream networks, the double word addresses of the peripheral and the process image must be adapted.

• The selected process image is used for each access to input/output data of the AS-i system, both with the diagnosis as well as with the other functions of the user program.

In the FC127 (Start-Up Program) • Initiation of all Diagnosis Blocks (1 initiation per master). • Enter basic address of the AS-i masters (1 call-up of the FB100 per master). • Select instance DB at the FB100 (DB101, DB102, ...). • Adapt parameters at the FB102.

In the FB117 • Program messages according to requirements.

Hint: Configuration with DP/AS-i LINK Advanced The station "DP-AS-i Link20E" can also be used for a configuration with DP/AS-i LINK Advanced - by corresponding adaption in HW Config. When using a double master, the FB100 "AS-i System Diagnose" has to be called once per each AS-i line. Each line needs its own instance DB, as if you would use two single masters. Note that in case of a PROFIBUS fault on a double master there is only one OB86 call which affects both AS-i lines: On the leaving event (going event) you should call FB100 for each AS-i line (with its own instance DB), so that the diagnosis data will be updated.