Main Content

restart

Restart simulation from beginning

    Description

    example

    restart(sc) resets the satellite scenario sc to the initial start time.

    Examples

    collapse all

    Create a satellite scenario object and set the AutoSimulate property to false to enable manual simulation of the satellite scenario.

    startTime = datetime(2022,1,12);
    stopTime = startTime + days(0.5);
    sampleTime = 60;                             % Seconds
    sc = satelliteScenario('AutoSimulate',false);

    Add a GPS satellite constellation to the scenario.

    sat = satellite(sc,"gpsAlmanac.txt");

    Simulate the scenario using the advance function.

    while advance(sc)
    end

    Obtain the satellite position histories.

    p = states(sat);

    AutoSimulate is false, so restart the scenario before adding a ground station.

    restart(sc);

    Add a ground station to the scenario.

    gs = groundStation(sc);

    Add access analysis between each satellite and ground station.

    ac = access(sat,gs);

    Simulate the scenario and determine the access intervals.

    while advance(sc)
    end
    intvls1 = accessIntervals(ac)
    intvls1=35×8 table
         Source           Target           IntervalNumber         StartTime                EndTime           Duration    StartOrbit    EndOrbit
        ________    ___________________    ______________    ____________________    ____________________    ________    __________    ________
    
        "PRN:1"     "Ground station 32"          1           11-Jan-2020 23:20:25    12-Jan-2020 05:15:47      21322        NaN          NaN   
        "PRN:2"     "Ground station 32"          1           12-Jan-2020 04:03:16    12-Jan-2020 07:40:50      13055        NaN          NaN   
        "PRN:3"     "Ground station 32"          1           11-Jan-2020 19:50:06    11-Jan-2020 21:38:53     6527.3        NaN          NaN   
        "PRN:3"     "Ground station 32"          2           12-Jan-2020 01:52:43    12-Jan-2020 06:42:49      17406        NaN          NaN   
        "PRN:4"     "Ground station 32"          1           11-Jan-2020 19:50:06    12-Jan-2020 00:11:11      15665        NaN          NaN   
        "PRN:4"     "Ground station 32"          2           12-Jan-2020 04:54:02    12-Jan-2020 07:40:50      10008        NaN          NaN   
        "PRN:5"     "Ground station 32"          1           12-Jan-2020 05:52:03    12-Jan-2020 07:40:50     6527.3        NaN          NaN   
        "PRN:6"     "Ground station 32"          1           12-Jan-2020 02:43:29    12-Jan-2020 07:40:50      17841        NaN          NaN   
        "PRN:7"     "Ground station 32"          1           11-Jan-2020 21:09:52    12-Jan-2020 03:27:00      22628        NaN          NaN   
        "PRN:8"     "Ground station 32"          1           11-Jan-2020 20:33:36    12-Jan-2020 03:19:45      24369        NaN          NaN   
        "PRN:9"     "Ground station 32"          1           11-Jan-2020 19:50:06    12-Jan-2020 00:47:27      17841        NaN          NaN   
        "PRN:9"     "Ground station 32"          2           12-Jan-2020 05:08:32    12-Jan-2020 07:40:50     9138.2        NaN          NaN   
        "PRN:10"    "Ground station 32"          1           12-Jan-2020 00:32:56    12-Jan-2020 01:59:58     5221.8        NaN          NaN   
        "PRN:11"    "Ground station 32"          1           11-Jan-2020 22:15:09    12-Jan-2020 04:39:32      23063        NaN          NaN   
        "PRN:12"    "Ground station 32"          1           12-Jan-2020 04:32:16    12-Jan-2020 07:40:50      11314        NaN          NaN   
        "PRN:13"    "Ground station 32"          1           12-Jan-2020 00:03:56    12-Jan-2020 02:50:44      10008        NaN          NaN   
          ⋮
    
    

    Visualize the simulation results.

    v = satelliteScenarioViewer(sc,'ShowDetails',false);
    play(sc);

    Verify that the access intervals are the same when you set the AutoSimulate property to true.

    sc.AutoSimulate = true;
    intvls2 = accessIntervals(ac)
    intvls2=35×8 table
         Source           Target           IntervalNumber         StartTime                EndTime           Duration    StartOrbit    EndOrbit
        ________    ___________________    ______________    ____________________    ____________________    ________    __________    ________
    
        "PRN:1"     "Ground station 32"          1           11-Jan-2020 23:20:25    12-Jan-2020 05:15:47      21322        NaN          NaN   
        "PRN:2"     "Ground station 32"          1           12-Jan-2020 04:03:16    12-Jan-2020 07:48:06      13490        NaN          NaN   
        "PRN:3"     "Ground station 32"          1           11-Jan-2020 19:50:06    11-Jan-2020 21:38:53     6527.3        NaN          NaN   
        "PRN:3"     "Ground station 32"          2           12-Jan-2020 01:52:43    12-Jan-2020 06:42:49      17406        NaN          NaN   
        "PRN:4"     "Ground station 32"          1           11-Jan-2020 19:50:06    12-Jan-2020 00:11:11      15665        NaN          NaN   
        "PRN:4"     "Ground station 32"          2           12-Jan-2020 04:54:02    12-Jan-2020 07:48:06      10444        NaN          NaN   
        "PRN:5"     "Ground station 32"          1           12-Jan-2020 05:52:03    12-Jan-2020 07:48:06     6962.4        NaN          NaN   
        "PRN:6"     "Ground station 32"          1           12-Jan-2020 02:43:29    12-Jan-2020 07:48:06      18276        NaN          NaN   
        "PRN:7"     "Ground station 32"          1           11-Jan-2020 21:09:52    12-Jan-2020 03:27:00      22628        NaN          NaN   
        "PRN:8"     "Ground station 32"          1           11-Jan-2020 20:33:36    12-Jan-2020 03:19:45      24369        NaN          NaN   
        "PRN:9"     "Ground station 32"          1           11-Jan-2020 19:50:06    12-Jan-2020 00:47:27      17841        NaN          NaN   
        "PRN:9"     "Ground station 32"          2           12-Jan-2020 05:08:32    12-Jan-2020 07:48:06     9573.3        NaN          NaN   
        "PRN:10"    "Ground station 32"          1           12-Jan-2020 00:32:56    12-Jan-2020 01:59:58     5221.8        NaN          NaN   
        "PRN:11"    "Ground station 32"          1           11-Jan-2020 22:15:09    12-Jan-2020 04:39:32      23063        NaN          NaN   
        "PRN:12"    "Ground station 32"          1           12-Jan-2020 04:32:16    12-Jan-2020 07:48:06      11749        NaN          NaN   
        "PRN:13"    "Ground station 32"          1           12-Jan-2020 00:03:56    12-Jan-2020 02:50:44      10008        NaN          NaN   
          ⋮
    
    

    Visualize the scenario.

    play(sc);

    Input Arguments

    collapse all

    Satellite scenario, specified as a satelliteScenario object. The argument applies only if the AutoSimulate property of the sc object is false.

    The timeline and playback widgets on the open satellite scenario viewers that were previously made available after calling the play function become unavailable for interaction.

    Version History

    Introduced in R2022a