Skip to content

XML Transmitter Loading

David Young edited this page Apr 30, 2025 · 1 revision

Description

This functionality parses the <transmitter> element within a FERS XML scenario file. It extracts attributes such as name, type, pulse, antenna, and timing, along with child elements like <prf> (Pulse Repetition Frequency). Based on this information, it creates a Transmitter object, finds its dependencies (like the specific Signal, Antenna, and Timing objects) within the simulation World using their names, sets the relevant properties on the Transmitter object, and finally adds the configured object to the World's collection of transmitters.

Assumptions

  • Assumes the XML input structure containing the <transmitter> element is valid and matches the expected format (e.g., required attributes and child elements are present).
  • Assumes the Platform* and World* pointers passed into the parsing function (parseTransmitter) are valid and point to existing, correctly initialized objects.
  • Assumes that the simulation objects referenced by name (the pulse signal definition, the antenna model, and the timing source) have already been defined and added to the World before the <transmitter> element is parsed. This implies a specific order requirement within the XML file.
  • Assumes that the World::findSignal, World::findAntenna, and World::findTiming methods successfully locate and return valid pointers to the dependencies based on exact name matching.
  • Assumes numerical child elements like <prf> contain text that can be correctly parsed into the expected numerical type (e.g., RealType) by helper functions.
  • Assumes the Timing::initializeModel method, called when setting the timing source, executes correctly.

Limitations

  • Dependency Brittleness: Relies strictly on matching the string names provided in the XML (pulse, antenna, timing attributes) to find dependencies already registered in the World. Typos or case mismatches will cause failures.
  • Error Handling (Missing References): The primary parsing function (parseTransmitter) may not explicitly check if the World::find* methods return nullptr (indicating a missing dependency). While downstream setter methods (e.g., Transmitter::setAntenna, Transmitter::setTiming) do perform null checks and throw exceptions, the initial point of failure detection might be less direct.
  • Value Range Validation: This parsing stage does not validate the range or physical plausibility of numerical values like the PRF. It only checks if the value can be parsed. Subsequent functions like Transmitter::setPrf might perform quantization or validation, but it's not enforced purely during XML parsing.
  • XML Order Dependency: The referenced signal, antenna, and timing definitions must appear earlier in the XML file (or an included file) than the <transmitter> element that uses them. Failure to adhere to this order will result in lookup errors.

Related Components

  • Parsing Entry Point: xml_parser.cpp::parseTransmitter
  • Object Creation: Transmitter class constructor (called within parseTransmitter)
  • Dependency Lookup: World::findSignal, World::findAntenna, World::findTiming methods
  • Property Setting: Transmitter::setWave, Transmitter::setPrf, Transmitter::setAntenna, Transmitter::setTiming methods
  • World Integration: World::add method
  • Related Wiki Pages: XML Parsing, Object Model, World Model, Pulse Handling, Antenna Models, Timing

Validation Status

  • Needs Verification: While core functionality is likely exercised by any successful simulation run, specific error handling paths and edge cases related to dependencies and configuration order require verification.
  • Key Areas for Validation:
    • Behavior when referenced signal, antenna, or timing names are misspelled, have incorrect case, or do not exist in the World. Verify that appropriate errors are thrown.
    • Behavior when the <prf> element is missing or contains non-numeric text.
    • Confirm simulation failure or clear error messages if a <transmitter> element appears before its dependencies in the XML.
    • Verify correct parsing and setting of all attributes and child elements onto the Transmitter object.
    • Confirm successful addition of the configured Transmitter to the World.
  • Priority: Medium (Essential for setup, but likely partially tested implicitly. Error handling robustness needs focused checks).

Clone this wiki locally