Accessibility of Structured Types - Manual - Software Loader - The AX SIMATIC SW-Loader. - Software Loader (sld),tool

Software Loader CLI Tool (sld)

Portfolio
SIMATIC AX
Product
Software Loader
Software version
3.2.2
Edition
04/2025
Language
English (original)
Package Name
@ax/sld

The accessibility can be defined for elementary variables (see example before) and for structured types like STRUCT, CLASS, FUNCTION_BLOCK and PROGRAM.

CONFIGURATION config
    VAR_GLOBAL
        {S7.extern=ReadWrite}
        Motor1 : Motor;        // the variables in Motor1 be read and written if enabled

        {S7.extern=ReadOnly}
        Motor2 : Motor;        // the variables in Motor2 be only read if enabled
    END_VAR
END_CONFIGURATION

CLASS Motor
    VAR PUBLIC
        {S7.extern=ReadWrite}
        Run               : BOOL;
        ReverseDirection  : BOOL;
    END_VAR
    VAR INTERNAL
        {S7.extern=ReadOnly}
        ActualVelocity    : LReal;
    END_VAR
    // ...
END_CLASS

Notes:

  1. To access variables inside structured types you must enable them at two locations!

    • inside the CONFIGURATION (with exception of PROGRAM)
    • inside a STRUCT, CLASS, FUNCTION_BLOCK or PROGRAM
  2. The final accessibility is the most restrictive over all definitions

    • ReverseDirection will never be accessible (Hidden is default)
    • ActualVelocity will always be read only
    • Motor2.Run will be read-only whereas Motor1.Run can be written


Each structure level is adding its restriction if you nest multiple structured types like

CONFIGURATION config
    VAR_GLOBAL
        {S7.extern=ReadWrite}
        s1 : struct1;
        {S7.extern=ReadWrite}
        s4 : struct4;
    END_VAR
END_CONFIGURATION

TYPE 
    struct1 : STRUCT  {S7.extern=ReadWrite}  s2 : struct2;   END_STRUCT;
    struct2 : STRUCT  {S7.extern=ReadOnly}   s3 : struct3;   END_STRUCT;
    struct3 : STRUCT  {S7.extern=ReadWrite}  s4 : struct4;   END_STRUCT;
    struct4 : STRUCT  {S7.extern=ReadWrite}  s5 : INT;       END_STRUCT;
END_TYPE

In this case the variable s5 will be read-only if accessed via s1.s2.s3.s4.s5 and can be written in case of s4.s5.