-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathCreatePIPointsExample.cs
More file actions
43 lines (36 loc) · 1.87 KB
/
CreatePIPointsExample.cs
File metadata and controls
43 lines (36 loc) · 1.87 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
43
using System.Collections.Generic;
using OSIsoft.AF;
using OSIsoft.AF.PI;
namespace ExamplesLibrary
{
/// <summary>
/// This example creates a floating and digital PI Point on the server.
/// </summary>
/// <prerequisite-examples>
/// none
/// </prerequisite-examples>
public class CreatePIPointsExample : IExample
{
public void Run()
{
PIServers piServers = new PIServers();
PIServer piServer = piServers["<AFSERVER>"];
// Use PICommonPointAttributes so we don't have to remember the strings for point attributes.
string floatpoint = "sample_floatpoint";
Dictionary<string, object> floatpoint_attributes = new Dictionary<string, object>();
floatpoint_attributes.Add(PICommonPointAttributes.PointClassName, "classic");
floatpoint_attributes.Add(PICommonPointAttributes.Descriptor, "Hello floating world");
floatpoint_attributes.Add(PICommonPointAttributes.PointType, "float32");
string digitalpoint = "sample_digitalpoint";
Dictionary<string, object> digitalpoint_attributes = new Dictionary<string, object>();
digitalpoint_attributes.Add(PICommonPointAttributes.PointClassName, "classic");
digitalpoint_attributes.Add(PICommonPointAttributes.Descriptor, "Hello digital world");
digitalpoint_attributes.Add(PICommonPointAttributes.PointType, "digital");
digitalpoint_attributes.Add(PICommonPointAttributes.DigitalSetName, "modes");
Dictionary<string, IDictionary<string, object>> pointDict = new Dictionary<string, IDictionary<string, object>>();
pointDict.Add(floatpoint, floatpoint_attributes);
pointDict.Add(digitalpoint, digitalpoint_attributes);
AFListResults<string, PIPoint> results = piServer.CreatePIPoints(pointDict);
}
}
}