vlcSim 0.3.1__tar.gz → 0.3.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vlcSim
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Python Package of Event-Oriented Simulation for visible light communication
5
5
  Home-page: https://gitlab.com/DaniloBorquez/simvlc/
6
6
  Author: Danilo Bórquez-Paredes
@@ -10,7 +10,7 @@ long_description = (this_directory / "README.md").read_text()
10
10
 
11
11
  setup(
12
12
  name="vlcSim",
13
- version="0.3.1",
13
+ version="0.3.2",
14
14
  license="MIT",
15
15
  description="Python Package of Event-Oriented Simulation for visible light communication",
16
16
  author="Danilo Bórquez-Paredes",
@@ -93,16 +93,16 @@ class TestScenario:
93
93
  assert totalPower == pytest.approx(1.333598176601676)
94
94
 
95
95
  snr = scenario.snrVled(receiver, vled1)
96
- assert snr == pytest.approx(7.365185165012038e07)
96
+ assert snr == pytest.approx(7.361724628127821e07)
97
97
 
98
98
  snr = scenario.snrVled(receiver, vled2)
99
- assert snr == pytest.approx(2.072547626391976e06)
99
+ assert snr == pytest.approx(2.071573464407198e06)
100
100
 
101
101
  snr = scenario.snrVled(receiver, vled3)
102
- assert snr == pytest.approx(2.072547626391976e06)
102
+ assert snr == pytest.approx(2.071573464407198e06)
103
103
 
104
104
  snr = scenario.snrVled(receiver, vled4)
105
- assert snr == pytest.approx(4.185333357837867e05)
105
+ assert snr == pytest.approx(4.183366036825221e05)
106
106
 
107
107
  rf = RF(0, 0, 0.85)
108
108
  receiver = Receiver(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vlcSim
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Python Package of Event-Oriented Simulation for visible light communication
5
5
  Home-page: https://gitlab.com/DaniloBorquez/simvlc/
6
6
  Author: Danilo Bórquez-Paredes
@@ -21,6 +21,8 @@ class Connection:
21
21
  :type id: int
22
22
  :param receiver: The receiver of this connection.
23
23
  :type receiver: :class:`vlcsim.scene.Receiver`
24
+ :param time: The time when this connection was created the first time.
25
+ :type time: float
24
26
  :return: :class:`vlcsim.controller.Connection` object
25
27
  :rtype: :class:`vlcsim.controller.Connection`
26
28
  """
@@ -36,15 +38,25 @@ class Connection:
36
38
  self.__snr = sys.float_info.min
37
39
 
38
40
  @property
39
- def snr(self):
41
+ def snr(self) -> float:
42
+ """Signal to Noise Ratio
43
+
44
+ :return: Signal to Noise Ratio
45
+ :rtype: float
46
+ """
40
47
  return self.__snr
41
48
 
42
49
  @snr.setter
43
- def snr(self, value):
50
+ def snr(self, value: float):
44
51
  self.__snr = value
45
52
 
46
53
  @property
47
54
  def capacityRequired(self) -> float:
55
+ """Capacity required in bps
56
+
57
+ :return: capacity required in bps
58
+ :rtype: float
59
+ """
48
60
  return self.__capacityRequired
49
61
 
50
62
  @capacityRequired.setter
@@ -52,7 +64,12 @@ class Connection:
52
64
  self.__capacityRequired = value
53
65
 
54
66
  @property
55
- def time(self):
67
+ def time(self) -> float:
68
+ """The time when this connection arrived to simulation
69
+
70
+ :return: time when this connection arrived to simulation
71
+ :rtype: float
72
+ """
56
73
  return self.__time
57
74
 
58
75
  @time.setter
@@ -60,7 +77,12 @@ class Connection:
60
77
  self.__time = value
61
78
 
62
79
  @property
63
- def goalTime(self):
80
+ def goalTime(self) -> float:
81
+ """Total effective time that the connection will be using the channel, depending of the capacity required and the capacity given by the channel.
82
+
83
+ :return: Effective time
84
+ :rtype: float
85
+ """
64
86
  return self.__goalTime
65
87
 
66
88
  @goalTime.setter
@@ -69,31 +91,69 @@ class Connection:
69
91
 
70
92
  @property
71
93
  def frameSlice(self):
94
+ """List of lists containing the tuples [frame, slice] that this connection will use
95
+
96
+ :return: Tuples frame,slice that the connection will use
97
+ """
72
98
  return self.__frameSlice
73
99
 
74
100
  @frameSlice.setter
75
101
  def frameSlice(self, value):
76
102
  self.__frameSlice = value
77
103
 
78
- def getNextTime(self):
104
+ def getNextTime(self) -> float:
105
+ """Gets the next time when this connection will start to transmit again
106
+
107
+ :return: the next time
108
+ :rtype: float
109
+ """
79
110
  return self.__timesAssigned.pop(0)
80
111
 
81
- def insertTime(self, time):
112
+ def insertTime(self, time: float):
113
+ """function in charge of defininfg the times when this connection will be used. It works with the simulation FEL
114
+
115
+ :param time: List of times that this connection will start the transmission
116
+ :type time: float
117
+ """
118
+
82
119
  for i in range(len(self.__timesAssigned)):
83
120
  if self.__timesAssigned[i] > time:
84
121
  self.__timesAssigned.insert(i, time)
85
122
  break
86
123
  self.__timesAssigned.append(time)
87
124
 
88
- def assignFrameSlice(self, frame, slice):
125
+ def assignFrameSlice(self, frame: int, slice: int):
126
+ """Assigns a frame and an slice to this connection.
127
+
128
+ :param frame: frame number
129
+ :type frame: int
130
+ :param slice: slice number
131
+ :type slice: int
132
+ """
89
133
  self.__frameSlice.append([frame, slice])
90
134
 
91
135
  def numberOfSlicesNeeded(
92
136
  self, capacityRequired: float, capacityFromAP: float
93
137
  ) -> int:
138
+ """Determinates the number of slices needed by this connection depending of the capacity required and the AP capacity
139
+
140
+ :param capacityRequired: Capacity required
141
+ :type capacityRequired: float
142
+ :param capacityFromAP: capacity given
143
+ :type capacityFromAP: float
144
+ :return: The number of slices needed by tis connection
145
+ :rtype: int
146
+ """
94
147
  return math.ceil(capacityRequired / capacityFromAP)
95
148
 
96
- def nextSliceInAPWhenArriving(self, ap):
149
+ def nextSliceInAPWhenArriving(self, ap: AccessPoint) -> int:
150
+ """When a new connection arrives, this funciont gives the position of the next slot depending of the arriving time for an AP
151
+
152
+ :param ap: _description_
153
+ :type ap: :class:`vlcsim.scene.AccessPoint`
154
+ :return: the slot position
155
+ :rtype: int
156
+ """
97
157
  return math.ceil(self.__time / ap.sliceTime) % ap.slicesInFrame
98
158
 
99
159
  @property
@@ -261,7 +321,8 @@ class Controller:
261
321
  if self.__allocationStatus == Controller.status.ALLOCATED:
262
322
  index = self.APPosition(connection.AP)
263
323
  self.__numberActiveConnections[index] += 1
264
- actualSlice = connection.nextSliceInAPWhenArriving(connection.AP) - 1
324
+ actualSlice = connection.nextSliceInAPWhenArriving(
325
+ connection.AP) - 1
265
326
  actualTime = (
266
327
  (time // (connection.AP.slicesInFrame * connection.AP.sliceTime))
267
328
  * connection.AP.slicesInFrame
@@ -373,7 +434,7 @@ class Controller:
373
434
 
374
435
  def init(self):
375
436
  """
376
- Initializatrion of this controller. This methods must be invoked before to start the simulation.
437
+ Initialization of this controller. This methods must be invoked before to start the simulation.
377
438
  """
378
439
  self.__activeConnections = []
379
440
  self.__numberActiveConnections = []
@@ -436,7 +497,18 @@ class Controller:
436
497
  """
437
498
  return self.__numberActiveConnections[self.APPosition(ap)]
438
499
 
439
- def assignSlice(self, apIndex, frame, slice, connection):
500
+ def assignSlice(self, apIndex: int, frame: int, slice: int, connection: Connection):
501
+ """Assigns the connection to the AP, in the frame and slice given
502
+
503
+ :param apIndex: Index of the AP
504
+ :type apIndex: int
505
+ :param frame: frame to be used
506
+ :type frame: int
507
+ :param slice: sliec to be used
508
+ :type slice: int
509
+ :param connection: Connection to be assigned
510
+ :type connection: Connection
511
+ """
440
512
  numberOfFrames = len(self.__activeConnections[apIndex])
441
513
  if numberOfFrames < frame + 1:
442
514
  for _ in range(numberOfFrames, frame + 1):
@@ -455,5 +527,11 @@ class Controller:
455
527
  else:
456
528
  self.__activeConnections[apIndex][frame][slice] = connection
457
529
 
458
- def framesState(self, ap):
530
+ def framesState(self, ap: AccessPoint):
531
+ """Return the set of frame/slices of the ap given.
532
+
533
+ :param ap: Access Point
534
+ :type ap: AccessPoint
535
+ :return: A list of lists containing the frames and slices of this AP
536
+ """
459
537
  return self.__activeConnections[self.APPosition(ap)]
@@ -520,7 +520,7 @@ class Receiver:
520
520
  s: float = 0.54,
521
521
  b: float = 10e6,
522
522
  ibg: float = 5.1e-3,
523
- cb: float = 1.38e-23,
523
+ cb: float = 1.380649e-23,
524
524
  tk: float = 298.0,
525
525
  a: float = 1.0,
526
526
  gv: float = 10.0,
@@ -534,25 +534,45 @@ class Receiver:
534
534
  Initializes the object with the values. This is the constructor for the Schrodinger model
535
535
 
536
536
  :param x: x coordinate of the object
537
+ :type x: float
537
538
  :param y: y coordinate of the object's coordinate.
539
+ :type y: float
538
540
  :param z: z coordinate of the object's coordinate.
541
+ :type z: float
539
542
  :param aDet: aDet value of the object's coordinate.
543
+ :type aDet: float
540
544
  :param ts: time of the object's coordinate. Default is 10 seconds.
541
- :param index:
542
- :param fov: q of the object. Default is 1. 6e - 19.
543
- :param q:
545
+ :type ts: float
546
+ :param index: order of Lambertian emission that depends on the half-angle at half illumination of the LED.
547
+ :type index: float
548
+ :param fov: width of the field of view.
549
+ :type fov: float
550
+ :param q: electronic load. Default is -1.602e-19 culombios
551
+ :type q: float
544
552
  :param s: ibg b - parameter of the Ib - Galactic model. Default i 5 seconds.
553
+ :type s: float
545
554
  :param b: c b - parameter of the Ib - Galactic model. Default is 5 seconds.
546
- :param ibg:
547
- :param cb:
548
- :param tk:
555
+ :type b: float
556
+ :param ibg: background current. Default is 5.1e-3 Amperes.
557
+ :type ibg: float
558
+ :param cb: Boltzmann constant. Default is 1.380649e-23 J/K.
559
+ :type cb: float
560
+ :param tk: 380649
561
+ :type tk: float
549
562
  :param a: n n - prameter of the B - parameter. Default is 10 seconds.
550
- :param gv:
551
- :param n:
552
- :param fr:
553
- :param gm:
554
- :param i1:
555
- :param i2:
563
+ :type a: float
564
+ :param gv: Open-loop voltage gain. Default is 10
565
+ :type gv: float
566
+ :param n: Fixed capacitance of the PD per unit area. Default is 1.12e-6.
567
+ :type n: float
568
+ :param fr: FET channel noise factor. Default is 1.5
569
+ :type fr: float
570
+ :param gm: FET transconductance. Default is 3e-2.
571
+ :type gm: float
572
+ :param i1: constant experimental value. Default is 0.562.
573
+ :type i1: float
574
+ :param i2: constant experimental value. Default is 0.0868.
575
+ :type i2: float
556
576
  """
557
577
  self.__x = x
558
578
  self.__y = y
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes