Loading local progress…
Language reference
Practise in
Level 1, 0 XP · your progress
TIA Portal V20

Siemens SCL

Simulator-tested

Standard S7-1500 · optimised FB storage · local # tags in SCL.

Structure
Typed interface; assignments, IF / ELSIF / ELSE, signed INT/DINT CASE lists and REGION / END_REGION. CASE ranges are outside this subset.
Expressions
BOOL logic, numeric arithmetic, comparisons and parentheses. INT, DINT and REAL; Siemens TIME.
Stateful instructions
Specialised TON_TIME / TOF_TIME instances, INT IEC_COUNTER.CTU (PV/CV), R_TRIG and F_TRIG.
FOR loops & EXIT
FOR counter := start TO end BY step DO … END_FOR; uses an INT/DINT counter, inclusive bounds and an optional BY (default +1). Negative steps work. EXIT leaves the innermost loop. Keep the counter, end and BY operands unchanged inside the body; zero BY is rejected.
Arrays
Declare ARRAY[0..9] OF REAL in the block interface; read or write #Samples[#Index]. BOOL, INT, DINT and REAL elements, including negative lower bounds.
PLC data types and FBs
Named PLC data types (table or TYPE document) and reusable FBs with Input, Output, InOut, Static and Temp. Declare FB instances in Static and call #Instance(Input := …, Output => …).
Execution limits
One-dimensional arrays: up to 256 elements each and 1,024 expanded storage values per programme. Each element appears in Watch tags and replay. Out-of-range indexing stops the scan with the actual index and allowed bounds. Loops share the 20,000-operation scan budget, even with an empty body. These are academy limits.
Outside this subset
WHILE / REPEAT, multidimensional arrays, arrays of UDTs or instances, anonymous nested structures, whole-array copies, functions with return values, pointer addressing and native project files.
PLC data types and FBs

Group equipment data and reuse a tested control block

Simulator-tested
  • A UDT describes a group of related values. PumpStatus holds the running status and start total; it does not execute any logic.
  • PumpControl contains the reusable logic. DutyControl and StandbyControl are separate instances: they share the definition, but each retains its own Latch and WasRunning values.
  • Inputs are supplied at the call. Running is copied to the output after execution. Status is a structured InOut referencing that pump's status tag; writing Status.Starts updates the caller's data.
  • Every call runs in programme order. Skipping a call retains its instance/output values; an IF around a call is not a stop command. Supply the inhibit/Stop input and execute the block to turn the pump off.

Declare PumpStatus as a PLC data type and PumpControl as an FB. Declare DutyControl/StandbyControl in Static for multi-instance calls. SCL uses #local tags, Input/InOut := and Output =>. Temp data is cleared per call in this optimised teaching model.

PLC data type · TYPE document
TYPE
    PumpStatus : STRUCT
        Running : BOOL;
        Starts : DINT;
    END_STRUCT;
END_TYPE
FB PumpControl · interface
NameSectionData type
StartInputBOOL
StopInputBOOL
PermitInputBOOL
FaultInputBOOL
RunningOutputBOOL
StatusInOutPumpStatus
LatchStaticBOOL
WasRunningStaticBOOL
FB body (SCL)
#Latch := (#Start OR #Latch) AND NOT #Stop AND #Permit AND NOT #Fault;
IF #Latch AND NOT #WasRunning THEN
    #Status.Starts := #Status.Starts + 1;
END_IF;
#Status.Running := #Latch;
#Running := #Latch;
#WasRunning := #Latch;
Two instances called from the main routine
#DutyControl(Start := #Start, Stop := #Stop, Permit := #Permit, Fault := #Fault, Running => #PumpOn, Status := #DutyStatus);
#StandbyControl(Start := #StandbyStart, Stop := #Stop, Permit := #Permit, Fault := #StandbyFault, Running => #StandbyPump, Status := #StandbyStatus);

Try it in the workbench

Open any SCL mission and use the PLC data types and Function blocks tabs. Then declare the instances in Block interface.

  1. Inspect the UDT and block definition, then the two differently named instances.
  2. While paused, override Start TRUE in the Inputs tab and step several scans: PumpOn stays on and DutyStatus.Starts increases once.
  3. Release Start. The latch keeps the duty pump running. Start the standby; its start count is independent.
  4. Switch Fault ON: the duty pump stops immediately while standby keeps running. Press Stop during Run, or override Stop TRUE in the Inputs tab while paused: both stop.
  5. Replay a recorded scan and compare the caller's status tags with the block-local state and executed block lines.

The simulation contract

  • Fixed 20 ms virtual task. Playback speed and 3D frame rate do not change results.
  • Each test scenario begins from a fresh controller and plant state.
  • Edits stop execution. Results and replay belong to the tested program revision.
  • REAL uses 32-bit precision. Unsupported integer overflow produces a diagnostic.
  • Pulse and retentive timers (TP/TONR), down counters (CTD/CTUD) and other counter widths are not implemented here.
  • Valid NORM_X/SCALE_X calculations are supported in FBD. Invalid ranges stop with a diagnostic; native ENO/error results are not reproduced.
  • Charts use one active path and Boolean N/S/R actions. Native timed actions, parallel paths and last-scan/reset options are outside this model.
  • Integer division drops the fractional part: 7 / 2 is 3. Decimal comparisons use the operand’s precision; a REAL value of 0.1 compares equal to 0.1. Use a REAL operand for fractional division.
  • SCL accepts typed REAL constants such as REAL#2.0. Ambiguous floating calculations use S7-1500 double precision before assignment to a REAL tag.
  • Power-cycle retention, real I/O, network timing and vendor firmware are outside the model.

Read the original documentation

This academy teaches a bounded subset. Native verification requires compiling and testing in the named vendor software.

Interview marking runs in this browser. The current in-person flow is a local prototype, not a secure remote assessment service. Export files are beta and need import and behaviour checks in TIA Portal V20 or Studio 5000 v38.

Basic behaviour has been reviewed against official Logix manuals and the S7-1200 manual and S7-1200/1500 guideline. The Siemens documents predate V20. This review does not replace testing on the target controller, especially for chart timing and reusable blocks.

Siemens TIA Portal V20Studio 5000 v38Logix function block manualLogix SFC manual