DBSimGenerator
DBSimGenerator generates simulation and interface code automatically from ICD (Interface Control Document) CSV files. Each CSV defines one or more blocks, containing fields and metadata that describe how data is structured, scaled, and interpreted.
DBSimGenerator automatically generates high-performance C++ code for simulation and interface directly from ICD (Interface Control Document) CSV files. Each CSV defines one block with fields and metadata describing how data is structured, scaled, and interpreted.
Terminology: LRU, Block, Element
ICDs are organized in a three-level hierarchy:
- LRU (Line Replacement Unit) - one physical or logical
replaceable unit (a named CSV subfolder, e.g.
LRU_FC). An LRU holds a list of Blocks, and it's the LRU that defines the Raw ↔ Eng conversion for everything it contains - see Raw ↔ Eng Conversion in the Model guide. - Block - one CSV file within an LRU folder (e.g.
Telemetry.csv). A Block holds a list of Elements and is the unit that streams send and receive to/from a device - the"blocks"array in streams.json is a list of Blocks. - Element - one row of a Block CSV (one field), e.g.
AltitudeorSpeedin the example below.
CSV Directory Structure
project_name/ ├── LRU_name/ │ ├── Block_name.csv │ └── Enums.csv
LRU Inheritance
An LRU can inherit another LRU's blocks, so a block only has to be defined once even when
several LRUs need it. Declare the dependency in an lrus.json file placed in the ICD project
folder, alongside the LRU subfolders (not inside any of them):
project_name/
├── lrus.json
├── LRUBase/
│ └── ConfigAllMessage.csv
└── LRUDerived/
└── ConfigAccelRangeMessage.csv
{
"LRUs": [
{ "name": "LRUDerived", "dependency": "LRUBase" }
]
}
Here LRUDerived ends up with both ConfigAllMessage (inherited from
LRUBase) and its own ConfigAccelRangeMessage — without LRUBase's CSV
ever being copied or re-authored under LRUDerived.
Memory Layout
DBSimGenerator generates the derived LRU's struct as a genuine C++ struct inheriting from the base LRU's struct:
#pragma pack(push,1)
struct lru_LRUBase {
blk_ConfigAllMessage ConfigAllMessage;
};
struct lru_LRUDerived : public lru_LRUBase {
blk_ConfigAccelRangeMessage ConfigAccelRangeMessage; // only the new block is declared here
};
#pragma pack(pop)
Because both structs are tightly packed (#pragma pack(push,1)), lru_LRUDerived's memory
is contiguous: the inherited base blocks come first, immediately followed by the derived LRU's own blocks — with
no gap and no duplication of layout logic. Elements are addressed exactly as if they'd been defined directly on
the derived LRU (e.g. LRUDerived.ConfigAllMessage.Sync1), even though ConfigAllMessage
is only defined once, in LRUBase's CSV.
LRUDerived gets its own
independent copy of the inherited blocks in its own shared-memory region. LRUBase is still registered
and usable on its own, completely separate from the copy inherited into LRUDerived — writing to one
does not affect the other.
ICD Addons
While LRU Inheritance reuses a block within a project, an
addon pulls a whole external, self-contained ICD package — with its own LRU folders, blocks, and
enums — into your project, without copying any of its files. List the addon folders in an
lrus-addon.json file, placed beside lrus.json in the ICD project folder:
project_name/
├── lrus.json
├── lrus-addon.json
└── LRU_name/
└── Block_name.csv
[
"c:/dev/simD/CoreEng/CoreEngICDAddons/FlightModel_Advance/"
]
Each entry is the root folder of an addon — a self-contained ICD folder laid out just like a normal project
(its own LRU subfolders with block CSVs and enums). DBSimGenerator loads every LRU it finds in each listed
addon folder, lets you view them alongside your project's own LRUs in the generator, and generates their code
into the same coredb/ output folder — so an addon's LRUs become part of your project exactly like
locally-defined ones.
Key Features
- High-Performance Code: Generates optimized C++ code for fast simulations.
- RAW and ENG Types: Supports both raw data and engineering unit conversions for flexible use.
- Endian & Bit Ordering: Handles Little/Big Endian and MSB/LSB conversions automatically — see Raw ↔ Eng Conversion for the
NoRaw/LElsb/LEmsb/BElsb/BEmsbblock conventions. - Hardware Integration: Integrates directly with HW drivers using
streams.jsonfor seamless system communication. - Automated & Scalable: Reduces repetitive coding, supporting multiple blocks, LRUs, and projects effortlessly.
Workflow
- Prepare ICD CSV files and Enums for your blocks.
- Organize CSVs in the project → LRU → block structure.
- DBSimGenerator reads the CSVs and generates high-performance code.
- Generated code integrates with simulation frameworks and hardware drivers.
With DBSimGenerator, you can focus on building your technology while the platform handles 80% of the integration and boilerplate code automatically.
Example ICD CSV snippet
BlockName, FieldName, Type, Size, Description
Telemetry, Altitude, float, 4, Aircraft altitude (m)
Telemetry, Speed, float, 4, Airspeed (m/s)
1. ICD Blocks and Elements
| # 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 |
2. Data Type Specification
| 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 | – | – | – |
3. Enums
| Name | Value |
|---|---|
| Mode_Manual | 0 |
| Mode_Auto | 1 |
| Error_None | 0x00 |
| Error_Sensor | 0x01 |