diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /map65/libm65/astro.f90 | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'map65/libm65/astro.f90')
| -rw-r--r-- | map65/libm65/astro.f90 | 252 |
1 files changed, 147 insertions, 105 deletions
diff --git a/map65/libm65/astro.f90 b/map65/libm65/astro.f90 index d34819cc..9ec92045 100644 --- a/map65/libm65/astro.f90 +++ b/map65/libm65/astro.f90 @@ -1,105 +1,147 @@ -subroutine astro(nyear,month,nday,uth,nfreq,Mygrid,NStation,MoonDX, & - AzSun,ElSun,AzMoon0,ElMoon0,ntsky,doppler00,doppler,dbMoon,RAMoon, & - DecMoon,HA,Dgrd,sd,poloffset,xnr,day,lon,lat,LST) - -! Computes astronomical quantities for display and tracking. -! NB: may want to smooth the Tsky map to 10 degrees or so. - - character*6 MyGrid,HisGrid - real LST - real lat,lon - integer*2 nt144(180) - -! common/echo/xdop(2),techo,AzMoon,ElMoon,mjd - real xdop(2) - - data rad/57.2957795/ - data nt144/ & - 234, 246, 257, 267, 275, 280, 283, 286, 291, 298, & - 305, 313, 322, 331, 341, 351, 361, 369, 376, 381, & - 383, 382, 379, 374, 370, 366, 363, 361, 363, 368, & - 376, 388, 401, 415, 428, 440, 453, 467, 487, 512, & - 544, 579, 607, 618, 609, 588, 563, 539, 512, 482, & - 450, 422, 398, 379, 363, 349, 334, 319, 302, 282, & - 262, 242, 226, 213, 205, 200, 198, 197, 196, 197, & - 200, 202, 204, 205, 204, 203, 202, 201, 203, 206, & - 212, 218, 223, 227, 231, 236, 240, 243, 247, 257, & - 276, 301, 324, 339, 346, 344, 339, 331, 323, 316, & - 312, 310, 312, 317, 327, 341, 358, 375, 392, 407, & - 422, 437, 451, 466, 480, 494, 511, 530, 552, 579, & - 612, 653, 702, 768, 863,1008,1232,1557,1966,2385, & - 2719,2924,3018,3038,2986,2836,2570,2213,1823,1461, & - 1163, 939, 783, 677, 602, 543, 494, 452, 419, 392, & - 373, 360, 353, 350, 350, 350, 350, 350, 350, 348, & - 344, 337, 329, 319, 307, 295, 284, 276, 272, 272, & - 273, 274, 274, 271, 266, 260, 252, 245, 238, 231/ - save - - call grid2deg(MyGrid,elon,lat) - lon=-elon - call sun(nyear,month,nday,uth,lon,lat,RASun,DecSun,LST,AzSun,ElSun,mjd,day) - - freq=nfreq*1.e6 - if(nfreq.eq.2) freq=1.8e6 - if(nfreq.eq.4) freq=3.5e6 - - call MoonDop(nyear,month,nday,uth,lon,lat,RAMoon,DecMoon,LST,HA, & - AzMoon,ElMoon,vr,dist) - -! Compute spatial polarization offset - xx=sin(lat/rad)*cos(ElMoon/rad) - cos(lat/rad)*cos(AzMoon/rad)*sin(ElMoon/rad) - yy=cos(lat/rad)*sin(AzMoon/rad) - if(NStation.eq.1) poloffset1=rad*atan2(yy,xx) - if(NStation.eq.2) poloffset2=rad*atan2(yy,xx) - - techo=2.0 * dist/2.99792458e5 !Echo delay time - doppler=-freq*vr/2.99792458e5 !One-way Doppler - - call coord(0.,0.,-1.570796,1.161639,RAMoon/rad,DecMoon/rad,el,eb) - longecl_half=nint(rad*el/2.0) - if(longecl_half.lt.1 .or. longecl_half.gt.180) longecl_half=180 - t144=nt144(longecl_half) - tsky=(t144-2.7)*(144.0/nfreq)**2.6 + 2.7 !Tsky for obs freq - - xdop(NStation)=doppler - if(NStation.eq.2) then - HisGrid=MyGrid - go to 900 - endif - - doppler00=2.0*xdop(1) - doppler=xdop(1)+xdop(2) -! if(mode.eq.3) doppler=2.0*xdop(1) - dBMoon=-40.0*log10(dist/356903.) - sd=16.23*370152.0/dist - -! if(NStation.eq.1 .and. MoonDX.ne.0 .and. -! + (mode.eq.2 .or. mode.eq.5)) then - if(NStation.eq.1 .and. MoonDX.ne.0) then - poloffset=mod(poloffset2-poloffset1+720.0,180.0) - if(poloffset.gt.90.0) poloffset=poloffset-180.0 - x1=abs(cos(2*poloffset/rad)) - if(x1.lt.0.056234) x1=0.056234 - xnr=-20.0*log10(x1) - if(HisGrid(1:1).lt.'A' .or. HisGrid(1:1).gt.'R') xnr=0 - endif - - tr=80.0 !Good preamp - tskymin=13.0*(408.0/nfreq)**2.6 !Cold sky temperature - tsysmin=tskymin+tr - tsys=tsky+tr - dgrd=-10.0*log10(tsys/tsysmin) + dbMoon -900 AzMoon0=Azmoon - ElMoon0=Elmoon - ntsky=nint(tsky) - -! auxHA = 15.0*(LST-auxra) !HA in degrees -! pi=3.14159265 -! pio2=0.5*pi -! call coord(pi,pio2-lat/rad,0.0,lat/rad,auxha*pi/180.0, -! + auxdec/rad,azaux,elaux) -! AzAux=azaux*rad -! ElAux=ElAux*rad - - return -end subroutine astro +module astro_mod + use iso_fortran_env, only: real64, real32, int16 + implicit none + + ! Sky temperature lookup table (was integer*2 nt144 + DATA + SAVE) + integer(int16), parameter :: nt144(180) = [ & + 234, 246, 257, 267, 275, 280, 283, 286, 291, 298, & + 305, 313, 322, 331, 341, 351, 361, 369, 376, 381, & + 383, 382, 379, 374, 370, 366, 363, 361, 363, 368, & + 376, 388, 401, 415, 428, 440, 453, 467, 487, 512, & + 544, 579, 607, 618, 609, 588, 563, 539, 512, 482, & + 450, 422, 398, 379, 363, 349, 334, 319, 302, 282, & + 262, 242, 226, 213, 205, 200, 198, 197, 196, 197, & + 200, 202, 204, 205, 204, 203, 202, 201, 203, 206, & + 212, 218, 223, 227, 231, 236, 240, 243, 247, 257, & + 276, 301, 324, 339, 346, 344, 339, 331, 323, 316, & + 312, 310, 312, 317, 327, 341, 358, 375, 392, 407, & + 422, 437, 451, 466, 480, 494, 511, 530, 552, 579, & + 612, 653, 702, 768, 863,1008,1232,1557,1966,2385, & + 2719,2924,3018,3038,2986,2836,2570,2213,1823,1461, & + 1163, 939, 783, 677, 602, 543, 494, 452, 419, 392, & + 373, 360, 353, 350, 350, 350, 350, 350, 350, 348, & + 344, 337, 329, 319, 307, 295, 284, 276, 272, 272, & + 273, 274, 274, 271, 266, 260, 252, 245, 238, 231 ] + + real(real32), parameter :: RAD2DEG = 57.2957795130823 + real(real32), parameter :: C_KM_S = 2.99792458e5 + +contains + + subroutine astro(nyear,month,nday,uth,nfreq,Mygrid,NStation,MoonDX, & + AzSun,ElSun,AzMoon0,ElMoon0,ntsky,doppler00,doppler,dbMoon,RAMoon, & + DecMoon,HA,Dgrd,sd,poloffset,xnr,day,lon,lat,LST) + + use coord_mod + use sun_mod + use moondop_mod + use grid2deg_mod, only: grid2deg + implicit none + + ! Dummy arguments + integer, intent(in) :: nyear, month, nday, nfreq, NStation + real, intent(in) :: uth + real, intent(in) :: MoonDX + character(len=6), intent(in):: MyGrid + integer, intent(out) :: ntsky + real, intent(out) :: AzSun, ElSun, AzMoon0, ElMoon0 + real, intent(out) :: doppler00, doppler, dbMoon + real, intent(out) :: RAMoon, DecMoon, HA, Dgrd, sd + real, intent(out) :: poloffset, xnr + real, intent(out) :: day + real, intent(out) :: lon, lat, LST + + ! Locals + character(len=6) :: HisGrid = 'UNK ' + real(real64) :: freq + real :: RASun, DecSun + real :: AzMoon, ElMoon, vr, dist + real(real64) :: xx, yy, poloffset1 = 0.0, poloffset2 = 0.0 + real(real64) :: techo + real(real32) :: el, eb + integer :: longecl_half, t144 + real(real64) :: tsky, x1, tr, tskymin, tsysmin, tsys + real :: elon + real(real64) :: xdop(2) + integer :: mjd + + ! Initialize intent(out) variables + ntsky = 0 + AzSun = 0.0 + ElSun = 0.0 + AzMoon0 = 0.0 + ElMoon0 = 0.0 + doppler00 = 0.0 + doppler = 0.0 + dbMoon = 0.0 + RAMoon = 0.0 + DecMoon = 0.0 + HA = 0.0 + Dgrd = 0.0 + sd = 0.0 + poloffset = 0.0 + xnr = 0.0 + day = 0.0 + lon = 0.0 + lat = 0.0 + LST = 0.0 + + ! Convert grid to lon/lat + call grid2deg(MyGrid, elon, lat) + lon = -elon + + call sun(nyear,month,nday,uth,lon,lat,RASun,DecSun,LST,AzSun,ElSun,mjd,day) + freq = nfreq*1.0d6 + call MoonDop(nyear,month,nday,uth,lon,lat,RAMoon,DecMoon,LST,HA, & + AzMoon,ElMoon,vr,dist) + + ! Spatial polarization offset + xx = sin(lat/RAD2DEG)*cos(ElMoon/RAD2DEG) - & + cos(lat/RAD2DEG)*cos(AzMoon/RAD2DEG)*sin(ElMoon/RAD2DEG) + yy = cos(lat/RAD2DEG)*sin(AzMoon/RAD2DEG) + if (NStation == 1) poloffset1 = RAD2DEG*atan2(yy,xx) + if (NStation == 2) poloffset2 = RAD2DEG*atan2(yy,xx) + + techo = 2.0 * dist / C_KM_S + doppler = -freq*vr / C_KM_S + + call coord(0.,0.,-1.570796,1.161639, & + RAMoon/RAD2DEG,DecMoon/RAD2DEG,el,eb) + + longecl_half = nint(RAD2DEG*el/2.0) + if (longecl_half < 1 .or. longecl_half > 180) longecl_half = 180 + t144 = nt144(longecl_half) + tsky = (t144-2.7)*(144.0e6/freq)**2.6 + 2.7 + + xdop(NStation) = doppler + if (NStation == 2) then + HisGrid = MyGrid + else + doppler00 = 2.0*xdop(1) + doppler = xdop(1) + xdop(2) + dbMoon = -40.0*log10(dist/356903.0) + sd = 16.23*370152.0/dist + + if (NStation == 1 .and. MoonDX /= 0.0) then + poloffset = mod(poloffset2-poloffset1+720.d0,180.d0) + if (poloffset > 90.0) poloffset = poloffset - 180.0 + x1 = abs(cos(2.0*poloffset/RAD2DEG)) + if (x1 < 0.056234) x1 = 0.056234 + xnr = -20.0*log10(x1) + if (HisGrid(1:1) < 'A' .or. HisGrid(1:1) > 'R') xnr = 0.0 + end if + + tr = 80.0 + tskymin = 13.0*(408.0e6/freq)**2.6 + tsysmin = tskymin + tr + tsys = tsky + tr + Dgrd = -10.0*log10(tsys/tsysmin) + dbMoon + end if + + AzMoon0 = AzMoon + ElMoon0 = ElMoon + ntsky = nint(tsky) + + end subroutine astro + +end module astro_mod |
