@@ -337,9 +337,13 @@ def _init_simulator(self) -> None:
337
337
].recorder ()
338
338
self .eclipse_log = self .eclipseObject .eclipseOutMsgs [0 ].recorder ()
339
339
340
+ self ._time_log = []
340
341
self .AddModelToTask (simTaskName , self .sc_state_log )
342
+ self ._r_BN_N_log = []
341
343
self .AddModelToTask (simTaskName , self .planet_state_log )
344
+ self ._J20002Pfix_log = []
342
345
self .AddModelToTask (simTaskName , self .eclipse_log )
346
+ self ._shadowFactor_log = []
343
347
344
348
self .InitializeSimulation ()
345
349
@@ -351,7 +355,7 @@ def sim_time(self) -> float:
351
355
@property
352
356
def times (self ) -> np .ndarray :
353
357
"""Recorder times in seconds."""
354
- return np . array ([ macros .NANO2SEC * t for t in self . sc_state_log . times ()] )
358
+ return macros .NANO2SEC * np . array ( self . _time_log )
355
359
356
360
def extend_to (self , t : float ) -> None :
357
361
"""Compute the trajectory of the satellite up to t.
@@ -363,12 +367,19 @@ def extend_to(self, t: float) -> None:
363
367
return
364
368
self .ConfigureStopTime (macros .sec2nano (t ))
365
369
self .ExecuteSimulation ()
370
+ self ._time_log .extend (self .sc_state_log .times ())
371
+ self ._r_BN_N_log .extend (self .sc_state_log .r_BN_N )
372
+ self ._J20002Pfix_log .extend (self .planet_state_log .J20002Pfix )
373
+ self ._shadowFactor_log .extend (self .eclipse_log .shadowFactor )
374
+ self .sc_state_log .clear ()
375
+ self .planet_state_log .clear ()
376
+ self .eclipse_log .clear ()
366
377
367
378
def _generate_eclipses (self , t : float ) -> None :
368
379
self .extend_to (t + self .dt )
369
380
upcoming_times = self .times [self .times > self ._eclipse_search_time ]
370
381
upcoming_eclipse = (
371
- self .eclipse_log . shadowFactor [self .times > self ._eclipse_search_time ] > 0
382
+ np . array ( self ._shadowFactor_log ) [self .times > self ._eclipse_search_time ] > 0
372
383
).astype (float )
373
384
for i in np .where (np .diff (upcoming_eclipse ) == - 1 )[0 ]:
374
385
self ._eclipse_starts .append (upcoming_times [i ])
@@ -412,7 +423,7 @@ def r_BN_N(self) -> interp1d:
412
423
self .extend_to (self .dt * 3 )
413
424
return interp1d (
414
425
self .times ,
415
- self .sc_state_log . r_BN_N ,
426
+ self ._r_BN_N_log ,
416
427
kind = "cubic" ,
417
428
axis = 0 ,
418
429
fill_value = "extrapolate" ,
@@ -427,9 +438,7 @@ def r_BP_P(self) -> interp1d:
427
438
self .times ,
428
439
[
429
440
np .matmul (dcm , pos )
430
- for dcm , pos in zip (
431
- self .planet_state_log .J20002Pfix , self .sc_state_log .r_BN_N
432
- )
441
+ for dcm , pos in zip (self ._J20002Pfix_log , self ._r_BN_N_log )
433
442
],
434
443
kind = "cubic" ,
435
444
axis = 0 ,
0 commit comments