korba 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/korba/orbit_utils.rb +6 -8
- data/lib/korba/propagator/kepler.rb +54 -0
- data/lib/korba/version.rb +1 -1
- data/lib/korba.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 82d326cac0ea342432bbb082f3abf220a6104073c070bc9c634bab9bb981c388
|
|
4
|
+
data.tar.gz: 0254dd92e20901966e424acf29a1c1cdc4c44128499e2c85b3fac3cb10fe89f9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a8c434b74a17a64f5ad4367a41391ec85345021f1b1de5ad741b9632a49ae92d123eb8aac9dd22e262a01953012862862a396fe9e5b6429dd5a126412d813bc4
|
|
7
|
+
data.tar.gz: f6e6c90bc931c98854823baa0089b6dff556b70def4a1a0d72f1544e633cc9745097506b00f422812ddbb4f598d640df53d18dfd6576145a2b19361cdc75270c
|
data/CHANGELOG.md
CHANGED
data/lib/korba/orbit_utils.rb
CHANGED
|
@@ -7,6 +7,10 @@ module Korba
|
|
|
7
7
|
(Constant::GME / (mean_motion * 2.0 * Math::PI / 86400.0) ** 2.0) ** (1.0 / 3.0)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
+
def period
|
|
11
|
+
2.0 * Math::PI * Math.sqrt(semi_major_axis ** 3 / Constant::GME)
|
|
12
|
+
end
|
|
13
|
+
|
|
10
14
|
def height_at_perigee
|
|
11
15
|
semi_major_axis * (1 - eccentricity) - Constant::EARTH_RADIUS
|
|
12
16
|
end
|
|
@@ -50,10 +54,7 @@ module Korba
|
|
|
50
54
|
end
|
|
51
55
|
|
|
52
56
|
def normalize_rad(rad)
|
|
53
|
-
rad
|
|
54
|
-
normalize_rad = rad > 2.0 * Math::PI ? rad - 2.0 * Math::PI : rad
|
|
55
|
-
normalize_rad(normalize_rad) if normalize_rad != rad
|
|
56
|
-
normalize_rad
|
|
57
|
+
rad % (2.0 * Math::PI)
|
|
57
58
|
end
|
|
58
59
|
|
|
59
60
|
def rad_to_deg(rad)
|
|
@@ -62,10 +63,7 @@ module Korba
|
|
|
62
63
|
end
|
|
63
64
|
|
|
64
65
|
def normalize_deg(deg)
|
|
65
|
-
deg
|
|
66
|
-
normalized_deg = deg > 360.0 ? deg - 360.0 : deg
|
|
67
|
-
normalize_deg(normalized_deg) if normalized_deg != deg
|
|
68
|
-
normalized_deg
|
|
66
|
+
deg % 360.0
|
|
69
67
|
end
|
|
70
68
|
end
|
|
71
69
|
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
module Korba
|
|
2
|
+
module Propagator
|
|
3
|
+
class Kepler
|
|
4
|
+
include OrbitUtils
|
|
5
|
+
|
|
6
|
+
def initialize(initial_kep, disable_j2: false)
|
|
7
|
+
@initial_kep = initial_kep
|
|
8
|
+
@disable_j2 = disable_j2
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def propagate(seconds_after_epoch)
|
|
12
|
+
mean_motion = Math.sqrt(Constant::GME / @initial_kep.semi_major_axis ** 3)
|
|
13
|
+
mean_anomaly = rad_to_deg(deg_to_rad(@initial_kep.mean_anomaly) + mean_motion * seconds_after_epoch)
|
|
14
|
+
|
|
15
|
+
Kep.new(
|
|
16
|
+
object_name: @initial_kep.object_name,
|
|
17
|
+
epoch: @initial_kep.epoch + seconds_after_epoch,
|
|
18
|
+
semi_major_axis: @initial_kep.semi_major_axis,
|
|
19
|
+
eccentricity: @initial_kep.eccentricity,
|
|
20
|
+
inclination: @initial_kep.inclination,
|
|
21
|
+
ra_of_asc_node: ra_of_asc_node(seconds_after_epoch),
|
|
22
|
+
arg_of_pericenter: arg_of_pericenter(seconds_after_epoch),
|
|
23
|
+
mean_anomaly: mean_anomaly,
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def ra_of_asc_node(seconds_after_epoch)
|
|
30
|
+
return @initial_kep.ra_of_asc_node if @disable_j2
|
|
31
|
+
|
|
32
|
+
rad_to_deg(deg_to_rad(@initial_kep.ra_of_asc_node) + ra_of_asc_node_dot_radian * seconds_after_epoch)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def ra_of_asc_node_dot_radian
|
|
36
|
+
-(3 * Math::PI * Constant::J2 *
|
|
37
|
+
(Constant::EARTH_RADIUS / @initial_kep.semi_major_axis * (1 - @initial_kep.eccentricity ** 2)) ** 2 *
|
|
38
|
+
Math.cos(deg_to_rad(@initial_kep.inclination))) / @initial_kep.period
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def arg_of_pericenter(seconds_after_epoch)
|
|
42
|
+
return @initial_kep.arg_of_pericenter if @disable_j2
|
|
43
|
+
|
|
44
|
+
rad_to_deg(deg_to_rad(@initial_kep.arg_of_pericenter) + arg_of_pericenter_dot_radian * seconds_after_epoch)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def arg_of_pericenter_dot_radian
|
|
48
|
+
(3 * Math::PI / 2.0 * Constant::J2 *
|
|
49
|
+
(Constant::EARTH_RADIUS / @initial_kep.semi_major_axis * (1 - @initial_kep.eccentricity ** 2)) ** 2 *
|
|
50
|
+
(5 * (Math.cos(deg_to_rad(@initial_kep.inclination)) ** 2) - 1)) / @initial_kep.period
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
data/lib/korba/version.rb
CHANGED
data/lib/korba.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: korba
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kk0000-kk
|
|
@@ -26,6 +26,7 @@ files:
|
|
|
26
26
|
- lib/korba/kep.rb
|
|
27
27
|
- lib/korba/keplers_equation.rb
|
|
28
28
|
- lib/korba/orbit_utils.rb
|
|
29
|
+
- lib/korba/propagator/kepler.rb
|
|
29
30
|
- lib/korba/propagator/rk4.rb
|
|
30
31
|
- lib/korba/propagator/sgp4.rb
|
|
31
32
|
- lib/korba/sgp4/elset_rec.rb
|