This guide shows you how to structure your ICD CSV files and run them through DBSimGenerator to produce high-performance C++ simulation and interface code.
1. Understand What DBSimGenerator Does
DBSimGenerator automatically generates high-performance C++ code for simulation and interface directly from ICD (Interface Control Document) CSV files. Each CSV defines one block, containing fields and metadata describing how data is structured, scaled, and interpreted.
2. Organize Your CSV Directory
Arrange your ICD CSV files in a project → LRU → block structure:
project_name/
├── LRU_name/
│ ├── Block_name.csv
│ └── Enums.csv
3. Write the ICD CSV
Each row of a block CSV describes one field. A minimal example:
BlockName, FieldName, Type, Size, Description
Telemetry, Altitude, float, 4, Aircraft altitude (m)
Telemetry, Speed, float, 4, Airspeed (m/s)
A full ICD block definition includes these columns:
| # Bytes | Name | Data Type | Array Size | Bits | Bits Size | Enum | Value / Units | Eng Type | Scale | Default | Description |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 4 | Altitude | R4 | 1 | - | - | - | m | float | 1.0 | 0 | Aircraft altitude |
| 4 | Speed | R4 | 1 | - | - | - | m/s | float | 1.0 | 0 | Aircraft speed |
4. Choose the Correct Data Type Codes
Use these short type codes when specifying a field's Data Type:
| Short | Type | Size (Bytes) | Min | Max | Resolution |
|---|---|---|---|---|---|
| U1 | Unsigned Char | 1 | 0 | 255 | 1 |
| I1 | Signed Char | 1 | -128 | 127 | 1 |
| X1 | Bitfield | 1 | n/a | n/a | n/a |
| U2 | Unsigned Short | 2 | 0 | 65535 | 1 |
| I2 | Signed Short | 2 | -32768 | 32767 | 1 |
| X2 | Bitfield | 2 | n/a | n/a | n/a |
| U4 | Unsigned Long | 4 | 0 | 4,294,967,295 | 1 |
| I4 | Signed Long | 4 | -2,147,483,648 | 2,147,483,647 | 1 |
| X4 | Bitfield | 4 | n/a | n/a | n/a |
| R4 | IEEE 754 Single Precision | 4 | -1×2127 | 2127 | ≈2⁻²⁴ |
| R8 | IEEE 754 Double Precision | 8 | -1×21023 | 21023 | ≈2⁻⁵³ |
| X8 | Bitfield | 8 | – | – | – |
5. Define Enums
List named values in an Enums.csv file alongside your block CSVs:
| Name | Value |
|---|---|
| Mode_Manual | 0 |
| Mode_Auto | 1 |
| Error_None | 0x00 |
| Error_Sensor | 0x01 |
6. Run the Generator Workflow
- Prepare ICD CSV files and Enums for your blocks.
- Organize CSVs in the project → LRU → block structure.
- Run DBSimGenerator so it reads the CSVs and generates high-performance code.
- Integrate the generated code with your simulation frameworks and hardware drivers.
7. Take Advantage of Key Features
- High-Performance Code: generates optimized C++ code for fast simulations.
- RAW and ENG Types: supports both raw data and engineering unit conversions.
- Endian & Bit Ordering: handles Little/Big Endian and MSB/LSB conversions automatically.
- Hardware Integration: integrates directly with HW drivers using
streams.jsonfor seamless system communication. - Automated & Scalable: reduces repetitive coding across multiple blocks, LRUs, and projects.