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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5dc3a4abbdd189f4388673e3960a615940a4feb68c359cce37a29ff47fa7efcb
4
- data.tar.gz: c312b2be706e321242d0f4c762134ad82ea681348e5631ec36a13ed91c36db11
3
+ metadata.gz: 82d326cac0ea342432bbb082f3abf220a6104073c070bc9c634bab9bb981c388
4
+ data.tar.gz: 0254dd92e20901966e424acf29a1c1cdc4c44128499e2c85b3fac3cb10fe89f9
5
5
  SHA512:
6
- metadata.gz: f0cc15b9fa16cec125d3902e3b52e1336acf4246c72860049955c32456d1eaa0e56a2fd99953477d36141da23b3b8696ed0b8a611c80bc51e1249368c7f07f84
7
- data.tar.gz: ffcbf5ed21c86f069d83276227c9db29e5b59d257d1630f5a1fb15eaff0550b881b1e7753fcc551ce6c647c49faf2bc84ee52efb015fbd9ad8efa9355b2da6ad
6
+ metadata.gz: a8c434b74a17a64f5ad4367a41391ec85345021f1b1de5ad741b9632a49ae92d123eb8aac9dd22e262a01953012862862a396fe9e5b6429dd5a126412d813bc4
7
+ data.tar.gz: f6e6c90bc931c98854823baa0089b6dff556b70def4a1a0d72f1544e633cc9745097506b00f422812ddbb4f598d640df53d18dfd6576145a2b19361cdc75270c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.9.0] - 2026-05-04
2
+
3
+ - Enable orbit propagation with Keplerian elements
4
+
1
5
  ## [0.8.0] - 2026-04-19
2
6
 
3
7
  - Enable orbit propagation using 4th-order Runge-Kutta
@@ -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 = rad + 2.0 * Math::PI if rad < 0
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 = deg + 360.0 if deg < 0
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Korba
4
- VERSION = "0.8.0"
4
+ VERSION = "0.9.0"
5
5
  end
data/lib/korba.rb CHANGED
@@ -10,6 +10,7 @@ require_relative "korba/keplers_equation"
10
10
  require_relative "korba/sgp4/elset_rec"
11
11
  require_relative "korba/propagator/sgp4"
12
12
  require_relative "korba/propagator/rk4"
13
+ require_relative "korba/propagator/kepler"
13
14
 
14
15
  module Korba
15
16
  end
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.8.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