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. (Optional) Share Blocks Between LRUs with Inheritance
If several LRUs need the same block, define it once and have the others inherit it instead of
copying the CSV. Add an lrus.json file beside the LRU folders (not inside any of them):
project_name/
├── lrus.json
├── LRUBase/
│ └── SharedBlock.csv
└── LRUDerived/
└── OwnBlock.csv
{
"LRUs": [
{ "name": "LRUDerived", "dependency": "LRUBase" }
]
}
LRUDerived now has both SharedBlock (inherited) and its own OwnBlock — see LRU Inheritance in the full reference for how this is laid out in memory.
4. (Optional) Pull In a Shared ICD Package with Addons
To reuse a whole external ICD package (its own LRUs, blocks, and enums) across multiple projects instead of
copying its files into each one, list its folder in an lrus-addon.json file beside lrus.json:
project_name/
├── lrus.json
├── lrus-addon.json
└── LRU_name/
└── Block_name.csv
[
"c:/dev/simD/CoreEng/CoreEngICDAddons/FlightModel_Advance/"
]
DBSimGenerator loads every LRU from each listed addon folder, shows them alongside your project's own LRUs, and generates their code into the same coredb/ output folder — see ICD Addons in the full reference for details.
5. 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 |
6. 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 | – | – | – |
7. 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 |
8. 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.
9. 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.