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.

How to connect to SPS Siemens S7

More
21 Jun 2021 13:24 #9803 by support
Hello,

EasyDAClient.ReadMultipleItems for OPC DA corresponds to EasyUAClient.ReadMultiple for OPC UA.
If you open the solution "QuickOpcComCppExamples.sln", most examples for OPC UA are in the UADocExample project.

They are also in the documentation, e.g.:

- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...s%20of%20OPC%20UA%20Nodes.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...20nodes%20or%20attributes.html

Regarding "...i would like to try the UA way. But only, when i can use login/password instead of certification.":

You need to be aware that there are multiple security measures in OPC UA, and understand the principles. First of all, in OPC UA *applications* themselves need to authenticate to the other party (client to server, and server to client). This is *always* done using certificates, and is a different thing from *user* authentication - which can only be done after the applications mutually authenticate themselves. Application (instance) authentication is mandatory in OPC UA and must be turned on (enforced) by default in all compliant servers. The server may allow to turn it off, but it is not recommended, because you normally end up with an insecure system.

Username/password is *one* of the methods that can *then* be used to authenticate the user of the application (client) to the server. This is optional and depends on the server. Some servers do not do user authentication, only application instance authentication. Turning off application instance security AND using username/password is theoretically possible but dangerous, because you end up with the password being transferred in the plaintext. Some servers will not even allow this combination, for precisely the same reason (they may still allow insecure connections with limited features, but never a username/password on an insecured channel).

Best regards

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

More
21 Jun 2021 12:37 #9802 by support
Hello.

The PLC, by itself, certainly does not support OPC DA (the COM/DCOM based, for which we have the EasyDAClient). OPC DA would be realized by a separate PC running Windows, on which the OPC DA server would be installed, and communicate to the PLC.

If you are connecting directly to the PLC and not to some PC running the server, you will need OPC UA, I am almost sure about it. The fact that your picture lists "DA (data Access)" on the top is not in contradiction with it; by "DA (data Access)", it is meant the Data Access part of the OPC UA specification (which provides similar functionality as OPC DA, but it is a different thing).

I will reply to your later post separately.

Best regards

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

More
21 Jun 2021 11:55 #9801 by Götz Heinemann
Hi there again,
I am terribly sorry, but i didn't find any example for using OPC UA. For "ReadMultipleItems" in c++ the only structure given in the examples is "_EasyDAClientPtr". So i guess i have to use the DA (classic) way. Hopefully working with Siemens S7 PLC.

Best Regards

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

More
21 Jun 2021 08:23 #9800 by Götz Heinemann
Seems, that the pic was lost at the last entry, so here it is:

Attachments:

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

More
21 Jun 2021 08:20 #9799 by Götz Heinemann
Hi there,

it seems, that Siemens supports definitely the UA Standard. What i found, is this:


To be safe, i would like to try the UA way. But only, when i can use login/password instead of certification.

Thank you

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

More
17 Jun 2021 15:01 #9784 by support
One more thing.

If you have a license key that does not allow the Browsing Dialogs (or anything else), but you want to use them for some testing, here is what to do:

1. Uninstall your license key (License Manager utility). This will revert to "trial" license, which only delivers valid data for first 30 minutes of process run time, but it has ALL features enabled.
2. Make your tests or experiments.
3. You can use the License Manager to reinstall your commercial license key when you are finished.

Best regards

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

More
17 Jun 2021 14:35 #9783 by support
Hello,

before I can get to answering most of your question, we need to clarify whether your OPC server supports OPC-DA ("Classic", COM/DCOM-based), or OPC UA (Unified Architecture), or both; and, if it supports both, which one you want to use.

I could not tell this from your code, because it is somehow mixed up:

1) It uses the OPC-DA objects of QuickOPC.
2) ServerClass "OPCLabs.KitServer.2" also indicates OPC-DA.
3) But, "opc.tcp://192.168.1.1:4840" appears to be OPC UA.
4) Setting Port to 4840 also appears to be OPC UA.

OPC DA and OPC UA are different. In the server documentation, it should tell you which is supported. Do you have that information?

Best regards

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

More
17 Jun 2021 12:48 #9777 by Götz Heinemann
Hi there, I have to read variables from a Siemens S7, then act with them and write back the results to the SPS.
I can connect via internet browser entering IP-Addr, then with login-name and password. After this I have access to the desired variables.
As you can see in attached picture



I tried to read the variables with multiple read:
_DAReadItemArgumentsPtr ReadItemArguments0Ptr(_uuidof(DAReadItemArguments));
             ReadItemArguments0Ptr->ServerDescriptor->MachineName = L"opc.tcp://192.168.1.1:4840"; // or "192.168.1.1:4840"
	     //ReadItemArguments0Ptr->ServerDescriptor->ServerClass = L"OPCLabs.KitServer.2";
             ReadItemArguments0Ptr->ServerDescriptor->ServerClass = L"SIMOTION OPC UA"; //or "Simotion D455-2" or "D455"
	     ReadItemArguments0Ptr->ServerDescriptor->Port = 4840;
	     //ReadItemArguments0Ptr->ServerDescriptor->Path = "";
	     ReadItemArguments0Ptr->ServerDescriptor->UserName = L"username"; //"abcxyz"
	     ReadItemArguments0Ptr->ServerDescriptor->Password = L"password"; //"xxx123"
             //ReadItemArguments0Ptr->ItemDescriptor->ItemId = L"Demo.Ramp";
             ReadItemArguments0Ptr->ItemDescriptor->ItemId = L"unit.RFID_Data_Interface.udt_oRFID_Data_1.StartBit"; //or L"unit/RFID..."
 
             CComSafeArray<VARIANT> ArgumentsArray(2);
             ArgumentsArray.SetAt(0, _variant_t((IDispatch*)ReadItemArguments0Ptr));
             ArgumentsArray.SetAt(1, _variant_t((IDispatch*)ReadItemArguments1Ptr));
 
             LPSAFEARRAY pArgumentsArray = ArgumentsArray.Detach();
             CComSafeArray<VARIANT> ResultArray;
             ResultArray.Attach(ClientPtr->ReadMultipleItems(&pArgumentsArray));
             ArgumentsArray.Attach(pArgumentsArray);
 
             _DAVtqResultPtr DAVtqResultPtr(ResultArray[i]);
             ....
In simulation everything works fine, but in the real world:
Instead of results i always got exceptions. For the machinename i have several examples.
1. But what do i have to use for the serverclass. Can you give me an example for Simotion with UPC-UA extension?
I do not have the slightest idea what it could be.(Google doesn't help)
2. Is it enough to put in username and password, or do i forgot something?
3. Path and ItemId: Do i need the complete path "SIMOTION/root..." or only "unit/RFID.....StartBit"
4. In Path and ItemId: Do i have to separate with a "/" or with a "." or with a "//"

My environment is Win7, QuickOPC2018 with single license, but i can't browse in the Easy OPC DA because of error message "Option not allowed...."

Thanks and best regards
Attachments:

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

Moderators: support
Time to create page: 0.076 seconds