92 LongBer *pre =
nullptr;
93 LongBer *pos =
nullptr;
95 for (j = 0; j < berlist->size(); j++) {
96 pos = *(berlist->begin() + j);
97 if (pos->longpkt >= tlen) {
104 if (j == berlist->size())
105 pre = *(berlist->begin() + j - 2);
107 pre = *(berlist->begin() + j - 1);
122 if (pos->snrlist.size() < 1)
123 throw cRuntimeError(
"model error: pos->snrlist is empty");
124 if (tsnr > pos->snrlist[pos->snrlist.size() - 1].snr) {
125 snrdata1 = pos->snrlist[pos->snrlist.size() - 1];
126 snrdata2 = pos->snrlist[pos->snrlist.size() - 1];
129 for (j = 0; j < pos->snrlist.size(); j++) {
130 snrdata1 = pos->snrlist[j];
131 if (tsnr <= snrdata1.snr)
139 if (j == pos->snrlist.size()) {
141 throw cRuntimeError(
"model error: pos->snrlist is too short, should be 2 or more elements");
142 snrdata2 = pos->snrlist[j - 2];
145 snrdata2 = pos->snrlist[j - 1];
151 if (tsnr > pre->snrlist[pre->snrlist.size() - 1].snr) {
152 snrdata3 = pre->snrlist[pre->snrlist.size() - 1];
153 snrdata4 = pre->snrlist[pre->snrlist.size() - 1];
156 for (j = 0; j < pre->snrlist.size(); j++) {
157 snrdata3 = pre->snrlist[j];
158 if (tsnr <= snrdata3.snr)
162 if (j == pre->snrlist.size())
163 snrdata4 = pre->snrlist[j - 2];
165 snrdata4 = pre->snrlist[j - 1];
168 if (snrdata2.snr == -1) {
169 snrdata2.snr = snrdata1.snr;
170 snrdata2.ber = snrdata1.ber;
172 if (snrdata4.snr == -1) {
173 snrdata4.snr = snrdata3.snr;
174 snrdata4.ber = snrdata3.ber;
176 double per1, per2, per;
180 if (tsnr <= snrdata1.snr) {
181 if (snrdata2.snr != snrdata1.snr)
182 per1 = snrdata1.ber + (snrdata2.ber - snrdata1.ber) / (snrdata2.snr - snrdata1.snr) * (tsnr - snrdata1.snr);
184 if (tsnr <= snrdata3.snr) {
185 if (snrdata3.snr != snrdata4.snr)
186 per2 = snrdata3.ber + (snrdata4.ber - snrdata3.ber) / (snrdata4.snr - snrdata3.snr) * (tsnr - snrdata3.snr);
188 if (per1 != -1 && per2 != -1) {
189 if (pos->longpkt != pre->longpkt)
190 per = per2 + (per1 - per2) / (pos->longpkt - pre->longpkt) * (tlen - pre->longpkt);
203 EV <<
"No PER available";
std::vector< LongBer * > BerList
Definition: BerParseFile.h:61
BerTable berTable
Definition: BerParseFile.h:64
int getTablePosition(double speed)
Definition: BerParseFile.cc:55