forked from stpaine/FERS
-
Notifications
You must be signed in to change notification settings - Fork 1
XML Transmitter Loading
David Young edited this page Apr 30, 2025
·
1 revision
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.
- 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*andWorld*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
Worldbefore the<transmitter>element is parsed. This implies a specific order requirement within the XML file. - Assumes that the
World::findSignal,World::findAntenna, andWorld::findTimingmethods 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::initializeModelmethod, called when setting the timing source, executes correctly.
-
Dependency Brittleness: Relies strictly on matching the string names provided in the XML (
pulse,antenna,timingattributes) to find dependencies already registered in theWorld. Typos or case mismatches will cause failures. -
Error Handling (Missing References): The primary parsing function (
parseTransmitter) may not explicitly check if theWorld::find*methods returnnullptr(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::setPrfmight perform quantization or validation, but it's not enforced purely during XML parsing. -
XML Order Dependency: The referenced
signal,antenna, andtimingdefinitions 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.
-
Parsing Entry Point:
xml_parser.cpp::parseTransmitter -
Object Creation:
Transmitterclass constructor (called withinparseTransmitter) -
Dependency Lookup:
World::findSignal,World::findAntenna,World::findTimingmethods -
Property Setting:
Transmitter::setWave,Transmitter::setPrf,Transmitter::setAntenna,Transmitter::setTimingmethods -
World Integration:
World::addmethod - Related Wiki Pages: XML Parsing, Object Model, World Model, Pulse Handling, Antenna Models, Timing
- 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, ortimingnames are misspelled, have incorrect case, or do not exist in theWorld. 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
Transmitterobject. - Confirm successful addition of the configured
Transmitterto theWorld.
- Behavior when referenced
- Priority: Medium (Essential for setup, but likely partially tested implicitly. Error handling robustness needs focused checks).