Skip to content

Trick Variable Mapping Definition

Philip Kunz edited this page Feb 10, 2022 · 2 revisions

Trick Variable Mapping (TVM) definition files are JSON formatted text files that define which variables are to be read from and pushed to each Trick Variable Server. Originally, it was required that each mapping had to be in a separate file. Now related mappings can be in a single TVM file.

Elements:

Key Value
cfsStructureType String type containing the CFS Data Structure Name whose fields will be mapped to Trick simulation variables
cfsStructureFileName String type containing the C-header file name which contains the CFS Data Type specified by the cfsStructureType key
members A JSON array containing a set of json objects - one JSON object per primitive type mapping. The schema describing a primitive type mapping for each JSON object in this array will be discussed in a later section called "Members Array JSON Object Schema".
messageId The message ID associated with particular "instance" of a CFS data type
flowDirection An integer type that can be 1, 2, or 3.
- 1, this mapping only applies to data flowing from Trick to CFS.
- 2, this mapping only applies to data flowing from CFS to Trick.
- 3, then this mapping is "bi-directional" and applies to data flowing in either direction betweeen CFS and Trick.
connectionIndex Zero based index to indicate which trick sim connection a structure is tied with. The index should correspond to the trick variable server IP and port (TVS_SERVER_IPS, TVS_SERVER_PORTS) defined in tvs_io_platform_cfg.h
- Optional, default=0
- Only use if there are multiple trick simulations with which to transfer data)
commandCode If supplied, the command code will be coupled with a particular message ID to uniquely identify a particular mapping.
- Optional
- Only used for mappings with a CCSDS Telecommand Message ID

cfsStructureType

Name of the C struct that values will be mapped to

members Array JSON Object Schema

For each mapping of a CFS data structure's primitive type member to a Trick simulation variable, the following key-value pairs must be defined:

  • trickVar: name of trick variable that will be mapped
  • trickType: C type of mapped trick variable
  • cfsVar: member of cfsStructureType that will be mapped
  • cfsType: C type of mapped cfs data struct member

Type Conversions Between CFS & Trick Primitive Types

TVS_IO supports conversions between primitive data types in CFS and Trick. Moreover, TVMC has an extensible interface for extending supported type conversions to accomodate user-defined mappings between different types.

Currently supported default primitive type mappings from CFS to Trick include, respectively:

  • Signed/Unsigned Integer type <-> Signed/Unsigned Integer type
  • Float <-> Signed/Unsigned Integer Type (and vice versa)
  • Double <-> Signed/Unsigned Integer Type (and vice versa)
  • Float <-> Double (and vice versa)
  • Character/Byte Array <-> String

NOTE: Anywhere that "Signed/Unsigned Integer Type" is mentioned in the above list of mappings, that type may be a bit-field type. Due to the nature of the Trick binary data format for bit-fields, there is no need for any distinction between bit-fields and multi-byte integer words in the TVM specification.