Code
Jump to navigation
Jump to search
Back to main page: PRE2015_3_Groep4
To the input: Input
To the output: Output
Room Brightness Control
function that calculates the brightness of sunlight based on the date/time
to-report light[day time] let psi 51.4408 ;; lat. ehv let Gsc 1367 ;; w/m2 solar constant let LC (15 * 1 - 5.4778) / 15 ;; timezone corrected longitude let c 0.21 ;; fraction of extraterrestrial sunlight that reaches ; the surface (clear weather ;; most of the following formulas are from wikipedia, they need to be verified and sourced. let Ext Gsc * (1 + 0.034 * cos(360 / 365 * (day - 2))) ;; day let theta 360 * (day - 1) / 365.242 let d 23.45 * sin(360 * (day + 10) / 365) let eqt 0.258 * cos(theta) - 7.416 * sin(theta) - 3.648 * cos(2 * theta) - 9.228 * sin(2 * theta) let w time + eqt / 60 - LC let as asin(cos((w - 12) / 24 * 360) * cos(psi) * cos(d) + sin(psi) * sin(d)) let Edv Ext * exp(- c / sin(as)) * sin(90 - as) * (max list 0 as) / as report Edv * 93;;lm/w http://physics.ucsd.edu/~tmurphy/papers/lumens-per-watt.pdf end