I am doing an export using the AF SDK and attributes in PI. The export is putting a heavy load on the PI Server.
We have a setup with a singe AF Server and two PI servers, where one is the primary server.
When running the export I would really like to have the data retrieval to connect to the secondary server.
In the AF SDK on live library I can find a description on how to connect to specific AF server (PI System) and also on how to connect to a specific PI Server.
I cannot however see how I can get data from the secondary PI Server through Attributes in AF SDK.
My idea was that if I just connect to the PI server I want in my program, the AF SDK will use that connection.
This is however not what I get. I always seem to run the queries on the primary PI Server.(I can see it using the PI SMT- PI Services)
Can anyone help me to reach a specific PI Server through AF Attriutes using AF SDK?.
I have done the following in code
public static PISystem GetPiSystem(string name)
var systems = new PISystems();
PIConnectionInfo.DefaultPreference = AFConnectionPreference.Any;
system = systems.DefaultPISystem;
system = systems[name];
public static PIServer GetPiServer(string name)
var piServers = new PIServers();
server = piServers.DefaultPIServer;
server = server.Collective.Members[name].PIServer;
private AFDatabase _afDatabase;
private PIServer _piServer;
public DataAccess(string afServerName, string afDatabaseName, string preferredPiServer)
_piServer = GetPiServer(preferredPiServer);
_afDatabase = GetPiSystem(afServerName).Databases[afDatabaseName];
Based on the what is described in the live library.
Connect to AF Server
// Get the PISystems collection for the current user and default PISystem.
PISystem myPISystem = new PISystems().DefaultPISystem;
// Simple connect.
//Connect to a specific PI Server
PICollectiveMember myMember = myPIServer.Collective.Members;