Class: AIXM::Feature::NavigationalAid::DME
- Inherits:
-
AIXM::Feature::NavigationalAid
- Object
- Component
- AIXM::Feature
- AIXM::Feature::NavigationalAid
- AIXM::Feature::NavigationalAid::DME
- Defined in:
- lib/aixm/feature/navigational_aid/dme.rb
Overview
Distance measuring equipment (DME) is a transponder-based radio navigation technology which measures slant range distance by timing the propagation delay of VHF or UHF signals. They operate in the frequency band between 962 MHz and 1213 MHz.
Cheat Sheet in Pseudo Code:
dme = AIXM.dme(
source: String or nil
region: String or nil
organisation: AIXM.organisation
id: String
name: String
xy: AIXM.xy
z: AIXM.z or nil
channel: String # either set channel directly
ghost_f: AIXM.f # or set channel via VOR ghost frequency
)
dme.timetable = AIXM.timetable or nil
dme.remarks = String or nil
dme.comment = Object or nil
Direct Known Subclasses
Constant Summary collapse
- CHANNEL_RE =
/\A([1-9]|[1-9]\d|1[0-1]\d|12[0-6])[XY]\z/.freeze
- GHOST_MAP =
{ 108_00 => (17..59), 112_30 => (70..126), 133_30 => (60..69), 134_40 => (1..16) }.freeze
Constants inherited from AIXM::Feature
Instance Attribute Summary collapse
-
#channel ⇒ Object
Radio channel.
Attributes inherited from AIXM::Feature::NavigationalAid
Attributes included from Concerns::Remarks
Attributes included from Concerns::Timetable
Attributes inherited from AIXM::Feature
Attributes inherited from Component
Instance Method Summary collapse
- #ghost_f ⇒ Object
- #ghost_f=(value) ⇒ Object
-
#initialize(channel: nil, ghost_f: nil, **arguments) ⇒ DME
constructor
See the cheat sheet for examples on how to create instances of this class.
-
#vor ⇒ AIXM::Feature::NavigationalAid::VOR?
Associated VOR.
Methods inherited from AIXM::Feature::NavigationalAid
#inspect, #kind, #organisation
Methods included from Concerns::Association
Methods inherited from AIXM::Feature
Methods included from Concerns::HashEquality
Methods included from Concerns::XMLBuilder
#build_fragment, #to_uid, #to_xml
Methods included from Concerns::Memoize
Constructor Details
#initialize(channel: nil, ghost_f: nil, **arguments) ⇒ DME
See the cheat sheet for examples on how to create instances of this class.
59 60 61 62 63 64 65 66 |
# File 'lib/aixm/feature/navigational_aid/dme.rb', line 59 def initialize(channel: nil, ghost_f: nil, **arguments) super(**arguments) case when channel then self.channel = channel when ghost_f then self.ghost_f = ghost_f else fail(ArgumentError, "either channel or ghost_f must be set") end end |
Instance Attribute Details
Instance Method Details
#ghost_f ⇒ Object
85 86 87 88 89 90 91 92 93 |
# File 'lib/aixm/feature/navigational_aid/dme.rb', line 85 def ghost_f if channel number, letter = channel.split(/(?=[XY])/) integer = GHOST_MAP.find { _2.include?(number.to_i) }.first integer += (number.to_i - GHOST_MAP[integer].min) * 10 integer += 5 if letter == 'Y' AIXM.f(integer.to_f / 100, :mhz) end end |
#ghost_f=(value) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/aixm/feature/navigational_aid/dme.rb', line 73 def ghost_f=(value) fail(ArgumentError, "invalid ghost_f") unless value.is_a?(AIXM::F) && value.unit == :mhz integer, letter = (value.freq * 100).round, 'X' unless (integer % 10).zero? integer -= 5 letter = 'Y' end base = GHOST_MAP.keys.reverse.bsearch { _1 <= integer } number = ((integer - base) / 10) + GHOST_MAP[base].min self.channel = "#{number}#{letter}" end |
#vor ⇒ AIXM::Feature::NavigationalAid::VOR?
Returns associated VOR.
43 |
# File 'lib/aixm/feature/navigational_aid/dme.rb', line 43 belongs_to :vor, readonly: true |