Explainer
Why a safety program should copy standard data once
Short answer
In an F-program every read of a standard variable gets its own compiler encoding, even a repeat read of the same one, so the safety guideline says to copy each standard value once into a fail-safe data area and read the copy afterwards. Variables that can change mid-cycle are acquired there too, by the PreSafety method.

On this page
Every access a safety program makes to a standard variable is encoded by the compiler as a separate operation, even a second read of the same variable in the same cycle. That is the finding of chapter 4.1.4 of version 1.5 of the Programming Guideline Safety for SIMATIC S7-1200/1500, and the recommendation beside it is concrete: copy the standard data once, at the top of the safety user program, into a fail-safe data area, and let the rest of the F-program, the fail-safe part of the user program, read the copy. The decision that follows is short. A variable read once per cycle stays as it is. A variable read several times per cycle is copied once. A variable that can change while the F-runtime group runs is acquired once at the top by the PreSafety method, which lands in the same place as the copy.
What version 1.5 documents #
Chapter 4.1.4 states the mechanism plainly: at every access from the safety program to a standard variable the compiler generates a separate encoding, and that holds even when the program accesses the same standard variable several times. Reading the same symbolic name three times in the logic is not one acquisition reused three times; it is three full safe-access mechanisms in the generated code. On that basis the guideline recommends copying the standard data once, at the beginning of the safety user program, into a fail-safe data area and working from the copied variables afterwards, so the encoding cost stops scaling with every repeated read.
The saved runtime has a destination: the safety program's cycle time and the standard user program's processing time share the same CPU, so time kept out of the F-runtime group is time the standard program gets back. None of this changes which standard tags the safety program may see at all; that selection happens when the tags are mapped, and mapping standard PLC tags into a safety program covers that step.
Counting the accesses before changing anything #
Work from cross-references, not from memory of the source. For each standard variable the F-program touches, list every consumer, including called blocks, and mark whether each access sits in a mutually exclusive branch, one execution path per invocation, or on a path that executes in every invocation. Only accesses that execute in the same invocation load the cycle together; a count inflated by branches that never run together flatters the saving. Record the group's execution time from the engineering environment first, so the before-and-after comparison comes from the running machine rather than from an estimate.
A worked count for one F-runtime group #
The numbers here are an illustrative example, not a measurement. Suppose one F-runtime group consumes four standard variables and the cross-references show, per invocation, the first read three times, the second twice, the third four times and the fourth once; every one of those is a separate encoding, so the group performs 3 + 2 + 4 + 1 = 10 standard-data accesses per cycle.
Copy all four once at the top and the standard-data count drops to 4, one access per variable in the copy block, while the ten downstream reads hit fail-safe copies: a reduction of 6 accesses per cycle, or 60%. Per variable the saving is the executed access count minus one, so (3 - 1) + (2 - 1) + (4 - 1) + (1 - 1) = 2 + 1 + 3 + 0 = 6.
The fourth variable marks the edge of the rule. One direct read before the change, one encoding for its copy after it: nothing saved, nothing lost. Copy variables that are read more than once per invocation and leave single-read variables on their direct access. How much cycle time the removed accesses return depends on the CPU, so compare the group's execution time before and after on the complete path, copy block included, under the machine states the safety logic actually sees.
When the value can change during the cycle #
Separate reads of a standard variable that changes while the F-runtime group executes can observe two different values, and that is a consistency problem independent of any performance saving. Version 1.2 of the guideline addresses it in chapter 3.7.2: for variables that can change during the runtime of an F-runtime group, it recommends the PreSafety method, acquiring the value once before safety processing so every consumer in that invocation works from one acquisition.
The copy block at the top is exactly that acquisition point, so the performance fix and the consistency fix belong in the same place. Two placement rules follow. Put the copy of changeable values at the very top, ahead of any safety logic that consumes them; a copy placed mid-cycle leaves earlier consumers reading stale or mixed data. And when a mode value must agree with the payload it describes, acquire them together, because copying the mode at the top and the payload halfway through the cycle is the wrong interface even when both are copied.
Keeping the exchange in one F-UDT #
Version 1.2, chapter 3.7, recommends F-compliant PLC data types, F-UDTs, for the standard-to-safety exchange, because a change to the interface then arrives as a visible change to one structure that goes through the safety program's compile and review, instead of hiding among loose standard references. Chapter 3.1.4 of the same version allows those F-UDTs to be nested, so a mode word and the values it governs can sit in one structure and be copied and reviewed as one unit.
Chapter 3.7.5 covers a different case again: for series machines, and under the documented conditions, non-safe inputs may be read in the standard program instead of the safety program, which keeps the safety logic independent of hardware variation across the series. That is a modularity measure for series production, not permission to move a required safety input onto an ordinary terminal. One safety note holds across every pattern in this piece: passing data through this interface never raises the integrity of its source, and a value the safety function genuinely depends on still has to arrive on validated fail-safe acquisition.
The decision for each case #
- Read once per invocation, stable during the cycle: leave the direct access; a copy saves nothing and only relocates the read.
- Read more than once per invocation, stable during the cycle: copy once at the top of the F-program into the fail-safe data area and read the copy everywhere else; the saving is the executed access count minus one, per variable, per cycle.
- Able to change while the F-runtime group runs: acquire once at the top with the PreSafety method and let that invocation's consumers use only the copied values.
- Values that must agree with each other: declare them as one nested F-UDT so the interface is reviewed as a single structure.
- Non-safe inputs on a series machine: confirm the chapter 3.7.5 conditions first, then read those inputs in the standard program to keep the safety logic hardware-independent.
Whichever pattern carries the data in, the safety logic still has to prove what it does with it; that proof lives in the cause-and-effect structure, and what a cause and effect matrix in a safety PLC must prove sets out what it has to show.
Questions asked
Can I use breakpoints to watch the copy while the safety program runs?
No. Siemens documents that breakpoints in the standard user program put an F-CPU into STOP, so the machine stops the moment one is set. Measure with the engineering environment's runtime monitoring instead, compare the complete cycle path including the copy block, and record the baseline under the machine states the safety logic actually sees.
How deep can nested F-UDTs go?
For a tag of a nested F-compliant PLC data type declared in a global F-DB, the documented maximum nesting depth is 7. Treat that as the structural ceiling when grouping mode and payload values into one interface; a structure the safety reviewer can read at a glance is worth more than depth for its own sake.
Can the event class of the F-OB in an existing F-runtime group be changed?
No. The documented procedure is to delete the F-runtime group and create a new one, which makes the event class a creation-time decision. Plan for that when deciding where the copy block lives: moving the acquisition into a different event class is a rebuild of the group, not a parameter edit.
Does the copy-once rule apply to F-CPUs on S7-300 and S7-400?
The guideline cited here covers SIMATIC S7-1200/1500 only. On S7-300/400 the safety documentation configures the F-runtime group differently: it has you enter a different or new I-DB for the main safety block and change the maximum cycle time of the group directly, so the chapter numbers in this piece are not transferable across those families.
Which guideline versions carry these recommendations?
The copy-once recommendation is chapter 4.1.4 of version 1.5, dated July 2023. Version 1.2, dated October 2021, supplied the pieces around it: nested F-UDTs in chapter 3.1.4, the F-UDT recommendation for the exchange in chapter 3.7, the PreSafety method in chapter 3.7.2 and the series-machine case in chapter 3.7.5. These are guideline versions, not TIA Portal releases or CPU firmware versions.


