IMD SolutionComputing LibraryShop main store

Explainer

PI AF SDK: the native path from a C# application to PI

Edge computing and IIoT Published 7 min read

Short answer

No driver joins two OPC UA clients, so KEPServerEX needs no new driver for this. Read PI Data Archive and PI Asset Framework from C# through PI AF SDK, which needs the server-side PSA license. Any new values must flow through a real OPC UA server endpoint that a licensed PI OPC UA interface or connector collects from.

On this page
  1. Why no driver fits this connection
  2. What the PI side actually is
  3. Reading PI from C#: the PI AF SDK path
  4. Feeding new values into PI: put a server in the middle
  5. Licensing sits on the server side of every hop
  6. Sizing the collector host
  7. The decision
  8. Questions asked

None: there is no driver for this job, and that absence is the architecture. A driver connects an OPC server to a data source — a PLC, a meter, a file system. Your C# application and the PI System are both OPC UA clients, and no driver joins two clients. If the application needs data PI already stores, write it against PI AF SDK, the native .NET path to both the PI Data Archive and PI Asset Framework, which runs under the server-side PSA license. If the application must supply new values, a real OPC UA server endpoint has to sit between the two clients, and a licensed PI OPC UA interface or connector collects from that endpoint into PI. The sections below place each piece, give the license and the numbers, and end with the decision for each direction.

Why no driver fits this connection #

OPC UA is client-server: a client requests reads, writes and subscriptions against the address space a server exposes. A client exposes no address space of its own, so two clients have nothing to connect to each other. A driver, in an OPC server such as KEPServerEX 6, is the component that connects the server to a data source, which is why the server demands one only when it has a real source to reach. Your C# application and the PI collection side are both clients, no PLC is involved, and the driver list therefore contains no entry for "another OPC UA client". The driver is chosen by the source protocol, never by the client on one side or the historian on the other.

The rule is not OPC UA-specific. The same wall appears in OPC DA, and the working pattern is identical, as in the case where a C# OPC DA client needs its own server in front of it. Whatever the dialect, put a server where the connection needs one.

What the PI side actually is #

PI Data Archive is the time-series store. Interfaces and connectors fill it from OPC servers, controllers, flat files and the rest. PI Asset Framework is the asset server: hierarchies of plant equipment whose attributes carry data references into archive points or calculations. Neither component waits on the LAN as a peer for an arbitrary client application.

The OPC UA role you pictured is the collection role. PI speaks OPC UA from the client side, through a licensed interface or connector, to pull values in. That role consumes OPC UA servers; it does not offer your C# application an address space to browse. If what you actually wanted was the opposite direction — an OPC UA client reading PI values — that is a serve-out function with its own components, covered in exposing historian latest values over OPC UA or MQTT.

Reading PI from C#: the PI AF SDK path #

For an application that consumes data PI already stores, PI AF SDK is the direct C# integration path and KEPServerEX drops out of the picture entirely. One library reaches both the PI Data Archive and the PI AF Server. The getting-started documentation shows the entry point: use the PISystems class to list the known PI AF servers and connect to an AF server or Data Archive.

PISystems knownServers = new PISystems(); // documented AF SDK class: enumerates known PI AF servers
// pick your AF server from knownServers, open it, then read one known tag

knownServers is an illustrative variable name for this article; PISystems is the documented class name.

Three prerequisites decide whether this runs in production:

  • The server-side PSA license. AF SDK access to a PI server runs under the PSA license on the server, the tier that permits external programmatic access to the Data Archive. It is a deployment prerequisite, not a connectivity setting; confirm it with the PI administrator before scheduling the work.
  • The SDK itself, obtained through the vendor's authorized developer channel, in a build that matches your .NET runtime.
  • An application identity with documented read access to the data you query.

Prove the path on one point before building anything wider: read a tag whose value you know at a timestamp you know, and compare it against what an authorized PI client shows for the same tag and timestamp. The same value at the same timestamp passes. A mismatch tells you which thing you got wrong — wrong server, wrong attribute or wrong point — before the mistake reaches production code.

Reachability is part of that test. The SDK connects to a real server endpoint, and a development machine in the cloud still needs a real PI Server endpoint to answer it, as covered in why the PI SDK needs a real PI Server endpoint for cloud tests.

When the reads are built on attributes rather than raw points, the AF model is the contract the SDK returns against: designing PI Asset Framework for part attribute tracking is the reference for building that model deliberately.

Feeding new values into PI: put a server in the middle #

Start one step earlier. If these values do not clearly need to land in PI at all, settle first whether you need a historian or just an OPC tag server. Once PI is the destination, the values must sit behind a server endpoint PI can collect from. The practical shapes are an application that writes into writable nodes of an OPC UA server such as KEPServerEX 6, or a documented internal data source the server product provides. There is no driver called "my C# application", because a driver names a source protocol; with the application itself as the source, look for the server's documented writable or internally supplied tags and verify their behavior before committing.

Check four things on a test node: data type, access rights, what the value storage does between writes, and whether acquisition overwrites application-written values. Then run the proof. A successful write response proves the server accepted an operation, not that the value survives collection: read the node back after normal acquisition activity and inspect its value, status and timestamp. Your value, still present, is the pass.

PI collects from that endpoint through a licensed PI OPC UA interface or connector acting as the client; the PI Connector for OPC UA copies contextual and time-series data from the server into the PI System. The timestamp PI keeps is the one that path carries — a PI value timestamp is not a receipt time — so build reads around the source timestamp, not the arrival time.

One boundary: if a node you write also feeds a control action, that write path belongs to the control system's owner and its safety review, not to a reporting application.

Licensing sits on the server side of every hop #

Each hop carries its license where the endpoint lives, never in your client. The AF SDK path needs the PSA license on the PI server. OPC UA collection into PI needs the PI-side collection license for the interface or connector. The server endpoints carry their own as well: enabling the OPC UA server in a DeltaV PK Flex Controller requires the Flex OPC UA Server Interface license, and that license lives with the server, not with whoever connects to it. Budget the licenses where the endpoints live; the C# application is the one component that adds none.

Sizing the collector host #

The PI Connector for OPC UA documents its host floor: 4 GB of RAM minimum, 8 GB or more recommended, 25 GB or more of drive space, and a dual-core processor. These numbers are the documented deployment floor for that component on its host.

Worked example: you dedicate one host to the connector and it has 16 GB of RAM and 120 GB of free disk. RAM: 16 GB - 8 GB = 8 GB above the recommendation. Disk: 120 GB - 25 GB = 95 GB above the minimum. That host clears the documented floor with room for the operating system and the connector's own footprint, and it is a defensible production collector. A machine at the RAM minimum has none of that room and is a bench-test host, not a production one. When that collector gets its own cabinet machine instead of space on an existing server, a fanless industrial mini PC is the usual shape for it.

The decision #

  • The application reads data PI already stores: use PI AF SDK directly against the AF server or Data Archive. Budget the server-side PSA license, skip KEPServerEX, skip every driver, and prove the path with one known tag at one known timestamp against an authorized PI client.
  • The application produces values PI must store: stand up a real OPC UA server endpoint, collect through a licensed PI OPC UA interface or connector, choose any driver by the actual source protocol, and prove the write with a read-back after acquisition.
  • You wanted PI values out for OPC UA clients: that is the serve-out direction with its own components, and no driver question applies to it either.

In all three cases the answer to the original question is the same: no driver applies, because adding one never turns a client-to-client gap into a client-to-server connection.

Questions asked

Can my C# client read PI values over OPC UA instead of using the SDK?

Only if a component serves those values over OPC UA. The Data Archive's supported programmatic access for .NET code is the AF SDK path. Serving PI values outward is a separate function with its own components, and PI's OPC UA role on the collection side is a client of your server, not a server for your client. If you need an OPC UA view of PI values, deploy a component built to expose them, then point the C# client at that endpoint.

Which license must be confirmed before AF SDK code runs in production?

The server-side PSA license on the PI server, the tier that permits external programmatic access to the Data Archive. Confirm the active license on the deployed target with the PI administrator, not on the development machine: a connection that worked against one server proves nothing about the licensing state of another. Treat the license as a deployment prerequisite that gates the go-live date, the same way the collection license gates an OPC UA collector.

Does the C# application have to run on the PI server?

No. The application runs on its own computer and connects over the LAN to the AF server or Data Archive with its configured identity. Being on the same subnet proves nothing about service reachability: host firewalls, name resolution and the server's advertised address decide. Test from the machine that will actually run the application, and treat a failure at the transport stage differently from a rejection at authentication or session setup.

Who timestamps the values PI stores from my server?

The collection path does, per its configuration, and that timestamp travels with the value into the archive. It is not necessarily the moment PI received the value, so comparing archive timestamps against receipt or processing times can chase an offset that was never an error. Configure the collection component to keep the source timestamps you want, then build reports and audits against those timestamps rather than arrival times.

Keep reading

  • How-to

    Get ETAP RTU data into AVEVA Historian the supported way

    Keep the ETAP acquisition path and feed AVEVA Historian from ETAP's OPC UA publication for live values, with a documented historical import for the SQLDB and MongoDB records. The gateway zeros carry OPC DA quality 0x0040, Uncertain, from a second RTU session the reported single-client limit leaves unavailable, so they are acquisition failures, not measurements.

    Edge computing and IIoT

  • Comparison

    Canary historian export paths: MQTT publisher or API read

    Canary gives you two confirmed ways to move historian data out: the Publisher service, which pushes real-time values to MQTT or Kafka as Sparkplug B or JSON, and the Read API, which an external client calls to pull stored data. An outbound OPC UA server is not a confirmed option.

    Edge computing and IIoT

  • Explainer

    Connect on-premise OPC UA and SQL servers to a cloud PI System

    Yes. Install the AVEVA adapters on-premise, on a small host next to the OPC UA and SQL servers, and point egress at PI Web API in the cloud; the PI Data Archive port is not a supported egress destination. Only the adapter-to-Web API direction needs an outbound route.

    Edge computing and IIoT