/  Yamcs PyMDB

Yamcs PyMDB

This library provides a Pythonic way to describe a Yamcs Mission Database.

Installing

Install with pip:

pip install --upgrade yamcs-pymdb

How it works

With PyMDB you create one or more System objects. A typical Yamcs Mission Database has at least one system representing the target spacecraft (or payload).

from yamcs.pymdb import *

satellite = System("MySat")
com = Subsystem(satellite, "COM")
eps = Subsystem(satellite, "EPS")
fc = Subsystem(satellite, "FC")

gse = System("GSE")

# ... add TM/TC definitions to each system

Then use PyMDB to generate an XTCE description (= XML file), one for each top-level system.

with open("satellite.xml", "wt") as f:
  satellite.dump(f)

with open("gse.xml", "wt") as f:
  gse.dump(f)

The generated files look somewhat like this:

satellite.xml
<?xml version="1.0" ?>
<SpaceSystem xmlns="http://www.omg.org/spec/XTCE/20180204" name="MySat">
  <TelemetryMetaData/>
  <CommandMetaData/>
  <SpaceSystem name="COM">
    <TelemetryMetaData/>
    <CommandMetaData/>
  </SpaceSystem>
  <SpaceSystem name="EPS">
    <TelemetryMetaData/>
    <CommandMetaData/>
  </SpaceSystem>
  <SpaceSystem name="FC">
    <TelemetryMetaData/>
    <CommandMetaData/>
  </SpaceSystem>
</SpaceSystem>
gse.xml
<?xml version="1.0" ?>
<SpaceSystem xmlns="http://www.omg.org/spec/XTCE/20180204" name="GSE">
  <TelemetryMetaData/>
  <CommandMetaData/>
</SpaceSystem>

Finally, reference the generated XML files in the mdb section of your Yamcs instance configuration file:

etc/yamcs.instance.yaml
mdb:
  - type: xtce
    args:
      file: mdb/satellite.xml
  - type: xtce
    args:
      file: mdb/gse.xml

Each time you make changes to the Python definition, regenerate the XML files, then restart Yamcs. Because the description is in Python, the changes are well suited for tracking with a standard version control system like git.

The autogenerated XML files are in XTCE 1.2 syntax, which is natively supported by Yamcs.

Table of Contents