Sunday 22 August 2010

Energy budget meter progress

The energy budget meter for the simulator is coming along fine and I now have the data being produced that can be used to move the graphic meter indicator.

The code took a while to get correct and it works on the basis of buffering a count of the incoming and outgoing photons from a fixed number of cycles of simulator activity, then calculating a rolling average on each cycle of the simulator. This means that there is a lag between the meter output and the actual simulator activity, but the numbers produced look good and reflect what is happening.

Because the current sim has a fixed rate for incoming sunlight energy, once the buffer is full, the data for incoming energy remains static (unless the day/night cycle is activated!). So, when in the 'always day' mode, the outgoing energy will fluctuate between being greater or less than the incoming energy.

Example scenario:
Starting with the ice extent set at a minimum and allowing the energy to build up so that outgoing is about the same as incoming. Then increase the ice extent, this will cause the outgoing energy to be greater than the incoming energy, showing the sim planet to be cooling. The cooling will continue until a new balance is reached in the atmosphere. The meter will show all this activity.

Anyway now I just need to produce the graphics and do the coding to control the meter!

No comments: