Objects
Now we shall explain how to work with objects and what help is available to keep track of a project (Folders, Call tree, Cross reference list,..).
Objects
POUs, data types, and the ressources (global variables, the sampling trace, the PLC configuration, the task configuration, and the Watch and Recipe Manager) are all defined as "objects". The folders inserted for structuring the project are partially involved. All objects of a project are in the Object Organizer.
If you hold the mouse pointer for a short time on a POU in the Object Organizer, then the type of the POU (Program, Function or Function block) is shown in a Tooltip.For the global variables the tooltip shows the keyword (VAR_GLOBAL, VAR_CONFIG).
With drag & drop you can shift objects (and also folders, see 'Folder') within an object type. For this, select the object and shift it to the desired spot by holding down the left mouse button. If the shift results in a name collision, the newly introduced element will be uniquely identified by an appended, serial number (e.g. “Object_1”).
Folder
In order to keep track of larger projects you should group your POUs, data types and global variables systematically in folders.
You can set up as many levels of folders as you want. If a plus sign is in front of a closed folder symbol, then this folder contains objects and/or additional folders. With a click on the plus sign the folder is opened and the subordinated objects appear. With a click on the minus (which has replaced the plus sign) the folder can be closed again.
In the context menu you find the commands "Expand nodes" and "Collapse nodes" with the same functions.
With Drag&Drop you can move the objects as well as the folders within their object type. For this select the object and drag it with pressed left mouse button to the desired position.
Folders have no influence on the program, but rather serve only to structure your project clearly.
Example of folders in the Object Organizer
'New Folder'
With this command a new folder is inserted as a structural object. If a folder has been selected, then the new one is created underneath it. Otherwise it is created on the same level. If an action is selected, the new folder will be inserted at the level of the POU to which the action belongs.The context menu of the Object Organizer which contains this command appears when an object or the object type has been selected and you have pressed the right mouse button or <Shift>+<F10>.
The newly inserted folder initially has the designation 'New Folder'. Observe the following naming convention for folders:
- Folders at the same level in the hierarchy must have distinct names. Folders on different levels can have the same name.
- A folder can not have the same name as an object located on the same level.
If there is already a folder with the name “New Folder” on the same level, each additional one with this name automatically receives an appended, serial number (e.g. “New Folder 1”). Renaming to a name that is already in use is not possible.
'Expand nodes' 'Collapse nodes'
With the command Expand the objects are visibly unfolded which are located in the selected object. With Collapse the subordinated objects are no longer shown. With folders you can open or close them with a double mouse click or by pressing <Enter>.The context menu of the Object Organizer which contains this command appears when an object or the object type has been selected and you have pressed the right mouse button or <Shift>+<F10>.
'Project' 'Object Delete' Shortcut: <Del>
With this command the currently selected object (a POU, a data type or global variables), or a folder with the subordinated objects is removed from the Object Organizer and is thus deleted from the project. For safety you are asked once more for confirmation. If the editor window of the object was open, then it is automatically closed. If you delete with the command "Edit" "Cut", then the object is parked on the clipboard.
'Project' 'Object Insert' Shortcut: <Ins>
With this command you create a new object. The type of the object (POU, data type or global variables) depends upon the selected register card in the Object Organizer. Enter the name of the new object in the dialog box which appears. Remember that the name of the object may not have already been used.
Take note of the following restrictions:
- The name of a POU can not include any spaces
- A POU can not have the same name as another POU, or a data type.
- A data type can not receive the same name as another data type or a POU.
- A global variable list can not have the same name as another global variable list.
- An action can not have the same name as another action in the same POU.
- A visualization can not have the same name as another visualization.
In all other cases, identical naming is allowed. Thus for example actions belonging to different POUs can have the same name, and a visualization may have the same as a POU. In the case of a POU, the POU type (program, function or function block) and the language in which it is programmed must also be selected. 'Program' is the default value of Type of the POU, while that of Language of the POU is that of most recently created POU. If a POU of the function type is created, the desired data type must be entered in the Return Type text input field. Here all elementary and defined data types (arrays, structures, enumerations, aliases) are allowed. Input assistance (e.g. via <F2>) can be used.
After pressing OK, which is only possible if there is no conflict with the naming conventions described above, the new object is set up in the Object Organizer and the appropriate input window appears.
If the command 'Edit' 'Insert' is used, the object currently in the clipboard is inserted and no dialog appears. If the name of the inserted object conflicts with the naming conventions (see above), it is made unique by the addition of a serial number appended with a leading underline character (e.g. “Rightturnsig_1”).
If the project is under source control in an ENI data base, it may be (depends on the settings in the Project options dialog for 'Project source control') that you will be automatically asked in which data base category you want to handle the new object. In this case the dialog Properties will open where you can assign the object to one of the data base object categories.
'Project' 'Object Rename' Shortcut: <Spacebar>
With this command you give a new name to the currently-selected object or folder. Remember that the name of the object may not have already been used. If the editing window of the object is open, then its title is changed automatically when the name is changed.
Dialog box for renaming a POU
'Project' 'Object Convert'
This command can only be used with POUs. You can convert POUs from the languages ST, FBD, LD, and IL into one of the three languages IL, FBD, and LD. For this the project must be compiled. Choose the language into which you want to convert and give the POU a new name. Remember that the name of the POU may not have already been used. Then press OK, and the new POU is added to your POU list.
The type of processing that occurs during conversion corresponds to that which applies to compilation.
Dialog box for converting a POU
'Project' 'Object Copy'
With this command a selected object is copied and saved under a new name. Enter the name of the new object in the resulting dialog box. Remember that the name of the object may not have already been used.
If, on the other hand, you used the command "Edit" "Copy", then the object is parked on the clipboard, and no dialog box appears.
Dialog box for copying a POU
'Project' 'Object Open' Shortcut: <Enter>
With the command you load a selected object within the Object Organizer into the respective editor. If a window with this object is already open, then it gets a focus, is moved into the foreground and can now be edited. There are two other ways of opening an object:
- Doubleclick with the mouse on the desired object or
- type in the Object Organizer the first letter of the object name. Then a dialog box opens in which all objects of the available object types with this initial letter are shown. Select the desired object and click on the button Open in order to load the object in its edit window. Thereby the object is marked in the Object Organizer and all hierarchical in the object path above the object lying folders and objects were expanded. This option is supported with the object type Ressources only for global variables.
This last possibility is especially useful in projects with many objects.
Dialog box for choosing the object to be opened
'Project' 'Object Access rights'
With this command you open the dialog box for assigning access rights to the different user groups. The following dialog box appears:
Dialog box for assigning access rights
Members of the user group 0 can now assign individual access rights for each user group. There are three possible settings:
- No Access: the object may not be opened by a member of the user group.
- Read Access: the object can be opened for reading by a member of the user group but not changed.
- Full Access: the object may be opened and changed by a member of the user group.
The settings refer either to the currently-selected object in the Object Organizer or, if the option Apply to all is chosen, to all POUs, data types and ressources of the project. The assignment to a user group takes place when opening the project through a password request if a password was assigned to the user group 0.
'Project' 'Object properties '
This command will open the dialog 'Properties' for that object which is currently marked in the Object organizer. On the tab Access rights you find the same dialog as you get when executing the command 'Project' 'Object Access Rights'. It depends on the object and the project settings, whether there are additional tabs available where you can define object properties:
- If a global variable list is currently selected in the Object Organizer, then a tab 'Global variable list' will be available where the parameters concerning the actualization of the list and concerning the data exchange of network variables are defined. The entries can be modified here. This dialog also will be opened if you create a new global variable list by selecting one of the entries in section 'Global Variables' in the Object Organizer and executing the command 'Add Object'.
- If the project is connected to an data base then a tab 'Database-connection' will be available. Here you can display and modify the current assignment of the object to one of the data base categories resp. to the category 'Local'.
'Project' 'Data base link'
This menu item is only available if you have activated the option 'Use source control (ENI)' in the project options dialog for category 'Project source control. A submenu is attached where you find the following commands for handling the object resp. the project in the currently connected ENI data base:
- Login (The user logs in to the ENI Server)
If an object is marked in the Object Organizer and the command Data Base Link is executed (from the context menu, right mouse button), then the following commands will be available for executing the corresponding data base actions:
- Define
- Get Latest Version
- Check Out
- Check In
- Undo Check Out
- Show differences
- Show Version History
If the command 'Data Base Link' in the 'Project' menu is activated, then additional menu items will be available, which concern all objects of the project:
- Multiple Define
- Get All Latest Versions
- Multiple Check Out
- Multiple Check In
- Multiple Undo Check Out
- Project Version History
- Label Version
- Add Shared Objects
- Refresh Status
See in the following the description of the commands.
Grey shaded icon:
Object is kept in the data base
Green check in front of the object name:
Object is checked out in the local project.
Red cross in front of the object name:
Object is currently checked out by another user.
<R> behind object name:
The object can only be read, but not edited.
Some objects (Task configuration, Sampling Trace, PLC Configuration, Target Settings, Watch- and Recipe Manager) are per default assigned with a <R> as long as they are not checked out. This means that you will not automatically be asked whether the object should be checked out, as soon as you start to edit the object; it not necessarily means that you cannot edit the object. If there is actually no write access then the command 'Check out' will not be available. |
'Project' 'Data base command' 'Define'
Use this command of the menu 'Project' 'Data Base Link' to define whether the object, which is currently marked in the Object organizer, should be kept in the data base or just locally in the project. A dialog will open, where you can choose one of the two data base categories 'Project' or 'Shared objects', or the category 'Local'.
The icons of all objects which are managed in the data base will be displayed grey-shaded in the Object organizer.
'Project' 'Data base command' 'Get latest version'
Use this command of the menu 'Project' 'Data Base Link' to copy the current version of the object, which is marked in the Object organizer, from the data base to your project. This will overwrite the local version. In contrast to the 'Check Out' action the object will not be locked for other users in the data base.
'Project' 'Data base command' 'Check Out'
Use this command of the menu 'Project' 'Data Base Link' to check out the object, which is marked in the Object organizer, from the data base and by that to lock it for other users.
When executing the command the user will get a dialog 'Check out object'. A comment can be added there which will be stored in the version history of the object in the data base.
After the dialog has been closed with OK the checked-out object will be marked with a green check in the object organizer of the local project. For other users it will be appear marked with a red cross and will not be editable by them.
'Project' 'Data base command' 'Check In'
Use this command of the menu 'Project' 'Data Base Link' to check in the object, which is marked in the Object organizer, to the data base. Thereby a new version of the object will be created in the data base. The old versions will be kept anyway.
When executing the command the user will get a dialog 'Check in object'. There a comment can be added which will be stored in the version history of the object in the data base.
After the dialog has been closed with OK the green check in front of the object name in the Object organizer will be removed.
'Project' 'Data base command' 'Undo Check Out'
Use this command of the menu 'Project' 'Data Base Link' to cancel the Checking out of the object which is currently marked in the Object organizer. Thereby also the modifications of the object which have been made locally, will be canceled. No dialog will appear. The unchanged last version of the object will be kept in the data base and it will be accessible again for other users. The red cross in front of the object name in the Object organizer will disappear.
'Project' 'Data base command' 'Show Differences'
Use this command of the menu 'Project' 'Data Base Link' to display the object, which is currently opened by the user, in a window which is divided up in two parts. The differences of the versions will be marked like described for the project comparison.
'Project' 'Data base command' 'Show Version History'
Use this command of the menu 'Project' 'Data Base Link' to open a dialog 'Version history of <object name> for the object which is currently marked in the Object Organizer. There all versions of the object are listed which have been checked in to the data base or which have been labeled there:
Version: Data base specific numbering of the versions of the object which have been checked in one after the other. Labeled versions get no version number but are marked by a label-icon.
User: Name of the user, who has executed the check-in or labeling action
Date: Date and time stamp of the action
Action: Type of the action which has been executed. Possible types: 'created' (the object has been checked in to the data base for the first time), 'checked in' (all check-in's of the object excluding the first one) and 'labeled with <label>' (a label has been assigned to this version of the object )
The buttons:
Close: The dialog will be closed.
Display: The version which is currently marked in the table will be opened in a window. The title bar shows: "ENI: <name of the project in the data base>/<object name>
Details: The dialog 'Details of Version History' will open:
File (name of the project and the object in the data base), Version (see above), Date (see above), User (see above),
Comment (Comment which has been inserted when the object has been checked in resp. has been labeled). Use the buttons Next resp. Previous to jump to the details window of the next or previous entry in the table in dialog 'Version history of ..'.
Get latest version: The version which is marked in the table will be loaded in TwinCAT PLC Control and there will overwrite the local version.
Differences: If in the table only one version of an object is marked, then this command will cause a comparison of this version with the latest (actual) data base version. If two versions are marked, then those will be compared. The differences are displayed in a bipartited window like it is done at the project comparison.
Reset version: The version which is marked in the table will be set as latest version. All versions which have been checked in later will be deleted ! This can be useful to restore an earlier status of an object.
Labels only: If this option is activated, then only those versions of the object will be displayed in the table, which are marked by a label.
Selection box below the option 'Labels only': Here you find the names of all users which have executed any data base actions for objects of the current project. Select 'All' or one of the names if you want to get the version history concerning all users or just for a certain one.
'Project' 'Data base command' 'Multiple Define'
Use this command of the menu 'Project' 'Data Base Link' to assign several objects at a single blow to a certain data base category. The dialog 'Properties' will open like described for command 'Define'. Choose the desired category and close the dialog with OK. After that the dialog 'ENI-Selection' will open, listing all POUs of the project which are considered for the chosen category (Example: if you choose category 'shared objects' then the selection window will only offer the POUs of the Ressources tab). The POUs are presented in a tree structure complying to that of the Object Organizer. Select the desired POUs and confirm with OK.
'Project' 'Data base command' 'Get All Latest Versions'
Use this command of the menu 'Project' 'Data Base Link' to call the latest version of each object of the currently opened project, which is kept under source control, from the data base. Consider the following:
- If in the meantime additional objects have been stored to the data base project folder, then those will now be added to the local project in PLC Control.
- If objects have been deleted in the data base in the meantime, those will not be deleted in the local project, but they will automatically get assigned to category 'Local'.
- The latest version of objects of category 'Shared Objects' will only be called, if these objects are already available in the local project. For further information see command 'Get latest version'.
'Project' 'Data base command' 'Multiple Check Out'
Use this command of the menu 'Project' 'Data Base Link' to check out several objects at a single blow. For this the dialog 'ENI-Selection' will open, listing all POUs of the project. Select those which should be checked out and confirm with OK. For further information see command 'Check Out'.
'Project' 'Data base command' 'Multiple Check In'
Use this command of the menu 'Project' 'Data Base Link' to check in several objects at a single blow. For this the dialog 'ENI-Selection' will open, listing all POUs of the project. Select those which should be checked in and confirm with OK. For further information see command 'Check In'.
'Project' 'Data base command' 'Project Version History'
Use this command of the menu 'Project' 'Data Base Link' to view the version history for the currently opened project. But this will only work, if the chosen data base system supports that functionality. The dialog 'History of <data base project name>' will open. It shows the actions (create, check in, label) which have been performed for the particular objects of the project in a chronological order. The total number of objects is displayed behind Version history. The dialog can be handled like described for command 'Show Version History', but regard the following:
- The command 'Reset Version' is only available for single objects.
- The command 'Get latest version' will call all objects of the version of the currently marked entry to the local project ! That means, that the objects in TwinCAT PLC Control will be overwritten with the older version. But: Local objects, which were not yet part of the project in that older version, will not be removed from the local project !
'Project' 'Data base command' Procect Label Version'
Use this command of the menu 'Project' 'Data Base Link' to put a "label" on the actual version of each object of a project, so that exactly this project version can be recalled later. A dialog 'Label <data base project name>' will open. Insert a Label name and optionally a Comment. When you confirm with OK, the dialog will close and the label and the action "labeled with <label name>" will appear in the table of the version history, as well in the history for a single object as in the history of the project. A labeled version of the project does not get a version number, but is just marked with a label icon in the column 'Version'. If the option 'Labels only' is activated in the Version History dialog, then only labeled versions will be listed.
'Project' 'Data base command' 'Add Shared Objects'
Use this command of the menu 'Project' 'Data Base Link' if you explicitely want to add new objects of data base category 'Shared Objects' to the locally opened project. For objects of category 'Project Objects' this is not necessary, because the command 'Get (all) latest version(s)' automatically calls all objects which are found in the data base project folder, even if there are some which not yet available in the local project. But for objects of category 'Shared Objects' in this case just those objects will be called which are already available in the local project.
So execute the command 'Add Shared Objects' to open the dialog 'Browse ENI'. A list in the right part of the window shows all objects which are available in the data base folder which is currently selected in the list on the left side. Choose the desired object and press OK or do a doubleclick on the entry to insert the object to the currently opened project.
'Project' 'Data base command' 'Refresh Status'
Use this command of the menu 'Project' 'Data Base Link' to update the display in the Object Organizer, so that you can see the actual status of the objects concerning the source control of the project.
'Project' 'Data base command' 'Login'
Use this command of the menu 'Project' 'Data Base Link' to open the dialog 'Login' where you can enter the access data for the ENI data base via the ENI Server. The access data also have to be defined in the ENI Server (ENI Admin, User Management) and - depending on the currently used data base - also in the user management of the data base. After the command has been executed, first the Login dialog for category 'Project objects' will open.
The following items are displayed:
Data base: project objects
Host: address of the computer where the ENI Server is running (must match with the entry in field 'TCP/IP address' in the project options dialog for 'Project source control').
Project: Name of the data base project (must match with the entry in field 'Project name' in the project options dialog for 'Project source control'/category 'Project Objects').
Credentials: Insert User name and Password.
Press OK to confirm the settings. The dialog will be closed and automatically the Login dialog for 'Shared objects' will open
Enter the access data in the same way as described for the 'Project objects' and confirm with OK.
'Project' 'Add action '
This command is used to generate an action allocated to a selected block in the Object Organizer. One selects the name of the action in the dialog which appears and also the language in which the action should be implemented.
The new action is placed under your block in the Object Organiser. A plus sign appears in front of the block. A simple mouse click on the plus sign causes the action objects to appear and a minus sign appears in front of the block. Renewed clicking on the minus sign causes the actions to disappear and the plus sign appears again. This can also be achieved over the context menu commands ‘Expand Node’ and ‘Collapse Node’.
With a double click at the action or pressing <Return>, an action will be loaded in your editor.
'Project' 'Open Instance'
With this command it is possible to open and display the instance of the function block which is selected in the Object Organizer. In the same manner, a double click on the function block in the Object Organizer gives access to a selection dialog in which the instances of the function block as well as the implementation are listed. Select here the desired instance or the implementation and confirm using OK. The desired item is then displayed in a window.
If you want to view instances, you first have to log in ! (The project has been compiled with no errors and downloaded to the PLC with ‘Online’ ’Login’). |
Dialog box for opening an instance
'Project' 'Show call tree'
With this command you open a window which shows the call tree of the object chosen in the Object Organizer. For this the project must be compiled (see "Rebuild all"). The call tree contains both calls for POUs and references to data types.
Example of a call tree
'Project' 'Show cross reference list'
With this command you open a dialog box which makes possible the output of all application points for a variable, address, or a POU. For this the project must be compiled (see "Rebuild all"). Choose first the category Variable, Address, or POU and then enter the name of the desired element. To obtain all elements of the entered category enter a “*” in Name.
By clicking on the button Get References you get the list of all application points. Along with the POU and the line or network number, the variable name and the address binding, if any, are specified. The Domain space shows whether this is a local or a global variable; the Access column shows whether the variable is to be accessed for ‚reading’ or ‚writing’ at the current location.
When you select a line of the cross reference list and press the button Go To or doubleclick on the line, then the POU is shown in its editor at the corresponding point. In this way you can jump to all application points without a time-consuming search.
In order to make processing easier, you can use the Send to message window button to bring the current cross reference list into the message window and from there change to the respective POU.
Dialog box and example of a cross reference list