Application Level
The application level can be found in the SAL file (Safety Application language) within the safety project. Within this file, the safety application logic can be implemented in a graphical editor (if chosen in the safety project wizard).
Safety Editor View
Double-clicking the SAL file opens the new TwinCAT 3 Safety Editor. The initial view is shown in the following Figure.
In the toolbox on the right of the diagram view (the position is freely configurable by the user), the available pre-certified function blocks can be found (in this example view for the EL6900). The function blocks can be added to the application by simply dragging a function block to the diagram view and thereby creating a new instance. Each function blocks has inports, outports and parameter ports (if available). Two function blocks can be connecting by dragging a line from one port to another port. The connection can only be established if it is a valid connection. Connecting an inport with another inport for example is not allowed. The Toolbox item "Network" allows the adding of additional networks. The toolbox category "Comments" allows adding custom comment boxes and even connect those comments to function diagram elements.
The Safety Editor also contains a toolwindow called "Variable Mapping" (on the bottom of the Figure above). This toolwindow allows the connection of ports with alias device channels.
Adding and configuring a function block
A function block is added to the diagram with drag and drop from the toolbox (in this example a safeAND function block).
In order to connect the function block to the environment (alias devices) an inport is selected (AndIn1). The necessary properties can now be configured in the properties toolwindow of TwinCAT 3 (if not shown, right-click the inport and select "Properties" or pressing F4 when the port is selected.
The Channel Interface in this view allows the activation of the inport. The property "Single-Channel 1" holds the information whether it is a make or break contact. In order to connect a in- or outport to an alias device, the corresponding port is assigned a variable name. The property "Assigned Variable Name" allows assignment of a variable name to the port (when assigning a variable name, the port is activated automatically). As soon as an assigned variable name is entered and confirmed, a new entry is generated within the Variable Mapping tool window showing all information available for the variable.
With the button "..." in the column "Alias Port", the variable can be connected to an alias device channel. Within the dialog which allows selection of an alias device port, multiple items can be chosen by first pressing the Ctrl.-button on the keyboard and then selecting the desired channels.
If a port should be connected to a standard alias device, the Data Type column within the Variable Mapping tool window has to be changed to a standard data type (for example bool instead of safeBool). As safe data types are a subcategory of standard data types, the user has to choose a standard data type in order to connect a variable to both standard and safety alias devices at the same time.
Configuring TwinSAFE Group in- and outputs
The properties of the TwinSAFE Group (for example the Error Acknowledgement input which has to be connected in order to run an application) can be accessed in the properties of the application diagram itself (selecting the free space beneath the lowest network) or in the properties of any network within the application (selecting the free space between function blocks or directly selecting the network). If the properties are not shown, a right-click on the corresponding item and selecting "Properties" brings up the corresponding view.
The in- and outports of the TwinSAFE Group can be connected to alias devices by selecting the corresponding property entry and pressing the "..." button on the right of the text field.