Structured Control Language

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 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 query language — SQL Apparu en 1974 Auteur …   Wikipédia en Français

  • Structured Query Language — SQL (das Kürzel für Structured Query Language; offizielle Aussprache [ɛskjuːˈɛl], häufig auch [ˈsiːkwəl] →SEQUEL), ist eine Datenbanksprache zur Definition, Abfrage und Manipulation von Daten in relationalen Datenbanken. SQL ist von ANSI und ISO… …   Deutsch Wikipedia

  • Structured Query Language — Содержание 1 История 1.1 Вопросы совместимости 2 Преимущества и недостатки …   Википедия

  • Data control language — A data control language (DCL) is a syntax similar to a computer programming language used to control access to data stored in a database. In particular, it is a component of Structured Query Language (SQL). Examples of DCL commands include: GRANT …   Wikipedia

  • Data Control Language — Die Data Control Language (DCL) ist derjenige Teil einer Datenbanksprache, der verwendet wird, um Berechtigungen zu vergeben oder zu entziehen. DCL ist die Datenüberwachungssprache einer Datenbank. Die DCL gibt es in unterschiedlichen Systemen in …   Deutsch Wikipedia

  • Control flow — Not to be confused with Flow control. In computer science, control flow (or alternatively, flow of control) refers to the order in which the individual statements, instructions, or function calls of an imperative or a declarative program are… …   Wikipedia

  • language — /lang gwij/, n. 1. a body of words and the systems for their use common to a people who are of the same community or nation, the same geographical area, or the same cultural tradition: the two languages of Belgium; a Bantu language; the French… …   Universalium

  • 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

  • Language attrition — is the loss of a first or second language or a portion of that language by individuals; it should be distinguished from language loss within a community (the latter process is referred to as language shift or language death). Language attrition… …   Wikipedia

  • Control table — This simple control table directs program flow according to the value of the single input variable. Each table entry holds a possible input value to be tested for equality (implied) and a relevant subroutine to perform in the action column. The… …   Wikipedia

Share the article and excerpts

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