Skip to content

Commit

Permalink
New tools documentation (#163)
Browse files Browse the repository at this point in the history
* Made xtce documentation in tools and added files with toctree. Had to rebase.
  • Loading branch information
GFMoraga authored Sep 26, 2023
1 parent dc0fb67 commit 0865c82
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/source/development/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ A typical development workflow might look like the following:
doc-overview
release-workflow
style-guide/style-guide
tools/index
poetry
7 changes: 7 additions & 0 deletions docs/source/development/tools/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Tools
=====

.. toctree::
:maxdepth: 1

xtce_generator
84 changes: 84 additions & 0 deletions docs/source/development/tools/xtce_generator.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
.. _xtce_generator:

Generating Telemetry XML with Python Script
===========================================

Here is some info on `XTCE <https://public.ccsds.org/Pubs/660x2g2.pdf/>`_. This Green
Book introduces the main concepts of XML Telemetric and Command Exchange (XTCE), a
telemetry and telecommand database format for spacecraft monitoring
and control.

General
-------

This document provides steps and information on how to use
`xtce_generator_template.py` script as a base for users to generate
telemetry XML files. The script is designed to simplify the process of creating
telemetry definitions for various packet types.

The script is located in the `tools/xtce_generation` directory. The script is called
`xtce_generator_template.py`. The script is a ``template`` that can be modified to
generate telemetry XML files for different packet types. Your new file should be
called `xtce_generator_yourinstrument.py`.
An example of how to use the script is `xtce_generator_codice.py` which is also
located in the `tools/xtce_generation` directory.

Before you Start
----------------

Generating XTCEs is only done whenever packet definitions get updated, and thus it
is not a part of the main processing package. To use it there are a few extra
dependencies like ``pandas`` that you can install with

.. code::
poetry install --extras tools
How to Use
----------

Define the instrument name in the `main()` function by setting the `instrument_name`
variable to the name of your instrument.

.. code::
instrument_name = "your_instrument_name"
In the code, file paths are being configured. Make sure to change the file paths to
match your instrument's file structure.

.. code::
current_directory = Path(__file__).parent
module_path = f"{current_directory}/../../imap_processing"
# This is the path of the output directory
packet_definition_path = f"{module_path}/{instrument_name}/packet_definitions"
# This is the path to the excel file that contains the telemetry definitions
path_to_excel_file = f"{current_directory}/your_packet.xlsx"
Define packet names and `Application Process Identifiers (APIDs)
<https://sanaregistry.org/r/space_packet_protocol_application_process_id/>`_.
The packet names are **case sensitive** meaning the the packet names need to be exactly
what the tabs of the spreadsheet are. APID's must match the names and apIds in the
packet definition file. You can use as many packet names and apIds as you want.
The APID should be an integer (not hexadecimal).
Follow the format below.

.. code::
packets = {
# Define packet names and associated Application IDs (apId)
"your_packet_A": ####,
"your_packet_B": ####,
# ... (other packet definitions)
}
Generating Telemetry XML Files
-------------------------------

Once you have your xtce processing file defined, you can run it with the
following command:

.. code::
python xtce_generator_instrument_name.py

0 comments on commit 0865c82

Please sign in to comment.