화요일, 11월 22, 2022

[HAM] 대중을 위한 소프트웨어 정의 라디오(SDR), 1부 (6/8)

[HAM] 대중을 위한 소프트웨어 정의 라디오(SDR), 1부 (6/8)

A Software-Defined Radio for the Masses, Part 1 - ARRL [Link]
By Gerald Youngblood, AC5OG

---------------------------------
주) 아래 번역 중 [] 안의 내용은 제가 부연설명 삼아 추가한 것입니다. 틀릴 수 있으니 미리 양해를 구합니다. 오류나 미진한 부분이 있다면 기탄없는 지적 바랍니다. -역자-
---------------------------------

<이전>

DSP in the Frequency Domain

주파수 영역의 디지털 신호 처리

Every DSP text I have read thus far concentrates on time-domain filtering and  demodulation of SSB signals using finite-impulse-response (FIR) filters. Since these techniques have been thoroughly discussed in the literature1, 3, 4 and are not currently used in my PC SDR, they will not be covered in this article series. My PC SDR uses the power of the fast Fourier transform (FFT) to do almost all of the heavy lifting in the frequency domain.

내가 읽었던 대부분 교과서에서는 시간영역(time domain)의 필터링인 유한 임펄스 응답(FIR, finite-impulse response) 필터를 설명하고 이를 이용해 SSB 신호를 복조하기 위해 상당량을 할애하고 있었다. 이 기법은 참고문헌 [1][3][4]에서 자세히 다루고 있으므로 참조하기 바란다. 이번 글에서 구현할 PC 기반 SDR에는 이에 대해서 다루지 않는다. 이번 PC SDR은 주파수 영역에서 처리하면서 생기는 지대한 계산의 부담을 고속 퓨리에 변환(FFT, fast Fourier transform)의 능력을 빌어 해결 하고자 한다.

[시간영역 신호를 주파수 영역으로 변환(주파수 성분을 분리해냄)하는 퓨리에 변환[참조]은 19세기 말에 이미 확립된 수학적 기법으로 원래 엄청난 계산량을 요구한다. 이 퓨리에 변환에 포함된 상당량의 지수함수와 곱셈이 반복 사용(주기함수들 이므로)된다는 점을 고려해 변수들을 미리 계산해 놓고 상수화 하여 재활용하고 곱셈의 횟수를 줄이는 방법으로 '고속(fast)'화 했다. 컴퓨터가 적극 활용되기 시작한 70년대에 이런 변환 계산을 실시간으로 수행할 만큼 빠르지 못했다. 따라서 '고속'의 알고리즘 개발이 큰 과재였던 시절이 있었다. FFT을 빠르게 수행하는 방법(알고리즘)으로 등장한 쿨리-튜키 알고리즘(Cooley-Tukey algorithm)은 1965년에 나왔다[참조]. 하지만 엄청난 속도를 자랑하는 오늘날에 이르러 '고속 알고리즘'은 개발이나 연구의 대상이 되지 못한다. 반복적인 계산 부분을 애써 찾기 보다 계산 유연성에 치중을 두고 있는 인공지능 분야는 오히려 대규모 컴퓨터 자원의 동원(사물 인터넷과 클라우드 컴퓨팅)이 더 큰 관심사다. 게다가 최신 컴퓨터 언어 컴파일러들은 원시 코드에서 계산의 병렬성을 알고리즘으로 찾아내어 고속화를 자동으로 꾀해주고 있다.]

Most DSP texts use a lot of ink to derive the math so that one can write the FFT code. Since Intel has so helpfully provided the code in executable form in their signal-processing library[5], we don’t care how to write an FFT: We just need to know how to use it. Simply put, the FFT converts the complex I and Q discrete-time signals into the frequency domain. The FFT output can be thought of as a large bank of very narrow band-pass filters, called bins, each one measuring the spectral energy within its respective bandwidth. The output resembles a comb filter wherein each bin slightly overlaps its adjacent bins forming a scalloped curve, as shown in Fig 7.

대부분 교과서들이 많은 분량을 들여 퓨리에 변환의 고속 알고리즘을 유도하고 FFT 프로그램의 작성을 다루고 있다. 다행히 인텔사에서 자사의 신호처리 라이브러리를 컴파일해서 배포하는 덕분에 우리가 직접 FFT를 작성 할 필요는 없다. 단지 어떻게 사용하는지 알면 된다[제대로 사용하려면 FFT의 의미와 원리를 알아야 한다.] 간단히 말해서 FFT는 복소수로 표현된 이산(discrete-time) I와 Q 신호를 주파수 영역으로 변환한다. FFT의 출력은 마치 다수의 협대역 통과 필터를 여러개 병렬로 늘어 놓은 것과 같다. 이 협대역 필터를  'bin'이라고 부르기로 하자. 각 필터는 주어진 대역 내에 어느정도의 세력[주파수에 해당하는(spectral energy) 성분의 정도]을 가지고 있는지 측정한다.] FFT의 출력은 마치 빗 필터(comb filter)와 같은 모습인데 빗살이 통과필터에 비유될 수 있다. 이웃한 각 빗살은 서로 겹쳐 있어서 그림 7처럼 [겹친 상단 부] 물결치는 모습(scallop: '조개 관자' 처럼 기둥이 불쑥 솟은 모양)이 된다.

Fig 7—FFT output resembles a comb filter: Each bin of the FFT overlaps its adjacent bins  just as in a comb filter. The 3-dB points overlap to provide linear output. The phase and magnitude of the signal in each bin is easily determined mathematically with Eqs 3 and 4.

When a signal is precisely at the center frequency of a bin, there will be a corresponding value only in that bin. As the frequency is offset from the bin’s center, there will be a corresponding increase in the value of the adjacent bin and a decrease in the value of the current bin. Mathematical analysis fully describes the relationship between FFT bins[6], but such is beyond the scope of this article.

입력 신호가 빗살의 정중앙 주파수에 해당할 경우 그에 해당하는 성분의 세기가 그  빗살 내에 나타날 것이다. 신호의 주파수가 빗살의 중앙에서 벗어나면 옆의 빗살쪽에서 크게 나타나고 현재 빗살 내의 값은 감소한다. FFT와 빗살의 관계에 대한 수학적인 해석은 이번 기사에서 크게 벗어나므로 참고문헌[6]을 찾아보기 바란다.

Further, the FFT allows us to measure both phase and amplitude of the signal within each bin using Eqs 3 and 4 above. The complex version allows us to measure positive and negative frequencies separately. Fig 8 illustrates the output of a complex, or quadrature, FFT.

덧붙여 FFT를 수행하고 나면 결과로 각 빗살에 대한 복소수의 값을 얻게 되는데 이를 이용해 세기와 위상을 각각 식 3과 식 4를 이용해 구할 수 있다. [시간 영역의 신호를 주파수 영역으로 변환해 놓으면 세기 이외에 위상 정보도 알아야 하는 이유가 있을까? 복원을 생각해보자. 시간 영역의 신호가 주파수 영역으로 분리해 냈을 때 구분된 신호의 위상이 모두 일치하리라는 법은 없다] 복소수로 계산된 FFT에는 주파수가 양과 음으로 분리된다. 그림 8은 복소수 또는 직각위상 FFT의 처리 결과를 도식적으로 나타낸 것이다.

[이 기사는 SDR의 구현이 목적이므로 DSP의 상당부분은 개념설명으로 넘기고 있다. 특히 신호를 복소수로 표현하는 이유와 응용에 대해 쉽개 설명한 'A Quadrature Signals Tutorial: Complex, But Not Complicated by Richard Lyons'를 꼭 읽어보자. 쉽다! 정말로.... 장담은 못하지만 이것도 해설서로 만들어 보겠다.]

Fig 8—Complex FFT output: The output of a complex FFT may be thought of as a series of band-pass filters aligned around the carrier frequency, f_c, at bin 0. N represents the number of FFT bins. The upper sideband is located in bins 1 through (N/2)–1 and the lower sideband is located in bins N/2 to N–1. The center frequency and bandwidth of each bin may be calculated using Eqs 5 and 6.

그림 8 - 복소수 FFT의 출력: 복소수 FFT의 출력은 반송파를 중심으로 등간격으로 배열된 다수의 연속된 대역 필터와 같다. N은 FFT 빗살의 갯수다. 상측파대는 n=1에서 (N/2)-1 번째 빗살이 점유한 대역이며 하측파대는 n=N에서 N-1 까지 주파수 대역이다. 빗살의 중심 주파수와 대역은 식 5와 6으로 계산 할 수 있다.

The bandwidth of each FFT bin may be computed as shown in Eq 5, where BW_bin is the bandwidth of a single bin, f_s is the sampling rate and N is the size of the FFT. The center frequency of each FFT bin may be determined by Eq 6 where fcenter is the bin’s center frequency, n is the bin number, fs is the sampling rate and N is the size of the FFT. Bins zero through (N/2)–1 represent upper-sideband frequencies and bins N/2 to N–1 represent lower-sideband frequencies around the carrier frequency.

FFT 빗살의 대역폭은 식5에 의해 계산된다[빗살들은 등분되어 있으므로 대역폭은 모두 동일하다.] 식5에서 BW_bin은 단일 빗살의 대역폭이며 f_s 샘플링 율(sampling rate)[샘플링 주파수], N은 FFT의 빗살 갯수다. FFT 빗살의 중심 주파수는 식6에 의해 계산된다. 식6에서 n 은 빗살의 순번, f_s 샘플링 율(sampling rate)[=샘플링 주파수], N은 FFT의 빗살 갯수다. 빗살의 0번째에서 (N/2)-1 번째가 상측파대(upper-sideband) 주파수 영역이며 N/2 에서 N-1 번째 빗살까지 영역이 반송파(carrier)를 포함한 하측파대(lower-sideband) 주파수 영역이다.

If we assume the sampling rate of the sound card is 44.1 kHz and the number of FFT bins is 4096, then the bandwidth and center frequency of each bin would be:

샘플링 주파수가 44.1 kHz이고 FFT의 빗살의 갯수가 4096개라면 빗상의 대역폭과 중심 주파수는 다음과 같다.

What this all means is that the receiver will have 4096, ~11-Hz-wide band-pass filters. We can therefore create band-pass filters from 11 Hz to approximately 40 kHz in 11-Hz steps.

이 수치의 의미는 11 Hz의 대역폭의 필터를 가진 4096개의 수신기가 있다는 뜻이다. Ehsms 11 Hz에서 약 44kHz 범위 내에서 통과 폭이 11 Hz인 대역 톡과 필터를 꾸밀 수 있게 됐다는 뜻이기도 하다.

The PC SDR performs the following functions in the frequency domain after FFT conversion:

PC 기반의 SDR은 FFT 변환으로 주파수 영역에서 다음과 같은 기능을 수행 할 수 있다.

• Brick-wall fixed and variable bandpass filters
    고정 혹은 가변 대역폭의 벽돌 담장 필터
• Frequency conversion
    주파수 변환
• SSB/CW demodulation
    측파대 음성 및 전신 복조
• Sideband selection
    측파대 선택
• Frequency-domain noise subtraction
    주파수 영역에서 잡음 소거
• Frequency-selective squelch
    주파수 별 스퀠치
• Noise blanking
    노이즈 차단
• Graphic equalization (“tone control”)
    그래픽 이퀄라이져 (음색 조절)
• Phase and amplitude balancing to remove images
    이미지 제거를 위한 위상 및 진폭 균형조절
• SSB generation
    측파대 신호 생성
• Future digital modes such as PSK31 and RTTY
    디지털 통신용 위상변조(PSK31, RTTY 등) 대응

Once the desired frequency-domain processing is completed, it is simple to convert the signal back to the time domain by using an inverse FFT. In the PC SDR, only AGC and adaptive noise filtering are currently performed in the time domain. A simplified diagram of the PC SDR software architecture is provided in Fig 9. These concepts will be discussed in detail in a future article.

일단 주파수 영역으로 변환이 완료된 신호들은 역 FFT(inverse FFT)후 다시 시간 영역으로 되돌릴 수 있다[FFT나 역FFT는 계산 알고리즘이 동일하다. 시간과 주파수는 서로 역수 맞대응 관계에 있다.] PC 기반 SDR에서는 [고전적인 무전기들에서는 시간 영역에서 이뤄지던] 자동 게인 조절 AGC와 적응형 잡음제거를 주파수 영역에서 실시할 것이다. 그림9는 PC SDR의 계통도를 간략하게 보여준다. 추후 이어지는 기사에서 자세히 다루기로 한다.

Fig 9—SDR receiver software architecture: The I and Q signals are fed from the soundcard input directly to a 4096-bin complex FFT. Band-pass filter coefficients are precomputed and converted to the frequency domain using another FFT. The frequencydomain filter is then multiplied by the frequency-domain signal to provide brick-wall filtering. The filtered signal is then converted to the time domain using the inverse FFT. Adaptive noise and notch filtering and digital AGC follow in the time domain.

그림 9 - SDR 수신기의 계통도: 사운드 카드를 통해 취한 I와 Q 신호는 4094 등분 복소수 FFT 처리를 통해 주파수 영역으로 변환 된다.  미리 계산해 둔 대역 필터의 계수들[시간 영역에서 계산되었던 것이므로]을 또다른 FFT를 이용해 주파수 영역으로 바꾼다. 주파수 영역에서 필터는 입력신호와 필터 계수의 주파수 변환 값을 곱하여 수행 된다. 필터를 거친 주파수 영역의 값들을 역 FFT를 통해 시간 영역으로 복원한다. 능동 잡음제거와 노치 필터 그리고 자동 게인조절은 시간 영역에서 실시한다.

------------------------------

<계속>


댓글 없음:

댓글 쓰기