wcdma_bb 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74b606e01ba9ed9f75cd5817616ebeeffe6aac40
4
- data.tar.gz: c3d5a77d1c91af54c6278fb174f3ee69d2841899
3
+ metadata.gz: ab5ead80aefe54e00afea4b50c8fd7978ea21228
4
+ data.tar.gz: 9b37cd9452a8579db93432fd2fb4541c4abda3fc
5
5
  SHA512:
6
- metadata.gz: f46acef60669d522a8eac124d3a14febef7559c5dcf1aa13cac7779ef608a2d21a6ccab727c5da1586545c6e96215290f963998040f0ff44634ef67b04639b4f
7
- data.tar.gz: c70b3622f70f4b8e427a3caae84fa489a8449f56974f6d4348afe344e14bc05fa4a2f51837fbaa246c35235a50f354b6999ca608f3bbc119585ede591d7774e6
6
+ metadata.gz: 61638c9169a25860a5c313edf38ef643c9e1b3c0609309327b895701b619e8b445c6f30c9bfc34acfa47f44e3006975d148addc081f4b9b23f4661fd8912e556
7
+ data.tar.gz: de6446a0fefe6f1a2b87c90aac05ca5e51d110431f4933076a9f90b4efbf5a96e4729bced4a72ae1559b7e4434503984ff93e9f73f90bb796031b6ea5c9a397b
@@ -1,4 +1,30 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'optparse'
3
4
  require 'wcdma_bb'
4
- puts WcdmaBb.hi
5
+
6
+ options = {}
7
+
8
+ optparser = OptionParser.new do |opts|
9
+ opts.banner = "Usage: wcdma_bb [options]"
10
+ options[:search_acronym] = nil
11
+ opts.on('--search_acronym PATTERN', 'Get full name of acronyms that match PATTERN') do |pattern|
12
+ options[:search_acronym] = pattern
13
+ end
14
+ opts.on('-h', '--help', 'Display help information') do
15
+ puts opts
16
+ exit
17
+ end
18
+ end
19
+
20
+ optparser.parse!
21
+
22
+ if options[:search_acronym]
23
+ result = Acronym.search_acronym(options[:search_acronym])
24
+ result.each { |key, values|
25
+ puts "%-10s\t%s" % [key, values[0]]
26
+ values[1..-1].each { |v|
27
+ puts "%-10s\t%s" % ["", v]
28
+ }
29
+ }
30
+ end
@@ -1,5 +1,8 @@
1
+ require 'wcdma_bb/rel10/ts25_211'
2
+
1
3
  class WcdmaBb
2
4
  def self.hi
3
5
  puts "Hello world!"
6
+ "Hello world!"
4
7
  end
5
8
  end
@@ -0,0 +1,40 @@
1
+
2
+ # Collect, hold, and look up all acronyms
3
+ # @author Michael Duo Ling
4
+ class Acronym
5
+
6
+ # a hash containing all acronyms: string => array of strings
7
+ @@acronyms = Hash.new
8
+
9
+ # Store acronym => fullname pair
10
+ # @param acronym [String] the abbreviation
11
+ # @param fullname [String] the full name
12
+ # @return [nil] nothing
13
+ def self.add(acronym, fullname)
14
+ values = @@acronyms.fetch(acronym, Array.new)
15
+ if not values.include?(fullname)
16
+ values << fullname
17
+ @@acronyms[acronym] = values
18
+ end
19
+ end
20
+
21
+ # Look up for one acronym pattern
22
+ # @param pattern [String] acronym pattern (regex)
23
+ # @return [Hash] acronym => array of fullnames for all acronyms that match given pattern
24
+ def self.search_acronym(pattern)
25
+ result = Hash.new
26
+ pattern = Regexp.new(pattern)
27
+ @@acronyms.each { |key, value|
28
+ if pattern.match(key)
29
+ result[key] = value
30
+ end
31
+ }
32
+ return result
33
+ end
34
+
35
+ # Clear all saved acronyms
36
+ # @return [nil] nothing
37
+ def self.clear()
38
+ @@acronyms = Hash.new
39
+ end
40
+ end
@@ -0,0 +1,95 @@
1
+ require 'wcdma_bb/acronym'
2
+
3
+ # 4 Services offered to higher layers
4
+ # 4.1 Transport channels
5
+ Acronym.add('DCH', 'Dedicated Channel')
6
+ Acronym.add('E-DCH', 'Enhanced Dedicated Channel')
7
+ Acronym.add('BCH', 'Broadcast Channel')
8
+ Acronym.add('FACH', 'Forward Access Channel')
9
+ Acronym.add('PCH', 'Paging Channel')
10
+ Acronym.add('RACH', 'Random Access Channel')
11
+ Acronym.add('HS-DSCH', 'High Speed Downlink Shared Channel')
12
+
13
+ # 4.2 Indicators
14
+ Acronym.add('AI', 'Acquisition Indicator')
15
+ Acronym.add('PI', 'Page Indicator')
16
+ Acronym.add('NI', 'MBMS Notification Indicator')
17
+ Acronym.add('ICH', 'Indicator Channel')
18
+
19
+ # 5 Physical channels and physical signals
20
+ Acronym.add('CCTrCH', 'Composite Coded Transport Channel')
21
+
22
+ # number of chips in one radio frame
23
+ RADIO_FRAME_LENGTH_IN_CHIPS = 38400
24
+ # number of chips in one slot
25
+ SLOT_LENGTH_IN_CHIPS = 2560
26
+ # number of chips in one subframe
27
+ SUBFRAME_LENGTH_IN_CHIPS = 7680
28
+
29
+ # 5.1 Physical signals
30
+
31
+ # 5.2 Uplink physical channels
32
+ # 5.2.1 Dedicated uplink physical channels
33
+
34
+ # types of uplink dedicated physical channels
35
+ UL_DEDICATED_PHY_CHANNEL_LIST = ["DPDCH", "DPCCH", "E-DPDCH", "E-DPCCH", "HS-DPCCH"]
36
+
37
+ Acronym.add('TPC', 'Transmit Power-Control')
38
+ Acronym.add('TFCI', 'Transport-Format Combination Indicator')
39
+ Acronym.add('FBI', 'Feedback Information')
40
+
41
+ # 5.2.1.1 DPCCH and DPDCH
42
+
43
+ # length of one slot in chips
44
+ T__slot = SLOT_LENGTH_IN_CHIPS
45
+
46
+ Acronym.add('SF', 'Spreading Factor')
47
+
48
+ # Base class for all physical channels
49
+ class PhysicalChannel
50
+
51
+ # Calc perameter k
52
+ # @param sf [Integer] spreading factor
53
+ # @param max_sf [Integer] maximum SF, e.g. 4 for DPDCH
54
+ # @param min_sf [Integer] minimum SF, e.g. 256 for DPDCH
55
+ # @return [Integer] k, parameter k that determines the number of bits per slot
56
+ def self.k(sf:, max_sf:, min_sf:)
57
+ raise 'SF=%s is out of range ([%s..%s])' % [sf, max_sf, min_sf] if not sf.between?(max_sf, min_sf)
58
+ return Math.log2(256/sf).to_i
59
+ end
60
+
61
+ # Calc number of bits per slot
62
+ # @param k [Integer]
63
+ # @return [Integer] number of bits per slot
64
+ def self.N__data(k:)
65
+ return 10 * (2 ** k)
66
+ end
67
+ end
68
+
69
+ class UplinkDPDCH < PhysicalChannel
70
+ @@DPDCH_MIN_SF_FACTOR = 256
71
+ @@DPDCH_MAX_SF_FACTOR = 4
72
+
73
+ attr_reader :sf, :k, :N__data
74
+
75
+ # Create a new instance
76
+ # @param sf [Integer] spreading factor
77
+ # @return [UplinkDPDCH] a new instance of this class
78
+ def initialize(sf)
79
+ @sf = sf
80
+ @k = self.class.k(sf: @sf, max_sf: @@DPDCH_MAX_SF_FACTOR, min_sf: @@DPDCH_MIN_SF_FACTOR)
81
+ @N__data = self.class.N__data(k: @k)
82
+ end
83
+ end
84
+
85
+ class UplinkDPCCH < PhysicalChannel
86
+ @@SF = 256
87
+
88
+ attr_reader :sf, :k, :N__data
89
+
90
+ def initialize()
91
+ @sf = @@SF
92
+ @k = self.class.k(sf: @sf, max_sf: @@SF, min_sf: @@SF)
93
+ @N__data = self.class.N__data(k: @k)
94
+ end
95
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wcdma_bb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Duo Ling
@@ -19,6 +19,8 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - bin/wcdma_bb
21
21
  - lib/wcdma_bb.rb
22
+ - lib/wcdma_bb/acronym.rb
23
+ - lib/wcdma_bb/rel10/ts25_211.rb
22
24
  homepage: http://rubygems.org/gems/wcdma_bb
23
25
  licenses:
24
26
  - MIT
@@ -44,3 +46,4 @@ signing_key:
44
46
  specification_version: 4
45
47
  summary: WCDMA baseband in Ruby
46
48
  test_files: []
49
+ has_rdoc: