Structured Text

Structured Text

Der strukturierte Text (engl. Structured Text, Abkürzung: ST) wird für die Programmierung von Speicherprogrammierbaren Steuerungen (SPS) eingesetzt. Die Norm EN 61131-3 legt neben anderen auch den Sprachumfang von ST fest. Dabei ist die Syntax der Sprachelemente ähnlich denen der Hochsprache Pascal und es wird wie bei allen Sprachen der EN 61131-3 keine Unterscheidung zwischen Groß- und Kleinschreibung gemacht (Case Insensitive).

ST bietet mehr Strukturierungsmöglichkeiten als AWL und löst diese daher immer mehr ab. Allerdings halten viele Entwickler noch immer an der Programmierung mit AWL fest, da ST-Programme nach der Kompilierung meist einen erhöhten Speicherbedarf mit sich bringen. Dieser kann auf kleineren SPS durch schnelleres Erreichen der Speichergrenzen durchaus zu Problemen führen.

Beispiel 1 (IF-Statement):

IF (MASCHINE_EINGESCHALTET = TRUE) THEN
    SOLLPOSITION := SOLLPOSITION + 100;
    AUSGANG1 := EINGANG1 AND EINGANG2;
ELSE
    AUSGANG1 := FALSE;
END_IF;

Alternativ ist auch folgende Programmierung möglich:

IF MASCHINE_EINGESCHALTET THEN
   SOLLPOSITION := SOLLPOSITION + 100;
END_IF;
AUSGANG1 := MASCHINE_EINGESCHALTET AND EINGANG1 AND EINGANG2;

Das Resultat beider Varianten ist identisch (nicht jedoch die interne Umsetzung in die Anweisungsliste). Achtung: Die Sollposition wird nicht verändert, wenn die Variable MASCHINE_EINGESCHALTET = FALSE ist.

Beispiel 2 (CASE-Statement):

if Cmd = 2 (* or Cmd = 9*) then
  case Slot of (* Aufnehmen *)
    1 : T_Dicke[3*i] := dint_to_int((RB_Ist[RB_Ist[0]]+499)/1000);
    2 : T_Dicke[3*i] := dint_to_int((Z1_Ist[Z1_Ist[0]]+499)/1000);
    3 : T_Dicke[3*i] := dint_to_int((FB_Ist+499)/1000);
  end_case;
else T_Dicke[3*i] := dint_to_int((T_Ist[i]+499)/1000);
end_if;

Beispiel 3 (FOR-Statement):

ENO := true;
for i := 0 to 499 by 1 do
  D := D1[i];
  D1[i] := D2[i];
  D2[i] := D;
end_for;

Beispiel 4 (REPEAT-Statement):

if RB_Ist[0] = 0 (*and RB_Soll[0] = 0*)
  then Daten[X[i]] := Daten[X[i]] + 1;
  else
    repeat
      Daten[X[i]] := Daten[X[i]] + 1;
      k := uint_to_int(Daten[X[i]]); (* Index des Kanals *)
    until Daten[X[i]+k] = 69 or Daten[X[i]+k] = 99
    end_repeat;
 end_if;

Beispiel 5 (WHILE-Statement):

If RST_Tisch then
  M[15] := false; 
  k := 1;
  while Daten[X[2]+k] <> 60 and Daten[X[2]+k] <> 99 and k < 49 do
    k := k+1;
  end_while;
  Daten[X[2]] := int_to_uint(k); (* neu setzen für 2. Vorgang *)
  Wait := false;
end_if;

Beispiel 6: Realisierung eines Blinklichts mit Flipflops, Timern und variablen Ein/Aus-Zeiten für eine Siemens S5

VAR
  TIMER1: TON;
  TIMER2: TON;
  FF1: RS; (* Flipflop 1 *)
  FF2: RS; (* Flipflop 2 *)
  FF3: RS; (* Flipflop 3 *)
END_VAR

TIMER1 ( IN :=NOT FF1.Q1 , PT := T#0.2s );
FF1 (SET := TIMER1.Q);
FF1 (RESET1:= NOT TIMER2.Q);
TIMER2 ( IN :=NOT FF2.Q1 AND TIMER1.q , PT := T#0.4s );
FF2 (SET := TIMER2.Q);
FF2 (RESET1:= NOT TIMER1.Q);
FF3(SET:=TIMER1.Q);
FF3(RESET1:=TIMER2.Q);

Wikimedia Foundation.

Игры ⚽ Поможем сделать НИР

Schlagen Sie auch in anderen Wörterbüchern nach:

  • Structured Text — es un lenguaje de marcas ligero creado para escribir textos de manera cómoda y rápida. Tiene la principal ventaja de que ese texto puede usarse para generar documentos equivalentes en HTML, TeX, docbook u otros lenguajes. Actualmente se usa más… …   Wikipedia Español

  • Structured text — is one of the 5 languages supported by the IEC 61131 3 standard. It is designed for programmable logic controllers (PLCs). It is a high level language that is block structured and syntactically resembles Pascal. All of the languages share… …   Wikipedia

  • Structured Text — (ST)  язык программирования стандарта IEC61131 3. Предназначен для программирования промышленных контроллеров и операторских станций. Широко используется в SCADA/HMI/SoftLogic пакетах. По структуре ближе всего к языку программирования… …   Википедия

  • Structured Control Language — Der strukturierte Text (engl. Structured Text, Abkürzung: ST) wird für die Programmierung von Speicherprogrammierbaren Steuerungen (SPS) eingesetzt. Die Norm EN 61131 3 legt neben anderen auch den Sprachumfang von ST fest. Dabei ist die Syntax… …   Deutsch Wikipedia

  • Structured programming — can be seen as a subset or subdiscipline of procedural programming, one of the major programming paradigms. It is most famous for removing or reducing reliance on the GOTO statement.Historically, several different structuring techniques or… …   Wikipedia

  • Structured Data Exchange Format — (SDXF) ist ein hierarchisch strukturiertes Datenformat. Mit diesem Format sollen fast beliebig strukturierte Daten zwecks Austauschs aufgenommen werden können. Dieses Format ist gleichermaßen geeignet als Dateiformat als auch als Networking… …   Deutsch Wikipedia

  • Text mining — Text mining, sometimes alternately referred to as text data mining , roughly equivalent to text analytics , refers generally to the process of deriving high quality information from text. High quality information is typically derived through the… …   Wikipedia

  • Structured writing — is a form of technical writing that leverages decades of research into documentation best practices. The term was coined by Robert E. Horn and became a central part of his Information Mapping method of analyzing, organizing, and displaying… …   Wikipedia

  • Structured Product Labeling — (SPL) defines the content of human prescription drug labeling in an XML format. This format is defined within the SPL schema and is displayed in a web browser using the SPL stylesheet. It is approved by Health Level Seven (HL7) and has been… …   Wikipedia

  • Text corpus — In linguistics, a corpus (plural corpora ) or text corpus is a large and structured set of texts (now usually electronically stored and processed). They are used to do statistical analysis and hypothesis testing, checking occurrences or… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”