Example of Adding a Tag Using the File Collector

For this example, we choose to add a Python Expression tag to the Historian using the File Collector to import a CSV file.

The file contents look like this:
[Tag]
Tagname,CollectorName,CalcType,SourceAddress,DataType,Description
ExampleTag,SimulationCollector,PythonExpr,
"{""imports"":[""math""],""script"":""temp.value + 
math.pow(10,temp.value/70)"",""parameters"":[{""name"":""temp"",""source"":{""address"":""Simulation00001"",""dataType"":""SingleFloat""}}]}",
SingleFloat,Python Expression Tag example
Note the following:
  • The CalcType header is included and set to PythonExpr.
  • The Source Address is set to the minified JSON created in the previous step.
  • The CollectorName is set to SimulationCollector, which is a Simulation Collector. This collector is on the list of collectors supporting Python Expression Tags. Your collector might be called by a different name.
  • The quotation marks within the JSON string are escaped with other quotation marks in the CSV file.

    For more information, refer to File Collector > CSV file format.