Skip to main content

OPC DA Point mapping CSV

info

OPC DA Point lists use CSV to map source Item IDs to target database tables. The source identifier column is tag_name; UA's point_id cannot replace it. Download a template and retain the original. After single-Point verification, expand to wide tables, vendor metadata tags, or a PI historical model.

Entry point: taosExplorer → Data Ingestion → OPC-DA → Point Set → Download or Upload CSV Configuration File.

Use UTF-8, optionally with a BOM. The first row is the header, and each subsequent row configures one Point. The target mapping rules are the same type as OPC UA's, but the source identifier is tag_name. Do not replace it directly with UA's point_id or ns=....

1. Preparation and fields​

First ask the Server administrator to confirm a readable Item ID using the actual runtime identity on the Windows host that performs collection. For connection and COM/DCOM prerequisites, see OPC DA. Download the template from the page, retain the original, then review and upload a copy.

ColumnDA configuration requirements
tag_nameRequired and unique within the task. Enter the exact source Item ID, such as Channel1.Device1.Temperature.
stable, tbnameRequired. Specify the target supertable and child table, such as opc_{type} and t_{id}. {id} uses the complete Item ID; {tag_name} / {TagName} uses only the segment after the last period, so identical final segments across devices may collide.
enabledOptional; use only 0 or 1. Enabled by default. Use enabled, not the old header enable.
value_col, value_transform, typeRetain the value_col header to store collected values. An empty cell in this column defaults the column name to val; omitting the header does not configure a value column automatically. Expressions reference the actual value column name. Type overrides are optional.
quality_colTarget column for quality codes. Only removing this header means no quality column is configured; an existing header with an empty row value uses quality.
quality_modeOptional. pi_compatible_v1 converts quality and values by the categories below and requires a quality column. Without it, original quality semantics are retained.
value_mapJSON dictionary mapping Digital codes to nonempty state names. The target value type must be NCHAR/VARCHAR. Cannot be combined with value_transform.
ts_col, request_ts_col, received_ts_colTarget column names for source, request, and receive times. Enter explicit, nonempty column names. The leftmost time header determines the primary key.
ts_transform, request_ts_transform, received_ts_transformOptional transformations for the corresponding time columns. Reference the actual target column name and confirm input units first.
tag::TYPE::nameTarget tag header, such as tag::VARCHAR(64)::site; each row contains this Point's tag value.

For common target-column defaults, type overrides, behavior when time columns are missing, and standard CSV quoting rules, see Point mapping column definitions, Value type names, and Commas and double quotes. Reuse only target mapping rules, not UA source identifiers or certificate configuration.

Use the exact lowercase header tag_name. Do not use the table-name template variable {TagName} as a source identifier header named TagName; these are different inputs. Spell other headers as defined too. Misspelled optional columns do not necessarily trigger required-field validation. Check the actual effect of each column against the shared definitions.

warning

enabled=0 may delete the corresponding child table and its historical data, not merely stop reads. Use the task stop operation to pause a task. Before submitting a disabled Point list or enabling deletion synchronization, assess all Points sharing the target table and preserve backups.

2. Single-Point example​

The following Item ID only illustrates the format. Replace it with an actual readable Point provided by the administrator. The fixed time column is source time ts. Quality and receive time are retained for verification:

tag_name,enabled,stable,tbname,value_col,quality_col,ts_col,received_ts_col,tag::VARCHAR(64)::site
Channel1.Device1.Temperature,1,opc_{type},t_{id},val,quality,ts,rts,lab

This example uses the complete-identifier template t_{id}; periods are normalized to underscores. If the source Point is Double, run the following queries in the taosExplorer Data Browser or taos CLI. Still check the table name against the actual preview. Do not change the template to t_{tag_name} and continue querying the same table name:

DESCRIBE opcda_demo.`t_Channel1_Device1_Temperature`;
SELECT ts, rts, val, quality, site
FROM opcda_demo.`t_Channel1_Device1_Temperature`
ORDER BY ts DESC LIMIT 10;

Expect site to be lab and the value to match the reading at the same source time. Interpret quality codes using the OPC DA Server specification. Ask the administrator to change a Point approved for testing, then query the new value. After receiving one historical value, also verify that new values continue to arrive.

3. Convert vendor metadata into tags​

note

DA can read Point values, quality, and time. Vendor attributes such as Description, EngineeringUnit, high/low range limits, and source paths do not automatically become target TAGs simply because the Server provides them. To retain this information, ask the administrator to export a Point list or dump using vendor tools. Confirm that Item IDs match the actual collection Points, then convert the result to this page's CSV format. Export commands and column names vary by vendor. Do not upload the raw export directly as a taosX Point list.

For example, a vendor exports the information below. ItemID is the join key. Description contains a comma, so CSV quoting must be retained:

ItemID,Description,EngineeringUnit,Low,High
Channel1.Device1.Temperature,"反应罐1,入口温度",degC,-40,150

Convert it to a complete target mapping row. The example uses explicit supertable, child-table, and source-time columns:

tag_name,enabled,stable,tbname,value_col,quality_col,ts_col,tag::NCHAR(128)::description,tag::VARCHAR(16)::unit,tag::DOUBLE::range_low,tag::DOUBLE::range_high
Channel1.Device1.Temperature,1,opcda_meta,t_device1_temperature,val,quality,ts,"反应罐1,入口温度",degC,-40,150
  1. Enter the exact source Item ID in tag_name. Do not match using a description, display name, or final segment with the device prefix removed.
  2. Check lengths and numbers against each column's type, and retain the distinction between null and an empty string. Tag names must be unique, and column counts must match. Do not use lossy truncation to make the template pass.
  3. Upload to a separate test task. Check the generated opcda_meta tag definitions and actual tag values for t_device1_temperature before expanding the Point count. This example does not convert collected value units; unit is only metadata.
  4. Query this Point's value, quality, and time, and check its tags as well. If the source range changes, separately review whether numeric conversion needs changing. Changing a tag does not automatically change value_transform.

3.1 Maintain ingested tags​

Asset attributes and industrial metadata can be maintained in TDengine IDMP through existing management processes. Check the actual integration configuration to determine whether IDMP attributes and TAGs in the TDengine database are linked. A change to the asset display alone does not establish that database tags have been updated. If IDMP is not used, or database TAGs must be maintained directly, have an authorized administrator execute SQL. For syntax, see Modify tag values and Modify tag values in batches.

The SQL below is only for the separate test child table described above. Confirm the target object and original tags before making changes:

DESCRIBE opcda_demo.opcda_meta;
SHOW TAGS FROM opcda_demo.t_device1_temperature;
ALTER TABLE opcda_demo.t_device1_temperature SET TAG description = '反应罐1入口温度';
ALTER TABLE opcda_demo.t_device1_temperature SET TAG range_high = 180;
SHOW TAGS FROM opcda_demo.t_device1_temperature;
SELECT ts, val, quality, description, unit, range_low, range_high
FROM opcda_demo.t_device1_temperature
ORDER BY ts DESC LIMIT 10;

Changing a TAG changes the child table's tag attributes. Queries of historical records by tag also use the updated tag; an original tag version is not retained for each historical record. Maintain a separate audit log if metadata change history is required. This operation does not change source Server attributes or replace maintenance of the collection Point list.

After making changes, update the controlled original CSV as well. Check tags after subsequent model updates or table recreation to prevent old configuration from restoring old values. Do not assume that reuploading a CSV automatically overwrites all existing TAGs, and do not update tags by disabling rows to recreate child tables. When multiple users share a target table, coordinate a maintenance window and retain tag values and query results from before and after the change.

4. Wide tables and maintenance checks​

Different tag_name values can map to different value columns in the same child table, but value_col must differ. The schema and time settings of every Point must be compatible with the existing target table. Within one task, the same source Point cannot be configured repeatedly for multiple targets. If one source genuinely needs multiple targets, create separate tasks and assess source load.

For a complete two-Point wide-table structure and verification method, see Write two Points to the same child table. For DA, change the source identifier header to tag_name, and enter the actual Item ID provided by the administrator in each row. Do not retain UA's ns=.... Still use different value columns and verify source time, value, and quality separately. Different Points need not update simultaneously each time.

Before submission, check for duplicate headers and tag names, consistent column counts, at least one configured row, an explicit time primary key, and no conflicting target table mappings. Unrecognized helper columns cannot replace required fields. Retain case, periods, and spaces according to the actual source identifier. After changes, verify both existing and new Points. Do not reinstall taosX-Agent merely to change a Point list.

5. Continue a PI historical model​

Use the following options only when the target actually reuses a PI historical model. Ordinary OPC DA tasks do not need to change quality encoding for this purpose.

5.1 Quality continuity​

Raw OPC DA quality codes and PI digital state numbers use different encodings. For example, raw OPC DA Good quality is commonly 192, while a PI historical model may use 0 for a valid value. Do not treat real-time 192 directly as a historical state number.

For PI continuity conversion, configure quality_mode=pi_compatible_v1 in the Point list and explicitly set quality_col to the existing quality column. This conversion does not run without that mode. The mode converts by OPC quality category as follows:

Source quality or data conditionValue columnQuality column result
Good category with a valid value, for example raw code 192Retain the numeric value, or convert using the configured Digital dictionary0
Bad category, for example raw codes 0, 4, 8, 24NULL307
Uncertain category, for example raw codes 64, 68, 80NULL308
Missing quality or reserved categoryNULL-1
Good but missing value, or Digital code not found in the dictionaryNULL-1
warning

pi_compatible_v1 does not reproduce every state conversion of the original PI Interface. It does not map individual Bad substates to historical numbers such as Configure, Not Connect, or Comm Fail, and does not change the rules above based on the original interface's /SQ or /SG parameters. If the site's historical model must retain these finer semantics, confirm a suitable continuation approach first. Do not treat this mode as fully compatible.

Ask the PI administrator for the historical state sets and original interface configuration. Have the business owner confirm whether these categories meet query, alarm, and reporting requirements. States such as I/O Timeout, Intf Shut, and Shutdown generated by the original PI Interface or server itself cannot be reconstructed from OPC current values. Enable Report Abnormal Values during continuation tests; otherwise abnormal source values may be excluded before reaching the target. Verify Good, Bad, Uncertain, and missing values separately using approved test Points. Do not deliberately cause production equipment failures.

5.2 Digital dictionaries and numeric conversion​

If historical Digital values are state names such as Idle and Charge, while OPC returns Boolean or integer codes, configure a business-approved JSON dictionary in CSV value_map. For example, {"0":"Idle","1":"Charge"} specifies target text for codes 0 and 1. Explicitly set the target type to NCHAR or VARCHAR. Dictionary values must be nonempty strings, and the dictionary cannot be combined with value_transform for the same Point.

Boolean keys false/true and integer keys 0/1 represent the same codes and cannot be configured twice. Codes absent from the dictionary do not default to 0 or a valid state: the value is written as NULL, quality is -1, and diagnostic information is logged. With quality conversion configured, Bad and Uncertain are handled first as shown above. They do not pass through the Digital dictionary to generate an apparently valid state value.

To restore scaling or offsets from the original PI path for ordinary numeric Points, configure value_transform using confirmed coefficients. For example, with target value column value, value * 0.1 scales by one tenth. Enter Point-list expressions directly, without the ${...} wrapper used by other mapping inputs. Coefficients must come from the original Point list or site business agreement, not guesses based on Point names or similar values. Compare input values, converted values, and historical units before approving the batch of Points.

The following example maps Points to two existing target child tables. Confirm compatibility with the existing schema before use, and replace every Point name, table name, column name, and type with the reviewed site values. Do not overwrite an existing model with example names:

tag_name,enabled,stable,tbname,ts_col,value_col,type,quality_col,quality_mode,value_map
Furnace01.Temp,1,ts_float32,tb_temp,ts,value,FLOAT,status,pi_compatible_v1,
Furnace01.State,1,ts_digital,tb_state,ts,value,NCHAR(100),status,pi_compatible_v1,"{""0"":""Idle"",""1"":""Charge""}"

Double quotes inside JSON are doubled according to CSV rules. Do not simply remove them or split a comma-containing dictionary across columns. Preview in a test task first. Check values and status in tb_temp and state names and state numbers in tb_state, then verify the handover window using PI historical backfill and WinCC real-time collection.