| 1 | package Date::Qreki; | ||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | 1 | require Exporter; | |||||||||||||||||||||||||||||||||||
| 5 | 1 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||
| 6 | 1 | our @EXPORT_OK = qw/calc_kyureki get_rokuyou rokuyou_unicode check_24sekki/; | |||||||||||||||||||||||||||||||||||
| 7 | 1 | our %EXPORT_TAGS = (all => \@EXPORT_OK); | |||||||||||||||||||||||||||||||||||
| 8 | 1 | our $VERSION = '0.07'; | |||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||
| 11 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 12 | # 旧暦計算サンプルプログラム $Revision: 1.1 $ | ||||||||||||||||||||||||||||||||||||
| 13 | # Coded by H.Takano 1993,1994 | ||||||||||||||||||||||||||||||||||||
| 14 | # | ||||||||||||||||||||||||||||||||||||
| 15 | # Arranged for Perl Script by N.Ueno | ||||||||||||||||||||||||||||||||||||
| 16 | # | ||||||||||||||||||||||||||||||||||||
| 17 | # | ||||||||||||||||||||||||||||||||||||
| 18 | # オリジナルのスクリプトは高野氏のAWKです。下記より入手できます。 | ||||||||||||||||||||||||||||||||||||
| 19 | # http://www.vector.co.jp/soft/dos/personal/se016093.html | ||||||||||||||||||||||||||||||||||||
| 20 | # | ||||||||||||||||||||||||||||||||||||
| 21 | # | ||||||||||||||||||||||||||||||||||||
| 22 | #======================================================================== | ||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||
| 24 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 25 | # 円周率の定義と(角度の)度からラジアンに変換する係数の定義 | ||||||||||||||||||||||||||||||||||||
| 26 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 27 | 1 | ▶ | use constant PI => 3.141592653589793238462; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | use constant k => PI/180.0; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||
| 30 | sub deg_cos | ||||||||||||||||||||||||||||||||||||
| 31 | 24875 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
deg_cos: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 32 | 24875 | my ($angle) = @_; | |||||||||||||||||||||||||||||||||||
| 33 | 24875 | return cos ($angle * k); | |||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||
| 36 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 37 | # 六曜算出関数 | ||||||||||||||||||||||||||||||||||||
| 38 | # | ||||||||||||||||||||||||||||||||||||
| 39 | # 引数:新暦年月日 | ||||||||||||||||||||||||||||||||||||
| 40 | # 戻値:0:大安 1:赤口 2:先勝 3:友引 4:先負 5:仏滅 | ||||||||||||||||||||||||||||||||||||
| 41 | # | ||||||||||||||||||||||||||||||||||||
| 42 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 43 | sub get_rokuyou | ||||||||||||||||||||||||||||||||||||
| 44 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
get_rokuyou: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||
| 46 | 4 | my ($year,$mon,$day) = @_; | |||||||||||||||||||||||||||||||||||
| 47 | 4 | my ($tm0,$q_year,$q_mon,$q_day,$uruu,$q_yaer); | |||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||
| 49 | 4 | ($q_yaer,$uruu,$q_mon,$q_day) = calc_kyureki($year,$mon,$day); | |||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||
| 51 | 4 | return(($q_mon + $q_day) % 6); | |||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||
| 54 | sub rokuyou_unicode | ||||||||||||||||||||||||||||||||||||
| 55 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
rokuyou_unicode: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||
| 57 | 1 | my ($year,$mon,$day) = @_; | |||||||||||||||||||||||||||||||||||
| 58 | 1 | my ($tm0,$q_year,$q_mon,$q_day,$uruu,$q_yaer); | |||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||
| 60 | 1 | ($q_yaer,$uruu,$q_mon,$q_day) = calc_kyureki($year,$mon,$day); | |||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||
| 62 | 1 | return (qw/大安 赤口 先勝 友引 先負 仏滅/)[(($q_mon + $q_day) % 6)]; | |||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||
| 64 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 65 | # 新暦に対応する、旧暦を求める。 | ||||||||||||||||||||||||||||||||||||
| 66 | # | ||||||||||||||||||||||||||||||||||||
| 67 | # 呼び出し時にセットする変数 | ||||||||||||||||||||||||||||||||||||
| 68 | # 引 数 year : 計算する日付 | ||||||||||||||||||||||||||||||||||||
| 69 | # mon | ||||||||||||||||||||||||||||||||||||
| 70 | # day | ||||||||||||||||||||||||||||||||||||
| 71 | # | ||||||||||||||||||||||||||||||||||||
| 72 | # 戻り値 kyureki : 答えの格納先(配列に答えをかえす) | ||||||||||||||||||||||||||||||||||||
| 73 | # kyureki[0] : 旧暦年 | ||||||||||||||||||||||||||||||||||||
| 74 | # kyureki[1] : 平月/閏月 flag .... 平月:0 閏月:1 | ||||||||||||||||||||||||||||||||||||
| 75 | # kyureki[2] : 旧暦月 | ||||||||||||||||||||||||||||||||||||
| 76 | # kyureki[3] : 旧暦日 | ||||||||||||||||||||||||||||||||||||
| 77 | # | ||||||||||||||||||||||||||||||||||||
| 78 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 79 | sub calc_kyureki | ||||||||||||||||||||||||||||||||||||
| 80 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
calc_kyureki: called CC=24 SCAR=40.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 81 | 9 | my ($year,$mon,$day) = @_; | |||||||||||||||||||||||||||||||||||
| 82 | 9 | my (@kyureki,$tm,@saku,$lap,@a,$i,@m); | |||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||
| 84 | 9 | my $tm0 = YMDT2JD($year,$mon,$day,0,0,0); | |||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||
| 86 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 87 | # 計算対象の直前にあたる二分二至の時刻を求める | ||||||||||||||||||||||||||||||||||||
| 88 | # chu[0,0]:二分二至の時刻 chu[0,1]:その時の太陽黄経 | ||||||||||||||||||||||||||||||||||||
| 89 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 90 | 9 | my @chu; | |||||||||||||||||||||||||||||||||||
| 91 | 9 | ($chu[0][0],$chu[0][1]) = before_nibun($tm0); | |||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||
| 93 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 94 | # 中気の時刻を計算(4回計算する) | ||||||||||||||||||||||||||||||||||||
| 95 | # chu[i,0]:中気の時刻 chu[i,1]:太陽黄経 | ||||||||||||||||||||||||||||||||||||
| 96 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 97 | 9 | ▶ | for($i=1;$i<4;$i++){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 98 | 27 | ($chu[$i][0],$chu[$i][1]) = calc_chu($chu[$i-1][0]+32.0); | |||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||
| 101 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 102 | # 計算対象の直前にあたる二分二至の直前の朔の時刻を求める | ||||||||||||||||||||||||||||||||||||
| 103 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 104 | 9 | $saku[0] = calc_saku($chu[0][0]); | |||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||
| 107 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 108 | # 朔の時刻を求める | ||||||||||||||||||||||||||||||||||||
| 109 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 110 | 9 | ▶ | for($i=1;$i<5;$i++){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 111 | 36 | $tm=$saku[$i-1]; | |||||||||||||||||||||||||||||||||||
| 112 | 36 | $tm += 30.0; | |||||||||||||||||||||||||||||||||||
| 113 | 36 | $saku[$i]=calc_saku($tm); | |||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||
| 115 | # 前と同じ時刻を計算した場合(両者の差が26日以内)には、初期値を | ||||||||||||||||||||||||||||||||||||
| 116 | # +33日にして再実行させる。 | ||||||||||||||||||||||||||||||||||||
| 117 | 36 | ▶ | if( abs( int($saku[$i-1])-int($saku[$i]) ) <= 26.0 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 118 | 0 | $saku[$i]=calc_saku($saku[$i-1]+35.0); | |||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||
| 122 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 123 | # saku[1]が二分二至の時刻以前になってしまった場合には、朔をさかのぼり過ぎ | ||||||||||||||||||||||||||||||||||||
| 124 | # たと考えて、朔の時刻を繰り下げて修正する。 | ||||||||||||||||||||||||||||||||||||
| 125 | # その際、計算もれ(saku[4])になっている部分を補うため、朔の時刻を計算 | ||||||||||||||||||||||||||||||||||||
| 126 | # する。(近日点通過の近辺で朔があると起こる事があるようだ...?) | ||||||||||||||||||||||||||||||||||||
| 127 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 128 | 9 | ▶ | if( int($saku[1]) <= int($chu[0][0]) ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | for($i=0;$i<5;$i++){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 130 | 0 | $saku[$i]=$saku[$i+1]; | |||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||
| 132 | 0 | $saku[4] = calc_saku($saku[3]+35.0); | |||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||
| 135 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 136 | # saku[0]が二分二至の時刻以後になってしまった場合には、朔をさかのぼり足 | ||||||||||||||||||||||||||||||||||||
| 137 | # りないと見て、朔の時刻を繰り上げて修正する。 | ||||||||||||||||||||||||||||||||||||
| 138 | # その際、計算もれ(saku[0])になっている部分を補うため、朔の時刻を計算 | ||||||||||||||||||||||||||||||||||||
| 139 | # する。(春分点の近辺で朔があると起こる事があるようだ...?) | ||||||||||||||||||||||||||||||||||||
| 140 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 141 | elsif( int($saku[0]) > int($chu[0][0]) ){ | ||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | for($i=4;$i>0;$i--){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 143 | 0 | $saku[$i] = $saku[$i-1]; | |||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||
| 145 | 0 | $saku[0] = calc_saku($saku[0]-27.0); | |||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||
| 148 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 149 | # 閏月検索Flagセット | ||||||||||||||||||||||||||||||||||||
| 150 | # (節月で4ヶ月の間に朔が5回あると、閏月がある可能性がある。) | ||||||||||||||||||||||||||||||||||||
| 151 | # lap=0:平月 lap=1:閏月 | ||||||||||||||||||||||||||||||||||||
| 152 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 153 | 9 | ▶ | if(int($saku[4]) <= int($chu[3][0]) ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 154 | 0 | $lap=1; | |||||||||||||||||||||||||||||||||||
| 155 | }else{ | ||||||||||||||||||||||||||||||||||||
| 156 | 9 | $lap=0; | |||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||
| 159 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 160 | # 朔日行列の作成 | ||||||||||||||||||||||||||||||||||||
| 161 | # m[i,0] ... 月名(1:正月 2:2月 3:3月 ....) | ||||||||||||||||||||||||||||||||||||
| 162 | # m[i,1] ... 閏フラグ(0:平月 1:閏月) | ||||||||||||||||||||||||||||||||||||
| 163 | # m[i,2] ... 朔日のjd | ||||||||||||||||||||||||||||||||||||
| 164 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 165 | 9 | $m[0][0]=int($chu[0][1]/30.0) + 2; | |||||||||||||||||||||||||||||||||||
| 166 | 9 | ▶ | if(defined $m[0][1] && $m[0][1] > 12 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $m[0][1] and $m[0][1] > 12
MC/DC0%0/2
defined $m[0][1] and $m[0][1] > 12
defined $m[0][1]
$m[0][1] > 12
Truth table33%1/3
A and B
A= defined $m[0][1]B= $m[0][1] > 12
| |||||||||||||||||||||||||||||||||||||
| 167 | 0 | $m[0][0]-=12; | |||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||
| 169 | 9 | $m[0][2]=int($saku[0]); | |||||||||||||||||||||||||||||||||||
| 170 | 9 | $m[0][1]=0; | |||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||
| 172 | 9 | ▶ | for($i=1;$i<5;$i++){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 173 | 36 | ▶ | if($lap == 1 && $i !=1 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$lap == 1 and $i != 1
MC/DC0%0/2
$lap == 1 and $i != 1
$lap == 1
$i != 1
Truth table33%1/3
A and B
A= $lap == 1B= $i != 1
| |||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | if( int($chu[$i-1][0]) <= int($saku[$i-1]) || int($chu[$i-1][0]) >= int($saku[$i]) ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
int $chu[$i - 1][0] <= int $saku[$i - 1] or int $chu[$i - 1][0] >= int $saku[$i]
MC/DC0%0/2
int $chu[$i - 1][0] <= int $saku[$i - 1] or int $chu[$i - 1][0] >= int $saku[$i]
int $chu[$i - 1][0] <= int $saku[$i - 1]
int $chu[$i - 1][0] >= int $saku[$i]
Truth table0%0/3
A or B
A= int $chu[$i - 1][0] <= int $saku[$i - 1]B= int $chu[$i - 1][0] >= int $saku[$i]
| |||||||||||||||||||||||||||||||||||||
| 175 | 0 | $m[$i-1][0] = $m[$i-2][0]; | |||||||||||||||||||||||||||||||||||
| 176 | 0 | $m[$i-1][1] = 1; | |||||||||||||||||||||||||||||||||||
| 177 | 0 | $m[$i-1][2] = int($saku[$i-1]); | |||||||||||||||||||||||||||||||||||
| 178 | 0 | $lap=0; | |||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||
| 181 | 36 | $m[$i][0] = $m[$i-1][0]+1; | |||||||||||||||||||||||||||||||||||
| 182 | 36 | ▶ | if( $m[$i][0] > 12 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 183 | 7 | $m[$i][0]-=12; | |||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||
| 185 | 36 | $m[$i][2]=int($saku[$i]); | |||||||||||||||||||||||||||||||||||
| 186 | 36 | $m[$i][1]=0; | |||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||
| 189 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 190 | # 朔日行列から旧暦を求める。 | ||||||||||||||||||||||||||||||||||||
| 191 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 192 | 9 | my $state=0; | |||||||||||||||||||||||||||||||||||
| 193 | 9 | ▶ | for($i=0;$i<5;$i++){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 194 | 32 | ▶ | if(int($tm0) < int($m[$i][2])){ | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 195 | 9 | $state=1; | |||||||||||||||||||||||||||||||||||
| 196 | 9 | last; | |||||||||||||||||||||||||||||||||||
| 197 | }elsif(int($tm0) == int($m[$i][2])){ | ||||||||||||||||||||||||||||||||||||
| 198 | 0 | $state=2; | |||||||||||||||||||||||||||||||||||
| 199 | 0 | last; | |||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||
| 202 | 9 | ▶ | if($state==0||$state==1){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$state == 0 or $state == 1
MC/DC0%0/2
$state == 0 or $state == 1
$state == 0
$state == 1
Truth table33%1/3
A or B
A= $state == 0B= $state == 1
| |||||||||||||||||||||||||||||||||||||
| 203 | 9 | $i--; | |||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||
| 206 | 9 | $kyureki[1]=$m[$i][1]; | |||||||||||||||||||||||||||||||||||
| 207 | 9 | $kyureki[2]=$m[$i][0]; | |||||||||||||||||||||||||||||||||||
| 208 | 9 | $kyureki[3]=int($tm0)-int($m[$i][2])+1; | |||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||
| 210 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 211 | # 旧暦年の計算 | ||||||||||||||||||||||||||||||||||||
| 212 | # (旧暦月が10以上でかつ新暦月より大きい場合には、 | ||||||||||||||||||||||||||||||||||||
| 213 | # まだ年を越していないはず...) | ||||||||||||||||||||||||||||||||||||
| 214 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||
| 216 | 9 | @a = JD2YMDT($tm0); | |||||||||||||||||||||||||||||||||||
| 217 | 9 | $kyureki[0] = $a[0]; | |||||||||||||||||||||||||||||||||||
| 218 | 9 | ▶ | if($kyureki[2] > 9 && $kyureki[2] > $a[1]){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$kyureki[2] > 9 and $kyureki[2] > $a[1]
MC/DC50%1/2
$kyureki[2] > 9 and $kyureki[2] > $a[1]
$kyureki[2] > 9
$kyureki[2] > $a[1]
Truth table66%2/3
A and B
A= $kyureki[2] > 9B= $kyureki[2] > $a[1]
| |||||||||||||||||||||||||||||||||||||
| 219 | 4 | $kyureki[0]--; | |||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||
| 222 | 9 | return($kyureki[0],$kyureki[1],$kyureki[2],$kyureki[3]); | |||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||
| 226 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 227 | # 中気の時刻を求める | ||||||||||||||||||||||||||||||||||||
| 228 | # | ||||||||||||||||||||||||||||||||||||
| 229 | # 呼び出し時にセットする変数 | ||||||||||||||||||||||||||||||||||||
| 230 | # tm ........ 計算対象となる時刻(ユリウス日) | ||||||||||||||||||||||||||||||||||||
| 231 | # chu ....... 戻り値を格納する配列のポインター | ||||||||||||||||||||||||||||||||||||
| 232 | # i ......... 戻り値を格納する配列の要素番号 | ||||||||||||||||||||||||||||||||||||
| 233 | # 戻り値 .... 中気の時刻、その時の黄経を配列で渡す | ||||||||||||||||||||||||||||||||||||
| 234 | # | ||||||||||||||||||||||||||||||||||||
| 235 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 236 | sub calc_chu | ||||||||||||||||||||||||||||||||||||
| 237 | 27 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
calc_chu: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 238 | 27 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||
| 239 | 27 | my ($tm1,$tm2,$t,$rm_sun0,$rm_sun,$delta_t1,$delta_t2,$delta_rm); | |||||||||||||||||||||||||||||||||||
| 240 | 27 | my (@temp); | |||||||||||||||||||||||||||||||||||
| 241 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 242 | #時刻引数を分解する | ||||||||||||||||||||||||||||||||||||
| 243 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 244 | 27 | $tm1 = int( $tm ); | |||||||||||||||||||||||||||||||||||
| 245 | 27 | $tm2 = $tm - $tm1; | |||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||
| 247 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 248 | # JST ==> DT (補正時刻=0.0sec と仮定して計算) | ||||||||||||||||||||||||||||||||||||
| 249 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 250 | 27 | $tm2-=9.0/24.0; | |||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||
| 252 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 253 | # 中気の黄経 λsun0 を求める | ||||||||||||||||||||||||||||||||||||
| 254 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 255 | 27 | $t=($tm2+0.5) / 36525.0; | |||||||||||||||||||||||||||||||||||
| 256 | 27 | $t=$t + ($tm1-2451545.0) / 36525.0; | |||||||||||||||||||||||||||||||||||
| 257 | 27 | $rm_sun = LONGITUDE_SUN( $t ); | |||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||
| 259 | 27 | $rm_sun0 = 30.0*int($rm_sun/30.0); | |||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||
| 261 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 262 | # 繰り返し計算によって中気の時刻を計算する | ||||||||||||||||||||||||||||||||||||
| 263 | # (誤差が±1.0 sec以内になったら打ち切る。) | ||||||||||||||||||||||||||||||||||||
| 264 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 265 | 27 | $delta_t1 = 0; | |||||||||||||||||||||||||||||||||||
| 266 | 27 | ▶ | for( $delta_t2 = 1.0 ; abs( $delta_t1 + $delta_t2 ) > ( 1.0 / 86400.0 ) ; ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||
| 268 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 269 | # λsun を計算 | ||||||||||||||||||||||||||||||||||||
| 270 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 271 | 122 | $t =($tm2+0.5) / 36525.0; | |||||||||||||||||||||||||||||||||||
| 272 | 122 | $t =$t + ($tm1-2451545.0) / 36525.0; | |||||||||||||||||||||||||||||||||||
| 273 | 122 | $rm_sun=LONGITUDE_SUN( $t ); | |||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||
| 275 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 276 | # 黄経差 Δλ=λsun −λsun0 | ||||||||||||||||||||||||||||||||||||
| 277 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 278 | 122 | $delta_rm = $rm_sun - $rm_sun0 ; | |||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||
| 280 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 281 | # Δλの引き込み範囲(±180°)を逸脱した場合には、補正を行う | ||||||||||||||||||||||||||||||||||||
| 282 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 283 | 122 | ▶ | if( $delta_rm > 180.0 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 284 | 10 | $delta_rm-=360.0; | |||||||||||||||||||||||||||||||||||
| 285 | }elsif( $delta_rm < -180.0 ){ | ||||||||||||||||||||||||||||||||||||
| 286 | 0 | $delta_rm+=360.0; | |||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||
| 289 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 290 | # 時刻引数の補正値 Δt | ||||||||||||||||||||||||||||||||||||
| 291 | # delta_t = delta_rm * 365.2 / 360.0; | ||||||||||||||||||||||||||||||||||||
| 292 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 293 | 122 | $delta_t1 = int($delta_rm * 365.2 / 360.0); | |||||||||||||||||||||||||||||||||||
| 294 | 122 | $delta_t2 = $delta_rm * 365.2 / 360.0; | |||||||||||||||||||||||||||||||||||
| 295 | 122 | $delta_t2 -= $delta_t1; | |||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||
| 297 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 298 | # 時刻引数の補正 | ||||||||||||||||||||||||||||||||||||
| 299 | # tm -= delta_t; | ||||||||||||||||||||||||||||||||||||
| 300 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 301 | 122 | $tm1 = $tm1 - $delta_t1; | |||||||||||||||||||||||||||||||||||
| 302 | 122 | $tm2 = $tm2 - $delta_t2; | |||||||||||||||||||||||||||||||||||
| 303 | 122 | ▶ | if($tm2 < 0){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 304 | 20 | $tm2+=1.0;$tm1-=1.0; | |||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||
| 308 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 309 | # 戻り値の作成 | ||||||||||||||||||||||||||||||||||||
| 310 | # chu[i,0]:時刻引数を合成するのと、DT ==> JST 変換を行い、戻り値とする | ||||||||||||||||||||||||||||||||||||
| 311 | # (補正時刻=0.0sec と仮定して計算) | ||||||||||||||||||||||||||||||||||||
| 312 | # chu[i,1]:黄経 | ||||||||||||||||||||||||||||||||||||
| 313 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 314 | 27 | $temp[0] = $tm2+9.0/24.0; | |||||||||||||||||||||||||||||||||||
| 315 | 27 | $temp[0] += $tm1; | |||||||||||||||||||||||||||||||||||
| 316 | 27 | $temp[1] = $rm_sun0; | |||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||
| 318 | 27 | return(@temp); | |||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||
| 321 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 322 | # 直前の二分二至の時刻を求める | ||||||||||||||||||||||||||||||||||||
| 323 | # | ||||||||||||||||||||||||||||||||||||
| 324 | # 呼び出し時にセットする変数 | ||||||||||||||||||||||||||||||||||||
| 325 | # tm ........ 計算対象となる時刻(ユリウス日) | ||||||||||||||||||||||||||||||||||||
| 326 | # nibun ..... 戻り値を格納する配列のポインター | ||||||||||||||||||||||||||||||||||||
| 327 | # 戻り値 .... 二分二至の時刻、その時の黄経を配列で渡す | ||||||||||||||||||||||||||||||||||||
| 328 | # (戻り値の渡し方がちょっと気にくわないがまぁいいや。) | ||||||||||||||||||||||||||||||||||||
| 329 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 330 | sub before_nibun | ||||||||||||||||||||||||||||||||||||
| 331 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
before_nibun: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 332 | 9 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||
| 333 | 9 | my (@nibun,$tm1,$tm2,$t,$rm_sun0,$rm_sun,$delta_t1,$delta_t2,$delta_rm); | |||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||
| 335 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 336 | #時刻引数を分解する | ||||||||||||||||||||||||||||||||||||
| 337 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 338 | 9 | $tm1 = int( $tm ); | |||||||||||||||||||||||||||||||||||
| 339 | 9 | $tm2 = $tm - $tm1; | |||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||
| 341 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 342 | # JST ==> DT (補正時刻=0.0sec と仮定して計算) | ||||||||||||||||||||||||||||||||||||
| 343 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 344 | 9 | $tm2-=9.0/24.0; | |||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||
| 346 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 347 | # 直前の二分二至の黄経 λsun0 を求める | ||||||||||||||||||||||||||||||||||||
| 348 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 349 | 9 | $t=($tm2+0.5) / 36525.0; | |||||||||||||||||||||||||||||||||||
| 350 | 9 | $t=$t + ($tm1-2451545.0) / 36525.0; | |||||||||||||||||||||||||||||||||||
| 351 | 9 | $rm_sun=LONGITUDE_SUN( $t ); | |||||||||||||||||||||||||||||||||||
| 352 | 9 | $rm_sun0=90*int($rm_sun/90.0); | |||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||
| 354 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 355 | # 繰り返し計算によって直前の二分二至の時刻を計算する | ||||||||||||||||||||||||||||||||||||
| 356 | # (誤差が±1.0 sec以内になったら打ち切る。) | ||||||||||||||||||||||||||||||||||||
| 357 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 358 | 9 | $delta_t1 = 0; | |||||||||||||||||||||||||||||||||||
| 359 | 9 | ▶ | for( $delta_t2 = 1.0 ; abs( $delta_t1+$delta_t2 ) > ( 1.0 / 86400.0 ) ; ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||
| 361 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 362 | # λsun を計算 | ||||||||||||||||||||||||||||||||||||
| 363 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 364 | 50 | $t=($tm2+0.5) / 36525.0; | |||||||||||||||||||||||||||||||||||
| 365 | 50 | $t=$t + ($tm1-2451545.0) / 36525.0; | |||||||||||||||||||||||||||||||||||
| 366 | 50 | $rm_sun=LONGITUDE_SUN( $t ); | |||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||
| 368 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 369 | # 黄経差 Δλ=λsun −λsun0 | ||||||||||||||||||||||||||||||||||||
| 370 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 371 | 50 | $delta_rm = $rm_sun - $rm_sun0 ; | |||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||
| 373 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 374 | # Δλの引き込み範囲(±180°)を逸脱した場合には、補正を行う | ||||||||||||||||||||||||||||||||||||
| 375 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 376 | 50 | ▶ | if( $delta_rm > 180.0 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 377 | 0 | $delta_rm-=360.0; | |||||||||||||||||||||||||||||||||||
| 378 | }elsif( $delta_rm < -180.0){ | ||||||||||||||||||||||||||||||||||||
| 379 | 0 | $delta_rm+=360.0; | |||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||
| 382 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 383 | # 時刻引数の補正値 Δt | ||||||||||||||||||||||||||||||||||||
| 384 | # delta_t = delta_rm * 365.2 / 360.0; | ||||||||||||||||||||||||||||||||||||
| 385 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 386 | 50 | $delta_t1 = int($delta_rm * 365.2 / 360.0); | |||||||||||||||||||||||||||||||||||
| 387 | 50 | $delta_t2 = $delta_rm * 365.2 / 360.0; | |||||||||||||||||||||||||||||||||||
| 388 | 50 | $delta_t2 -= $delta_t1; | |||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||
| 390 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 391 | # 時刻引数の補正 | ||||||||||||||||||||||||||||||||||||
| 392 | # tm -= delta_t; | ||||||||||||||||||||||||||||||||||||
| 393 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 394 | 50 | $tm1 = $tm1 - $delta_t1; | |||||||||||||||||||||||||||||||||||
| 395 | 50 | $tm2 = $tm2 - $delta_t2; | |||||||||||||||||||||||||||||||||||
| 396 | 50 | ▶ | if($tm2 < 0){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 397 | 11 | $tm2+=1.0;$tm1-=1.0; | |||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||
| 402 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 403 | # 戻り値の作成 | ||||||||||||||||||||||||||||||||||||
| 404 | # nibun[0,0]:時刻引数を合成するのと、DT ==> JST 変換を行い、戻り値とする | ||||||||||||||||||||||||||||||||||||
| 405 | # (補正時刻=0.0sec と仮定して計算) | ||||||||||||||||||||||||||||||||||||
| 406 | # nibun[0,1]:黄経 | ||||||||||||||||||||||||||||||||||||
| 407 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 408 | 9 | $nibun[0] = $tm2+9.0/24.0; | |||||||||||||||||||||||||||||||||||
| 409 | 9 | $nibun[0] += $tm1; | |||||||||||||||||||||||||||||||||||
| 410 | 9 | $nibun[1] = $rm_sun0; | |||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||
| 412 | 9 | return(@nibun); | |||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||
| 416 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 417 | # 朔の計算 | ||||||||||||||||||||||||||||||||||||
| 418 | # 与えられた時刻の直近の朔の時刻(JST)を求める | ||||||||||||||||||||||||||||||||||||
| 419 | # | ||||||||||||||||||||||||||||||||||||
| 420 | # 呼び出し時にセットする変数 | ||||||||||||||||||||||||||||||||||||
| 421 | # tm ........ 計算対象となる時刻(ユリウス日) | ||||||||||||||||||||||||||||||||||||
| 422 | # 戻り値 .... 朔の時刻 | ||||||||||||||||||||||||||||||||||||
| 423 | # | ||||||||||||||||||||||||||||||||||||
| 424 | # ※ 引数、戻り値ともユリウス日で表し、時分秒は日の小数で表す。 | ||||||||||||||||||||||||||||||||||||
| 425 | # | ||||||||||||||||||||||||||||||||||||
| 426 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 427 | sub calc_saku | ||||||||||||||||||||||||||||||||||||
| 428 | 45 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
calc_saku: called CC=13 SCAR=27.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 429 | 45 | my ($tm) = @_; | |||||||||||||||||||||||||||||||||||
| 430 | 45 | my ($lc,$t,$tm1,$tm2,$rm_sun,$rm_moon,$delta_rm,$delta_t1,$delta_t2); | |||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||
| 432 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 433 | # ループカウンタのセット | ||||||||||||||||||||||||||||||||||||
| 434 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 435 | 45 | $lc=1; | |||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||
| 437 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 438 | #時刻引数を分解する | ||||||||||||||||||||||||||||||||||||
| 439 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 440 | 45 | $tm1 = int( $tm ); | |||||||||||||||||||||||||||||||||||
| 441 | 45 | $tm2 = $tm - $tm1; | |||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||
| 443 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 444 | # JST ==> DT (補正時刻=0.0sec と仮定して計算) | ||||||||||||||||||||||||||||||||||||
| 445 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 446 | 45 | $tm2-=9.0/24.0; | |||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||
| 448 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 449 | # 繰り返し計算によって朔の時刻を計算する | ||||||||||||||||||||||||||||||||||||
| 450 | # (誤差が±1.0 sec以内になったら打ち切る。) | ||||||||||||||||||||||||||||||||||||
| 451 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 452 | 45 | $delta_t1 = 0; | |||||||||||||||||||||||||||||||||||
| 453 | 45 | ▶ | for( $delta_t2 = 1.0 ; abs( $delta_t1+$delta_t2 ) > ( 1.0 / 86400.0 ) ; $lc++){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||
| 455 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 456 | # 太陽の黄経λsun ,月の黄経λmoon を計算 | ||||||||||||||||||||||||||||||||||||
| 457 | # t = (tm - 2451548.0 + 0.5)/36525.0; | ||||||||||||||||||||||||||||||||||||
| 458 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 459 | 279 | $t=($tm2+0.5) / 36525.0; | |||||||||||||||||||||||||||||||||||
| 460 | 279 | $t=$t + ($tm1-2451545.0) / 36525.0; | |||||||||||||||||||||||||||||||||||
| 461 | 279 | $rm_sun=LONGITUDE_SUN( $t ); | |||||||||||||||||||||||||||||||||||
| 462 | 279 | $rm_moon=LONGITUDE_MOON( $t ); | |||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||
| 464 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 465 | # 月と太陽の黄経差Δλ | ||||||||||||||||||||||||||||||||||||
| 466 | # Δλ=λmoon−λsun | ||||||||||||||||||||||||||||||||||||
| 467 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 468 | 279 | $delta_rm = $rm_moon - $rm_sun ; | |||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||
| 470 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 471 | # ループの1回目(lc=1)で delta_rm < 0.0 の場合には引き込み範囲に | ||||||||||||||||||||||||||||||||||||
| 472 | # 入るように補正する | ||||||||||||||||||||||||||||||||||||
| 473 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 474 | 279 | ▶ | if( $lc==1 && $delta_rm < 0.0 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
$lc == 1 and $delta_rm < 0
MC/DC100%2/2
$lc == 1 and $delta_rm < 0
$lc == 1
$delta_rm < 0
Truth table100%3/3
A and B
A= $lc == 1B= $delta_rm < 0
| |||||||||||||||||||||||||||||||||||||
| 475 | 7 | $delta_rm = NORMALIZATION_ANGLE( $delta_rm ); | |||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||
| 477 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 478 | # 春分の近くで朔がある場合(0 ≦λsun≦ 20)で、月の黄経λmoon≧300 の | ||||||||||||||||||||||||||||||||||||
| 479 | # 場合には、Δλ= 360.0 − Δλ と計算して補正する | ||||||||||||||||||||||||||||||||||||
| 480 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 481 | ▶ | elsif( $rm_sun >= 0 && $rm_sun <= 20 && $rm_moon >= 300 ){ | |||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$rm_sun >= 0 and $rm_sun <= 20 and $rm_moon >= 300
$rm_sun >= 0 and $rm_sun <= 20
MC/DC0%0/3
$rm_sun >= 0 and $rm_sun <= 20 and $rm_moon >= 300
$rm_sun >= 0
$rm_sun <= 20
$rm_moon >= 300
Truth table50%2/4
A and B and C
A= $rm_sun >= 0B= $rm_sun <= 20C= $rm_moon >= 300
| |||||||||||||||||||||||||||||||||||||
| 482 | 0 | $delta_rm = NORMALIZATION_ANGLE( $delta_rm ); | |||||||||||||||||||||||||||||||||||
| 483 | 0 | $delta_rm = 360.0 - $delta_rm; | |||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||
| 485 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 486 | # Δλの引き込み範囲(±40°)を逸脱した場合には、補正を行う | ||||||||||||||||||||||||||||||||||||
| 487 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 488 | elsif( abs( $delta_rm ) > 40.0 ) { | ||||||||||||||||||||||||||||||||||||
| 489 | 2 | $delta_rm = NORMALIZATION_ANGLE( $delta_rm ); | |||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||
| 492 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 493 | # 時刻引数の補正値 Δt | ||||||||||||||||||||||||||||||||||||
| 494 | # delta_t = delta_rm * 29.530589 / 360.0; | ||||||||||||||||||||||||||||||||||||
| 495 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 496 | 279 | $delta_t1 = int($delta_rm * 29.530589 / 360.0); | |||||||||||||||||||||||||||||||||||
| 497 | 279 | $delta_t2 = $delta_rm * 29.530589 / 360.0; | |||||||||||||||||||||||||||||||||||
| 498 | 279 | $delta_t2 -= $delta_t1; | |||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||
| 500 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 501 | # 時刻引数の補正 | ||||||||||||||||||||||||||||||||||||
| 502 | # tm -= delta_t; | ||||||||||||||||||||||||||||||||||||
| 503 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 504 | 279 | $tm1 = $tm1 - $delta_t1; | |||||||||||||||||||||||||||||||||||
| 505 | 279 | $tm2 = $tm2 - $delta_t2; | |||||||||||||||||||||||||||||||||||
| 506 | 279 | ▶ | if($tm2 < 0.0){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 507 | 41 | $tm2+=1.0;$tm1-=1.0; | |||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||
| 510 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 511 | # ループ回数が15回になったら、初期値 tm を tm-26 とする。 | ||||||||||||||||||||||||||||||||||||
| 512 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 513 | 279 | ▶ | if($lc == 15 && abs( $delta_t1+$delta_t2 ) > ( 1.0 / 86400.0 ) ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$lc == 15 and abs $delta_t1 + $delta_t2 > "1.15740740740741e-05"
MC/DC0%0/2
$lc == 15 and abs $delta_t1 + $delta_t2 > "1.15740740740741e-05"
$lc == 15
abs $delta_t1 + $delta_t2 > "1.15740740740741e-05"
Truth table33%1/3
A and B
A= $lc == 15B= abs $delta_t1 + $delta_t2 > "1.15740740740741e-05"
| |||||||||||||||||||||||||||||||||||||
| 514 | 0 | $tm1 = int( $tm-26 ); | |||||||||||||||||||||||||||||||||||
| 515 | 0 | $tm2 = 0; | |||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||
| 518 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 519 | # 初期値を補正したにも関わらず、振動を続ける場合には初期値を答えとして | ||||||||||||||||||||||||||||||||||||
| 520 | # 返して強制的にループを抜け出して異常終了させる。 | ||||||||||||||||||||||||||||||||||||
| 521 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 522 | ▶ | elsif( $lc > 30 && abs( $delta_t1+$delta_t2 ) > ( 1.0 / 86400.0 ) ){ | |||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$lc > 30 and abs $delta_t1 + $delta_t2 > "1.15740740740741e-05"
MC/DC0%0/2
$lc > 30 and abs $delta_t1 + $delta_t2 > "1.15740740740741e-05"
$lc > 30
abs $delta_t1 + $delta_t2 > "1.15740740740741e-05"
Truth table33%1/3
A and B
A= $lc > 30B= abs $delta_t1 + $delta_t2 > "1.15740740740741e-05"
| |||||||||||||||||||||||||||||||||||||
| 523 | 0 | $tm1=$tm;$tm2=0; | |||||||||||||||||||||||||||||||||||
| 524 | 0 | last; | |||||||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||
| 528 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 529 | # 時刻引数を合成するのと、DT ==> JST 変換を行い、戻り値とする | ||||||||||||||||||||||||||||||||||||
| 530 | # (補正時刻=0.0sec と仮定して計算) | ||||||||||||||||||||||||||||||||||||
| 531 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||
| 533 | 45 | return($tm2+$tm1+9.0/24.0); | |||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||
| 536 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 537 | # 角度の正規化を行う。すなわち引数の範囲を 0≦θ<360 にする。 | ||||||||||||||||||||||||||||||||||||
| 538 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 539 | sub NORMALIZATION_ANGLE | ||||||||||||||||||||||||||||||||||||
| 540 | 26703 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
NORMALIZATION_ANGLE: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 541 | 26703 | my ($angle) = @_; | |||||||||||||||||||||||||||||||||||
| 542 | 26703 | my ($angle1,$angle2); | |||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||
| 544 | 26703 | ▶ | if( $angle < 0.0 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 545 | 21757 | $angle1 = -$angle; | |||||||||||||||||||||||||||||||||||
| 546 | 21757 | $angle2 = int( $angle1 / 360.0 ); | |||||||||||||||||||||||||||||||||||
| 547 | 21757 | $angle1 -= 360.0 * $angle2; | |||||||||||||||||||||||||||||||||||
| 548 | 21757 | $angle1 = 360.0 - $angle1; | |||||||||||||||||||||||||||||||||||
| 549 | }else{ | ||||||||||||||||||||||||||||||||||||
| 550 | 4946 | $angle1 = int( $angle / 360.0 ); | |||||||||||||||||||||||||||||||||||
| 551 | 4946 | $angle1 = $angle - 360.0 * $angle1; | |||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||
| 554 | 26703 | return($angle1); | |||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||
| 557 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 558 | # 太陽の黄経 λsun を計算する | ||||||||||||||||||||||||||||||||||||
| 559 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 560 | sub LONGITUDE_SUN | ||||||||||||||||||||||||||||||||||||
| 561 | 491 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
LONGITUDE_SUN: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 562 | 491 | my ($t) = @_; | |||||||||||||||||||||||||||||||||||
| 563 | 491 | my ($th,$ang); | |||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||
| 565 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 566 | # 摂動項の計算 | ||||||||||||||||||||||||||||||||||||
| 567 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 568 | 491 | $ang = NORMALIZATION_ANGLE( 31557.0 * $t + 161.0 ); | |||||||||||||||||||||||||||||||||||
| 569 | 491 | $th = .0004 * deg_cos( $ang ); | |||||||||||||||||||||||||||||||||||
| 570 | 491 | $ang = NORMALIZATION_ANGLE( 29930.0 * $t + 48.0 ); | |||||||||||||||||||||||||||||||||||
| 571 | 491 | $th = $th + .0004 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 572 | 491 | $ang = NORMALIZATION_ANGLE( 2281.0 * $t + 221.0 ); | |||||||||||||||||||||||||||||||||||
| 573 | 491 | $th = $th + .0005 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 574 | 491 | $ang = NORMALIZATION_ANGLE( 155.0 * $t + 118.0 ); | |||||||||||||||||||||||||||||||||||
| 575 | 491 | $th = $th + .0005 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 576 | 491 | $ang = NORMALIZATION_ANGLE( 33718.0 * $t + 316.0 ); | |||||||||||||||||||||||||||||||||||
| 577 | 491 | $th = $th + .0006 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 578 | 491 | $ang = NORMALIZATION_ANGLE( 9038.0 * $t + 64.0 ); | |||||||||||||||||||||||||||||||||||
| 579 | 491 | $th = $th + .0007 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 580 | 491 | $ang = NORMALIZATION_ANGLE( 3035.0 * $t + 110.0 ); | |||||||||||||||||||||||||||||||||||
| 581 | 491 | $th = $th + .0007 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 582 | 491 | $ang = NORMALIZATION_ANGLE( 65929.0 * $t + 45.0 ); | |||||||||||||||||||||||||||||||||||
| 583 | 491 | $th = $th + .0007 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 584 | 491 | $ang = NORMALIZATION_ANGLE( 22519.0 * $t + 352.0 ); | |||||||||||||||||||||||||||||||||||
| 585 | 491 | $th = $th + .0013 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 586 | 491 | $ang = NORMALIZATION_ANGLE( 45038.0 * $t + 254.0 ); | |||||||||||||||||||||||||||||||||||
| 587 | 491 | $th = $th + .0015 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 588 | 491 | $ang = NORMALIZATION_ANGLE( 445267.0 * $t + 208.0 ); | |||||||||||||||||||||||||||||||||||
| 589 | 491 | $th = $th + .0018 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 590 | 491 | $ang = NORMALIZATION_ANGLE( 19.0 * $t + 159.0 ); | |||||||||||||||||||||||||||||||||||
| 591 | 491 | $th = $th + .0018 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 592 | 491 | $ang = NORMALIZATION_ANGLE( 32964.0 * $t + 158.0 ); | |||||||||||||||||||||||||||||||||||
| 593 | 491 | $th = $th + .0020 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 594 | 491 | $ang = NORMALIZATION_ANGLE( 71998.1 * $t + 265.1 ); | |||||||||||||||||||||||||||||||||||
| 595 | 491 | $th = $th + .0200 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 596 | 491 | $ang = NORMALIZATION_ANGLE( 35999.05 * $t + 267.52 ); | |||||||||||||||||||||||||||||||||||
| 597 | 491 | $th = $th - 0.0048 * $t * deg_cos ($ang ) ; | |||||||||||||||||||||||||||||||||||
| 598 | 491 | $th = $th + 1.9147 * deg_cos ($ang ) ; | |||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||
| 600 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 601 | # 比例項の計算 | ||||||||||||||||||||||||||||||||||||
| 602 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 603 | 491 | $ang = NORMALIZATION_ANGLE( 36000.7695 * $t ); | |||||||||||||||||||||||||||||||||||
| 604 | 491 | $ang = NORMALIZATION_ANGLE( $ang + 280.4659 ); | |||||||||||||||||||||||||||||||||||
| 605 | 491 | $th = NORMALIZATION_ANGLE( $th + $ang ); | |||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||
| 607 | 491 | return($th); | |||||||||||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||
| 610 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 611 | # 月の黄経 λmoon を計算する | ||||||||||||||||||||||||||||||||||||
| 612 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 613 | sub LONGITUDE_MOON | ||||||||||||||||||||||||||||||||||||
| 614 | 279 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
LONGITUDE_MOON: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 615 | 279 | my ($t) = @_; | |||||||||||||||||||||||||||||||||||
| 616 | 279 | my ($th,$ang); | |||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||
| 618 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 619 | # 摂動項の計算 | ||||||||||||||||||||||||||||||||||||
| 620 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 621 | 279 | $ang = NORMALIZATION_ANGLE( 2322131.0 * $t + 191.0 ); | |||||||||||||||||||||||||||||||||||
| 622 | 279 | $th = .0003 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 623 | 279 | $ang = NORMALIZATION_ANGLE( 4067.0 * $t + 70.0 ); | |||||||||||||||||||||||||||||||||||
| 624 | 279 | $th = $th + .0003 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 625 | 279 | $ang = NORMALIZATION_ANGLE( 549197.0 * $t + 220.0 ); | |||||||||||||||||||||||||||||||||||
| 626 | 279 | $th = $th + .0003 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 627 | 279 | $ang = NORMALIZATION_ANGLE( 1808933.0 * $t + 58.0 ); | |||||||||||||||||||||||||||||||||||
| 628 | 279 | $th = $th + .0003 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 629 | 279 | $ang = NORMALIZATION_ANGLE( 349472.0 * $t + 337.0 ); | |||||||||||||||||||||||||||||||||||
| 630 | 279 | $th = $th + .0003 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 631 | 279 | $ang = NORMALIZATION_ANGLE( 381404.0 * $t + 354.0 ); | |||||||||||||||||||||||||||||||||||
| 632 | 279 | $th = $th + .0003 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 633 | 279 | $ang = NORMALIZATION_ANGLE( 958465.0 * $t + 340.0 ); | |||||||||||||||||||||||||||||||||||
| 634 | 279 | $th = $th + .0003 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 635 | 279 | $ang = NORMALIZATION_ANGLE( 12006.0 * $t + 187.0 ); | |||||||||||||||||||||||||||||||||||
| 636 | 279 | $th = $th + .0004 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 637 | 279 | $ang = NORMALIZATION_ANGLE( 39871.0 * $t + 223.0 ); | |||||||||||||||||||||||||||||||||||
| 638 | 279 | $th = $th + .0004 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 639 | 279 | $ang = NORMALIZATION_ANGLE( 509131.0 * $t + 242.0 ); | |||||||||||||||||||||||||||||||||||
| 640 | 279 | $th = $th + .0005 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 641 | 279 | $ang = NORMALIZATION_ANGLE( 1745069.0 * $t + 24.0 ); | |||||||||||||||||||||||||||||||||||
| 642 | 279 | $th = $th + .0005 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 643 | 279 | $ang = NORMALIZATION_ANGLE( 1908795.0 * $t + 90.0 ); | |||||||||||||||||||||||||||||||||||
| 644 | 279 | $th = $th + .0005 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 645 | 279 | $ang = NORMALIZATION_ANGLE( 2258267.0 * $t + 156.0 ); | |||||||||||||||||||||||||||||||||||
| 646 | 279 | $th = $th + .0006 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 647 | 279 | $ang = NORMALIZATION_ANGLE( 111869.0 * $t + 38.0 ); | |||||||||||||||||||||||||||||||||||
| 648 | 279 | $th = $th + .0006 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 649 | 279 | $ang = NORMALIZATION_ANGLE( 27864.0 * $t + 127.0 ); | |||||||||||||||||||||||||||||||||||
| 650 | 279 | $th = $th + .0007 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 651 | 279 | $ang = NORMALIZATION_ANGLE( 485333.0 * $t + 186.0 ); | |||||||||||||||||||||||||||||||||||
| 652 | 279 | $th = $th + .0007 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 653 | 279 | $ang = NORMALIZATION_ANGLE( 405201.0 * $t + 50.0 ); | |||||||||||||||||||||||||||||||||||
| 654 | 279 | $th = $th + .0007 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 655 | 279 | $ang = NORMALIZATION_ANGLE( 790672.0 * $t + 114.0 ); | |||||||||||||||||||||||||||||||||||
| 656 | 279 | $th = $th + .0007 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 657 | 279 | $ang = NORMALIZATION_ANGLE( 1403732.0 * $t + 98.0 ); | |||||||||||||||||||||||||||||||||||
| 658 | 279 | $th = $th + .0008 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 659 | 279 | $ang = NORMALIZATION_ANGLE( 858602.0 * $t + 129.0 ); | |||||||||||||||||||||||||||||||||||
| 660 | 279 | $th = $th + .0009 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 661 | 279 | $ang = NORMALIZATION_ANGLE( 1920802.0 * $t + 186.0 ); | |||||||||||||||||||||||||||||||||||
| 662 | 279 | $th = $th + .0011 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 663 | 279 | $ang = NORMALIZATION_ANGLE( 1267871.0 * $t + 249.0 ); | |||||||||||||||||||||||||||||||||||
| 664 | 279 | $th = $th + .0012 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 665 | 279 | $ang = NORMALIZATION_ANGLE( 1856938.0 * $t + 152.0 ); | |||||||||||||||||||||||||||||||||||
| 666 | 279 | $th = $th + .0016 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 667 | 279 | $ang = NORMALIZATION_ANGLE( 401329.0 * $t + 274.0 ); | |||||||||||||||||||||||||||||||||||
| 668 | 279 | $th = $th + .0018 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 669 | 279 | $ang = NORMALIZATION_ANGLE( 341337.0 * $t + 16.0 ); | |||||||||||||||||||||||||||||||||||
| 670 | 279 | $th = $th + .0021 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 671 | 279 | $ang = NORMALIZATION_ANGLE( 71998.0 * $t + 85.0 ); | |||||||||||||||||||||||||||||||||||
| 672 | 279 | $th = $th + .0021 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 673 | 279 | $ang = NORMALIZATION_ANGLE( 990397.0 * $t + 357.0 ); | |||||||||||||||||||||||||||||||||||
| 674 | 279 | $th = $th + .0021 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 675 | 279 | $ang = NORMALIZATION_ANGLE( 818536.0 * $t + 151.0 ); | |||||||||||||||||||||||||||||||||||
| 676 | 279 | $th = $th + .0022 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 677 | 279 | $ang = NORMALIZATION_ANGLE( 922466.0 * $t + 163.0 ); | |||||||||||||||||||||||||||||||||||
| 678 | 279 | $th = $th + .0023 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 679 | 279 | $ang = NORMALIZATION_ANGLE( 99863.0 * $t + 122.0 ); | |||||||||||||||||||||||||||||||||||
| 680 | 279 | $th = $th + .0024 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 681 | 279 | $ang = NORMALIZATION_ANGLE( 1379739.0 * $t + 17.0 ); | |||||||||||||||||||||||||||||||||||
| 682 | 279 | $th = $th + .0026 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 683 | 279 | $ang = NORMALIZATION_ANGLE( 918399.0 * $t + 182.0 ); | |||||||||||||||||||||||||||||||||||
| 684 | 279 | $th = $th + .0027 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 685 | 279 | $ang = NORMALIZATION_ANGLE( 1934.0 * $t + 145.0 ); | |||||||||||||||||||||||||||||||||||
| 686 | 279 | $th = $th + .0028 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 687 | 279 | $ang = NORMALIZATION_ANGLE( 541062.0 * $t + 259.0 ); | |||||||||||||||||||||||||||||||||||
| 688 | 279 | $th = $th + .0037 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 689 | 279 | $ang = NORMALIZATION_ANGLE( 1781068.0 * $t + 21.0 ); | |||||||||||||||||||||||||||||||||||
| 690 | 279 | $th = $th + .0038 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 691 | 279 | $ang = NORMALIZATION_ANGLE( 133.0 * $t + 29.0 ); | |||||||||||||||||||||||||||||||||||
| 692 | 279 | $th = $th + .0040 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 693 | 279 | $ang = NORMALIZATION_ANGLE( 1844932.0 * $t + 56.0 ); | |||||||||||||||||||||||||||||||||||
| 694 | 279 | $th = $th + .0040 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 695 | 279 | $ang = NORMALIZATION_ANGLE( 1331734.0 * $t + 283.0 ); | |||||||||||||||||||||||||||||||||||
| 696 | 279 | $th = $th + .0040 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 697 | 279 | $ang = NORMALIZATION_ANGLE( 481266.0 * $t + 205.0 ); | |||||||||||||||||||||||||||||||||||
| 698 | 279 | $th = $th + .0050 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 699 | 279 | $ang = NORMALIZATION_ANGLE( 31932.0 * $t + 107.0 ); | |||||||||||||||||||||||||||||||||||
| 700 | 279 | $th = $th + .0052 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 701 | 279 | $ang = NORMALIZATION_ANGLE( 926533.0 * $t + 323.0 ); | |||||||||||||||||||||||||||||||||||
| 702 | 279 | $th = $th + .0068 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 703 | 279 | $ang = NORMALIZATION_ANGLE( 449334.0 * $t + 188.0 ); | |||||||||||||||||||||||||||||||||||
| 704 | 279 | $th = $th + .0079 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 705 | 279 | $ang = NORMALIZATION_ANGLE( 826671.0 * $t + 111.0 ); | |||||||||||||||||||||||||||||||||||
| 706 | 279 | $th = $th + .0085 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 707 | 279 | $ang = NORMALIZATION_ANGLE( 1431597.0 * $t + 315.0 ); | |||||||||||||||||||||||||||||||||||
| 708 | 279 | $th = $th + .0100 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 709 | 279 | $ang = NORMALIZATION_ANGLE( 1303870.0 * $t + 246.0 ); | |||||||||||||||||||||||||||||||||||
| 710 | 279 | $th = $th + .0107 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 711 | 279 | $ang = NORMALIZATION_ANGLE( 489205.0 * $t + 142.0 ); | |||||||||||||||||||||||||||||||||||
| 712 | 279 | $th = $th + .0110 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 713 | 279 | $ang = NORMALIZATION_ANGLE( 1443603.0 * $t + 52.0 ); | |||||||||||||||||||||||||||||||||||
| 714 | 279 | $th = $th + .0125 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 715 | 279 | $ang = NORMALIZATION_ANGLE( 75870.0 * $t + 41.0 ); | |||||||||||||||||||||||||||||||||||
| 716 | 279 | $th = $th + .0154 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 717 | 279 | $ang = NORMALIZATION_ANGLE( 513197.9 * $t + 222.5 ); | |||||||||||||||||||||||||||||||||||
| 718 | 279 | $th = $th + .0304 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 719 | 279 | $ang = NORMALIZATION_ANGLE( 445267.1 * $t + 27.9 ); | |||||||||||||||||||||||||||||||||||
| 720 | 279 | $th = $th + .0347 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 721 | 279 | $ang = NORMALIZATION_ANGLE( 441199.8 * $t + 47.4 ); | |||||||||||||||||||||||||||||||||||
| 722 | 279 | $th = $th + .0409 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 723 | 279 | $ang = NORMALIZATION_ANGLE( 854535.2 * $t + 148.2 ); | |||||||||||||||||||||||||||||||||||
| 724 | 279 | $th = $th + .0458 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 725 | 279 | $ang = NORMALIZATION_ANGLE( 1367733.1 * $t + 280.7 ); | |||||||||||||||||||||||||||||||||||
| 726 | 279 | $th = $th + .0533 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 727 | 279 | $ang = NORMALIZATION_ANGLE( 377336.3 * $t + 13.2 ); | |||||||||||||||||||||||||||||||||||
| 728 | 279 | $th = $th + .0571 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 729 | 279 | $ang = NORMALIZATION_ANGLE( 63863.5 * $t + 124.2 ); | |||||||||||||||||||||||||||||||||||
| 730 | 279 | $th = $th + .0588 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 731 | 279 | $ang = NORMALIZATION_ANGLE( 966404.0 * $t + 276.5 ); | |||||||||||||||||||||||||||||||||||
| 732 | 279 | $th = $th + .1144 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 733 | 279 | $ang = NORMALIZATION_ANGLE( 35999.05 * $t + 87.53 ); | |||||||||||||||||||||||||||||||||||
| 734 | 279 | $th = $th + .1851 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 735 | 279 | $ang = NORMALIZATION_ANGLE( 954397.74 * $t + 179.93 ); | |||||||||||||||||||||||||||||||||||
| 736 | 279 | $th = $th + .2136 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 737 | 279 | $ang = NORMALIZATION_ANGLE( 890534.22 * $t + 145.7 ); | |||||||||||||||||||||||||||||||||||
| 738 | 279 | $th = $th + .6583 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 739 | 279 | $ang = NORMALIZATION_ANGLE( 413335.35 * $t + 10.74 ); | |||||||||||||||||||||||||||||||||||
| 740 | 279 | $th = $th + 1.2740 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 741 | 279 | $ang = NORMALIZATION_ANGLE( 477198.868 * $t + 44.963 ); | |||||||||||||||||||||||||||||||||||
| 742 | 279 | $th = $th + 6.2888 * deg_cos ($ang ); | |||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||
| 744 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 745 | # 比例項の計算 | ||||||||||||||||||||||||||||||||||||
| 746 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 747 | 279 | $ang = NORMALIZATION_ANGLE( 481267.8809 * $t ); | |||||||||||||||||||||||||||||||||||
| 748 | 279 | $ang = NORMALIZATION_ANGLE( $ang + 218.3162 ); | |||||||||||||||||||||||||||||||||||
| 749 | 279 | $th = NORMALIZATION_ANGLE( $th + $ang ); | |||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||
| 751 | 279 | return($th); | |||||||||||||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||
| 754 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 755 | # 年月日、時分秒(世界時)からユリウス日(JD)を計算する | ||||||||||||||||||||||||||||||||||||
| 756 | # | ||||||||||||||||||||||||||||||||||||
| 757 | # ※ この関数では、グレゴリオ暦法による年月日から求めるものである。 | ||||||||||||||||||||||||||||||||||||
| 758 | # (ユリウス暦法による年月日から求める場合には使用できない。) | ||||||||||||||||||||||||||||||||||||
| 759 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 760 | sub YMDT2JD | ||||||||||||||||||||||||||||||||||||
| 761 | 11 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
YMDT2JD: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 762 | 11 | my ($year,$month,$day,$hour,$min,$sec) = @_; | |||||||||||||||||||||||||||||||||||
| 763 | 11 | my ($jd,$t); | |||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||
| 765 | 11 | ▶ | if( $month < 3.0 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 766 | 7 | $year -= 1.0; | |||||||||||||||||||||||||||||||||||
| 767 | 7 | $month += 12.0; | |||||||||||||||||||||||||||||||||||
| 768 | } | ||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||
| 770 | 11 | $jd = int( 365.25 * $year ); | |||||||||||||||||||||||||||||||||||
| 771 | 11 | $jd += int( $year / 400.0 ); | |||||||||||||||||||||||||||||||||||
| 772 | 11 | $jd -= int( $year / 100.0 ); | |||||||||||||||||||||||||||||||||||
| 773 | 11 | $jd += int( 30.59 * ( $month-2.0 ) ); | |||||||||||||||||||||||||||||||||||
| 774 | 11 | $jd += 1721088; | |||||||||||||||||||||||||||||||||||
| 775 | 11 | $jd += $day; | |||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||
| 777 | 11 | $t = $sec / 3600.0; | |||||||||||||||||||||||||||||||||||
| 778 | 11 | $t += $min /60.0; | |||||||||||||||||||||||||||||||||||
| 779 | 11 | $t += $hour; | |||||||||||||||||||||||||||||||||||
| 780 | 11 | $t = $t / 24.0; | |||||||||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||||||||||
| 782 | 11 | $jd += $t; | |||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||
| 784 | 11 | return( $jd ); | |||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||
| 786 | } | ||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||
| 788 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 789 | # ユリウス日(JD)から年月日、時分秒(世界時)を計算する | ||||||||||||||||||||||||||||||||||||
| 790 | # | ||||||||||||||||||||||||||||||||||||
| 791 | # 戻り値の配列TIME[]の内訳 | ||||||||||||||||||||||||||||||||||||
| 792 | # TIME[0] ... 年 TIME[1] ... 月 TIME[2] ... 日 | ||||||||||||||||||||||||||||||||||||
| 793 | # TIME[3] ... 時 TIME[4] ... 分 TIME[5] ... 秒 | ||||||||||||||||||||||||||||||||||||
| 794 | # | ||||||||||||||||||||||||||||||||||||
| 795 | # ※ この関数で求めた年月日は、グレゴリオ暦法によって表されている。 | ||||||||||||||||||||||||||||||||||||
| 796 | # | ||||||||||||||||||||||||||||||||||||
| 797 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 798 | sub JD2YMDT | ||||||||||||||||||||||||||||||||||||
| 799 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
JD2YMDT: called CC=6 SCAR=21.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||
| 801 | 9 | my ($JD) = @_; | |||||||||||||||||||||||||||||||||||
| 802 | 9 | my (@TIME,$x0,$x1,$x2,$x3,$x4,$x5,$x6,$tm); | |||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||
| 804 | 9 | $x0 = int( $JD+68570.0); | |||||||||||||||||||||||||||||||||||
| 805 | 9 | $x1 = int( $x0/36524.25 ); | |||||||||||||||||||||||||||||||||||
| 806 | 9 | $x2 = $x0 - int( 36524.25*$x1 + 0.75 ); | |||||||||||||||||||||||||||||||||||
| 807 | 9 | $x3 = int( ( $x2+1 )/365.2425 ); | |||||||||||||||||||||||||||||||||||
| 808 | 9 | $x4 = $x2 - int( 365.25*$x3 )+31.0; | |||||||||||||||||||||||||||||||||||
| 809 | 9 | $x5 = int( int($x4) / 30.59 ); | |||||||||||||||||||||||||||||||||||
| 810 | 9 | $x6 = int( int($x5) / 11.0 ); | |||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||
| 812 | 9 | $TIME[2] = $x4 - int( 30.59*$x5 ); | |||||||||||||||||||||||||||||||||||
| 813 | 9 | $TIME[1] = $x5 - 12*$x6 + 2; | |||||||||||||||||||||||||||||||||||
| 814 | 9 | $TIME[0] = 100*( $x1-49 ) + $x3 + $x6; | |||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||
| 816 | # 2月30日の補正 | ||||||||||||||||||||||||||||||||||||
| 817 | 9 | ▶ | if($TIME[1]==2 && $TIME[2] > 28){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$TIME[1] == 2 and $TIME[2] > 28
MC/DC0%0/2
$TIME[1] == 2 and $TIME[2] > 28
$TIME[1] == 2
$TIME[2] > 28
Truth table33%1/3
A and B
A= $TIME[1] == 2B= $TIME[2] > 28
| |||||||||||||||||||||||||||||||||||||
| 818 | 0 | ▶ | if($TIME[0] % 100 == 0 && $TIME[0] % 400 == 0){ | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$TIME[0] % 100 == 0 and $TIME[0] % 400 == 0
MC/DC0%0/2
$TIME[0] % 100 == 0 and $TIME[0] % 400 == 0
$TIME[0] % 100 == 0
$TIME[0] % 400 == 0
Truth table0%0/3
A and B
A= $TIME[0] % 100 == 0B= $TIME[0] % 400 == 0
| |||||||||||||||||||||||||||||||||||||
| 819 | 0 | $TIME[2]=29; | |||||||||||||||||||||||||||||||||||
| 820 | }elsif($TIME[0] % 4 ==0){ | ||||||||||||||||||||||||||||||||||||
| 821 | 0 | $TIME[2]=29; | |||||||||||||||||||||||||||||||||||
| 822 | }else{ | ||||||||||||||||||||||||||||||||||||
| 823 | 0 | $TIME[2]=28; | |||||||||||||||||||||||||||||||||||
| 824 | } | ||||||||||||||||||||||||||||||||||||
| 825 | } | ||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||
| 827 | 9 | $tm=86400.0*( $JD - int( $JD ) ); | |||||||||||||||||||||||||||||||||||
| 828 | 9 | $TIME[3] = int( $tm/3600.0 ); | |||||||||||||||||||||||||||||||||||
| 829 | 9 | $TIME[4] = int( ($tm - 3600.0*$TIME[3])/60.0 ); | |||||||||||||||||||||||||||||||||||
| 830 | 9 | $TIME[5] = int( $tm - 3600.0*$TIME[3] - 60*$TIME[4] ); | |||||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||||||
| 832 | 9 | return(@TIME); | |||||||||||||||||||||||||||||||||||
| 833 | } | ||||||||||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||||||||||
| 835 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 836 | # 今日が24節気かどうか調べる | ||||||||||||||||||||||||||||||||||||
| 837 | # | ||||||||||||||||||||||||||||||||||||
| 838 | # 引数 .... 計算対象となる年月日 $year $mon $day | ||||||||||||||||||||||||||||||||||||
| 839 | # | ||||||||||||||||||||||||||||||||||||
| 840 | # 戻り値 .... 24節気の名称 | ||||||||||||||||||||||||||||||||||||
| 841 | # | ||||||||||||||||||||||||||||||||||||
| 842 | #========================================================================= | ||||||||||||||||||||||||||||||||||||
| 843 | sub check_24sekki | ||||||||||||||||||||||||||||||||||||
| 844 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
check_24sekki: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 845 | 2 | my ($year,$mon,$day) = @_; | |||||||||||||||||||||||||||||||||||
| 846 | 2 | my ($tm1,$tm2,$t,$rm_sun_today,$rm_sun_today0,$rm_sun_tommorow,$rm_sun_tommorow0); | |||||||||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||||||||||
| 848 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 849 | # 24節気の定義 | ||||||||||||||||||||||||||||||||||||
| 850 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 851 | 2 | my (@sekki24) = ("春分","清明","穀雨","立夏","小満","芒種","夏至","小暑","大暑","立秋","処暑","白露", | |||||||||||||||||||||||||||||||||||
| 852 | "秋分","寒露","霜降","立冬","小雪","大雪","冬至","小寒","大寒","立春","雨水","啓蟄"); | ||||||||||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||||||||||
| 854 | 2 | my $tm = YMDT2JD($year,$mon,$day,0,0,0); | |||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||
| 856 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 857 | #時刻引数を分解する | ||||||||||||||||||||||||||||||||||||
| 858 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| 859 | 2 | $tm1 = int( $tm ); | |||||||||||||||||||||||||||||||||||
| 860 | 2 | $tm2 = $tm - $tm1; | |||||||||||||||||||||||||||||||||||
| 861 | 2 | $tm2-=9.0/24.0; | |||||||||||||||||||||||||||||||||||
| 862 | 2 | $t=($tm2+0.5) / 36525.0; | |||||||||||||||||||||||||||||||||||
| 863 | 2 | $t=$t + ($tm1-2451545.0) / 36525.0; | |||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||
| 865 | #今日の太陽の黄経 | ||||||||||||||||||||||||||||||||||||
| 866 | 2 | $rm_sun_today = LONGITUDE_SUN( $t ); | |||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||
| 868 | 2 | $tm++; | |||||||||||||||||||||||||||||||||||
| 869 | 2 | $tm1 = int($tm); | |||||||||||||||||||||||||||||||||||
| 870 | 2 | $tm2 = $tm - $tm1; | |||||||||||||||||||||||||||||||||||
| 871 | 2 | $tm2-=9.0/24.0; | |||||||||||||||||||||||||||||||||||
| 872 | 2 | $t=($tm2+0.5) / 36525.0; | |||||||||||||||||||||||||||||||||||
| 873 | 2 | $t=$t + ($tm1-2451545.0) / 36525.0; | |||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||
| 875 | #明日の太陽の黄経 | ||||||||||||||||||||||||||||||||||||
| 876 | 2 | $rm_sun_tommorow = LONGITUDE_SUN($t); | |||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||
| 878 | # | ||||||||||||||||||||||||||||||||||||
| 879 | 2 | $rm_sun_today0 = 15.0 * int($rm_sun_today / 15.0); | |||||||||||||||||||||||||||||||||||
| 880 | 2 | $rm_sun_tommorow0 = 15.0 * int($rm_sun_tommorow / 15.0); | |||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||
| 882 | 2 | ▶ | if($rm_sun_today0 != $rm_sun_tommorow0){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 883 | 1 | return($sekki24[$rm_sun_tommorow0 / 15]); | |||||||||||||||||||||||||||||||||||
| 884 | }else{ | ||||||||||||||||||||||||||||||||||||
| 885 | 1 | return(''); | |||||||||||||||||||||||||||||||||||
| 886 | } | ||||||||||||||||||||||||||||||||||||
| 887 | } | ||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||
| 889 | 1 | 1; | |||||||||||||||||||||||||||||||||||