# Fitting a Spatial Analysis Grid

Many people have questioned why the analysis grid produced by the 'Auto-Fit Grid' function in Ecotect leaves a gap around the edges of a room rather than covering the full extents of its floor area. There is a very good reason for this and, as it touches on some more general analysis concepts, is deserving of some detailed explanation.

## Introduction

When calculating room-averaged performance values, it is necessary to test a number of different points within the room. This is usually done with a virtual analysis grid - a set of evenly spaced points distributed over the floor area of the room.

Figure 1 - An example of a virtual analysis grid distributed throughout a space in order to calculate room average values.

As each point on the grid can be considered representative of a small section of the floor area, the area-weighted average over the whole room can be calculated by summing the values at all points in the grid and dividing by the total number of points considered. However, doing this accurately means ensuring that:

1. all parts of the floor area of the room are considered, and
2. each part contributes proportionately to the result.

By default Ecotect's own 'Auto-Fit Grid' function does this quite appropriately. If you select all the floor objects that belong to a room and choose the Auto-Fit Grid to Objects... button, Ecotect will automatically generate an evenly distributed grid over the room area, similar to the example shown in Figure 2.

Figure 2 - Ecotect's default 'Auto-Fit Grid' placement for this room.

The issue appears to be that the resultant grid leaves a gap around the outer edges of the room. A disproportionately high number of users then try to 'fix' this gap by moving the extents of the grid to the edges, thinking that some of the floor area is being missed. Such users aim to end up with the kind of grid shown in Figure 3.

Figure 3 - Some users mistakenly think they have to fit the grid right to the very edge of a room.

## Why Leave an Edge Gap?

To understand why a virtual analysis grid extended right to the edges of a room is wrong, you have to stop thinking of the grid as representing a series of small square cells. Instead, think of it as a series of grid nodes, with calculation points at the intersections of each grid line. Figure 4 shows the locations of each calculation point on the automatically generated grid as a series of small red dots.

Figure 4 - Calculations are actually done at each grid node, the intersections of each axial line.

This is pretty much exactly how data is stored for the virtual analysis grid within the model, not just in Ecotect but most analysis software. As the data at each grid node is known, interim values and contours can be linearly interpolated between each node and in each axis to present smoother visual representations. Figure 5 clearly shows where the values are known and how contour lines are interpolated and drawn between them.

Figure 5 - Storing values at grid nodes allows for accurate interpolation and contour mapping.

If the analysis grid is set up to touch the edges of the room, then there would be calculation points located hard up against each wall. This is not an area that can be easily accessed by occupants, unless they are physically leaning up against the surface, so is not particularly representative of what would likely be experienced. Also, for some kinds of performance calculations such as air-flow, internal temperature and internally reflected components of daylighting, it is possible to encounter localised boundary effects and other inaccuracies when a point is that close to a room boundary.

Whilst there are many calculations that can be performed directly on room surfaces, the idea of using the virtual analysis grid is to be able to collect spatial data and derive room-averaged values. Thus, if it is not realistic to calculate spatial values from directly on the wall surfaces themselves, then how much of a gap should you leave?

## How Much Edge Gap?

When you use the 'Auto-Fit Grid' function in Ecotect, it distributes grid points evenly over the floor area and leave a gap around the edge equal to exactly 1/2 the distance between each grid node, as illustrated in Figure 6.

Figure 6 - Ecotect's default placement leaves half a cell-width gap around the egde.

The values calculated at each grid node are considered to be representative of the average value of a small area of space centred around it, as shown in Figure 7. Obviously the higher the density of grid nodes, the smaller the space each represents and, given the physics of air-flow, light and acoustics, the more representative of that small area of space they usually are.

Figure 7 - Think of each calculation point at representing an average of the floor area centred around it.

However, the whole point of using a distributed analysis grid is that it is too prohibitive to consider absolutely every point within a space so, no matter how dense the grid, each node must represent some area.

If we extrapolate this idea over all the nodes in the grid, then each node represents an area equal in size to each grid cell, but offset by exactly half a cell width and height. Redraw the room with these representative areas mapped to the centre of each grid node, as illustrated in Figure 8, and you get full and complete coverage of the floor area.

Figure 8 - Extrapolating this over the whole grid means that the default placement fully represents the entire floor area.

## What About Uneven Grid Spacings

Simply summing up the values at each grid node and dividing by the total number of nodes gives a valid room average only if the grid nodes are evenly spaced in each axial direction. If you use an uneven grid, then you must account for the relative size of the representative areas around each node.

Figure 9 is an example of an unevenly spaced grid within the test room. It clearly shows that even a small number of size changes in each axis can result in several different cell sizes of cell. Not using an area-weighted average calculation would given undue influence over the result to the area, in plan, towards the bottom-right corner of the room where the grid nodes are much denser than nearer the top.

Figure 9 - Even a small number of changes in dimension along each axis can result in many different sized cells.

Accounting for different sized representative areas is done using an area-weighted average algorithm. This requires you to calculate the distance between the mid-points of each grid cell in each direction to get the width and height of each area. Multiplying the width and height gives each grid node's relative representative area. In Figure 10, representative area of the left-top node would be `x1*y1` whereas the right-top would be `x2*y1`.

Figure 10 - To ensure proportionate influence, unevenly spaced grids require calculation of the size of each node's representative area.

Given the size of each nodes representative area (`dx` x `dy`), the room average value is calculated by summing the values at each node multiplied by the representative area, and then dividing the total by the sum of the all the representative areas. Figure 10 shows this equation in mathmatical form.

Figure 10 - Equation for calculating the area-weighted average.

## Summary

It is important to understand exactly where calculation points are located relative to any analysis grid when you are going to use it to calculate room-averaged values. If, as in Ecotect, calculation points align with each grid node, then it is necessary to leave an edge gap equal to half a cell width and height in order to properly represent the entire floor area. This is best done in Ecotect using the 'Auto-Fit Grid' function, though you can do it manually.

If you have an uneven grid spacing, then you must use an area-weighted average calculation across the room and not simply count up the number of grid nodes.