Martin's corner on the web

Measuring the solar yield

As I already mentioned before, I have an non pressurized evacuated tube solar water heater on my roof. In that same post I outline the possibility to calculate the solar energy that will fall on a flat surface (panel) with arbitrary tilt and azimuth at any given day and time. The user AminfiBerlin immediately asked the natural question: Can you compare that against the actual yield? I my answer I replied I had some idea. Later that day,  of openenergymonitor.org posted his work on the exact same subject in this blog post.

My approach is a bit different from Trystan’s, I’d rather do the calculation as a part of the input processing in emoncms rather than calculate these with Javascript on report run-time. Also, I have only one temperature in the upper half of the horizontal hot water tank, whereas his is probably vertical and therefore he uses two temperature sensors to average the readings.

So, I created the following input processor, named it heat flux calculator, edit emon/Models/process_model.php to add it:

 

// DO NOT forget to add:     $list[17] = array( "heat flux" ,		2,		"heat_flux",		1	);
// to function get_process_list() so that this processor is visible

  //------------------------------------------------------------------------------------------------------
  // Calculate the energy used to heat up water based on the rate of change for the current and a previous temperature reading
  //------------------------------------------------------------------------------------------------------
  function heat_flux($feedid,$time_now,$value)
  {
	// Get the feed
	$feedname = "feed_".trim($feedid)."";

	// Get the current input id
	$result = db_query("Select * from input where processList like '%:$feedid%';");
	$rowfound = db_fetch_array($result);
	if ($rowfound)
	{
		$inputid = trim($rowfound['id']);
		$processlist = $rowfound['processList'];
		// Now get the feed for the log to feed command for the input
		$logfeed = preg_match('/1:(\d+)/',$processlist,$matches);
		$logfeedid = trim($matches[1]);
		// Now need to get the last but one value in the main log to feed table
		$oldfeedname = "feed_".trim($logfeedid)."";

		// Read previous N readings, starting not from the latest one, but the one before it (LIMIT 1,N)
		// Find a previous reading that is at least 4 minutes apart from the current reading and average the in-between readings to smooth out fluctuations
		// Without this we will get unstable readings

		$lastentry = db_query("Select * from $oldfeedname order by time desc LIMIT 1,128;");
		$lastentryrow = db_fetch_array($lastentry); 

		$time_prev  = trim($lastentryrow['time']);	//Read the time of previous reading
		$prevValue = trim($lastentryrow['data']);		//Get previous reading

		while($lastentryrow = db_fetch_array($lastentry)) {

		$time_prev  = trim($lastentryrow['time']);
		$prevValue += trim($lastentryrow['data']);	 //Average out readings, smooth out fluctuations
		$prevValue = $prevValue/2;

		if(($time_now-$time_prev)> 60*8) break;		//Scan for a value 4 minutes apart from this reading, if possible. This means the power calc lags a bit also
									//Comparing against reading that is only 15 seconds ago makes the graphs go crazy
									//because a false 0.01 change in temperature readings for 220l water tank in 15 seconds means 613.94W flux reading
		}

		$ratechange = $value - $prevValue;
		$TimeDelta  = $time_now - $time_prev;		//Calculate time in seconds that has elapsed since then

		/* debug
		//http://harizanov.com/emon/api/post?apikey=zzzzzzzzzzzzzzzzzzzzzzzzzz&json={"TinyTemp7":34.31}
		echo("Prev value is "); echo($prevValue ); echo("<br>");
		echo("New value is "); echo($value); echo("<br>");
		echo("ratechange is "); echo($ratechange ); echo("<br>");
		echo("Prev time is "); echo($time_prev); echo("<br>");
		echo("New time is "); echo($time_now ); echo("<br>");
		echo("time delta is is "); echo($TimeDelta); echo("<br>");
		*/

		$ratechange = ($ratechange*4186/$TimeDelta);     //Calculate the temperature change per second
									//Specific heat of Water (4186 J/kg/K)
									//Multiply by the volume in liters in emoncms as a next step of the processing
    }
	return($ratechange);
  }

So, this will calculate the heat flux, but you need to multiply it by the volume of you hot water tank, here is how:

I tested it with an immersion heater on my other water tank and it is spot on..neat.

So here is my solar yield for today in multigraph:

Starting temperature is 40.62 degrees C and at the end of the day (at least the sunshine) it is 72.25 degrees C. It has been mostly sunny,  apart for a thunderstorm with hail that is clearly visible by the drop of solar power, but then was all sunny again.

So for ten hours today, my 220l solar hot water heater managed to warm up water by 31.63 degrees C, or that would mean it managed to absorb 7.8KWh solar energy.

 

 

 

 

8 thoughts on “Measuring the solar yield

  1. Trystan

    Just seen your blog post, we’re thinking along similar lines,
    I agree that the optimum place for this is in the input processor, I was just doing it in javascript as I wanted to be able to apply it to all my historical data at the same as I was developing it.
    nice work!
    Trystan

  2. Pingback: Solar statistics | Martin's corner on the web

  3. Pingback: Hot water usage analysis | Martin's corner on the web

  4. Pingback: Using my 1.8 TFT as a Raspberry Pi status display | Martin's corner on the web

  5. Pingback: Solar water heating in the winter | Martin's corner on the web

  6. Pingback: Domestic hot water for free | Martin's corner on the web

  7. Pingback: Improving my home automation system’s Data Quality | Martin's corner on the web