Editing User:CSeguinot

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 3: Line 3:




This tutorial is intended for non specialist, it involves as less maths as possible and present most results with GNURadio flowgraph. Some examples involving simple modulation scheme used in HAM radio are presented. While introducing complex signal can be seen as increasing complexity, we will see that it drastically simplify studying impairment such as synchronization.  
This tutorial is intended for non specialist, it involves as less maths as possible and present most results with GNURadio flowgraph. Some examples involving simple modulation scheme used in HAM radio are presented. While introducing complex signal can be seen as increasing complexity, we will see that it drastically simplify some impairment such as synchronization.  


If you are searching for more detailed information please refer to corresponding literature such as references [[#ancre1|[1]]],[[#ancre2|[2]]],[[#ancre3|[3]]].
If you are searching for more detailed information please refer to corresponding literature such as references [[#ancre1|[1]]],[[#ancre2|[2]]],[[#ancre3|[3]]].
Line 11: Line 11:


This section summarize complex numbers properties used in this tutorial. More information can be found on  
This section summarize complex numbers properties used in this tutorial. More information can be found on  
[[wikipedia: Complex number|complex number Wikipedia page||200px]].
[[wikipedia: Complex number|complex number Wikipedia page]].


[[File:IQ_complex_tutorial_polar2.png|frame|Complex number ''z''=''a'' + ''jb'']]
[[File:IQ_complex_tutorial_polar2.png|frame|Complex number ''z''=''a'' + ''jb'']]
Line 54: Line 54:
GNURadio software is mainly used to design and study radio communications. Making high frequency transmission requires modulating a high frequency carrier at frequency ''F<sub>0</sub>''. The most common modulation for analog transmissions are Amplitude modulation (AM) Phase modulation (PM) and Frequency modulation (FM).  
GNURadio software is mainly used to design and study radio communications. Making high frequency transmission requires modulating a high frequency carrier at frequency ''F<sub>0</sub>''. The most common modulation for analog transmissions are Amplitude modulation (AM) Phase modulation (PM) and Frequency modulation (FM).  


[[File:IQ_complex_tutorial_AM_spectrum.png|thumb|400px|AM spectrum]]
For analog AM, the modulated signal ''m(t)'' is simply the mathematical product of the carrier ''c(t)'' and the baseband signal to transmit ''a(t)''. The corresponding hardware is a mixer whose scheme is a multiplier.  
For analog AM, the modulated signal ''m(t)'' is simply the mathematical product of the carrier ''c(t)'' and the baseband signal to transmit ''a(t)''. The corresponding hardware is a mixer whose scheme and mathematical representation is a multiplier.  


: <math>m(t) = a(t) c(t) = a(t) \cos(2\pi f_0t)</math>
: <math>m(t) = a(t) c(t) = a(t) \cos(2\pi f_0t)</math>SCHéMA


We call ''a(t)'' a baseband signal since its spectrum is in a low frequency range starting near 0 Hz (For example [0-20kHz] for an HIFI audio signal).  
We call ''a(t)'' a baseband signal since its spectrum is in a low frequency range starting near 0 Hz (For example [0-20kHz] for an HIFI audio signal).  


The spectrum of an AM modulated signal ''M(f)'' is the translation or the audio spectrum ''A(f)'' around &plusmn;''F<sub>0</sub>'' with ''A(f)'' being the entire spectrum of the modulating signal, using both positive and negative frequencies
The spectrum of an AM modulated signal ''M(f)'' is the translation or the audio spectrum ''A(f)'' around ''F<sub>0</sub>'' with ''A(f)'' being the whole spectrum using both positive and negative frequencies


: <math>M(f) = \frac{1}{2}\big(A(f-f_0) + A(f+f_0)\big)</math>
: <math>M(f) = \frac{1}{2}\big(A(f-f_0) + A(f+f_0)\big)</math>SCHéMA


N.B. Negative frequencies are often omitted in spectrum representation since, for real signal (''a(t)'', ''m(t)'' are real) the power spectrum are symmetric around zero as will be detailed later.  
N.B. Negative frequencies are often omitted since for real signal (''a(t)'', ''m(t)'' are real) the power spectrum are symetric around zero as will be detailed later.  


Up to now we have been dealing with real signal. The need for complex signal appears in the next step. Simulation requires sampled signal. Sampling is the operation of observing a continuous signal and taking a finite number of sample at a given sampling rate ''f<sub>s</sub>'' (i.e; one sample each 1/''f<sub>s</sub>'' second). simulator can only make calculations on a finite number of samples, they require sampled signal. Nyquist Sampling theorem states that the sampling rate must be greater than twice the maximum frequency ''F<sub>Max</sub>'' to be able to reconstruct the original signal from the sampled signal.  
Up to now we have been dealing with real signal. The need for complex signal appears in the next step. Simulation requires sampled signal. Sampling is the operation of observing a continuous signal and taking a finite number of sample at a given sampling rate ''f<sub>s</sub>'' (i.e; one sample each 1/''f<sub>s</sub>'' second). Nyquist Sampling theorem states that the sampling rate must be greater than twice the maximum frequency ''F<sub>Max</sub>'' to be able to reconstruct the original signal from the sampled signal.  


: <math>f_s > F_{Max}</math>
: <math>f_s > F_{Max}</math>
Line 73: Line 72:
For an HIFI audio signal, maximum audio frequency <math>F_{Max Audio}</math> is closed to 20 kHz, sampling rate must be higher then 40 kHz (44.8 kHz is often used in computer sound card, 8 kHz is used for mobile phone since voice has a lower frequency range then HIFI audio).  
For an HIFI audio signal, maximum audio frequency <math>F_{Max Audio}</math> is closed to 20 kHz, sampling rate must be higher then 40 kHz (44.8 kHz is often used in computer sound card, 8 kHz is used for mobile phone since voice has a lower frequency range then HIFI audio).  


For an AM signal modulated by an audio signal, maximum frequency of the modulated spectrum is <math>F_{Max}=F_0+F_{Max Audio}</math>. Direct sampling of such signal is not possible with conventional hardware such as low cost SDR dongle. If the carrier frequency is close to 1 GHz, the sampling rate should be at least 2 GHz. This is obviously too much then computer can handle (higher then some computer clock).
For an AM signal modulated by an audio signal, maximum frequency is <math>F_{Max}=F_0+F_{Max Audio}</math>. Direct sampling of such signal is not possible with conventionnal hardware such as low cost SDR dongle. If the carrier frequency is close to 1 GHz, the sampling rate should be 2 GHz. This is obviously too much then computer cans handle (higher then most computer clock).
 
Flowgraph [[Media:IQ_tutorial_AM_TX_real.grc|IQ_tutorial_AM_TX_real.grc]] illustrates amplitude modulation using only real blocks (excepted for bits source). As a consequence, the maximum carrier frequency is limited to several tens of kHz.
* study the modulator part which simply multiply the baseband signal and the sine carrier
* look at the influence of the carrier frequency on the modulated signal spectrum (carrier frequency must stay lower than half the sampling rate)
* look at the spectrum shape for sawtooth input and random bit sequence (QT Gui chooser and Selector)
* When transmitting random bits, you can desactivate the interpolating FIR Filter and replace it by a root raised cosine filter
 
== Spectrum properties of signals==
Amplitude spectrum is calculated using the Fourier Transform. It represents how the power is spread in the frequency domain. It allows for determining the signal bandwidth. Power Spectral Density or PSD correspond to the average magnitude of the Amplitude spectrum.
 
In this section we summarize some properties of the phase arg''{X(f)}'' and magnitude |''X(f))''|. We first consider properties for continuous signal. Then we will investigate additional properties of sampled signal (those used in GNURadio).
 
Given a signal ''x(t)"" it amplitude/phase spectrum is denoted ''X(f))'' which is a complex function given by :
: <math>X(f) =\int{x(t)e^{-2j\pi ft}dt</math>
 
=== continuous real signal ===
Every real signal have a spectrum whose magnitude is symmetric and phase is anti-symmetric.
: <math>x(t) \in \mathbb{R}</math>
: <math>X(-f)=X^*(f)</math>
: <math>|X(-f)|=|X(f)|</math>
: <math>\text{arg}\{X(-f)\}=-\text{arg}\{X(f)\}</math>
 
[[File:IQ_complex_tutorial_complex_spectrum.png|thumb|500px|Complex signal spectrum and, sampled complex signal spectrum (only first 3 patterns represented)]]
=== continuous complex signal ===
The main difference with real signal is that:
* any complex signal having non null imaginary part exhibits a non-symmetric spectrum.
* as a consequence, every non-symmetric spectrum correspond to a complex signal
 
=== sampled signals ===
We consider a signal ''x(t))'' and we note its sampled version ''x<sub>s</sub>(t))'' sampled at frequency ''F<sub>s</sub>''.
 
The spectrum ''X<sub>s</sub>(f)'' of the sampled signal is a periodic function of period ''F<sub>s</sub>''.
: <math>X_s(f)=\sum_k X(f-kF_s)</math>
So the sampled signal spectrum verify :
: <math>X_s(f+kF_s)=X_s(f)</math>
 
Generally the bandwidth of ''X(f))'' is lower then ''F<sub>s</sub>''/2. The infinite sum defined above exhibit no aliasing (no superposition of patterns ''X(f), X(f+F<sub>s</sub>)'' and ''X(f-F<sub>s</sub>)'') .In that case, as stated in the Nyquist theorem of sampling, the original spectrum/signal can be recovered by filtering the sampled signal.
 
When the maximum frequency of the signal spectrum do not respect Nyquist theorem, one should filter the signal with a low pass filter having a cutt-off frequency lower then ''F<sub>s</sub>''/2 before sampling: this correspond to the anti-aliasing filter used in every SDR hardware.


== Complex enveloppe, equivalent baseband signal==
== Complex enveloppe, equivalent baseband signal==
Line 120: Line 80:
Bandpass signals have no energy near 0 Hz and a spectrum located near a high frequency (generally the carrier frequency). Analog and digital AM PM and FM modulated signals are bandpass signals.
Bandpass signals have no energy near 0 Hz and a spectrum located near a high frequency (generally the carrier frequency). Analog and digital AM PM and FM modulated signals are bandpass signals.
   
   
A theorem ([[#ancre1|[1]]],[[#ancre2|[2]]],[[#ancre3|[3]]])  states that any high frequency bandpass signal having a limited bandwidth ''B'' can be represented by a baseband equivalent signal having the same bandwidth. This baseband equivalent signal also called the complex envelope is used in simulators since its allow to lower sampling rate as compare to directly sampling the bandpass signal.  
A theorem ([[#ancre1|[1]]],[[#ancre2|[2]]],[[#ancre3|[3]]])  states that any high frequency bandpass signal having a limited bandwidth ''B'' can be represented by a baseband equivalent signal having the same bandwidth. This baseband equivalent signal also called the complex envelope is used in simulators since its allow to lower sampling rate as compare to directly sampling the bandpass signal.


The equivalent baseband representation help us for the simulation of bandpass signals. At this step we need some math. We will consider a carrier modulated in phase and/or amplitude (in the sake of simplicity, Frequency modulation is not considered but it can be related to phase modulation.). Such a modulated signal ''m(t)'' and it's complex representation <math>\tilde{m}(t)</math> is :
The equivalent baseband representation help us for the simulation of bandpass signals. At this step we need some math. We will consider a carrier modulated in phase and/or amplitude (in the sake of simplicity, Frequency modulation is not considered but it can be related to phase modulation.). Such a modulated signal ''m(t)'' and it's complex representation <math>\tilde{m}(t)</math> is :
Line 129: Line 89:
For modulated signal, the complex representation is obtained by replacing the cos function by an exponent function . For a more general definition see [[#ancre1|[1]]],[[#ancre2|[2]]],[[#ancre3|[3]]] . The real signal correspond to the real part of the complex signal <math>m(t)=\text{Re}(\tilde{m}(t))</math>.  
For modulated signal, the complex representation is obtained by replacing the cos function by an exponent function . For a more general definition see [[#ancre1|[1]]],[[#ancre2|[2]]],[[#ancre3|[3]]] . The real signal correspond to the real part of the complex signal <math>m(t)=\text{Re}(\tilde{m}(t))</math>.  


[[File:IQ_complex_tutorial_EQ_BB.png|thumb|400px|AM spectrum]]
One important property of <math>\tilde{m}(t)</math> spectrum <math>\tilde{M}(f)</math> is that it has only energy in the positive frequency range and verify.
One important property of <math>\tilde{m}(t)</math> spectrum <math>\tilde{M}(f)</math> is that it has only energy in the positive frequency range and verify.


Line 144: Line 103:


== IQ modulator and demodulator==
== IQ modulator and demodulator==
[[File:IQ_complex_tutorial_IQ.png|thumb|200px|Complex signal in the IQ plane]]
[[File:IQ_complex_tutorial_IQ_Mod_Demod-crop.png|thumb|400px|ID modulator and demodulator]]
Let us now come to hardware and SDR and first rewrite the equivalent baseband signal and the modulated signal ''m(t)'' :  
Let us now come to hardware and SDR and first rewrite the equivalent baseband signal and the modulated signal ''m(t)'' :  


: <math>m^{bb}(t)=a(t) e^{j \phi(t)} =i(t) + j q(t)</math>
: <math>m^{bb}(t)=a(t) e^{j \phi(t)} =i(t) + j q(t)</math>
: <math>m(t)=\text{Re} \left[ \big(i(t)+jq(t)\big)  e^{j2\pi F_0t} \right]</math>  
: <math>m(t)=\text{Re} \left[ (i(t)+jq(t))  e^{j2\pi F_0t} \right]</math>  
: <math>m(t)=i(t) \cos(2\pi F_0t) -q(t))  \sin(2\pi F_0t)</math>
: <math>m(t)=i(t) \cos(j2\pi F_0t) -q(t))  \sin(j2\pi F_0t)</math>
 
SCHEM i(t) q(t), phase, amplitude)  
The phase ''&phi;(t)'' of the modulated signal ''m(t)'', is identical to the phase of the complex signal ''c(t)=i(t)+jq(t)''. The equivalent baseband signal ''c(t)'' is represented in a complex plane also refeered to as the IQ plane. The resulting ''m(t)'' can be any modulated in AM, PM or even FM signal. 
* <math>i(t)=a(t) \cos(\phi(t))</math>
* <math>q(t)=a(t) \sin(\phi(t))</math>


As a result, the modulated signal ''m(t)'' is the addition of :  
As a result, the modulated signal ''m(t)'' is the addition of :  
* <math>i(t) \cos(2\pi F_0t)</math> which is an AM modulated signal, the product of ''i(t)'' by a signal In phase with the carrier (i stand for In phase)
* <math>i(t) \cos(j2\pi F_0t)</math> which is an AM modulated signal, the product of ''i(t)'' by a signal In phase with the carrier (i stand for In phase)
* <math>q(t) \sin(-2\pi F_0t)</math> which is an AM modulated signal, the product of ''q(t)'' by a signal in Quadrature with the carrier (q stand for Quadrature)
* <math>q(t) \sin(-j2\pi F_0t)</math> which is an AM modulated signal, the product of ''q(t)'' by a signal in Quadrature with the carrier (q stand for Quadrature)


The corresponding hardware is called an IQ modulator. Every modern radio communication uses IQ modulator for emitting and IQ demodulator for receiving. The IQ demodulator is able to recover incoming ''i(t)'' and ''q(t)''. If the amplitude of the recovered carrier is 2, and if modulator and demodulator carrier are synchronous (same frequency and phase) the output of the IQ demodulator correspond to input ''i(t)'' and ''q(t)''.
The resulting ''m(t)'' can be any modulated in AM, PM or even FM signal. The corresponding hardware is called an IQ modulator. Every modern radio communication uses IQ modulator for emitting and IQ demodulator for receiving. The IQ demodulator is able to recover incoming ''i(t)'' and ''q(t)''.  
: <math>\hat{i}(t)=i(t) </math>
SCHEMA MID DMIQ
: <math>\hat{q}(t)=q(t) </math>
 
In real hardware, carrier are not synchronous and the receiver must compensate any phase and frequency difference between emitter and receiver. This is done using some hardware and/or software such as polyphase clock sync, and Costas loop. 


SDR Module such as USRP [https://www.ettus.com/all-products/usrp-n320/|(USRP N320 block Diagram)] and SDR Dongle [https://www.programmersought.com/article/59454592969/| (RTL-2832)] input and output are the 2 real signals ''i(t)'' and ''q(t)'' combined to form the complex signal ''i(t) + j q(t)'' which turns to be the equivalent baseband of the modulated emitted or received signal. These hardware are based on IQ modulator and IQ demodulator associated with mixers when intermediate frequency (IF) is used.
SDR Module such as USRP [https://www.ettus.com/all-products/usrp-n320/|(USRP N320 block Diagram)] and SDR Dongle [https://www.programmersought.com/article/59454592969/| (RTL-2832)] input and output are the 2 real signals ''i(t)'' and ''q(t)'' combined to form the complex signal ''i(t) + j q(t)'' which turns to be the equivalent baseband of the modulated emitted or received signal. These hardware are based on IQ modulator and IQ demodulator associated with mixers when intermediate frequency (IF) is used.


== Some examples of EqBB signals  ==
== Some examples of EqBB signals  ==
In order to get familiar with complex signal, let us consider some basic examples.
In order to get familiar with complex signal, let us consider some simple examples.
 
First, we suppose our emitter carrier is <math> \cos (2\pi F_0t)</math> so that every equivalent baseband signal will be defined according to this reference.  
   
   
=== complex envelope of a pure sine wave ===  
=== complex envelope of a pure sine wave ===  
Line 181: Line 130:
The complex envelope of the carrier itself is found for ''&Delta;f''=0  and ''&phi;''=0 which yields <math>m^{bb}(t) = A</math>. We conclude that in a GNURadio flowgraph, the carrier is represented by a continuous components, a pure DC signal ; this may seemed counter intuitive. The spectrum <math>M^{bb}(f)</math> is a single peak at ''f=0'' which can be represented using the Dirac ''&delta;(f) function (or distribution)'' : <math>M^{bb}(f)=\delta(f))</math>. Shifting this spectrum of <math>+F_0</math> towards positive frequency we get the positive part of the carrier spectrum (a peak at <math>+F_0</math>) : <math>M^+(f)=\delta(f-F_0))</math>. The negative part of the spectrum is simply obtained by symmetry of the real part (a peak at <math>-F_0</math>).  
The complex envelope of the carrier itself is found for ''&Delta;f''=0  and ''&phi;''=0 which yields <math>m^{bb}(t) = A</math>. We conclude that in a GNURadio flowgraph, the carrier is represented by a continuous components, a pure DC signal ; this may seemed counter intuitive. The spectrum <math>M^{bb}(f)</math> is a single peak at ''f=0'' which can be represented using the Dirac ''&delta;(f) function (or distribution)'' : <math>M^{bb}(f)=\delta(f))</math>. Shifting this spectrum of <math>+F_0</math> towards positive frequency we get the positive part of the carrier spectrum (a peak at <math>+F_0</math>) : <math>M^+(f)=\delta(f-F_0))</math>. The negative part of the spectrum is simply obtained by symmetry of the real part (a peak at <math>-F_0</math>).  


This can be simulated with GNURadio flowgraph [[media:IQ_tutorial_eq_bb.grc|IQ_tutorial_eq_bb.grc]]. The spectrum of our carrier is centered at 0 Hz. The Frequency sink has a feature to shift this spectrum around <math>F_0</math> which is a parameter of the sink. In a simulation, it is not necessary to represent the negative part of the spectrum since ''m(t'') being real, it spectrum is obviously symmetric.
This is simulated with this GNURadio flowgraph. The spectrum of our carrier is centered at 0 Hz. The Frequency sink has a feature to shift this spectrum around <math>F_0</math> which is a parameter of the sink. In a simulation, it is not necessary to represent the negative part of the spectrum since ''m(t'') being real, it spectrum is obviously symmetric.


We will now consider ''&Delta;f'' &ne;0 which simulate a signal not exactly synchronous to the carrier. This yieds
We will now consider ''&Delta;f'' &ne;0 which yields
: <math>m^{bb}(t) = A e^{2j\pi \Delta ft}</math>
: <math>m^{bb}(t) = A e^{2j\pi \Delta ft}</math>
The complex enveloppe is rotating vector (you can simulate this with ''&Delta;f''=1 Hz giving a vector which rotate at 60 rpm  or 1 turn per second) , its spectrum is a single peak at ''f=+&Delta;f''. This complex signal exhibits a non symmetric spectrum (no peak at ''f=-&Delta;f''). Change ''&Delta;f'' to -0.5 Hz, the vector now rotates counter clockwise at 30 rpm  or 0.5 turn per second.
The complex enveloppe is rotating vector (you can simulate this with ''&Delta;f''=1 Hz giving a vector which rotate at 60 rpm  or 1 turn per second) , its spectrum is a single peak at ''f=+&Delta;f''. This complex signal exhibits a non symmetric spectrum (no peak at ''f=-&Delta;f''). Change ''&Delta;f'' to -0.5 Hz, the vector now rotates counter clockwise at 30 rpm  or 0.5 turn per second.


Exercice:  
Exercice:  
Open flowgraph [[media:IQ_tutorial_eq_bb.grc|IQ_tutorial_eq_bb.grc]]. Parameter delta_f is set with an increment of 1/12, which correspond to 5 rotation per minute.
* Use the flowgraph to simulate a positive and a negative ''&Delta;f'' and verify the above results.
* For ''&Delta;f''=1/12=0.0833, what is the speed of rotation of the complex signal?
* Modify the flowgraph (QT GUI Range) to simulate ''&Delta;f'' larger than the sampling rate ''f<sub>s</sub>'' ranging from -2''f<sub>s</sub>'' to +2''f<sub>s</sub>''. Explain the obtained results.
* What do you observe when ''&Delta;f''=-1/12=-0.0833 ?
* Slowly increase ''&Delta;f'' to reach ''f<sub>s</sub>/2'' and observe the spectrum really has a single peak at ''&Delta;f''. Explain your observation when  ''&Delta;f>f<sub>s</sub>/2'.
* Do the same for a negative ''&Delta;f''  
* For ''&Delta;f =f<sub>s</sub>'' what is the equivelant baseband frequency. What is the carrier frequency ?
* Set ''&Delta;f''=0 and  ''&phi;''&ne;0. Discusss the simulated equivalent baseband signal.


=== AM mod demod example===
=== AM mod demod example===
This example will consider signal baseband signal ''a(t)'' modulating a carrier at F<sub>0</sub> in AM, and its demodulation. As no phase modulation in used, ''&phi;(t)''=0 and consequently ''q(t)''=0.
This example will consider signal baseband signal ''a(t)'' modulating a carrier at F<sub>0</sub> in AM, and its demodulation. As no phase modulation in used, \phi;(t)=0 and consequently ''q(t)''=0.
: <math>m(t) = a(t) \cos (2\pi (F_0t)=i(t) \cos (2\pi F_0t) -q(t) \sin (2\pi F_0t)= </math>  
: <math>m(t) = a(t) \cos (2\pi (F_0t)=i(t) \cos (2\pi F_0t) -q(t) \sin (2\pi F_0t)= </math>  
: <math>i(t) = a(t) </math>
: <math>i(t) = a(t) </math>
: <math>q(t) = 0</math>
: <math>q(t) = 0</math>


AM modulation is a special case for which the equivalent baseband complex signal has a null imaginary part and is real. Considering the schematic diagram of an IQ modulator demodulator, when ''q(t))'' is null the diagram is simplified (imaginary path is not used) yielding the well known AM modulation/demodulation scheme.
AM modulation is a special case for which the equivalent baseband complex signal has a null imaginary part and is real. Considering the schematic diagram of an IQ modulator demodulator, when ''q(t))' is null the diagram is simplified (imaginary path is not used) yielding the well known AM modulation/demodulation scheme.  
 
Remind that in GNURadio flowgraph :
* orange connections correspond to real signals (float numbers)
* blue connections correspond to complex signals (complex numbers)
 
Flowgraph [[media:IQ_tutorial_AM_TX_complex.grc|IQ_tutorial_AM_TX_complex.grc]] contains two equivalent diagram for an AM modulation with a sawtooth input:
* the upper one uses real signals. It is the exact AM modulator uses at the beginning of this tutorial.
** sampling frequency is 200 kHz, 40 times the input rate which equal 5 kHz.
** allowing a maximum carrier frequency close to 100Khz
 
[[File:AM TX complex.png|thumb|600px|AM modulator flowgraph]]
* the lower one uses an equivalent baseband representation.
** sampling frequency is 25 kHz, 5 times the input rate which equal 5 kHz.
** the sawtoooth correspond to identical generator in both modulator
** each blue input or output is the baseband equivalent of the corresponding signal in the upper AM modulator.
** the carrier frequency can be any value compatible with connected Hardware
** the carrier equivalent signal equal 1 (as stated in the previous section) so it has been disable and replaced by a complex constant
** the Hardware input is the complex equivalent baseband signal
** the carrier frequency is not needed nor used in complex blocks; excepted in the QT GUI spectrum to label the center frequency which is 0 but correspond to the ''F>sub>0</sub>''.


Three blocks are unusefull and can be removed from the lower complex modulator:
SCHEMA AM complex ET réel
* save the current flowgraph as IQ_tutorial_AM_TX_complex_2.grc.
aa
* remove the complex multiplier, the carrier equivalent baseband (complex constant=1) and the carrier complex source (the disabled one). Reconnect complex to float and throttle blocks to obtain the flowgraph sketched on the right.
Flowgraph xxx contains two transmission diagram, the upper on using real signals, the lower one using equivalent baseband signals. Both diagrams yield the same demodulated signal and spectrum: they are equivalent. However, the sampling rate used differs:
* Complex signal diagram : ''F<sub>s</sub>''=40 kHz , it must be higher than Fmax.
* Real signal diagram : ''F<sub>s</sub>''=200 Khz it must be higher than ''F<sub>0</sub>''+Fmax, which will become prohibitive if gHZ frequency carrier are used.


You can now run this flowgraph and compare signal and their spectrum in both modulator. Once again, these simulations suppose perfectly synchronous emitter and receiver carrier which is quite far from reality.
Unfortunately, these simulations suppose perfectly synchronous emitter and receiver carrier (identical frequency and phase). In real world this will never happen as will be discussed later in the tutorial.


==== Further work : construct the AM demodulator flowgraph ====
Use the flowgraph IQ_tutorial_AM_TX_complex_2.grc that you created, add blocks to perform AM demodulation and to recover the input signal ''a(t)'' from the modulated signal. You have to use the equivalent baseband representation of the demodulator.
{| class="mw-collapsible mw-collapsed wikitable"
| 1st indication &nbsp;
|-
| Remind and use the relation between ''a(t)'' and ''c(t)=i(t)+jq(t)'' given above.
|}
{| class="mw-collapsible mw-collapsed wikitable"
| 2nd indication &nbsp;
|-
| An AM demodulator extract the amplitude (magnitude) of the modulated signal...
|}
{| class="mw-collapsible mw-collapsed wikitable"
| Solution including filter &nbsp;
|-
| [[media:IQ_tutorial_AM_TX_complex_3.grc|IQ_tutorial_AM_TX_complex_3.grc]]
Running this flowgraph, demodulation is obtained taking the real part (imperfect solution), or the magnitude (good solution) of the complex signal.
* these two methods give exactly the same results
* these two methods are close to, but differ from original input signal due to the low-pass filter (only 6 peak are taken from the sawtooth spectrum, 3 for positive frequency and 3 other for negatives ones. )
* in a real system, bandpass filtering before demodulation is used. As will be shown, the lowpass filter is equivalent to a bandpass filter acting on the bandpass modulated signal
* Only taking magnitude is a good AM demodulation since it is less sensitive to frequency and phase lack of synchronism found in real systems.
|}


=== QPSK example ===
=== QPSK example ===
 
QPSK digital signal exhibit four phase state <math>\phi \in \{\pi/4, 3\pi/4, -3\pi/4, \-pi/4\}</math>.
QPSK digital signal exhibit four phase state <math>\phi \in \{\pi/4, 3\pi/4, -3\pi/4, -\pi/4 \}</math>.
: <math>m^{bb}(t)=a(t) e^{j \phi(t)} =i(t) + j q(t)</math>
: <math>m^{bb}(t)=a(t) e^{j \phi(t)} =i(t) + j q(t)</math>


Line 263: Line 164:
: <math>m^{bb}(t) \in \{1+j , -1+j , -1-j, 1-j \}</math>
: <math>m^{bb}(t) \in \{1+j , -1+j , -1-j, 1-j \}</math>


Normally, we would use a GNURadio "constellation modulator" to simulate QPSK as is done in the excellent [[Guided_Tutorial_PSK_Demodulation|Guided Tutorial on PSK Demodulation]].  
At this step, we consider unfiltered QPSK. The QPSK modulator/demodulator (complex representation) correspond to flowgraph XXX. The upper flowgraph is a classic QPSK. The constellation '' q(t)'' versus ''i(t)'') shows that this signal exhibit only the 4 phase state.  


[[File:IQ_complex_tutorial_QPSK.png|thumb|600px|QPSK modulator]]
The lower diagram is similar, however, only 3 phase states are used as shows the constellation diagram. This QPSK has not practical interest, it will be usefull for further work in this tutorial.
For the present tutorial we will simulate a QPSK without Nyquist filter in order to get phase states which can be simply displayed on a constellation sink. This is not possible with constellation modulator. Our QPSK modulator (complex representation) is build taking into account that the complex signal exhibit 4 different values, its obvious that both ''i(t)'' and ''q(t)'' have only 2 states so they are binary symmetric NRZ line codes:
: <math>i(t), q(t) \in \{+1, -1\}</math>


Flowgraph [[IQ_tutorial_QPSK.grc]] generates 2 sequences of bits, interpolates them to get 2 binary symmetric NRZ line codes. The NRZ signals are combined to create the complex equivalent baseband signal of the QPSK which can be transmitted to any SDR emitter.  
Simulating these diagrams clearly shows that the complex baseband signal spectrum is no longer symmetric as expected for complex signals. As for the previous example, this simple modulation/demodulation scheme is far from reality and we will have to investigate synchronisation later.


Simulate this flowgraph :
== Spectrum properties of signals (put that before)==
* stop the QT GUI spectrum  to observe that the complex baseband signal spectrum is no longer symmetric as expected for complex signals.
=== real signal ===
* use spectrum averaging to see that despite of the previous observation, the power spectral density (average of the magnitude spectrum) is symmetric around 0 (which correspond to ''F<sub>0</sub>'' for the modulated signal.
=== complex signal ===
* Disable the interpolating filters and enable both root raised cosine filter (the filter used in every QPSK emitter). This yields the real spectrum of a QPSK.
=== sampled signals ===


== Equivalent baseband scheme ==
== Equivalent baseband scheme ==
  This section is not yet ready... Work in progress !!
This diagram sketch a classical Tranceiver Receiver (Tx/Rx).in order to simulates this, we need a equivalent representation of
This diagram sketch a classical Emitter/Receiver (Tx/Rx) transmission including channel noise, and its equivalent baseband representation which could be used for a GNURadio simulation.
* this IQ modulator and demodulator
 
* bandpass filters
Note that complex baseband signal don't permit precise modelization of non linear effects such as intermodulation so they are not considered here. Every linear band limited system has an equivalent baseband as despicted below.
* unsynchronized receiver
* channel noise


Note that complex baseband signal don't permit to precisely modelize non linear effects such as intermodulation so they are not considered here.
=== Bandpass filter===
=== Bandpass filter===
* give the equivalent baseband representation of a bandpass filter
* explain what is a complex filter and when a filter is complex
=== Unsynchronized demodulator ===
=== Unsynchronized demodulator ===
* give the equivalent baseband representation of an unsynchronized receiver (using results obtained above)
=== Channel noise ===
=== Channel noise ===
* give the equivalent baseband representation of noise source
=== Tx/Rx baseband model ===
* explain what is a complex noise.
The following diagram is the baseband equivalent of the TX/RX given above.


== Tx/Rx QPSK : the carrier asynchronism problem ==
== E/R QPSK avec canal /synchro==
  This section is not yet ready... Work in progress !!
 
The idea of this section is to explain what is carrier asynchronism, how it can be simulated in GNURadio, and the basic mechanism to compensate it in a receiver.
 
=== GNURadio Channel model ===
* explain how carrier asynchronism is simulated with the channel model
* give a flowgraph illustrating the problem (with the QPSK used above)
* give a basic solution to compensate carrier asynchronism by muttiplying by exp(2 j pi df t)
=== GNURadio XLating filter ===
* explain the Xlating mecanism, spectrum cycling-shifted
* give a basic solution to compensate carrier asynchronism with a Xlating filter
* note that this solution is basic and not sufficient in real hardware
=== Asynchronism in real hardware ===
* give a recorded  example of unmodulated carrier emitted and received by a SDR Dongle
* try to compensate  asynchronism
* result : we need more robust block to synchronize: see PSK guided tutorial ...


==References==
==References==

Please note that all contributions to GNU Radio are considered to be released under the Creative Commons Attribution-ShareAlike (see GNU Radio:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)