Wednesday, 1 July 2020

21cm Radio Astronomy




The image above shows recent results from our 2m dish in Prospect looking at the 21 cm Hydrogen signal (with star positions superimposed).  It's plotted in galactic coordinates and represents data collected over a few months.  Red indicates H1 moving away from us; blue is Doppler shifted to higher frequencies as the H1 moves towards us.  Leaving the dish in a fixed position for one day gives a curved track as the Earth rotates. (For example the almost circular tracks in the slightly-lower right side arose when the antenna was close to the South Celestial Pole.  The Pointers and Southern Cross can be clearly seen near zero latitude.)     We did a talk on this project recently for AREG

Wednesday, 8 January 2020

Sun Shades to Cool the Earth?

Introduction

Given the present inadequate global response to reducing greenhouse gas (GHG) emissions, some people are considering geoengineering options to ameliorate the effects of the climate changes which we have begun to observe.  Many worry that deliberate intervention in the Earth's climate system is a bad idea since the unexpected effects could be dangerous and in addition the usual fossil fuel polluters might use this solution as a "get out of gaol" card.  The top priority should be drastic GHG reduction, but it seems prudent to explore the feasibility of geoengineering methods as backup.  Hence this page briefly reviews the idea of reducing global warming by a space-based approach of solar flux reduction.   See [1] or [2] for an introduction to geoengineering. 

Solar Flux Control 
The idea of controlling solar radiation to limit climate change effects is not new (e.g. see [3]).  Terrestrial methods of geoengineering may be cheaper, but this space-based approach has potential advantages:

  • once installed, it might be possible to adjust the attenuation fairly rapidly
  • it might offer some ability for varying the solar radiation depending on latitude.  
The figure below contains a simple 2D model of flux attenuator located near the L1 Lagrange point, a distance (L in the figure) about 1.5 million km from the Earth on the left hand side.  At this location the gravitational forces towards the Earth and the Sun are balanced, providing a pseudo-stable "parking spot".   The sun's disc is shown in the right;   it subtends an angle of about half a degree from the Earth.  We assume some type of mirror is used to block solar radiation that would otherwise fall on the Earth's surface.  (Other options such as a large thin Fresnel lens to disperse sunlight have also been proposed.)  

Fig 1:  2D Model of Solar Flux Control (not to scale) 

For realistic mirror dimensions, no part of the Earth would be fully in shadow from the mirror (i.e. the umbra doesn't extend to the earth).  An observer on Earth would not notice any change in the Sun, unless equipped with a pin-hole camera or similar. Assume that the mirror's position  can be adjusted in the vertical direction shown in Fig 1.  This allows some scope in varying the flux versus latitude on the Earth.   For example a simple evaluation using the 2D model above, with a 1000 km mirror, offset by 3000km, gives the Figure 2 reduction in flux versus position on the Earth.  In this example case the mirror is located "below" the Earth-Sun midpoint so for regions near the North Pole, no part of the Sun's disc is obstructed and the attenuation is zero.   


Fig. 2: Example of Solar Flux Reduction 
Previous studies of similar sun shades have concluded that only a few percent reduction in solar radiation might counter the GHG heating effects and have suggested mirrors of similar dimensions.  

Feasibility  
Radiation will exert a force on the mirror (solar sails use this  effect) and for (say) a 1000 km square mirror this is large (e.g. almost 8 million Newtons). However this should not pose a major problem as the structure can be placed on the Sun side of the L1 Lagrange point such that the radiation force balances the net gravitational force.  Of course second-order effects would require an active positioning system, probably provided by many small thrusters.  

The main challenge appears to be manufacture and transport of the mirror(s).  For a mirror of 1 gram per square meter, the area mentioned above requires 1 million tonnes of mirror.  Fabrication on the Earth  doesn't appear to be likely given estimates of the total mass launched into space are considerably less.   Manufacture in space seems more promising but is probably a long term project compared to the time available.  For example the moon contains a large percentage of Aluminium that might form the bulk of the reflecting material.  Some asteroids could also provide useful raw materials, such as Nickel.  If significant amounts of Aluminium could be mined and smelted on the Lunar surface, it could be used to make very thin reflecting sheets (possibly unrolled and assembled at L1) together with structural elements required for the large fleet of positioning cubesats.  Presumably the required micro-electronic components could be made on Earth, with highly automated assembly of the cubesats on the Moon and possible launch via a Space Gun

Conclusions 

Control of solar flux seems feasible but is a long term project.  All the more reason to make rapid cuts in our greenhouse gas emissions and avoid the need for these extreme measures.  


Sunday, 17 November 2019

Back to Python

This post was for year 6 and 7 students taking a short Python class in late 2019.

(For more Python, see an earlier blog post.)
Dec 3rd 

For the last lesson of this short course, let's draw a Christmas tree!  Without any graphics, we might just use the '*' symbol.   For example:

# almost a Xmas tree!! 
height = 10
for wid in range(1,10):
    print((height-wid)*' '+wid*'*') 

gives .... 
a very simple Xmas Tree


Can you understand how this program works?  Can you improve this code?  eg a better shape, add a tree trunk,  add a snowman! or snow!!  There might be a prize for the best solution.








Nov 25th
After the class today, hopefully everybody can run the Python Editor/Compiler app on their Chromebook and save files to their Google Drive - let us know if you can not do this!

Today we discussed summing integers from 1 to N in a "for loop" and we also showed the Maths trick that gives the formula N*(N+1)/2 as the summation result.   Lastly we looked at the bottom right-hand example in my handout from last week, that finds factors of a number.   eg

# find the factors of a number
num = 12
for j in range(2, num-1):
    if int(num/j) * j == num:
    print j, ' is a factor of ', num

…. 
2 is a factor of 12
3 is a factor of 12
4 is a factor of 12
6 is a factor of 12

The key statement here is the test that divides two numbers, chops off any remainder from the division, and then multiplies by the second number (the divisor) to check if the result is equal to what we started with!   If you don't follow this, just try it out, eg 


int(12/5)*5
10
int(12/4)*4

12

int(12/5)*5 == 12
False


Now, instead of using the test "int(num/j) * j == num",  how about using Python's % (remainder) operator?   For example:
12%5
2
12%4

0

OK - so try to change the code so that it uses a remainder test to check if the second number is a factor of the first number.  You might also edit the code so that it will give an extra message when there are no factors (i.e. variable "num" is a prime).   We will look at this in the next lesson.


Nov 18th
After further investigation, it seems that the best approach with Chromebooks might be to use the Python Compiler Editor app (which should now be installed on your laptops).

This app should allow Python 2 code to be edited and saved on your Google drive.  Initially you might start with a very simple program stored on my drive at this location:
https://drive.google.com/drive/folders/146FxzhtjIbP4KeEtpPEG1KX49HQwO_h4?usp=sharing

From the menu items at the bottom of the app screen, try to open the file listed above (copy and paste the long address), or you might start a new file and copy the code from below.)   Try running the code - does it work?  Do you understand how it works?  Make some changes (e.g. can you use a "for" or "while" loop to repeat the last 4 statements many times?


# maths drill
import random

n1 = random.randint(1,10)
n2 = random.randint(1,10)
prod = n1 * n2
print(str(n1)+" * "+str(n2)+" = "+str(prod))

Save the final program on your own Google drive, using the SaveAs button.  Hopefully this approach will let you edit, run and save Python programs!

If the above works, here's nice homework problem.  Please write a program to add up all the (whole) numbers from 1 to 100 and print the result.  We will discuss this next week.

Dr Bill

Monday, 20 May 2019

Climate Change: Time to Act


Surprisingly, the dangers associated with Climate Change are still poorly appreciated by the general public. Some media outlets and internet sites continue to provide little (or biased) information on this topic. This post tries to very briefly clarify why we need to take urgent action and provides links to some reliable sources.

Carbon Diode Concentration, from ice-core records and recent observations. 
Greenhouse Effects

First, let's just look at the change in CO2 concentration, say during the last 1000 years.  The recent increase to over 400 parts per million is dramatic.  Increased concentrations of this (and other) greenhouse gases since the Industrial Revolution have resulted in average temperature increases of about 1.1 degrees C.  This rise continues at about 0.2 degrees per decade.  The IPCC has recommended trying to limit the temperature rise to 1.5 degrees.  



We are already observing the effects of climate change in rainfall patterns, extreme weather events, sea-level rise, forest fires, etc and these will obviously get worse at the greenhouse gas levels rise.  IPCC points out that the effects are significantly worse when the temperature rise reaches 2 degrees.  Their models indicate that a 45% reduction in emissions is required by 2030, (from 2010 levels), to limit warming to about 1.5 degrees, with net 0% emissions by 2050.  To limit the average rise to 2 degrees requires a 25% reduction in emissions by 2030, increasing to zero emissions by 2050.  Furthermore, the general climate models can not accurately predict various tipping points that may cause abrupt worsening of global warming effects. At present it seems that some indicators of climate change(e.g. reduction in Arctic ice cover)  are developing more rapidly than IPCC models predict.  Beyond 1.5 degrees it's increasingly difficult to predict the socio-economic effects of climate change, but they are likely to be dire.   

On the present trajectory, within one generation (about 20 years) we will reach the 1.5 degree limit.  A huge effort is required in many areas, including energy generation, transport, agriculture and manufacturing, to cut greenhouse gas emissions.  Even more effort is needed if we delay.  Solutions do exist!

To quote from a recent TAI report:  
Immediate and sustained action to reduce greenhouse gas emissions is needed is to avoid the most dangerous climate impacts. The cost of action should not be exaggerated to try to distract from the large and increasing cost of inaction. 

Climate Science

I'm not a climate scientist but I understand the scientific method (e.g. my previous posts on this site).  Please understand that climate science uses exactly the same approach that characterises all our technical progress since ancient history.  Hence if (say) you use a smart phone and don't believe it works by magic, you should believe in climate science!

Useful Links 



Monday, 11 February 2019

Measuring Upper Atmosphere Radiation

Aims

Last Saturday AREG flew another high altitude balloon for the SHSSP19 program  As well as two imaging payloads using the Wenet downlink, this year we decided to measure ionising radiation during the balloon flight.  Cosmic radiation levels increase as we ascend from sea level, losing the protection of our atmosphere.  Cosmic rays (mainly high energy particles from our sun and beyond) and gamma rays (high energy photons) present significant hazards to humans (and electronics) in space.  Our experiment was designed to repeat measurements of charged particle distribution in the atmosphere first carried out by Georg Pfotzer in the 1930s.

We used two radiation detectors on the Horus-52 flight.  The RD2014 solid state (SS) detector uses a set of PIN diodes (plus amplifier and limiter) that are shielded from visible light but respond to high energy photons or particles.  This product has now been superseded  but the manufacturer has very similar modules.  A Geiger Muller tube was also used to measure ionising radiation.   This requires a high voltage power supply, but fortunately uses minimal power.

Hardware

The GM schematic is a synthesis of various circuits from the web and was fairly easy to build.  An oscillator drives the transistor used in the charge pump.  The basic operation is easy to describe. Current starts to flow through the 10 mH inductor when the transistor is turned on.  But inductors don't like sudden changes in current.  The voltage across the inductor is proportional to the derivative of the current (V = L dI/dt), so when the transistor turns off we get a large voltage spike. This turns on the first diode and current flows into the high voltage capacitor.   A couple more diodes and capacitors make a voltage doubler.  Since the regulation of this power supply is poor, a series of zener diodes are used to stabilise the voltage (before doubling).  The voltage applied to the detector is a little over 450V.

The GM tube itself is filled with an inert gas and normally acts like a good insulator.  However a high energy particle or photon ionises some gas molecules and initiates a discharge from anode to cathode.  In our circuit this small current is amplified by a transistor and allows current to flow briefly from the (raspberry pi) 3V supply to flash a LED and drive a falling edge to an IO pin of the RPI, causing a interrupt.  The solid state detector output was connected to another GPIO pin of the RPI.


 The left hand figure shows the overall arrangement.  The "radiation" payload in the upper half of the figure communicates via WiFi with the Wenet payload in the lower half.  High energy particles detected by either of the sensors are counted by the radiation RPI zero. Cumulative counts are stored locally on the uSD card, and also downlinked in the Wenet telemetry stream (with the camera images).






Software

Existing Wenet code, allowed a fairly simple python script to be used on the radiation payload to count interrupts and send the current count values each few seconds via a UDP packet.  The Wenet RPI was configured to act as a WiFi Access Point (AP), collecting these secondary payload packets for inclusion in the downlink telemetry within the amateur radio 70 cm band.   On the ground, the secondary packets can be readily extracted and stored for real-time processing and display.

The two payloads are separated by some metres on the balloon train so WiFi seemed like a good method for these boxes to communicate.  We only found late in the testing that the RPI AP software was not very reliable. In addition the Wenet RPI is already heavily loaded and the AP processing can cause the processor to overhead.  Some last-minute code (mainly from Mark, VK5QI) for AP suspension and restarting overcame these issues.





Results 


The final payload is shown on the right.  From the left, the GM tube, HT supply and RPI zero are mounted on a baseboard, with the RD2014 near the bottom edge.   Three Lithium AA cells provide power to a small up convertor, as the RD2014 needs to run at 5V and this also suits the RPI. All of this fits in a foam box to provide insulation.



The first figure below shows the results from data collected on the uSD card and recovered after Horus 52 had landed.  The blue and green plots are cumulative radiation counts from the GM tube and SS detectors respectively.  The GM tube is more sensitive (much larger number of counts), probably due to its larger area. 
























Real-Time Radiation Counts versus Altitude
PostScript:    RadioLab has a podcast in May 2019 on how an election count in Belgium was increased by 4096 due to a bit flip caused by cosmic ray. 

To understand the variations in radiation during the flight, the plots on the right show counts each 2 minute period. It can be seen that the radiation levels  vary significantly during the flight.









To get the best picture of radiation versus altitude we can use data collected in real-time during the flight.   While the stored data in the payload didn't contain any altitude information, the ground station software stored altitude readings from the Wenet GPS, as it collected radiation data packets.  This allows the radiation counts per 120 seconds to be plotted versus altitude.  Now the characteristic "Pfotzer Maximum" can be seen more clearly around 15 to 20 km.  

Friday, 3 August 2018

How Fourier Transforms Work


In a recent talk I tried to explain how Fourier Transforms can be used to estimate the frequency content of signals (ie. the spectral content).  Normally we would use maths to illustrate these concepts - but that doesn't suit everyone,  so here's an attempt with only animated images!


First let's consider a signal which contains only one frequency component.  We consider sampled signals (i.e. discrete-time signals) - the upper plot on the left shows a sin wave sampled at regular time intervals.  In fact any periodic signal can be decomposed into sinusoidal components but for simplicity we will only consider  sin waves. 









Since each sample has a magnitude and phase, in the lower left plot we show a polar version of the sample sequence.  This rotating "phasor" signal is actually a more generic representation than plotting the samples versus time.  The original signal can be recovered by taking the horizontal component of the polar diagram.  Likewise the vertical part represents another sin-wave, with 90 degrees phase difference.  (In radio models, these components are called the Inphase and Quadrature signals.)





Of course if the signal frequency is lower, the plot will show more samples per cycle (see magenta example). 

Noise has been added to the sin-wave shown on the LHS.  (In the polar plot, independent noise samples have been added in both the I and Q dimensions.)   






From now on we will drop the time-domain plots.  Our aim is to estimate the amount of each sin-wave component in a sampled signal.  Assume our input signal is shown in blue phasor samples and will be compared to 4 "references" plotted below in black.  Ref2 is twice the frequency of Ref1, the next is three times etc.   A Discrete Fourier Transform (DFT) would normally contain many more frequency references, but four is enough for this illustration.  

   
 You might notice that the blue input is the same frequency as Ref2.  How can we use the reference phasors to estimate the input spectrum?  

Assume that for each new sample, we multiply the signal magnitude by the reference magnitude (which is 1) and that we take the difference between their phases. This gives a product phasor for each new sample which will be added to the previous product (as in vector addition).  The result is shown below, with the references shown in different colours for clarity.  




On the RHS sub-plot, observe that the magenta phasor (or vector) sum grows steadily in length during the DFT.   (The phase difference between blue and magenta is zero.)   However the other product sums "curve back" on themselves and their net length is zero at the end of the DFT.  The RHS sub-plots are autoscaling so we can see the initial behaviour more clearly.  The bottom right sub-plot shows the net length of each phasor sum, during the DFT.  This shows, in more conventional plotting style, that the spectral amplitude is zero for all components except Ref2. 



If you have followed the figures above -- well done!  But is this example too contrived - what happens with noise, or if the input signal is a slightly different frequency?  On the right, we see it still works!  Now the magenta vector sum is slightly curved - but its length is still much greater that the other components.  (We say the input frequency is no longer 'bin-centred'.) 








Needless to say, I encourage you to look at the mathematical description of DFTs.  While the DFT takes a lot of numerical processing, thanks to the great work by Cooley and Tukey in the 1960's we now have the very efficient Fast Fourier Transform (FFT). This forms the basis of signal processing in many modern communications systems (and much else as well!)   

Sunday, 22 April 2018

Moving Away from Press-To-Talk?


From the start,  radio amateurs and many others have used the "press-to-talk" approach for voice communications: transmission is initiated by pressing a button,  talking continues for a period of time and then the operator invites the other party (or parties) to reply while he or she receives.  This approach is currently used for both analog and digital modes.  It allows simpler equipment and the same communication channel can be be reused for communication in either direction.  Obvious disadvantages include the inability of the receiving station to interrupt or reply during an 'over' and lack of feedback to the sender about the reception of their signal (until the next over).

Can we move away from PTT to achieve more natural methods of radio communication, say over HF channels?  Cellular systems achieve duplex operation via rapid time multiplexing, or by the use of multiple frequency allocations (TDD or FDD).  To avoid significant complexity, a time-division scheme with longer frame times could be envisaged as follows:   

  • We assume a software-defined (at least partially) approach whereby speech packets are digitised and only transmitted after the voice-activity-detector (VAD) indicates speech is present.    These packets are transmitted during an allocated period of the time frame. For example if A initiates the call, her packets could be transmitted during the first part of the frame, after which A will receive packets from B, until the end of the frame.  
  • We consider an adaptive scheme where the person who is talking the most, will get a large portion of the Tx time.  So if B is mainly listening to A, he might be allocated just the last 10% of the frame for his transmission - which is just enough for some interjections or brief comments, plus (digital) feedback on signal quality,  including how much of his speech is queued and waiting to be sent.  
  • This quasi-duplex scheme requires a cooperative approach from the operators -- they would be given an indication of how much of their speech is waiting to be sent, and how much from the other end is waiting.  Polite operators would stop talking when the other party wants to say something! 
  • What frame period should be used?  Longer frames (eg >10 seconds) could allow greater interleaving and robustness, but of course latency will become an increasing problem for two-way communications.  Short frames (eg a few seconds) will suffer a higher overhead from Tx/Rx switching, guard times, etc and need tighter synchronisation requirements.  Of course we envisage the use of source and channel coding (eg ~FreeDV) so need to avoid very short frames durations to suit these algorithms.  


Given the likely short pauses and delays in speech delivery under the scheme above it is hard to say how well it will work.  I've therefore created a small python simulation of this "ADDS" scheme (see figure below) using UDP packet transmission between two linux PCs, with sound-cards and headsets.  (ADDS stands for "adaptive delayed duplex speech".) The VAD is very simple and just checks the maximum sample amplitude in a block.  This simulation is rather basic, with no source or channel coding, using 8 bit samples, at 8 kHz.  The percentage of transmission time at each terminal can only be adjusted manually at present and while the local queue length is visible, the remote queue length is not. 





The results seem encouraging so far.  Using a frame period of 3 or 4 seconds, the pauses in conversation are obviously noticeable, but not too annoying.  On the other hand, natural speech contains silence periods.   These are not transmitted, so speech from the other end (that has been waiting) may be delivered faster than it was spoken.  The simulation code is on github.

This method would take some effort to implement over a radio channel. Frame sync could use NTP, as for other recent digital modes like WSJT.  For simplicity the frame allocations could be fixed, e.g. 50% of the frame for each party, but performance would suffer significantly.  The adaptive scheme requires the control portions of the frame to be particularly robust which will be challenging on a flaky channel.  It would be sensible to always send the control transmissions in the same part of the time frame. For example A's status and control information (including ID) could be sent in the first (say) 10% of the frame, B's status in the last 10%, with the rest allocated to speech (probably by the calling party A), as required.