66 NS_LOG_FUNCTION(
this << filePathName);
69 std::ifstream* ifs =
new std::ifstream(filePathName.c_str(), std::ifstream::in);
75 filePathName =
"../../" + filePathName;
76 ifs =
new std::ifstream(filePathName.c_str(), std::ifstream::in);
80 NS_FATAL_ERROR(
"The file " << filePathName <<
" is not found.");
87 while (std::getline(*ifs, line,
'\n'))
90 std::stringstream ssLine;
93 std::vector<uint32_t> tempVector;
97 while (std::getline(ssLine, col,
','))
99 std::stringstream ssCol;
103 tempVector.push_back(uCol);
106 NS_ASSERT(tempVector.size() >= 2);
108 m_bstp.push_back(tempVector);
111 NS_ASSERT(!
m_bstp.empty());
158 NS_LOG_FUNCTION(
this);
162 NS_FATAL_ERROR(
"BSTP container is empty!");
166 std::map<uint32_t, uint32_t> beamIds;
167 std::map<uint32_t, std::vector<uint32_t>> gwFeederFreqs;
170 for (uint32_t i = 0; i <
m_bstp.size(); i++)
173 gwFeederFreqs.clear();
176 std::vector<uint32_t> confEntry =
m_bstp.at(i);
177 for (uint32_t j = 1; j < confEntry.size(); j++)
179 uint32_t beamId = confEntry.at(j);
181 std::vector<uint32_t>::iterator eIt =
182 std::find(enabledBeams.begin(), enabledBeams.end(), beamId);
183 if (eIt != enabledBeams.end())
185 enabledBeams.erase(eIt);
189 if ((beamIds.insert(std::make_pair(beamId, 0))).second ==
false)
191 NS_FATAL_ERROR(
"Beam id: " << confEntry.at(j)
192 <<
" is located twice in the BSTP line: " << i);
197 std::map<uint32_t, uint32_t>::iterator gwIt =
m_beamGwMap.find(beamId);
202 uint32_t feederFreqId = ffIt->second;
203 uint32_t gwId = gwIt->second;
206 std::map<uint32_t, std::vector<uint32_t>>::iterator findGw =
207 gwFeederFreqs.find(gwId);
210 if (findGw == gwFeederFreqs.end())
212 std::vector<uint32_t> ffIds;
213 ffIds.push_back(feederFreqId);
214 gwFeederFreqs.insert(std::make_pair(gwId, ffIds));
220 std::vector<uint32_t>::iterator findFfIt =
221 std::find(findGw->second.begin(), findGw->second.end(), feederFreqId);
225 if (findFfIt != findGw->second.end())
227 NS_FATAL_ERROR(
"Feeder link freq id: " << feederFreqId
228 <<
" already found for GW: "
233 findGw->second.push_back(feederFreqId);
238 NS_LOG_WARN(
"Beam id: " << beamId <<
" is not enabled, but it located at BSTP!");
245 if (enabledBeams.size() > 0)
247 NS_FATAL_ERROR(
"All enabled beams are not in the BSTP configuration!");
void AddEnabledBeamInfo(uint32_t beamId, uint32_t userFreqId, uint32_t feederFreqId, uint32_t gwId)
Add the information about which spot-beams are enabled in this simulation.