satellite-frame-conf.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 
23 #include "satellite-frame-conf.h"
24 
25 #include <ns3/boolean.h>
26 #include <ns3/double.h>
27 #include <ns3/enum.h>
28 #include <ns3/log.h>
29 #include <ns3/object.h>
30 #include <ns3/uinteger.h>
31 
32 #include <algorithm>
33 #include <string>
34 
35 NS_LOG_COMPONENT_DEFINE("SatFrameConf");
36 
37 namespace ns3
38 {
39 
40 // BTU conf
41 
43  : m_allocatedBandwidthInHz(0.0),
44  m_occupiedBandwidthInHz(0.0),
45  m_effectiveBandwidthInHz(0.0),
46  m_duration(0.0)
47 {
48  NS_LOG_FUNCTION(this);
49 
50  // default constructor should not be used
51  NS_ASSERT(false);
52 }
53 
54 SatBtuConf::SatBtuConf(double bandwidthInHz,
55  double rollOff,
56  double spacing,
57  uint32_t spreadingFactor)
58  : m_allocatedBandwidthInHz(bandwidthInHz),
59  m_spreadingFactor(spreadingFactor)
60 {
61  NS_LOG_FUNCTION(this);
62 
63  if ((spacing < 0.00) && (spacing > 1.00))
64  {
65  NS_FATAL_ERROR("Spacing for BTU is out of range. Check frame configuration parameters "
66  "(attributes)!!!");
67  }
68 
69  if ((rollOff < 0.00) && (rollOff > 1.00))
70  {
71  NS_FATAL_ERROR("Roll-off for BTU is out of range. Check frame configuration parameters "
72  "(attributes)!!!");
73  }
74 
75  m_occupiedBandwidthInHz = spreadingFactor * m_allocatedBandwidthInHz / (rollOff + 1.00);
77  spreadingFactor * m_allocatedBandwidthInHz / ((spacing + 1.00) * (rollOff + 1.00));
78 
79  m_duration = Seconds(1 / m_effectiveBandwidthInHz);
80 }
81 
83 {
84  NS_LOG_FUNCTION(this);
85 }
86 
87 // Time Slot conf
88 
90  : m_startTime(0),
91  m_waveFormId(0),
92  m_frameCarrierId(0),
93  m_rcIndex(0),
94  m_slotType(SatTimeSlotConf::SLOT_TYPE_TRC)
95 {
96  NS_LOG_FUNCTION(this);
97 
98  // default constructor should not be used
99  NS_ASSERT(false);
100 }
101 
103  uint32_t waveFormId,
104  uint16_t frameCarrierId,
106  : m_startTime(startTime),
107  m_waveFormId(waveFormId),
108  m_frameCarrierId(frameCarrierId),
109  m_rcIndex(0),
110  m_slotType(slotType)
111 {
112  NS_LOG_FUNCTION(this);
113 }
114 
116 {
117  NS_LOG_FUNCTION(this);
118 }
119 
120 // Frame conf
121 
123  : m_bandwidthHz(0.0),
124  m_duration(0.0),
125  m_isRandomAccess(false),
126  m_parent(nullptr),
127  m_btuConf(nullptr),
128  m_allocationChannel(0),
129  m_carrierCount(0),
130  m_maxSymbolsPerCarrier(0),
131  m_minPayloadPerCarrierInBytes(0)
132 {
133  NS_LOG_FUNCTION(this);
134 
135  // default constructor should not be used
136  NS_ASSERT(false);
137 }
138 
140  : m_bandwidthHz(parameters.m_bandwidthHz),
141  m_isRandomAccess(parameters.m_isRandomAccess),
142  m_isLogon(parameters.m_isLogon),
143  m_parent(parameters.m_parent),
144  m_btuConf(parameters.m_btuConf),
145  m_waveformConf(parameters.m_waveformConf),
146  m_allocationChannel(parameters.m_allocationChannel)
147 {
148  NS_LOG_FUNCTION(this);
149 
150  m_carrierCount = m_bandwidthHz / m_btuConf->GetAllocatedBandwidthInHz();
151 
152  if (m_carrierCount == 0)
153  {
154  NS_FATAL_ERROR("No carriers can be created for the frame with given BTU and bandwidth. "
155  "Check frame configuration parameters (attributes)!!! ");
156  }
157  else
158  {
159  NS_LOG_INFO("Carriers count " << m_carrierCount);
160  }
161 
162  uint32_t defWaveFormId = m_waveformConf->GetDefaultWaveformId();
163  Ptr<SatWaveform> defWaveform = m_waveformConf->GetWaveform(defWaveFormId);
164 
165  // calculate slot details based on given parameters and default waveform
166  Time timeSlotDuration = defWaveform->GetBurstDuration(m_btuConf->GetSymbolRateInBauds());
167  uint32_t carrierSlotCount =
168  parameters.m_targetDuration.GetSeconds() / timeSlotDuration.GetSeconds();
170 
171  if (carrierSlotCount == 0)
172  {
173  NS_FATAL_ERROR("Time slots cannot be created with target frame duration. Check frame "
174  "target duration!!!");
175  }
176  else
177  {
178  NS_LOG_INFO("Carrier slot count " << carrierSlotCount);
179  }
180 
181  m_duration = Time(carrierSlotCount * timeSlotDuration.GetInteger());
182 
183  m_maxSymbolsPerCarrier = carrierSlotCount * defWaveform->GetBurstLengthInSymbols();
184 
185  if (parameters.m_defaultWaveformInUse || (m_waveformConf->IsAcmEnabled() == false))
186  {
187  m_minPayloadPerCarrierInBytes = carrierSlotCount * defWaveform->GetPayloadInBytes();
188  }
189  else
190  {
191  uint32_t mostRobustWaveFormId;
192 
193  if (!m_waveformConf->GetMostRobustWaveformId(mostRobustWaveFormId,
194  defWaveform->GetBurstLengthInSymbols()))
195  {
196  NS_FATAL_ERROR("Most robust waveform not found, error in waveform configuration ???");
197  }
198 
199  Ptr<SatWaveform> waveform = m_waveformConf->GetWaveform(mostRobustWaveFormId);
200  m_minPayloadPerCarrierInBytes = carrierSlotCount * waveform->GetPayloadInBytes();
201  }
202 
203  uint32_t frameTimeSlotCount = 0;
204 
205  // Created time slots for every carrier and add them to frame configuration
206  for (uint32_t i = 0; i < m_carrierCount; i++)
207  {
208  for (uint32_t j = 0; j < carrierSlotCount; j++)
209  {
210  Time guardTime = Seconds((m_guardTimeSymbols / 2) / m_btuConf->GetSymbolRateInBauds());
211  Ptr<SatTimeSlotConf> timeSlot =
212  Create<SatTimeSlotConf>(Time(j * timeSlotDuration.GetInteger()) + guardTime,
213  defWaveFormId,
214  i,
216  AddTimeSlotConf(timeSlot);
217 
218  frameTimeSlotCount++;
219 
220  if (parameters.m_checkSlotLimit && (frameTimeSlotCount > m_maxTimeSlotCount))
221  {
222  NS_FATAL_ERROR("Time slot count is over limit. Check frame configuration!!!");
223  }
224  }
225  }
226 }
227 
229 {
230  NS_LOG_FUNCTION(this);
231 }
232 
233 double
234 SatFrameConf::GetCarrierFrequencyHz(uint16_t carrierId) const
235 {
236  NS_LOG_FUNCTION(this << carrierId);
237 
238  if (carrierId >= m_carrierCount)
239  {
240  NS_FATAL_ERROR("Carrier Id out of range");
241  }
242 
243  double carrierBandwidthHz = m_btuConf->GetAllocatedBandwidthInHz();
244 
245  return ((carrierBandwidthHz * carrierId) + (carrierBandwidthHz / 2.0));
246 }
247 
248 double
250 {
251  NS_LOG_FUNCTION(this << bandwidthType);
252 
253  double bandwidth = 0.0;
254 
255  switch (bandwidthType)
256  {
258  bandwidth = m_btuConf->GetAllocatedBandwidthInHz();
259  break;
260 
262  bandwidth = m_btuConf->GetOccupiedBandwidthInHz();
263  break;
264 
266  bandwidth = m_btuConf->GetEffectiveBandwidthInHz();
267  break;
268 
269  default:
270  NS_FATAL_ERROR("Invalid bandwidth type!!!");
271  break;
272  }
273 
274  return bandwidth;
275 }
276 
277 uint8_t
279 {
280  NS_LOG_FUNCTION(this);
281 
282  uint8_t subdivisionLevel = 0;
283  Ptr<SatFrameConf> parent = m_parent;
284 
285  while (parent != nullptr)
286  {
287  ++subdivisionLevel;
288  parent = parent->m_parent;
289  }
290 
291  NS_LOG_INFO("Subdivision level is " << (uint32_t)subdivisionLevel);
292  return subdivisionLevel;
293 }
294 
295 uint16_t
297 {
298  NS_LOG_FUNCTION(this);
299 
300  uint16_t slotCount = 0;
301 
302  if (m_timeSlotConfMap.empty() == false)
303  {
304  slotCount = m_timeSlotConfMap.size() * m_timeSlotConfMap.begin()->second.size();
305  }
306 
307  return slotCount;
308 }
309 
310 Ptr<SatTimeSlotConf>
311 SatFrameConf::GetTimeSlotConf(uint16_t carrierId, uint16_t index) const
312 {
313  NS_LOG_FUNCTION(this);
314 
315  Ptr<SatTimeSlotConf> foundTimeSlot = NULL;
316 
317  SatTimeSlotConfMap_t::const_iterator foundCarrier = m_timeSlotConfMap.find(carrierId);
318 
319  if (foundCarrier != m_timeSlotConfMap.end() && index < foundCarrier->second.size())
320  {
321  foundTimeSlot = foundCarrier->second[index];
322  }
323  else
324  {
325  NS_FATAL_ERROR("Index is invalid!!!");
326  }
327 
328  return foundTimeSlot;
329 }
330 
331 Ptr<SatTimeSlotConf>
332 SatFrameConf::GetTimeSlotConf(uint16_t index) const
333 {
334  NS_LOG_FUNCTION(this);
335 
336  Ptr<SatTimeSlotConf> foundTimeSlot = NULL;
337  uint32_t carrierId = index / m_timeSlotConfMap.begin()->second.size();
338  uint16_t timeSlotIndex = index % m_timeSlotConfMap.begin()->second.size();
339 
340  foundTimeSlot = GetTimeSlotConf(carrierId, timeSlotIndex);
341 
342  return foundTimeSlot;
343 }
344 
346 SatFrameConf::GetTimeSlotConfs(uint16_t carrierId) const
347 {
348  NS_LOG_FUNCTION(this);
349 
350  SatTimeSlotConfContainer_t timeSlots;
351 
352  SatTimeSlotConfMap_t::const_iterator it = m_timeSlotConfMap.find(carrierId);
353 
354  if (it != m_timeSlotConfMap.end())
355  {
356  timeSlots = it->second;
357  }
358  else
359  {
360  NS_FATAL_ERROR("Carrier not found!!!");
361  }
362 
363  return timeSlots;
364 }
365 
366 uint16_t
367 SatFrameConf::AddTimeSlotConf(Ptr<SatTimeSlotConf> conf)
368 {
369  NS_LOG_FUNCTION(this << conf);
370 
371  // find container for the Carrier from map
372  SatTimeSlotConfMap_t::iterator it = m_timeSlotConfMap.find(conf->GetCarrierId());
373 
374  // If not found, add new Carrier container to map,
375  // otherwise use container found from map
376  if (it == m_timeSlotConfMap.end())
377  {
378  std::pair<SatTimeSlotConfMap_t::iterator, bool> result = m_timeSlotConfMap.insert(
379  std::make_pair(conf->GetCarrierId(), SatTimeSlotConfContainer_t()));
380 
381  if (result.second)
382  {
383  it = result.first;
384  }
385  else
386  {
387  it = m_timeSlotConfMap.end();
388  }
389  }
390 
391  // container creation for carrier has failed, so we need to crash
392  if (it == m_timeSlotConfMap.end())
393  {
394  NS_FATAL_ERROR("Cannot insert slot to container!!!");
395  }
396 
397  // store time slot info to carrier specific container
398  it->second.push_back(conf);
399 
400  return 0;
401 }
402 
403 NS_OBJECT_ENSURE_REGISTERED(SatSuperframeConf);
404 
405 // Super frame configuration interface.
406 
407 Ptr<SatSuperframeConf>
409 {
410  NS_LOG_FUNCTION_NOARGS();
411 
412  Ptr<SatSuperframeConf> superFrameConf;
413 
414  switch (conf)
415  {
417  superFrameConf = CreateObject<SatSuperframeConf0>();
418  break;
419 
421  superFrameConf = CreateObject<SatSuperframeConf1>();
422  break;
423 
425  superFrameConf = CreateObject<SatSuperframeConf2>();
426  break;
427 
429  superFrameConf = CreateObject<SatSuperframeConf3>();
430  break;
431 
433  superFrameConf = CreateObject<SatSuperframeConf4>();
434  break;
435 
436  default:
437  NS_FATAL_ERROR("Not supported super frame configuration!!!");
438  break;
439  }
440 
441  return superFrameConf;
442 }
443 
445  : m_usedBandwidthHz(0.0),
446  m_duration(0.0),
447  m_frameCount(0),
448  m_configType(CONFIG_TYPE_0),
449  m_carrierCount(0),
450  m_logonEnabled(false),
451  m_logonChannelIndex(0)
452 {
453  NS_LOG_FUNCTION(this);
454 }
455 
457 {
458  NS_LOG_FUNCTION(this);
459 }
460 
461 TypeId
463 {
464  static TypeId tid = TypeId("ns3::SatSuperframeConf").SetParent<Object>();
465 
466  return tid;
467 }
468 
469 TypeId
471 {
472  NS_LOG_FUNCTION(this);
473  return GetTypeId();
474 }
475 
476 void
478  double bandwidthInHz,
479  double rollOff,
480  double spacing,
481  uint32_t spreadingFactor,
482  uint8_t subdivisionLevel)
483 {
484  NS_LOG_FUNCTION(this << &frameConfParameters << bandwidthInHz << rollOff << spacing
485  << (uint32_t)subdivisionLevel);
486  uint32_t frameId = m_frames.size();
487 
488  // in case of random access frame, store carriers to RA channel container
489  if (frameConfParameters.m_isRandomAccess)
490  {
491  // Create BTU conf according to given attributes
492  frameConfParameters.m_btuConf =
493  Create<SatBtuConf>(bandwidthInHz, rollOff, spacing, spreadingFactor);
494  Ptr<SatFrameConf> frameConf = Create<SatFrameConf>(frameConfParameters);
495 
496  uint16_t raBaseIndex = m_raChannels.size();
497  uint16_t carriersCount = frameConf->GetCarrierCount();
498 
499  if (frameConf->IsLogon() && carriersCount > 1)
500  {
501  NS_FATAL_ERROR("Logon frame can have only one carrier, this one have " << carriersCount
502  << " carriers.");
503  }
504 
505  if (frameConf->IsLogon() && m_logonEnabled)
506  {
507  NS_FATAL_ERROR("Logon frame cannot be set several times.");
508  }
509 
510  if (frameConf->IsLogon())
511  {
513  m_logonEnabled = true;
514  }
515 
516  for (uint32_t i = 0; i < carriersCount; i++)
517  {
518  // Only number of the RA channels definable by uint8_t data type can used
519  // This is needed to take into account when configuring frames and defined which of them
520  // are random access channels
521  if ((raBaseIndex + i) >= std::numeric_limits<uint8_t>::max())
522  {
523  NS_FATAL_ERROR("RA channels maximum count is exceeded!!!");
524  }
525 
526  m_raChannels.push_back(
527  std::make_tuple(frameId, i, frameConf->GetAllocationChannelId()));
528  }
529 
530  m_frames.push_back(frameConf);
531  m_carrierCount += carriersCount;
532  }
533  else
534  {
535  for (uint8_t i = 0; i <= subdivisionLevel; ++i)
536  {
537  double subdivisionAmount = std::pow(2.0, static_cast<double>(i));
538 
539  // Create BTU conf according to given attributes
540  frameConfParameters.m_btuConf = Create<SatBtuConf>(bandwidthInHz / subdivisionAmount,
541  rollOff,
542  spacing,
543  spreadingFactor);
544  Ptr<SatFrameConf> frameConf = Create<SatFrameConf>(frameConfParameters);
545 
546  if (frameConf->IsLogon())
547  {
548  NS_FATAL_ERROR("Logon frame must use Random Access.");
549  }
550 
551  m_frames.push_back(frameConf);
552  m_carrierCount += frameConf->GetCarrierCount();
553 
554  // Update parent for the next subdivided frame conf
555  frameConfParameters.m_parent = frameConf;
556  }
557  }
558 }
559 
560 Ptr<SatFrameConf>
562 {
563  NS_LOG_FUNCTION(this << (uint32_t)index);
564 
565  return m_frames[index];
566 }
567 
568 uint32_t
570 {
571  NS_LOG_FUNCTION(this);
572 
573  return m_carrierCount;
574 }
575 
576 uint32_t
577 SatSuperframeConf::GetCarrierId(uint8_t frameId, uint16_t frameCarrierId) const
578 {
579  NS_LOG_FUNCTION(this);
580 
581  if (frameId > m_frames.size())
582  {
583  NS_FATAL_ERROR("Frame ID out of range.");
584  }
585 
586  uint32_t carrierId = frameCarrierId;
587 
588  for (uint8_t i = 0; i < frameId; i++)
589  {
590  carrierId += m_frames[i]->GetCarrierCount();
591  }
592 
593  return carrierId;
594 }
595 
596 double
598 {
599  NS_LOG_FUNCTION(this);
600 
601  double frameStartFrequency = 0.0;
602  uint32_t carrierIdInFrame = carrierId;
603 
604  uint8_t frameId = GetCarrierFrame(carrierId);
605 
606  for (uint8_t i = 0; i < frameId; ++i)
607  {
608  carrierIdInFrame -= m_frames[i]->GetCarrierCount();
609  frameStartFrequency += m_frames[i]->GetBandwidthHz();
610  }
611 
612  double carrierFrequencyInFrame = m_frames[frameId]->GetCarrierFrequencyHz(carrierIdInFrame);
613 
614  return frameStartFrequency + carrierFrequencyInFrame;
615 }
616 
617 double
619  SatEnums::CarrierBandwidthType_t bandwidthType) const
620 {
621  NS_LOG_FUNCTION(this);
622 
623  uint8_t frameId = GetCarrierFrame(carrierId);
624 
625  return m_frames[frameId]->GetCarrierBandwidthHz(bandwidthType);
626 }
627 
628 Ptr<SatFrameConf>
629 SatSuperframeConf::GetCarrierFrameConf(uint32_t carrierId) const
630 {
631  NS_LOG_FUNCTION(this << carrierId);
632 
633  uint8_t frameId = GetCarrierFrame(carrierId);
634 
635  return m_frames[frameId];
636 }
637 
638 bool
640 {
641  NS_LOG_FUNCTION(this);
642 
643  uint8_t frameId = GetCarrierFrame(carrierId);
644 
645  return m_frames[frameId]->IsRandomAccess();
646 }
647 
648 void
649 SatSuperframeConf::SetFrameAllocatedBandwidthHz(uint8_t frameIndex, double bandwidthHz)
650 {
651  NS_LOG_FUNCTION(this << (uint32_t)frameIndex << bandwidthHz);
652 
653  if (frameIndex >= m_maxFrameCount)
654  {
655  NS_FATAL_ERROR("Frame index out of range!!!");
656  }
657 
658  m_frameAllocatedBandwidth[frameIndex] = bandwidthHz;
659 }
660 
661 void
662 SatSuperframeConf::SetFrameCarrierAllocatedBandwidthHz(uint8_t frameIndex, double bandwidthHz)
663 {
664  NS_LOG_FUNCTION(this << (uint32_t)frameIndex << bandwidthHz);
665 
666  if (frameIndex >= m_maxFrameCount)
667  {
668  NS_FATAL_ERROR("Frame index out of range!!!");
669  }
670 
671  m_frameCarrierAllocatedBandwidth[frameIndex] = bandwidthHz;
672 }
673 
674 void
675 SatSuperframeConf::SetFrameCarrierSpacing(uint8_t frameIndex, double spacing)
676 {
677  NS_LOG_FUNCTION(this << (uint32_t)frameIndex << spacing);
678 
679  if (frameIndex >= m_maxFrameCount)
680  {
681  NS_FATAL_ERROR("Frame index out of range!!!");
682  }
683 
684  m_frameCarrierSpacing[frameIndex] = spacing;
685 }
686 
687 void
688 SatSuperframeConf::SetFrameCarrierRollOff(uint8_t frameIndex, double rollOff)
689 {
690  NS_LOG_FUNCTION(this << (uint32_t)frameIndex << rollOff);
691 
692  if (frameIndex >= m_maxFrameCount)
693  {
694  NS_FATAL_ERROR("Frame index out of range!!!");
695  }
696 
697  m_frameCarrierRollOff[frameIndex] = rollOff;
698 }
699 
700 void
701 SatSuperframeConf::SetFrameCarrierSpreadingFactor(uint8_t frameIndex, uint32_t spreadingFactor)
702 {
703  NS_LOG_FUNCTION(this << frameIndex << spreadingFactor);
704 
705  if (frameIndex >= m_maxFrameCount)
706  {
707  NS_FATAL_ERROR("Frame index out of range!!!");
708  }
709 
710  m_frameCarrierSpreadingFactor[frameIndex] = spreadingFactor;
711 }
712 
713 void
714 SatSuperframeConf::SetFrameRandomAccess(uint8_t frameIndex, bool randomAccess)
715 {
716  NS_LOG_FUNCTION(this << (uint32_t)frameIndex << randomAccess);
717 
718  if (frameIndex >= m_maxFrameCount)
719  {
720  NS_FATAL_ERROR("Frame index out of range!!!");
721  }
722 
723  m_frameIsRandomAccess[frameIndex] = randomAccess;
724 }
725 
726 void
727 SatSuperframeConf::SetFrameLogon(uint8_t frameIndex, bool logon)
728 {
729  NS_LOG_FUNCTION(this << (uint32_t)frameIndex << logon);
730 
731  if (frameIndex >= m_maxFrameCount)
732  {
733  NS_FATAL_ERROR("Frame index out of range!!!");
734  }
735 
736  m_frameIsLogon[frameIndex] = logon;
737 }
738 
739 void
740 SatSuperframeConf::SetFrameAllocationChannelId(uint8_t frameIndex, uint8_t allocationChannel)
741 {
742  NS_LOG_FUNCTION(this << (uint32_t)frameIndex << (uint32_t)allocationChannel);
743 
744  if (frameIndex >= m_maxFrameCount)
745  {
746  NS_FATAL_ERROR("Frame index out of range!!!");
747  }
748 
749  m_frameAllocationChannel[frameIndex] = allocationChannel;
750 }
751 
752 void
753 SatSuperframeConf::SetFrameGuardTimeSymbols(uint8_t frameIndex, uint8_t guardTimeSymbols)
754 {
755  NS_LOG_FUNCTION(this << (uint32_t)frameIndex << guardTimeSymbols);
756 
757  if (frameIndex >= m_maxFrameCount)
758  {
759  NS_FATAL_ERROR("Frame index out of range!!!");
760  }
761 
762  m_frameGuardTimeSymbols[frameIndex] = guardTimeSymbols;
763 }
764 
765 double
767 {
768  NS_LOG_FUNCTION(this << (uint32_t)frameIndex);
769 
770  if (frameIndex >= m_maxFrameCount)
771  {
772  NS_FATAL_ERROR("Frame index out of range!!!");
773  }
774 
775  return m_frameAllocatedBandwidth[frameIndex];
776 }
777 
778 double
780 {
781  NS_LOG_FUNCTION(this << (uint32_t)frameIndex);
782 
783  if (frameIndex >= m_maxFrameCount)
784  {
785  NS_FATAL_ERROR("Frame index out of range!!!");
786  }
787 
788  return m_frameCarrierAllocatedBandwidth[frameIndex];
789 }
790 
791 double
793 {
794  NS_LOG_FUNCTION(this << (uint32_t)frameIndex);
795 
796  if (frameIndex >= m_maxFrameCount)
797  {
798  NS_FATAL_ERROR("Frame index out of range!!!");
799  }
800 
801  return m_frameCarrierSpacing[frameIndex];
802 }
803 
804 double
806 {
807  NS_LOG_FUNCTION(this << (uint32_t)frameIndex);
808 
809  if (frameIndex >= m_maxFrameCount)
810  {
811  NS_FATAL_ERROR("Frame index out of range!!!");
812  }
813 
814  return m_frameCarrierRollOff[frameIndex];
815 }
816 
817 uint32_t
819 {
820  NS_LOG_FUNCTION(this << frameIndex);
821 
822  if (frameIndex >= m_maxFrameCount)
823  {
824  NS_FATAL_ERROR("Frame index out of range!!!");
825  }
826 
827  return m_frameCarrierSpreadingFactor[frameIndex];
828 }
829 
830 bool
831 SatSuperframeConf::IsFrameRandomAccess(uint8_t frameIndex) const
832 {
833  NS_LOG_FUNCTION(this << (uint32_t)frameIndex);
834 
835  if (frameIndex >= m_frames.size())
836  {
837  NS_FATAL_ERROR("Frame index out of range!!!");
838  }
839 
840  return m_frames[frameIndex]->IsRandomAccess();
841 }
842 
843 bool
844 SatSuperframeConf::IsFrameLogon(uint8_t frameIndex) const
845 {
846  NS_LOG_FUNCTION(this << (uint32_t)frameIndex);
847 
848  if (frameIndex >= m_frames.size())
849  {
850  NS_FATAL_ERROR("Frame index out of range!!!");
851  }
852 
853  return m_frames[frameIndex]->IsLogon();
854 }
855 
856 uint8_t
858 {
859  NS_LOG_FUNCTION(this << (uint32_t)frameIndex);
860 
861  if (frameIndex >= m_maxFrameCount)
862  {
863  NS_FATAL_ERROR("Frame index out of range!!!");
864  }
865 
866  return m_frameAllocationChannel[frameIndex];
867 }
868 
869 uint8_t
871 {
872  NS_LOG_FUNCTION(this << (uint32_t)frameIndex);
873 
874  if (frameIndex >= m_maxFrameCount)
875  {
876  NS_FATAL_ERROR("Frame index out of range!!!");
877  }
878 
879  return m_frameGuardTimeSymbols[frameIndex];
880 }
881 
882 bool
884 {
885  NS_LOG_FUNCTION(this);
886 
887  return m_logonEnabled;
888 }
889 
890 uint32_t
892 {
893  NS_LOG_FUNCTION(this);
894 
895  return m_logonChannelIndex;
896 }
897 
898 void
899 SatSuperframeConf::Configure(double allocatedBandwidthHz,
900  Time targetDuration,
901  Ptr<SatWaveformConf> waveformConf)
902 {
903  NS_LOG_FUNCTION(this);
904 
905  if (m_configType == CONFIG_TYPE_0 && waveformConf->IsAcmEnabled() == true)
906  {
907  NS_LOG_WARN("Superframe is configured to use config type 0, thus ACM should be disabled!");
908  }
909 
910  if (m_configType == CONFIG_TYPE_1 && waveformConf->IsAcmEnabled() == false)
911  {
912  NS_FATAL_ERROR(
913  "Superframe is configured to use config type 1, thus ACM should be enabled!");
914  }
915 
916  DoConfigure();
917 
918  bool useDefaultWaveform = false;
919  bool checkSlotLimit = true;
920  uint8_t subdivisionLevels = 0;
921 
927  m_duration = targetDuration;
928 
929  // make actual configuration
930 
931  switch (m_configType)
932  {
933  case CONFIG_TYPE_0:
934  useDefaultWaveform = true;
935  break;
936  case CONFIG_TYPE_1:
937  break;
938  case CONFIG_TYPE_2:
939  checkSlotLimit = false;
940  break;
941  case CONFIG_TYPE_3:
942  checkSlotLimit = false;
943  subdivisionLevels = m_maxCarrierSubdivision;
944  break;
945  case CONFIG_TYPE_4:
946  useDefaultWaveform = true;
947  checkSlotLimit = false;
948  break;
949  default:
950  NS_FATAL_ERROR("Not supported configuration type " << m_configType << "!!!");
951  break;
952  }
953 
954  m_raChannels.clear();
955  m_frames.clear();
956  m_carrierCount = 0;
957 
958  for (uint8_t frameIndex = 0; frameIndex < m_frameCount; frameIndex++)
959  {
960  // Create frame without allocating a BTU yet
961  SatFrameConf::SatFrameConfParams_t frameConfParameters;
962  frameConfParameters.m_bandwidthHz = m_frameAllocatedBandwidth[frameIndex];
963  frameConfParameters.m_targetDuration = targetDuration;
964  frameConfParameters.m_parent = nullptr;
965  frameConfParameters.m_btuConf = nullptr;
966  frameConfParameters.m_waveformConf = waveformConf;
967  frameConfParameters.m_allocationChannel = m_frameAllocationChannel[frameIndex];
968  frameConfParameters.m_isRandomAccess = m_frameIsRandomAccess[frameIndex];
969  frameConfParameters.m_isLogon = m_frameIsLogon[frameIndex];
970  frameConfParameters.m_defaultWaveformInUse = useDefaultWaveform;
971  frameConfParameters.m_checkSlotLimit = checkSlotLimit;
972  frameConfParameters.m_guardTimeSymbols = m_frameGuardTimeSymbols[frameIndex];
973 
975 
976  // Add created frame to super frame configuration, creating
977  // the BTU and the carrier subdivision in the process if need bee
978  AddFrameConf(frameConfParameters,
980  m_frameCarrierRollOff[frameIndex],
981  m_frameCarrierSpacing[frameIndex],
982  m_frameCarrierSpreadingFactor[frameIndex],
983  subdivisionLevels);
984  }
985 
986  if (m_frames.size() != m_frameCount)
987  {
988  NS_ASSERT_MSG(m_configType == CONFIG_TYPE_3,
989  "SatSuperframeConf::Configure: Error: configured more frames than requested");
990  m_frameCount = m_frames.size();
991  }
992 
993  // check if configured frames exceeds given band
994  if (m_usedBandwidthHz > allocatedBandwidthHz)
995  {
996  NS_FATAL_ERROR("Bandwidth of super frame exceeds allocated bandwidth");
997  }
998 }
999 
1002 {
1003  NS_LOG_FUNCTION(this);
1004 
1006 
1007  if (raChannel < m_raChannels.size())
1008  {
1009  uint8_t frameId;
1010  uint32_t carrierId;
1011  std::tie(frameId, carrierId, std::ignore) = m_raChannels[raChannel];
1012 
1013  timeSlots = m_frames[frameId]->GetTimeSlotConfs(carrierId);
1014  }
1015  else
1016  {
1017  NS_FATAL_ERROR("Channel out of range!!!");
1018  }
1019 
1020  return timeSlots;
1021 }
1022 
1023 uint16_t
1025 {
1026  NS_LOG_FUNCTION(this);
1027 
1028  uint16_t slotCount = 0;
1029 
1030  if (raChannel < m_raChannels.size())
1031  {
1032  uint8_t frameId;
1033  uint32_t carrierId;
1034  std::tie(frameId, carrierId, std::ignore) = m_raChannels[raChannel];
1035 
1036  slotCount = m_frames[frameId]->GetTimeSlotConfs(carrierId).size();
1037  }
1038  else
1039  {
1040  NS_FATAL_ERROR("Channel out of range!!!");
1041  }
1042 
1043  return slotCount;
1044 }
1045 
1046 uint8_t
1048 {
1049  NS_LOG_FUNCTION(this);
1050  return m_raChannels.size();
1051 }
1052 
1053 uint8_t
1055 {
1056  NS_LOG_FUNCTION(this);
1057 
1058  uint8_t frameId = 0;
1059 
1060  if (raChannel < m_raChannels.size())
1061  {
1062  frameId = std::get<0>(m_raChannels[raChannel]);
1063  }
1064  else
1065  {
1066  NS_FATAL_ERROR("Channel out of range!!!");
1067  }
1068 
1069  return frameId;
1070 }
1071 
1072 uint8_t
1074 {
1075  NS_LOG_FUNCTION(this);
1076 
1077  uint8_t allocationChannel = 0;
1078 
1079  if (raChannel < m_raChannels.size())
1080  {
1081  allocationChannel = std::get<2>(m_raChannels[raChannel]);
1082  }
1083  else
1084  {
1085  NS_FATAL_ERROR("Channel out of range!!!");
1086  }
1087 
1088  return allocationChannel;
1089 }
1090 
1091 uint32_t
1093 {
1094  NS_LOG_FUNCTION(this);
1095 
1096  uint32_t payloadInBytes = 0;
1097 
1098  if (raChannel < m_raChannels.size())
1099  {
1100  uint8_t frameId = std::get<0>(m_raChannels[raChannel]);
1101  Ptr<SatTimeSlotConf> timeSlotConf = (*m_frames[frameId]->GetTimeSlotConfs(0).begin());
1102  Ptr<SatWaveform> waveform =
1103  m_frames[frameId]->GetWaveformConf()->GetWaveform(timeSlotConf->GetWaveFormId());
1104 
1105  payloadInBytes = waveform->GetPayloadInBytes();
1106  }
1107  else
1108  {
1109  NS_FATAL_ERROR("Channel " << raChannel << " out of range!!!");
1110  }
1111 
1112  return payloadInBytes;
1113 }
1114 
1115 std::string
1117 {
1118  std::string name = "Frame";
1119  return name + GetNumberAsString(index);
1120 }
1121 
1122 // macro to call base class converter function with shorter name in macro ADD_FRAME_ATTRIBUTES
1123 #define GetIndexAsFrameName(index) SatSuperframeConf::GetIndexAsFrameName(index)
1124 
1125 // macro to ease definition of attributes for several frames
1126 #define ADD_FRAME_ATTRIBUTES(index, \
1127  frameBandwidth, \
1128  carrierBandwidth, \
1129  carrierSpacing, \
1130  carrierRollOff, \
1131  spreadingFactor, \
1132  randomAccess, \
1133  lowerLayerService, \
1134  logon, \
1135  guardTime) \
1136  .AddAttribute(GetIndexAsFrameName(index) + "_AllocatedBandwidthHz", \
1137  std::string("The allocated bandwidth [Hz] for ") + GetIndexAsFrameName(index), \
1138  TypeId::ATTR_CONSTRUCT, \
1139  DoubleValue(frameBandwidth), \
1140  MakeDoubleAccessor(&SatSuperframeConf::SetFrame##index##AllocatedBandwidthHz, \
1141  &SatSuperframeConf::GetFrame##index##AllocatedBandwidthHz), \
1142  MakeDoubleChecker<double>()) \
1143  .AddAttribute( \
1144  GetIndexAsFrameName(index) + std::string("_CarrierAllocatedBandwidthHz"), \
1145  std::string("The allocated carrier bandwidth [Hz] for ") + GetIndexAsFrameName(index), \
1146  TypeId::ATTR_CONSTRUCT, \
1147  DoubleValue(carrierBandwidth), \
1148  MakeDoubleAccessor(&SatSuperframeConf::SetFrame##index##CarrierAllocatedBandwidthHz, \
1149  &SatSuperframeConf::GetFrame##index##CarrierAllocatedBandwidthHz), \
1150  MakeDoubleChecker<double>()) \
1151  .AddAttribute(GetIndexAsFrameName(index) + std::string("_CarrierRollOff"), \
1152  std::string("The roll-off factor for ") + GetIndexAsFrameName(index), \
1153  TypeId::ATTR_CONSTRUCT, \
1154  DoubleValue(carrierSpacing), \
1155  MakeDoubleAccessor(&SatSuperframeConf::SetFrame##index##CarrierRollOff, \
1156  &SatSuperframeConf::GetFrame##index##CarrierRollOff), \
1157  MakeDoubleChecker<double>(0.00, 1.00)) \
1158  .AddAttribute(GetIndexAsFrameName(index) + std::string("_CarrierSpacing"), \
1159  std::string("The carrier spacing factor for ") + GetIndexAsFrameName(index), \
1160  TypeId::ATTR_CONSTRUCT, \
1161  DoubleValue(carrierRollOff), \
1162  MakeDoubleAccessor(&SatSuperframeConf::SetFrame##index##CarrierSpacing, \
1163  &SatSuperframeConf::GetFrame##index##CarrierSpacing), \
1164  MakeDoubleChecker<double>(0.00, 1.00)) \
1165  .AddAttribute(GetIndexAsFrameName(index) + std::string("_SpreadingFactor"), \
1166  std::string("The carrier spreading factor for ") + \
1167  GetIndexAsFrameName(index), \
1168  TypeId::ATTR_CONSTRUCT, \
1169  UintegerValue(spreadingFactor), \
1170  MakeUintegerAccessor(&SatSuperframeConf::SetFrame##index##SpreadingFactor, \
1171  &SatSuperframeConf::GetFrame##index##SpreadingFactor), \
1172  MakeUintegerChecker<uint32_t>(1, std::numeric_limits<uint32_t>::max())) \
1173  .AddAttribute(GetIndexAsFrameName(index) + std::string("_RandomAccessFrame"), \
1174  std::string("Flag to tell if ") + GetIndexAsFrameName(index) + \
1175  std::string(" is used for random access"), \
1176  TypeId::ATTR_CONSTRUCT, \
1177  BooleanValue(randomAccess), \
1178  MakeBooleanAccessor(&SatSuperframeConf::SetFrame##index##RandomAccess, \
1179  &SatSuperframeConf::IsFrame##index##RandomAccess), \
1180  MakeBooleanChecker()) \
1181  .AddAttribute( \
1182  GetIndexAsFrameName(index) + std::string("_LowerLayerService"), \
1183  std::string("Lower layer service to use for ") + GetIndexAsFrameName(index), \
1184  TypeId::ATTR_CONSTRUCT, \
1185  UintegerValue(lowerLayerService), \
1186  MakeUintegerAccessor(&SatSuperframeConf::SetFrame##index##AllocationChannelId, \
1187  &SatSuperframeConf::GetFrame##index##AllocationChannelId), \
1188  MakeUintegerChecker<uint8_t>()) \
1189  .AddAttribute(GetIndexAsFrameName(index) + std::string("_LogonFrame"), \
1190  std::string("Flag to tell if ") + GetIndexAsFrameName(index) + \
1191  std::string(" is used for logon"), \
1192  TypeId::ATTR_CONSTRUCT, \
1193  BooleanValue(logon), \
1194  MakeBooleanAccessor(&SatSuperframeConf::SetFrame##index##Logon, \
1195  &SatSuperframeConf::IsFrame##index##Logon), \
1196  MakeBooleanChecker()) \
1197  .AddAttribute(GetIndexAsFrameName(index) + std::string("_GuardTimeSymbols"), \
1198  std::string("Set the guard time of ") + GetIndexAsFrameName(index) + \
1199  std::string(" in symbols"), \
1200  TypeId::ATTR_CONSTRUCT, \
1201  UintegerValue(guardTime), \
1202  MakeUintegerAccessor(&SatSuperframeConf::SetFrame##index##GuardTimeSymbols, \
1203  &SatSuperframeConf::GetFrame##index##GuardTimeSymbols), \
1204  MakeUintegerChecker<uint8_t>())
1205 
1206 // macro to ease definition of attributes for several super frames
1207 #define ADD_SUPER_FRAME_ATTRIBUTES(frameCount, configType, maxSubdivision) \
1208  .AddAttribute("FrameCount", \
1209  "The number of frames in super frame.", \
1210  TypeId::ATTR_CONSTRUCT, \
1211  UintegerValue(frameCount), \
1212  MakeUintegerAccessor(&SatSuperframeConf::SetFrameCount, \
1213  &SatSuperframeConf::GetFrameCount), \
1214  MakeUintegerChecker<uint32_t>(1, SatSuperframeConf::m_maxFrameCount)) \
1215  .AddAttribute("FrameConfigType", \
1216  "The frame configuration type used for super frame.", \
1217  TypeId::ATTR_CONSTRUCT, \
1218  EnumValue(configType), \
1219  MakeEnumAccessor(&SatSuperframeConf::SetConfigType, \
1220  &SatSuperframeConf::GetConfigType), \
1221  MakeEnumChecker(SatSuperframeConf::CONFIG_TYPE_0, \
1222  "ConfigType_0", \
1223  SatSuperframeConf::CONFIG_TYPE_1, \
1224  "ConfigType_1", \
1225  SatSuperframeConf::CONFIG_TYPE_2, \
1226  "ConfigType_2", \
1227  SatSuperframeConf::CONFIG_TYPE_3, \
1228  "ConfigType_3", \
1229  SatSuperframeConf::CONFIG_TYPE_4, \
1230  "ConfigType_4")) \
1231  .AddAttribute( \
1232  "MaxCarrierSubdivision", \
1233  "The maximum amount of subdivision for a single carrier (ConfigType_3 only).", \
1234  TypeId::ATTR_CONSTRUCT, \
1235  UintegerValue(maxSubdivision), \
1236  MakeUintegerAccessor(&SatSuperframeConf::SetMaxSubdivision, \
1237  &SatSuperframeConf::GetMaxSubdivision), \
1238  MakeUintegerChecker<uint8_t>(0))
1239 
1240 uint8_t
1241 SatSuperframeConf::GetCarrierFrame(uint32_t carrierId) const
1242 {
1243  NS_LOG_FUNCTION(this);
1244 
1245  uint32_t currentFrame = 0;
1246  uint32_t lastIdInFrame = m_frames[0]->GetCarrierCount() - 1;
1247 
1248  while (carrierId > lastIdInFrame)
1249  {
1250  ++currentFrame;
1251  lastIdInFrame += m_frames[currentFrame]->GetCarrierCount();
1252  }
1253 
1254  return currentFrame;
1255 }
1256 
1257 uint8_t
1258 SatSuperframeConf::GetRaChannel(uint32_t carrierId) const
1259 {
1260  NS_LOG_FUNCTION(this);
1261 
1262  uint8_t raChannelId = 0;
1263  uint8_t frameId = GetCarrierFrame(carrierId);
1264 
1265  if (m_frames[frameId]->IsRandomAccess())
1266  {
1267  uint32_t carrierIdInFrame = carrierId;
1268 
1269  for (uint8_t i = 0; i < frameId; i++)
1270  {
1271  carrierIdInFrame -= m_frames[i]->GetCarrierCount();
1272 
1273  // increase RA channel id (index) by count of RA carriers before asked carrier/frame
1274  if (m_frames[i]->IsRandomAccess())
1275  {
1276  raChannelId += m_frames[i]->GetCarrierCount();
1277  }
1278  }
1279 
1280  // increase RA channel id (index) by carrier id of the asked carrier/frame
1281  raChannelId += carrierIdInFrame;
1282  }
1283 
1284  return raChannelId;
1285 }
1286 
1287 NS_OBJECT_ENSURE_REGISTERED(SatSuperframeConf0);
1288 
1289 // Super frame configuration 0.
1290 
1292 {
1293  NS_LOG_FUNCTION(this);
1294 }
1295 
1297 {
1298  NS_LOG_FUNCTION(this);
1299 }
1300 
1301 TypeId
1303 {
1304  static TypeId tid =
1305  TypeId("ns3::SatSuperframeConf0")
1306  .SetParent<ns3::SatSuperframeConf>()
1307  .AddConstructor<SatSuperframeConf0>() ADD_SUPER_FRAME_ATTRIBUTES(
1308  10,
1310  5) ADD_FRAME_ATTRIBUTES(0, 1.25e7, 1.25e6, 0.20, 0.30, 1, false, 0, false, 0)
1311  ADD_FRAME_ATTRIBUTES(1, 1.25e6, 1.25e6, 0.20, 0.30, 1, true, 0, false, 0)
1312  ADD_FRAME_ATTRIBUTES(2, 1.25e7, 1.25e6, 0.20, 0.30, 1, false, 0, false, 0)
1313  ADD_FRAME_ATTRIBUTES(3, 1.25e7, 1.25e6, 0.20, 0.30, 1, false, 0, false, 0)
1315  1.25e7,
1316  1.25e6,
1317  0.20,
1318  0.30,
1319  1,
1320  false,
1321  0,
1322  false,
1323  0) ADD_FRAME_ATTRIBUTES(5,
1324  1.25e7,
1325  1.25e6,
1326  0.20,
1327  0.30,
1328  1,
1329  false,
1330  0,
1331  false,
1332  0)
1334  1.25e7,
1335  1.25e6,
1336  0.20,
1337  0.30,
1338  1,
1339  false,
1340  0,
1341  false,
1342  0) ADD_FRAME_ATTRIBUTES(7,
1343  1.25e7,
1344  1.25e6,
1345  0.20,
1346  0.30,
1347  1,
1348  false,
1349  0,
1350  false,
1351  0)
1353  1.25e7,
1354  1.25e6,
1355  0.20,
1356  0.30,
1357  1,
1358  false,
1359  0,
1360  false,
1361  0) ADD_FRAME_ATTRIBUTES(9,
1362  1.25e7,
1363  1.25e6,
1364  0.20,
1365  0.30,
1366  1,
1367  false,
1368  0,
1369  false,
1370  0);
1371 
1372  return tid;
1373 }
1374 
1375 TypeId
1377 {
1378  NS_LOG_FUNCTION(this);
1379  return GetTypeId();
1380 }
1381 
1382 void
1384 {
1385  NS_LOG_FUNCTION(this);
1386 }
1387 
1388 NS_OBJECT_ENSURE_REGISTERED(SatSuperframeConf1);
1389 
1390 // Super frame configuration 1.
1391 
1393 {
1394  NS_LOG_FUNCTION(this);
1395 }
1396 
1398 {
1399  NS_LOG_FUNCTION(this);
1400 }
1401 
1402 TypeId
1404 {
1405  static TypeId tid =
1406  TypeId("ns3::SatSuperframeConf1")
1407  .SetParent<ns3::SatSuperframeConf>()
1408  .AddConstructor<SatSuperframeConf1>() ADD_SUPER_FRAME_ATTRIBUTES(
1409  10,
1411  0) ADD_FRAME_ATTRIBUTES(0, 1.25e7, 1.25e6, 0.20, 0.30, 1, false, 0, false, 0)
1412  ADD_FRAME_ATTRIBUTES(1, 1.25e6, 1.25e6, 0.20, 0.30, 1, true, 0, false, 0)
1413  ADD_FRAME_ATTRIBUTES(2, 1.25e7, 1.25e6, 0.20, 0.30, 1, false, 0, false, 0)
1414  ADD_FRAME_ATTRIBUTES(3, 1.25e7, 1.25e6, 0.20, 0.30, 1, false, 0, false, 0)
1416  1.25e7,
1417  1.25e6,
1418  0.20,
1419  0.30,
1420  1,
1421  false,
1422  0,
1423  false,
1424  0) ADD_FRAME_ATTRIBUTES(5,
1425  1.25e7,
1426  1.25e6,
1427  0.20,
1428  0.30,
1429  1,
1430  false,
1431  0,
1432  false,
1433  0)
1435  1.25e7,
1436  1.25e6,
1437  0.20,
1438  0.30,
1439  1,
1440  false,
1441  0,
1442  false,
1443  0) ADD_FRAME_ATTRIBUTES(7,
1444  1.25e7,
1445  1.25e6,
1446  0.20,
1447  0.30,
1448  1,
1449  false,
1450  0,
1451  false,
1452  0)
1454  1.25e7,
1455  1.25e6,
1456  0.20,
1457  0.30,
1458  1,
1459  false,
1460  0,
1461  false,
1462  0) ADD_FRAME_ATTRIBUTES(9,
1463  1.25e7,
1464  1.25e6,
1465  0.20,
1466  0.30,
1467  1,
1468  false,
1469  0,
1470  false,
1471  0);
1472 
1473  return tid;
1474 }
1475 
1476 TypeId
1478 {
1479  NS_LOG_FUNCTION(this);
1480  return GetTypeId();
1481 }
1482 
1483 void
1485 {
1486  NS_LOG_FUNCTION(this);
1487 }
1488 
1489 NS_OBJECT_ENSURE_REGISTERED(SatSuperframeConf2);
1490 
1491 // Super frame configuration 2.
1492 
1494 {
1495  NS_LOG_FUNCTION(this);
1496 }
1497 
1499 {
1500  NS_LOG_FUNCTION(this);
1501 }
1502 
1503 TypeId
1505 {
1506  static TypeId tid =
1507  TypeId("ns3::SatSuperframeConf2")
1508  .SetParent<ns3::SatSuperframeConf>()
1509  .AddConstructor<SatSuperframeConf2>() ADD_SUPER_FRAME_ATTRIBUTES(
1510  10,
1512  0) ADD_FRAME_ATTRIBUTES(0, 1.25e7, 1.25e6, 0.20, 0.30, 1, false, 0, false, 0)
1513  ADD_FRAME_ATTRIBUTES(1, 1.25e6, 1.25e6, 0.20, 0.30, 1, true, 0, false, 0)
1514  ADD_FRAME_ATTRIBUTES(2, 1.25e7, 1.25e6, 0.20, 0.30, 1, false, 0, false, 0)
1515  ADD_FRAME_ATTRIBUTES(3, 1.25e7, 1.25e6, 0.20, 0.30, 1, false, 0, false, 0)
1517  1.25e7,
1518  1.25e6,
1519  0.20,
1520  0.30,
1521  1,
1522  false,
1523  0,
1524  false,
1525  0) ADD_FRAME_ATTRIBUTES(5,
1526  1.25e7,
1527  1.25e6,
1528  0.20,
1529  0.30,
1530  1,
1531  false,
1532  0,
1533  false,
1534  0)
1536  1.25e7,
1537  1.25e6,
1538  0.20,
1539  0.30,
1540  1,
1541  false,
1542  0,
1543  false,
1544  0) ADD_FRAME_ATTRIBUTES(7,
1545  1.25e7,
1546  1.25e6,
1547  0.20,
1548  0.30,
1549  1,
1550  false,
1551  0,
1552  false,
1553  0)
1555  1.25e7,
1556  1.25e6,
1557  0.20,
1558  0.30,
1559  1,
1560  false,
1561  0,
1562  false,
1563  0) ADD_FRAME_ATTRIBUTES(9,
1564  1.25e7,
1565  1.25e6,
1566  0.20,
1567  0.30,
1568  1,
1569  false,
1570  0,
1571  false,
1572  0);
1573 
1574  return tid;
1575 }
1576 
1577 TypeId
1579 {
1580  NS_LOG_FUNCTION(this);
1581  return GetTypeId();
1582 }
1583 
1584 void
1586 {
1587  NS_LOG_FUNCTION(this);
1588 }
1589 
1590 NS_OBJECT_ENSURE_REGISTERED(SatSuperframeConf3);
1591 
1592 // Super frame configuration 3.
1593 
1595 {
1596  NS_LOG_FUNCTION(this);
1597 }
1598 
1600 {
1601  NS_LOG_FUNCTION(this);
1602 }
1603 
1604 TypeId
1606 {
1607  static TypeId tid =
1608  TypeId("ns3::SatSuperframeConf3")
1609  .SetParent<ns3::SatSuperframeConf>()
1610  .AddConstructor<SatSuperframeConf3>() ADD_SUPER_FRAME_ATTRIBUTES(
1611  10,
1613  5) ADD_FRAME_ATTRIBUTES(0, 1.25e7, 1.25e6, 0.20, 0.30, 1, false, 0, false, 0)
1614  ADD_FRAME_ATTRIBUTES(1, 1.25e6, 1.25e6, 0.20, 0.30, 1, true, 0, false, 0)
1615  ADD_FRAME_ATTRIBUTES(2, 1.25e7, 1.25e6, 0.20, 0.30, 1, false, 0, false, 0)
1616  ADD_FRAME_ATTRIBUTES(3, 1.25e7, 1.25e6, 0.20, 0.30, 1, false, 0, false, 0)
1618  1.25e7,
1619  1.25e6,
1620  0.20,
1621  0.30,
1622  1,
1623  false,
1624  0,
1625  false,
1626  0) ADD_FRAME_ATTRIBUTES(5,
1627  1.25e7,
1628  1.25e6,
1629  0.20,
1630  0.30,
1631  1,
1632  false,
1633  0,
1634  false,
1635  0)
1637  1.25e7,
1638  1.25e6,
1639  0.20,
1640  0.30,
1641  1,
1642  false,
1643  0,
1644  false,
1645  0) ADD_FRAME_ATTRIBUTES(7,
1646  1.25e7,
1647  1.25e6,
1648  0.20,
1649  0.30,
1650  1,
1651  false,
1652  0,
1653  false,
1654  0)
1656  1.25e7,
1657  1.25e6,
1658  0.20,
1659  0.30,
1660  1,
1661  false,
1662  0,
1663  false,
1664  0) ADD_FRAME_ATTRIBUTES(9,
1665  1.25e7,
1666  1.25e6,
1667  0.20,
1668  0.30,
1669  1,
1670  false,
1671  0,
1672  false,
1673  0);
1674 
1675  return tid;
1676 }
1677 
1678 TypeId
1680 {
1681  NS_LOG_FUNCTION(this);
1682  return GetTypeId();
1683 }
1684 
1685 void
1687 {
1688  NS_LOG_FUNCTION(this);
1689 }
1690 
1691 NS_OBJECT_ENSURE_REGISTERED(SatSuperframeConf4);
1692 
1693 // Super frame configuration 4.
1694 
1696 {
1697  NS_LOG_FUNCTION(this);
1698 }
1699 
1701 {
1702  NS_LOG_FUNCTION(this);
1703 }
1704 
1705 TypeId
1707 {
1708  static TypeId tid =
1709  TypeId("ns3::SatSuperframeConf4")
1710  .SetParent<ns3::SatSuperframeConf>()
1711  .AddConstructor<SatSuperframeConf4>()
1714  3.0e5,
1715  3.0e5,
1716  0.25,
1717  0.0,
1718  16,
1719  true,
1720  0,
1721  false,
1722  0) // create frame only to store waveformconf
1723  ;
1724 
1725  return tid;
1726 }
1727 
1728 TypeId
1730 {
1731  NS_LOG_FUNCTION(this);
1732  return GetTypeId();
1733 }
1734 
1735 void
1737 {
1738  NS_LOG_FUNCTION(this);
1739 }
1740 
1741 } // namespace ns3
~SatBtuConf()
Destructor for SatBtuConf.
SatBtuConf()
Default constructor for SatBtuConf.
CarrierBandwidthType_t
Types of bandwidth.
uint8_t GetSubdivisionLevel() const
Get the subdivision level of this frame.
uint16_t AddTimeSlotConf(Ptr< SatTimeSlotConf > conf)
Add time slot.
uint32_t m_minPayloadPerCarrierInBytes
static const uint16_t m_maxTimeSlotCount
double GetCarrierBandwidthHz(SatEnums::CarrierBandwidthType_t bandwidthType) const
Get carrier bandwidth in frame.
Ptr< SatTimeSlotConf > GetTimeSlotConf(uint16_t index) const
Get time slot configuration of the frame.
Ptr< SatWaveformConf > m_waveformConf
SatTimeSlotConfMap_t m_timeSlotConfMap
std::vector< Ptr< SatTimeSlotConf > > SatTimeSlotConfContainer_t
Define type SatTimeSlotConfContainer_t.
double GetCarrierFrequencyHz(uint16_t carrierId) const
Get carrier center frequency in frame.
Ptr< SatBtuConf > m_btuConf
~SatFrameConf()
Destructor for SatFrameConf.
Ptr< SatFrameConf > m_parent
SatTimeSlotConfContainer_t GetTimeSlotConfs(uint16_t carrierId) const
Get time slot of the specific carrier.
uint16_t GetTimeSlotCount() const
Get time slot count of the frame.
SatFrameConf()
Default constructor for SatFrameConf.
This class implements super frame configuration 0.
virtual void DoConfigure()
Do frame specific configuration as needed.
static TypeId GetTypeId(void)
Get the type ID.
~SatSuperframeConf0()
Destructor for SatSuperframeConf.
SatSuperframeConf0()
Default constructor for SatSuperframeConf.
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
This class implements super frame configuration 1.
SatSuperframeConf1()
Default constructor for SatSuperframeConf.
static TypeId GetTypeId(void)
Get the type ID.
~SatSuperframeConf1()
Destructor for SatSuperframeConf.
virtual void DoConfigure()
Do frame specific configuration as needed.
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
This class implements sup.
~SatSuperframeConf2()
Destructor for SatSuperframeConf.
static TypeId GetTypeId(void)
Get the type ID.
virtual void DoConfigure()
Do frame specific configuration as needed.
SatSuperframeConf2()
Default constructor for SatSuperframeConf.
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
This class implements super frame configuration 3.
~SatSuperframeConf3()
Destructor for SatSuperframeConf.
virtual void DoConfigure()
Do frame specific configuration as needed.
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
static TypeId GetTypeId(void)
Get the type ID.
SatSuperframeConf3()
Default constructor for SatSuperframeConf.
This class implements super frame configuration 4.
static TypeId GetTypeId(void)
Get the type ID.
virtual void DoConfigure()
Do frame specific configuration as needed.
SatSuperframeConf4()
Default constructor for SatSuperframeConf.
~SatSuperframeConf4()
Destructor for SatSuperframeConf.
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
This abstract class defines and implements interface of configuration for super frames.
SatSuperframeConf()
Default constructor for SatSuperframeConf.
void SetFrameCarrierSpacing(uint8_t frameIndex, double spacing)
SatFrameConf::SatTimeSlotConfContainer_t GetRaSlots(uint8_t raChannel)
Get RA channel time slots.
SatFrameConfList_t m_frames
double m_frameCarrierSpacing[m_maxFrameCount]
uint8_t m_frameGuardTimeSymbols[m_maxFrameCount]
uint32_t GetCarrierCount() const
Get carrier count in the super frame.
static std::string GetNumberAsString(T number)
Template method to convert number to string.
double GetFrameCarrierSpacing(uint8_t frameIndex) const
double GetFrameAllocatedBandwidthHz(uint8_t frameIndex) const
Ptr< SatFrameConf > GetCarrierFrameConf(uint32_t carrierId) const
Get the frame configuration of the requested carrier.
void SetFrameGuardTimeSymbols(uint8_t frameIndex, uint8_t guardTimeSymbols)
bool m_frameIsLogon[m_maxFrameCount]
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
uint16_t GetRaSlotCount(uint8_t raChannel)
Get RA channel time slot count.
void SetFrameRandomAccess(uint8_t frameIndex, bool randomAccess)
void SetFrameAllocatedBandwidthHz(uint8_t frameIndex, double bandwidthHz)
uint8_t GetRaChannel(uint32_t carrierId) const
Get the RA channel id (index) corresponding to given (global) carrier id.
void SetFrameLogon(uint8_t frameIndex, bool logon)
void SetFrameAllocationChannelId(uint8_t frameIndex, uint8_t allocationChannel)
std::vector< RaChannelInfo_t > m_raChannels
double m_frameCarrierAllocatedBandwidth[m_maxFrameCount]
double GetCarrierFrequencyHz(uint32_t carrierId) const
Get the center frequency of the requested carrier.
uint32_t GetRaChannelTimeSlotPayloadInBytes(uint8_t raChannel) const
Get the payload of the RA channel time slot in bytes.
uint8_t GetFrameGuardTimeSymbols(uint8_t frameIndex) const
static std::string GetIndexAsFrameName(uint32_t index)
Method to convert frame index to frame name.
double GetFrameCarrierAllocatedBandwidthHz(uint8_t frameIndex) const
void AddFrameConf(SatFrameConf::SatFrameConfParams_t frameConfParameters, double bandwidthInHz, double rollOff, double spacing, uint32_t spreadingFactor, uint8_t subdivisionLevel)
Add frame configuration to super frame configuration.
double GetFrameCarrierRollOff(uint8_t frameIndex) const
SuperFrameConfiguration_t
Configurable Super Frames.
@ SUPER_FRAME_CONFIG_0
SUPER_FRAME_CONFIG_0.
@ SUPER_FRAME_CONFIG_3
SUPER_FRAME_CONFIG_3.
@ SUPER_FRAME_CONFIG_4
SUPER_FRAME_CONFIG_4.
@ SUPER_FRAME_CONFIG_1
SUPER_FRAME_CONFIG_1.
@ SUPER_FRAME_CONFIG_2
SUPER_FRAME_CONFIG_2.
static const uint8_t m_maxFrameCount
static Ptr< SatSuperframeConf > CreateSuperframeConf(SuperFrameConfiguration_t conf)
Create pre-configured super frame configuration-.
uint8_t GetRaChannelFrameId(uint8_t raChannel) const
Get RA channel frame ID.
void SetFrameCarrierRollOff(uint8_t frameIndex, double rollOff)
uint8_t GetFrameAllocationChannelId(uint8_t frameIndex) const
void SetFrameCarrierAllocatedBandwidthHz(uint8_t frameIndex, double bandwidthHz)
double GetCarrierBandwidthHz(uint32_t carrierId, SatEnums::CarrierBandwidthType_t bandwidthType) const
Get the bandwidth of the requested carrier.
uint8_t m_frameAllocationChannel[m_maxFrameCount]
bool IsFrameLogon(uint8_t frameIndex) const
double m_frameAllocatedBandwidth[m_maxFrameCount]
void Configure(double allocatedBandwidthHz, Time targetDuration, Ptr< SatWaveformConf > waveformConf)
Configures super frame configuration according to set attributes.
uint32_t m_frameCarrierSpreadingFactor[m_maxFrameCount]
virtual void DoConfigure()=0
Do frame specific configuration as needed.
double m_frameCarrierRollOff[m_maxFrameCount]
uint32_t GetCarrierId(uint8_t frameId, uint16_t frameCarrierId) const
Get carrier id of the super frame.
~SatSuperframeConf()
Destructor for SatSuperframeConf.
bool m_frameIsRandomAccess[m_maxFrameCount]
void SetFrameCarrierSpreadingFactor(uint8_t frameIndex, uint32_t spreadingFactor)
static TypeId GetTypeId(void)
Get the type ID.
Ptr< SatFrameConf > GetFrameConf(uint8_t id) const
Get frame conf of the super frame.
uint8_t GetRaChannelCount() const
Get the number of the RA channels in super frame configuration.
uint32_t GetFrameCarrierSpreadingFactor(uint8_t frameIndex) const
bool IsFrameRandomAccess(uint8_t frameIndex) const
uint32_t GetLogonChannelIndex() const
uint8_t GetCarrierFrame(uint32_t carrierId) const
Get frame id where given global carrier ID belongs to.
uint8_t GetRaChannelAllocationChannelId(uint8_t raChannel) const
Get RA channel allocation channel ID.
@ CONFIG_TYPE_4
Configuration type 4 (ESSA)
@ CONFIG_TYPE_2
Configuration type 2.
@ CONFIG_TYPE_1
Configuration type 1.
@ CONFIG_TYPE_0
Configuration type 0.
@ CONFIG_TYPE_3
Configuration type 3.
bool IsRandomAccessCarrier(uint32_t carrierId) const
Check if given carrier is random access carrier.
This class implements configuration for time slots (for super frames / frames)
SatTimeSlotConf()
Default constructor for SatTimeSlotConf.
SatTimeSlotType_t
Types for time slot.
@ SLOT_TYPE_TRC
Control or traffic slot.
~SatTimeSlotConf()
Destructor for SatTimeSlotConf.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
#define ADD_SUPER_FRAME_ATTRIBUTES(frameCount, configType, maxSubdivision)
#define ADD_FRAME_ATTRIBUTES(index, frameBandwidth, carrierBandwidth, carrierSpacing, carrierRollOff, spreadingFactor, randomAccess, lowerLayerService, logon, guardTime)
Helper struct to reduce the number of parameters fed into the SatFrameConf constructor.