承接 abbadon1334/sun-position-spa-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

abbadon1334/sun-position-spa-php

Composer 安装命令:

composer require abbadon1334/sun-position-spa-php

包简介

solar data calculation and sun position

README 文档

README

SPA Sun Position Calc Library for PHP

Build Status Coverage Status Maintainability Test Coverage Codacy Badge Codacy Badge

This library is based on the work of Ibrahim Reda and Afshin Andreas (SPA) Solar Position Algorithm for Solar Radiation Applications ( 2008 National Renewable Energy Laboratory )

Abstract from the original study

There have been many published articles describing solar position algorithms for solar radiation applications. The best uncertainty achieved in most of these articles is greater than ±0.01 / in calculating the solar zenith and azimuth angles. For some, the algorithm is valid for a limited number of years varying from 15 years to a hundred years. This report is a step by step procedure for implementing an algorithm to calculate the solar zenith and azimuth angles in the period from the year -2000 to 6000, with uncertainties of ±0.0003°

PHPUNIT TEST

Library test data vs Table A.4 of the original study

C Source code for Solar Position Algorithm (SPA)

http://www.nrel.gov/midc/spa/

Requirements

  • PHP 7.2
  • PHP 7.3
  • PHP 7.4

Composer install

composer require abbadon1334/sun-position-spa-php

Simple Usage

$SD = new SolarData\SolarData();

/* ARGS : observer latitude, observer longitude, observer altitude */
$SD->setObserverPosition(39.742476,-105.1786,1830.14);

/* ARGS : Observer Date : Year, Month, Day */
$SD->setObserverDate(2003, 10, 17);

/* ARGS : Observer Time : Hours, Minutes, Seconds */
$SD->setObserverTime(12, 30,30);

/* ARGS : difference in seconds between the Earth rotation time and the Terrestrial Time (TT) */
$SD->setDeltaTime(67);
/* ARGS : Observer Timezone */
$SD->setObserverTimezone(-7);

/* ARGS : Observer mean pressure in Millibar */
$SD->object->setObserverAtmosphericPressure(820);

/* ARGS : Observer mean temperature in Celsius */
$SD->object->setObserverAtmosphericTemperature(11.0);

/* calculate sun position */
$SunPosition = $SD->calculate();

Available attributes after calculate() :

I know this attributes names are not so ortodox. Formulas that are present in the original document are really complex and using the same name for variables is a big aid for debugging

  • Earth heliocentric longitude (degrees)
  • Earth heliocentric latitude (degrees)
  • R Earth radius vector, R (in Astronomical Units, AU)
  • Θ° geocentric longitude (degrees)
  • β° geocentric longitude (degrees)
  • X nutation in longitude and obliquity
  • ε° true obliquity of the ecliptic (degrees)
  • Δτ aberration correction (degrees)
  • λ° apparent sun longitude (degrees)
  • ν° apparent sidereal time at Greenwich (degrees)
  • ν0° apparent mean sidereal time at Greenwich (degrees)
  • α° geocentric sun right ascension (degrees)
  • α´° topocentric sun right ascension (degrees)
  • δ° geocentric sun declination (degrees)
  • δ´° topocentric sun declination (degrees)
  • Observer hour angle (degrees)
  • H´° topocentric hour angle (degrees)
  • ξ° equatorial horizontal parallax of the sun (degrees)
  • topocentric zenith angle (degrees)
  • Γ° topocentric astronomers azimuth angle (degrees)
  • Φ° topocentric azimuth angle, M for navigators and solar radiation users (in degrees)
  • e0° topocentric elevation angle without atmospheric refraction (in degrees)
  • topocentric elevation angle (in degrees)
  • Eot Equation Of Time

Example to get angle H° - Observer hour angle (degrees)

$SD = new SolarData\SolarData();

/* ARGS : observer latitude, observer longitude, observer altitude */
$SD->setObserverPosition(39.742476,-105.1786,1830.14);

/* ARGS : Observer Date : Year, Month, Day */
$SD->setObserverDate(2003, 10, 17);

/* ARGS : Observer Time : Hours, Minutes, Seconds */
$SD->setObserverTime(12, 30,30);

/* ARGS : difference in seconds between the Earth rotation time and the Terrestrial Time (TT) */
$SD->setDeltaTime(67);
/* ARGS : Observer Timezone */
$SD->setObserverTimezone(-7);

/* ARGS : Observer mean pressure in Millibar */
$SD->object->setObserverAtmosphericPressure(820);

/* ARGS : Observer mean temperature in Celsius */
$SD->object->setObserverAtmosphericTemperature(11.0);

/* calculate sun position */
$SunPosition = $SD->calculate();

to get H° Observer hour angle (degrees)

echo $SunPosition->H°;

*Example to get fraction day for sunrise - transit - sunset *


$SD = new SolarData\SolarData();

/* ARGS : observer latitude, observer longitude, observer altitude */
$SD->setObserverPosition(39.742476,-105.1786,1830.14);

/* ARGS : Observer Date : Year, Month, Day */
$SD->setObserverDate(2003, 10, 17);

/* ARGS : Observer Time : Hours, Minutes, Seconds */
$SD->setObserverTime(12, 30,30);

/* ARGS : difference in seconds between the Earth rotation time and the Terrestrial Time (TT) */
$SD->setDeltaTime(67);
/* ARGS : Observer Timezone */
$SD->setObserverTimezone(-7);

/* ARGS : Observer mean pressure in Millibar */
$SD->object->setObserverAtmosphericPressure(820);

/* ARGS : Observer mean temperature in Celsius */
$SD->object->setObserverAtmosphericTemperature(11.0);

/* calculate sun position and calculate sun rise transit set angles 
ARGS : true = call ->calculate()
*/
$SunPosition = $SD->calculateSunRiseTransitSet(true);

$SunRiseDayFraction = $SunPosition->DayFractionSunrise;
$TransitDayFraction = $SunPosition->DayFractionTransit;
$SunsetDayFraction  = $SunPosition->DayFractionSunset;

Get Sun Incidence Angle


$SD = new SolarData\SolarData();

/* ARGS : observer latitude, observer longitude, observer altitude */
$SD->setObserverPosition(39.742476,-105.1786,1830.14);

/* ARGS : Observer Date : Year, Month, Day */
$SD->setObserverDate(2003, 10, 17);

/* ARGS : Observer Time : Hours, Minutes, Seconds */
$SD->setObserverTime(12, 30,30);

/* ARGS : difference in seconds between the Earth rotation time and the Terrestrial Time (TT) */
$SD->setDeltaTime(67);
/* ARGS : Observer Timezone */
$SD->setObserverTimezone(-7);

/* ARGS : Observer mean pressure in Millibar */
$SD->object->setObserverAtmosphericPressure(820);

/* ARGS : Observer mean temperature in Celsius */
$SD->object->setObserverAtmosphericTemperature(11.0);

  • no need of calling calculate *
/* ARGS : tilt angle from horizontal plane, rotation angle from real south  */
$Surface2SunAngleOfIncidence = $SD->getSurfaceIncidenceAngle(30,-10)

abbadon1334/sun-position-spa-php 适用场景与选型建议

abbadon1334/sun-position-spa-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 57.69k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2017 年 05 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 abbadon1334/sun-position-spa-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 abbadon1334/sun-position-spa-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 abbadon1334/sun-position-spa-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 57.69k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 39
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-07