class AIXM::Feature::NavigationalAid::DME

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
)
dme.timetable = AIXM.timetable or nil
dme.remarks = String or nil

@see gitlab.com/openflightmaps/ofmx/wikis/Navigational-aid#dme-dme

Constants

CHANNEL_RE

Attributes

channel[R]

@return [String] radio channel

Public Class Methods

new(source: nil, region: nil) click to toggle source
   # File lib/aixm/feature.rb
15 def initialize(source: nil, region: nil)
16   self.source = source
17   self.region = region || AIXM.config.region
18 end
new(channel:, **arguments) click to toggle source
Calls superclass method AIXM::Feature::NavigationalAid::new
   # File lib/aixm/feature/navigational_aid/dme.rb
41 def initialize(channel:, **arguments)
42   super(**arguments)
43   self.channel = channel
44 end

Public Instance Methods

channel=(value) click to toggle source
   # File lib/aixm/feature/navigational_aid/dme.rb
46 def channel=(value)
47   fail(ArgumentError, "invalid channel") unless value.is_a?(String) && value.match?(CHANNEL_RE)
48   @channel = value
49 end
ghost_f() click to toggle source

@return [AIXM::F] ghost frequency matching the channel

   # File lib/aixm/feature/navigational_aid/dme.rb
52 def ghost_f
53   if channel
54     number, letter = channel.split(/(?=[XY])/)
55     integer = case number.to_i
56       when (1..16) then 13430
57       when (17..59) then 10630
58       when (60..69) then 12730
59       when (70..126) then 10530
60     end
61     integer += number.to_i * 10
62     integer += 5 if letter == 'Y'
63     AIXM.f(integer.to_f / 100, :mhz)
64   end
65 end
to_uid() click to toggle source

@return [String] UID markup

   # File lib/aixm/feature/navigational_aid/dme.rb
68 def to_uid
69   builder = Builder::XmlMarkup.new(indent: 2)
70   builder.DmeUid({ region: (region if AIXM.ofmx?) }.compact) do |dme_uid|
71     dme_uid.codeId(id)
72     dme_uid.geoLat(xy.lat(AIXM.schema))
73     dme_uid.geoLong(xy.long(AIXM.schema))
74   end
75 end
to_xml() click to toggle source

@return [String] AIXM or OFMX markup

    # File lib/aixm/feature/navigational_aid/dme.rb
 79 def to_xml
 80   builder = to_builder
 81   builder.Dme({ source: (source if AIXM.ofmx?) }.compact) do |dme|
 82     dme << to_uid.indent(2)
 83     dme << organisation.to_uid.indent(2)
 84     dme << vor.to_uid.indent(2) if vor
 85     dme.txtName(name) if name
 86     dme.codeChannel(channel)
 87     unless vor
 88       dme.valGhostFreq(ghost_f.freq.trim)
 89       dme.uomGhostFreq('MHZ')
 90     end
 91     dme.codeDatum('WGE')
 92     if z
 93       dme.valElev(z.alt)
 94       dme.uomDistVer(z.unit.upcase.to_s)
 95     end
 96     dme << timetable.to_xml(as: :Dtt).indent(2) if timetable
 97     dme.txtRmk(remarks) if remarks
 98     dme.target!
 99   end
100 end