Follow these steps to build the runtime configuration JSON that controls folders, threading, CPU affinity, startup state, and recording policies in APIC.

In APICCenter (project page config.json) the recorder keys show a description and unit; fixed values are lists (report 0 / 1 / 2, startRecording boot / model, ioMode, onOverflow, ...); + on recorder adds missing settings with their default and a comment.

1. Define Folders

Set the logical directories used by the system.

FieldDescription
setupsDirectory containing setup configuration files.
testsDirectory containing test scenarios.
{
  "folders": {
    "setups": "./setups",
    "tests": "./tests"
  }
}
These can also be overridden per-launch with the setup/test command-line arguments — see CoreEngine Command-Line Arguments.

2. Configure the RealTime Thread

Control the main real-time processing thread.

FieldDescription
affinityCPU core binding (comma and range supported).
priorityThread scheduling priority (higher = more critical).
bTimingFixTimeIf true, enforces fixed-cycle timing compensation.
Affinity example: "0,3,4-6" binds to cores 0, 3, 4, 5, 6.
{
  "RealTime": {
    "affinity": "0,3,4-6",
    "priority": 6,
    "bTimingFixTime": true
  }
}

3. Configure the Keyboard Thread

Handles interactive keyboard control.

FieldDescription
affinityDedicated CPU core binding.
priorityThread priority.
activeEnable/disable keyboard monitoring.
{
  "Keyboard": {
    "affinity": "2",
    "priority": 9,
    "active": true
  }
}

4. Configure the Reflector

This thread connects the CoreEngine out to a running Reflector app instance and streams this engine's shared memory to it for remote monitoring and interaction.

FieldDescription
affinityCPU binding.
priorityThread priority.
{
  "Reflector": {
    "affinity": "1",
    "priority": 9
  }
}

5. Set the Startup Mode

Define the system boot behavior with the bootmode field:

{
  "startup": {
    "bootmode": "play"
  }
}

6. Configure the Recorder

Control recording subsystem behavior.

FieldDescription
priorityRecorder thread priority.
pathOutput directory for recordings.
flushAfterFramesData older than N frames is written to the file.
recordOnlyOnChangeGlobal setup — record only when data changes.
{
  "recorder": {
    "priority": 9,
    "path": "C:/temp/rec_test",
    "flushAfterFrames": 5,
    "recordOnlyOnChange": true
  }
}

The recording itself never slows the simulation frame: the frame only copies the data, a writer thread writes the files. The defaults pick the fastest way to write for the drive (unbuffered with 8 writes in flight on SSD/NVMe, through the OS cache on a hard disk). To check a new PC or drive, set "environmentReport": true once: at start the console lists the drive type and the available I/O, and tests every storage driver method (PASS/FAIL per line). To find the fastest write method and queue size for the drive, set "benchmark": true once: at start it measures each ioMode / queue size, prints a table and the best result as "recorder" keys to paste into config.json. "report" sets how much the recorder prints: 0 nothing (default), 1 the start / close summary of each recording, 2 also a table of every recorded item (sizes, rate, drives, MB/s) (then remove "benchmark"; how to read it). The other keys (ioMode, queueSize, ringMB, onOverflow, capture, playbackPath, ...) are described in the config.json reference, section 7.

{
  "recorder": {
    "path": "D:/recordings",
    "ioMode": "auto",
    "report": 2,
    "environmentReport": true,
    "benchmark": true
  }
}

7. (Optional) Fine-Tune the Recorded Items (coredb)

Use the optional coredb block inside recorder for fine-grained control over which signals are recorded and how, including wildcard patterns (the old name DBSim is not read).

FieldDescription
engSize-1 = use actual data size, 0 = disabled, >0 = bytes per record.
rawSize-1 = use actual data size, 0 = disabled, >0 = bytes per record.
recordOnlyOnChangetrue (default) = record only on value change; false = record every frame.
Useful when recording arrays with dynamic length but requiring a fixed storage size.
{
  "coredb": {
    "CAM.cam.timestamp": {},
    "IMU.*": {},    // Wildcard example: records all IMU signals with default settings
    "CAM.cam.frame": {
      "recordOnlyOnChange": true,   //default
      "engSize": -1
    }
  }
}

8. (Optional) Enable EngineSync

EngineSync synchronizes engine time using an external telemetry element, typically for deterministic replay or hardware-aligned simulation. It is disabled by default.

{
  "EngineSync": {
    "stream": "SocketTCPTLMStream",
    "element": "LRU_KZ.TLMAiding.SystemEventNumber",
    "syncPerMS": "1000",
    "affinity": "0,1,3,4-6",
    "priority": 6
  }
}

9. Apply Threading & Design Guidelines

Linux: applying the thread priority settings needs root privilege (real-time scheduling). Start the application with sudo, otherwise the priorities are refused by the operating system. See config.html.
Best practice: avoid overlapping CPU affinity between real-time and high-priority auxiliary threads unless hyper-threading behavior is fully characterized.