计算太阳位于地平线以下/之上 X 度的时间

2023-11-25

我想知道太阳在地平线以下/之上 X 度的时间是什么时候。

例如,我想找到太阳位于地平线以下 19.75 度的时间。我认为这与函数中的最高点有关date_sunrise/date_sunset但我不确定。

提前致谢!


  1. 收集您需要的日期的太阳星历数据

采取 1 小时步长,获取太阳在方位角坐标中的位置,以获得您所需的地理位置。使用您找到的方程式或使用一些 WEB 服务,例如:

  • 喷气推进实验室地平线不喜欢这个,因为他们使用了一些奇怪的输出参考框架,这些参考框架与我的测量不符,但更有可能的是我一路上转换了一些错误的东西......

  • 普雷绍夫天文台这是我最喜欢的(但它是斯洛伐克语)输出可以轻松复制到矿井引擎,并且输出与矿井观察、计算、估计和测量相对应。只需填写:

    • 地理位置(Miesto pozorovania)
    • 日期、时间 (Dátum a čas pozorovania)
    • 左下角:间隔[天],间隔步长[天]
    • 点击太阳(Slnko)、月亮(Mesiac)、行星(Planety)的按钮

有很多这样的页面,只是看看,但总是检查它们是否输出正确的数据。我使用开普勒定律/方程形成行星运动(精度较低,但对于地球-太阳应该没问题)。如今,引擎使用重力模型(但随着时间的推移,它不稳定)

  1. 将数据处理为沿折线的 3D 点集(方位角、高度、时间)

  2. 现在只要在数据中找到2点

一个低于所需角度,下一个高于所需角度。展位点必须相邻。如果任何点位于所需的角度,那么您已经有了解决方案,所以停止

  1. 插值高度角交叉时间

enter image description here

所以如果所需的高度角是b想要时间t then:

  • a0,a1是方位角
  • b0,b1是高度角
  • t0,t1是次

然后求解这个线性系统:

    b=b0+(b1-b0)*u
    t=t0+(t1-t0)*u

所以如果我没有犯一些愚蠢的错误:

    t=t0+((t1-t0)*(b-b0)/(b1-b0))

[Notes]

如果你不需要太高的精度(以及上面的用法100年)并且地理位置是固定的,那么您可以列出全年并定期使用此数据。这样您就不需要在运行时执行步骤 1。

[编辑1] 开普勒定律

如果你想走这条路看here。您将需要地球的轨道和自转参数。这些是从太阳系矿井星历引擎 *.ini 中提取的:

[Earth]
txr_map=Earth_Map.jpg
txr_nor=Earth_Normal.jpg
txr_clouds=Earth_Cloud.jpg
txr_lights=Earth_Light.jpg
txr_ring_map=
txr_ring_alpha=
is_star=0
mother=Sun
re=6378141.2
rp=6356754.79506139
r0=-1
r1=-1
ha=60000
vd=250000
B0r=0.1981
B0g=0.4656
B0b=0.8625
B0a=0.75
t0=-0.0833333333333333 ; this means 1.1.2000 00:00:00 UT
a=149597896927.617
da=-0.122872993839836
e=0.01673163
de=-1.00232717316906E-9
i=-9.48516635288838E-6
di=-6.38963964003634E-9
O=-0.004695
dO=-1.15274665428334E-7
o=1.79646842620403
do=1.51932094052745E-7
M  =1.7464
dM =0.0172021242603194
ddM=0
rota0 =3.0707963267949
rotda =6.30038738085328
prea0 =1.5707963267949
preda =-6.68704522111755E-7
prei  =0.409124584728753
predi =0
nuta  =0
nutda =0
nutia =0
nutdia=0
nutii =0
nutdii=0

以下是解释:

[Name]      [string id] object ID name
txr_map     [filename] surface texture
txr_nor     [filename] surface normal/bump texture 
txr_clouds  [filename] cloud blend texture (white cloud, black clear sky)
txr_lights  [filename] night surface texture
txr_ring_map    [filename] rings color texture 
txr_ring_alpha  [filename] rings alpha texture (alpha0 transparent, alpha1 solid)
is_star     [0/1] is star ?
mother      [string] "" or owner object name
re      [m] equator radius
rp      [m] polar radius
r0      [m] -1 or rings inner radius
r1      [m] -1 or rings outer radius
ha      [m]  0 or atmosphere thickness
vd      [m] -1 or atmosphere view depth
B0r     <0,1> star R light or atmosphere color
B0g     <0,1> star G light or atmosphere color
B0b     <0,1> star B light or atmosphere color
B0a     <0,1> overglow of star below horizont
t0      [day]     t0 time the parameters are taken after 1.1.2000 00:00:00
a       [m]       a main semiaxis
da      [m/day]   a change in time
e       [-]       e eccentricity
de      [-/day]   e change in time
i       [rad]     i inclination
di      [rad/day] i change in time
O       [rad]     O (node n) position of inclination axis
dO      [rad/day] O node shift (pi2/T)
o       [rad]     o perihelium (no change in inclination position)
do      [rad/day] o perihelium shift (pi2/T)
M       [rad]     M rotation around owner position in t0
dM      [rad/day] dM orbital rotation (pi2/draconic month)
ddM0        [rad/day^2] dM change in time
rota0       [rad]     rota0 rotation around self axis position in t0
rotda       [rad/day] rotda mean rotation around self axis
prea0       [rad]     prea rotation axis position in t0
preda       [rad/day] preda precession rotation (pi2/Platonic year)
prei        [rad]     prei equator inclination to ecliptic
predi       [rad/day] prei change in time
nuta        [rad]     nuta angle position on nutation ellipse
nutda       [rad/day] nutation rotation (pi2/T)
nutia       [rad]     nutia nutation (of rotation axis) ellipse semiaxis  axis in ecliptic plane
nutdia      [rad/day] nutia change in time
nutii       [rad]     nutii nutation (of rotation axis) ellipse semiaxis  axis in rotation axis direction
nutdii      [rad/day] nutii change in time

忽略 is_star、纹理、环和大气参数。所以:

  1. 让 Sun 就位(0,0,0)在笛卡尔坐标系中
  2. 计算地球位置(x,y,z)从开普勒定律

那时太阳(-x,-y,-z)在地心坐标中

  1. 通过日自转、进动、章动向后旋转(-x,-y,-z) -> (x',y',z')

  2. compute NEH您的地理位置框架(North,East,High(Up))

  3. convert (x',y',z')到 NEH 局部坐标(xx,yy,zz)

  4. compute:

     azimut=atanxy(-xx,-yy)
     height=atanxy(sqrt((xx*xx)+(yy*yy)),-zz)
    

就是这样

这是我的日心天体身体位置计算:

void astro_body::compute(double t)
    {
      // t is time in days after 1.1.2000 00:00:00
      // double pos[3] is output heliocentric position [m]
      // reper rep is output heliocentric position [m] and orientation transform matrix (mine class) where Z is rotation axis (North pole) and X is long=0,lat=0

    rot_a.compute(t); // compute actual value for orbital parameters changing in time
    pre_a.compute(t); // the actual parameter is in XXX.a you can ignore this part
    pre_i.compute(t);
    nut_a.compute(t);
    nut_ia.compute(t);
    nut_ii.compute(t);

//  pre_a=pre_a0+(pre_da.a*dt)+(nut_ia*cos(nut_a)); // some old legacy dead code
//  pre_i=pre_i0+(pre_di.a*sin(pre_e))+(nut_ii*sin(nut_a));

    rep.reset(); // rep is the transform matrix representing body coordinate system (orientation and position)
    rep.lrotz(pre_a.a); // local rotation around reps Z axis by pre_a.a [rad] angle
    rep.lroty(pre_i.a);
    rep.lrotx(nut_ia.a*cos(nut_a.a));
    rep.lroty(nut_ii.a*sin(nut_a.a));
    rep.lrotz(rot_a.a);

    a.compute(t); // the same as above can ignore this part
    e.compute(t);
    i.compute(t);
    O.compute(t);
    o.compute(t);
    M.compute(t);
    M.compute(t);

    double  c0,c1,c2,sO,si,cO,ci,b;       // trajectory constants
    double  x,y;
    int     q;

    if (e.a>=1.0) e.a=0;
    c0=sqrt((1.0-e.a)/(1.0+e.a));       // some helper constants computation
    c1=sqrt((1.0+e.a)/(1.0-e.a));
    c2=a.a*(1-e.a*e.a);
    sO=sin(O.a);
    cO=cos(O.a);
    si=sin(-i.a);
    ci=cos(-i.a);
    b=a.a*sqrt(1.0-e.a);

    M.a-=o.a;                           // correction
    M.a=M.a-pi2*floor(M.a/pi2);
    E=M.a;
    for (q=0;q<20;q++) E=M.a+e.a*sin(E); // Kepler's equation
    V=2.0*atan(c1*tan(E/2.0));
    r=c2/(1.0+e.a*cos(V));
    pos[0]=r*cos(V+o.a-O.a);  // now just compute heliocentric position along ecliptic ellipse
    pos[1]=r*sin(V+o.a-O.a);  // and then rotate by inclination
    pos[2]=-pos[1]*si;
    pos[1]=+pos[1]*ci;
    x=pos[0]; y=pos[1];
    pos[0]=x*cO-y*sO;
    pos[1]=x*sO+y*cO;

    if ((mother>=0)&&(tab!=NULL)) vector_add(pos,pos,tab[mother].pos); // if satelite like Moon add owners position
    rep.gpos_set(pos); // set the global position to transform matrix also
    }
//---------------------------------------------------------------------------

reper类非常复杂(类似于 GLM),您唯一需要的就是局部旋转(所有其他东西都是基本的)。就是这样lrotx works:

double c=cos(ang),s=sin(ang);
double rot[16],inv[16]; // rot is the rotation around x transform matrix
rot=(1, 0, 0, 0,
      0, c,-s, 0,
      0, s, c, 0,
      0, 0, 0, 1);
inv=inverse(rep); // inverse is inverse matrix 4x4
inv=inv*rot
rep=inverse(inv);
  • rep是输入和输出矩阵
  • ang是旋转角度 [rad]

现在您可以使用rep与地球局部坐标系进行转换

  • LCS 至 GCS(l2g) ... (gx,gy,gz)=rep*(lx,ly,lz)
  • GCS 至 LCS(g2l) ... (lx,ly,lz)=inverse(rep)*(gx,gy,gz)

local 是地球坐标系,global 是太阳坐标系

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

计算太阳位于地平线以下/之上 X 度的时间 的相关文章

随机推荐

  • JS 中的 getCurrentPosition 在 iOS 上不起作用

    我有一个页面 其中包含一个代码 该代码从设备获取当前位置 并使用以下代码根据该位置加载其他内容 if navigator geolocation navigator geolocation getCurrentPosition succes
  • JavaFX 自安装程序与 Inno Setup 5 - 允许用户更改安装目录

    我正在使用 Ant 为 JavaFX 应用程序构建自部署 EXE 当前 Inno Setup 将 EXE 放置在此处 C Users 用户名 AppData Local 应用程序名称 我想将其放置在不同的位置 并为用户提供覆盖它的选项 但是
  • 使用 SwiftUI WindowsGroup 关闭后恢复 macOS 窗口大小

    默认情况下 在使用 SwiftUI 的 macOS 应用程序上 窗口关闭后不会恢复窗口大小 有没有办法在关闭应用程序之前保留用户给出的任何大小和位置 基本上我想要关闭和打开以与用户时相同的方式进行操作退出并打开该应用程序 这里有什么需要补充
  • Window.open 作为模式弹出窗口?

    我要开window open作为模式弹出窗口 var features resizable yes status no scroll no help no center yes width 460 height 140 menubar no
  • 在 python shell 中向前和向后打印带有点的文本“正在加载”

    我想打印文本 正在加载 但它的点会前后移动 在shell 我正在创建一个文字游戏 因此它看起来会更好 我知道慢慢写一个字 但点也得往后退 我想我应该忘记点回来 为此 import sys import time shell sys stdo
  • ios 如何处理大文件上传?

    我的应用程序需要从用户手机上传视频文件 然后在服务器上进行处理 问题是文件大小可能达到 200 MB 以上 并且用户不会保持应用程序打开以等待文件上传 由于苹果不允许应用程序在后台运行超过有限的时间 如何确保我的文件已上传 我正在使用 af
  • Angular2 typescript 中的第三方 JS

    我对 Angular 和 TypeScript 很陌生 所以这可能是非常基本的 我正在尝试在模板中制作带有图表 使用 Chart js 的 angular2 组件 我意识到有一个图表指令正在开发 专门使用 Chart JS 但我想了解如何做
  • 在名称与其 getter 不同的字段上使用 jackson 注释 JsonUnwrapped

    我有一堂课 比如 class Car private Engine myEngine JsonProperty color private String myColor JsonProperty maxspeed private int m
  • Wikidata - SPARQL 查询的请求限制

    查询次数有限制吗Wikidata 仅 SPARQL 查询 不编辑 我找不到任何关于此的官方文档 我想知道每分钟 小时 以及每个 IP 地址 的强查询限制有多大 是的 有限制 单个查询当前限制为 1 分钟运行时间 文档在这里 https ww
  • 不变性的真正定义?

    我想知道不变性是如何定义的 如果这些值没有公开 因此无法修改 那么这就足够了吗 是否可以在类型内部修改值 而不是由类型的客户修改 或者只能将它们设置在构造函数中 如果是这样 在双重初始化的情况下 使用this结构上的关键字等 对于不可变类型
  • app.js 中的全局变量可在路由中访问吗?

    我如何设置一个变量app js并使其在所有路线上都可用 至少在index js文件位于路径中 使用express框架和node js 实际上 使用 Express 对象上可用的 set 和 get 方法可以很容易地做到这一点 示例如下 假设
  • 如何在 MATLAB 中删除轴

    axis off不工作 function displayResults filename hObject eventdata handles Open filename file for reading fid fopen filename
  • 为什么Java的Arrays.sort方法对不同的类型使用两种不同的排序算法?

    Java 6 的Arrays sort方法对基元数组使用快速排序 对对象数组使用合并排序 我相信大多数时候快速排序比合并排序更快并且消耗更少的内存 我的实验支持这一点 尽管两种算法都是 O n log n 那么为什么不同的类型使用不同的算法
  • AFNetworking-2 waitUntilFinished 不起作用

    我知道有另一个类似的问题 但它适用于旧版本的 AFNetworking 而且并没有真正回答它 我有以下代码 AFHTTPRequestOperationManager manager AFHTTPRequestOperationManage
  • Google Maps API a.lat 不是函数错误

    我正在创建一个代码 可以通过使用分割作为分隔符来协调 CSV 文件中的数据 并计算两个输入坐标之间的距离 但结果总是显示错误a lat is not a function 我已经在网上浏览了有关此特定错误类型的信息 但似乎找不到正确的解决方
  • C# 中可调整大小的表格布局面板

    我发现 c net 2 0 中的表格布局面板非常原始 我希望允许我的用户调整表格布局面板中的列大小 但没有现成的选项可以执行此操作 有没有办法至少找出光标是否直接位于单元格的任何边框上 如果是 则哪个单元格位于其下方 可能有了这些信息 我们
  • 如何使用应用内自定义键盘的按钮输入文本

    我制作了一个应用程序内自定义键盘 它取代了系统键盘 并在我点击内部时弹出UITextField 这是我的代码 class ViewController UIViewController var myCustomKeyboard UIView
  • 数据表过滤:linq 与过滤器?

    过滤内存对象 数据表 这样做之间有很大的不同吗 var t dt Select id 2 vs var g dt AsEnumerable Where f gt f id ToString 2 我假设DataTable Select需要更多
  • 在 3D 世界中渲染 2D 精灵?

    假设我有精灵的 png 如何在 OpenGL 中渲染 2D 精灵 将图像作为我想要实现的效果的示例 另外 我想在屏幕上覆盖武器 例如底部图像中的步枪 有谁知道我如何实现这两种效果 任何帮助是极大的赞赏 在 3D 术语中 这称为 广告牌 广告
  • 计算太阳位于地平线以下/之上 X 度的时间

    我想知道太阳在地平线以下 之上 X 度的时间是什么时候 例如 我想找到太阳位于地平线以下 19 75 度的时间 我认为这与函数中的最高点有关date sunrise date sunset但我不确定 提前致谢 收集您需要的日期的太阳星历数据