> For the complete documentation index, see [llms.txt](https://infosys.selmotech.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://infosys.selmotech.com/selmo-struktur-und-standard/selmo-technischer-standard-und-struktur/beschreibung-selmo-plc-code/sequence-logic/less-than-sequence_name-greater-than/struktur-less-than-sequence_name-greater-than/standard-end.md).

# Standard End

Der Funktionsblock fbStandardEnd enthält die Logik, der die Information aus dem Maschinenzustand(Schritt) zu Aktorik und Sensorik(Zonen) extrahieren und die Art der nachfolgenden Maßnahmen bestimmt. Dieser überwacht auch die Steuerung des Schrittzählers und liefert die Diagnose an die HMI. Dieser FB ist Hauptbestandteil jeder Sequence und ist in der Selmo Basic Bibliothek zu finden. **refSeqHmi** ist die Reference(Pointer)zu der Variablenliste "[GVL\_\<Sequence\_name>\_HMI.stHmiIf](https://selmo-technology-gmbh.gitbook.io/selmo-solution/02-selmo-standard/04-selmo-plc-code/contents#221783-gvl_sequence1_hmi)" (stHmiSequence) **refSeqIf** ist die Reference(Pointer)zu der Variablenliste "[GVL\_\<Sequence\_name>.stSeqIf](https://selmo-technology-gmbh.gitbook.io/selmo-solution/02-selmo-standard/04-selmo-plc-code/contents#221781-gvl_sequence1)" (stSequenceInterface) **iSeqEndStep** Abfrage des letzten modellierten Schritt "[GVL\_\<HwZone\_name>\_IOs.xSafetyFunctionKeySwitch](https://selmo-technology-gmbh.gitbook.io/selmo-solution/02-selmo-standard/04-selmo-plc-code/contents#22173-gvl_hwzone1_ios)" **iSeqStepcounter** aktueller Schrittzähler der Sequence "[GVL\_\<Sequence\_name>.iStepcounter](https://selmo-technology-gmbh.gitbook.io/selmo-solution/02-selmo-standard/04-selmo-plc-code/contents#221781-gvl_sequence1)" **aLampMatrix** [Array der Bit Matrix](https://selmo-technology-gmbh.gitbook.io/selmo-solution/02-selmo-standard/04-selmo-plc-code/contents#221786-sequence1) (Variablen Deklaration) wird um zwei Indizes je Zone erhöht **aStepMatrix** [Array der Bit Matrix](https://selmo-technology-gmbh.gitbook.io/selmo-solution/02-selmo-standard/04-selmo-plc-code/contents#221786-sequence1) (Variablen Deklaration) wird um zwei Indizes je Zone erhöht **aTempMatrix** [Array der Bit Matrix](https://selmo-technology-gmbh.gitbook.io/selmo-solution/02-selmo-standard/04-selmo-plc-code/contents#221786-sequence1) (Variablen Deklaration) wird um zwei Indizes je Zone erhöht **aSeqHmiBits** Array der Bit Matrix wird um zwei Indizes je Zone erhöht und dient zur Information der HMI "[GVL\_\<Sequence\_name>\_HMI.aHmi](https://selmo-technology-gmbh.gitbook.io/selmo-solution/02-selmo-standard/04-selmo-plc-code/contents#221783-gvl_sequence1_hmi)" **aStepMonitoringMatrix** Array zum Speichern der Zeiten je Schritt "[GVL\_\<Sequence\_name>.aStepMonitoringMatrix](https://selmo-technology-gmbh.gitbook.io/selmo-solution/02-selmo-standard/04-selmo-plc-code/contents#221781-gvl_sequence1)" **aStepMonitoringFb** [Array der Speicherbausteine](https://selmo-technology-gmbh.gitbook.io/selmo-solution/02-selmo-standard/04-selmo-plc-code/contents#221786-sequence1) (Variablen Deklaration) je Schritt

Copy

```
// ########################### STANDARD END ###########################
   {region "Description Standard End"}
   (*
   The Standard End section provides the logic which extracts fault information from 
   the step sequence fault matrix determining the nature of the fault and subsequent actions.
   It also supervises control of the sequence step counter and provides the diagnostic  ‘link’ to the ‘HMI’ software.
   *)
   {endregion}
   GVL_<Sequence_name>.iStepCounterLastCycle := GVL_<Sequence_name>.iStepCounter;

   fbStandardEnd(
      refSeqHmi:= GVL_<Sequence_name>_HMI.stHmiIf,
      refSeqIf :=GVL_<Sequence_name>.stSeqIf,   
      iSeqEndStep := GVL_<Sequence_name>.iEndStep, 
      iSeqStepCounter := GVL_<Sequence_name>.iStepCounter, 
      aLampMatrix := aMatrix, 
      aStepMatrix := aStep, 
      aTempMatrix := aTemp, 
      aSeqHmiBits := GVL_<Sequence_name>_HMI.aHmi,
      aStepMonitoringMatrix := GVL_<Sequence_name>.aStepMonitoringMatrix,
      aStepMonitoringFb := aStepMonitoringFb);
```

**Interlock Stored**

Copy

```
// --------------------------- Interlock stored ---------------------------
   // Copy HMI Bits to stored array
   FOR nHmiStoredLoopCounter := 0 TO (UINT_TO_INT(SIZEOF(GVL_<Sequence_name>_HMI.aHmi)) - 1) BY 1 DO
      IF GVL_<Sequence_name>_HMI.aHmi[nHmiStoredLoopCounter] THEN
         GVL_<Sequence_name>_HMI.aHmiStored[nHmiStoredLoopCounter] := TRUE;
      END_IF
   END_FOR; 
   
   // Delete stored array every step counter change
   IF GVL_<Sequence_name>.iStepCounterLastCycle <> GVL_<Sequence_name>.iStepCounter OR GVL_Global.stGlobalIf.xFaultReset OR GVL_<Sequence_name>_HMI.stHmiIf.xHmiPbFaultReset THEN
      FOR nHmiStoredLoopCounter := 0 TO (UINT_TO_INT(SIZEOF(GVL_<Sequence_name>_HMI.aHmi)) - 1) BY 1 DO
         GVL_<Sequence_name>_HMI.aHmiStored[nHmiStoredLoopCounter] := FALSE;
      END_FOR; 
   END_IF
```

**2.2.1.7.8.7. \<Sequence\_name>\_InputMapping**

***

Copy

```
PROGRAM Sequence1_InputMapping
VAR
END_VAR

{region "Description Input Mapping"}
(*
All Step Sequence Zone Inputs that cannot be directly linked are connected to the real world hardware in this section.
This must be done manually.
*)
{endregion}

(*
GVL_Sequence1_IOs.i_xDecision_1_Path1 := ; // Decision: Decision 1
GVL_Sequence1_IOs.i_xDecision_1_Path2 := ; // Decision: Decision 1

*)
```

<\*\*\*> Variablen Name, Kommentar und Datentyp werden aus dem Studio automatisch übernommen

Im Input-Mapping werden die benötigten Hardware-Inputs auf die Input-Zonen gemappt. Beispielhaft:

Copy

```
GVL_Sequence1_IOs.i_xDecision_1_Path1 := GVL.I_Y3; 
GVL_Sequence1_IOs.i_xDecision_1_Path2 := GVL.I_Y4; 
```

**2.2.1.7.8.8. \<Sequence\_name>\_OutputMapping**

***

Copy

```
PROGRAM Sequence1_OutputMapping
VAR
END_VAR

{region "Description Output Mapping"}
(*
All Step Sequence Zone Outputs that cannot be directly linked are connected to the real world hardware in this section.
This must be done manually.
*)
{endregion}

(*
 := GVL_<Sequence_name>_IOs.<o_xZone_name>; 
 := GVL_<Sequence_name>_IOs.<o_xZone_name>; 
 := GVL_<Sequence_name>_IOs.<o_xZone_name>; 
 := GVL_<Sequence_name>_IOs.<o_xZone_name>; 

*)
```

<\*\*\*> Variablen Name, Kommentar und Datentyp werden aus dem Studio automatisch übernommen

Im Output-Mapping werden die Output-Zonen auf die Hardware-Ausgänge wie benötigt gemappt. Beispielhaft:

Copy

```
GVL.O_Y1 := GVL_Sequence1_IOs.o_xZone9; 
GVL.O_Y2 := GVL_Sequence1_IOs.o_xZone10; 
GVL.O_Y3 := GVL_Sequence1_IOs.o_xZone11; 
GVL.O_Y4 := GVL_Sequence1_IOs.o_xZone12; 
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://infosys.selmotech.com/selmo-struktur-und-standard/selmo-technischer-standard-und-struktur/beschreibung-selmo-plc-code/sequence-logic/less-than-sequence_name-greater-than/struktur-less-than-sequence_name-greater-than/standard-end.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
