sunset accross Europe, 4PM

I don’t remember what sparked the idea, but for some time I have been thinking about having a desktop background that showed the changing view of Earth from space; a geostationary position showing the approaching sunrise/sunset. I have seen a ‘Desktop DreamScene‘? that was something akin to what I was after, but I wanted to do this myself and slightly differently. In the end I think I ended up using the same or very similar software to achieve my effect.

Google Earth was my first port of call to source these images, but this was limited by the limited ability to take clean screenshots and inability to position the view off-centre. After more stumbling around the web I came accross NASA’s World Wind Java application. This is fantastic, the Blue Marble Next Generation images look fantastic, it is open source and can be developed in a multitude of ways and it can be scripted. The drawback is that the applet is supplied as a demo, my Java skills are virtually non-existant and after some time playing around and looking at other peoples work I had made very little progress. Then whilst watching some of the BBC Wonders of the Solar System series I began wondering what software they used to create the models. The BBC site pointed me towards Celestia. Another free offering, it has its own scripting language and lets the user explore the solar system in its known entirety.

Celestia has its own scripting language and an active user base who have generated many higher resolution image maps and other objects. I downloaded a night view and higher res day views, then created my own cloud cover png.

I adapted the scattering effect after reading a discussion about adapting night time views, I don’t know about realism, but I prefer the look offered by the following:

Atmosphere
{
Height 60
Lower [ 0.43 0.52 0.65 ]
Upper [ 0.26 0.47 0.84 ]
Sky [ 0.40 0.6 1.0 ]
Sunset [ 1.0 0.6 0.2 ]
CloudHeight 7
CloudSpeed 65
CloudMap "earth-clouds.*"
# Mie 0.001
# MieAsymmetry -0.25
# Rayleigh [ 0.001 0.0025 0.006 ]
# MieScaleHeight 12
# my old values
## Mie 0.0005
## MieAsymmetry -0.15
## Rayleigh [ 0.00025 0.0009 0.0015 ]
## Absorption [ 0.00018 0.00005 0.0 ]
## MieScaleHeight 18
Mie 0.0050
MieAsymmetry -0.35
Rayleigh [ 0.0008121 0.0020775 0.00375 ]
Absorption [ 0.00057 0.0004 0.0 ]
MieScaleHeight 15
}

There is more work to do on the night lights, I can improve on what I currently have, but I have not had any luck using the Radiance Calibrated Lights: 1996-1997 from http://www.ngdc.noaa.gov/dmsp/download_rad_cal_96-97.html. This post and this one discuss creating texture maps, but I have not managed to do it. I will stick with what I have for now.

Version 1.6.1 of Celestia will allow the user to use a url directly in a script, but for now I set the view I would like to record then run a little script. The script increments the date and time and takes a series of screenshots. In this way I captured 288 images; images from midnight to midnight for the 15th Jan, 15th Feb etc. So I get a rougly accurate seasonal variation in sunlight. If I were really keen I would work out how to use the NASA Blue Marble monthly images so the snowline moves according to the season along with the sunlight, but then since all the snow seems to be melting anyway…

I use the images on my desktop background along with a little program wot I wrote to keep the images in sync with the local time. Below is the celx script i use in celestia.
To Use the Script: Read the rest of this entry »

Advertisements

Windows 7 comes with the option of a Desktop Slideshow, point out a folder of images and then tell the OS how often to cycle through them. Fantastic I thought, I can have a day time and a night time desktop, colourful and cheery by day, more subdued and less bright for night work. Hmm, doesn’t work like that, you can sertainly cycle though images every hour, but if you put your somputer to sleep or turn it off then the day/night images soon get out of sync.

Simple (I thought), name the images systematically then write a little VBScript that gets the system time then loads the appropriate image. This is well documented on the web, the following example is from the TechRepublic website:
dim wshShell
dim sUserName

Set wshShell = WScript.CreateObject("WScript.Shell")
sUserName = wshShell.ExpandEnvironmentStrings("%USERNAME%")
Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
sWinDir = oFSO.GetSpecialFolder(0)
sWallPaper = "c:\IMGP0816.bmp"

' update in registry
oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper
' let the system know about the change
oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True

Unfortunately the user32.dll call does not work in Windows 7, the advice is to use the Win32 API instead.

So I wrote a little C++ app (my first) that uses the SystemParametersInfo API for Control Panel Settings, specifically SPI_SETDESKWALLPAPER. The source is below;


#include <windows.h>
#include <stdio.h>
#include <time.h>
#include <iostream>
#include <string>
#include <sstream>

int main()
{
SYSTEMTIME lt;
GetLocalTime(&lt);

//concatenate
std::string path = "C:\\wallpaper\\";
std::string filename;
std::stringstream sstm;
sstm << path << lt.wMonth << "_" << lt.wHour << ".jpg";
filename = sstm.str();

//Generate a null-terminated sequence of characters (c-string)
char * cstrfilename;
cstrfilename =
new char [filename.size()+1];
strcpy (cstrfilename, filename.c_str());

// cstr now contains a c-string copy of str
std::cout << "built string: " << sstm.str() << std::endl;
SystemParametersInfo( SPI_SETDESKWALLPAPER,
0, (PVOID)cstrfilename, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
return
0;
}

Compile this using MinGW and a command line like:
g++ wallpaper.cpp -o wallpaper.exe -mwindows
note -mwindows is depreacted, you should probably use “-Wl,–subsystem,windows“. This compiles the code so that no window pops up each time the litle program is run. Without this, the code is compiled as a console command and the command window will flash up each time the program is exectuted.

I have set this to run every 10 minutes, it works fine, the desktop slideshow has a smooth transition from one image to the next whereas this method simply swaps the images, but for the series of images I am using this works OK. I now have a time accurate view of the earth from space. Delighted with my fist C++ attempts, I would welcome any suggestions for tidying the code which I am sure is horrid. 2 examples from the series of desktop background images are below. I hope to write more on how I assembled these images.

The European continent around 9AM in April

sunset accross Europe, 4PM

TODO:

  • Pass the image directory as a parameter
  • Format the time string returned eg currently 4_1 to 04_01 strftime (timestamp_buf, 10,"%m_%H", localtime(&now));

route 1
route 2
route 3
route 4
route 5
Lowestoft 7 Feb 2010
Ely running routes

‘Twas a mystery to me until I read this post which describes how to mount the filesystem automatically at boot time. The VirtualBox guide says install Guest Additions, add a shared folder, boot the guest machine and enter:
sudo mount -t vboxsf -o uid=1000,gid=1000 share ~/host

To mount automatically, the VirtualBox guide continues…

“Using /etc/fstab has little effect, because that file is processed before the SF module is loaded and will fail to mount the share. Sometimes, the share does get mounted because the GA check for it when they are loaded upon boot, but it’s very flaky, meaning it doesn’t work most of the time. You’re better of with the first option.
When you put the mount command in /etc/rc.local, so it’s mounted at startup, you can’t use the short notation for your home folder. During startup, everything is done through the root user, so using ~ for home, means it’s the home folder of Root (/root). Change it to the full path.”

Here’s what I did

  • Go to the folder /etc
  • Use your favorite editor to open the file etc/modules
  • After the last line you write now vboxvfs and in the next line vboxadd. Then save save and close this file.
  • Now edit etc/fstab
  • after the last line write share ~/host vboxsf defaults 0 0

reboot the guest machine after adding the share – if you add a new share the guest will not see it until it is restarted. Having read all that I thought I’d just mount the share when it was needed, so I’ll just hang onto this post for reference.

Inspired by my brothers and thinking ‘how hard can it be?’ I decided to add car windscreen wash to a growing list of ‘home produce’. OK so I did not make the IPA, nor the surfactant, it’s still home-mixed though.

The screen wash I bought recently says it contains methanol/isoproanol, <1% non-ionic surfactant, sequestrant, parfum. This is a fairly simple shoppiong list; dentaured alcohol, a surfactant (reduce surface tension ie less smearing), a sequestrant (chelating agent presumably helps bonding onto and removing dirt?) and something smelly. Scratch the last 2.

Following a little guidance I mixed up 200ml IMS with 800ml tap water and added a tiddly dab of Decon Neutracon that happened to be lying about at work (less than 5ml, but no I shouldn’t have liberated it, mind you it has been sat there for 6 years without being used which puts the stuff beyond its shelflife, so maybe I am providing a useful testing service). It’s a pH neutral mix of anionic and ionic, but to be honest I am not that fussed, a dab of washing up liquid would probably achieve the same.

The resultant mixture is sat outside my back door at the moment with a remote temp/RH datalogger (no, that was not liberated from work). I reckon it shouldn’t freeze until – 10°C, which should be fine even in the present more-chilly-than-usual-weather . Results to follow along I hope…

Denatured alcohol is 10% methanol, 90% ethanol (pretty much).

This works out to a molar weight of 44.667 g/mol

so 200ml contains 4.48 moles

molality of the solution is: (4.48 mol alcohol / 0.8 kg) = 5.59 molal

5.59 × -1.86 (freezing point depression of water) = -10.4°C

Educational and useful, although potentially paint prejudicial.

A little engine management light (EML) came up on our car last September, its a Vauxhall Astra H (2006) 1.6L petrol. As the weather got colder I noticed that the heating wasn’t working too well either. I had always thought ‘those modern cars you can’t do anything with them it’s all computers’. Well, it turns out that much like any other computer, with the aid of the internet you can do loads.

I learnt that you can get the engine management system to tell you its error codes, there are a bunch o’ refernces to the brake pedal test:

Hold down both the brake and accelerator and turn the ignition on (but don’t start the engine), keep the pedals held down for a while and in place of your mileage the display pops up ECN followed by any stored error codes. In my case it showed 011505, appararently you remove the last 2 numbers, leaving a 4 digit code which you can look up (free registration required, some good advice in this forum, but also plenty of gimps).

This code indicaates a coolant temperature sensor error. So I tested the coolant thermostat. At 0°C the resistance was about 5kΩ and dropping as I started the engine and it warmed up. So the sensor was OK.

A little more Googling and someone suggested it was a thermostat stuck open, hence the error; the car knows the thermostat is open and so the temperature should be over 107°C, but the temperature sensor was (accurately) reporting a temperature around 50 – 70°C.

It turns out that a thermostat for a 2006 astra costs £145 +VAT from aVauxhall dealer, a bit cheaper from other sites (part no 24405922 for an 06 Astra H 1.6L), but I needed it quickly. Drain the coolant -keep it for refilling, the coolant drains from a red plastic tap drivers side, bottom of the radiator. Remove the battery (for access), disconnect a few wiring looms and connectors, remove 4 torx head bolts (one has tricky access, I needed to loosen off the manifold heat shield to get at it). The thermostat and its housing come away and replace with a new ‘un.

The EML remains lit for 30? ignition starts after the error has gone and the error code remains in the ECU memory. I was keen to clear the EML light so I knew I’d fixed the problem, I tried disconneting the battery for 4 hours to no effect. Patience won out in the end and the light went out. The error code is still in the memory.

Another handy thing I learnt was that the radio display can show you all sorts of things. With the radio turned on, hold down the Settings button until you hear a bleep. Then press the button with a circle and a dot in the middle next to the time/radio display. After I pressed this 16 times the radio display shows V:0   T:0 – velocity in km/h and coolant temperature in °C. The former handy next time I am in Europe, the latter infomring me that the engine runs around 107°C when all is well and the thermostat seems to switch at about 109°C, sending the coolant around the radiator to cool it further.

It was cold, but the feeling of satisfaction was good.

Just having a play with WordPress as a means of gathering together projects that interest me. Maybe things I have done before and am now thinking ‘where did I leave my notes on that?’ ‘ Wouldn’t it be useful if I could look that one up again’

No great revelations, just bits and bobs