-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathPIConnectionExample.cs
More file actions
42 lines (35 loc) · 1.2 KB
/
PIConnectionExample.cs
File metadata and controls
42 lines (35 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using OSIsoft.AF.PI;
namespace ExamplesLibrary
{
/// <summary>
/// This example demonstrates making a connection to an PI Data Archive using an implicit connection and an explicit connection.
/// </summary>
/// <prerequisite-examples>
/// none
/// </prerequisite-examples>
public class PIConnectionExample : IExample
{
public void Run()
{
ImplicitConnection();
ExplicitConnection();
}
public void ImplicitConnection()
{
PIServers piServers = new PIServers();
PIServer piServer = piServers["PIServerName"];
// At this point, no connection is made.
PIPoint piPoint = PIPoint.FindPIPoint(piServer, "sinusoid");
// Now a connection is made by first data access.
}
public void ExplicitConnection()
{
PIServers piServers = new PIServers();
PIServer piServer = piServers["PIServerName"];
// At this point, no connection is made.
piServer.Connect();
// Now a connection is made by explicit call.
PIPoint piPoint = PIPoint.FindPIPoint(piServer, "sinusoid");
}
}
}