from math import *
#Christmas tree light calculator
#Conditions
dis_to_tree = 10 #meters
hight_tree = 1.8 #meters
width_tree = 1.0 #meter
#Lights
mini_lights = 0.5 #watts/bulb
LED = 0.07 #watts/bulb
#Viewing arcs (vertical)
xV = sqrt((pow((hight_tree/2),2))+pow(dis_to_tree,2)-2*(hight_tree/2)*dis_to_tree*cos(radians(90))) #distance from viewer to top of tree
Half_v = degrees(asin((sin(radians(90))*hight_tree)/xV))
vArcs = (Half_v*2)*60
#Viewing arcs (horizontal)
xH = sqrt((pow((width_tree/2),2))+pow(dis_to_tree,2)-2*(hight_tree/2)*dis_to_tree*cos(radians(90))) #distance from viewer to furthest edge of tree
Half_h = degrees(asin((sin(radians(90))*width_tree)/xH))
hArcs = (Half_h*2)*60
#total number
total_arcs = vArcs*hArcs
cm2 = (width_tree*100)*(hight_tree*100)
density = total_arcs/cm2
print "Density of lights/cm2 resolvable"
print density #number of cm2
print ""
#total power
incandecent = (mini_lights*total_arcs)*2 #x2 to cover both sides of tree
led = (LED*total_arcs)*2 #x2 to cover both sides of tree
print "Incandescent bulbs (total watts)"
print incandecent
print ""
print "LED bulbs (total watts) "
print led
print ""
#Lumens
Lumens_I = ((incandecent/2)/100*1)*15
Lumens_L = ((led/2)/100*7)*50
print "Total Lumens (incandecent)"
print Lumens_I
print""
print "Total Lumens (led)"
print Lumens_L
print ""
#Calculate the temperature of the tree from the jouls
SPHC = 4.18 #specific heat capacity of water in J/g/C)
mass = 25000
watts_I = (((incandecent)/100)*90)/2 #divided by 2 as only half the heat is directed inwards
J_I = watts_I*60 #joules per minute
deltaI = (J_I/(mass*SPHC)) #temperature change per minute
print "Incadencent Bulbs - Change in degrees celcius per min"
print deltaI
print ""
watts_L = (((led)/100)*75)/2 #divided by 2 as only half the heat is directed inwards
J_L = watts_L*60 #joules per minute
deltaL = (J_L/(mass*SPHC)) #temperature change per minute
print "LED Bulbs - Change in degrees celcius per min"
print deltaL
print ""
#