Naming - References - SIMATIC AX - Support documentation - ST Style Guide, Cheat sheet

Structured Text Style guide

Portfolio
SIMATIC AX
Product
SIMATIC AX
Software version
2510
Edition
02/2026
Language
English (original)
Package Name
@ax/st-styleguide

For a unique look, identifier should be named consistently in the project.

Rule:

Don't add prefixes to your identifier (Hungarian notation). Structured text is a strongly typed language, so they are not needed. Do not mark temporary values or internal values either.

wStw1       : WORD    //Not OK
Stw1        : WORD    //OK
r32SetPoint : REAL    //Not OK
SetPoint    : REAL    //OK

Exception: Interfaces should start with the capital letter I. The following letter of the identifier is capital.

Rule:

Abbreviations in names should be handled like a word and not written in capital letters, except the abbreviation consists of two characters. In this case, both letters may be capital.

VAR_GLOBAL
    IceTrainNumber  : INT;          //OK
    ICETrainNumber  : INT;          //Not OK
    DrivePNName     : STRING;       //OK
END_VAR
INTERFACE IHmiDeviceTemplate //OK

Rule:

Use PascalCasing for naming your PROGRAM, CLASS, METHOD, FUNCTION_BLOCK, FUNCTION, ENUM, STRUCT, VAR_GLOBAL and VAR_PUBLIC: First letter of every word in the name with a capital letter, the rest of the word in lower case. Do not use any separation characters like underscores _ or hyphens -

VAR_GLOBAL
    ActualSpeed     : REAL;         //OK
    Actual_Speed    : REAL;         //Not OK
    _actualSpeed    : REAL;         //Not OK
END_VAR
FUNCTION    CalcRotorSpeed          //OK
CLASS       binarySignal            //Not OK

Rule:

Use _camelCasing with a leading underscore _ for private variables in the sections VAR PRIVATE, VAR PROTECTED and VAR: Do not use any separation characters like hyphens - and do not use underscores _ inside the name.

Variables inside the VAR section in methods and functions behave like VAR_TEMP. In those sections, the rule for VAR_TEMP applies instead.

VAR
    _actualSpeed     : REAL;         //OK
    _actual_Speed    : REAL;         //Not OK
    actualSpeed      : REAL;         //Not OK
END_VAR

Rule: Use camelCasing for your IO variables and temporary variables in the sections VAR_INPUT, VAR_OUTPUT, VAR_IN_OUT and VAR_TEMP: Do not use any separation characters like underscores _ or hyphens -

VAR_INPUT
    actualSpeed     : REAL;         //OK
    ActualSpeed     : REAL;         //Not OK
END_VAR

Rule:

Use SNAKE_CASING (All capital letters with underscores dividing words) in symbolic constants and for enumeration values.

VAR CONSTANT
    NUMBER_OF_DRIVES : INT := 5; //constant definition
END_VAR
TYPE
    ModeType : (
        BUSY,
        FREE,
        RUN
    ); //enumeration definition
END_TYPE

Recommendation:

The name of an identifier indicates its meaning and purpose. Avoid names like i or j. For identifiers consisting of several words, the sequence of the words should be selected like that in spoken language.

Recommendation:

Avoid using very long identifier names. 32 characters should not be exceeded.

Recommendation:

The name in the identifiers should be in English.

Recommendation:

The name of an array is always in the plural.

VAR
    AxesPos : Array[0..5] OF AxisPosition //OK
    AxisPos : Array[0..5] OF AxisPosition //Not OK
END_VAR

Recommendation:

Avoid a name for the identifier that is similar to keywords of ST.(e.g. 'Classes', 'FunctionBlock', 'Functions').

Recommendation:

Avoid a name for the identifier that is equal to a keyword of another widely used programming language. (e.g. C#: 'foreach', 'void').

Recommendation:

Use abbreviations only for common words. If you use an abbreviation, its meaning should never be ambiguous.

Here are some common abbreviations you should use:

Abbr. Type
Min Minimum
Max Maximum
Act Actual, current
Next Next
Prev Previous
Avg Average
Diff Difference
Pos Position
Ris Rising edge
Fal Falling edge
Sim Simulated
Sum Sum
Old Old value (e. g. edge detection)
Dir Direction
Err Error
Warn Warning
Cmd Command
No Number