This example shows how satellite power system designed in Simulink can be integrated with STK for testing and analysis of that system. An STK scenario is used to generate inputs to the Simulink power model by determining sunlight exposure, experiment times, and downlink times. A level-2 s-function block is used to host the STK application. When the Simulink model is run, an STK scenario will be built that includes a satellite, an area target to be imaged (experiment), and a ground station for downlink (communications). As Simulink executes the model through time, it will query STK for updates on the state of the satellite. STK will return 1 or 0 for these three states, In Sunlight, Conducting Experiment (access to area target), Conducting Downlink (link budget with ground station where BER < 1e-8). These values will feed into the power model to determine the current state of the battery. Requirements
Instructions for use
- MATLAB+Simulink, R2012b or later , 32-bit
- STK 10.0.1 or later
- STK-to-Matlab Connectors for 32-bit
- Open MATLAB and browse to the SolarEnergy directory
- It is important that the current directory in MATLAB contains all the files in the SolarEnergy directory, or it will not find the s-function necessary for the simulation.
- Open SolarEnergy.slx in Simulink
- Run the Simulation
- Open the PowerLevel output scope block. Notice the change in battery power over time due to depletion from normal system operations, experiments, and communications.
The s-function block relies on the stk_level2_mfile.m function to interact with the STK scenario. The STK scenario is started and built with the code that can be found in InitFcn_TestCode.m. This code is then copied into the s-function’s InitFcn callback (right click on the s-function block, select Properties, and then Callbacks tab).