Home > Net >  Use the PISDK and c # (do not use the buffer) to write value Pl
Use the PISDK and c # (do not use the buffer) to write value Pl

Time:10-30

PISDK. PISDK g_SDK;
PISDK. Server piServer;
PISDK. PIPoint PIPoint;
G_SDK=new PISDK. PISDKClass ();
PiServer=g_SDK. The Servers [myServer];
PiServer. Open (" UID=piadmin; The PWD=");
PiPoint=piServer. PIPoints [myTag];

//Write to PI using PIValues

PISDK. PIValues pvPIValues;
PvPIValues=new PISDK. PIValues ();
PvPIValues. ReadOnly=false;
PvPIValues. Add (null, myValue, null);
PiPoint. Data. UpdateValues (pvPIValues, PISDK. DataMergeConstants. DmInsertDuplicates, null);

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
//Write to PI using PIPoint

PiPoint. Data. UpdateValue (pvPIValues, null, DataMergeConstants dmInsertDuplicates, null);

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
//Write to PI, the using of Collective

List PiPointList;
Double utcDatetime=ah. ConvertDateToUtcSec (DateTime. Now);
Enclosing numPointsUpdated=0;
String strLimitVal="";
PISDK. PIPoint PIPoint;
The Object _ServerName="MYPISERVER";

The foreach (var alarmLimit piPointList) in
{
TagName=alarmLimit. PiTagName;
LimitValue=https://bbs.csdn.net/topics/alarmLimit.limitValue;
StrLimitVal=alarmLimit. StrLimitValue;

Try
{
PISDK. PISDK piSDK1=new PISDK. PISDK ();
PISDK. Server the Srv=piSDK1. The Servers [_ServerName] (String);
PISDK. IPICollective Collective=(PISDK IPICollective) the Srv;

If (Collective. IsCollectiveMember)
{
PISDK. CollectiveList ColList=Collective. ListMembers ();
PISDK. CollectiveMember ColMember=ColList. Get_Item (ref _ServerName);
PiServer=Collective. MemberOpen (ColMember, "");

PiPoint=piServer. PIPoints [tagName];

PiPoint. Data. UpdateValue (strLimitVal, utcDatetime, DataMergeConstants dmInsertDuplicates, null);
This. NumPointsUpdated++;
}
}
}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

//VB code that works but not able to translate the to c #
OCollective=CType (m_oServer, PISDK IPICollective)
OPoint=Nothing
OPoint=oCollective. PIPoints. Item (strPiTag)

If Not oPoint Is Nothing Then
OPoint. Data. UpdateValue (strVal, dblUTCSecs, DataMergeConstants dmInsertDuplicates, Nothing)
End the If
? Open the About - PISDK, click on the buffer & gt; PI buffer allocation, cancel the "enable SDK buffer" check box, click the "save"
? Ensure that the PI is not running buffer subsystem (in the services. The MSC in),
  •  Tags:  
  • C#
  • Related