# -*- coding: utf-8 -*-
"""
Created on Sat Dec 09 13:11:31 2017
@author: Monstein
"""
import numpy as np
print ('\nSolution based on basic SI-units:\n')
# Given:
S1 = 1.0e-26 # 1 Jansky source flux density expressed in W/m^2/Hz
T1 = 60.0 # observation time 1 minute
Aeff = 3927.0 # effective ara of a 100 m parabolic dish expressed in m^2
bw = 500.0e6 # band width expressed in Hz
S2 = 40.0e-26 # 40 Jansky source flux density expressed in W/m^2/Hz
T2 = 3600*24*365*40 # one year expressed in seconds
g = 9.80665 # gravitational acceleration on earth expressed in m/s^2
m = 0.01 # mass of a pencil expressd in kg
# Solutions:
Pfd = S1 * bw
print ('(1) Power flux density = {:.1e} W/m^2'.format(Pfd))
print ('(1) Power flux density = {:.1f} dB [mW/m^2]'.format(10*np.log10(Pfd)))
P = Pfd * Aeff
print ('\n(2) Power received = {:.1e} W'.format(P))
print ('(2) Power received = {:.1f} dB [mW]'.format(10*np.log10(P)))
W1 = P*T1
print ('\n(3) Energy received in 1 minute= {:.1e} J'.format(W1))
W2 = S2*bw*Aeff*T2
print ('\n(4) Energy received in 40 years= {:.1e} J'.format(W2))
h = W2/(m*g)
print ('\n(5) Lifting height of a 10g pencil= {:.1e} m'.format(h))
print ('(5) Lifting height of a 10g pencil= {:3.1f} cm'.format(100*h))