Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
Let's try testing this
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherRabotin committed May 6, 2017
1 parent e7bbda2 commit 5e3815c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
20 changes: 0 additions & 20 deletions mission.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ func (a *Mission) LogStatus() {
// PropagateUntil propagates until the given time is reached.
func (a *Mission) PropagateUntil(dt time.Time, autoClose bool) {
if !a.propuntilCalled {
fmt.Println("adding first state")
a.CurrentDT = a.CurrentDT.Add(-2 * a.step)
a.SetState(0, a.GetState())
a.LogStatus()
Expand All @@ -98,7 +97,6 @@ func (a *Mission) PropagateUntil(dt time.Time, autoClose bool) {
}
// For the final propagation report says the exact prop time, we update the start date time.
a.StartDT = a.CurrentDT.Add(-a.step)
//fmt.Printf("%s -> %s\n", a.StartDT, a.StopDT)
a.Propagate()
}

Expand Down Expand Up @@ -157,14 +155,8 @@ func (a *Mission) Stop(t float64) bool {
var stop bool
select {
case <-a.stopChan:
/*for _, histChan := range a.histChans {
close(histChan)
}
return true // Stop because there is a request to stop.
*/
stop = true
default:
//a.CurrentDT = a.CurrentDT.Add(a.step) // XXX: Should this be in SetState?
if a.StopDT.Before(a.StartDT) {
// A hard limit is set on a ten year propagation.
kill := false
Expand All @@ -180,26 +172,14 @@ func (a *Mission) Stop(t float64) bool {
}
}
}
/*for _, histChan := range a.histChans {
close(histChan)
}*/
stop = true
//return true
}
if a.CurrentDT.Sub(a.StopDT).Nanoseconds() > 0 {
/*if a.autoChanClosing {
for _, histChan := range a.histChans {
close(histChan)
}
}
return true // Stop, we've reached the end of the simulation.*/
stop = true
}
}
if stop {
if a.autoChanClosing {
//fmt.Println("about to stop, saving state")
//a.SetState(0, a.GetState())
for _, histChan := range a.histChans {
close(histChan)
}
Expand Down
5 changes: 2 additions & 3 deletions mission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ func TestMissionSTM(t *testing.T) {
startDT := time.Date(2017, 1, 1, 0, 0, 0, 0, time.UTC)
endDT := startDT.Add(time.Duration(24) * time.Hour)
dragExample := 1.2
for meth := 3; meth < 4; meth++ {
for meth := 1; meth < 4; meth++ {
// Define the orbits
leoMission := NewOrbitFromOE(7000, 0.00001, 30, 80, 40, 0, Earth)
// Initialize the mission and estimates
Expand Down Expand Up @@ -783,7 +783,6 @@ func TestMissionSTM(t *testing.T) {
} else {
prevDT = state.DT
}
fmt.Printf("%s \t %+v\n", state.DT, mat64.Formatted(state.Vector().T()))
if mat64.Equal(prevState, state.Vector()) {
t.Fatal("propagation not happening: previous state is equal to new state")
} else {
Expand All @@ -808,7 +807,7 @@ func TestMissionSTM(t *testing.T) {
}
t.Logf("real duration = %s", mission.CurrentDT.Sub(startDT))
if numStates != 86403 {
t.Fatalf("expected 86401 states to be processed, got %d (failed on %d)", numStates, meth)
t.Fatalf("expected 86403 states to be processed, got %d (failed on %d)", numStates, meth)
}
if meth == 2 {
cfgLoaded = false // Unload the modified config file
Expand Down

0 comments on commit 5e3815c

Please sign in to comment.