# page no 703
# prob no 19.1
#calculate the level of video signals
#given
# In the given problem,a video signal has 50% of the maximum luminance level
#A black setup level of 7.5 IRE represents zero luminance,and 100 IRE is max brightness.
#Therefore the range from min to max luminnance has 100-7.5=92.5 units.
#Therefore the level is
#calculations
IRE = 7.5 + (0.5 * 92.5)
#results
print 'Level of video signals in IRE units',IRE,'IRE units'
# page no 704
# prob no 19.2
#calculate the horizontal, vertical blanking occupies
# part a) horizontal blanking
# Horizontal blanking occupies approximately 10 us of the 63.5 us duration of each line,
#given
Hztl_blnk = 10 / 63.5 * 100
#calculations and results
print 'Horizontal blanking occupies',round(Hztl_blnk,2),'%','of the signal'
# part b) vertical blanking
# Vertical blanking occupies approximately 21 lines per field or 42 lines per
# frame. A frame has 525 lines altogether,so
Vert_blnk = 42. / 525 * 100
print 'vertical blanking occupies',Vert_blnk,'%','of the signal'
# part c) active signal
# since 8% of the time is lost in vertical blanking, 92% of the time is
# involved in the tansmission of the active lines.
act_vid = (100 - Hztl_blnk) * (100 - Vert_blnk) / 100
print 'The active video is',round(act_vid,2),'%'
# page no 707
# prob no 19.3
#calculate the horizontal resolution
# A typical low-cost monochrome receiver has a video bandwidth of 3MHz
#given
B = 3.# bandwidth in MHz
#calculations
# The horizontal resolution in lines is given as
L_h = B * 80
#results
print 'The horizontal resolution in lines is',L_h,'lines'
# page no 709
# prob no 19.4
#given
#calculate the components of signal
# A RGB video signal has normalized values as
R=0.2;G=0.4;B=0.8;
#calculations and results
#The luminance signal is given as
Y=0.30*R+0.59*G+0.11*B;
print 'The luminance signal is',Y
#The in-phase component of the color signal is given as
I=0.60*R-0.28*G-0.32*B;
print 'The in-phase component of the color signal is',I
#The quadrature component of the color signal is given as
Q=0.21*R-0.52*G+0.31*B;
print 'The quadrature component of the color signal is',Q
# page no 712
# prob no 19.5
#refer table 19.1
#calculate the max transmitter power
#given
# The proportion in the table are voltage levels and have to be squared to get power.
# for black setup the voltage level is given as
#calculations
v = 0.675
#Therefore the power level as a fraction of the maximum transmitter power is
P_black_setup = v ** 2 * 100
#results
print P_black_setup,'%','of the maximum transmitter power is used to transmit a black setup'
# page no 728
# prob no 19.6
# refer fig 19.27 of the page no 729
#calculate the output and input in all cases
#given
from math import log10
# from fig, we can write down the values directly as given
In1 = 100 * 10 ** -3#expressed in mV
#calculations and results
In1_dBmV = 20 * log10(In1 / 1)
print 'The input of Amp 1 is',In1_dBmV,'dBmV'
# this above calculated signal is applied to the input of the first
# amplifier,i.e. head-end signal processing
G1 = 40# gain of Amp 1 expressed in dB
# o/p level of Amp 1 is
Out1 = In1_dBmV + G1
print 'The output of Amp 1 is',Out1,'dBmV'
L = 15#expressed in dB
# The input level of Amp 2 is
In2_dBmV = Out1 - L
print 'The input of Amp 2 is',In2_dBmV,'dBmV'
G2 = 25#gain of Amp2 expressed in dB
# o/p level of Amp 2 is
Out2 = In2_dBmV + G2
print 'The output of Amp 2 is',Out2,'dBmV'
L1 = 10# loss in cable
L2 = 12#loss in directional coupler
# The input level of Amp 3 is
In3_dBmV = Out2 - L1 - L2
print 'The input of Amp 3 is',In3_dBmV,'dBmV'
G3 = 20#gain of Amp3 expressed in dB
Out3 = In3_dBmV + G3
print 'The output of Amp 3 is',Out3,'dBmV'
# There is further 3dB cable loss and 20dB loss in the tap
L3 = 3.#loss in cable
L4 = 20.# loss in tap
#signal strength at the tap is
Vdrop_dBmV = Out3 - L3 - L4
V_drop = 10 ** (Vdrop_dBmV / 20)# expressed in mV
print 'Signal strength at subscriber tap is',round(V_drop,3),'mV'
# Calculation of power into 75 ohm
R = 75.#expressed in ohm
Pdrop = (V_drop * 10 ** -3) ** 2 / R
Pdrop_dBm = 10 * log10(Pdrop / 10 ** -3)
print 'The power at the end is',round(Pdrop_dBm,3),'dBm'
# page no 731
# prob no 19.7
#calculate bit rate and interference
#given
# In given problem a TV receiver is tuned to channel 6.
#All modern Rx uses a picture IF of 45.75 MHz with high-side injection of the signal into the cable.
# The picture carrier of channel 6 is at a frequency of 83.25MHz,so
ch = 6
Fc = 83.25# expressed in MHz
IF = 45.75#expressed in MHz
Nh = 640.
Nv = 480# resolution of digital video signal as 640*480 pixels
Rf = 30.#frame rate expressed in Hz
m = 8.# bits per sample
#calculations
f_lo = Fc + IF
a = f_lo + ch / 2
b = f_lo - ch / 2
# By using the product of Horizontal & vertical resolution, no of luminance
# pixels per frame are
Npl = Nh * Nv
# since each of the color signals has one-fourth the total no of luma pixels
Npt = 1.5 * Npl
#therefore bit rate is given as
fb = Npt * m * Rf
#results
print 'The interference would in',a,'MHz','to',b,'MHz','band'
print 'The bit rate for the signal is',fb,'bps'