61 if (symbolErrorRate == 0) {
62 const TransmissionSymbolModel *transmissionSymbolModel = check_and_cast<
const TransmissionSymbolModel *>(transmission->getSymbolModel());
63 return new ReceptionSymbolModel(transmissionSymbolModel->getHeaderSymbolLength(), transmissionSymbolModel->getHeaderSymbolRate(), transmissionSymbolModel->getPayloadSymbolLength(), transmissionSymbolModel->getPayloadSymbolRate(),
new std::vector<const ISymbol*>(*transmissionSymbolModel->getSymbols()));
66 const TransmissionSymbolModel *transmissionSymbolModel = check_and_cast<
const TransmissionSymbolModel *>(transmission->getSymbolModel());
67 const APSKModulationBase *modulation = check_and_cast<
const APSKModulationBase *>(transmissionSymbolModel->getPayloadModulation());
68 const std::vector<const ISymbol*> *transmittedSymbols = transmissionSymbolModel->getSymbols();
69 std::vector<const ISymbol*> *receivedSymbols =
new std::vector<const ISymbol *>();
70 for (
auto & transmittedSymbols_i : *transmittedSymbols) {
71 if (uniform(0, 1) < symbolErrorRate) {
72 const APSKSymbol *transmittedSymbol = check_and_cast<
const APSKSymbol *>(transmittedSymbols_i);
73 ShortBitVector bits = modulation->demapToBitRepresentation(transmittedSymbol);
74 int errorIndex = intuniform(0, bits.getSize() - 1);
75 bits.setBit(errorIndex, !bits.getBit(errorIndex));
76 const APSKSymbol *receivedSymbol = modulation->mapToConstellationDiagram(bits);
77 receivedSymbols->push_back(receivedSymbol);
80 receivedSymbols->push_back(transmittedSymbols_i);
82 return new ReceptionSymbolModel(transmissionSymbolModel->getHeaderSymbolLength(), transmissionSymbolModel->getHeaderSymbolRate(), transmissionSymbolModel->getPayloadSymbolLength(), transmissionSymbolModel->getPayloadSymbolRate(), receivedSymbols);