Creating a TwinSAFE Simulation Project for ESTOP PL d Logic
This technical reference walks through the complete creation, mapping, debug, and verification of a TwinSAFE simulation project implementing an Emergency Stop function (variant 1) classified as Category 3 / PL d per TwinSAFE project design. The project uses the EL6910 TwinSAFE logic terminal, the EL1904 safe 4-channel digital input, and the EL2904 safe 4-channel digital output. The procedure runs entirely in the TwinCAT 3 development environment (TC3 Safety Editor) so that the safety logic can be exercised, fault-injected, and verified without wiring physical E-Stops.
1. Overview and Scope
TwinSAFE is Beckhoff's integrated safety technology that runs safety logic directly on dedicated EtherCAT terminals (EL6900/EL6910) and uses Fail Safe over EtherCAT (FSoE / Safety over EtherCAT protocol) to communicate with safe I/O. The simulation mode provided in the TC3 Safety Editor allows the safety program to be loaded into the engineering PC and executed against virtual I/O so that:
- Application logic can be developed and tested before hardware is on the bench.
- Function-block libraries (TwinSAFE Logic) such as
safeESTopcan be exercised with deterministic input sequences. - Diagnostic states, error acknowledgements, and Group RUN transitions can be validated.
- Variant 1 E-Stop behavior (PL d, Cat 3, dual-channel with cross-fault detection) can be proven out before commissioning on the machine.
2. Prerequisites
| Item | Requirement | Notes |
|---|---|---|
| TwinCAT 3 XAE | TC3.1 build 4024.56 or newer (TC3.1 build 4026 recommended) | Older build 401x is not compatible with EL6910 simulation |
| TF5800 TwinSAFE Logic | License installed in the TC3 license manager | Enables the Safety Editor, FSoE address editor, and Debug Safety Project toolbar |
| Safety target | EL6910 TwinSAFE PLC terminal (EtherCAT) | EL6900 will not run in simulation - see note above |
| Safe input | EL1904 - 4-channel safe digital input 24 V DC | Used for E-Stop loop 1, loop 2, and Reset pushbutton |
| Safe output | EL2904 - 4-channel safe digital output 24 V DC, 0.5 A | Drives the E-Stop output indicator / contactor |
| EtherCAT | Distributed Clock (DC) sync enabled on the bus segment | Required for FSoE timing |
| AMS Net ID | Local TwinCAT router address | Auto-populated, do not change unless multi-router |
3. Create the TwinCAT Project Skeleton
- Open Visual Studio with the TwinCAT 3 Shell installed and create a new TwinCAT XAE Project (Project with PLC).
- Once the project loads, locate the SAFETY node in the Solution Explorer. Right-click and choose Add → New Item.
- In the Add New Item dialog, three TwinSAFE project templates are offered:
- Empty TwinSAFE Project (no mappings)
- TwinSAFE Project with ErrAck mappings
- TwinSAFE Project with ErrAck mappings and Run mappings (recommended for E-Stop simulation)
- Select the third option (ErrAck + Run mappings) and assign a meaningful name, e.g.
ESTOP_PLd_Variant1.sal. Confirm with OK.
The template generates a safety project with two pre-wired alias groups: TwinSafeGroup1 and a default connection to the safety target. The pre-populated ErrAck and GroupPort_RunStop signals are essential for driving the TwinSAFE group from the editor.
4. Select the Safety Target System
Double-click the Target System node of the new safety project to open the configuration dialog.
- In the Target System dropdown, choose EL6910 TwinSAFE PLC (or the equivalent CX safety runtime).
- Click the External Device button to expose the simulation binding. The Safety Editor creates a virtual TwinSAFE target bound to the local AMS router.
- Verify the AMS Net ID matches the local TwinCAT router (default
127.0.0.1.1.1). Click OK to commit the selection.
5. Add the Safety I/O Alias Devices
Alias Devices are the safety editor's symbolic handles for safe I/O. They decouple the safety program from the physical slot position of the terminals in the EtherCAT tree.
- Right-click Alias Devices → Add → New Item.
- From the vendor list choose Beckhoff Automation, then select EL1904 (4-channel safe digital input, 24 V DC). Click Add.
- Repeat the process and add the EL2904 (4-channel safe digital output, 24 V DC, 0.5 A per channel).
- Set a unique FSoE address for each alias:
| Alias Device | FSoE Address | Function |
|---|---|---|
| EL1904 (inputs) | 1 | Estop1 = Ch1, Estop2 = Ch2, Reset = Ch3 |
| EL2904 (outputs) | 2 | EStopOut = Ch1 |
The FSoE address must be unique on the FSoE segment and must match the rotary switches (or automatic FSoE address assignment) configured on the physical terminals. In simulation mode the addresses are logical; they only need to be unique within the project.
6. Implement the safeESTop Function Block
- Open TwinSafeGroup1.sal in the Safety Editor.
- From the Toolbox (View → Toolbox if not visible), drag the
safeESTopfunction block into the network area. - Under the block's Assigned Variable Name properties, declare the following Boolean inputs and outputs:
| Pin | Variable Name | Source / Sink |
|---|---|---|
| Reset | Reset_In | EL1904 Ch3 (operator reset pushbutton) |
| Estop1 | Estop1_In | EL1904 Ch1 (E-Stop channel 1) |
| Estop2 | Estop2_In | EL1904 Ch2 (E-Stop channel 2) |
| EStopOut | EStopOut | EL2904 Ch1 (output to contactor / indicator) |
The safeESTop block implements variant 1 per EN 60204-1: dual-channel evaluation, cross-fault monitoring, and a manual reset with positive-guided output. Achieving PL d / Cat 3 requires that both channels agree and that the reset signal is a separate, deliberate operator action.
7. Variable Mapping to Physical I/O
- Open the Variable Mapping tab at the bottom of the Safety Editor.
- For each declared variable, click the three-dot selector and bind it to the corresponding safe I/O channel:
-
Reset_In→ EL1904 → Input Channel 3 -
Estop1_In→ EL1904 → Input Channel 1 -
Estop2_In→ EL1904 → Input Channel 2 -
EStopOut→ EL2904 → Output Channel 1
Save the project (Ctrl+S). The Safety Editor runs an automatic consistency check on every save; mapping errors are highlighted in the Error List.
8. Enable the Safety Toolbar and Start Debug
- Enable the dedicated safety toolbar: View → Toolbars → TwinCAT Safety. The toolbar exposes Debug Safety Project, Stop, Single Cycle, and online-value write controls.
- With the target set to EL6910 and a valid simulation binding, the Debug Safety Project button activates. Click it to build and load the project into the simulated TwinSAFE runtime.
- After successful load, click Run on the safety toolbar to start the safe logic task. The group state changes from Init to Run-Request.
9. Commissioning - Group RUN and Reset Sequence
Variant 1 E-Stops require the operator to acknowledge restart conditions, so a deliberate run-up sequence is mandatory. In simulation this is exercised through the online-value write controls.
- Open the Variable Mapping tab. Locate GroupPort_RunStop; double-click its Online Value and force it to
TRUE. - The TwinSafeGroup1 state transitions to RUN. Observe that the E-Stop block is still active (red) because no reset has occurred yet.
- Set the two E-Stop signals (
Estop1_In,Estop2_In) toTRUEvia the online-value editor. This represents the contactor / pushbutton returning to a safe state. - Double-click the Online Value of
Reset_Inand force it toTRUE. ThesafeESTopblock state indicator turns red and green, signalling that the block is armed and waiting for a falling edge of the reset signal. - Force
Reset_Inback toFALSE. The block releases the output - the E-Stop output (EStopOut) goes toTRUE, the simulation output channel 1 of the EL2904 latches high.
This sequence (Run-Request → Both channels TRUE → Reset rising → Reset falling) is the canonical variant 1 start-up. Any deviation (no reset, channels not both TRUE, simultaneous reset and channel change) must cause the block to remain in the safe state and raise a diagnostic bit.
10. Verification Checklist
Use this matrix to confirm the simulation behaves as designed. All tests are run in the Safety Editor's online mode; no live wiring is required.
| Test | Action | Expected Result |
|---|---|---|
| Normal start | Force GroupPort_RunStop=TRUE, EStops=TRUE, Reset rising then falling | EStopOut=TRUE, block state RUN, EL2904 Ch1 energized |
| E-Stop trip | Force Estop1=FALSE while running | EStopOut=FALSE immediately, block state SAFE, output de-energizes |
| Cross-fault | Force Estop1=TRUE, Estop2=FALSE simultaneously | Block latches SAFE, diagnostic error raised |
| Reset without channels true | Force Reset rising with Estop1=FALSE | Reset ignored, EStopOut stays FALSE |
| Loss of RUN | Force GroupPort_RunStop=FALSE | Group transitions to STOP, EStopOut=FALSE |
| Restore RUN | Force GroupPort_RunStop=TRUE again | Group re-enters RUN-Request; full start-up sequence required |
11. Troubleshooting Matrix
| Symptom | Likely Root Cause | Corrective Action |
|---|---|---|
| Debug Safety Project button greyed out | EL6900 still selected, or TF5800 license missing | Switch target to EL6910; verify TF5800 in TwinCAT license device |
| FSoE address conflict error on build | Two aliases share the same FSoE address | Re-number one of the alias devices (1, 2, ...) |
| safeESTop block never releases output | Reset signal held high permanently (no falling edge) | Pulse reset: TRUE then FALSE; verify mapping to a normally-open pushbutton |
| Block reports channel discrepancy | Estop1 and Estop2 wired to the same channel | Re-bind to channels 1 and 2 of the EL1904 |
| Group stays in Run-Request | GroupPort_RunStop not driven TRUE in mapping | Map GroupPort_RunStop to a PLC or directly drive from the online value editor |
| EL2904 output bit not visible in I/O view | Alias device was not added under the same group | Verify both alias devices are listed under TwinSafeGroup1 |
12. Frequently Asked Questions
Can I run TwinSAFE simulation on the EL6900?
No. The EL6900 does not support the TC3 Safety Editor's debug/simulation path; the Debug Safety Project button never becomes active. Use the EL6910 TwinSAFE PLC terminal, the EK1960 coupler, or a CX-series controller with an embedded TwinSAFE runtime.
Which TwinCAT 3 build supports EL6910 simulation?
TwinCAT 3.1 build 4024.56 or newer is required, with TF5800 TwinSAFE Logic licensed. Build 4026 is recommended for the most recent EL6910 firmware and TwinSAFE Logic library improvements.
What safety level does this project achieve?
The implementation described targets EN ISO 13849-1 Performance Level d, Category 3. It uses dual-channel E-Stop wiring into an EL1904, a manual reset, and a single safe output on the EL2904. Final PL must be confirmed by the machine builder's risk assessment and SISTEMA calculation.
Do I have to wire physical buttons to run the simulation?
No. The Safety Editor's online-value write controls let you force the mapped Boolean variables TRUE or FALSE. The EL1904 inputs and EL2904 outputs are virtual, so the entire sequence (RUN request, reset pulse, E-Stop press) is driven from the keyboard.
Why does my project fail to compile after I change the FSoE address?
Each safe device on the FSoE segment must have a unique address. If two aliases share the same FSoE number, the Safety Editor reports a duplicate-address error during build. Re-number the conflicting alias to a free value in the 1 to 65535 range and rebuild.