Home > PV-Graph

PV-Graph

PV-Graph is a project mainly written in JAVA and SHELL, it's free.

Java program to display PV array power data logged by smatool

PVGRAPH

Simple utility to plot power generated by PV array.

Assumes data is stored in MySQL database by sma-bluetooth program.

Uses the JFreeChart library to do the actual plotting. You need to obtain the latest release of that library and unpack the archive in the PV-Graph source directory.

A Makefile is provided to build the program. It expects the JFreeChart library to be in ./jfreechart-1.0.13 so you will need to adjust the Makefile if your setup is different. This will produce a pvgraph.jar.

A simple shell script, pvgraph.sh, is provided to run the program - you may need to modify this to suit your setup as it needs to know where the JFreeChart jars are and also the location of mysql-connector-java.jar.

When PVGraph runs it needs a username, password and url for the MySQL connection. The easiest way to specify these is to create a pvgraph.properties file in the current directory which contains these properties:

mysql.user = USERNAME
mysql.password = PASSWORD
mysql.url = URL                 # e.g. jdbc:mysql://localhost/smatool

A basic cron-like capability to run smatool every now and then is configured with these properties:

smatool.cmd = CMDLINE           # command to execute smatool (default smatool)
smatool.period = NUM            # execute smatool every NUM minutes (default 0, disables autorun)
smatool.starthour = NUM         # don't run smatool before this hour (default 0)
smatool.endhour = NUM           # don't run smatool after this hour (default 24)
smatool.havebutton = 0|1        # display "Run smatool" button for manual updates (default 1)
smatool.printstdout = 0|1       # print smatool stdout to stdout (default 0)
smatool.printstderr = 0|1       # print smatool stderr to stderr (default 1)

Other (optional) properties are:

maxpower.day = NUM              # sets upper limit on power axis (KW) - by default, graphs auto-scale
maxpower.month = NUM
maxpower.year = NUM

colour.plot = COLOUR            # colour of plots for all inverters (colour name or 0xRRGGBB)
colour.plot.SERIAL = COLOUR     # colour of plot for a single inverter (specified by SERIAL, colour name or 0xRRGGBB)
colour.background = COLOUR      # colour of plot background (colour name or 0xRRGGBB, default is LIGHT_GRAY)
colour.chart = COLOUR           # colour of chart outside of plot area (colour name or 0xRRGGBB, default is WHITE)
colour.gridline = COLOUR        # colour of grid lines (colour name or 0xRRGGBB)

Right hand mouse button above a graph pops up a context menu, mouse scroll wheel zooms and ctrl-mouse1 pans.

Currently, the key bindings are:

d    show day view
m    show month view
y    show year view
Y    show years view

S    run smatool and update view

-    show previous day/month/year
+    show next day/month/year

C-n  open new window
C-q  close current window
C-r  update current view

Tab/S-Tab  move focus
Space      activate button
Arrow keys change tab (when tab pane has focus)