Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Variable info in delphi

More
01 Aug 2017 15:30 #5400 by support
Replied by support on topic Variable info in delphi
  // Instantiate the client object
  Client := TEasyUAClient.Create(nil);
 
  ReadArguments1 := CoUAReadArguments.Create;
  ReadArguments1.EndpointDescriptor.UrlString := 'http://opcua.demo-this.com:51211/UA/SampleServer';
  ReadArguments1.NodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/;i=10845';
  ReadArguments1.AttributeId := UAAttributeId_DisplayName;
 
  ReadArguments2 := CoUAReadArguments.Create;
  ReadArguments2.EndpointDescriptor.UrlString := 'http://opcua.demo-this.com:51211/UA/SampleServer';
  ReadArguments2.NodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/;i=10845';
  ReadArguments2.AttributeId := UAAttributeId_ValueRank;
 
  ReadArguments3 := CoUAReadArguments.Create;
  ReadArguments3.EndpointDescriptor.UrlString := 'http://opcua.demo-this.com:51211/UA/SampleServer';
  ReadArguments3.NodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/;i=10845';
  ReadArguments3.AttributeId := UAAttributeId_DataType;
 
  Arguments := VarArrayCreate([0, 2], varVariant);
  Arguments[0] := ReadArguments1;
  Arguments[1] := ReadArguments2;
  Arguments[2] := ReadArguments3;
 
  // Obtain values. By default, the Value attributes of the nodes will be read.
  TVarData(Results).VType := varArray or varVariant;
  TVarData(Results).VArray := PVarArray(Client.ReadMultipleValues(
    PSafeArray(TVarData(Arguments).VArray)));
 
  // Display results
  for I := VarArrayLowBound(Results, 1) to VarArrayHighBound(Results, 1) do
  begin
      Result := IInterface(Results[I]) as _ValueResult;
      WriteLn;
      WriteLn('Value: ', Result.Value);
  end;

Please Log in or Create an account to join the conversation.

More
01 Aug 2017 14:35 #5399 by alr1976
Replied by alr1976 on topic Variable info in delphi
This is my function: I have always 'FromCache' result

procedure TFormBrowser.ReadAttribute(Attributeid: Integer);
var
Count: Cardinal;
Element: OleVariant;
EndpointDescriptor: _UAEndpointDescriptor;
NodeDescriptor: _UANodeDescriptor;
NodeElement: _UANodeElement;
NodeElementEnumerator: IEnumVariant;
NodeElements: _UANodeElementCollection;
tempendpoint,tempnode :string;
temp :TUAReadArguments;
tempread :_UAReadParameters;
begin


tempendpoint := 'opc.tcp://127.0.0.1:45320';
tempnode := 'nsu=KEPServerEX;ns=2;s=TEST.000000.COMANDO';
EndpointDescriptor := CoUAEndpointDescriptor.Create;
EndpointDescriptor.UrlString := tempendpoint;
NodeDescriptor := CoUANodeDescriptor.Create;
NodeDescriptor.NodeId.NamespaceUriString := tempnode;
temp := TUAReadArguments.Create(nil);
temp.EndpointDescriptor := EndpointDescriptor;
temp.NodeDescriptor := NodeDescriptor;
temp.AttributeId := Attributeid;
temp.Connect;
tempread := temp.ReadParameters;

showmessage(tempread.tostring);
end;

Please Log in or Create an account to join the conversation.

More
01 Aug 2017 14:07 #5398 by alr1976
Replied by alr1976 on topic Variable info in delphi
Hi!

I m working on it but I don t have successfully read attributeid can you write a small example to read Attributeid in Delphi?

Thanks

Please Log in or Create an account to join the conversation.

More
01 Aug 2017 11:21 #5397 by support
Replied by support on topic Variable info in delphi
In OPC UA, all nodes have multiple attributes. By default, QuickOPC works with the Value attribute. There are other attributes that contain additional information. You can specify an AttributeID in objects like UAReadParameters.

Please Log in or Create an account to join the conversation.

More
01 Aug 2017 08:10 #5394 by alr1976
Hi!

How can I read variable info in Delphi?(Variable type,value,description and so on)

Thanks Alessandro

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.057 seconds