[insert_php]
if(isset($_POST[‘electricity’]) && isset($_POST[‘roofarea’])&& isset($_POST[‘solar_gen’]) ) {
$servername = ‘localhost’;
$username = ‘solarman_cal’;
$password = ‘mv)f848R4h~&’;
$dbname = ‘solarman_tools’;
// Create connection
$conn = mysql_connect($servername, $username, $password) or die(“Unable to connect to MySQL”);
mysql_select_db($dbname, $conn );
$e=($_POST[‘electricity’]);
$r=($_POST[‘roofarea’]);
$u=($_POST[‘solar_gen’]);
$ip = $_SERVER[‘REMOTE_ADDR’];
$date= date(‘Y-m-d’);
$sql = “INSERT INTO `energy_consumption` (`electricity`, `roofarea`, `solar_gen`, `date`, `ip`) VALUES (‘$e’,’$r’,’$u’,’$date’,’$ip’)”;
if (mysql_query($sql) === TRUE) {
} else {
echo “Error: ” .mysql_error() . “
“;
}
mysql_close($conn);
if(!empty($_POST[‘electricity’]) &&!empty($_POST[‘roofarea’]) &&!empty($_POST[‘solar_gen’]) ) {
$e=($_POST[‘electricity’]);
$e1 = str_replace( ‘,’, ”, $e );
if( is_numeric( $e1 ) ) {
$e = $e1;
}
$r=$_POST[‘roofarea’];
$r1 = str_replace( ‘,’, ”, $r );
if( is_numeric( $r1 ) ) {
$r = $r1;
}
$u=($_POST[‘solar_gen’]);
$g=(($r/10)*$u*30*0.8);
if($g <= $e){
$o= (($g*100)/$e);
if($o<=25) {
echo "
| Electricity consumption per month | “; echo number_format($e); echo ” kWh |
| Roof area available | “;echo number_format($r); echo ” Sq. m. |
| Rate of sunshine availability | “;echo $u; echo ” kWh per day |
|
Solar energy that can be generated for a month |
“; echo ” “;echo number_format($g);echo ” Units |
|
% of your monthly consumption that can be met with solar |
“; echo round($o,2);echo “% |
- We take 10 Sq. m. as the required area for 1 kW solar panels
- Please note that the % is the maximum possible contribution, and might be lower if a large % of electricity is consumed mainly during non-sunlight hours and the solar plant does not use batteries to store solar power to use in the non-sunlight hours
- Panel efficiency is assumed to be 16%. For higher efficiency panels, a smaller roof top area will give a higher output
- Only 80% of available area is considered for calculations , to accommodate for shading losses
Looking to own customized calculators?
Talk to ramya@solarmango.com
}
else if(($o>25)&&($o<=100)) { echo "
| Electricity consumption per month | “; echo number_format($e); echo ” kWh |
| Roof area available | “;echo number_format($r); echo ” Sq. m. |
| Rate of sunshine availability | “;echo $u; echo ” kWh per day |
|
Solar energy that can be generated for a month |
“; echo ” “;echo number_format($g);echo ” Units |
|
% of your monthly consumption that can be met with solar |
“; echo round($o,2);echo “% |
- We take 10 Sq. m. as the required area for 1 kW solar panels
- Please note that the % is the maximum possible contribution, and might be lower if a large % of electricity is consumed mainly during non-sunlight hours and the solar plant does not use batteries to store solar power to use in the non-sunlight hours
- Panel efficiency is assumed to be 16%. For higher efficiency panels, a smaller roof top area will give a higher output
- Only 80% of available area is considered for calculations , to accommodate for shading losses
Looking to own customized calculators?
Talk to ramya@solarmango.com
}
}
else {
$i=(($e/120)*10);
$o= (($g*100)/$e);
$x=(($i*100)/($r*0.8));
echo “
| Electricity consumption per month | “; echo number_format($e); echo ” kWh |
| Roof area available | “;echo number_format($r); echo ” Sq. m. |
| Solar generation per kW per day | “;echo $u; echo ” kWh |
|
Solar energy that can be generated for a month |
“; echo ” “;echo number_format($g);echo ” Units |
|
% of your monthly consumption that can be met with solar |
“; echo round($o,2);echo “% |
- We take 10 Sq. m. as the required area for 1 kW solar panels
- Please note that the % is the maximum possible contribution, and might be lower if a large % of electricity is consumed mainly during non-sunlight hours and the solar plant does not use batteries to store solar power to use in the non-sunlight hours
- Panel efficiency is assumed to be 16%. For higher efficiency panels, a smaller roof top area will give a higher output
- Only 80% of available area is considered for calculations , to accommodate for shading losses
Looking to own customized calculators?
Talk to ramya@solarmango.com
}
} else {
echo “
To view results, please fill all the fields correctly
}
}
[/insert_php]
