Class: AIXM::Feature::NavigationalAid::DME

Inherits:
AIXM::Feature::NavigationalAid show all
Includes:
Memoize
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
)
dme.timetable = AIXM.timetable or nil
dme.remarks = String or nil

Direct Known Subclasses

TACAN

Constant Summary collapse

CHANNEL_RE =
/\A([1-9]|[1-9]\d|1[0-1]\d|12[0-6])[XY]\z/.freeze

Constants inherited from AIXM::Feature

REGION_RE

Instance Attribute Summary collapse

Attributes inherited from AIXM::Feature::NavigationalAid

#id, #name, #remarks, #timetable, #xy, #z

Attributes inherited from AIXM::Feature

#region, #source

Instance Method Summary collapse

Methods included from Memoize

cache, included, method

Methods inherited from AIXM::Feature::NavigationalAid

#inspect, #kind, #organisation

Methods included from Association

included

Methods inherited from AIXM::Feature

#==

Constructor Details

#initialize(channel:, **arguments) ⇒ DME


41
42
43
44
# File 'lib/aixm/feature/navigational_aid/dme.rb', line 41

def initialize(channel:, **arguments)
  super(**arguments)
  self.channel = channel
end

Instance Attribute Details

#channelString


39
40
41
# File 'lib/aixm/feature/navigational_aid/dme.rb', line 39

def channel
  @channel
end

Instance Method Details

#ghost_fAIXM::F


52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/aixm/feature/navigational_aid/dme.rb', line 52

def ghost_f
  if channel
    number, letter = channel.split(/(?=[XY])/)
    integer = case number.to_i
      when (1..16) then 13430
      when (17..59) then 10630
      when (60..69) then 12730
      when (70..126) then 10530
    end
    integer += number.to_i * 10
    integer += 5 if letter == 'Y'
    AIXM.f(integer.to_f / 100, :mhz)
  end
end

#to_uidString


68
69
70
71
72
73
74
75
# File 'lib/aixm/feature/navigational_aid/dme.rb', line 68

def to_uid
  builder = Builder::XmlMarkup.new(indent: 2)
  builder.DmeUid({ region: (region if AIXM.ofmx?) }.compact) do |dme_uid|
    dme_uid.codeId(id)
    dme_uid.geoLat(xy.lat(AIXM.schema))
    dme_uid.geoLong(xy.long(AIXM.schema))
  end
end

#to_xmlString


79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/aixm/feature/navigational_aid/dme.rb', line 79

def to_xml
  builder = to_builder
  builder.Dme({ source: (source if AIXM.ofmx?) }.compact) do |dme|
    dme << to_uid.indent(2)
    dme << organisation.to_uid.indent(2)
    dme << vor.to_uid.indent(2) if vor
    dme.txtName(name) if name
    dme.codeChannel(channel)
    unless vor
      dme.valGhostFreq(ghost_f.freq.trim)
      dme.uomGhostFreq('MHZ')
    end
    dme.codeDatum('WGE')
    if z
      dme.valElev(z.alt)
      dme.uomDistVer(z.unit.upcase.to_s)
    end
    dme << timetable.to_xml(as: :Dtt).indent(2) if timetable
    dme.txtRmk(remarks) if remarks
    dme.target!
  end
end

#vorAIXM::Feature::NavigationalAid::VOR?


36
# File 'lib/aixm/feature/navigational_aid/dme.rb', line 36

belongs_to :vor, readonly: true