The following list provides essential facts on the user interface of Machine Expert - Safety and the characteristics of safety-related code and variables.
For further information and details, refer to the EcoStruxure Machine Expert - Safety - User Guide.
POUs are organized in the
Window.A safety-related project contains exactly one POU of the IEC 61131-3 type Program named Main. This POU cannot be deleted or renamed and no further user-defined IEC 61131-3 programs can be added (only FBs).
The safety-related task in which this program is executed is also predefined but not visible in Machine Expert - Safety. You cannot edit this task configuration.
You can create user-defined safety-related function blocks (according to IEC 61131-3) but no functions.
You can insert libraries which provide safety-related functions and function blocks.
Each POU is composed of one or several code worksheets and a variable table with local variable declarations. Double-click a tree icon to open the corresponding worksheet for editing.
Global variable declarations are contained in a separate variable grid. Click the
icon on the main toolbar to open this table.The
provides functions and function blocks. After you have added a POU library (via the context menu of the folder in the project tree), the contained blocks can be selected in a separate .Safety-related and standard code is strictly distinguished in Machine Expert - Safety. Therefore, also safety-related and standard variables, or more precise, safety-related and standard data types, are distinguished. It is, for example, not possible to connect a variable with a standard data type to a formal parameter which expects a safety-related variable.
Safety-related variables are displayed with a red background in the code. Variables of standard data types are shown without background.
Safety-related system FUs/FBs as well as safety-related library FBs are displayed in red. Standard blocks are shown gray-blue. User FUs/FBs are displayed in green.
When mixing safety-related and standard variables, Machine Expert - Safety performs a data flow analysis in the FBD/LD code and highlights the leading safety-related signal paths of a network by displaying them as thick red lines. A safety-related path always ends either at a safety-related output variable or, in case of a standard output variable, at the last object input located before this output. If a standard signal path ends at a safety-related output, this output is shown with a background hatched in red.
The following simple program considers the TM5 I/O modules configured in the example project. The procedures to develop this example are described in the following sections.
Refer to the chapter FBD/LD Code Development in the EcoStruxure Machine Expert User Guide for a comprehensive description of the editor functions.
The input signal SafeDigitalInput01 of the TM5SDI4DFS module is read and mapped via the AND_S function to the output signal SafeDigitalOutput01 of the TM5SDO4TFS module. Due to the AND_S function, the SafeModuleOK diagnostic signals of the safety-related I/O modules are evaluated. A failure detected in any module switches the SafeDigitalOutput01 signal off (SAFEFALSE).
In addition, the SafeDigitalOutput01 is written to the Boolean exchange variable SLC2LMC_Bool0_7_0 which belongs to the SLC2LMC exchange data configured in the SLC device configuration in Logic Builder. This way, the standard application can read the status of the output. (The SafeDigitalOutputxx signal is available for digital output modules. It signals the standard application whether the safety-related output is set by the safety application). The direct connection of the safety-related variable to the standard exchange variable SLC2LMC_Bool0_7_0 is possible because type conversions from safety-related to standard data types are allowed.
The timer function block TON_S delays the ReleaseOutput01 signal. This release signal deactivates an active restart inhibit and enables the output channel of the SafeDigitalOutput01 signal of the TM5SDO4TFS module. The delay time is set to 50 ms.
Execute the following steps for the AND_S function and the TON_S function block:
Step |
Action |
---|---|
1 |
Open the program worksheet by double-clicking its icon in the . |
2 |
In the selection area, select the desired block.If the block is not visible, you must first select the . |
3 |
Drag the block from the selection area into the code worksheet, left-click to insert the block outline, and drop it with another left mouse click at the desired position. |
4 |
In case of a function block (TON_S in the example), an instance variable must be declared. Result: The dialog appears proposing an instance name which you can modify, if desired. |
5 |
In the dialog, click .Result: The function block instance is inserted into the code and the related instance variable is inserted into the local declarations of the POU. You can open the declaration worksheet by clicking the icon in the main toolbar. |
6 |
In the example, the AND_S function needs four inputs. To adapt the function, right-click the block icon and select from the context menu. Select in the list and click twice to add two further inputs. Close the dialog with . |
The following procedure applies to the device signals that are provided under the device nodes in the SLC as well as diagnostic and control signals of the safety-related I/O modules.
window. This includes exchange variables defined for theProcedure in Machine Expert - Safety:
Step |
Action |
---|---|
1 |
Open the code worksheet where you want to insert the signal. |
2 |
In the window, open the devices tree on the left and expand the node of the desired module (SL1.SMx). |
3 |
Drag the desired signal into the code worksheet. Result: When releasing the mouse button, the dialog appears. |
4 |
In the dialog, accept the proposed name, select an existing global variable, or declare a new global variable. Refer to the figure for the variable names used in the example. |
5 |
Confirm the dialog by clicking and drop the variable at the desired position with a left click.Result: The variable is inserted into the code and its variable declaration is automatically inserted into the global variable worksheet. You can directly drop the variable on a block output or input to connect it on insertion. |
For the example, insert the following signals in the described way:
SafeDigitalInput01 of the TM5SDI4DFS module connected to an AND_S input.
SafeModuleOK of each I/O module connected to an AND_S input.
SafeDigitalOutput01 of the TM5SDO4TFS module connected to the AND_S output.
Insert the variable a second time and drop it at a free position without any connection.
ReleaseOutput01 of the TM5SDO4TFS module connected to the TON_S output.
SLC2LMC_Bool0_7_0 exchange variable of the SLC connected to the input (blue connection point) of the unconnected SafeDigitalOutput01 variable. This way, the output variable is written to the Boolean exchange variable.
The following procedure describes how to insert literals into the code. Literals have to be used to enter constant values in the code. They can be used without specifying a declaration.
Step |
Action |
---|---|
1 |
You can insert unconnected or connected/assigned constants:
Result: The dialog appears. |
2 |
Specify = . |
3 |
A data type is proposed in the combo box. Adapt this setting, if required. |
4 |
Enter the desired literal (constant) in the field.Observe the rules below this table. |
5 |
Press .Result: The constant is inserted into the FBD/LD code. |
Refer to the chapter Constants (Literals): Inserting and Declaring in the EcoStruxure Machine Expert User Guide for further details on constants and the special case “Global Constants”.
Rules for constants:
Literals must always be entered including the data type (for example, SAFEINT#1000).
Exceptions: TRUE and FALSE are always handled as BOOL and SAFETRUE/SAFEFALSE are always handled as SAFEBOOL. It is, for example, not necessary to enter BOOL#TRUE.
Standard INT constants can be entered without data type (for example, 1000 means INT#1000) as decimal inputs are automatically interpreted as INT.
Exception: 0 and 1 if used with Boolean data type.
Refer to the chapter Constants vs. Literals in the EcoStruxure Machine Expert User Guide for further information on literals according to the IEC 61131-3 standard.
The following procedure describes how to insert new variables into the code. The declaration is automatically inserted into the respective declaration worksheet.
Step |
Action |
---|---|
1 |
You can insert unconnected or connected/assigned variables:
Result: The dialog appears. |
2 |
Select the of the variable.Result: For local variables, the declaration is inserted into the declaration worksheet of the current POU (to be opened using the icon). A global declaration is inserted into the global declaration worksheet which you can open by clicking the icon. |
3 |
Specify the data type of the new variable, enter a variable , and define the remaining properties. |
4 |
Press .Result: The variable is inserted into the FBD/LD code and the declaration into the corresponding declaration worksheet. |
There are more possibilities for declaring variables. Refer to the chapter Variables: Inserting and Declaring in the EcoStruxure Machine Expert User Guide for details.
To draw lines between objects and block formal parameters, you must activate the connection mode by clicking the
icon on the editor toolbar.Clicking the
icon on the editor toolbar switches the editor to mark mode in which you can select and move objects.The safety-related project must not contain unused safety-related TM5/TM7 modules. Unused means that none of the signals, which are listed under the device node in the Machine Expert - Safety window, is used in the safety-related project. At least one signal of each module must be assigned to a global safety-related variable in Machine Expert - Safety. Otherwise, the compiler reports errors.
The same applies to the SLC exchange signals you have defined in Logic Builder (see section Exchange Data Configuration for the Safety PLC).
The following steps apply to each type of signal provided in the Machine Expert - Safety window:
Step |
Action |
---|---|
1 |
In Machine Expert - Safety, open the global variables worksheet by clicking the icon on the toolbar. |
2 |
Right-click into the grid and select from the context menu.Result: A new variable with a default name (which you can modify) is created. |
3 |
In the window, open the device tree on the left. Expand the tree node of the device of which a device terminal is to be used. |
4 |
Drag the device signal to be connected into the global variables worksheet and drop it on the desired declaration. Result:
|
To insert a declared variable into the code, use the Variables: Inserting and Declaring of the EcoStruxure Machine Expert - Safety - User Guide for details.
dialog which you open via the icon on the editor toolbar. Refer to the chapterAfter you have finished the development of the safety-related project, you must compile it. (If a POU is marked with an asterisk (*) in the project tree, it has not yet been compiled after editing variables or code. After the successful compilation, the asterisk is removed.)
Procedure in Machine Expert - Safety:
Step |
Action |
---|---|
1 |
Press or click the icon on the toolbar. |
2 |
Correct any errors that the compiler has detected and reported in the message window. Double-click an error message to jump to the suspected error position. |
3 |
After having compiled the project without any errors, proceed with the download of the project to the SLC. Refer to chapter Downloading the safety-related application. |