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