Friday, December 6, 2013

Convective Heat Transfer: Buildings in the Cold

Engineering Toolbox has an equation (here) for calculating a convective heat transfer coefficient:
   
where v is the wind speed in m/s and hc is in W/(m2 K).  When I first found this equation I thought that I had a way to calculate the hactual/hNW ratio more accurately than in my earlier post about "wind chill" on buildings.  As I reviewed my previous post however, I realize that this is awkward to compare.  The ratio that I would obtain using the above equation is hactual/hNW = 2.833 (this is comparing convective heat transfer with 15 mph wind versus no wind).  To see that something isn't quite copacetic, observe that if we use the equation used there, namely,

       TWC = TS – (hactual / hNW)(TS – Tactual)),

with 2.833 for the ratio and 88 °F as the skin temperature, we obtain

    TWC = 88 – (2.833)(88 – (–31)) = –249 °F,

the implausibility of which suggestion I am satisfied. Radiative heat loss may be complicating the situation. But whatever the reason, the wind chill equation makes no promises to us about its applicability to anything other than humans.

The current day wind chill index is a bit of a backward way of looking at things. Notice that it is called an index. It is not a physical quantity. It is a measure of a phenomenon. The wind doesn't make the temperature outside colder.  It does make bodies which are warmer than the air loose heat faster. But be cautious with relative terms. Something does not really loose heat "faster".  Rather, it may lose heat "faster than something else". It is more helpful (to the understanding) to say that the absence of wind results in a building loosing heat less quickly than a wind swept building.

I say this because of the way one sets up the steady state heat equations. We set the temperature of the outside of the outer air film to be equal to the ambient outdoor temperature. And we assume a small air film with R value something like 0.15 so that the outside surface of the building is not much different in temperature than the ambient air temperature. However, this neglects the affects of sunlight. In the absence of wind, sunlight has the most beneficial effect to the exterior of a building (in winter). By heating up the exterior surface of the building, the thermal gradient across the envelope is less—there is less temperature difference from inside to outside—and therefore the rate of heat loss through the envelope is reduced. The benefit of sunlight is kept in check by the convection on the outside of the building. As the exterior of the building gets warmer, the temperature difference between it and the air increases, which increases the rate of heat loss from the surface of the building.  If there is significant wind, it will mean a larger convective heat transfer coefficient (relative to no wind) and therefore raise the rate at which exterior surface loses heat, which in time reduces the temperature difference between the air and the exterior surface.

Hence, in modeling a steady state temperature loss, the coldest the outside temperature of the envelope should be modeled at is the ambient outside temperature; this is the worst case scenario. To see that this is true, notice that at this point there is no temperature difference between the ambient and the exterior surface. Considering the convective heat transfer equation, this means there is no heat transfer. Thus,

       q = hc·A·(TS - Tair) = hc·A·0 = 0,

by which observation, with some thought, you might realize that this means the outside surface is necessarily warmer than the ambient air temperature, by at least some amount. Otherwise your building would stop losing heat, which would be very efficient indeed if it was possible!

If you want to model the benefits of reduced wind conditions and sunlight, you might model the exterior temperature as being warmer than ambient.  In short, wind lessens the benefits of sunlight to the thermal performance of a building envelope, but it does not make the exterior colder than ambient.

What I am saying is that the reason why heating requirements may be higher in windier places is because the less windy places are receiving (and retaining) a greater amount of benefit from sunlight and therefore have lesser heating requirements.

If Not "Wind Chill", Then What?


If the wind chill index is not totally real (though it is fine for its intended purpose), what should we be considering? The physical quantity that really matters is called heat flux. Heat is the transfer of thermal energy (1, p. 53). Of course, when a transfer is happening, it is happening at some rate.  So you can speak of loosing or gaining heat at a rate specified in Watts, kilowatts, Btu/h, etc. Heat flux is the rate of thermal energy gain/loss per unit time and area.  Possible units of measure include W/m2 and Btu/(h ft2).

Solar radiation is often expressed in these units.  Note however, that to model the effect of the sunlight effectively requires you to determine the fractional portion of the incident radiation which is actually converted into thermal energy. You also need to scale the result by the cosine of the incidence angle (measured perpendicular to the surface normal) since a non-direct (non-normal) angle "spreads out" a given amount of radiation over a broader area.

One of the merits of working with heat flux, is that you can compare a tendency to heat loss between objects of varying surface area. A really large building might be losing heat faster than a small building even though it is better insulated. If you wanted to compare their tendency to loose heat on a kind of level playing field, you would divide the rate of heat loss by surface area.  Your result would be heat flux—actually, average heat flux.

If you want to calculate heat flux (φ), divide area out of the convective heat transfer equation:
   
(For the convective heat transfer equation, see ASHRAE Fundamentals chapter 4 or [1].)

But we have now touched on an important issue in energy efficiency: bigger isn't always better. If you can reduce your volume, you reduce the amount of stuff to heat.  (This is most pertinent in spaces with redundant air space, where the hot air rises to the top and is useful only for increasing the rate of heat loss through your roof—and when I say useful, I mean not useful.)  If you reduce your surface area, you reduce the area through which you lose heat. If you don't need big, go small. After you decide the space you really need, configure the space to reduce exterior surface area, subject of course to meeting the functional requirements of the space.

An interesting case of balancing surface area with other considerations is in solar energy greenhouses (SEGs).  A long building a few meters wide with a broad glazed wall facing south (up here in Canada) allows the building to maximize the amount of sunlight captured and stored in the north thermal mass wall. A square footprint would reduce the surface area for a given volume, but it would result in redundant air space. (Plants at the south wall would be too far from the north wall to benefit from it and the roof would need to be higher to allow the sunlight to reach the north wall.)  For more information on these greenhouses, see [2] and [3].

Sources:
1. World of Energy, Chapter 4: Transfer of Thermal Energyhttp://www.physics.ohio-state.edu/p670/textbook/Chap_4.pdf
2. Bomford, M., Solar greenhouses, Chinese-style, http://energyfarms.wordpress.com/2010/04/05/solar-greenhouses-chinese-style/, 2010
3. Love, M., The solar solution, http://www.greenhousecanada.com/content/view/1562/38/
4. Wind Energy Institute of Canada, Wind Chill Temperature Index, http://www.weican.ca/links/011101-ec-windchill-index.php
5. Engineering Toolbox, Convective Heat Transfer, http://www.engineeringtoolbox.com/convective-heat-transfer-d_430.html
6. Irvine, D., Convective Heat Transfer on a Building Envelope (Wind Chill?),  http://darrenirvine.blogspot.com/2012/12/convective-heat-transfer-on-building.html, 2012

Volume of a Tetrahedon

In this article I give a rough outline of a derivation of the volume formula for a tetrahedron, given its four vertices.

Any set of three points in 3D are co-planar. If they are not co-linear, then they uniquely define a plane. They also uniquely define a triangle. With polygons of more than three sides/vertices, you need to specify which edges are drawn and which are not.  In a program, you might imply the edges according to the ordering of the points, but the order then is a means of indicating which edges to draw. You could not simply draw all of the possible edges and get a polygon, generally. But with a triangle, you take every pairing of points and draw an edge between them.

If you add a fourth point which is not in the same plane, you now have a tetrahedron (tretra = four)—a four sided polyhedron which is uniquely defined by four points. As in the case of the triangle, you draw an edge between every pairing of points. The number of combinations of 2 points is    
and so there are 6 edges.
A tetrahedron is a special case of a slanted pyramid. The same volume formula applies, namely,
                                                          
In order to use the formula, we must pick a face to serve as the base.  We choose the face with vertices P1, P2, and P3, in the above illustration. (It doesn't matter which ones as long as you're consistent.)  We need to calculate the area of the base and find the height of the pyramid. The height is the distance from P4 to the plane defined by the base points (the measure is taken perpendicular to the plane).

First we find the area. A well known formula for finding the area of a triangle given the length of two sides, say a and b, and the included angle, say θ,  is      
(With some minor trig you can figure this out, but if you just want to see it proved, see Area of Triangles Without Right Angles [1].) The cross-product comes in handy here since
where v and u are vectors and θ is the included angle. Thus, the area is
To find the distance from P4 to the base plane, we first find the plane. The equation of a plane can be expressed in terms of a normal vector and any point on the plane. The normal vector for our plane is
and the equation of the plane is
(This is a 3D analogue to the point-slope form of the equation of a line, albeit, it also resembles the general form.)

The height from the plane to P4 is the component of the vector (P4 – P1) which is in the direction of the normal vector, namely ([2], p. 679),

This leads to the volume formula
Sources:
  1. Math is Fun, Area of Triangles Without Right Angleshttp://www.mathsisfun.com/algebra/trig-area-triangle-without-right-angle.html
  2. Stewart, J., Calculus: Early Transcendentals, 3rd Ed., Brooks/Cole Publishing Company, 1995

Wednesday, November 6, 2013

Rotation of Planar Regions: Polyhedron in AutoCAD

In a previous post about the angle between intersecting planes, I noted the importance of measuring that angle perpendicular to the line of intersection.  Now I want to apply a similar notion to the rotation of planar regions.  In CAD programs that support solid and surface modelling, it is common to support planar regions. These programs do much more complicated things as well, of course, but they will certainly allow you to make, say, a hexagonal region.  A hexagonal region is not only the outline of the hexagon, but the area enclosed by that outline, all of which lies within the same plane as the outline.  Making a planar region in AutoCAD is straightforward:
  1. Change to one of the 3D workspaces.
  2. Create any closed sequence of line work (sometimes called a closed path), all of which should be coplanar.  (While you can create a closed path that is not coplanar, it won't suit our purpose here and you can't make it into a region.)
  3. Type Region, select the line work and press .
  4. To see the region, change the visual style as necessary:
    1. Click the View tab.
    2. Click the Visual Styles button on the Palettes pane.
    3. In the Visual Styles Manager (which should pop up) choose a style that shows the faces (if/when that is desirable).  I'm partial to Shaded with edges, but other styles may be suitable.
      1. Notice also the settings under Face Settings that can affect the way the faces appear (or not appear).
But I don't just want to make planar regions, we want to do something with them.  I want to rotate them about a line of intersection/adjacency and make multiple regions "fit" together.  I'm going to make, well, you'll see...(at the end of the video in this post)...

Description of the Problem

Suppose we are given three planar regions A, B, and C, such that A is adjacent to B and B is adjacent to C, with all of the regions being initially co-planar with each other.  We want to rotate A and C about their "line of adjacency" with B so that A and C are adjacent to each other.

Informally, we might say that A and C are the box flaps and B is the base.  You may intuit the analogy I'm making.  We are pretending we have a sheet of cardboard cut out in an unusual shape with two creases in it which will serve as the fold lines – our lines of adjacency.  Note also that the proximal lines of A and C (the ones we want to be coincident) need not be of equal length to do the kind of folding/rotating we want to do, but if they are not equal we may not get the result we desire.

We are currently looking at our box flaps in plan view.  Suppose we continue observing in plan view and fold the box flaps (about B).  B is unchanged in appearance but A and C appear "squished" in one direction.  Or, another way to think of it, every point on A will appear to move perpendicularly toward its line of adjacency with B.  Likewise for C.  Thus,


If for some reason the proximal lines of A and C were not of equal length (as they are above), for purposes of our construction, we would need to establish points of equal distance from their common vertex.  A circle centered on their common vertex would do nicely.  In AutoCAD we can work in 3D to do this rotation, but first let's consider how we would do this in 2D.  This will be informative as to how to proceed in 3D.

First observe how the arrows at the end of the proximal lines of A and C cross each other.  These arrows are in plan view with z = 0, but the point where these arrows intersect gives us the xy-coordinates of the point where the non-common vertices of the proximal lines will meet.  (If that doesn't make sense, just go with the picture.)  Now to make our 2D plan view work, we've got to do some single axis scaling.  Here's what we're looking at:


We need to scale region A along the y-axis by a factor of A2/A1 and scale C along an axis perpendicular to the line of adjacency with B by a factor of C2/C1.  Since we are working with only a small number of points here, we can simply draw lines of lengths A3 and C3 and scale them as needed.  We move and copy the lines as necessary so that we can move the vertices of the polygons to their new positions based on the newly scaled lines.  (To scale A in the y direction you could turn A into a block and scale the y-axis as desired.  To scale C you could use the "block"  and scale method too, but you'd have to adjust your UCS line up with the line adjacent to B – use the ucs command with the OBject option and click the line you want to line up with.)  Here's the scaled result:


I used the scale command with the reference option so that I didn't have to do the indicated math myself, but AutoCAD did in fact compute A3(A2/A1) and likewise for C.  (Incidentally, this doesn't work so nice with regions, though it works fine with polylines; it's a simple matter of moving vertices along a line perpendicular to the line of adjacency.)  As for making the other views work for you in 2D – you're on your own, because right now I'm posting how to do this in AutoCAD (full version).

Rotating Planar Regions to Make a Polyhedron in AutoCAD


Making of a Polyhedron in AutoCAD from Darren Irvine on Vimeo.


Friday, September 6, 2013

Find Snap Tangent Points

A common feature of CAD programs is support for tangent object snaps.  A line is drawn from some point, A, toward a circle with center C and radius r.  We want to find a point (or points), B, on the circle, such that AB is tangent to the circle.

Here's a sketch of the problem:



We are given the points A and C and the radius r.  The goal is to find B1 and B2.  We argue mainly for B1. The argument for B2 is the same.  We have assumed A is outside of the circle or else there are no solutions. (If you write code for this, you will need to check for this condition.)

Since AB1 is tangent to the circle and B1C is the radius of the circle, angle AB1C is a right angle.  The distances f and from A to C, say, d, may be calculated using the pythagorean theorem.  Now, we draw the altitude of triangle AB1C to E.  By similar triangles (ΔAB1C ~ ΔB1EC~ ΔAEB1) we determine that

and

and so, e = r2/d and a = f r/d.  We let δ be the normalized direction vector from C to A, namely,


Then point E is given by E = C + e δ.  Let δp= (δy, –δx), or the clockwise 90° rotation of δ.  Then points B1 and B2 are given by:

       B1 = E + a δp
and
       B2 = E – a δp,

which are the desired points.

Snap Perpendicular Code

"Snap perpendicular" is a way certain drawing programs (like AutoCAD and DraftSight) help the user to draw a line starting from some point C and draw it up to an existing line such that the new line is perpendicular to the existing one.  What would we do without "snap perpendicular"?  The alternative, I suppose, would be to hold a set-square on the computer screen.  Or, calculate the destination point.  Of course, the aforesaid programs do just that.  And so does the Maxima code at the end of this post.

Derivation

We're given an existing line segment AB in space and a point C.  We want to find a point P on line AB such that line segment CP is perpendicular to AB.  (We won't worry about whether it is on the line segment AB, just on the line AB; we omit a "range check".)  We observe that the perpendicular distance between a point and a line is the shortest possible distance and so we will treat this as a minimization problem, using the methods of calculus.  Let A = (Ax, Ay, Az) and similar for points B and C.  Then line AB is described by the parametric equations:

      x(t) = Ax + (Bx – Ax) t,
      y(t) = Ay + (By – Ay) t,
      z(t) = Az + (Bz – Az) t,

where P(t) = (x(t), y(t), z(t)).  We want to find P(t) such that line segment CP(t) is as small as possible, which is equivalent to finding when the square of the distance is minimized.  So, we define

D(t) = (C– x(t))2 + (C– y(t))2 + (C– z(t))2
       = (Cx – Ax – (Bx – Ax) t)2 + (Cy – Ay – (By – Ay) t)2 + (Cz – Az – (Bz – Az) t)2.

Taking the derivative yields:

D'(t) = 2 (Cx – Ax – (Bx – Ax) t) (– (Bx – Ax)) + 2 (Cy – Ay – (By – Ay) t) (– (By – Ay)) +2 (Cz – Az – (Bz – Az) t) (– (Bz – Az))

We solve for t when D'(t) = 0 as follows:

0 = (Cx – Ax – (Bx – Ax) t) (Bx – Ax) + (Cy – Ay – (By – Ay) t) (By – Ay) + (Cz – Az – (Bz – Az) t) (Bz – Az)

[(Bx – Ax)2 + (By – Ay)2 +  (Bz – Az)2] t = (Cx – Ax)(Bx – Ax) + (Cy – Ay)(By – Ay) +  (Cz – Az)(Bz – Az)

t = [(Cx – Ax)(Bx – Ax) + (Cy – Ay)(By – Ay) +  (Cz – Az)(Bz – Az)]/[(Bx – Ax)2 + (By – Ay)2 +  (Bz – Az)2]
which can be stated more succinctly in terms of vector notation as
\[t = \frac{(B - A) \cdot (C-A)}{(B-A)\cdot (B-A)}\]
from whence derives the below Maxima code:



To prove that the point thus obtained is indeed the desired "Snap Perpendicular" point, it would be sufficient to show that the dot product of the vectors (A – B) and (C – P) is equal to zero, which check, I omit.

3D Analogue to the Trapezoid (part 3)

Suppose we have two parallel polygonal faces with a non-zero distance between such that, for some pairing of vertices, every consecutive pair of edges connecting the paired vertices are coplanar. It follows that the faces joining the two given parallel polygonal faces are quadrilaterals.  At first, it might not appear that this is a sufficient condition to assert that the shape thus described is a frustum of a slanted pyramid.  In this post I proceed to prove that it is.  For the volume formula of a frustum of a pyramid (slanted or otherwise), see this previous post of mine.

I term the parallel polygonal faces the end faces and the other faces as the side faces.

Proposition 1 (Transitivity of Parallel Lines).
  1. Let P be a plane and L a line parallel with P. Every line parallel with L is also parallel with P.
  2. Let L, M, N be lines. Then, if L is parallel with M and M with N, then L is parallel with N.
Proposition 2. The corresponding edges of the polygons are parallel with each other.
Fig. 1. Partial drawing of  two parallel planes.  AC is the "bottom edge" and BD is the "top edge".  AB and CD are "side edges".  Consecutive side edges are coplanar with each other.
Proof: Assume without limitation that the faces are parallel with the horizontal plane. Since the faces are parallel, the edges do not change in proximity vertically. Consider any two consecutive edges AB and CD joining the two end faces with corresponding vertices A with B and C with D. Draw line EF with E on line AC (edge of bottom face) and F on BD (edge of top face; extend BD as necessary) such that EF is perpendicular to AC. EF is coincident with the plane of quadrilateral ABDC and so is coplanar with all of its edges.
Fig. 2. We show the construction of B'D' as a line which is coincident with BD, but this is not given as a condition in the construction. That is to be proved. At construction we take neither parallelness nor coincidence with BD for granted. Because it is the same distance from AC as the point F, however, we do know there is at least an intersection between B'D' and BD at F.

Let B' and D' be points such that AB' and CD' are of length(EF), coincident with the plane of quadrilateral ABDC, and perpendicular to AC. Then AB' and CD' are parallel.

If you want to go crazy with the details to see that B'D' is parallel with AC, see the parenthetical section below. I obviously did want to go crazy. Normal people can skip ahead.

(By side-angle-side, triangle AB'C is congruent with triangle CD'A. Thus,
Also, since the non-right angles of a right triangle sum to 90°,

                                               
Thus, triangles B'AD' and D'CB' are congruent by side-angle-side. Hence,
By alternating interior angles,
Since the angles of a triangle sum to 180°,
Hence, angle B'D'C is a right angle.  By a similar argument, angle D'B'A is a right angle and so quadrilateral AB'D'C is a rectangle and thus B'D' is parallel with AC. Since F is length(EF) away from AC, in the same plane as quadrilateral AB'D'C, on the same side of AC, it is on line B'D'.)

Fig. 3. The shape we are discussing doesn't really look like this, but how do we know it doesn't look like this? How do we know Fig. 2. isn't the one that's wrong? See rest of argument below.
Assume that lines BD and B'D' are not coincident. Both are coincident with a common plane and so are coplanar. Since quadrilateral ABDC is on an angle from horizontal and BD and B'D' are not coincident, there is some point, P, on B'D' which is below BD. But point F is coincident with both BD and B'D'. Since BD is parallel with horizontal (it is part of a polygonal face which is horizontal), and B'D' has at a point on and a point below BD (points F and P, respectively), B'D' is not parallel with the horizontal plane. But, since AC is parallel with the horizontal plane, the parallel line B'D' must be parallel with the horizontal plane (Proposition 1), which is a contradiction. Thus our (limiting) assumption is wrong and lines BD and B'D' are coincident. It follows that BD is parallel with AC.■

Corollary 1. The walls of the prism are trapezoidal.

Proof: The corresponding edges of the end faces are parallel.■

Corollary 2. Every cross-section of the prism, parallel with the end faces, has corresponding edges parallel with the end faces.

Proof: Fix any cross-section parallel with the end faces and observe that the side edges are intersected by this cross-section so as to produce a polygonal face, whose vertices and edges correspond with the bottom face in the same way the top face did in the proof of Proposition 2. The same argument, therefore, applies.■

Proposition 3. The top and bottom faces are similar shapes.

Proof: It suffices to show that the interior angles at each pair of corresponding vertices are equal. Let A, B, and C be consecutive vertices of the bottom polygon and D, E, and F be the corresponding vertices of the top polygon, respectively. By Proposition 2, DE is parallel with AB and EF is parallel with BC. There exists vertices D’, E’, and F’ which are translated vertically from the top polygonal face down to the plane of the bottom polygon. By this we obtain lines D’E’ and E’F’, in the plane of the bottom polygon which are parallel with DE and EF, respectively. By Proposition 1, D’E’ is parallel with AB and E’F’ is parallel with BC. Draw a line through B and E’ to some point beyond E’, say, G (see Figure 1).
image
Figure 1. AB || D’E’ and BC || E’F’.

Then we have corresponding angles ABE' = D'E'G and CBE' = F'E'G. Thus, ABC = D'E'F'. We take for granted that the translation of DEF to D’E’F’ did not alter the angle between the lines and so we have our result.■

Corollary 3. The cross-section taken parallel with the end faces is everywhere similar to the ends.

Proof: By observing that the parallel cross-section intersects the trapezoidal walls of the prism so as to produce lines which are parallel to the base and top (Corollary 2), the argument applied for Proposition 3 applies here as well.■

Proposition 4.  The lines extended from the side edges intersect at a common point (the apex).

Proof:  Consider three consecutive vertices on the base A, B, and C, and corresponding vertices D, E, and F on an arbitrary parallel cutting plane parallel with ABC. By corollary 3,
Since AD and BE are coplanar, they intersect at some point P. Similarly, BE and CF intersect at some point Q. Assume that P ≠ Q. Take a section parallel to the base through P and label the vertices of the section which correspond to A, B, and C as D, E, and F and observe that the above proportion equation still follows from corollary 3. Also, D = E = P and so line segment DE = 0. However, since P ≠ Q, line segment EF ≠ 0, which contradicts the proportion above. Therefore, our assumption that P ≠ Q is wrong and we have P = Q. By the principle of mathematical induction, the proposition follows.  [Finding P is (i) 2 in S and establishing P = Q is (ii) the inductive step. 1 in S is either automatic or ill-defined I suppose, but irrelevant anyway.]■

The shape we have considered in this post is a frustum of a (possibly slanted) pyramid by proposition 4.

We conclude by noting that the argument for determining the volume of the frustum of a pyramid does not impose a condition that requires the top face to be centered over the bottom face. A slant does not alter the argument and therefore the result is the same. Note, of course, that the height must be measured perpendicularly to the end faces. It should be noted that we have not dealt in this post with the relationship between the cross-sectional area and the height, which relationship is needed in order to establish the volume formula.

Such proof involves 1) similar triangles, using the height of the apex as a reference, and 2) the relationship between linear dimensions and the area(s) they pertain to. Assurance of the existence of a proper apex is the critical component addressed in this post.

Thanks to one of my readers for the question at the end of a previous post that led to this post.

Saturday, July 6, 2013

Introspecting the Lisp Representation of a Maxima Variable

I recently wanted to know how Maxima (a computer algebra system) implemented something.  I searched and searched and couldn't solve my problem.  Specifically, I wanted to access a Maxima structure from within Lisp code.  However, I didn't know how the structure was implemented in Lisp and therefore didn't know how to access it.

All you need is a single line of inline Lisp:



structures is a global variable which stores the structures that have been defined in the session by using defstruct().  I wasted a few hours looking for this information to come up with 25 characters that would answer my question.  Applying the same general idea to an instance of PanelStruct() tells me how it is implemented.  By the way, the answer to my questions looks like this:



The near repeat is caused by the print function returning what it has printed and Maxima outputting it.  The $ indicates a references to a Maxima variable and the | | symbols indicate a case sensitive reference.  Oddly, the case is reversed for RDV (which is documented) but not for PanelStruct which surprises me.  (These structures are not built-in but were user-defined in my Maxima session.)

I will still need to figure out how I'm going to use the information, but I have a working concept.

Wednesday, February 6, 2013

Lighting Distribution

I've written a simple Maxima program which uses linear interpolation and lamp luminous intensity data to determine the illuminance on a flat surface (read floor or work surface) caused by several lamps in different locations.  It displays a color contour do show you how the light is distributed.  I could probably tweak some things to get a nicer selection of colors for the color contour but as far as a result which is easy to interpret, this works fine.  Behold:


Never mind the clutter in the bottom left hand corner.  This is just the z-axis numbers written on top of one another because we are looking straight down on the graph.  Small price to pay for the cool result and you can edit the picture afterward if you need something for presentation purposes.  An additional problem I observe is the aspect ratio.  It should look square because my chosen room is square (8' × 8').  Dauntless, I press on.

To implement this program with your own example you need:

  • Maxima:  a free computer algebra system.
  • Light data
  • A room and light configuration.

Light Selection
You need to select a light and find the manufacturer data.  I am using the Cooper RPN3MR-E3MRC.  This is a combination of the light fixture and the lamp in the fixture.  The data you need will indicate how the candle power changes with vertical angle.  The assumed situation is that the light is pointing down.  The vertical angle is measured between the vertical line passing through the center of the light fixture and the line drawn through the center of the fixture to a location on the floor (or incident surface).  This vertical angle affects the "amount of light" (measured in candelas) that is going in that direction.  To input the data for your luminaire-lamp combination you enter it on the line that says "lampData:".  The data is in the form of a list of lists where the nested lists (two items each) represent points.  The pattern for each point in the master list is [angle in degrees, candle power in candelas].  If your data doesn't go all the way to 90 degrees, then put a final point [90, 0] to indicate there will be no light going in that direction.

Considerations in the Calculation
The vertical angle not only affects the "amount of light" in that direction but the angle of incidence with the floor.  We are assuming the light is "facing" the floor.  (The floor is horizontal.  The light is shining straight down onto it, although, of course it "spreads out" as it goes down.)  Remembering that the "angle of incidence" is measured relative to the normal line (perpendicular to the floor), you can see that the angle of incidence is an alternating angle with the vertical angle and therefore equal to it.  An angle of incidence affects how the light "spreads out" across a surface because the same amount of light gets spread out more if the surface is at an angle (not "facing head on") to the beam of light.  Also, not every point of the floor is the same distance away from each light.  As light travels it spreads out in two directions.  If you spread the same amount of anything (sound, light, peanut butter) over a larger area, there isn't as much of it in a given area.  The basic formula is:

\[fc = \frac{cp}{d^2}\cos{\theta}\],

where
      fc = foot-candles (a measure of illuminance: cd/ft2)
      cp = candle power (candelas: cd, same unit in metric and imperial, relates to the Watt)
      d = distance (in feet)  
      θ = angle of incidence (measured from the normal).

The formula is the same if you use metric, but the units change.  Instead of entering feet and getting foot-candles, you enter meters and get lux.  You use the same lamp data which is in candelas.  Candelas are the same in metric and imperial.  To put it very simply:

lux = cd/m2
fc = cd/ft2

Using the Program
If you want metric, enter all distances in m (you will get lux).  If you want imperial, enter all distances in ft (you will get foot-candles).
  1. As always, choose a coordinate system and stick to it.  Pick a corner of your room to be (0,0) and one of the sides to be the positive x-axis.
  2. Enter the length and width of your room.  I have called these x_length and y_length to avoid misunderstandings based on the usual understanding of width < length.  Just pick a dimension to be the x direction length and one for the y direction length.  Doesn't matter which is set to which.  Just be consistent with step 1.  Sorry, only rectangles.  You're welcome to program something more interesting if you get bored some day.  Or, maybe your room can pretend to be a rectangle?
  3. Enter the locations (positions) of your luminaires.  These are in terms of [x, y, z].  I have entered the height of the luminaires for the the z value (12.5 feet).  You could instead enter their height above a work surface (the results would only be correct for the work surface).  Alternatively, you can change the Illum(x,y) function definition to use a z-value of the height of the work surface instead of 0 (same caveat as previous suggestion).


Note:  P2P_Illum() means Point-to-Point Illuminance.  Illum() is the sum of the illuminance contributions of each luminaire to a given point.

Possible Improvements to the Program
  1. Change the color selections for the plot.  Perhaps yellow for higher values.  Might be a fiddly thing to get right.
  2. Include a more explicit boundary (wall) definition mechanism.  A list of vertices would satisfy the wall definition needs.  But then some programming would need to be done to determine which lights have a line of sight to a given x,y point.  There would also be a need to either crop the end result or indicate some neutral value for places in the plot area but not within the boundaries of the room.
  3. Allow the incident surface shape to be specified.  
    • This might be as simple as allowing inputs of areas at different heights.  This would be the simplest and most widely useful approach.  It would be helpful to indicate the locations of the different surfaces on the plot as well.  It might be necessary to directly use the draw package to do this. [First, load(draw).  Then learn how to use draw.  I haven't looked much into it yet.]
    • More complex surface entry would require more complex angle of incidence calculations.  The angle of incidence would not necessarily be equal to the vertical angle.  If the incident surface (or part thereof) was represented as an analytic function of two variables, you could use the partial derivatives to determine the tangent plane and thus the direction of the normal.  Given the direction of the normal and the direction toward a given luminaire, you take the dot product of these (normalized/unit) vectors to get the cosine of the angle of incidence (which is what you need; see formula above).