Home > Back-end >  Delphi by OPC server with Siemens 300 communication problems
Delphi by OPC server with Siemens 300 communication problems

Time:09-19

1, OPC Server is to use the simens.net include building, have to be able to communicate and S7-314 normal read and write,
2, Delphi and OPC communications reference this BBS posts http://bbs.csdn.net/topics/330170980/
In delhpi7.0 environment, added the simens OPC DA automation 2.0, Active pages have three controls: OPC server, OPCgroup, OPCgroups, added in the form the three controls, in addition to add a button, ready to test the connection OPC server, now just a button test connection to the OPC, is running, press the button to report errors,





All the code is as follows:
The unit Unit1;

Interface

USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls OPCSiemensDAAutomation_TLB OleServer;

Type
TForm1=class (TForm)
OPCServer1: TOPCServer;
OPCGroups1: TOPCGroups;
OPCGroup1: TOPCGroup;
For: TButton;
Procedure Button1Click (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
end;

Var
Form1: TForm1;
Group: OPCGroup;
TestItem: OPCItem;
OPCItems: string;
OPCItemsValues: string;

Implementation

{$R *. DFM}

procedure TForm1.Button1Click(Sender: TObject);
The begin
//connect the OPC
OPCServer1. Connect1 (' xingyun - PC ', ');
//xingyun - PC is my computer name, is also the name of the OPC server,
OPCServer1. OPCGroups. DefaultGroupUpdateRate:=500;
Group:=OPCServer1. OPCGroups. Add (' MyGroup);
TestItem:=Group. OPCItems. AddItem (' SCADA. YPA1_SILO_CHARGEWEIGHTACT. F_CV ', 1);

end;
End.

What do a such communication, bother to guide, appreciate!!!!!

CodePudding user response:

A Delphi procedure based on OPC and implementation method of PLC communication hope to help you
http://wenku.baidu.com/link? Url=uZ0XmuS8VHpkfEcnrA2vs3vs7paEWVMzZ2SEJqY3i3kf4NIr04AdPfMs27lpR4fJRvM7oSaItJoPvnnFNrpBunVonfDTSqyPbSs5jEUjq - I

CodePudding user response:

Is according to this method, the error

CodePudding user response:

First look, now I am doing the PC and Omron PLC, Siemens PLC, Omron has a base, to do,
Which CPU you are using is 314? Now the latest 314 c - 2 pn/DP and ET200S series support Open TCP/IP, should not need to use OPC can,

In addition, ask, what are you doing?

CodePudding user response:

Looked at the program, try once, this is not an error, because the author just routines, introduces the connection methods, your connection variable is not defined, such as: OPCServer1. Connect1 (' xingyun - PC ', '), and this' SCADA. YPA1_SILO_CHARGEWEIGHTACT. F_CV 'is a variable, it should be defined in the PLC,

To do this, must have a Siemens PLC, actual connection, and look at Siemens OPC data, a preliminary look at the, Siemens PC connection is tedious, but try, sure can,

CodePudding user response:

I met the question not to be enumerated Siemens opc server,

 
The function TForm1. OPCServerList () : a Boolean;
Var OPCServerList OPCServerName: OleVariant;
J, I: integer;
The begin
Result:=false;
Try
//FOPCServer:=TOPCServer. Create (Self);
OPCServerList:=OPCServer1. GetOPCServers;
I:=VarArrayHighBound (OPCServerList, 1);
For j:=1 to the I do
The begin
OPCServerName:=VarArrayGet (OPCServerList, j);
LboxServerName. Items. The Add (OPCServerName);
Result:=true;
end;
Except,
Result:=False;
end;
end;


But then I enumerated, the machine can to the test server (Siemens)


Murphy is OPCDAAuto. DLL version to be the problem?

CodePudding user response:

DELPHI is a high-level language, also use OPC, directly from the official DLL is not more convenient, there are detailed and the source code download:
http://blog.sina.com.cn/s/blog_16d7d3ecb0102x1z5.html

CodePudding user response:

refer to 6th floor AutoCtrl666 response:
DELPHI to high-level language, still doing with OPC, directly from the official DLL is not more convenient, there are detailed and the source code download:
http://blog.sina.com.cn/s/blog_16d7d3ecb0102x1z5.html

Interface is clear, the top,

CodePudding user response:

refer to 6th floor AutoCtrl666 response:
DELPHI to high-level language, still doing with OPC, directly from the official DLL is not more convenient, there are detailed and the source code download:
http://blog.sina.com.cn/s/blog_16d7d3ecb0102x1z5.html

Interface is clear, the top,
  • Related