wcdma_bb 0.0.2 → 0.0.3

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: ab5ead80aefe54e00afea4b50c8fd7978ea21228
4
- data.tar.gz: 9b37cd9452a8579db93432fd2fb4541c4abda3fc
3
+ metadata.gz: 52845974a6b3f4d061ab8b0fa1fbb847d8ec23bc
4
+ data.tar.gz: 99290b320ab8c1cf44ad9e2aa6add6d3d760aee0
5
5
  SHA512:
6
- metadata.gz: 61638c9169a25860a5c313edf38ef643c9e1b3c0609309327b895701b619e8b445c6f30c9bfc34acfa47f44e3006975d148addc081f4b9b23f4661fd8912e556
7
- data.tar.gz: de6446a0fefe6f1a2b87c90aac05ca5e51d110431f4933076a9f90b4efbf5a96e4729bced4a72ae1559b7e4434503984ff93e9f73f90bb796031b6ea5c9a397b
6
+ metadata.gz: c31b4919781399d542e578223bdea5685b48792b53bd40af41b413edc383b6eb26829525829931f2456b34c63ad487142af747a0eaf6b4ad84e286b7ece25f35
7
+ data.tar.gz: 81bcc1260acb1ece5ee666a40c96ed0ac19a7396d41d7ec76bc883b941c5d37ff347a35c457228772dc5fdfb500c4ab1dc50455169ac1d0d2cccc3a8f9eb3292
@@ -0,0 +1,28 @@
1
+
2
+ class Enum < Hash
3
+
4
+ # Create a new Enum instance
5
+ # @param *members [Array of String] list of strings becoming symbols
6
+ # @return [Enum]
7
+ def initialize(*members)
8
+ super()
9
+ @rev = {}
10
+ members.each_with_index {|m,i| self[i] = m}
11
+ end
12
+
13
+ # Get index by symbol or get symbol by index
14
+ # @param k [symbol or Integer]
15
+ # @return [Integer or symbol]
16
+ def [](k)
17
+ super || @rev[k]
18
+ end
19
+
20
+ # Change or add enum pair
21
+ # @param k [String] the symbol name
22
+ # @param v [Integer] the index
23
+ # @return [nil]
24
+ def []=(k, v)
25
+ @rev[v] = k
26
+ super
27
+ end
28
+ end
@@ -1,4 +1,5 @@
1
1
  require 'wcdma_bb/acronym'
2
+ require 'enum'
2
3
 
3
4
  # 4 Services offered to higher layers
4
5
  # 4.1 Transport channels
@@ -30,6 +31,11 @@ SUBFRAME_LENGTH_IN_CHIPS = 7680
30
31
 
31
32
  # 5.2 Uplink physical channels
32
33
  # 5.2.1 Dedicated uplink physical channels
34
+ Acronym.add('DPDCH', 'Dedicated Physical Data Channel')
35
+ Acronym.add('DPCCH', 'Dedicated Physical Control Channel')
36
+ Acronym.add('E-DPDCH', 'E-DCH Dedicated Physical Data Channel')
37
+ Acronym.add('E-DPCCH', 'E-DCH Dedicated Physical Control Channel')
38
+ Acronym.add('HS-DPCCH', 'Dedicated Control Channel associated with HS-DSCH transmission')
33
39
 
34
40
  # types of uplink dedicated physical channels
35
41
  UL_DEDICATED_PHY_CHANNEL_LIST = ["DPDCH", "DPCCH", "E-DPDCH", "E-DPCCH", "HS-DPCCH"]
@@ -66,30 +72,81 @@ class PhysicalChannel
66
72
  end
67
73
  end
68
74
 
75
+ # Uplink DPDCH slot formats
76
+ UplinkDpdchSlotFormatEnum = Enum.new(:UL_DPDCH_slot_format_0,
77
+ :UL_DPDCH_slot_format_1,
78
+ :UL_DPDCH_slot_format_2,
79
+ :UL_DPDCH_slot_format_3,
80
+ :UL_DPDCH_slot_format_4,
81
+ :UL_DPDCH_slot_format_5,
82
+ :UL_DPDCH_slot_format_6)
83
+
69
84
  class UplinkDPDCH < PhysicalChannel
70
85
  @@DPDCH_MIN_SF_FACTOR = 256
71
86
  @@DPDCH_MAX_SF_FACTOR = 4
72
87
 
73
- attr_reader :sf, :k, :N__data
88
+ attr_reader :sf, :k, :N__data, :slot_format, :kbps, :ksps, :bit_per_slot, :bit_per_frame
74
89
 
75
90
  # Create a new instance
76
- # @param sf [Integer] spreading factor
91
+ # @param slot_format [symbol] slot format from table 1 25.211 v10.0
77
92
  # @return [UplinkDPDCH] a new instance of this class
78
- def initialize(sf)
79
- @sf = sf
93
+ def initialize(slot_format:)
94
+ raise "slot_format=%s is out of range [0..6]" % slot_format if not UplinkDpdchSlotFormatEnum.has_value?(slot_format)
95
+ @slot_format = slot_format
96
+ @sf = 256 / (2**UplinkDpdchSlotFormatEnum[@slot_format])
80
97
  @k = self.class.k(sf: @sf, max_sf: @@DPDCH_MAX_SF_FACTOR, min_sf: @@DPDCH_MIN_SF_FACTOR)
81
98
  @N__data = self.class.N__data(k: @k)
99
+ @bit_per_slot = @N__data
100
+ @bit_per_frame = @bit_per_slot * RADIO_FRAME_LENGTH_IN_CHIPS / SLOT_LENGTH_IN_CHIPS
101
+ @kbps = @bit_per_frame / 10
102
+ @ksps = @kbps
82
103
  end
83
104
  end
84
105
 
106
+ # Uplink DPCCH slot formats
107
+ :UL_DPCCH_slot_format_0
108
+ :UL_DPCCH_slot_format_0A
109
+ :UL_DPCCH_slot_format_0B
110
+ :UL_DPCCH_slot_format_1
111
+ :UL_DPCCH_slot_format_2
112
+ :UL_DPCCH_slot_format_2A
113
+ :UL_DPCCH_slot_format_2B
114
+ :UL_DPCCH_slot_format_3
115
+ :UL_DPCCH_slot_format_4
116
+
117
+ # Uplink DPCCH slot formats
118
+ UplinkDpcchSlotFormatEnum = Enum.new(:UL_DPCCH_slot_format_0,
119
+ :UL_DPCCH_slot_format_0A,
120
+ :UL_DPCCH_slot_format_0B,
121
+ :UL_DPCCH_slot_format_1,
122
+ :UL_DPCCH_slot_format_2,
123
+ :UL_DPCCH_slot_format_2A,
124
+ :UL_DPCCH_slot_format_2B,
125
+ :UL_DPCCH_slot_format_3,
126
+ :UL_DPCCH_slot_format_4)
127
+
128
+ Acronym.add('FSW', "Frame Synchronization Word")
129
+
85
130
  class UplinkDPCCH < PhysicalChannel
86
131
  @@SF = 256
87
132
 
88
- attr_reader :sf, :k, :N__data
133
+ attr_reader :slot_format, :sf, :k, :kbps, :ksps, :bit_per_frame,
134
+ :bit_per_slot, :N__pilot, :N__TPC, :N__TFCI, :N__FBI
89
135
 
90
- def initialize()
136
+ # Create a new instance
137
+ # @param slot_format [symbol] slot format from table 2 25.211 v10.0
138
+ # @return [UplinkDPDCH] a new instance of this class
139
+ def initialize(slot_format:)
140
+ @slot_format = slot_format
91
141
  @sf = @@SF
92
142
  @k = self.class.k(sf: @sf, max_sf: @@SF, min_sf: @@SF)
93
- @N__data = self.class.N__data(k: @k)
143
+ @kbps = 15
144
+ @ksps = 15
145
+ @bit_per_frame = 150
146
+ @bit_per_slot = 10
147
+ @N__pilot = [6,5,4,8,5,4,3,7,6][UplinkDpcchSlotFormatEnum[@slot_format]]
148
+ @N__TPC = [2,2,2,2,2,2,2,2,4][UplinkDpcchSlotFormatEnum[@slot_format]]
149
+ @N__TFCI = [2,3,4,0,2,3,4,0,0][UplinkDpcchSlotFormatEnum[@slot_format]]
150
+ @N__FBI = [0,0,0,0,1,1,1,1,0][UplinkDpcchSlotFormatEnum[@slot_format]]
94
151
  end
95
152
  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.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Duo Ling
@@ -18,6 +18,7 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - bin/wcdma_bb
21
+ - lib/enum.rb
21
22
  - lib/wcdma_bb.rb
22
23
  - lib/wcdma_bb/acronym.rb
23
24
  - lib/wcdma_bb/rel10/ts25_211.rb