OPC simaticNET ProgID unknown - c#

I have a C# application that is running as an OPC client, with a Siemens S7-300 PLC as the device with which it needs to communicate over a DP coupler (profibus). I am using Siemens OPC Server running on a CPC to facilitate the communications, but in order to do this, I have to feed my application some OPC server information, including the Server Name and Server ProgID (which I've been told is also known as the CLSID?)
The goal is to be able to load my application onto the CPC, run it with the PLC connected to the CPC via profibus, and then have communication capabilities between software & PLC.
As a result of the research I've done so far, I have my Server Name set to localhost/OPC.SimaticNET.1 and the Server ProgID set to {B6EACB30-42D5-11D0-9517-0020AFAA4B3C} so that my actual OPC connection string looks like opcda://localhost/OPC.SimaticNET.1/{B6EACB30-42D5-11D0-9517-0020AFAA4B3C}but my program cannot read or write through the OPC server. Since I am using the DP couplers specifically, I am unsure if I should instead be using OPC.SimaticNET.DP.1 and its associated {5F30A70F-8256-4ee3-8FCD-A65CF62C25CA} CLSID. I have played around with both ideas, but neither seems to yield solid results.
What might I try to get my application to correctly communicate with the OPC server?

Related

Read Serial port via web browser

I am currently reading Modbus via Serial port (Serial.IO.Ports) using ASP.NET C# Web application, I am able to read the serial port as I am running the application on my local machine.
While working on the project, I thought that the web app won't work once deployed on server because, it will try to access server's Serial port(COM) and not client's (the one running the website) obviously.
Is there any library or package I can use to read the Serial port of the machine which is running the browser.
Let me know if I was not clear or if you need any more info.
If you're developing your app for your customer(s) you can:
1. develop windows-service that accepts http requests
2. Share the serial somehow on the ethernet so that the server
can connect to the KNOWN ip address.
Browser ( JavaScript ) can't talk directly to the serial port.
You could Try
System.IO.Ports
Use this class to control a serial port file resource. This class
provides synchronous and event-driven I/O, access to pin and break
states, and access to serial driver properties. Additionally, the
functionality of this class can be wrapped in an internal Stream
object, accessible through the BaseStream property, and passed to
classes that wrap or use streams.
https://learn.microsoft.com/en-us/dotnet/api/system.io.ports.serialport?view=netframework-4.7.2

OPC UA-.NETStandardLibrary: the simplest way to access historical data

I'm facing a task which is to extract historical data from an OPC system, and then store these data into a standalone database for our BI team.
Although I'm a experienced developer, but I never use OPC UA before. I found the latest library provided by OPC Foundation here:
https://github.com/OPCFoundation/UA-.NETStandardLibrary
There is a sample console client app in this repo. However, I didn't find any clue for HDA (Historical Data Access). So, could anyone help out?
Also, I'm actually the only IT background person in my company. The manager told me that there is another guy who is maintaining the OPC system using some 3rd party application, so that I assume that it is not necessary to implement anything about the OPC server. In other words, I suppose I just need to implement an OPC client connecting to some URLs which can be found in that OPC application. Does my assumption correct?
To sum up, there are two questions:
How to implement an OPC UA Client to extract historical data with OPC UA-.NETStandardLibrary
Given that the current OPC system is running on top of a 3rd party application, does that mean I don't need to code anything about the "Server"?
Any help will be appreciated.
Unless you actually need to support .NET Standard, you should rather be looking at a different GitHub project: https://github.com/OPCFoundation/UA-.NET . Under SampleApplications/Samples/HistoryClient you should find what you need.
And yes, if the OPC UA server is in place, configured and running, your development task should be just to write an OPC UA client. You need to "know" about what data the server presents to you through OPC (or browse for it from the code), but you need not to know about the internal implementation of the server (its code).

TCP Listener / Proxy in C#

I have several machines running an application that plays a video feed from a camera. Each machine is located behind a firewall on different LANs. I am trying to investigate an approach to be able to talk to these machines from an Azure web app and get access to the video they are streaming. I don't want to have to open ports on any LAN. My first attempt at this was to have a client running on each machine that contacts an intermediate Azure service via a TCP port, the port is kept open and the local machine sends data to the Azure service which basically downloads this data and then sends it on to any connected clients.
The problem I am having is the intermediate service essentially has to download each message and then retransmit it to any clients, I don't think this approach will scale as the intermediate server can become overrun very easily. Ideally all I would like the intermediate service to do is manage the connections between the local machines and the end client azure service so that they talk directly to one and other.
I guess this must be similar to what products like TeamViewer or LogMeIn do.
I'd appreciate any pointers or suggestions from others experience.

OPC server access remotely using OPCDA.NET tools

I am developing OPC Client in windows C#. I have developed the code and reading
OPC Items on Sampling as well as event based (OnDataChange). When I am
working with local machine then my code works fine with both Sampling as well
as OnDataChange, but when I am trying to read data from Remote OPC Server
then Sampling works fine but I am not able fetch data on event based process.
I am able to connect to the OPC Server but when i am adding subscription to
it then i am getting error.
HRESULT : 0x80040202.
group1.DataChanged += new DataChangeEventHandler(this.DataChangeHandler);
group1.AdviseIOPCDataCallback();//exception HRESULT : 0x80040202.
OPC server connected & then register the group also but i got the exception when reading data.
The issue usually is that when you use Advise(), the server will make a DCOM connection back to the client (standard DCOM connection points). The client needs to be set up properly to allow this to happen (i.e. the right security settings to allow the server to execute code on the client).
You should read this page: http://www.softwaretoolbox.com/xpsp2/, it covers a lot of recommendations on how to set up DCOM properly for OPC usage. There are a lot of security concerns here. The Software Toolbox site has a lot of great information (and videos too). If you are still having trouble getting it to work, I recommend investing in an OPC tunneling product that will allow you to do remote OPC without having to jump through all the DCOM loops.
You don't have to be using OPCDA.NET to have the same issue. You can use any OPC client and get it working first with your remote server, then focus on figuring out how to get it all hooked up in OPCDA.NET. I recommend OPC Quick Client (comes with Software Toolbox TOP Server demo).
The problem you are actually having is with the callback. In other words, it isn't the advise call that is failing you, it is the callback from the OPC server (which advise triggers). This error is usually caused by user authentication problems (i.e. the user accounts do not match on both computers). Check out the OPC server's user account on the remote computer. If it doesn't exist on your local computer, you found the problem!
There is an automated application to help you figure out your problem. I recommend you download OPC Expert (Google it). It is a free application, does not require installation, and does not change Windows Registry. It has saved me many times. Also, the vendor (OPCTI) is extremely helpful, so check them out.
That problem is because when you connect to the server, you might use the first connect function, which is server.connect();
Instead, try:
server.connect(new Opc.ConnectData(new System.Net.NetworkCredential()));
This works for me. Hope it helps:)

C# and ActiveSync communication / open and read files

I have a device connected to a host computer through cradle usb. Now, I'm just wondering if I could use C# sockets to communicate with the device (ie device sending data, host computer processing it then replying back to the device). How can I accomplish this? by that, what ip address etc etc.. do I have to change so that it would connect cause I have the sockets working on wireless. If not, then is there a way to connect to the device, open and read a file (a text document to be more specific) from the device to my host application.. any ideas?
Thanks! :)
Depending on your target device, when you connect via ActiveSync it likely makes a local RNDIS network connection between teh two devices. You can resolve "ppp_peer" as the partner's network name instead of trying to use a hard-coded IP address (IIRC the IP is different on XP than on Vista).
Be aware that it's not a full connection. TCP packets gets passed through, but things like ICMP do not.
Of course, this just gives you a socket connection, just like if you were to connect between two PCs. It's not going to allow you to do file system operations unless you have an app on the other side listening for commands. If you want that type of thing, Microsoft provides the Remote API (RAPI) interface (wrapped in managed code here)for a lot of basic commands, and it can be extended (with C) to do anything you'd like.

Categories

Resources