×
Siemens Industry Online Support
Siemens AG
  • Content
  • Search
  • Index
  • WinCC Engineering V15.1 - Programming reference
    • VB scripting
      • VBS object model
        • VBS object model
        • Objects
          • Alarm
          • Alarms (list)
          • AlarmLogs (list)
          • DataItem
          • DataLogs (list)
          • DataSet (list)
          • HMIRuntime
          • Item
          • Layer
          • Layers (list)
          • Logging
          • Project
          • Screen
          • ScreenItem
          • ScreenItems (list)
          • Screen object (list)
          • SmartTag
          • SmartTags
          • Tag
          • Tags (list)
          • TagSet (list)
    (1)
    Rate

    Entry type: Manual, Entry ID: 109755216, Entry date: 11/21/2018

    SIMATIC WinCC WinCC Engineering V15.1 - Programming reference

    Document: WinCC Engineering V15.1 - Programming reference (10/2018, English)
    Type of topic: Function

    SmartTags

    Description

    A list of SmartTag objects which represent all of the tags in WinCC Runtime.


    Note

    The SmartTags list has a limited range of functions. You can only use the tag names to access a SmartTag object. Access via the index or by using "For each" instruction is not supported.




    Note

    In order to access a tag, which has still not been created in the project, using the SmartTags list, no value is returned. Assignment to a non-existing tag is not executed:

    Dim intVar
    intVar = SmartTags("FillLevel")

    "intVar" remains empty when the "FillLevel" tag has not been created.




    Note

    Current system behavior for dynamic access to elements of a user data type

    When you compose the tag name of a user data type element dynamically in Runtime, the composed tag name is not recognized under the following condition:

    • Tag of the data type of the user data type is created.

    • Tag is not used, e.g. at an I/O field

    Example:

    You have configured a user data type "Motor" with the elements "RPM" (Int), "On" (Bool) and "Off" (Bool). In the project, you have configured the tag "Motor1" as instance of the user data type. You want to output the values of the elements in only one I/O field in runtime. You have configured an additional I/O field for input of the element name. The value you enter is saved to the internal tag strElementName. With the following script you output the value of an element in the I/O field "IOFieldOutputValue":

    Dim strDynElementName, objIOFieldOutputValue

    Set objIOFieldOutputValue = objscreen.ScreenItems("IOFieldOutput")

    'Get element name from tag value

    strDynElementName = SmartTags("strElementName").Value

    'Create tag name

    objIOFieldOutputValue.ProcessValue = SmartTags("Motor1."+strDynElementName).Value

    Help:

    Configure a separate I/O field for each user data type element, for example, in an additional screen. Interconnect the "process value" with the respective user data type element.




    Note

    Dynamizing faceplates

    Use the following syntax to access a tag that is connected at a faceplate interface ("Properties"):

    Smarttags("Properties\int_input1_tag")



    Application

    Use the SmartTags list to return a SmartTag object. Use the tag name to reference the SmartTag object.

     
    'VBS_Example_SmartTags
    'Writes tag value to local tag and returns a user-defined text through the operating system channel for debug alarms.
    Dim strAirPressure
    strAirPressure = "Current air pressure: " + CStr(SmartTags("AirPressure"))
    HMIRuntime.Trace strAirPressure

    In Runtime Advanced and Panels you address the tag directly using its name. If the tag name corresponds to the VBS name conventions, you do not need to use the SmartTags list. Follow the example below:

     
    Dim strAirPressure
    strAirPressure = "Current air pressure: " + CStr(AirPressure)
    HMIRuntime.Trace strAirPressure

    See also

    internal link HMIRuntime

    internal link SmartTag



     

    Support to the statistics
    With this function the IDs found are listed according to number (format .txt).

    Generate list
    Copy URL
    Display page in new design
    mySupport Cockpit