Dieser Baustein sortiert ein Array vom Typ Dint
mit beliebiger Anzahl an Elementen (max. 1000) aufsteigend oder absteigend und gibt es im selben Array wieder zurück.
LGF_ShellSort_DInt (FB) | ||||||||
---|---|---|---|---|---|---|---|---|
Bool | sortDirection | error | Bool | |||||
status | Word | |||||||
Array[*] of DInt | array | Array[*] of DInt | ||||||
Bezeichner | Datentyp | Default Wert | Beschreibung |
---|---|---|---|
sortDirection | Bool | FALSE | FALSE := Sortierung aufsteigend TRUE := Sortierung absteigend |
Bezeichner | Datentyp | Beschreibung |
---|---|---|
error | Bool | FALSE: Kein Fehler TRUE: Während der Ausführung des FB ist ein Fehler aufgetreten |
status | Word | 16#0000-16#7FFF: Status des FB 16#8000-16#FFFF: Fehleridentifikation (siehe folgende Tabelle) |
Bezeichner | Datentyp | Beschreibung |
---|---|---|
array | Array[*] of DInt | Array, das sortiert werden soll |
Code / Wert | Bezeichner / Beschreibung |
---|---|
16#0000 | STATUS_NO_ERROR Status: Abarbeitung ohne Fehler beendet |
16#8200 | ERR_NO_ARRAY Fehler: Aktualparameter am Eingang `array` hat nur ein Element. |
16#8201 | ERR_TOO_MANY_ELEMENTS Fehler: Aktualparameter am Eingang `array` hat zu viele Elemente (maximal 1000). |
Der Baustein sortiert nach dem Shell-Sortierverfahren. Beachten Sie, dass die Ausführungszeit des Bausteins stark davon abhängt, wie viele Elemente das zu sortierende Array hat. Folgende Übersicht zeigt einige Messwerte des Bausteins in Abhängigkeit der Anzahl der Array-Elemente.
Mittlere Anzahl an schritten bei der Ausführung: \mathcal{O}( n \cdot \log (n)^2 )
Tabelle: Ausführungszeiten des Bausteins LGF_ShellSort…
Anzahl der Array-Elemente | S7-1212C DC/DC/DC | S7-1516-3 PN/DP |
---|---|---|
100 | ca. 11-16 ms | ca. 1-2 ms |
1000 | ca. 185-205 ms | ca. 10-12 ms |
Version & Datum | Änderungsbeschreibung | |
---|---|---|
01.00.00 | Siemens Industry Online Support | |
19.08.2015 | First released version | |
01.01.00 | Siemens Industry Online Support | |
19.05.2016 | New function: reverse sort | |
01.01.01 | Siemens Industry Online Support | |
02.01.2017 | Upgrade: TIA Portal V14 Update 1 | |
01.01.02 | Siemens Industry Online Support | |
17.08.2018 | Upgrade: TIA V15 Update 2 | |
01.01.03 | Siemens Industry Online Support | |
23.11.2018 | Upgrade: TIA V15.1 | |
02.00.00 | Siemens Industry Online Support | |
29.01.2019 | Output "done" removed (not necessary, because only one cycle) | |
02.00.01 | Simatic Systems Support | |
15.10.2019 | Code refactoring, comments added, change data type from Int to DInt | |
03.00.00 | Simatic Systems Support | |
23.04.2020 | Set version to V3.0.0, harmonize the version of the whole library | |
03.00.01 | Simatic Systems Support | |
15.02.2021 | Insert documentation |