D2S2 Scenario files (files with a .D2S2 file extension) are plain text serialised JSON files that contain the simulation settings, a list of model objects, and the model object dependencies. These scenario files are created whenever the Save Scenario button is pressed. Furthermore, loading the scenario file using the Open Scenario button recreates the settings, model objects, and dependencies as the project was when it was saved.
Scenario files can be edited using any text editor. They comprise the following sections:
These sections appear as a list of dictionaries in the .D2S2 file. An example of a shortened scenario file is shown below:
{
"$type": "D2S2.SimulationFramework.ScenarioFile, SimulationLibrary",
"Settings": {
"$type": "D2S2.SimulationFramework.SimulationSettings, SimulationLibrary",
...list of simulation settings...
},
"ModelObjects": {
"$type": "D2S2.SimulationFramework.ScenarioModelObjectDictionary, SimulationLibrary",
...list of model objects...
},
"Dependencies": {
"$type": "D2S2.SimulationFramework.DependencyDescriptor[], SimulationLibrary",
"$values": [
...Dependency bindings...
]
},
"InitScript": "D2S2.Models.Satellite.DefaultUiInitScript",
"RootModelObject": "Simulation Model"
}
We now cover each of the sections in more depth.
The same simulation settings that are available from the UI Simulation settings window (see this link for simulation setting details) are stored as a dictionary in the scenario file. For example,
"Settings": {
"$type": "D2S2.SimulationFramework.SimulationSettings, SimulationLibrary",
"SimulationStart": "2022-01-01T12:00:00",
"SimulationDuration": "00:00:00",
"SimulationEnd": "2022-01-01T12:00:00",
"SimulationPeriod": "00:00:01",
"SamplePeriod": "00:00:01",
"RunForever": true,
"RealTime": false,
"SamplePeriodMultiplier": 1
}
The model object list section is a list of serialized simulation model objects, specified as a list of dictionaries. Each of the model objects in the list is indicated by a name (identifier), its type (including full namespace), initial values, and input property values. An example of such a list is given below for a scenario containing three model objects; a satellite simulation container, a satellite structure, and a 6U-sized solar panel. These model objects are created with the identifiers "Simulation", "Satellite 1", and "Solar Panel 1", respectively.
"ModelObjects":{
"$type": "D2S2.Simulation.ScenarioModelObjectDictionary, D2S2",
"Simulation": {
""$type": "D2S2.Model.Satellite.SatelliteSimulation, D2S2Library"
},
"Satellite 1": {
"$type": "D2S2.Models.Satellite.CubeSatLibrary.CubeSat6UModel, CubeSatLibrary",
"NominalAlignment": 2,
"IncludeAeroDisturbance": true,
"IncludeSolarDisturbance": true,
"StructureMass": 6.0,
"StructureMomentOfInertia": "{{M11:0.10240864, M12:0.00003805, M13:0.00040984},
{M21:0.00003805, M22:0.14196956, M23:-0.00000069},
{M31:0.00040984, M32:-0.00000069, M33:0.03957005}
}",
"StructureCentreOfMass": "{X:0, Y:0, Z:0}"
},
"Solar Panel 1": {
"$type": "D2S2.Models.Satellite.CubeSatLibrary.CubeSat6USolarPanel, CubeSatLibrary",
"MaxMagneticMoment": 0.006,
"MaxSolarPower": 17.2,
"IsEnclosingPanel": false,
"Position": "{X:-0.25, Y:0.1, Z:-0.17}",
"Orientation": "{{M11:0.00000000, M12:0.00000000, M13:1.00000000},
{M21:1.00000000, M22:0.00000000, M23:0.00000000},
{M31:0.00000000, M32:1.00000000, M33:0.00000000}}"
},
}
To structure the model objects into an object graph (as in the D2S2 model view), it is necessary to define dependency bindings between objects. The dependency bindings section of the scenario file is a list of such binding definitions. The relationship between two objects can either be of type parent or child. The root parent object is the Simulation Model, which is dependent on models of the earth, sun moon, one or more satellites, as well as a number of geographic locations as children. In turn, each of these children objects are parents to other objects in the graph.
Each of the bindings is specified as a dictionary comprising the parent object, the parent's dependency property, as well as the name of the child object. If a parent object is dependent on multiple children objects, the names of the children are specified as a list. As an example, the dependency binding between the Simulation model and the satellite SimSat, as well as the dependency bindings between SimSat and its components are shown below:
"Dependencies": {
"$type": "D2S2.Simulation.DependencyDescriptor[], D2S2",
"$values": [
{
"$type": "D2S2.Simulation.DependencyDescriptor, D2S2",
"ParentObjName": "Simulation",
"ParentDependencyProperty": "Satellites",
"ChildObjNames": "{SimSat}"
},
{
"$type": "D2S2.Simulation.DependencyDescriptor, D2S2",
"ParentObjName": "SimSat",
"ParentDependencyProperty": "Components",
"ChildObjNames": "{SimSat EPS,SimSat Electric Load,SimSat ACS,SimSat Imager,SimSat Cover Panel +Xa,SimSat Cover Panel -Xa,SimSat Cover Panel +Ya,SimSat Cover Panel -Ya,SimSat Cover Panel +Za,SimSat Solar Panel -Za,SimSat Deployed Solar Panel a,SimSat Deployed Solar Panel b}"
},
... other object dependencies from the SimSat tutorial scenario...
]
}