QUESTION:
Why can't I output a string with an uneven number of bytes on the OP 17 with ProTool V5?
ANSWER:
It has never been possible with OP 17 line devices to implement an uneven number of bytes with string variables. In the case of strings access is always word by word (system property).
Programming the "Set_Bit" function by pressing a button on Windows-based devices
QUESTION: How do I realize the "Set_Bit" function by pressing a button on
Windows-based devices?
ANSWER:
If you want to set or reset a bit in the controller defined via an
Operator Panel, then you must not use the function "
Set_Reset_Bit". This function must be performed using the
individual functions "Set_Bit" and "Reset_Bit" in conjunction with
the triggering event. This means that first the "Set_Bit" function
has to be linked to the "Press_button" event and secondly the
"Reset_Bit" function to the "Release_button" event.
Search terms: Programming notes
When editing the second OP language, variables are shifted in the other language.
QUESTION: The OP program is created in the 1st OP
language. Now, once I entered error messages, operating messages
and images (images only for OP 3,5,7,15,17 + TD17) in the 2nd
OP language, I noticed that the variable fields in the first language
are no longer in the same place as they were originally entered.
ANSWER: If, in a multiple language configuration,
a variable field in one language is moved via Drag&Drop
or Cut+Paste, this move is also made in the other languages.
In the editing language the moved variable field is inserted exactly
to the position selected with the cursor. In all the other languages
the variable field is simply inserted directly after the previous
variable field (or even in the first position) depending on the
order of the variable fields. Use the Drag&Drop and
Cut+Paste functions only if you have to change the
order of the variable fields. Afterwards, you have to redefine
the position of the moved variable field in all the other languages.
To re-position you must move the texts or re-enter them. You must
not move the variable field any more.
QUESTION:
Why, when changing the control protocol in a ProTool configuration,
do I get errors in the symbology?
ANSWER:
After changing the controller protocol, when you reconnect the tags
with the "Restore symbols" function in ProTool V6.0, you get
the message that the tags have separated from the symbols.
If the configuration is now saved and opened again, the tags can be
connected again with no error message.
Note: Please refer here too to Entry ID 2147482 if you are working
with a version of ProTool previous to V6.0.
Operating the S5 timer via Operator Panel in the controller
QUESTION: How can I operate a S5-Timer in a S7 controller from a
Windows-based operating system?
ANSWER: You have two options to operate a S5-Timer:
by means of a float entry field and the corresponding script.
An example can be found in entry ID 947095.
by means of a ProTool variable of type Timer.
In order to operate a S5-Timer from an OP, it is necessary to
define the S5-Timer in a data block. To do so, please
proceed as follows:
Define the corresponding data block
on the CPU
In the variable container, create a
variable of the type "Timer". As address, specify the data
block address of the CPU on which the S5-Timer is defined.
With the input field you can now operate
this variable and therefore the S5-Timer on the CPU. The time that
you predetermine has to be entered in milliseconds. The value
entered will be rounded up to the next 10 milliseconds. The time
value assigned to the variables in the data block of the CPU is
automatically determined by the OP.
Note: When entering a time value of 2 seconds with highest accuracy,
it is not sufficient to enter a "2" since an entry of "2.00" is
expected. If the operator only enters "2" and confirms with
"Enter", the OP will interpret this value as 2002 "Hex" - which
will lead to inaccurate time statements.
Remedy:
FUNCTION "fc3SysS5TimeOptimize" : VOID
TITLE =Optimize time values
VERSION : 0.1
VAR_IN_OUT
Time value : S5TIME ;
END_VAR
VAR_TEMP
Basis : BYTE ;
END_VAR
BEGIN
NETWORK
TITLE =Read in time value
L 0;
L #Time value;
==I ;
BEB ;
SLW 4;
SRW 12;
L 0;
<>I ;
BEB ;
L #Time value;
SRW 12;
T #Basis;
L 0;
<=I ;
BEB ;
NETWORK
TITLE =Convert time
L #Basis;
+ -1;
T #Basis;
L #Time value;
SLW 8;
SRW 4;
L #Basis;
SLW 12;
OW ;
T #Time value;
END_FUNCTION
Note:
In the case of RMOS devices you must specify the default time in
seconds.
Keywords: Configuration notes
Replace CPU in the HW Config of STEP7 and retain variable link in ProTool
QUESTION:
How should I proceed to replace a CPU and still retain the
variable link?
ANSWER:
You have integrated ProTool in STEP 7 and would like to replace a
CPU in the HW Config. In this case it is not possible to make a
direct replacement of the CPU via the HW Config. Please proceed as
follows to replace your CPU:
Note: If you are working with ProTool V6.0, please refer here too to
Entry ID 12018480.
Requirements:
The OP is integrated in the SIMATIC Manager and connected to
the CPU.
The ProTool project must be closed.
Procedure:
Delete the CPU in the HW Config
In response to the question "Do you also want to delete the program assigned to the module:
<<Project_name \ Station_name \ CPU_name >>?"
you select "No".
Insert the new CPU into the slot that has become free.
Link the CPU with the available networks (MPI and/or
PROFIBUS).
Use the MPI/PROFIBUS address of your old CPU configuration and
acknowledge the prompt "This address is not recommended. Do you want to change this
address?"
with "No".
Check the consistency of the configuration, save the project
and close the HW Config.
Copy the system data from the block container of the SIMATIC
station.
Under the SIMATIC station there is a directory "S7 Program(x)"
with a block container. Paste the copied system data into this
block container and acknowledge overwriting with "Yes".
Switch to the directory of the SIMATIC station and delete the
"S7 Program (x)" directory.
Cut out the remaining program container and paste it in the
place of the deleted program container.
Open ProTool and double-click "Controllers".
In the dialog box select the new CPU under "Parameters" in the
"Communication partners / Symbol list" window.
QUESTION: What should I set in STEP 7 to have the individual data words
of the instance data blocks displayed?
ANSWER: Please make the following settings in the symbol list of STEP 7
so that you can select the individual data words of the instance
data blocks in the symbol list in ProTool:
Symbol
Address
Data type
Comment
Not displayed->
DB 1
DB 1
DB1
Displayed ->
DB 1
DB 1
FB 3
Table 1: Symbol list
Under Data type you enter the FB associated with the instance
DB.
Note: Please refer here too to Entry ID 213347 - "Symbol table in
ProTool (DB with UDT)".
New data type "StringChar" from ProTool V6.0 SP2 on
QUESTION:
From ProTool V6.0 SP2 on, the new data type "StringChar" is
available for the protocol SIMATIC S7. Which importance does this
data type "StringChar" have and how is it used?
ANSWER:
The data type "String" can be used in line/graphics devices (RMOS)
and in Windows based systems to display strings on the panel.
However, there are significant differences in the display of string
variables betwenn line/grapics devices and Windows based systems
together with SIMATIC S7.
Line/graphics devices In line/graphics devices (RMOS), there is no definition of
lengths.
fig. 1: String variable in RMOS devices
Windows-based systems An S7 string does have a length definition. In Windows based
systems, this is taken into account (complies with IEEE norm).
fig. 2: String variable in Windows-based systems
Conversion of projects up to ProTool V6 SP1a
When converting or copying a project for a graphics device into
a project for a Windows based system, the string variable is
converted into an IEEE string variable (S7 string). While doing
this, the displacement of the character positions shown in fig. 3
is done.
To decrease the configuring effort when converting from graphics
devices to Windows based systems, with ProTool V6.0 SP2, the new
data type "StringChar" has been implemented. With this, the
following behaviour appears:
Line/graphics devices The new data type "StringChar" replaces the present data type
"String". The construction of the data type remains.
Windows based systems The new data type "StringChar" exists additionally to the
present data type "string".
The new data type "StringChar" corresponds to the old string format
of the line and graphics devices. Existing variables of data type
"String" remain and keep corresponding to the S7 string
format.
When converting or copying a project for a graphics device into
a project for a Windows based system, the data type "String"
("StringChar" from V6.0 SP2 on) of the graphics configuration (e.
g. TP27) is changed into the data type "StringChar" in the Windows
based configuration (e. g. TP270).
QUESTION:
When are the ProTool functions executed which are configured on a
variable?
ANSWER:
These functions are executed when the variable from the control is
displayed and the configured event occurs.
The variable is displayed as soon as an image is active on the
panel or the PC, in which the variable was used. Otherwise, the
variable on the panel will not be refreshed and therefore the
variable configured for this function is not executed.
If the variable is to be refreshed constantly - that is,
the function is to be executed also when the corresponding image is
not active - the variable "Read Continuously" can be
activated in the options for the variable. That way, the variable
is continuously displayed.
QUESTION:
Why don't I access the same array elements with ProTool as with STEP7? I am using the same indices.
ANSWER:
A two-dimensional array (e.g. ARRAY[0..9,0..3] of the BOOL type) is stored by STEP7 in the S7 memory as follows: Element [0,0] is stored at 0.0
Element [0,1] is stored at 0.1
Element [0,2] is stored at 0.2
Element [0,3] is stored at 0.3
Element [1,0] is stored at 1.0
Element [1,1] is stored at 1.1
STEP7 configures the memory for an array at BYTE limits. ProTool before version V5.10 presumes a continuous arrangement. Therefore, with the same indexing (e.g. [1,3]) in the SPS program (address 1.3), you read a different value than in ProTool (address 0.7). This behavior has been corrected in ProTool version V5.10. Until then, you can prevent this behavior by always creating arrays in STEP7 with full bytes (e.g. ARRAY[0..9,0..7] of the BOOL type).
QUESTION: What do I have to set in order to have the individual data
words of a data block with assigned UDT displayed?
ANSWER:
Please make the following settings in the symbol list of STEP 7 so
that you can have the individual data words of a data block with
assigned UDT displayed in the symbol list in ProTool:
Symbol
Address
Data type
Comment
Not displayed ->
DB 1
DB 1
DB 1
Displayed ->
DB 1
DB 1
UDT 1
Table 1: Symbol list
Under Data type you enter the UDT assigned to the data
block.
Note: Please refer here too to Entry ID 213338 - "Symbol table in
ProTool (instance DB)".
Instructions: In the case of tag multiplexing the tags are changed depending on the value of an index tag.
Purpose of tag multiplexing: With tag multiplexing you can access multiple tags via one index tag. For example, for visualizing similar machines you configure just one picture; this saves memory on the PLC and reduces the configuration time. Switching between the various views can be done, for example, via a selection list (text list) to which you link the index tag.
Sample application:
Using tag multiplexing you can configure the following scenario: The operator selects one of several machines from a selection list (text list). Depending on the operator's selection, a process value of the machine is displayed in an input or output field.
No.
Procedure
1
Creating tags
In ProTool you create an integrated project (e.g. TP270 10").
In the project tree you click on "Tags" and create the "Multiplex" tag of the data type "INT".
Then you create the following tags for Motor 1:
Tag
Data type
Address
Set_rotation_speed_1
INT
DB10.DBW0
Actual_rotation_speed_1
INT
DB10.DBW2
Current_1
INT
DB10.DBW4
Temperature_1
INT
DB10.DBW6
Motor_on_1
BOOL
DB10.DBX 8.0
Fault_1
BOOL
DB10.DBX 8.1
Create two more data records as in Fig. 01 with the indices 2 and 3 for data blocks DB20 and DB30.
Fig. 01
2
Creating multiplex tags
In the project tree you click on "Multiplex Tags".
Create the following multiplex tags and add the relevant tags (see also Fig. 01):
Multiplex Tag
Type
Index Tag
MUX_Set_rotation_speed
INT
Multiplex
MUX_Actual_rotation_speed
INT
MUX_Current
INT
MUX_Temperature
INT
MUX_Motor_on
INT
MUX_Fault
INT
Fig. 02
3
Creating the text list
Right-click the symbol list and select "Text/Graphic List insert...".
Assign the name "Motors" to the symbol list and enter the following texts for the parameters (values):
Value
Text
0
Motor 1
1
Motor 2
2
Motor 3
Fig. 03
4
Creating a picture and adding text fields
Create a new picture and define it as Start picture.
Add six text fields with the following designations:
- "Drive"
- "Set rotation speed"
- "Actual rotation speed"
- "Temperature"
- "Current"
- "Fault"
Fig. 04
5
Adding IO fields
Add one input and four output fields.
Link the "MUX_Set_rotation_speed" multiplex tag to the input field.
Link the four output fields to the following multiplex tags:
- "MUX_Actual_rotation_speed"
- "MUX_Temperature"
- "MUX_Current"
- "MUX_Fault"
Add a combobox to the picture and link it with the multiplex tag "Multiplex" and the "Motors" symbol list.
Fig. 05
6
Adding button and rectangle
Create a rectangle across all the inserted objects and put it in the background. For this you right-click and select "Align > To The Back".
Then you add a status button of the switch type. For the button "Pressed" state you enter the designation "ON" and for the button "Released" state you enter the designation "OFF".
Link the button in addition to the "MUX_Motor_on" tag.
Add four text fields for the unit designations "rpm", "°C" and "A".
Fig. 06
7
Configuring the controller
In STEP 7 you configure a controller (e.g. CPU315 2-DP) and link the panel to the controller.
Create a data block "DB10" with the following parameters:
Name
Data type
Address
Set_Rotation_speed
INT
+0.0
Actual_Rotation_speed
INT
+2.0
Current
INT
+4.0
Temperature
INT
+6.0
Motor_on
Boolean
+8.0
Fault
Boolean
+8.1
Make two copies of the data block and change their names to "DB20" and "DB30".
Fig. 07
8
Start Runtime
Load the project into the controller or in S7-PLCSIM and set the CPU to RUN.
Transfer the project (ProTool) to the panel or start Runtime on your configuration PC.
Select "Motor_1" and enter a value for the set rotation speed.
Then select "Motor_2" in the selection field.
Fig. 08
Function The operator selects a drive via the text list. An appropriate value is read in via the index in the text list. Depending on this value, the relevant tag is opened and the tag data displayed.
Download: The sample project includes the example described above. The operator panel used was a TP270 10".
Runnability and test environment: The following table lists the components that have been used to create this entry and verify the functions described.
Components
Product and version designation
PC operating system
Microsoft Windows XP SP2
Standard tools
-
Engineering tool
-
HMI software
ProTool V6.0 SP3 HF 3
HMI system
-
Keywords:
Tag multiplexing, Address multiplexing, Indirect addressing
Instructions: With address multiplexing you can change the address area separately via a multiplex tag.
Purpose of address multiplexing Address multiplexing permits you to use one tag (a multiplex tag) to call multiple memory locations in the controller's address area. You can have read and write access to the multiple memory locations without having to define a tag for each individual address. This is a very efficient method of processing large volumes of data.
Requirements
Windows-based devices Multiplexing is only possible using SIMATIC WinAC, SIMATIC S7-300, SIMATIC S7-400 or SIMOTION as controller.
Line devices Address multiplexing of tags is only possible using operator panels OP 7, OP 17 and TD 17.
You can use SIMATIC S7-300, SIMATIC S7-400 or SIMATIC S7-NC as controller.
Note:
The value in the memory area is only read at the next updating cycle of the tag addressed.
If, for example, you use a multiplex tag in a script, after changing the memory area you do not directly access its content.
Note: Avoid changing the index of a multiple tags within a script, and then accessing those tags.
Changing the index of multiplex tags and then accessing those tags (e.g. within the same script) can cause data inconsistency!
Sample application:
Using indirect addressing you can configure the following scenario:
The operator selects one of several machines from a selection list. Depending on the operator's selection, a process value of the machine is displayed in an input or output field.
No.
Procedure
1
Creating tags
In ProTool you create an integrated project (e.g. TP270 10").
In the project tree you click on "Tags" and create the "Multiplex" tag of the data type "INT" (DB1.DBW10).
Then create the following tags whose address areas have been defined by the multiplex tag (Multiplex) during Runtime:
Tag
Data type
Address
Set_rotation_speed
INT
DB [mux] DBW0
Actual_rotation_speed
INT
DB [mux] DBW2
Current
INT
DB [mux] DBW4
Temperature
INT
DB [mux] DBW6
Motor_on
BOOL
DB [mux] DBX 8.0
Fault
BOOL
DB [mux] DBX 8.1
Fig. 01
2
Creating a text list
Right-click the symbol list and select "Text/Graphic List insert...".
Assign the name "Motors" to the symbol list and enter the following texts for the parameters (values):
Value
Text
1
Motor 1
2
Motor 2
3
Motor 3
Fig. 02
3
Creating a picture and adding text fields
Create a new picture and define it as Start picture.
Add six text fields with the following designations:
- "Drive"
- "Set rotation speed"
- "Actual rotation speed"
- "Temperature"
- "Current"
- "Fault"
Fig. 03
4
Adding IO fields
Add one input and four output fields.
Link the "Set_rotation_speed" tag to the input field.
Link the four output fields to the following tags:
- "Actual_rotation_speed"
- "Temperature"
- "Current"
- "Fault"
Add a combobox to the picture and link it with the multiplex tag "Multiplex" and the "Motors" symbol list.
Fig. 04
5
Adding button and rectangle
Create a rectangle across all the inserted objects and put it in the background. For this you right-click and select "Align > To The Back".
Then you add a status button of the switch type. For the button "Pressed" state you enter the designation "ON" and for the button "Released" state you enter the designation "OFF".
Link the button in addition to the "Motor_on" tag.
Add four text fields for the unit designations "rpm", "°C" and "A".
Fig. 05
6
Configuring the controller
In STEP 7 you configure a controller (e.g. CPU315 2-DP) and link the panel to the controller.
Create a data block "DB1" with the following parameters:
Name
Data type
Address
Set_Rotation_speed
INT
+0.0
Actual_Rotation_speed
INT
+2.0
Current
INT
+4.0
Temperature
INT
+6.0
Motor_on
Boolean
+8.0
Fault
Boolean
+8.1
Mux
INT
+10.0
Make two copies of the data block and change their names to "DB2" and "DB3".
Fig. 06
7
Start Runtime
Load the project into the controller or in S7-PLCSIM and set the CPU to RUN.
Transfer the project (ProTool) to the panel or start Runtime.
Select "Motor_1" and enter a value for the set rotation speed.
Then select "Motor_2" in the selection field.
Fig. 07
Function The operator selects a drive via the text list. An appropriate value is read in via the index in the text list. Depending on this value, the relevant DB is opened and the highlighted data displayed.
Download: The sample project includes the example described above. The operator panel used was a TP270 10".
Runnability and test environment: The following table lists the components that have been used to create this entry and verify the functions described.
Components
Product and version designation
PC operating system
Microsoft Windows XP SP2
Standard tools
-
Engineering tool
-
HMI software
ProTool V6.0 SP3 HF3
HMI system
-
Keywords: Tag multiplexing, Address multiplexing, Indirect addressing
Transfer of S5 Time values (Timer data type) from an OP to the controller
QUESTION:
What are the differences when transferring S5 Time values from a
line/graphics device from a Windows-based device into the
controller?
ANSWER:
Transfer of S5 Time values (Timer data type) into the controller
is done via various time bases in the Operator Panels.
Line/graphics devices: In line/graphics devices the S5
Time is transferred to the controller on a time base of
seconds.
Windows-based devices: In Windows-based devices the
S5 Time is transferred to the controller on a time base of
milliseconds.
When converting (as of ProTool V6) a line/graphics device into a
Windows-based device with integrated timer tags, the time bases of
the timer tags change from seconds in a line/graphics device to
milliseconds in a Windows-based device.
In order to be able to create a time base of 1s also in a
Windows-based device, you must install a conversion with the factor
of 100 for all time tags.
QUESTION:
Why is the alarm time set online not transferred after a restart /
power failure on the panel?
ANSWER:
The alarm time can only be saved in an internal ProTool tag. When
the ProTool Runtime terminates, the value of the internal tag is
reset to zero and the alarm time set in the configuration is
transferred to the internal variable when the ProTool Runtime
starts up. The alarm time set online is lost. To save the alarm
time, you have to buffer it in the controller.
Procedure:
Configure an internal tag called "Wecker_intern"
(internal alarm), i.e. no controller link, of the DATETIME
data type.
Fig. 1: Creating the internal "alarm tag"
Link this tag to the alarm.
Fig. 2: Linking to the alarm
Create an "Alarm" tag with controller link of the
DATE_AND_TIME data type.
Fig. 3: Storage tag for the alarm time
Create a script, in which the alarm time (tag:
"Wecker" [alarm]) is copied into the internal tag
"Wecker_intern".
Fig. 4: Script for copying the alarm time
Call the script when the value of the control tag "Wecker"
changes.
Fig. 5: Script call upon change of value
Link an input field for your alarm time to the tag
"Wecker".
Fig. 6: Linking to the input field of the alarm time
Note: This entry does not apply for SIMATIC 505 CPUs.
The data type DATETIME is not permitted for SIMATIC 505 CPUs.
Retrieval of Specific Parts (Year, Month, Day, ...) of a Date and Time with ProTool and Visual Basic Script
QUESTION: How can I filter and save specific parts (such as year, month, day, hour, minute, second) of a given date and time in a tag with ProTool?
ANSWER: Certain parts of a given date and time string can be retrieved in ProTool or ProTool/Pro by the Visual Basic Scriptfunction DatePart.
Prerequisites of the Usage of Visual Basic Script in ProTool or ProTool/Pro:
OP270, TP270, MP270, MP270B
MP370
PC
Note:
You find further information on differences between Visual Basic Script functions under Microsoft WinCE and Windows in Entry-ID: 13408815
Visual Basic Script Function DatePart:
DatePart evaluate a date/ time and returns a specific component as integer (year, month, day, week day, hour, minute, second). With DatePart you can save for example the week day or filter the current hour of a date and time and save it in tag.
Interval: data type = string; parameter Interval determines which part of the date is retrieved.
Possible Values for Interval:
Value
Definition
"yyyy"
Year
"q"
Quarter
"m"
Month
"y"
Day of Year
"d"
Day
"w"
Week Day
"ww"
Week
"h"
Hour
"n"
Minute
"s"
Second
Table 1: Values for Interval
Date: data type = date; date and time to be evaluated.
FirstDayOfWeek: optional constant; returns the first day of the week. If this value is not stated, then it is assumed to be Sunday.
Possible Values for FirstDayOfWeek:
Value
Constant
Definition
0
vbUseSystem
Uses System's Setting
1
vbSunday
Sunday (default)
2
vbMonday
Monday
3
vbTuesday
Tuesday
4
vbWednesday
Wednesday
5
vbThursday
Thursday
6
vbFriday
Friday
7
vbSaturday
Saturday
Table 2: Values of FirstDayOfWeek
FirstWeekOfYear: optional constants; returns the first week of the year. If this value is not stated, then it assumes the first week with 1st January.
Possible Values for FirstWeekOfYear:
Value
Konstante
Definition
0
vbUseSystem
Uses System's Setting
1
vbFirstJan1
Week of the 1st January (default)
2
vbFirstFourDays
Week that contains at least 4 Days of the new year
3
vbFirstFullWeek
1st full week of the year
Table 3: Values for FirstWeekOfYear
Examples:
Day = DatePart("d", Now, 1, 1): retrieval of the day of the current system time
Year = DatePart("yyyy", "07.05.2003"): retrieval of the year out of stated date (here: 2003)
Stunde = DatePart("h", "20:49:23"): retrieval of the hour of the stated time (here: 20)
A Sample Project as Download: This is a OP270 6 project that was designed with ProTool/Pro V6.0 SP2. The project contains a sample script of DatePart function. Copy file OP270.exe into a separate directory and unpack it per double click. You can open and edit this project as of ProTool V6.0 SP2.