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 NS_LOG_COMPONENT_DEFINE("SatLowerLayerServiceConf");
37 
38 namespace ns3
39 {
40 
42  : m_constantAssignmentProvided(false),
43  m_rbdcAllowed(false),
44  m_volumeAllowed(false),
45  m_constantServiceRateStream(0),
46  m_maximumServiceRateKbps(0.0),
47  m_minimumServiceRateKbps(0.0),
48  m_maximumBacklogInKbytes(0)
49 {
50  NS_LOG_FUNCTION(this);
51 }
52 
54 {
55  NS_LOG_FUNCTION(this);
56 }
57 
59  : m_maxUniquePayloadPerBlock(0),
60  m_maxConsecutiveBlockAccessed(0),
61  m_minimumIdleBlock(0),
62  m_backOffTimeInMilliSeconds(0),
63  m_highLoadBackOffTimeInMilliSeconds(0),
64  m_backOffProbability(0),
65  m_highLoadBackOffProbability(0),
66  m_numberOfInstances(0),
67  m_averageNormalizedOfferedLoadThreshold(0.0),
68  m_isCrdsaAllowed(false),
69  m_isSlottedAlohaAllowed(false),
70  m_isEssaAllowed(false)
71 {
72  NS_LOG_FUNCTION(this);
73 }
74 
76 {
77  NS_LOG_FUNCTION(this);
78 }
79 
80 NS_OBJECT_ENSURE_REGISTERED(SatLowerLayerServiceConf);
81 
83  : m_dynamicRatePersistence(0),
84  m_volumeBacklogPersistence(0),
85  m_defaultControlRandomizationInterval(0.0),
86  m_daServiceEntryCount(0),
87  m_raServiceEntryCount(0)
88 {
89  NS_LOG_FUNCTION(this);
90 
92  {
93  NS_FATAL_ERROR("SatLowerLayerServiceConf::SatLowerLayerServiceConf - m_minRaServiceEntries "
94  "> m_maxRaServiceEntries");
95  }
96 
98  {
99  NS_FATAL_ERROR("SatLowerLayerServiceConf::SatLowerLayerServiceConf - m_minDaServiceEntries "
100  "> m_maxDaServiceEntries");
101  }
102 }
103 
105 {
106  NS_LOG_FUNCTION(this);
107 }
108 
109 std::string
111 {
112  std::string name = "DaService";
113  return name + GetNumberAsString<uint8_t>(index);
114 }
115 
116 std::string
118 {
119  std::string name = "RaService";
120  return name + GetNumberAsString<uint8_t>(index);
121 }
122 
138 #define SAT_ADD_DA_SERVICE_ATTRIBUTES(index, a1, a2, a3, a4, a5, a6, a7) \
139  AddAttribute(GetIndexAsDaServiceName(index) + "_ConstantAssignmentProvided", \
140  "Constant Assignment provided for " + GetIndexAsDaServiceName(index), \
141  BooleanValue(a1), \
142  MakeBooleanAccessor( \
143  &SatLowerLayerServiceConf::SetDaServ##index##ConstantAssignmentProvided, \
144  &SatLowerLayerServiceConf::GetDaServ##index##ConstantAssignmentProvided), \
145  MakeBooleanChecker()) \
146  .AddAttribute( \
147  GetIndexAsDaServiceName(index) + "_RbdcAllowed", \
148  "RBDC allowed for DA " + GetIndexAsDaServiceName(index), \
149  BooleanValue(a2), \
150  MakeBooleanAccessor(&SatLowerLayerServiceConf::SetDaServ##index##RbdcAllowed, \
151  &SatLowerLayerServiceConf::GetDaServ##index##RbdcAllowed), \
152  MakeBooleanChecker()) \
153  .AddAttribute( \
154  GetIndexAsDaServiceName(index) + "_VolumeAllowed", \
155  "Volume allowed for DA " + GetIndexAsDaServiceName(index), \
156  BooleanValue(a3), \
157  MakeBooleanAccessor(&SatLowerLayerServiceConf::SetDaServ##index##VolumeAllowed, \
158  &SatLowerLayerServiceConf::GetDaServ##index##VolumeAllowed), \
159  MakeBooleanChecker()) \
160  .AddAttribute(GetIndexAsDaServiceName(index) + "_ConstantServiceRate", \
161  "A RandomVariableStream for constant service rate [kbps] for DA " + \
162  GetIndexAsDaServiceName(index), \
163  StringValue("ns3::ConstantRandomVariable[Constant=" + \
164  GetNumberAsString<uint16_t>(a4) + "]"), \
165  MakePointerAccessor( \
166  &SatLowerLayerServiceConf::SetDaServ##index##ConstantServiceRateStream, \
167  &SatLowerLayerServiceConf::GetDaServ##index##ConstantServiceRateStream), \
168  MakePointerChecker<RandomVariableStream>()) \
169  .AddAttribute(GetIndexAsDaServiceName(index) + "_MaximumServiceRate", \
170  "Maximum service rate [kbps] for DA " + GetIndexAsDaServiceName(index), \
171  UintegerValue(a5), \
172  MakeUintegerAccessor( \
173  &SatLowerLayerServiceConf::SetDaServ##index##MaximumServiceRateInKbps, \
174  &SatLowerLayerServiceConf::GetDaServ##index##MaximumServiceRateInKbps), \
175  MakeUintegerChecker<uint16_t>()) \
176  .AddAttribute(GetIndexAsDaServiceName(index) + "_MinimumServiceRate", \
177  "Minimum service rate [kbps] for DA " + GetIndexAsDaServiceName(index), \
178  UintegerValue(a6), \
179  MakeUintegerAccessor( \
180  &SatLowerLayerServiceConf::SetDaServ##index##MinimumServiceRateInKbps, \
181  &SatLowerLayerServiceConf::GetDaServ##index##MinimumServiceRateInKbps), \
182  MakeUintegerChecker<uint16_t>()) \
183  .AddAttribute(GetIndexAsDaServiceName(index) + "_MaximumBacklogSize", \
184  "Maximum backlog size [Kbytes] for DA " + GetIndexAsDaServiceName(index), \
185  UintegerValue(a7), \
186  MakeUintegerAccessor( \
187  &SatLowerLayerServiceConf::SetDaServ##index##MaximumBacklogInKbytes, \
188  &SatLowerLayerServiceConf::GetDaServ##index##MaximumBacklogInKbytes), \
189  MakeUintegerChecker<uint16_t>())
190 
211 #define SAT_ADD_RA_SERVICE_ATTRIBUTES(index, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) \
212  AddAttribute(GetIndexAsRaServiceName(index) + "_MaximumUniquePayloadPerBlock", \
213  "Maximum unique payload per block for RA " + GetIndexAsRaServiceName(index), \
214  UintegerValue(a1), \
215  MakeUintegerAccessor( \
216  &SatLowerLayerServiceConf::SetRaServ##index##MaximumUniquePayloadPerBlock, \
217  &SatLowerLayerServiceConf::GetRaServ##index##MaximumUniquePayloadPerBlock), \
218  MakeUintegerChecker<uint8_t>()) \
219  .AddAttribute( \
220  GetIndexAsRaServiceName(index) + "_MaximumConsecutiveBlockAccessed", \
221  "Maximum consecutive block accessed for RA " + GetIndexAsRaServiceName(index), \
222  UintegerValue(a2), \
223  MakeUintegerAccessor( \
224  &SatLowerLayerServiceConf::SetRaServ##index##MaximumConsecutiveBlockAccessed, \
225  &SatLowerLayerServiceConf::GetRaServ##index##MaximumConsecutiveBlockAccessed), \
226  MakeUintegerChecker<uint8_t>()) \
227  .AddAttribute( \
228  GetIndexAsRaServiceName(index) + "_MinimumIdleBlock", \
229  "Minimum idle block for RA " + GetIndexAsRaServiceName(index), \
230  UintegerValue(a3), \
231  MakeUintegerAccessor(&SatLowerLayerServiceConf::SetRaServ##index##MinimumIdleBlock, \
232  &SatLowerLayerServiceConf::GetRaServ##index##MinimumIdleBlock), \
233  MakeUintegerChecker<uint8_t>()) \
234  .AddAttribute(GetIndexAsRaServiceName(index) + "_BackOffTimeInMilliSeconds", \
235  "Back off time in milliseconds for RA " + GetIndexAsRaServiceName(index), \
236  UintegerValue(a4), \
237  MakeUintegerAccessor( \
238  &SatLowerLayerServiceConf::SetRaServ##index##BackOffTimeInMilliSeconds, \
239  &SatLowerLayerServiceConf::GetRaServ##index##BackOffTimeInMilliSeconds), \
240  MakeUintegerChecker<uint16_t>()) \
241  .AddAttribute( \
242  GetIndexAsRaServiceName(index) + "_HighLoadBackOffTimeInMilliSeconds", \
243  "High load back off time in milliseconds for RA " + GetIndexAsRaServiceName(index), \
244  UintegerValue(a5), \
245  MakeUintegerAccessor( \
246  &SatLowerLayerServiceConf::SetRaServ##index##HighLoadBackOffTimeInMilliSeconds, \
247  &SatLowerLayerServiceConf::GetRaServ##index##HighLoadBackOffTimeInMilliSeconds), \
248  MakeUintegerChecker<uint16_t>()) \
249  .AddAttribute( \
250  GetIndexAsRaServiceName(index) + "_BackOffProbability", \
251  "Back off probability for RA " + GetIndexAsRaServiceName(index), \
252  UintegerValue(a6), \
253  MakeUintegerAccessor(&SatLowerLayerServiceConf::SetRaServ##index##BackOffProbability, \
254  &SatLowerLayerServiceConf::GetRaServ##index##BackOffProbability), \
255  MakeUintegerChecker<uint16_t>()) \
256  .AddAttribute( \
257  GetIndexAsRaServiceName(index) + "_HighLoadBackOffProbability", \
258  "High load back off probability for RA " + GetIndexAsRaServiceName(index), \
259  UintegerValue(a7), \
260  MakeUintegerAccessor( \
261  &SatLowerLayerServiceConf::SetRaServ##index##HighLoadBackOffProbability, \
262  &SatLowerLayerServiceConf::GetRaServ##index##HighLoadBackOffProbability), \
263  MakeUintegerChecker<uint16_t>()) \
264  .AddAttribute( \
265  GetIndexAsRaServiceName(index) + "_NumberOfInstances", \
266  "Number of instances for RA " + GetIndexAsRaServiceName(index), \
267  UintegerValue(a8), \
268  MakeUintegerAccessor(&SatLowerLayerServiceConf::SetRaServ##index##NumberOfInstances, \
269  &SatLowerLayerServiceConf::GetRaServ##index##NumberOfInstances), \
270  MakeUintegerChecker<uint8_t>()) \
271  .AddAttribute( \
272  GetIndexAsRaServiceName(index) + "_AverageNormalizedOfferedLoadThreshold", \
273  "Average normalized offered load threshold for RA " + GetIndexAsRaServiceName(index), \
274  DoubleValue(a9), \
275  MakeDoubleAccessor(&SatLowerLayerServiceConf:: \
276  SetRaServ##index##AverageNormalizedOfferedLoadThreshold, \
277  &SatLowerLayerServiceConf:: \
278  GetRaServ##index##AverageNormalizedOfferedLoadThreshold), \
279  MakeDoubleChecker<double>()) \
280  .AddAttribute(GetIndexAsRaServiceName(index) + "_SlottedAlohaAllowed", \
281  "Slotted Aloha allowed for RA " + GetIndexAsRaServiceName(index), \
282  BooleanValue(a10), \
283  MakeBooleanAccessor( \
284  &SatLowerLayerServiceConf::SetRaServ##index##IsSlottedAlohaAllowed, \
285  &SatLowerLayerServiceConf::GetRaServ##index##IsSlottedAlohaAllowed), \
286  MakeBooleanChecker()) \
287  .AddAttribute( \
288  GetIndexAsRaServiceName(index) + "_CrdsaAllowed", \
289  "CRDSA allowed for RA " + GetIndexAsRaServiceName(index), \
290  BooleanValue(a11), \
291  MakeBooleanAccessor(&SatLowerLayerServiceConf::SetRaServ##index##IsCrdsaAllowed, \
292  &SatLowerLayerServiceConf::GetRaServ##index##IsCrdsaAllowed), \
293  MakeBooleanChecker()) \
294  .AddAttribute( \
295  GetIndexAsRaServiceName(index) + "_EssaAllowed", \
296  "ESSA allowed for RA " + GetIndexAsRaServiceName(index), \
297  BooleanValue(a12), \
298  MakeBooleanAccessor(&SatLowerLayerServiceConf::SetRaServ##index##IsEssaAllowed, \
299  &SatLowerLayerServiceConf::GetRaServ##index##IsEssaAllowed), \
300  MakeBooleanChecker())
301 
302 TypeId
304 {
305  static TypeId tid =
306  TypeId("ns3::SatLowerLayerServiceConf")
307  .SetParent<Object>()
308  .AddConstructor<SatLowerLayerServiceConf>()
309  .AddAttribute(
310  "DaServiceCount",
311  "DA services in use.",
312  UintegerValue(4),
314  MakeUintegerChecker<uint8_t>(SatLowerLayerServiceConf::m_minDaServiceEntries,
316  .AddAttribute(
317  "RaServiceCount",
318  "RA services in use.",
319  UintegerValue(1),
321  MakeUintegerChecker<uint8_t>(SatLowerLayerServiceConf::m_minRaServiceEntries,
323  .AddAttribute(
324  "RaServiceDefault",
325  "Index of the RA service to use as a default for carriers with no explicitly "
326  "assigned services.",
327  UintegerValue(0),
329  MakeUintegerChecker<uint8_t>(0,
331  .AddAttribute("DynamicRatePersistence",
332  "Dynamic rate persistence for the lower layer service.",
333  UintegerValue(5),
335  MakeUintegerChecker<uint8_t>())
336  .AddAttribute(
337  "VolumeBacklogPersistence",
338  "Volume backlog persistence for the lower layer service",
339  UintegerValue(7),
341  MakeUintegerChecker<uint8_t>())
342  .AddAttribute(
343  "DefaultControlRandomizationInterval",
344  "Default control randomization interval for the lower layer service",
345  TimeValue(MilliSeconds(100)),
347  MakeTimeChecker(MilliSeconds(0), MilliSeconds(std::numeric_limits<uint8_t>::max())))
348  /*
349  * RC index, CRA allowed, RBDC allowed, VBDC allowed, CRA rate, Max RBDC rate, Min RBDC
350  * rate, Max volume backlog
351  */
352  .SAT_ADD_DA_SERVICE_ATTRIBUTES(0, true, false, false, 50, 9216, 10, 384)
353  .SAT_ADD_DA_SERVICE_ATTRIBUTES(1, false, false, false, 50, 9216, 10, 384)
354  .SAT_ADD_DA_SERVICE_ATTRIBUTES(2, false, false, false, 50, 9216, 10, 384)
355  .SAT_ADD_DA_SERVICE_ATTRIBUTES(3, false, true, false, 50, 9216, 10, 384)
356 
357  /*
358  * Max payload per block, Max consecutive blocks, Min IDLE block, Backoff time, High
359  * load Backoff time, Backoff probability, High load Backoff probability, Replicas,
360  * Average load threshold
361  */
362  .SAT_ADD_RA_SERVICE_ATTRIBUTES(0,
363  3,
364  4,
365  2,
366  250,
367  500,
368  10000,
369  30000,
370  3,
371  0.5,
372  true,
373  true,
374  false)
375  .SAT_ADD_RA_SERVICE_ATTRIBUTES(1,
376  3,
377  4,
378  2,
379  250,
380  500,
381  10000,
382  30000,
383  2,
384  0.5,
385  true,
386  true,
387  false)
388  .SAT_ADD_RA_SERVICE_ATTRIBUTES(2,
389  3,
390  4,
391  2,
392  250,
393  500,
394  10000,
395  30000,
396  5,
397  0.5,
398  true,
399  true,
400  false);
401 
402  return tid;
403 }
404 
405 TypeId
407 {
408  NS_LOG_FUNCTION(this);
409 
410  return GetTypeId();
411 }
412 
413 bool
415 {
416  NS_LOG_FUNCTION(this << (uint32_t)index);
417 
418  if (index >= m_maxDaServiceEntries)
419  {
420  NS_FATAL_ERROR("Service index out of range!!!");
421  }
422 
424 }
425 
426 void
428  bool constAssignmentProvided)
429 {
430  NS_LOG_FUNCTION(this << (uint32_t)index << constAssignmentProvided);
431 
432  if (index >= m_maxDaServiceEntries)
433  {
434  NS_FATAL_ERROR("Service index out of range!!!");
435  }
436 
437  m_daServiceEntries[index].SetConstantAssignmentProvided(constAssignmentProvided);
438 }
439 
440 bool
442 {
443  NS_LOG_FUNCTION(this << (uint32_t)index);
444 
445  if (index >= m_maxDaServiceEntries)
446  {
447  NS_FATAL_ERROR("Service index out of range!!!");
448  }
449 
450  return m_daServiceEntries[index].GetRbdcAllowed();
451 }
452 
453 void
454 SatLowerLayerServiceConf::SetDaRbdcAllowed(uint8_t index, bool bdcAllowed)
455 {
456  NS_LOG_FUNCTION(this << (uint32_t)index << bdcAllowed);
457 
458  if (index >= m_maxDaServiceEntries)
459  {
460  NS_FATAL_ERROR("Service index out of range!!!");
461  }
462 
463  m_daServiceEntries[index].SetRbdcAllowed(bdcAllowed);
464 }
465 
466 bool
468 {
469  NS_LOG_FUNCTION(this << (uint32_t)index);
470 
471  if (index >= m_maxDaServiceEntries)
472  {
473  NS_FATAL_ERROR("Service index out of range!!!");
474  }
475 
476  return m_daServiceEntries[index].GetVolumeAllowed();
477 }
478 
479 void
480 SatLowerLayerServiceConf::SetDaVolumeAllowed(uint8_t index, bool volumeAllowed)
481 {
482  NS_LOG_FUNCTION(this << (uint32_t)index << volumeAllowed);
483 
484  if (index >= m_maxDaServiceEntries)
485  {
486  NS_FATAL_ERROR("Service index out of range!!!");
487  }
488 
489  m_daServiceEntries[index].SetVolumeAllowed(volumeAllowed);
490 }
491 
492 uint16_t
494 {
495  NS_LOG_FUNCTION(this << (uint32_t)index);
496 
497  if (index >= m_maxDaServiceEntries)
498  {
499  NS_FATAL_ERROR("Service index out of range!!!");
500  }
501 
503 }
504 
505 Ptr<RandomVariableStream>
507 {
508  NS_LOG_FUNCTION(this << (uint32_t)index);
509 
510  if (index >= m_maxDaServiceEntries)
511  {
512  NS_FATAL_ERROR("Service index out of range!!!");
513  }
514 
516 }
517 
518 void
520  uint8_t index,
521  Ptr<RandomVariableStream> constantServiceRateStream)
522 {
523  NS_LOG_FUNCTION(this << (uint32_t)index);
524 
525  if (index >= m_maxDaServiceEntries)
526  {
527  NS_FATAL_ERROR("Service index out of range!!!");
528  }
529 
530  m_daServiceEntries[index].SetConstantServiceRateStream(constantServiceRateStream);
531 }
532 
533 uint16_t
535 {
536  NS_LOG_FUNCTION(this << (uint32_t)index);
537 
538  if (index >= m_maxDaServiceEntries)
539  {
540  NS_FATAL_ERROR("Service index out of range!!!");
541  }
542 
544 }
545 
546 void
548  uint16_t maximumServiceRateKbps)
549 {
550  NS_LOG_FUNCTION(this << (uint32_t)index << maximumServiceRateKbps);
551 
552  if (index >= m_maxDaServiceEntries)
553  {
554  NS_FATAL_ERROR("Service index out of range!!!");
555  }
556 
557  m_daServiceEntries[index].SetMaximumServiceRateInKbps(maximumServiceRateKbps);
558 }
559 
560 uint16_t
562 {
563  NS_LOG_FUNCTION(this << (uint32_t)index);
564 
565  if (index >= m_maxDaServiceEntries)
566  {
567  NS_FATAL_ERROR("Service index out of range!!!");
568  }
569 
571 }
572 
573 void
575  uint16_t minimumServiceRateKbps)
576 {
577  NS_LOG_FUNCTION(this << (uint32_t)index << minimumServiceRateKbps);
578 
579  if (index >= m_maxDaServiceEntries)
580  {
581  NS_FATAL_ERROR("Service index out of range!!!");
582  }
583 
584  m_daServiceEntries[index].SetMinimumServiceRateInKbps(minimumServiceRateKbps);
585 }
586 
587 uint16_t
589 {
590  NS_LOG_FUNCTION(this << (uint32_t)index);
591 
592  if (index >= m_maxDaServiceEntries)
593  {
594  NS_FATAL_ERROR("Service index out of range!!!");
595  }
596 
598 }
599 
600 void
602  uint16_t maximumBacklogInKbytes)
603 {
604  NS_LOG_FUNCTION(this << (uint32_t)index << maximumBacklogInKbytes);
605 
606  if (index >= m_maxDaServiceEntries)
607  {
608  NS_FATAL_ERROR("Service index out of range!!!");
609  }
610 
611  m_daServiceEntries[index].SetMaximumBacklogInKbytes(maximumBacklogInKbytes);
612 }
613 
614 uint8_t
616 {
617  NS_LOG_FUNCTION(this << (uint32_t)index);
618 
619  if (index >= m_maxRaServiceEntries)
620  {
621  NS_FATAL_ERROR("Service index out of range!!!");
622  }
623 
625 }
626 
627 void
629  uint8_t uniquePayloadPerBlock)
630 {
631  NS_LOG_FUNCTION(this << (uint32_t)index << uniquePayloadPerBlock);
632 
633  if (index >= m_maxRaServiceEntries)
634  {
635  NS_FATAL_ERROR("Service index out of range!!!");
636  }
637 
638  m_raServiceEntries[index].SetMaximumUniquePayloadPerBlock(uniquePayloadPerBlock);
639 }
640 
641 uint8_t
643 {
644  NS_LOG_FUNCTION(this << (uint32_t)index);
645 
646  if (index >= m_maxRaServiceEntries)
647  {
648  NS_FATAL_ERROR("Service index out of range!!!");
649  }
650 
652 }
653 
654 void
656  uint8_t consecutiveBlockAccessed)
657 {
658  NS_LOG_FUNCTION(this << (uint32_t)index << consecutiveBlockAccessed);
659 
660  if (index >= m_maxRaServiceEntries)
661  {
662  NS_FATAL_ERROR("Service index out of range!!!");
663  }
664 
665  m_raServiceEntries[index].SetMaximumConsecutiveBlockAccessed(consecutiveBlockAccessed);
666 }
667 
668 uint8_t
670 {
671  NS_LOG_FUNCTION(this << (uint32_t)index);
672 
673  if (index >= m_maxRaServiceEntries)
674  {
675  NS_FATAL_ERROR("Service index out of range!!!");
676  }
677 
678  return m_raServiceEntries[index].GetMinimumIdleBlock();
679 }
680 
681 void
682 SatLowerLayerServiceConf::SetRaMinimumIdleBlock(uint8_t index, uint8_t minimumIdleBlock)
683 {
684  NS_LOG_FUNCTION(this << (uint32_t)index << minimumIdleBlock);
685 
686  if (index >= m_maxRaServiceEntries)
687  {
688  NS_FATAL_ERROR("Service index out of range!!!");
689  }
690 
691  m_raServiceEntries[index].SetMinimumIdleBlock(minimumIdleBlock);
692 }
693 
694 uint16_t
696 {
697  NS_LOG_FUNCTION(this << (uint32_t)index);
698 
699  if (index >= m_maxRaServiceEntries)
700  {
701  NS_FATAL_ERROR("Service index out of range!!!");
702  }
703 
705 }
706 
707 void
709  uint16_t backOffTimeInMilliSeconds)
710 {
711  NS_LOG_FUNCTION(this << (uint32_t)index << backOffTimeInMilliSeconds);
712 
713  if (index >= m_maxRaServiceEntries)
714  {
715  NS_FATAL_ERROR("Service index out of range!!!");
716  }
717 
718  m_raServiceEntries[index].SetBackOffTimeInMilliSeconds(backOffTimeInMilliSeconds);
719 }
720 
721 uint16_t
723 {
724  NS_LOG_FUNCTION(this << (uint32_t)index);
725 
726  if (index >= m_maxRaServiceEntries)
727  {
728  NS_FATAL_ERROR("Service index out of range!!!");
729  }
730 
732 }
733 
734 void
736  uint16_t backOffTimeInMilliSeconds)
737 {
738  NS_LOG_FUNCTION(this << (uint32_t)index << backOffTimeInMilliSeconds);
739 
740  if (index >= m_maxRaServiceEntries)
741  {
742  NS_FATAL_ERROR("Service index out of range!!!");
743  }
744 
745  m_raServiceEntries[index].SetHighLoadBackOffTimeInMilliSeconds(backOffTimeInMilliSeconds);
746 }
747 
748 uint16_t
750 {
751  NS_LOG_FUNCTION(this << (uint32_t)index);
752 
753  if (index >= m_maxRaServiceEntries)
754  {
755  NS_FATAL_ERROR("Service index out of range!!!");
756  }
757 
759 }
760 
761 void
762 SatLowerLayerServiceConf::SetRaBackOffProbability(uint8_t index, uint16_t backOffProbability)
763 {
764  NS_LOG_FUNCTION(this << (uint32_t)index << backOffProbability);
765 
766  if (index >= m_maxRaServiceEntries)
767  {
768  NS_FATAL_ERROR("Service index out of range!!!");
769  }
770 
771  m_raServiceEntries[index].SetBackOffProbability(backOffProbability);
772 }
773 
774 uint16_t
776 {
777  NS_LOG_FUNCTION(this << (uint32_t)index);
778 
779  if (index >= m_maxRaServiceEntries)
780  {
781  NS_FATAL_ERROR("Service index out of range!!!");
782  }
783 
785 }
786 
787 void
789  uint16_t highLoadBackOffProbability)
790 {
791  NS_LOG_FUNCTION(this << (uint32_t)index << highLoadBackOffProbability);
792 
793  if (index >= m_maxRaServiceEntries)
794  {
795  NS_FATAL_ERROR("Service index out of range!!!");
796  }
797 
798  m_raServiceEntries[index].SetHighLoadBackOffProbability(highLoadBackOffProbability);
799 }
800 
801 uint8_t
803 {
804  NS_LOG_FUNCTION(this << (uint32_t)index);
805 
806  if (index >= m_maxRaServiceEntries)
807  {
808  NS_FATAL_ERROR("Service index out of range!!!");
809  }
810 
812 }
813 
814 void
815 SatLowerLayerServiceConf::SetRaNumberOfInstances(uint8_t index, uint8_t numberOfInstances)
816 {
817  NS_LOG_FUNCTION(this << (uint32_t)index << (uint32_t)numberOfInstances);
818 
819  if (index >= m_maxRaServiceEntries)
820  {
821  NS_FATAL_ERROR("Service index out of range!!!");
822  }
823 
824  m_raServiceEntries[index].SetNumberOfInstances(numberOfInstances);
825 }
826 
827 double
829 {
830  NS_LOG_FUNCTION(this << (uint32_t)index);
831 
832  if (index >= m_maxRaServiceEntries)
833  {
834  NS_FATAL_ERROR("Service index out of range!!!");
835  }
836 
838 }
839 
840 void
842  uint8_t index,
843  double averageNormalizedOfferedLoadThreshold)
844 {
845  NS_LOG_FUNCTION(this << (uint32_t)index << averageNormalizedOfferedLoadThreshold);
846 
847  if (index >= m_maxRaServiceEntries)
848  {
849  NS_FATAL_ERROR("Service index out of range!!!");
850  }
851 
853  averageNormalizedOfferedLoadThreshold);
854 }
855 
856 bool
858 {
859  NS_LOG_FUNCTION(this << (uint32_t)index);
860 
861  if (index >= m_maxRaServiceEntries)
862  {
863  NS_FATAL_ERROR("Service index out of range!!!");
864  }
865 
867 }
868 
869 void
870 SatLowerLayerServiceConf::SetRaIsSlottedAlohaAllowed(uint8_t index, bool isSlottedAlohaAllowed)
871 {
872  NS_LOG_FUNCTION(this << (uint32_t)index << isSlottedAlohaAllowed);
873 
874  if (index >= m_maxRaServiceEntries)
875  {
876  NS_FATAL_ERROR("Service index out of range!!!");
877  }
878 
879  m_raServiceEntries[index].SetIsSlottedAlohaAllowed(isSlottedAlohaAllowed);
880 }
881 
882 bool
884 {
885  NS_LOG_FUNCTION(this << (uint32_t)index);
886 
887  if (index >= m_maxRaServiceEntries)
888  {
889  NS_FATAL_ERROR("Service index out of range!!!");
890  }
891 
892  return m_raServiceEntries[index].GetIsCrdsaAllowed();
893 }
894 
895 void
896 SatLowerLayerServiceConf::SetRaIsCrdsaAllowed(uint8_t index, bool isCrdsaAllowed)
897 {
898  NS_LOG_FUNCTION(this << (uint32_t)index << isCrdsaAllowed);
899 
900  if (index >= m_maxRaServiceEntries)
901  {
902  NS_FATAL_ERROR("Service index out of range!!!");
903  }
904 
905  m_raServiceEntries[index].SetIsCrdsaAllowed(isCrdsaAllowed);
906 }
907 
908 bool
910 {
911  NS_LOG_FUNCTION(this << (uint32_t)index);
912 
913  if (index >= m_maxRaServiceEntries)
914  {
915  NS_FATAL_ERROR("Service index out of range!!!");
916  }
917 
918  return m_raServiceEntries[index].GetIsEssaAllowed();
919 }
920 
921 void
922 SatLowerLayerServiceConf::SetRaIsEssaAllowed(uint8_t index, bool isEssaAllowed)
923 {
924  NS_LOG_FUNCTION(this << (uint32_t)index << isEssaAllowed);
925 
926  if (index >= m_maxRaServiceEntries)
927  {
928  NS_FATAL_ERROR("Service index out of range!!!");
929  }
930 
931  m_raServiceEntries[index].SetIsEssaAllowed(isEssaAllowed);
932 }
933 
934 } // 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...