# Can I Calculate the Building Compactness Ratio?

My local authority needs the 'Compactness Ratio' for my building, which is the ratio of room volume to floor area. Can I calculate this is Ecotect ?

The following script will do this for you, allowing you to calculate the ratio of zone volume to floor area. It also demonstrates the generation of a simple HTML report showing values for each thermal zone in the model, as well as summed overall values at the bottom.

```-- ------------------------------------------------
-- BUILDING COMPACTNESS CALCULATION:
-- This is a simple script that cycles through all
-- thermal zones in the current model and builds up
-- a table of the ratio between volume and floor
-- area to give a simple compactness ratio.
-- ------------------------------------------------

-- Get number of zones in the model.
zones = get("model.zones")

-- Initialise some variables.
sum_v = 0
sum_f = 0

-- Initialise the heading of a report table.
-- Using the '|' character as a column separator.
reportData = "ZONE NAME|VOLUME (V)|FLOOR AREA (A)|V/A(BCR)\n"

-- Cycle through model zones.
for z = 1, zones-1, 1 do

-- Check for a thermal zone.
if (get("zone.thermal", z)) then

-- Get volume and floor area of zone.
v = get("zone.volume", z)
f = get("zone.floorarea", z)

-- If both are greater than zero,
if (v > 0.0) and (f > 0.0) then

-- output zone data as another table line.
line = format("%s|%0.2f|%0.2f|%0.3f\n",
get("zone.name", z), v, f, f/v
)

-- Concatenate line to reportData text.
reportData = reportData .. line

-- Sum up volume and areas.
sum_v = sum_v + v
sum_f = sum_f + f

end

end

end

-- Add the totals line to the table.
line = format("OVERALL|%0.2f|%0.2f|%0.3f\n",
sum_v, sum_f, sum_f/sum_v
)

reportData = reportData .. line

-- Create a HTML report - other report types
-- include: 'text', 'box', 'html' and 'excel'.
reportOpen("html", "")

-- Adds a <H1> title line to the HTML page.

-- Adds a normal <p> line to the HTML page.
reportAddLine("The BCR is given as the ratio of"
.. " total volume over floor area for each"
.. " thermal zone within the building model."
)

-- Generates a table within the HTML page
-- using 'reportData' which contains 4 columns,
-- 1 header row and 1 footer row.
reportData, 4, 1, 1
)

-- Close and display report.
reportClose()
```

You could easily modify this script to show floor area vs exposed surface area or basically any other set of building criteria.

### Authors/Reviewers

View desktop or mobile version of site.