News:

To visit MidNite Solar click this link www.midnitesolar.com

Main Menu

Rossw's NEWMODBUS

Started by Vance_G, April 30, 2018, 12:27:24 AM

Previous topic - Next topic

Vance_G


So, new to Midnite after using lots of other solar products over the last 15 years.  Our property owner's association recently upgraded the solar system at our Manager's house, which included the purchase of a Classic 200 to replace an Outback which could not handle the higher voltage of the new array.

Everything is working fine.  We are able to remotely monitor the Classic with the Android Classic Monitor app and N1GNN's Classic Status 4 Plus program.

However, a couple of us kicked Winblows to the curb several years ago and have switched to Lubuntu, leaving us with few options for remotely monitoring the Classic.  I spent a couple hours trying to get Classic Status 4 to run under both 64-bit and 32-bit wine prefixes with no success.  Using the Midnite Local App is a no-go for me as I refuse to install ANY Adobe crapware on my otherwise well-running system.  We are both running LTS 16.04 patched up to date.

RossW's NEWMODBUS with the -p option is all we need for now.  I can take it from there by parsing the data it grabs with individual register reads into a web page later.

However, I can't get NEWMODBUS to read the Classic.  Sequence of events is as below (pasted from LXTerminal):

vance_green@vg-NUC:~/Newmodbus$ ./newmodbus -p 192.168.0.221
modbus reply error
Failed to read serial number
vance_green@vg-NUC:~/Newmodbus$

What we have tried:

Changing the LOK jumper
Running NEWMODBUS from various places, OPT, /home, its own directory.
Running from different Lubuntu machines.
Reading individual or combinations of registers.

All with the same 'failed to read..." error.

I do have the serial number, and tried various permutations of the -s option with no apparent effect.

It's almost as if the serial number no longer resides at the previous register address, but that can't be right.  Or can it?

Classic Rev. is 2126 and Network Rev. is 2122 per the Android app, if that info is of any help.

Thanks in advance for any ideas on this.  Willing to experiment to get this to work.  Have a feeling I am overlooking something basic about the Classic or NEWMODBUS.

Vance



ClassicCrazy

I haven't jumped into the Linux world too much but I did mess around in the past with modbus to the Classic once using a Raspberry Pi - which is running linux also. I got it to read some registers. I suggest you look around in the Raspberry Pi topic areas for clues on how to get it to work properly .

http://midniteftp.com/forum/index.php?board=33.0

Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system 2
 5s 135w Kyocero , 3s3p 270w Kyocera  to Classic 150 ,   8s Kyocera 225w to Hawkes Bay Jakiper 48v 15kwh LiFePO4 , Outback VFX 3648 inverter
system 3
KID / Brat portable

Vance_G

Larry:

Thanks for the response.  I believe I have read all the posts on the forum about NEWMODBUS.  I saw only one other instance of the "Failed to read..." error message as part of another post.

NEWMODBUS can clearly "see" the Classic at the provided address, it just bombs at the serial # issue.  I need some input as to why that is the case.

Maybe RussW is still around and will take pity on me...

dbcollen


RossW

You could try running   ./newmodbus -ddd -p (address)

That should give you a lot of extra verbosity about what it's trying to do, as it does it.

Eg:


./nmb -dddp 192.168.1.111
Command line scanned
Looking up host 192.168.1.111
creating pointer
Reading additional register outside cached range: 28673
Read 2 (data) bytes from addr 28673
28673: 0000
Reading additional register outside cached range: 28674
Read 2 (data) bytes from addr 28674
28674: 138f
Read serial number 5007 from device
Read 100 (data) bytes from addr 4101
4101: 0496 07dd 0608 0000 0000 1db9 0f00 601d 0000 0000 9ebf 737c 600a 0001 0212 0187 0000 0000 0000 0000 0000 0188 059e 0000 0000
4126: 6131 0000 b6fe 0000 3104 3200 00ee 0121 0174 082c 0258 01f6 0027 2a30 0000 052d 0000 0e10 0000 0001 0000 0000 0370 022b 022a
Read 100 (data) bytes from addr 4151
4151: 022b 0370 0000 2a30 0244 0210 00b2 0000 0000 0000 0000 0e10 0000 0009 0001 0064 0001 000a 0001 0000 0000 0258 0384 ffec 000a
4176: ffec 0032 04b0 0578 0a65 0578 0000 00ca 0055 0000 48c0 0041 0000 0000 0000 0188 00c8 0000 0000 0000 0000 0001 0064 03de 000a
Read 100 (data) bytes from addr 4201
4201: 0008 02da 0000 000a 0000 05fb 0001 0187 2415 6f53 616c 3272 0000 0a3a 0416 0502 07e2 00e3 0000 0000 0000 0000 ffa6 0188 0006
4226: 000a 0001 0001 0000 0186 0188 0000 0187 0010 0000 2a30 0032 6cec 0014 2000 0000 0000 003c 022b 0030 0000 0000 0000 0050 0000
Read 100 (data) bytes from addr 4251
4251: 0000 0000 0000 0000 0000 0000 0000 059e 0000 0000 0000 0000 0029 0008 0000 0000 002a 002a 0000 0000 0001 002a 011b 0190 0005
4276: 0215 0188 0096 0000 0149 0000 0000 0186 0000 2415 0014 0032 0011 e0c0 005a ea60 0000 5cc2 02b2 0000 ffc2 0000 050f 03d4 0000
Read 100 (data) bytes from addr 4301
4301: 5b5a 5e5c 6260 6664 6a68 6e6c 7270 7874 0200 0704 0d0a 1511 1e19 2823 312d 3b37 0000 0511 0000 0000 0000 0000 0000 0000 0000
4326: 000a 8000 220c 0001 0000 0000 0000 0000 0000 0000 00f0 0000 07cb 0002 0000 0012 e380 f000 e121 d02c e59f 0000 e10f 0000 0000
Solar2 Display Panel 1.0.19, RossW
State Resting because Too low of power out
Reading additional register outside cached range: 16388
Read 2 (data) bytes from addr 16388
16388: 0000
Reading additional register outside cached range: 16387
Read 2 (data) bytes from addr 16387
16387: 0579
Firmware 1401
ClassicTime 22:10:58  02/05/2018
    0 Watts out
53.0 Volts (Battery)
39.1 Volts (PV)
  0.0 Amps (Battery)
  0.0 kWh today (0 amphours)


Failing that helping directly, get back in touch with me on irc
  irc.rossw.net  in channel #otherpower
3600W on 6 tracking arrays.
7200W on 2 fixed array.
Midnite Classic 150
Outback Flexmax FM80
16 x LiFePO4 600AH cells
16 x LiFePO4 300AH cells
Selectronics SP-PRO 481 5kW inverter
Fronius 6kW AC coupled inverter
Home-brew 4-cyl propane powered 14kVa genset
2kW wind turbine

Vance_G



RossW:

Thanks for that.  I didn't realize that you could specify more than two d's when debugging.

Anyway figured it out.  Gotta tell a story for some background first.

This is a remote network completely off grid that myself and some of my neighbors use to provide some basic Internet access.  Originally, our backhaul was Starband consumer satellite, which had all kinds of weird problems due to high latency, MSS mangling, and low (21k) upload speeds.  I have a Morningstar MPPT-60 at my place that I used MSView to monitor.  Had a port forward rule in the Mikrotik RB-750 that I am using as a core router to get to port 502 on it.  Worked OK, but was dead slow.  The internal web server on the Morningstar would not run at all due to the MSS and latency issues, so this was my only option.

Anyway, as time went on, dumped Starband for a Verizon 3G M2M connection via Cradlepoint bridge, then 4G a year later.  Morningstar web server runs just fine over this connection.  I hadn't used the port forward to the Morningstar to run MSView in years, but it was still there and enabled.

You can probably guess where this is headed...

Once I disabled that port forward to 502 (which I no longer need), I was able to use NEWMODBUS via a PPtP VPN server running on the Mikrotik just fine:

++++++++++++++++++++++++++
vance_green@vg-NUC:~/Newmodbus$ ./newmodbus -p 192.168.0.221
CLASSIC Display Panel 1.0.19, RossW
State Resting because Not enough power available
Firmware 2126
ClassicTime 18:05:08  02/05/2018
    0 Watts out
50.1 Volts (Battery)
126.6 Volts (PV)
  0.0 Amps (Battery)
  2.8 kWh today (50 amphours)
vance_green@vg-NUC:~/Newmodbus$
+++++++++++++++++++++++++

Snowing and raining today.  A crappy solar day.

(one of these days should set the time on the Classic, I guess, or is that the correct date shown in "european" format?)  Time is correct...

If I wanted to keep things such that I could still use MSView with the Morningstar, I suppose I could just change the Classic's MODBUS port (I think it supports this) so that it isn't 502.  But I see no option to tell NEWMODBUS about that.  Will it just figure it out when it looks at the IP address?

Anyway, doesn't matter.  Just following though on the whole issue as a "just in case" exercise.  I can still learn things after 60 yrs.

Thanks for the guidance.

Vance

RossW

Quote from: Vance_G on May 02, 2018, 08:23:31 PM
Thanks for that.  I didn't realize that you could specify more than two d's when debugging.

I just had a look in the code, and it'll handle basically any number of -d switches, it just increments a "debug level" counter.
In the code, where there's something that "could be" displayed, I simply display (or not) based on the value of that flag. It looks like I don't have anything that needs >2 (so -d and -dd).

Quote
Anyway figured it out.  Gotta tell a story for some background first.

Always the way, for sure, and fully appreciate where you're coming from.


Quote
Once I disabled that port forward to 502 (which I no longer need), I was able to use NEWMODBUS via a PPtP VPN server running on the Mikrotik just fine:

I use (and have used) newmodbus over significant chunks of the internet. As long as the address (and port) are reachable, it just works.


Quote
(one of these days should set the time on the Classic, I guess, or is that the correct date shown in "european" format?)  Time is correct...

        printf(" %02d/%02d/%04d\n", midnite.date.day, midnite.date.month, midnite.date.year);


Quote
If I wanted to keep things such that I could still use MSView with the Morningstar, I suppose I could just change the Classic's
MODBUS port (I think it supports this) so that it isn't 502.  But I see no option to tell NEWMODBUS about that.  Will it just figure it out when it looks at the IP address?

Good point and fair question.
The framework is there for it:

  int port=502;         // modbus port number on classic

but I don't see anything that changes it. It'd be a pretty straightforward thing to add.
I don't really have the time to do it right now, but give me a whistle if it becomes urgent and I'll make time.

Quote
Just following though on the whole issue as a "just in case" exercise.  I can still learn things after 60 yrs.
Thanks for the guidance.

No probs. Glad to assist.
3600W on 6 tracking arrays.
7200W on 2 fixed array.
Midnite Classic 150
Outback Flexmax FM80
16 x LiFePO4 600AH cells
16 x LiFePO4 300AH cells
Selectronics SP-PRO 481 5kW inverter
Fronius 6kW AC coupled inverter
Home-brew 4-cyl propane powered 14kVa genset
2kW wind turbine