-
Notifications
You must be signed in to change notification settings - Fork 5
/
cellular.go
executable file
·94 lines (81 loc) · 2.75 KB
/
cellular.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package cellular
import (
// "sync"
"github.com/wiless/vlib"
)
type GenericStruct map[string]interface{}
// type LinkInfo struct {
// RxNodeID int
// NodeTypes []string
// LinkGain vlib.VectorF
// LinkGainNode vlib.VectorI
// InterferenceLinks vlib.VectorF
// }
type LinkMetric struct {
RxNodeID int
FreqInGHz float64
BandwidthMHz float64
N0 float64
TxNodeIDs vlib.VectorI
TxNodesRSRP vlib.VectorF
RSSI float64
BestRSRP float64
BestRSRPNode int
BestSINR float64
RoIDbm float64
//AgainDb float64
BestCouplingLoss float64
MaxTxAg float64 // Tx AAS Gain
MaxRxAg float64 // Rx AAS Gain
AssoTxAg float64 // Tx AAS Gain for Associated Link
AssoRxAg float64 // Rx AAS Gain for Associated Link
MaxTransmitBeamID int
}
type LinkProfile struct {
RxNodeID int
TxID int
Distance float64
IndoorDistance, UEHeight float64
IsLOS bool
CouplingLoss, Pathloss, O2I, InCar, ShadowLoss, TxPower, BSAasgainDB, UEAasgainDB, TxGCSaz, TxGCSel, RxGCSaz, RxGCSel float64
}
func (l *LinkMetric) SetParams(fGHz, bwMHz float64) {
// BandwidthMHz := 20.0
NoisePSDdBmPerHz := -173.9
l.N0 = NoisePSDdBmPerHz + vlib.Db(bwMHz*1e6)
l.FreqInGHz = fGHz
}
//CreateLink creates a single tx-rx link with a given SNR with bandwidth=10MHz, Signal power assumed as 0dBm
//and N0 calculated based on 10MHz bandwidth
func CreateLink(rxid, txid int, snrDb float64) LinkMetric {
var result LinkMetric
result.SetParams(2.1, 10)
result.RxNodeID = rxid
result.TxNodeIDs.AppendAtEnd(txid)
rssi := snrDb + result.N0
result.TxNodesRSRP.AppendAtEnd(rssi)
result.RoIDbm = -1000
return result
}
func CreateSimpleLink(rxid, txid int, snrDb float64) LinkMetric {
var result LinkMetric
result = CreateLink(rxid, txid, snrDb)
result.N0 = -snrDb
rssi := snrDb + result.N0
result.TxNodesRSRP[0] = rssi
return result
}
// type Transmitter interface {
// SetWaitGroup(wg *sync.WaitGroup)
// GetChannel() gocomm.Complex128AChannel
// GetID() int
// StartTransmit()
// GetSeed() int64
// IsActive() bool
// }
// type Receiver interface {
// GetID() int
// SetWaitGroup(wg *sync.WaitGroup)
// StartReceive(rxch gocomm.Complex128AChannel)
// IsActive() bool
// }