Archive site for Autodesk Ecotect Analysis educational resources, notes and tutorials

Script example 02


This script demonstates the generation of a simple HTML report table showing the ratio of zone volume to floor area. This ratio is sometimes used as a measure of a building's compactness ratio. It displays a line in the table for each thermal zone in the model as well as summed overall values at the bottom.

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

Script Contents (Lang: lua)

-- ------------------------------------------------
-- 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\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("", 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




-- 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.
reportAddLine("Compactness Ratio Report", "h1");

-- 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.
reportAddTable("Building Compactness Ratio (BCR)", 
  reportData, 4, 1, 1

-- Close and display report.


No votes yet


User login

Translate Site To: