×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ, Entry ID: 55741262, Entry date: 11/07/2011
(2)
Rate

How can you provide new tags for the separate trends of an f(t) trend display by means of a C or VB script in WinCC Runtime Professional V11 and higher?

  • Entry
  • Associated product(s)

Description
With the scripts used here you can change the tag originally configured as data source of a trend during runtime.

Example
You have defined the "TagA" tag from the "TestArchive" process value archive as data source for the "Trend1" trend. Using the script now in runtime you can define the "TagB" tag as data source of the "Trend1" trend.

Instructions
Proceed as follows to use a C script to assign a trend a different tag from the process value archive.
 

No. Procedure
1 Set the "TrendName" attribute, which corresponds to the name of the trend in the f(t) trend display, for the trend whose data source you wish to change.

Function: SetPropChar

Example: SetPropChar( "Trends", "Control_1", "TrendName", "Trend1" );

2 Set the "TrendTagName" attribute of the trend previously defined to the new tag required.

Function: SetPropChar

Example: SetPropChar("Trends","Control_1","TrendTagname", "TestArchive\\TagB");

3 Complete sample script:
SetPropChar( "Trends", "Control_1", "TrendName", "Trend1" );
SetPropChar("Trends","Control_1","TrendTagname", "TestArchive\\TagB");
Table 01

Proceed as follows to use a VB script to assign a trend a different tag from the process value archive.
 

No. Procedure
1 Create the "obj" object for the f(t) message display.

Dim obj
Set obj = ScreenItems("Control_1")

2 Set the "TrendName" attribute, which corresponds to the name of the trend in the f(t) trend display, for the trend whose data source you wish to change.

obj.TrendName = "Trend1"

3 Set the "TrendTagName" attribute of the trend previously defined to the new tag required.

obj.TrendTagName = "TestArchive\TagB"

4 Complete sample script:
Dim obj
Set obj = ScreenItems("Control_1")
obj.TrendName = "Trend1"
obj.TrendTagName = "TestArchive\TagB"
Table 02

Keywords
Change data source, Change trend tag

Security information
In order to protect plants, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about industrial security, please visit
http://www.siemens.com/industrialsecurity.