Use the systemLinkTagHandler data type to create SystemLink tags.

  • systemLinkTagHandler myTagHandler = sys:systemLink:createTagHandler( text tagPath, int32 cycleTime, text systemLinkWorkspaceId )
  • [ systemLinkTagHandler myTagHandler, systemLink:createTagHandler status ]= sys:systemLink:createTagHandler( text tagPath, int32 cycleTime, text systemLinkWorkspaceId )

Example: SystemLink Tags

program
    section globals
        int32  int32Variable
        int32  real64Variable
        int32  textVariable
    endsection
        
    uint32 cycleTime = 10
    text SystemLinkWorkspaceID(50) = "45bc27cf-85c6-485c-945d-a51e664f511d"
    text tagPath(50) = "BTS.Battery"
    
    // helper object to create the tag handler
    TagContainer myObject(tagPath, cykleTime, SystemLinkWorkspaceID)
    // add some variables to the tag handler. The name and the values will be send cyclical to the systemLink
    myObject:addVariable(ref int32Variable)
    myObject:addVariable(ref real64Variable)
    myObject:addVariable(ref textVariable)
    
    myObject:create() // creates the tags (initial, only the names without values)
    myObject:start()  // start sending the values cyclically to systemlink
        
    myObject:stop() // ending the test will also stopping the taghandler
endprogram
    
class TagContainer
    systemLinkTagHandler TagHandler
    text tagMetaDataTemp(80)
    
    function TagContainer(text myTagPath, uint32 myCyleTime, text mySleWorkspaceId)
        TagHandler = sys:systemLink:createTagHandler(myTagPath, myCyleTime, mySleWorkspaceId)
    endfunction

    function addVariable(ref int32 variable)
        setUnit(variable:unit)
        TagHandler:addTag(variable, tagMetaDataTemp)
    endfunction

    function addVariable(ref real64 variable)
        setUnit(variable:unit)
        TagHandler:addTag(variable, tagMetaDataTemp)
    endfunction

    function addVariable(ref text variable)
        setUnit(variable:unit)
        TagHandler:addTag(variable, tagMetaDataTemp)
    endfunction

    function setUnit(text unit)
        tagMetaDataTemp =  "{\"properties\": { \"units\": \""
        tagMetaDataTemp += unit
        tagMetaDataTemp += "\" }}"
    endfunction

    function create()
        TagHandler:create()
    endfunction

    function start()
        TagHandler:start()
    endfunction

    function stop()
        TagHandler:stop()
    endfunction
endclass