Is there any information on how to get the logs off of the Classic through Modbus? The current on-line MidNite Solar MODBUS Network Spec from May 2011 states that information on how do that is "coming soon".
Thanks,
David
Quote from: David on July 23, 2012, 09:57:13 AM
Is there any information on how to get the logs off of the Classic through Modbus? The current on-line MidNite Solar MODBUS Network Spec from May 2011 states that information on how do that is "coming soon".
Thanks,
David
Yeah, we should get that in there shouldn't we ?
There are quite a few new things we should document in that file.
Will try to get that done soon.
boB
Bob,
A little more info on Modbus would be helpful...and appreciated.
I am a Linux user and the App upgrades are not supported now. I have been able to get a Modbus scanner working thru Wine/TCP... Logging is the final goal, sooner or later it will happen.
I understand the economic drivers and that is reality.
thanks,
steve
Hi all,
Always in my Classic logging quest, after using the Local App, i'm researching something that let me see the Classic's Data.
So I'm learning ModBus on the Classic.
On a local WebServer, I installed a PHP Modbus library :
http://code.google.com/p/phpmodbus/
After that, I created the following PHP Code :
Quote
<?php
require_once dirname(__FILE__) . '/../Phpmodbus/ModbusMaster.php';
// Create Modbus object
$modbus = new ModbusMaster("192.168.1.52", "TCP");
try {
// 4132 (AVG_Battery_Voltage,Kw_Day, Battery_Temp)
$recData = $modbus->readMultipleRegisters(4115, 4118, 4132);
}
catch (Exception $e) {
// Print error information if any
echo $modbus;
echo $e;
exit;
}
// Print status information
echo "</br>Status:</br>" . $modbus;
// Print read data
echo "</br>Data:</br>";
print_r($recData);
echo "</br>";
?>
Firstly, I get an error "Unable to find the create_socket function".
That was resolved by enabling the extension=php_sockets.dll in the php.ini file.
But now, when i run the PHP page, it goes in an endless loop.
Are these parameters OK :
Protocol : TCP ??
Port : 502 ??
What else ??
Yann
Quote from: Lya72 on August 04, 2012, 05:48:37 PM
On a local WebServer, I installed a PHP Modbus library :
http://code.google.com/p/phpmodbus/
Are these parameters OK :
Protocol : TCP ??
Port : 502 ??
What else ??
Yann
Hey Yann !! Yes, those parmaters look OK to me.
Regarding readMultipleRegisters(4115, 4118, 4132)....
....I would have thought that this command would have a start address and a register amount to read, since read or write multiple is usually organized as having all registers in sequence, so I would question how you are calling that, but you might be just fine as is.
Or, maybe that is a problem if it is starting at register 4115 and trying to read 4000+ registers !
Does it return anything ?
Thanks for the link on the PHP modbus. Now I will have to look into that.
There is also Python modbus, Java modbus (jamod) and others.
I'm glad there is so much to choose from !
boB
boB,
You neglected to mention yours truly's "j2mod". Which actually has the READ FILE RECORD Modbus methods. I'd think that for log file reading you'd use a record structured routine ...
And when are you going to open a Modbus/TCP port back up to me? I've not poked at your gear in =months=.
Hi TG,
I'm reading your post with Google traduction, and I think, there are hidden messages in it :o
Are you saying that there is no Modbus/TCP port open on the Classic, and that's why my PHP page goes in an endless loop, whitout returning something ??
Yann
Quote from: Lya72 on August 05, 2012, 04:29:08 PM
Hi TG,
I'm reading your post with Google traduction, and I think, there are hidden messages in it :o
Are you saying that there is no Modbus/TCP port open on the Classic, and that's why my PHP page goes in an endless loop, whitout returning something ??
Yann
No, there is definitely modbus over TCP. I just was not sure if the way you were using read multiple registers was being applied like I thought it was or if those numbers in the parentheses() needed to be adjusted. It looks like the register numbers in your example is trying to read 3 or 4 different registers but what I am familiar with is that you set the first register and then read a certain numbers of registers after that rather than specifying which registers to individually access and read.
Now, your PHP modbus code certainly can read a list of registers but the name "read multiple" from what I have seen usually means to read a certain number of registers starting at one register address. I have not had a chance to look at the PHP modbus code but I did download it.
boB
PS, Julie, Tallgirl is needing a nice warm fresh Classic to play with online.
Quote from: tallgirl on August 05, 2012, 03:57:52 PM
boB,
You neglected to mention yours truly's "j2mod". Which actually has the READ FILE RECORD Modbus methods. I'd think that for log file reading you'd use a record structured routine ...
And when are you going to open a Modbus/TCP port back up to me? I've not poked at your gear in =months=.
TallGirl
I can do a couple things. I can wire up a Classic for you to talk to or I can let you into one of my live working units. I would prefer to get one wired up and let you have at it. Give me a day and I will send you the IP and Port. Shoot me a PM or Email with your Email as I think it has changed no?
Ryan
Ryan,
Yes, the best e-mail to reach me at is jfh AT ghgande DOT com. I'm moving away from greenhousepc because too many people want to know what kind of PCs I sell ...
I have started a device driver for the Classic, and would love to add support. I just can't seem to keep my hands on one, so to speak, long enough to do that ...
Hi All,
Firstly : To connect to the Classic with a ModBus Client, the Local App must not be running !!
After stopping the Local App, the connexion was good with an Ipad Client (GSI ModBus Test Lite)
(see 1st capture below)
Secondly : Once connected to the Classic, there is no response from the server, following a read request (of one register).
(2nd capture below)
For the PHP request, the progress is the same, the endless loop was replaced by a return :
Quote
readMultipleRegisters: START
Connected
Packet: 408200000006130310161024
Send
Wait data ...
Wait data ...
Wait data ...
Wait data ...
Wait data ...
Wait data ...
Wait data ...
Wait data ...
Wait data ...
Wait data ...
Wait data ...
Wait data ...
Wait data ...
Wait data ...
Wait data ...
exception 'Exception' with message 'Watchdog time expired [ 5 sec]!!! Connection to 192.168.1.52 is not established.'
It seems to me, that I'm alone in this logs quest.
Thanks to give me no promises, but visibility.
Yann
Yann, try device ID of 10 (decimal) instead of 1 and let's see if that helps.
boB
Hi Bob,
That's a good proposal ==> now, I have registers value :)
That's time to read the manual to get the good registers numbers to look at.
(Please version the manuals with a release number and a release date - I was having different versions on my Ipad and on my computer)
Some values surprised me and after hours, I have the following question :
Is the latest Classic manual up to date for the ModBus registers numbers or my ModBus client isn't showing them correctly ?
In my opinion,
4114 = Average Battery Voltage (Manual says RestartTimerms ???)
4115 = Average PV Input Voltage (Manual says Average Battery Voltage)
4116 = ?? (Manual says Average PV terminal Input)
4117 = Production of the day ? (Manual says Average Battery Current )
4118 = Instantaneous watts production (Manual says Average Energy to the Battery -This is reset once per day)
4132/4133/4134 = Temps . How do you switch them from °F to °C ??
Thansks in advance.
Yann
Quote from: Lya72 on August 08, 2012, 06:36:38 AM
Hi Bob,
That's a good proposal ==> now, I have registers value :)
That's time to read the manual to get the good registers numbers to look at.
(Please version the manuals with a release number and a release date - I was having different versions on my Ipad and on my computer)
Some values surprised me and after hours, I have the following question :
Is the latest Classic manual up to date for the ModBus registers numbers or my ModBus client isn't showing them correctly ?
In my opinion,
4114 = Average Battery Voltage (Manual says RestartTimerms ???)
4115 = Average PV Input Voltage (Manual says Average Battery Voltage)
4116 = ?? (Manual says Average PV terminal Input)
4117 = Production of the day ? (Manual says Average Battery Current )
4118 = Instantaneous watts production (Manual says Average Energy to the Battery -This is reset once per day)
4132/4133/4134 = Temps . How do you switch them from °F to °C ??
Thansks in advance.
Yann
Yann, I'm glad the ID changed to 10 (ten) helped !
No, the manual and modbus register list is not up to date. We are working on that.
I will try to give you information on reading logs through the 2 modbus registers
sooner than that though.
As for temperature, there is no switch as of yet for C to F conversion. The Local App does this itself.
Temperatures are all in C right now from the Classic.
boB
Hi Bob,
Reference to your latest post, have you found the key of the desk where are stored the latest Classic ModBus specifications ???
My Classic is speaking to the Web but I need a dictionnary to understand him...
Also, always interested in how to read Classic logs via ModBus registers.
Thanks in advance.
Yann
Yann,
Your efforts are motivating me to have another go at Modbus....
It worked for me using a Modbus reader called Ananas with Wine/Linux, but massaging the data is another story. There is a lot to learn, but all fun.
Lurking in the shadows, but following your progress, keep it up.
thanks
steve
Quote from: Lya72 on August 16, 2012, 10:10:25 AM
Hi Bob,
Reference to your latest post, have you found the key of the desk where are stored the latest Classic ModBus specifications ???
My Classic is speaking to the Web but I need a dictionnary to understand him...
Also, always interested in how to read Classic logs via ModBus registers.
Thanks in advance.
Yann
Yann, I have been working on the writeup for this. Here is what I have so far for retrieving single data points by way of simple modbus registers.
This is fine for single points but for say, graphing, you might want to use the modbus file transfer method to get 32 points at one time.
That is how the MNGP retrieves data for its graphing, but the single "textual" readout uses this retrieval method. I will get to writing up the
file retrieval method later. Hopefully this helps to get you started in understanding how this works.
This text tries to explain one of the two methods to retrieve internal Classic data logs.
This one retrieves one daily or recenty history (minutely) at a time. The other method
retrieves 32 data points at a time using modbus file transfer.
To read a logged data value from the Classic's EEprom, first combine the dayly or minute log index,
(index means how many records ago), with the category of data you want to retrieve.
Category examples include, maximum power for a past day or what stage the charger was in
23 records ago. "Minute Logs" is the same as "Recent History" and may be acquired as often
as 1 minute apart and up to 380 records total. After 380 records are stored in the Classic,
the oldest data is overwritten with the penultimate (next to last) data point values.
In the future, there may be more categories, but at the moment, there are less than 8
for Daily and Recent History logs. Daily logs are stored (usually) at midnight every day.
Actually, they are stored by the clock at 23:59 hours:minutes. If the clock in the Classic has
not been set by the MNGP, this may happen 2 hours after the Classic last went to Resting.
At this time, the Classic's internal clock will be set to 23:59. This might happen with a
Classic-Lite where no MNGP (graphics panel) is present.
Summary of the 3 main data logging retrieval registers. " | " is logical OR
Normal modbus convention will make it necessary to add 1 (one) to these register numbers.....
Modbus Address --- Register --- Index OR'd with Category to return in the LogValueRead Register
4253 DaylyLogCatIndex = [-DAY & 0x03ff] | [ (DaylyLogCategory & 0x3ff) << 10 ]
4254 LogValueRead = Value returned after requested input changes
4255 MinLogCatIndex = [-MINUTERECORD & 0x03ff] | [ (MinuteRecordCategory & 0x3ff) << 10 ]
4135 MinuteLogIntervalSec = How many seconds between data logging intervals. (Minimum of 60 seconds)
Logging Interval has a default of ten (10) minutes but will be changed eventually to every 5 minutes (300 seconds)
MinuteLogIntervalSec is remembered in the Classics EEProm
For example, request the charge stage category (5) from 2 minutely log records ago....
(2 records would be 2 X 10 minutes ago if interval is 10 minutes)....
decimal binary binary hex
2 | (5 << 10) = ( 0010 | 01010000000000) = 01010000000010 = 0x1402
The value returned in LogValueRead, (register 4254), will not be filled with a
return category value until one of the combination index/category input registers,
(DaylyLogCategory or MinLogCatIndex), change request value.
This means that if you want to read a value twice, the request register must
change and then be changed back again to request the logged data point again.
The minus sign in front of MINUTERECORD and DAY index is to represent that these index
numbers are past histories. All values are unsigned and an index of zero is undefined.
Minute Logs Category (MinuteRecordCategory)
0 Watts
1 PV input voltage (times 10 with tenth digit in LSDigit)
2 Battery Voltage (times 10 with tenth digit in LSDigit)
3 Time Stamp Low
4 Time Stamp High
5 Charge Stage ( in high byte of 16 bit result)
6 Battery Amps Out (times 10 with tenth digit in LSDigit)
7 kW-Hours (times 10 with tenth digit in LSDigit)
Daily Logs Category (DaylyLogCategory )
0 kW-Hours (times 10 with tenth digit in LSDigit)
1 Amp-Hours (Not used yet)
2 Float Time in Minutes
3 Dailys Time Stamp Low
4 High Power watts
5 High FET Temperature (Celcius)
6 Dailys Time Stamp High
7 High PV Input Voltage (times 10 with tenth digit in LSDigit)
8 High Battery Voltage (times 10 with tenth digit in LSDigit)
Time Stamp
TimeStampLow = (MONTH & 0x0f) | ((DOM & 0x1f) << 4) | ((((YEAR - 2000) & 0x7f) << 9))
TimeStampHigh = (MINUTE & 0x3f) | ((HOUR & 0x1f) << 6)
DOM = Day Of Month, Year is encoded as years after 2000
Charge Stage (High byte of 16 bit returned value)
Stage = value >> 8
Resting 0
Absorb 3
Bulk Mppt 4
Float 5
Float Mppt 6
Equalize 7
Eq Mppt 18
[/font]
P.S. Does anyone have an idea why I get the end font html tag printing at the end here ?? AFAIK, it should be "silent" and not actually displayed.
Hi Bob,
I was on my roof, increasing my panels power and you answered !!
Unattended :P
On my first read, it seems complex to me.
First of all, i need to reorder your writes.
Secondly, the difficulty is with the Index and category combination.
Do I need to write a calculated value in a register to be able to read the requested result in another register ?,
The calculated value is obscur for me and the writable register is the same as the register giving the requested result ?
Thanks for the precisions.
Yann
Quote from: Lya72 on August 22, 2012, 02:51:41 AM
First of all, i need to reorder your writes.
Secondly, the difficulty is with the Index and category combination.
Do I need to write a calculated value in a register to be able to read the requested result in another register ?,
Yann
Yann, I probably actually need to re-write some of my writing. It is kind of complicated but as complicated
as some methods I have seen over the years.
The LogValueRead register returns any of the requested information... Either from a Day by day log (Dailys)
or a minute by minute (Minutely) log entry.
You do not have to calculate where in memory anything is... You only need to give it an index which is how
many log entries ago you want to retrieve. Index of 1 is 1 entry ago (Yesterday for Dailys), Index of 2
is 2 days ago, Index of 3 is 3 days ago, etc...
The log values are internally stored as a circular buffer and has an internal pointer to where "NOW" is
so it knows where the index will point to in that buffer.
I will re-read and re-clarify as I can. Thanks for the help !
boB
Yann and all,
Had some success using Modpoll/Linux/RRDTool to graph data from the MS 150.
http://sunenr.homedns.org/cgi-bin/modclsc150.pl
Still have a bug in bash script....the "tail" command means the watt value below 100 is "nan"....need to find another way to parse the value. Just takes a little time.
satisfying to make pretty lines... :)
steve
ps willing to share my little bit if anyone is interested
This is excellent news, Steve!