---
# System prepended metadata

title: Simulink B210 TEST
tags: [IIT, 程式]

---

# Simulink B210 TEST

## No Doppler shift in source and destination
:::info
* Simulink Model
* TX
![TX](https://hackmd.io/_uploads/HkOLVg0h2.png)
* RX
![RX](https://hackmd.io/_uploads/BJTTQ33h3.png)

* Output
```
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
```
* Ideal Output
```
A vechile is approaching from left of the road towards you, Be careful. Vechicle is malfunctioning. Driver is not responding
```

***The reason for the discrepancy between the output and the ideal output is that there is some interference and errors in the data during transmission. Therefore, it is normal that there will be some decoding errors***

I encountered a problem during the implementation where the Bit Error Rate (BER) was excessively high, making successful decoding impossible. Initially, I suspected it was related to the `Gain` setting in the Software Defined Radio (SDR) and the `Detection threshold` in the Preamble Detector, but testing these parameters didn't improve the situation. After some thought, I suspected that it might have something to do with the distance and positioning between the SDR boards.
After adjusting the positioning the problem was solved.

I found that adjusting the distance between the boards resolved the issue. My current hypothesis is that the power from the antennas to the boards was not sufficient. When the distance was slightly increased, additional interference was introduced along the path, significantly affecting the BER.
:::

## Source without Doppler shift, destination with Doppler shift
:::warning
* Simulink Model
* TX
![TX](https://hackmd.io/_uploads/rJiDNl02n.png)
* RX
![RX_Doppler_Shift](https://hackmd.io/_uploads/B1XHHgA22.png)

* Output
```
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
A`vechilf is approaching frol`left of thf road towards yowL Bf carefql. fechiclf is malfqnctioning Driver is not responding 
```
* Ideal Output
```
A vechile is approaching from left of the road towards you, Be careful. Vechicle is malfunctioning. Driver is not responding
```
There were issues during the decoding process, likely due to frequency or phase offsets. However, overall, it was not a significant problem, and I was still able to successfully interpret the transmitted messages.
:::


## Source with Doppler shift, destination without Doppler shift
:::success
* Simulink Model
* TX
![TX_Doppler_Shift](https://hackmd.io/_uploads/SJWA7gA32.png)
* RX
![RX](https://hackmd.io/_uploads/BJMlwlCn3.png)

* Output
```
A`vechile is approaching from left of the road towards you, Be careful. fechicle is malfunctioning. Driver is not responding 
A vechile is approaching frol left of thd road towards you, Bf careful. Vechicle is malfunctioning Driver is not responding 
A vechile is approaching frol left of thd road towards you, Be careful. Vechicle is malfqnctioning. Driver is not responding 
A vechilf is approaching from left of the road towards yow, Be carefql. Vechiclf is malfunctioning. Driver is not responding 
A`vechile is approaching from left of the road towards you, Be careful. fechicle is malfunctioning. Driver is not responding 
A vechile is approaching frol left of the road towards you, Bf careful. Fechicle is malfunctioning. Driver is not responding 
A vechile is approaching frol`left of thf road towards you, Be careful. Vechicle is malfqnctioning. Driver is not responding 
A vechilf is approaching from left of the road towards you, Be carefql. Vechiclf is malfunctioning. Driver is not responding 
A`vechile is approaching from left of the road towards youL Be careful. Fechicle is malfunctioning. Driver is not responding 
```

* Ideal Output
```
A vechile is approaching from left of the road towards you, Be careful. Vechicle is malfunctioning. Driver is not responding
```

After adding Doppler Shift at the TX end, the decoding results at the RX end became much more accurate. The reason for this improvement is currently attributed to the inherent frequency offset between the two SDRs, which was unintentionally compensated for by the Doppler Shift. However, this issue was not identified in the initial stages, leading to decoding errors. 

Therefore, the current task is to reconfirm the frequency offset between the two SDR boards, perform frequency calibration, and proceed with further work.
:::

## Source with Doppler shift, destination with Doppler shift
:::danger
* Simulink Model
* TX
![TX](https://hackmd.io/_uploads/BJxy77Qan.png)
* RX
![RX](https://hackmd.io/_uploads/HywAfQQpn.png)

***RX Required Changes***
![RX需修改部分](https://hackmd.io/_uploads/rygWmmXan.png)

* Output
```
A`vechilf is approaching from left of the road towards you, Be careful. Vechicle is malfunctioning Driver is not responding 
A vechile is approaching from left of the road towards youL Bd careful. Vechicle is malfunctioning. Driver is not responding 
A vechile is approaching from left of the road towards you, Be careful. Vechicle is malfunctioning. Driver is not responding 
A vechild is approaching frol`left of thf road towards you, Be careful. vechiclf is malfunctioning. Driver is not responding 
A vechile is approaching from left of the road towards you, Be careful. Vechicle is malfunctioning Driver is not responding 
A vechile is approaching from left of the road towards yowL Bf careful. Vechicle is malfunctioning. Driver is not responding 
A vechile is approaching frol left of thf`road towards you, Be careful. fechicld is malfunctioning. Driver is not responding 
A vechilf is approaching frol left of the road towards you, Be careful. Vechicle is malfunctioning. Driver is not responding 
```

* Ideal Output
```
A vechile is approaching from left of the road towards you, Be careful. Vechicle is malfunctioning. Driver is not responding
```

By introducing Phase/Frequency Offset at the TX end to simulate Doppler Shift, and modifying the Phase/Frequency Offset phase in the Coarse Frequency Compensation at the RX end to compensate for phase offset, the frequency compensation part is provided by the Coarse Frequency Compensator.

After testing, various offsets can be effectively compensated, and the Bit Error Rate (BER) is relatively good, generally maintained at around 1% to 8%. It's important to note that the frequency offset needs to be within the Maximum frequency offset range set in the Coarse Frequency Compensator. If it exceeds this range, it can lead to insufficient compensation and result in decoding failures.
:::

## Relay Node
:::info
* Simulink Model
* Relay Node
* Setting 1
![Relay Node](https://hackmd.io/_uploads/BkCCOl3yT.png)
* Setting 2
![Relay Node](https://hackmd.io/_uploads/S1jYgb2kT.png)

In the design of the Relay Node, initially, we adopted the approach shown in the first diagram. That is, after RX receives the signal, it undergoes a complete signal processing, followed by modulation, and finally, it is transmitted via TX. However, this method has only succeeded once. After discussing with the professor, we concluded that our SDR board is set to operate in FDD mode by default, but we didn't separate the uplink and downlink paths for TXRX. This resulted in frequency feedback issues, causing the relay to fail.

I also attempted to use triggers to separate TXRX and avoid the frequency feedback problem, but the results were not satisfactory. Therefore, our current plan is to redesign using TDD to prevent feedback issues from occurring.

* Setting 3
    * Relay RX
    ![image](https://hackmd.io/_uploads/ByoqYAL8p.png)
    * Relay TX
    ![image](https://hackmd.io/_uploads/H1SsF08UT.png)
:::

---
