Scheduling with Scripts
As scenarios grow in size and complexity, scripting becomes benificial or even necessary.
Optimizing Ground Station Location
An iterative approach to STK Scheduler allows for many optimization abilities. Given several satellites and ground stations STK Scheduler, automated via script, can determine the optimal location of the ground stations for maximizing possiable contact duration. The following steps will outline the procedure for deciding the location of a third ground station given two fixed locations. The figure of merit deciding the optimal location will be assessed by the ratio of assigned contact tasks vs. unassigned timeslots.
Python 2.7 is required for this Use Case
File: Script_Analysis.vdf Path: C:\Program Files\AGI\STK 11\STKScheduler\Scenarios\Use Cases
File: Script_Analysis.py Path: C:\Program Files\AGI\STK 11\STKScheduler\Examples\TCP\Python
Line 163 of Script_Analysis.py will automatically ingest the Script_Analysis.txt commands from the program files. If you wish to ingest the commands you construct in these steps, change the current path to your saved commands absolute path. (See step 6)
- Open STK Scheduler.
- Load the associated STK Scenario.
- Navigate to Schedule > STK > Load Scenario....
- In the Schedule Properties window, click Change Scenario.
- Select the file path to Script_Analysis.vdf.
- Click Open then OK and the STK scenario will be associated with your Scheduler file.
- Ingest Resources from STK.
- Navigate to Resource > Ingest From STK > All.
- In the Select Map Objects for Resource Creation window, use Ctrl + click to select all satellite and facility resources.
- Click OK.
- Edit the ingested Resources.
- Adjust satellite attributes.
- Navigate to Resource > Edit Resource.
- On the left side of the Resource Editor window use Ctrl + click to select all GPS satellite resources.
- In the General tab, locate the New Group field and enter "MEO".
- Click the Create button next to New Group.
- Select the MEO resource group under Available Groups.
- Click the right arrow button to add MEO to the Included Groups.
- Click Update.
- Create Task definitions.
- Go to Task > New Task.
- In the Task ID: field, enter "F1_Contact".
- In the Duration tab, select the radio button next to Variable Duration.
- Set the Min Total Duration to 1 minute and the Max Total Duration to unlimited.
- Click the check box next to Allow Multiple Segments.
- Adjust the Min Segment Duration to 1 minute.
- Click the check box next to Allow Resource Change Between Segments and select the Allow Gaps radio button.
- Construct "_1ofMEOs' Constraint Group
- In the Resources tab, select "MEO" under Available Resource Groups: and click the right arrow button.
- Select the radio button next to Resources From Group and change the field to 1 resource from group.
- Click Create Group/List and enter "_1ofMEOs".
- Click OK and _1ofMEOs will appear under Available Resources.
- Create the following Resource Constraints string: <"Facility1" AND "_1ofMEOs">.
- Click Create Possibilities, then Update.
- Click Create New Task then repeat steps 5 B-G,I for "F2_Contact" and "F3_Contact" with the respective Resource Constraints string: <"Facility2" AND "_1ofMEOs">, <"Facility3" AND "_1ofMEOs">.
- Click Close.
- Edit script.
- Open Script_Analysis.py in the editor of your choice.
- Ensure lines 21-23 are correct.
- Export Commands
- In Scheduler, navigate to File > Export Commands As... and save the commands in the location of your choice.
- Change line 163 from: command = "IngestCommands 'C:\Program Files\AGI\STK 11\STKScheduler\Examples\TCP\Python\Script_Analysis.txt'" to: command = "IngestCommands '<your absolute path>'"
- Save Script_Analysis.py
- Run the python optimization script.
- Run Script_Analysis.py in your method of choice.
The script will print the location number, Latitude, Longitude, and figure of merit (Assigned vs. Unassigned ratio) for the optimal ground station location. It may be beneficial to view the final Schedule and STK Scenario as well.
Ingest Command File
A sample ingest command file named Script_Analysis.txt is available in the Examples/Use Cases folder. Ingesting that file will replicate the schedule described here.