15.5 Testing the user program
15.5.7 Testing with watch tables
The watch tables contain tags whose values can be monitored and controlled during runtime. The tags can be combined in any manner so that a specially tai- lored watch table can be created for each test case. You can call the test functions in the shortcut menu or using the icons in the toolbar of the working window shown in Fig. 15.15 on page 624.
Tags from data blocks (global, instance and type data blocks) can be used in watch tables as well as tags from the areas: peripheral inputs/outputs, inputs, outputs, and bit memories. The current time and count values are displayed with the SIMATIC timer functions (data type TIMER) and the SIMATIC counter functions (data type COUNTER).
In the case of a CPU 400, you can simultaneously monitor and control up to 70 tags.
Creating a watch table
Underneath a PLC station in the project tree there is the Watch and force tables fold- er with the watch tables. Further subfolders can be created within this folder in or- der to structure the watch tables: Select the Watch and force tables folder and then the Add group command from the shortcut menu. You can assign separate names to the new subfolders and the watch tables by using the Rename command from the shortcut menu.
Fig. 15.13 Example of monitoring of data tags
In order to create a new watch table, double-click on the Add new watch table com- mand. In the empty table, enter the names of the tags line by line and the display format from a drop-down list. You can enter a short explanatory text for each tag in the comment column.
The tags entered with names must previously have been defined in the PLC tag table or in a data block. You can also enter the memory location (absolute address) in the Address column.
Fig. 15.14 shows monitoring in expanded mode. In the Monitor with trigger column, the possible settings are “opened”.
Monitoring and modifying with triggers
The watch tables permit specification of the monitoring and control time. The fol- lowing can be selected:
b Permanent
In each program cycle the inputs are monitored and controlled at the start of the cycle prior to processing of the main program and the outputs at the end of the cycle following processing of the main program.
b Permanently, at start of scan cycle
In each program cycle, the tags are monitored and controlled prior to processing of the main program (meaningful for inputs or tags which control functions).
b Once only, at start of scan cycle
The tags are monitored and controlled once prior to processing of the main pro- gram (meaningful for inputs or tags which control functions).
b Permanently, at end of scan cycle
In each program cycle, the tags are monitored and controlled following process- Fig. 15.14 Example of monitoring of tags in expanded mode
ing of the main program (meaningful for outputs or tags which are controlled by functions).
b Once only, at end of scan cycle
The tags are monitored and controlled once following processing of the main program (meaningful for outputs or tags which are controlled by functions).
b Permanently, at transition to STOP
The tags are monitored and controlled permanently at the transition to the STOP state.
b Once only, at transition to STOP
The tags are monitored and controlled once at the transition to the STOP state.
It is additionally possible to control tags using the Online > Modify > Modify now command in the main menu or the Modify > Modify now command in the shortcut menu. The selected tags are then updated as rapidly as possible. Tags can even be controlled using the listed commands if the CPU is in the STOP state.
Monitoring of tags with watch table
You can call the test functions of a watch table in the shortcut menu or using the icons in the toolbar of the working window shown in Fig. 15.15.
Double-click to open the watch table and select Monitor all or Monitor now. An online connection to the CPU will be established.
In basic mode, the Name, Address, Display format, Monitor value, and Comment col- umns are displayed. The Monitor value column shows the tag value in the display format which has been set in the Display format column. If Monitor now was select- ed, Monitor value shows a snapshot; if Monitor all was selected, the values in the Monitor value column are updated continuously.
The time of monitoring corresponds to the trigger mode Permanent (see
“Monitoring and modifying with triggers” on page 623). You can stop the current monitoring by clicking again on the Monitor all icon.
Please note that peripheral outputs can never be monitored.
The icons from left to right:
Name in text Tooltip text Basic mode
Expanded mode Modify now Modify with trigger Enable PQ Monitor all Monitor now
Show/hide all modify columns Show/hide advanced setting columns Modify all selected values once and now
All active values will be modified by “modify with trigger”
The function “Enable peripheral outputs” disables the output disables (OD) Monitor all
Monitor all values once and now Fig. 15.15 Icons in the toolbar of the watch table
Monitor with trigger
In expanded mode, you can select the trigger time at which the tag values are read from the CPU. If you switch on the Expanded mode function, the Monitor with trigger column is displayed. You can then define the read time for each tag from a drop- down list.
Tag values which are read out once only or which are not read out (yet) are shown in the Monitor value column with a gray background; permanently read values have an orange background.
Controlling of tags with watch tables
Double-click to open the watch table and switch the Expanded mode function on. In addition to the Name, Address, Display format, Monitor value, and Comment col- umns, the Modify value and Tag selection (represented by a lightning icon) columns are now displayed.
In the Modify value column, enter the value to which the tag is to be set; in the Tag selection column, activate the checkbox if the associated tag is to be modified.
A yellow triangle with exclamation mark indicates that the selected tag has not yet been modified.
It is recommendable to switch on permanent monitoring prior to the modification.
An online connection to the CPU is then already established and the success of the modification can be monitored.
Caution! Make sure that no dangerous states can occur when modifying tags!
To modify the activated tags, click on Modify now. The tags activated in the Tag se- lection column are immediately set (as fast as possible) to the control value. If a tag is immediately overwritten after the modification by a value from the program – for example if a switched-on input has been controlled to “0” and the process image up- dating overwrites the control value again – the yellow triangle appears again in the Tag selection column.
In Fig. 15.16, the tags “Belt motor_1”, “Quantity_parts”, “Monitoring” (the time value of the SIMATIC timer function) and “Belt_1”.Quantity have been selected for modifi- cation.
Alternatively, modification can be triggered by means of the Online > Modify > Mod- ify now command from the main menu or the Modify > Modify now command from the shortcut menu. The Modify > Modify to 0 and Modify > Modify to 1 commands from the shortcut menu immediately control the tag selected in the watch table.
Please note that peripheral inputs can never be modified.
Only the tags visible in the table are modified. Multiple modification (multiple input) of a tag in the watch table is not permissible.
Caution! Reloading of modified data blocks with an ongoing control job can result in unforeseen operating states. The control job continues to modify the specified address,
while the address assignment in the data block may possibly have changed. Exit ongo- ing control jobs prior to the loading of data blocks.
Modify with trigger
In expanded mode, you can select the trigger time at which the tag values are mod- ified in the CPU. If you switch on the Expanded mode function, the Monitor with trig- ger and Modify with trigger columns are displayed. You can then define the control time for each tag from a drop-down list.
If you click Modify with trigger, all activated tags are updated (following confirma- tion) with the control value in accordance with the trigger conditions. Clicking on the icon again exits permanent control.
Alternatively, modification can be triggered or exited by means of the Online >
Modify > Modify with trigger command from the main menu or the Modify > Modify with trigger command from the shortcut menu.
Modify now
You can use the Modify now function to assign values once to tags independent of the monitoring and control modes. This job is executed as rapidly as possible. With the CPU at STOP, this command can be used to assign default values to tags.
Enter the modify values in the watch table and activate the checkbox after the mod- ify value in the column in which the tag to be controlled is present. A yellow triangle indicates that this tag has been selected for modification but has not yet been controlled.
To carry out the modification, select the Online > Modify > Modify now command in the main menu or shortcut menu.
Fig. 15.16 Example of controlling tags