Polling issue with high register number with Arduino via Modbus
-
Thank you, phildunlap.
I did what you have written - moved debug-log4j.xml in place of log4j.xml, created overrides folder and subfolders, and placed the file provided by you in there. Here is the log I received: http://pasted.co/d6b935a0
I do not know much about how Modbus works "inside", but I here is the log I received for this session: http://pasted.co/10adedb5
-
How interesting! It looks like there is a duplicate class in sero-utils and my override isn't being loaded. sero-utils pulled our Jssc code! This is quite bizarre... nothing in Mango references com.serotonin.io.serial.JsscSerialPortInputStream!
Edit The below probably won't work, the package in the java is wrong! Sorry!
Well, that's probably your issue. Try placing a copy of that .class file I gave you in Mango/overrides/classes/com/serotonin/io/serial/ as well. I will investigate why it's using the Jssc from sero utils...
-
Hi, I tried placing the file into serotonin folder and when tried to enable my data source, got an error as shown below.
What could I do about it now?
-
So is there any way of solving that problem? I see than I encounter the same error message even on fresh install of Mango when creating Modbus data source and defining at least one data point.
-
Hi copytco! Sorry for the delay.
Let's try this again....
JsscSerialPortInputStream.classThis time it's the one for the Mango/overrides/classes/com/serotonin/io/serial/ directory. I am hoping the stack trace will shed more light on what could be null in that method. I'm thinking the origin is the native library for the jssc. If so, another thing to try would be to attempt communication from a different computer to the arduino. I hope being able to read the stack trace sheds some light, though.
-
Thanks, phildunlap, I used your file and this is the log I received: http://pasted.co/6ac92888
-
Hi copytco, glad that class worked! I was able to get a little more information. Can you try this attached .class in that same location ( com/serotonin/io/serial ) and let me know if it's still occurring?
-
Thanks, I see that there is no longer error message, but some other appeared. Details are here: http://pasted.co/ae06e69d To know if it resolves the aborted polls issue, I would need to let it run for couple of hours.
-
Great! I do not know what you are referring to, "but some other appeared." The only errors I see relate to your meta points having some disabled points in the context. Remember, we turned on debug logging! Please let me know if that fixes the issue for you, and I can discuss the modification I made with the other developers for integration.
-
Thanks, unfortunately I still experience those errors mentioned in the first post. Though, they seem to be a little bit less intensive.
-
How bizarre. Like I said, I think part of the error is from the native portion of the JSSC, so perhaps you could have better luck on a *nix system. It would be nontrivial to troubleshoot this more through the forum. Would you mind providing a couple details? Like, what version of windows are you using? Can you confirm the errors are still from com.serotonin.io.serial.JsscSerialPortInputStream?
My understanding of what I think it going on is that JSSC is reporting an RX event, and then we're requesting to read the number of bytes the event purports to contain. This null would suggest an RX event occurred purporting more bytes than it had (or than are actually in the buffer), which would suggest a deeper problem.
-
I run Mango on Windows 7 Home Premium, on Asus K53S with i7-2630QM CPU. All I know about those errors is that what is in the first post and while going through the log I see also something like that:
WARN 2016-01-15 19:25:18,888 (com.serotonin.m2m2.rt.dataSource.PollingDataSource.scheduleTimeout:106) - Modbus: poll at 2016/01/15 19:25:18 aborted because a previous poll started at 2016/01/15 19:25:16 is still running
DEBUG 2016-01-15 19:25:18,888 (com.serotonin.m2m2.rt.EventManager.raiseEvent:155) - Event raised: type=DataSoureEventType(dataSourceId=2, eventTypeId=4), message='Modbus': Data source with xid: DS_257972 and name: Modbus, aborted 219 polls.I can try to run fresh Mango install on virtual machine with Ubuntu installed and see what happens.
-
Seems like pretty normal conditions. It's definitely experienced heavy use on Windows 7. So, you're not getting the same NullPointerException, or you are? It's certainly possible the Arduino is saying something it shouldn't to the wire.
-
No, this exception no longer occurs. However, timeout errors are still present. I imported the project, after some modifications, to ScadaBR and It works without those errors. Also, I have set up RapidSCADA and It is also going without any timeouts on the same polling time configuration, so this drives me to conclusion, that the issue comes directly from Mango.
-
Hi copytco,
Hmm. Well, ScadaBR is using a fork of the very old Mango. I ran up the old Mango on RXTX to try and test what you're talking about on my machine. My observation was that the adapter I used to convert from USB to RS485 influenced the results I got on the reliability of the connection. Using the circuitry shipped on our embedded product, for instance, I did not suffer any polls aborted. Using a USB to 422/485 hub I had some luck overriding the timing down to 0, but didn't abort many polls either way. The two straight USB to RS485 cables I had on hand revealed one likely broken cable and one that aborts polls semi-regularly. Also, the frequency of data arriving into your database is more important than whether or not polls abort. For instance, if you point a datasource at an invalid port and set the polling faster than a subsystems' timeout on attempting to open the port, you will timeout every time.
I did not experience any significant differences running these tests against a Mango 2.1.3 instance (using RXTX and a more similar Modbus4J to ScadaBR's) vs. running it against the current Mango, except perhaps that the JSSC current version doesn't crash when the serial plug is pulled (thanks RXTX!). You can experiment with the override timing settings, but it is not trivial to actually try to bring a system into compliance with Modbus timing. The device I have on hand has a baud of 19200, though.
-
Hi phildunlap,
I use a simple USB A male to B male cable to connect my Arduino and unfortunately I am not capable of building 485 type of connection.
Any type of timing settings (even above 10 s) resulted in aborted polls in Mango, while as strict polling as 500 ms or 1 s in ScadaBR or RapidSCADA or any other Modbus Master (downloaded some applications acting as Modbus Master) do not act like Mango with the same settings. Therefore, I do not know what type of timing override I might employ to make it work.