Tuesday, January 13, 2009

Building the Photosynthesis Engine II

Here is a working prototype of the Photosynthesis Engine. The Engine consists of eight linked prims, scripted to qualitatively model photosynthesis. This model presented a number of challenges.

First is developing a representation of of photosynthesis that captures qualitative aspects of the process without getting bogged down in heavy model building. I chose to avoid dynamic modeling and and use very general functions to illustrate what is happening in photosynthesis.

The scripting challenge involved getting the parts of the model to talk to each other since the physical model consists of linked prims which pass data to each other. The trick was to develop a system that allows the prims to pass data using SL's llMessageLinked function to send data and the Link_message event to receive data. If you compare this version of the engine, you'll notice it has far fewer parts-important since SL does have limits on how many prims you can have. I also could simply the scripting since each prim has fewer other prims to keep track of.

The next challenge is making the way users interact with the Engine as smooth as possible and this is still being played with along with adjusting the script parameters to give more realistic output.

It is hard to see in this image but the blue horizontal object with the left and right arrows is a tunable lamp. The user can select a particular wavelength of light and "shine" it on the chloroplast to examine the relationship between light wavelength and the rate of photosynthesis. The trick here is to develop a way to represent the spectral color of a wavelength of light in SL's r,g,b color scheme The yellow and light grey boxes show the sugar and oxygen produced by the chloroplast.

The user can also change the level of carbon dioxide and water independently. Note that the user has to manually change the factor she wants to investigate..the engine is not completely automatic.

The model has a thylakoid that receives a wavelength of light from the lamp and uses its own absorption spectrum (input as a notecard) to interact with the wavelength received from the lamp. So the can gets to generate a real action spectrum. I might point out that the thylakoid's color is generated internally with a function based on the its own spectrum. So there is a fair amount of flexible scripting embedded in this innocent looking model!

More details later...

No comments: