loading

I recently added some solar power from Solar City. They monitor and record the solar output via a web based program and using this you can graph your production either by day, month, or year, but if your graph by day you can only see the production for a calendar month. This project lets you see the daily data across as long a span as you want, and also lets you process the data by smoothing to better see long term trends. You may also find the program useful as a way to graph other data, particularly that in comma separated ( csv ) files.

Step 1: ​Tools and Material

  • CSV files from Solar City ( or where ever, I provide my files as examples )
  • Python ( on a computer of course )

Step 2: ​Make and Run It

For Python I like the Spyder environment as described in Graph Instructable Views with Python Screen Scraping by russ_hensel but any Python 2.7 environment will do. ( Also any operating system ) If you do not have matplotlib or numpy you will need to add them, but I believe they are standard with Spyder.

Download the attached file and unzip in its own directory. It has some sample csv files, along with some Python files. The main program is in solar_city_plot.py. Run solar_city_plot.py. It will graph the data, or complain about missing packages ( like matplotlib ). Download missing packages until it does run.

What You Get

As downloaded you should get 2 graphs. The first is a bar graph of daily energy production for every day in the csv files. This is a lot like the Solar City supplied graph of a month of data, but can be for as long a period as you include in your files. That is the graph includes as many data files as are in the directory. The second graph is a line graph which has 3 lines on it. Each line represents all the data in all the files, but so you can see trends better when a running average is applied prior to plotting the line. The legend on the graph indicates the amount of smoothing applied.

Step 3: ​Plotting Your Own Data

Just delete or move my sample files then download your own from https://mysolarcity.com/#/monitoring/historical/da... When you name the files you need to name them so they sort in the right order from old to new. My file names look like: 2015_09_summary.csv. Then just run the program again. Use parameter.py to control which graphs you get and how many lines and smoothing is used.

Think I have finally figured out how to do code in a box, here is parameters.py:

# -*- coding: utf-8 -*-
# parameters for solar_city_plot.py

class Parameters( object ):
       """
       parameters
       manages parameter values, should be globally available,
       need to look into getter setter value idea
       may allow some to come from a file similar to an ini file
       casts parameter values to other types if necessary, like to string
       for display.
       note:
           some parameters may be marked as *todo
           beware that may be implemented or not, not yet checked.

       """
       def __init__(self,  aController  ):

          self.myController      = aController    # save a link to the controller

          # begin options...

          # title of the plot
          self.plot_title        = "Solar Energy Production By Day"
          
          # max value of y the energy per day
          self.plot_max_y             = 50
          
          # True to do bar graph, else False
          self.bargraph          = True     # True to do bar graph, else False

          # for multiple lines on one graph with different smoothings specify the
          # array below
          # ex:
          # self.smooth_vals       = [ 1, 16 ]       # two lines, no smoothing and 16 days for the running average
          # some other examples, the last on is the one that "works"
          self.smooth_vals       = []     # for no line graph = [], len - 0 
          self.smooth_vals       = [ 1, 2, 4, 8, 16 ]
          self.smooth_vals       = [ 1, 4, 16 ]
          self.smooth_vals       = [ 1, 16, 32 ]

# =================== eof ==============================

That old oscillator was the first HP product. It was named model 200A. Why?
A very good article! You gave me some ideas for future projects along this line. <br><br>I also enjoy your photo of the electronic equipment &quot;not needed for this project.&quot; I spent over 30 years in the calibration industry, mostly calibrating electronic test &amp; measuring equipment. Your photo is a storehouse of memories for me!
<p>Thanks. Some of the equipment is old stuff of mine, some I got just for the historic importance. The old HP Ossc. is the basis for the whole HP company.</p>

About This Instructable

892views

19favorites

License:

Bio: For now see me at: http://www.opencircuits.com/User:Russ_hensel
More by russ_hensel:Tic Tak Power Supply Difficult Dis-assembly: Taking Things Apart for Repair A Bit Better Bit Holder 
Add instructable to: