satellite-lower-layer-service.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 Magister Solutions Ltd
4  * Copyright (c) 2018 CNES
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Sami Rantanen <sami.rantanen@magister.fi>
20  * Author: Mathias Ettinger <mettinger@toulouse.viveris.fr>
21  */
22 
24 
25 #include "satellite-utils.h"
26 
27 #include <ns3/boolean.h>
28 #include <ns3/double.h>
29 #include <ns3/log.h>
30 #include <ns3/object.h>
31 #include <ns3/pointer.h>
32 #include <ns3/random-variable-stream.h>
33 #include <ns3/string.h>
34 #include <ns3/uinteger.h>
35 
36 #include <limits>
37 #include <string>
38 
39 NS_LOG_COMPONENT_DEFINE("SatLowerLayerServiceConf");
40 
41 namespace ns3
42 {
43 
45  : m_constantAssignmentProvided(false),
46  m_rbdcAllowed(false),
47  m_volumeAllowed(false),
48  m_constantServiceRateStream(0),
49  m_maximumServiceRateKbps(0.0),
50  m_minimumServiceRateKbps(0.0),
51  m_maximumBacklogInKbytes(0)
52 {
53  NS_LOG_FUNCTION(this);
54 }
55 
57 {
58  NS_LOG_FUNCTION(this);
59 }
60 
62  : m_maxUniquePayloadPerBlock(0),
63  m_maxConsecutiveBlockAccessed(0),
64  m_minimumIdleBlock(0),
65  m_backOffTimeInMilliSeconds(0),
66  m_highLoadBackOffTimeInMilliSeconds(0),
67  m_backOffProbability(0),
68  m_highLoadBackOffProbability(0),
69  m_numberOfInstances(0),
70  m_averageNormalizedOfferedLoadThreshold(0.0),
71  m_isCrdsaAllowed(false),
72  m_isSlottedAlohaAllowed(false),
73  m_isEssaAllowed(false)
74 {
75  NS_LOG_FUNCTION(this);
76 }
77 
79 {
80  NS_LOG_FUNCTION(this);
81 }
82 
83 NS_OBJECT_ENSURE_REGISTERED(SatLowerLayerServiceConf);
84 
86  : m_dynamicRatePersistence(0),
87  m_volumeBacklogPersistence(0),
88  m_defaultControlRandomizationInterval(0.0),
89  m_daServiceEntryCount(0),
90  m_raServiceEntryCount(0)
91 {
92  NS_LOG_FUNCTION(this);
93 
95  {
96  NS_FATAL_ERROR("SatLowerLayerServiceConf::SatLowerLayerServiceConf - m_minRaServiceEntries "
97  "> m_maxRaServiceEntries");
98  }
99 
101  {
102  NS_FATAL_ERROR("SatLowerLayerServiceConf::SatLowerLayerServiceConf - m_minDaServiceEntries "
103  "> m_maxDaServiceEntries");
104  }
105 }
106 
108 {
109  NS_LOG_FUNCTION(this);
110 }
111 
112 std::string
114 {
115  std::string name = "DaService";
116  return name + GetNumberAsString<uint8_t>(index);
117 }
118 
119 std::string
121 {
122  std::string name = "RaService";
123  return name + GetNumberAsString<uint8_t>(index);
124 }
125 
141 #define SAT_ADD_DA_SERVICE_ATTRIBUTES(index, a1, a2, a3, a4, a5, a6, a7) \
142  AddAttribute(GetIndexAsDaServiceName(index) + "_ConstantAssignmentProvided", \
143  "Constant Assignment provided for " + GetIndexAsDaServiceName(index), \
144  BooleanValue(a1), \
145  MakeBooleanAccessor( \
146  &SatLowerLayerServiceConf::SetDaServ##index##ConstantAssignmentProvided, \
147  &SatLowerLayerServiceConf::GetDaServ##index##ConstantAssignmentProvided), \
148  MakeBooleanChecker()) \
149  .AddAttribute( \
150  GetIndexAsDaServiceName(index) + "_RbdcAllowed", \
151  "RBDC allowed for DA " + GetIndexAsDaServiceName(index), \
152  BooleanValue(a2), \
153  MakeBooleanAccessor(&SatLowerLayerServiceConf::SetDaServ##index##RbdcAllowed, \
154  &SatLowerLayerServiceConf::GetDaServ##index##RbdcAllowed), \
155  MakeBooleanChecker()) \
156  .AddAttribute( \
157  GetIndexAsDaServiceName(index) + "_VolumeAllowed", \
158  "Volume allowed for DA " + GetIndexAsDaServiceName(index), \
159  BooleanValue(a3), \
160  MakeBooleanAccessor(&SatLowerLayerServiceConf::SetDaServ##index##VolumeAllowed, \
161  &SatLowerLayerServiceConf::GetDaServ##index##VolumeAllowed), \
162  MakeBooleanChecker()) \
163  .AddAttribute(GetIndexAsDaServiceName(index) + "_ConstantServiceRate", \
164  "A RandomVariableStream for constant service rate [kbps] for DA " + \
165  GetIndexAsDaServiceName(index), \
166  StringValue("ns3::ConstantRandomVariable[Constant=" + \
167  GetNumberAsString<uint16_t>(a4) + "]"), \
168  MakePointerAccessor( \
169  &SatLowerLayerServiceConf::SetDaServ##index##ConstantServiceRateStream, \
170  &SatLowerLayerServiceConf::GetDaServ##index##ConstantServiceRateStream), \
171  MakePointerChecker<RandomVariableStream>()) \
172  .AddAttribute(GetIndexAsDaServiceName(index) + "_MaximumServiceRate", \
173  "Maximum service rate [kbps] for DA " + GetIndexAsDaServiceName(index), \
174  UintegerValue(a5), \
175  MakeUintegerAccessor( \
176  &SatLowerLayerServiceConf::SetDaServ##index##MaximumServiceRateInKbps, \
177  &SatLowerLayerServiceConf::GetDaServ##index##MaximumServiceRateInKbps), \
178  MakeUintegerChecker<uint16_t>()) \
179  .AddAttribute(GetIndexAsDaServiceName(index) + "_MinimumServiceRate", \
180  "Minimum service rate [kbps] for DA " + GetIndexAsDaServiceName(index), \
181  UintegerValue(a6), \
182  MakeUintegerAccessor( \
183  &SatLowerLayerServiceConf::SetDaServ##index##MinimumServiceRateInKbps, \
184  &SatLowerLayerServiceConf::GetDaServ##index##MinimumServiceRateInKbps), \
185  MakeUintegerChecker<uint16_t>()) \
186  .AddAttribute(GetIndexAsDaServiceName(index) + "_MaximumBacklogSize", \
187  "Maximum backlog size [Kbytes] for DA " + GetIndexAsDaServiceName(index), \
188  UintegerValue(a7), \
189  MakeUintegerAccessor( \
190  &SatLowerLayerServiceConf::SetDaServ##index##MaximumBacklogInKbytes, \
191  &SatLowerLayerServiceConf::GetDaServ##index##MaximumBacklogInKbytes), \
192  MakeUintegerChecker<uint16_t>())
193 
214 #define SAT_ADD_RA_SERVICE_ATTRIBUTES(index, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) \
215  AddAttribute(GetIndexAsRaServiceName(index) + "_MaximumUniquePayloadPerBlock", \
216  "Maximum unique payload per block for RA " + GetIndexAsRaServiceName(index), \
217  UintegerValue(a1), \
218  MakeUintegerAccessor( \
219  &SatLowerLayerServiceConf::SetRaServ##index##MaximumUniquePayloadPerBlock, \
220  &SatLowerLayerServiceConf::GetRaServ##index##MaximumUniquePayloadPerBlock), \
221  MakeUintegerChecker<uint8_t>()) \
222  .AddAttribute( \
223  GetIndexAsRaServiceName(index) + "_MaximumConsecutiveBlockAccessed", \
224  "Maximum consecutive block accessed for RA " + GetIndexAsRaServiceName(index), \
225  UintegerValue(a2), \
226  MakeUintegerAccessor( \
227  &SatLowerLayerServiceConf::SetRaServ##index##MaximumConsecutiveBlockAccessed, \
228  &SatLowerLayerServiceConf::GetRaServ##index##MaximumConsecutiveBlockAccessed), \
229  MakeUintegerChecker<uint8_t>()) \
230  .AddAttribute( \
231  GetIndexAsRaServiceName(index) + "_MinimumIdleBlock", \
232  "Minimum idle block for RA " + GetIndexAsRaServiceName(index), \
233  UintegerValue(a3), \
234  MakeUintegerAccessor(&SatLowerLayerServiceConf::SetRaServ##index##MinimumIdleBlock, \
235  &SatLowerLayerServiceConf::GetRaServ##index##MinimumIdleBlock), \
236  MakeUintegerChecker<uint8_t>()) \
237  .AddAttribute(GetIndexAsRaServiceName(index) + "_BackOffTimeInMilliSeconds", \
238  "Back off time in milliseconds for RA " + GetIndexAsRaServiceName(index), \
239  UintegerValue(a4), \
240  MakeUintegerAccessor( \
241  &SatLowerLayerServiceConf::SetRaServ##index##BackOffTimeInMilliSeconds, \
242  &SatLowerLayerServiceConf::GetRaServ##index##BackOffTimeInMilliSeconds), \
243  MakeUintegerChecker<uint16_t>()) \
244  .AddAttribute( \
245  GetIndexAsRaServiceName(index) + "_HighLoadBackOffTimeInMilliSeconds", \
246  "High load back off time in milliseconds for RA " + GetIndexAsRaServiceName(index), \
247  UintegerValue(a5), \
248  MakeUintegerAccessor( \
249  &SatLowerLayerServiceConf::SetRaServ##index##HighLoadBackOffTimeInMilliSeconds, \
250  &SatLowerLayerServiceConf::GetRaServ##index##HighLoadBackOffTimeInMilliSeconds), \
251  MakeUintegerChecker<uint16_t>()) \
252  .AddAttribute( \
253  GetIndexAsRaServiceName(index) + "_BackOffProbability", \
254  "Back off probability for RA " + GetIndexAsRaServiceName(index), \
255  UintegerValue(a6), \
256  MakeUintegerAccessor(&SatLowerLayerServiceConf::SetRaServ##index##BackOffProbability, \
257  &SatLowerLayerServiceConf::GetRaServ##index##BackOffProbability), \
258  MakeUintegerChecker<uint16_t>()) \
259  .AddAttribute( \
260  GetIndexAsRaServiceName(index) + "_HighLoadBackOffProbability", \
261  "High load back off probability for RA " + GetIndexAsRaServiceName(index), \
262  UintegerValue(a7), \
263  MakeUintegerAccessor( \
264  &SatLowerLayerServiceConf::SetRaServ##index##HighLoadBackOffProbability, \
265  &SatLowerLayerServiceConf::GetRaServ##index##HighLoadBackOffProbability), \
266  MakeUintegerChecker<uint16_t>()) \
267  .AddAttribute( \
268  GetIndexAsRaServiceName(index) + "_NumberOfInstances", \
269  "Number of instances for RA " + GetIndexAsRaServiceName(index), \
270  UintegerValue(a8), \
271  MakeUintegerAccessor(&SatLowerLayerServiceConf::SetRaServ##index##NumberOfInstances, \
272  &SatLowerLayerServiceConf::GetRaServ##index##NumberOfInstances), \
273  MakeUintegerChecker<uint8_t>()) \
274  .AddAttribute( \
275  GetIndexAsRaServiceName(index) + "_AverageNormalizedOfferedLoadThreshold", \
276  "Average normalized offered load threshold for RA " + GetIndexAsRaServiceName(index), \
277  DoubleValue(a9), \
278  MakeDoubleAccessor(&SatLowerLayerServiceConf:: \
279  SetRaServ##index##AverageNormalizedOfferedLoadThreshold, \
280  &SatLowerLayerServiceConf:: \
281  GetRaServ##index##AverageNormalizedOfferedLoadThreshold), \
282  MakeDoubleChecker<double>()) \
283  .AddAttribute(GetIndexAsRaServiceName(index) + "_SlottedAlohaAllowed", \
284  "Slotted Aloha allowed for RA " + GetIndexAsRaServiceName(index), \
285  BooleanValue(a10), \
286  MakeBooleanAccessor( \
287  &SatLowerLayerServiceConf::SetRaServ##index##IsSlottedAlohaAllowed, \
288  &SatLowerLayerServiceConf::GetRaServ##index##IsSlottedAlohaAllowed), \
289  MakeBooleanChecker()) \
290  .AddAttribute( \
291  GetIndexAsRaServiceName(index) + "_CrdsaAllowed", \
292  "CRDSA allowed for RA " + GetIndexAsRaServiceName(index), \
293  BooleanValue(a11), \
294  MakeBooleanAccessor(&SatLowerLayerServiceConf::SetRaServ##index##IsCrdsaAllowed, \
295  &SatLowerLayerServiceConf::GetRaServ##index##IsCrdsaAllowed), \
296  MakeBooleanChecker()) \
297  .AddAttribute( \
298  GetIndexAsRaServiceName(index) + "_EssaAllowed", \
299  "ESSA allowed for RA " + GetIndexAsRaServiceName(index), \
300  BooleanValue(a12), \
301  MakeBooleanAccessor(&SatLowerLayerServiceConf::SetRaServ##index##IsEssaAllowed, \
302  &SatLowerLayerServiceConf::GetRaServ##index##IsEssaAllowed), \
303  MakeBooleanChecker())
304 
305 TypeId
307 {
308  static TypeId tid =
309  TypeId("ns3::SatLowerLayerServiceConf")
310  .SetParent<Object>()
311  .AddConstructor<SatLowerLayerServiceConf>()
312  .AddAttribute(
313  "DaServiceCount",
314  "DA services in use.",
315  UintegerValue(4),
317  MakeUintegerChecker<uint8_t>(SatLowerLayerServiceConf::m_minDaServiceEntries,
319  .AddAttribute(
320  "RaServiceCount",
321  "RA services in use.",
322  UintegerValue(1),
324  MakeUintegerChecker<uint8_t>(SatLowerLayerServiceConf::m_minRaServiceEntries,
326  .AddAttribute(
327  "RaServiceDefault",
328  "Index of the RA service to use as a default for carriers with no explicitly "
329  "assigned services.",
330  UintegerValue(0),
332  MakeUintegerChecker<uint8_t>(0,
334  .AddAttribute("DynamicRatePersistence",
335  "Dynamic rate persistence for the lower layer service.",
336  UintegerValue(5),
338  MakeUintegerChecker<uint8_t>())
339  .AddAttribute(
340  "VolumeBacklogPersistence",
341  "Volume backlog persistence for the lower layer service",
342  UintegerValue(7),
344  MakeUintegerChecker<uint8_t>())
345  .AddAttribute(
346  "DefaultControlRandomizationInterval",
347  "Default control randomization interval for the lower layer service",
348  TimeValue(MilliSeconds(100)),
350  MakeTimeChecker(MilliSeconds(0), MilliSeconds(std::numeric_limits<uint8_t>::max())))
351  /*
352  * RC index, CRA allowed, RBDC allowed, VBDC allowed, CRA rate, Max RBDC rate, Min RBDC
353  * rate, Max volume backlog
354  */
355  .SAT_ADD_DA_SERVICE_ATTRIBUTES(0, true, false, false, 50, 9216, 10, 384)
356  .SAT_ADD_DA_SERVICE_ATTRIBUTES(1, false, false, false, 50, 9216, 10, 384)
357  .SAT_ADD_DA_SERVICE_ATTRIBUTES(2, false, false, false, 50, 9216, 10, 384)
358  .SAT_ADD_DA_SERVICE_ATTRIBUTES(3, false, true, false, 50, 9216, 10, 384)
359 
360  /*
361  * Max payload per block, Max consecutive blocks, Min IDLE block, Backoff time, High
362  * load Backoff time, Backoff probability, High load Backoff probability, Replicas,
363  * Average load threshold
364  */
365  .SAT_ADD_RA_SERVICE_ATTRIBUTES(0,
366  3,
367  4,
368  2,
369  250,
370  500,
371  10000,
372  30000,
373  3,
374  0.5,
375  true,
376  true,
377  false)
378  .SAT_ADD_RA_SERVICE_ATTRIBUTES(1,
379  3,
380  4,
381  2,
382  250,
383  500,
384  10000,
385  30000,
386  2,
387  0.5,
388  true,
389  true,
390  false)
391  .SAT_ADD_RA_SERVICE_ATTRIBUTES(2,
392  3,
393  4,
394  2,
395  250,
396  500,
397  10000,
398  30000,
399  5,
400  0.5,
401  true,
402  true,
403  false);
404 
405  return tid;
406 }
407 
408 TypeId
410 {
411  NS_LOG_FUNCTION(this);
412 
413  return GetTypeId();
414 }
415 
416 bool
418 {
419  NS_LOG_FUNCTION(this << (uint32_t)index);
420 
421  if (index >= m_maxDaServiceEntries)
422  {
423  NS_FATAL_ERROR("Service index out of range!!!");
424  }
425 
427 }
428 
429 void
431  bool constAssignmentProvided)
432 {
433  NS_LOG_FUNCTION(this << (uint32_t)index << constAssignmentProvided);
434 
435  if (index >= m_maxDaServiceEntries)
436  {
437  NS_FATAL_ERROR("Service index out of range!!!");
438  }
439 
440  m_daServiceEntries[index].SetConstantAssignmentProvided(constAssignmentProvided);
441 }
442 
443 bool
445 {
446  NS_LOG_FUNCTION(this << (uint32_t)index);
447 
448  if (index >= m_maxDaServiceEntries)
449  {
450  NS_FATAL_ERROR("Service index out of range!!!");
451  }
452 
453  return m_daServiceEntries[index].GetRbdcAllowed();
454 }
455 
456 void
457 SatLowerLayerServiceConf::SetDaRbdcAllowed(uint8_t index, bool bdcAllowed)
458 {
459  NS_LOG_FUNCTION(this << (uint32_t)index << bdcAllowed);
460 
461  if (index >= m_maxDaServiceEntries)
462  {
463  NS_FATAL_ERROR("Service index out of range!!!");
464  }
465 
466  m_daServiceEntries[index].SetRbdcAllowed(bdcAllowed);
467 }
468 
469 bool
471 {
472  NS_LOG_FUNCTION(this << (uint32_t)index);
473 
474  if (index >= m_maxDaServiceEntries)
475  {
476  NS_FATAL_ERROR("Service index out of range!!!");
477  }
478 
479  return m_daServiceEntries[index].GetVolumeAllowed();
480 }
481 
482 void
483 SatLowerLayerServiceConf::SetDaVolumeAllowed(uint8_t index, bool volumeAllowed)
484 {
485  NS_LOG_FUNCTION(this << (uint32_t)index << volumeAllowed);
486 
487  if (index >= m_maxDaServiceEntries)
488  {
489  NS_FATAL_ERROR("Service index out of range!!!");
490  }
491 
492  m_daServiceEntries[index].SetVolumeAllowed(volumeAllowed);
493 }
494 
495 uint16_t
497 {
498  NS_LOG_FUNCTION(this << (uint32_t)index);
499 
500  if (index >= m_maxDaServiceEntries)
501  {
502  NS_FATAL_ERROR("Service index out of range!!!");
503  }
504 
506 }
507 
508 Ptr<RandomVariableStream>
510 {
511  NS_LOG_FUNCTION(this << (uint32_t)index);
512 
513  if (index >= m_maxDaServiceEntries)
514  {
515  NS_FATAL_ERROR("Service index out of range!!!");
516  }
517 
519 }
520 
521 void
523  uint8_t index,
524  Ptr<RandomVariableStream> constantServiceRateStream)
525 {
526  NS_LOG_FUNCTION(this << (uint32_t)index);
527 
528  if (index >= m_maxDaServiceEntries)
529  {
530  NS_FATAL_ERROR("Service index out of range!!!");
531  }
532 
533  m_daServiceEntries[index].SetConstantServiceRateStream(constantServiceRateStream);
534 }
535 
536 uint16_t
538 {
539  NS_LOG_FUNCTION(this << (uint32_t)index);
540 
541  if (index >= m_maxDaServiceEntries)
542  {
543  NS_FATAL_ERROR("Service index out of range!!!");
544  }
545 
547 }
548 
549 void
551  uint16_t maximumServiceRateKbps)
552 {
553  NS_LOG_FUNCTION(this << (uint32_t)index << maximumServiceRateKbps);
554 
555  if (index >= m_maxDaServiceEntries)
556  {
557  NS_FATAL_ERROR("Service index out of range!!!");
558  }
559 
560  m_daServiceEntries[index].SetMaximumServiceRateInKbps(maximumServiceRateKbps);
561 }
562 
563 uint16_t
565 {
566  NS_LOG_FUNCTION(this << (uint32_t)index);
567 
568  if (index >= m_maxDaServiceEntries)
569  {
570  NS_FATAL_ERROR("Service index out of range!!!");
571  }
572 
574 }
575 
576 void
578  uint16_t minimumServiceRateKbps)
579 {
580  NS_LOG_FUNCTION(this << (uint32_t)index << minimumServiceRateKbps);
581 
582  if (index >= m_maxDaServiceEntries)
583  {
584  NS_FATAL_ERROR("Service index out of range!!!");
585  }
586 
587  m_daServiceEntries[index].SetMinimumServiceRateInKbps(minimumServiceRateKbps);
588 }
589 
590 uint16_t
592 {
593  NS_LOG_FUNCTION(this << (uint32_t)index);
594 
595  if (index >= m_maxDaServiceEntries)
596  {
597  NS_FATAL_ERROR("Service index out of range!!!");
598  }
599 
601 }
602 
603 void
605  uint16_t maximumBacklogInKbytes)
606 {
607  NS_LOG_FUNCTION(this << (uint32_t)index << maximumBacklogInKbytes);
608 
609  if (index >= m_maxDaServiceEntries)
610  {
611  NS_FATAL_ERROR("Service index out of range!!!");
612  }
613 
614  m_daServiceEntries[index].SetMaximumBacklogInKbytes(maximumBacklogInKbytes);
615 }
616 
617 uint8_t
619 {
620  NS_LOG_FUNCTION(this << (uint32_t)index);
621 
622  if (index >= m_maxRaServiceEntries)
623  {
624  NS_FATAL_ERROR("Service index out of range!!!");
625  }
626 
628 }
629 
630 void
632  uint8_t uniquePayloadPerBlock)
633 {
634  NS_LOG_FUNCTION(this << (uint32_t)index << uniquePayloadPerBlock);
635 
636  if (index >= m_maxRaServiceEntries)
637  {
638  NS_FATAL_ERROR("Service index out of range!!!");
639  }
640 
641  m_raServiceEntries[index].SetMaximumUniquePayloadPerBlock(uniquePayloadPerBlock);
642 }
643 
644 uint8_t
646 {
647  NS_LOG_FUNCTION(this << (uint32_t)index);
648 
649  if (index >= m_maxRaServiceEntries)
650  {
651  NS_FATAL_ERROR("Service index out of range!!!");
652  }
653 
655 }
656 
657 void
659  uint8_t consecutiveBlockAccessed)
660 {
661  NS_LOG_FUNCTION(this << (uint32_t)index << consecutiveBlockAccessed);
662 
663  if (index >= m_maxRaServiceEntries)
664  {
665  NS_FATAL_ERROR("Service index out of range!!!");
666  }
667 
668  m_raServiceEntries[index].SetMaximumConsecutiveBlockAccessed(consecutiveBlockAccessed);
669 }
670 
671 uint8_t
673 {
674  NS_LOG_FUNCTION(this << (uint32_t)index);
675 
676  if (index >= m_maxRaServiceEntries)
677  {
678  NS_FATAL_ERROR("Service index out of range!!!");
679  }
680 
681  return m_raServiceEntries[index].GetMinimumIdleBlock();
682 }
683 
684 void
685 SatLowerLayerServiceConf::SetRaMinimumIdleBlock(uint8_t index, uint8_t minimumIdleBlock)
686 {
687  NS_LOG_FUNCTION(this << (uint32_t)index << minimumIdleBlock);
688 
689  if (index >= m_maxRaServiceEntries)
690  {
691  NS_FATAL_ERROR("Service index out of range!!!");
692  }
693 
694  m_raServiceEntries[index].SetMinimumIdleBlock(minimumIdleBlock);
695 }
696 
697 uint16_t
699 {
700  NS_LOG_FUNCTION(this << (uint32_t)index);
701 
702  if (index >= m_maxRaServiceEntries)
703  {
704  NS_FATAL_ERROR("Service index out of range!!!");
705  }
706 
708 }
709 
710 void
712  uint16_t backOffTimeInMilliSeconds)
713 {
714  NS_LOG_FUNCTION(this << (uint32_t)index << backOffTimeInMilliSeconds);
715 
716  if (index >= m_maxRaServiceEntries)
717  {
718  NS_FATAL_ERROR("Service index out of range!!!");
719  }
720 
721  m_raServiceEntries[index].SetBackOffTimeInMilliSeconds(backOffTimeInMilliSeconds);
722 }
723 
724 uint16_t
726 {
727  NS_LOG_FUNCTION(this << (uint32_t)index);
728 
729  if (index >= m_maxRaServiceEntries)
730  {
731  NS_FATAL_ERROR("Service index out of range!!!");
732  }
733 
735 }
736 
737 void
739  uint16_t backOffTimeInMilliSeconds)
740 {
741  NS_LOG_FUNCTION(this << (uint32_t)index << backOffTimeInMilliSeconds);
742 
743  if (index >= m_maxRaServiceEntries)
744  {
745  NS_FATAL_ERROR("Service index out of range!!!");
746  }
747 
748  m_raServiceEntries[index].SetHighLoadBackOffTimeInMilliSeconds(backOffTimeInMilliSeconds);
749 }
750 
751 uint16_t
753 {
754  NS_LOG_FUNCTION(this << (uint32_t)index);
755 
756  if (index >= m_maxRaServiceEntries)
757  {
758  NS_FATAL_ERROR("Service index out of range!!!");
759  }
760 
762 }
763 
764 void
765 SatLowerLayerServiceConf::SetRaBackOffProbability(uint8_t index, uint16_t backOffProbability)
766 {
767  NS_LOG_FUNCTION(this << (uint32_t)index << backOffProbability);
768 
769  if (index >= m_maxRaServiceEntries)
770  {
771  NS_FATAL_ERROR("Service index out of range!!!");
772  }
773 
774  m_raServiceEntries[index].SetBackOffProbability(backOffProbability);
775 }
776 
777 uint16_t
779 {
780  NS_LOG_FUNCTION(this << (uint32_t)index);
781 
782  if (index >= m_maxRaServiceEntries)
783  {
784  NS_FATAL_ERROR("Service index out of range!!!");
785  }
786 
788 }
789 
790 void
792  uint16_t highLoadBackOffProbability)
793 {
794  NS_LOG_FUNCTION(this << (uint32_t)index << highLoadBackOffProbability);
795 
796  if (index >= m_maxRaServiceEntries)
797  {
798  NS_FATAL_ERROR("Service index out of range!!!");
799  }
800 
801  m_raServiceEntries[index].SetHighLoadBackOffProbability(highLoadBackOffProbability);
802 }
803 
804 uint8_t
806 {
807  NS_LOG_FUNCTION(this << (uint32_t)index);
808 
809  if (index >= m_maxRaServiceEntries)
810  {
811  NS_FATAL_ERROR("Service index out of range!!!");
812  }
813 
815 }
816 
817 void
818 SatLowerLayerServiceConf::SetRaNumberOfInstances(uint8_t index, uint8_t numberOfInstances)
819 {
820  NS_LOG_FUNCTION(this << (uint32_t)index << (uint32_t)numberOfInstances);
821 
822  if (index >= m_maxRaServiceEntries)
823  {
824  NS_FATAL_ERROR("Service index out of range!!!");
825  }
826 
827  m_raServiceEntries[index].SetNumberOfInstances(numberOfInstances);
828 }
829 
830 double
832 {
833  NS_LOG_FUNCTION(this << (uint32_t)index);
834 
835  if (index >= m_maxRaServiceEntries)
836  {
837  NS_FATAL_ERROR("Service index out of range!!!");
838  }
839 
841 }
842 
843 void
845  uint8_t index,
846  double averageNormalizedOfferedLoadThreshold)
847 {
848  NS_LOG_FUNCTION(this << (uint32_t)index << averageNormalizedOfferedLoadThreshold);
849 
850  if (index >= m_maxRaServiceEntries)
851  {
852  NS_FATAL_ERROR("Service index out of range!!!");
853  }
854 
856  averageNormalizedOfferedLoadThreshold);
857 }
858 
859 bool
861 {
862  NS_LOG_FUNCTION(this << (uint32_t)index);
863 
864  if (index >= m_maxRaServiceEntries)
865  {
866  NS_FATAL_ERROR("Service index out of range!!!");
867  }
868 
870 }
871 
872 void
873 SatLowerLayerServiceConf::SetRaIsSlottedAlohaAllowed(uint8_t index, bool isSlottedAlohaAllowed)
874 {
875  NS_LOG_FUNCTION(this << (uint32_t)index << isSlottedAlohaAllowed);
876 
877  if (index >= m_maxRaServiceEntries)
878  {
879  NS_FATAL_ERROR("Service index out of range!!!");
880  }
881 
882  m_raServiceEntries[index].SetIsSlottedAlohaAllowed(isSlottedAlohaAllowed);
883 }
884 
885 bool
887 {
888  NS_LOG_FUNCTION(this << (uint32_t)index);
889 
890  if (index >= m_maxRaServiceEntries)
891  {
892  NS_FATAL_ERROR("Service index out of range!!!");
893  }
894 
895  return m_raServiceEntries[index].GetIsCrdsaAllowed();
896 }
897 
898 void
899 SatLowerLayerServiceConf::SetRaIsCrdsaAllowed(uint8_t index, bool isCrdsaAllowed)
900 {
901  NS_LOG_FUNCTION(this << (uint32_t)index << isCrdsaAllowed);
902 
903  if (index >= m_maxRaServiceEntries)
904  {
905  NS_FATAL_ERROR("Service index out of range!!!");
906  }
907 
908  m_raServiceEntries[index].SetIsCrdsaAllowed(isCrdsaAllowed);
909 }
910 
911 bool
913 {
914  NS_LOG_FUNCTION(this << (uint32_t)index);
915 
916  if (index >= m_maxRaServiceEntries)
917  {
918  NS_FATAL_ERROR("Service index out of range!!!");
919  }
920 
921  return m_raServiceEntries[index].GetIsEssaAllowed();
922 }
923 
924 void
925 SatLowerLayerServiceConf::SetRaIsEssaAllowed(uint8_t index, bool isEssaAllowed)
926 {
927  NS_LOG_FUNCTION(this << (uint32_t)index << isEssaAllowed);
928 
929  if (index >= m_maxRaServiceEntries)
930  {
931  NS_FATAL_ERROR("Service index out of range!!!");
932  }
933 
934  m_raServiceEntries[index].SetIsEssaAllowed(isEssaAllowed);
935 }
936 
937 } // namespace ns3
The SatLowerLayerServiceConf class holds information of all configures lower layer service entries.
void SetDaVolumeAllowed(uint8_t index, bool volumeAllowed)
Set state, if volume is allowed for a DA service.
bool GetDaVolumeAllowed(uint8_t index) const
Get state, if volume is allowed for a DA service.
uint16_t GetDaMaximumBacklogInKbytes(uint8_t index) const
Get maximum backlog size for a DA service.
uint8_t GetRaMaximumUniquePayloadPerBlock(uint8_t index) const
Get maximum unique payload per block for a RA service.
void SetRaIsCrdsaAllowed(uint8_t index, bool isCrdsaAllowed)
Set CRDSA allowance.
void SetDaMinimumServiceRateInKbps(uint8_t index, uint16_t minimumServiceRateKbps)
Set minimum service rate for a DA service.
static std::string GetIndexAsDaServiceName(uint8_t index)
Method to convert DA service index to service name.
bool GetRaIsSlottedAlohaAllowed(uint8_t index) const
Get Slotted Aloha allowance.
void SetRaHighLoadBackOffProbability(uint8_t index, uint16_t highLoadBackOffProbability)
Set high load back off probability.
void SetRaNumberOfInstances(uint8_t index, uint8_t numberOfInstances)
Set number of instances.
void SetDaConstantAssignmentProvided(uint8_t index, bool constAssignmentProvided)
Set state, if constant assignment is provided for a DA service.
bool GetDaRbdcAllowed(uint8_t index) const
Get state, if RBDC is allowed for a DA service.
uint16_t GetRaHighLoadBackOffProbability(uint8_t index) const
Get high load back off probability.
uint16_t GetDaMaximumServiceRateInKbps(uint8_t index) const
Get maximum service rate for a DA service.
void SetRaMaximumUniquePayloadPerBlock(uint8_t index, uint8_t maxUniquePayloadPerBlock)
Set maximum unique payload per block for a RA service.
~SatLowerLayerServiceConf()
Destructor for SatLowerLayerServiceConf.
uint16_t GetRaHighLoadBackOffTimeInMilliSeconds(uint8_t index) const
Get high load back off time in milliseconds.
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
SatLowerLayerServiceConf()
Constructor for SatLowerLayerServiceConf.
void SetRaAverageNormalizedOfferedLoadThreshold(uint8_t index, double averageNormalizedOfferedLoadThreshold)
Set average normalized offeredLoad Threshold.
SatLowerLayerServiceRaEntry m_raServiceEntries[m_maxRaServiceEntries]
bool GetRaIsEssaAllowed(uint8_t index) const
Get E-SSA allowance.
void SetRaIsSlottedAlohaAllowed(uint8_t index, bool isSlottedAlohaAllowed)
Set Slotted Aloha allowance.
void SetRaIsEssaAllowed(uint8_t index, bool isEssaAllowed)
Set ESSA allowance.
static TypeId GetTypeId(void)
methods derived from base classes
uint16_t GetDaMinimumServiceRateInKbps(uint8_t index) const
Get minimum service rate for a DA service.
bool GetRaIsCrdsaAllowed(uint8_t index) const
Get CRDSA allowance.
uint16_t GetDaConstantServiceRateInKbps(uint8_t index) const
Get constant service rate for a DA service.
void SetDaRbdcAllowed(uint8_t index, bool bdcAllowed)
Set state, if RBDC is allowed for a DA service.
double GetRaAverageNormalizedOfferedLoadThreshold(uint8_t index) const
Get average normalized offeredLoad Threshold.
uint8_t GetRaNumberOfInstances(uint8_t index) const
Get number of instances.
Ptr< RandomVariableStream > GetDaConstantServiceRateStream(uint8_t index) const
Get constant service rate stream for a DA service.
void SetRaMaximumConsecutiveBlockAccessed(uint8_t index, uint8_t maxConsecutiveBlockAccessed)
Set maximum consecutive block accessed for a RA service.
void SetRaBackOffProbability(uint8_t index, uint16_t backOffProbability)
Set back off probability.
void SetRaMinimumIdleBlock(uint8_t index, uint8_t minimumIdleBlock)
Set minimum idle block for a RA service.
uint16_t GetRaBackOffProbability(uint8_t index) const
Get back off probability.
static std::string GetIndexAsRaServiceName(uint8_t index)
Method to convert RA service index to service name.
uint8_t GetRaMaximumConsecutiveBlockAccessed(uint8_t index) const
Get maximum consecutive block accessed for a RA service.
void SetRaBackOffTimeInMilliSeconds(uint8_t index, uint16_t backOffTimeInMilliSeconds)
Set back off time in milliseconds.
void SetDaMaximumServiceRateInKbps(uint8_t index, uint16_t maximumServiceRateKbps)
Set maximum service rate for a DA service.
void SetRaHighLoadBackOffTimeInMilliSeconds(uint8_t index, uint16_t backOffTimeInMilliSeconds)
Set high load back off time in milliseconds.
void SetDaConstantServiceRateStream(uint8_t index, Ptr< RandomVariableStream > constantServiceRateStream)
Set constant service rate stream for a DA service.
bool GetDaConstantAssignmentProvided(uint8_t index) const
Get state, if constant assignment is provided for a DA service.
SatLowerLayerServiceDaEntry m_daServiceEntries[m_maxDaServiceEntries]
uint8_t GetRaMinimumIdleBlock(uint8_t index) const
Get minimum idle block for a RA service.
uint16_t GetRaBackOffTimeInMilliSeconds(uint8_t index) const
Get back off time in milliseconds.
void SetDaMaximumBacklogInKbytes(uint8_t index, uint16_t maximumBacklogInKbytes)
Set maximum backlog size for a DA service.
bool GetRbdcAllowed() const
Get state, if RBDC is allowed.
void SetConstantServiceRateStream(Ptr< RandomVariableStream > constantServiceRateStream)
Set constant service rate stream.
void SetMaximumBacklogInKbytes(uint16_t maximumBacklogInKbytes)
Set maximum backlog size.
uint16_t GetMinimumServiceRateInKbps() const
Get minimum service rate.
Ptr< RandomVariableStream > GetConstantServiceRateStream() const
Get constant service rate stream.
SatLowerLayerServiceDaEntry()
~SatLowerLayerServiceDaEntry()
Destructor for SatLowerLayerServiceDaEntry.
void SetMinimumServiceRateInKbps(uint16_t minimumServiceRateKbps)
Set minimum service rate.
void SetConstantAssignmentProvided(bool constAssignmentProvided)
Set state, if constant assignment is provided.
void SetMaximumServiceRateInKbps(uint16_t maximumServiceRateKbps)
Set maximum service rate.
uint16_t GetMaximumServiceRateInKbps() const
Get maximum service rate.
bool GetVolumeAllowed() const
Get state, if volume is allowed.
uint16_t GetMaximumBacklogInKbytes() const
Get maximum backlog size.
uint16_t GetConstantServiceRateInKbps() const
Get constant service rate.
void SetVolumeAllowed(bool volumeAllowed)
Set state, if volume is allowed.
bool GetConstantAssignmentProvided() const
Get state, if constant assignment is provided.
void SetRbdcAllowed(bool bdcAllowed)
Set state, if RBDC is allowed.
void SetHighLoadBackOffProbability(uint16_t highLoadBackOffProbability)
Set high load back off probability.
void SetBackOffProbability(uint16_t backOffProbability)
Set back off probability.
void SetMaximumUniquePayloadPerBlock(uint8_t maxUniquePayloadPerBlock)
Set maximum unique payload per block.
void SetAverageNormalizedOfferedLoadThreshold(double averageNormalizedOfferedLoadThreshold)
Set average normalized offered load threshold.
uint16_t GetBackOffProbability() const
Get back off probability.
SatLowerLayerServiceRaEntry()
void SetMinimumIdleBlock(uint8_t minimumIdleBlock)
Set minimum idle block.
bool GetIsEssaAllowed() const
Get ESSA allowance.
void SetBackOffTimeInMilliSeconds(uint16_t backOffTimeInMilliSeconds)
Set back off time in milliseconds.
void SetMaximumConsecutiveBlockAccessed(uint8_t maxConsecutiveBlockAccessed)
Set maximum consecutive block accessed.
double GetAverageNormalizedOfferedLoadThreshold() const
Get average normalized offered load threshold.
void SetIsCrdsaAllowed(bool isCrdsaAllowed)
Set CRDSA allowance.
uint8_t GetNumberOfInstances() const
Get number of instances.
uint16_t GetHighLoadBackOffTimeInMilliSeconds() const
Get high load back off time in milliseconds.
uint8_t GetMaximumConsecutiveBlockAccessed() const
Get maximum consecutive block accessed.
bool GetIsCrdsaAllowed() const
Get CRDSA allowance.
void SetIsSlottedAlohaAllowed(bool isSlottedAlohaAllowed)
Set Slotted Aloha allowance.
void SetHighLoadBackOffTimeInMilliSeconds(uint16_t backOffTimeInMilliSeconds)
Set high load back off time in milliseconds.
bool GetIsSlottedAlohaAllowed() const
Get Slotted Aloha allowance.
uint16_t GetBackOffTimeInMilliSeconds() const
Get back off time in milliseconds.
void SetNumberOfInstances(uint8_t numberOfInstances)
Set number of instances.
uint8_t GetMinimumIdleBlock() const
Get minimum idle block.
~SatLowerLayerServiceRaEntry()
Destructor for SatLowerLayerServiceRaEntry.
void SetIsEssaAllowed(bool isEssaAllowed)
Set ESSA allowance.
uint16_t GetHighLoadBackOffProbability() const
Get high load back off probability.
uint8_t GetMaximumUniquePayloadPerBlock() const
Get maximum unique payload per block.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
#define SAT_ADD_DA_SERVICE_ATTRIBUTES(index, a1, a2, a3, a4, a5, a6, a7)
SAT_ADD_DA_SERVICE_ATTRIBUTES macro helps defining service specific attributes for SatLowerLayerServi...