- Home
- Importing / Exporting Project Data
- Importing Safety-Related Data
Importing Safety-Related Data
PLCnext Engineer offers the option of importing safety-related data into the currently open project. Two different imports are available, both of which are initiated via the menu item 'File > Import Safety-Related Data...'. The procedure and the necessary requirements in the source and target projects differ depending on the type of import file you subsequently select in the 'Open' dialog.
Both imports are described in detail below:
Importing safety data using a script file (*.pcustx)
General information on the import
The import of safety-related data via the menu item 'File > Import > Import Safety-Related Data...' is only possible if the data to be imported has been exported from the source project as scripts. This special export can currently only be carried out by Phoenix Contact. The resulting script package (file format Compressed Batch File, *.pcustx) includes all safety-related POUs created in the source project, the parameters of all safety devices and the complete content of the Data List of the 'Safety PLC' node.
The purpose of this procedure is to be able to edit the safety-related part of a project externally and import it again without changing the project CRC. The PLCnext Engineer project is thus supplemented by the externally created safety application and remains valid and compilable.
The import command executes the scripts contained in the compressed batch file and so the data from the source project is transferred into the target project.
Creating the source project
The following must be ensured while editing the source project:
- Exchange variables (which are standard variables of the Safety PLC) must be created at the end of a variable group in the source project because new exchange variables are appended to the end of their respective group when they are imported into the target project.
- The topologies (instance hierarchies) of the source and target projects must be identical.
Preparing the target project
The following conditions must be met in the target project before executing the import command:- The target project is open.
- You have logged on to the safety-related area which means write access to the safety-related part of the project is possible.
- All libraries for a device import are included in the target project.
- The topologies (instance hierarchies) of the source and target projects are identical.
What happens during the import
The following data is created in the target project during import:- Parameters of all existing safety devices are updated.
- All existing safety-related POUs are deleted first. New safety POUs are then imported.The POUs are imported into the folder 'Programming > Local > Functions & Function Blocks' in the COMPONENTS area. The Main POU is inserted into the 'Programs' folder.
- In the Data List of the 'IEC 61131-3' node the new exchange variables are created including their variables groups.
- The Data List of the Safety PLC is updated and unused global safety variables are deleted.
How to proceed
- Open the project into which you want to import the project data.
- Logon to the Safety-related Area by entering the corresponding password.
- Select 'File > Import > Import Safety-Related Data...'.
- Read and confirm the message that you must verify and validate the imported data after the import.After the import is completed, the project is automatically compiled.
- Validate your safety application. Observe the following hazard message.
WARNING
|
Unintended machine operation
|
Importing safety data from SafetyProg/SafeProg (*.swt)
PLCnext Engineer offers the possibility of importing safety-related project data that was created with the safety-related programming system SafetyProg or SafeProg.
The import includes POUs and their FBD code worksheets, local variables and the descriptions of the POU. If there are several national languages in the POU description of the source project, the texts of all languages are imported into one description worksheet in the default language.
The import does not include the device topology.
Note
The project CRC of the classic project and the project CRC after the import do not match. |
Preconditions for the SafeProg/SafetyProg source project
- The source project (*.swt file) was created with SafetyProg/SafeProg version 3.70. Older project versions must have been opened and converted with version 3.70.
- The cross references have been created in SafetyProg/SafeProg before saving the project.
Preparing the PLCnext Engineer target project
The following conditions must be met in the target project before executing the import command:- The target project is open.
- You have logged on to the Safety-related Area which means write access to the safety-related part of the project is possible.
- If PLCopen FBs are used in the source project, you must include the "PLCopen_SF_V2_00.pcwlx" library. PLCopen V1.0 FBs are automatically converted to PLCopen V2.0 FBs during the import.
- For the procedure described below, it is assumed that the target PLCnext Engineer project already contains a Safety PLC.Reason: If a Safety PLC already exists in the target project, the global/external variables declared in the source project are created in the variables table of the individual POUs ('Usage' = 'External') and the related global variables are inserted in the Data List of the Safety PLC.
If no Safety PLC is present during import, only the Externals are created in the POU. In this case, you can add a Safety PLC later and rebuild the project to create the global variables.
How to proceed
- Open the project into which you want to import the data.
- Logon to the Safety-related Area by entering the corresponding password.
- Select 'File > Import > Import Safety-Related Data...'.
- Read and confirm the message that you must verify and validate the imported data after the import.The POUs are imported into the folder 'Programming > Local > Functions & Function Blocks' in the COMPONENTS area. The Main POU is inserted into the 'Programs' folder.After the import is completed, the project is automatically compiled.
-
Handling the imported Main program POUIf your target project already contained a program type named Main before the import (regardless of whether the program is standard or safety-related), the Main POU is imported from the swt project under the name Main1.If your target project already contained a Safety PLC before the import, a safety-related program POU with the name S_Main was automatically included. This program POU is then already instantiated in the 'Task and Events' editor of the 'Safety PLC' node.Proceed as follows:
- In the COMPONENTS, folder 'Programming > Local > Programs': Rename the imported Main program POU to S_Main.
If necessary, rename or delete the existing S_Main POU beforehand. Make sure that deleting the "old" Main program does not delete already developed safety code. For example, you can merge existing code with the imported program POU. - Make sure that the S_Main POU is instantiated in the 'Task and Events' editor of the 'Safety PLC' node.
- In the COMPONENTS, folder 'Programming > Local > Programs': Rename the imported Main program POU to S_Main.
-
Syntax errors due to imported extended identifiers?If you receive error messages regarding invalid variable or constant identifiers (e.g. LEX0001 + VAR0005) and other resulting syntax errors, proceed as follows:
- Click 'Extras > Options'.
- In the 'Options' dialog, open the 'Compiler | IEC Compiler Settings' category.
- Activate the checkbox 'Allow extended identifiers'.
- Compile the project with 'Project > Rebuild'.
-
Semantic errors and warnings due to missing assignment of variables?If the imported project contains global safety-related variables that were mapped to input or output process data items (PDIs) or to global variables of the standard PLC, these assignments could not be imported. Although the global variables were created in the Safety PLC Data List, they are now declared there as marker variables (indicated by Data List column 'I/Q/M' = 'M') and need to be mapped manually.The following cases and thus error/warning messages could result:
-
SSEM0016 "The variable name is read before written"
This error is issued if the affected imported global safety-related variable was mapped to an input PDI in the source project.Assign each output variable for which the error message SSEM0016 is issued to an input PDI. -
SSEM0019 "The variable name is written but not read"
This warning is issued if the affected imported global safety-related variable was mapped to an output PDI in the source project.Assign each output variable for which the warning message SSEM0019 is issued to an output PDI. -
SSEM0018 "The variable name is not used"
This warning is issued if the affected imported global variable was mapped to a variable of the standard PLC or/and to a PDI in the source project.Add the missing assignments to each output variable for which the warning message SSEM0018 is issued.
Procedure for error SSEM0016 and warning SSEM0019
- In the MESSAGES window, double-click on the error/warning message to jump to the respective code position. The affected variable is marked in the code.Example for SSEM0016:
- In the code worksheet, right-click the suspected variable and select 'Go to Definition' from the context menu. The global declaration of the variable in the Safety PLC 'Data List' is opened and marked.Example for SSEM0016:
- In the 'Data List' assign an input process data item using the Role Picker. Precondition is that the respective input or output device is already available in the PLANT.Example for SSEM0016, assignment to an input signal:
After mapping the variable to a PDI, the error is removed and the data direction in the 'Data List' column 'I/Q/M' is set from 'M' to 'I' or 'Q'.
- Repeat these steps for each corresponding message.
Procedure for warning SSEM0018
- In the MESSAGES window, double-click on the message to jump to the 'Data List' of the Safety PLC. The affected variable is marked.
- To verify where the variable is used in the code, right-click the suspected variable declaration in the 'Data List' and select 'Show all References' from the context menu. The CROSS REFERENCES window is opened.
Inspecting the code locations where a variable is used may help you to decide which assignment is required. For that purpose you can double-click a cross reference with 'Location' = 'Code' to jump into the code worksheet. - Go back to the 'Data List' assign the correct PLC variable or process data item using the Role Picker. Precondition is that the required PLC variable is already declared or the respective input device is already available in the PLANT.After mapping the variable to a PLC variable or PDI, the warning is removed and the data direction in the 'Data List' column 'I/Q/M' is set from 'M' to 'I' or 'Q'.
- Repeat these steps for each corresponding message.
WARNINGUnintended machine operation - Validate the assignments between variables and process data items (signals) and thoroughly test the application.
- Validate the overall safety-related function with regard to the variable/process data items assignments.
- Validate the physical wiring of your safety-related architecture.
- Prior to commissioning the safety application, make certain that suitable organizational measures (according to applicable sector standards) have been taken to avoid hazardous situations if the safety-related logic application operates in an unintended or incorrect way.
-
SSEM0016 "The variable name is read before written"
- Rebuild the project by selecting 'Project > Rebuild'.
-
Validation and Confirm VerificationAfter rebuilding, you will receive the safety violation message CDI0001 ('The worksheet name has no valid safety seal') for each code worksheet of each imported POU. This error is reported because the checksum is no longer valid after importing the worksheet.Proceed as follows:
- Double-click on each error message with the ID CDI0001 to open the affected code worksheet.
- Validate the imported safety-related data in the respective worksheet. WARNING
Unintended machine operation
Verify that the safety-related data have been imported correctly and without any modification or corruption. - Once you have ensured that the data has been imported correctly, right-click on the background of the code worksheet and select the 'Confirm Verification' command from the context menu.
The verified data is now sealed by calculating a checksum over it and the error message is removed.