Skip to content

Commit

Permalink
Burn renders a nominal *looking* Hohmann transfer in my example, but …
Browse files Browse the repository at this point in the history
…the final orbit is MUCH higher than it should
  • Loading branch information
ChristopherRabotin committed Apr 27, 2017
1 parent 6a70355 commit 972a6fb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 27 deletions.
31 changes: 18 additions & 13 deletions cmd/mission/example.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[mission]
start = "2015-02-03 15:16:17" # or JDE
end = "2015-03-03 15:16:17" # or JDE
step = "10s" # Must be parsable by Go's time.
start = "2015-02-03 00:00:00" # or JDE
end = "2015-02-15 00:00:00" # or JDE

[spacecraft]
name = "MRO"
Expand All @@ -10,12 +9,12 @@ dry = 500

[orbit]
body = "Earth"
sma = 7000
ecc = 0.01
inc = 10.6
RAAN = 36
argPeri = 36
tAnomaly = 1
sma = 6469
ecc = 0.0
inc = 0.0
RAAN = 0.0
argPeri = 0.0
tAnomaly = 90
#position = [] #[x, y, z]
#velocity = [] #[xdot ydot zdot]

Expand All @@ -31,10 +30,16 @@ J4 = true
bodies = ["Earth", "Sun", "Venus", "Jupiter"]

[burns.0]
date = "2015-02-10 15:16:17" # or JDE
V = 1
N = 2
C = 3
date = "2015-02-03 00:30:00" # or JDE
V = 2.457038
N = 0
C = 0

[burns.1]
date = "2015-02-03 05:45:20"
V = -1.478187
N = 0
C = 0

[measurements]
output = "meas.csv"
Expand Down
9 changes: 2 additions & 7 deletions cmd/mission/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const (

var (
scenario string
timeStep time.Duration
verbose bool
)

Expand All @@ -48,10 +47,6 @@ func main() {
// Read Mission parameters
startDT := confReadJDEorTime("mission.start")
endDT := confReadJDEorTime("mission.end")
timeStep = viper.GetDuration("mission.step")
if verbose {
log.Printf("[conf] time step: %s\n", timeStep)
}

// Read spacecraft
scName := viper.GetString("spacecraft.name")
Expand Down Expand Up @@ -113,11 +108,11 @@ func main() {
if burnDT.After(endDT) || burnDT.Before(startDT) {
log.Printf("[WARNING] burn scheduled out of propagation time")
} else if verbose {
log.Printf("added: %s", sc.Maneuvers[burnDT])
log.Printf("Scheduled burn %s @ %s", sc.Maneuvers[burnDT], burnDT)
}
}

smd.NewMission(sc, scOrbit, startDT, endDT, perts, false, smd.ExportConfig{}).Propagate()
smd.NewMission(sc, scOrbit, startDT, endDT, perts, false, smd.ExportConfig{AsCSV: false, Cosmo: true, Filename: scName}).Propagate()
}

func confReadJDEorTime(key string) (dt time.Time) {
Expand Down
11 changes: 11 additions & 0 deletions mission.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,17 @@ func (a *Mission) Func(t float64, f []float64) (fDot []float64) {
bodyAcc := -tmpOrbit.Origin.μ / math.Pow(Norm(R), 3)
_, _, i, Ω, _, _, _, _, u := tmpOrbit.Elements()
Δv = Rot313Vec(-u, -i, -Ω, Δv)
// Check if any impulse burn, and execute them if needed.
if maneuver, exists := a.Vehicle.Maneuvers[a.CurrentDT.Truncate(StepSize)]; exists {
if !maneuver.done {
a.Vehicle.logger.Log("level", "info", "subsys", "astro", "date", a.CurrentDT, "thrust", "impulse", "v(km/s)", maneuver.Δv())
Δv[0] += maneuver.V
Δv[1] += maneuver.N
Δv[2] += maneuver.C
maneuver.done = true
a.Vehicle.Maneuvers[a.CurrentDT.Truncate(StepSize)] = maneuver
}
}
// d\vec{R}/dt
fDot[0] = f[3]
fDot[1] = f[4]
Expand Down
7 changes: 0 additions & 7 deletions spacecraft.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@ func (sc *Spacecraft) Accelerate(dt time.Time, o *Orbit) (Δv []float64, fuel fl
thrust := 0.0
fuel = 0.0
Δv = make([]float64, 3)
// Check if any impulse burn, and execute them if needed.
if maneuver, exists := sc.Maneuvers[dt.Truncate(StepSize)]; exists {
sc.logger.Log("level", "info", "subsys", "astro", "date", dt, "thrust", "impulse", "v(km/s)", maneuver.Δv(), "orbit", o, "period", o.Period())
Δv[0] += maneuver.V
Δv[1] += maneuver.N
Δv[2] += maneuver.C
}
for _, wp := range sc.WayPoints {
if sc.EPS == nil {
panic("cannot attempt to reach any waypoint without an EPS")
Expand Down

0 comments on commit 972a6fb

Please sign in to comment.