hullumajahull Posted December 31, 2014 Report Posted December 31, 2014 Hi. I have a V570 that collects temperature readings and stores those on SD card. PLC itself is connected to local network and so is RaspberryPi that is supposed to work as a web server, that on request grabs that datatable from plc, makes it into nice graph and shows it to client. The thing is that currently when my RP tries to run the test code(below), it says that it is unable to connect to PLC with that unitID. In my PLC settings I have set unitID to 0. When I run same code on my PC, it works like it is supposed to. Thanks in advance. using System; using Unitronics.ComDriver; namespace RTTest { class MainClass { static PLC plc; public static void Main (string[] args){ Ethernet eth = new Ethernet ("192.168.1.190", 20256, EthProtocol.TCP, 3, 3000); Console.WriteLine(eth.Connected); try{ plc = PLCFactory.GetPLC(eth, 0); plc.EventAbortCompleted+=new PLC.AbortCompletedDelegate(plc_EventAbortCompleted); }catch(Exception e){ eth.Disconnect(); Console.WriteLine ("Error1:"+e.Message+"-->("+e.TargetSite+")"+e.StackTrace+"-->"+e.Source); } try{ Console.WriteLine(plc.Version.OPLCModel); Console.WriteLine (plc.PlcName); Console.WriteLine(eth.Connected); Console.WriteLine(plc.UnitId); }catch(Exception e){ eth.Disconnect(); Console.WriteLine ("Error2:"+e.Message+"-->("+e.TargetSite+")"+e.StackTrace); } Console.Read (); } public static void plc_EventAbortCompleted(){ Console.WriteLine ("dunno"); } } }
Saragani Posted January 3, 2015 Report Posted January 3, 2015 I think that an inner exception is causing the problem. You can use the given source codes in order to debug the communication driver. My first guess is that when the driver is trying to extract the PLCs xml, the OS is preventing it. You can set the following then the program starts: PLCFactory.WorkWithXmlInternally = true; If the problem is the XML, then it should solve your problem.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now