holicz / pvgis
通过 PVGIS 的 GPS 坐标提供太阳能发电包
2.2
2022-03-24 15:46 UTC
Requires
- php: ^7.4|^8.0
- ext-json: *
Requires (Dev)
- phpstan/phpstan: ^0.12
README
composer require holicz/pvgis
需求
- PHP ^7.4|^8.0
使用方法
基本使用
<?php use holicz\PVGIS\PVGIS; use holicz\PVGIS\Adapter\PvgisAdapter; use holicz\PVGIS\Enum\Database; $latitude = '50.0898689'; $longitude = '14.4000936'; $pvgis = new PVGIS(new PvgisAdapter()); $electricityProduction = $pvgis->getElectricityProduction( $latitude, $longitude, 35, // Solar panels angle (not required) CardinalDirection::SOUTH, // Solar panels azimuth (not required) Database::SARAH // Name of the radiation database (not required) ); // Yearly sum of production $electricityProduction->getYearlyProduction(); foreach ($electricityProduction->getMonthlyProductions() as $monthlyProduction) { // Month number $monthlyProduction->getMonth(); // Sum of the monthly production $monthlyProduction->getProduction(); }
使用倍数
例如,如果您知道您有六个太阳能板,并且产量比 PVGIS 结果高 1.86 倍,则应使用倍数方法
$electricityProduction->multiply(1.86);