Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Getting started with SIMPLE

In this chapter we will build a model of a single bedroom, simulate it for a whole year, and look at the results. Along the way you will learn the main ideas behind SIMPLE's models. The next chapter will then teach you how to operate the building (e.g., turn on a heater), which—you'll see—is a big deal in SIMPLE.

SIMPLE is used from the terminal, and its models are text files. So, you will need a text editor and a little bit of courage. I promise it is not that bad.

Installing SIMPLE

The easiest way is to download the pre-built binaries from the latest release, for macOS (Apple silicon), Linux (x86-64) or Windows (x86-64). Each archive contains a few command-line tools; the one we care about now is simple. Put it somewhere in your PATH (or just in the folder where you will be working) and check that it works:

simple --help

On macOS, the binaries are not signed. If the system refuses to open them, run xattr -d com.apple.quarantine simple.

If you'd rather build it yourself (or you are on another platform), check the README.

You will also need a weather file, in EPW format. For this chapter I'll use the one for Wellington, New Zealand, which is where I live and the reason why I care about cold homes.

The model in one paragraph

A SIMPLE model describes what the building is: its spaces, the surfaces that enclose them, what those surfaces are made of, the devices in it (heaters, luminaires), and so on. It does not describe what happens to it—temperatures, heat flows, whether the heater is on—which is the simulation state and is calculated by SIMPLE. (Separating these two is what allows SIMPLE to travel in time.)

Models are written in .spl files, which look like this:

// Comments start with two slashes...
/* ...or go between these, if they span
   multiple lines */
Space {
    name: "Bedroom",
    volume: 32.4,
}

That is: the kind of object (Space), followed by its properties between curly braces. The order of the objects in the file does not matter, and objects refer to each other by their name. The Input/Output reference lists every object and property.

Note: SIMPLE is strict. A property it does not know (e.g., a typo like volumen), a missing required property, or a name that refers to nothing (e.g., a Material made of a Substance that does not exist) are all errors. This is annoying for about five minutes, and then it saves you hours.

Our bedroom

Our bedroom is 4m wide (x), 3m deep (y) and 2.7m tall (z). It has a single window facing North—which, in Wellington, is where the sun is.

You can download the whole model, but let's go through it piece by piece.

What things are made of

SIMPLE describes materials in three steps:

  1. A Substance is what things are made of: concrete, glass, wool... It has physical properties like density and thermal conductivity.
  2. A Material is a layer of a Substance with a certain thickness (e.g., 20cm of concrete).
  3. A Construction is a stack of Materials, from the front to the back (we'll get to what front and back mean soon).
// A Substance is "what things are made of"...
Substance {
    type: "Normal",
    name: "Concrete",
    thermal_conductivity: 1.63,     // W/m.K
    density: 2400,                  // kg/m3
    specific_heat_capacity: 900.,   // J/kg.K
    front_thermal_absorbtance: 0.9,
    back_thermal_absorbtance: 0.9,
    front_solar_absorbtance: 0.7,
    back_solar_absorbtance: 0.7,
}

Substance {
    type: "Normal",
    name: "Glass",
    thermal_conductivity: 1.,
    density: 2500,
    specific_heat_capacity: 840,
    solar_transmittance: 0.8,
    front_solar_absorbtance: 0.1,
    back_solar_absorbtance: 0.1,
    front_thermal_absorbtance: 0.84,
    back_thermal_absorbtance: 0.84,
}

// ... a Material is a layer of a Substance, with a thickness...
Material {
    name: "20cm Concrete",
    substance: "Concrete",
    thickness: 0.2, // m
}

Material {
    name: "3mm Glass",
    substance: "Glass",
    thickness: 0.003,
}

// ... and a Construction is a stack of Materials (from front to back)
Construction {
    name: "Concrete Wall",
    materials: ["20cm Concrete"],
}

Construction {
    name: "Single Glazing",
    materials: ["3mm Glass"],
}

Why three steps? Because it avoids repeating ourselves. The same Substance can be used in layers of different thicknesses, and the same Material in many Constructions.

The space

A Space is a volume of air with a single temperature. Each Space becomes a thermal zone in the simulation.

Space {
    name: "Bedroom",
    volume: 32.4, // 4 x 3 x 2.7... SIMPLE does not calculate volumes (yet)
    purposes: ["Bedroom"],
}

The walls and the window

Surfaces are walls, floors, roofs and so on. Each of them has a Construction, a polygon (its vertices, as a flat list of x, y, z coordinates, in metres), and two Boundarys: what is in front of it and what is behind it.

Surface {
    name: "North Wall",
    construction: "Concrete Wall",
    // No front_boundary means the front leads outdoors
    back_boundary: { type: "Space", space: "Bedroom" },
    vertices: [
        4, 3, 2.7,
        4, 3, 0,
        0, 3, 0,
        0, 3, 2.7,
    ],
}

Fenestration {
    name: "North Window",
    construction: "Single Glazing",
    parent_surface: "North Wall", // SIMPLE makes the hole in the wall
    back_boundary: { type: "Space", space: "Bedroom" },
    vertices: [
        3, 3, 2.1,
        3, 3, 0.9,
        1, 3, 0.9,
        1, 3, 2.1,
    ],
}

A few things are worth explaining here:

  • The front of a surface is the side its normal points to, and the normal follows the right-hand rule: if the fingers of your right hand follow the vertices, your thumb points to the front. In this model, all the surfaces have their front facing out and their back facing the bedroom.
  • Boundaries say what is on each side. If none is given, the surface leads outdoors (i.e., it gets sun, wind and sky). A Space boundary connects the surface to a space. Check the Boundary reference for the others.
  • Windows and doors are Fenestrations. If you give them a parent_surface, SIMPLE cuts the hole in that surface for you. They follow the same rules as surfaces (so the window also faces North).

The other three walls are the same, just in other places:

Surface {
    name: "South Wall",
    construction: "Concrete Wall",
    back_boundary: { type: "Space", space: "Bedroom" },
    vertices: [
        0, 0, 2.7,
        0, 0, 0,
        4, 0, 0,
        4, 0, 2.7,
    ],
}

Surface {
    name: "East Wall",
    construction: "Concrete Wall",
    back_boundary: { type: "Space", space: "Bedroom" },
    vertices: [
        4, 0, 2.7,
        4, 0, 0,
        4, 3, 0,
        4, 3, 2.7,
    ],
}

Surface {
    name: "West Wall",
    construction: "Concrete Wall",
    back_boundary: { type: "Space", space: "Bedroom" },
    vertices: [
        0, 3, 2.7,
        0, 3, 0,
        0, 0, 0,
        0, 0, 2.7,
    ],
}

The floor and the ceiling

Our bedroom is in an apartment, so we will not simulate what is under it or above it. Instead, we will say that these are at a fixed temperature, using an AmbientTemperature boundary.

Surface {
    name: "Floor",
    construction: "Concrete Wall",
    // A crawl space at 12C (Ground boundaries are not supported yet)
    front_boundary: { type: "AmbientTemperature", temperature: 12 },
    back_boundary: { type: "Space", space: "Bedroom" },
    vertices: [
        4, 0, 0,
        0, 0, 0,
        0, 3, 0,
        4, 3, 0,
    ],
}

Surface {
    name: "Ceiling",
    construction: "Concrete Wall",
    // The apartment upstairs, at 18C
    front_boundary: { type: "AmbientTemperature", temperature: 18 },
    back_boundary: { type: "Space", space: "Bedroom" },
    vertices: [
        0, 3, 2.7,
        0, 0, 2.7,
        4, 0, 2.7,
        4, 3, 2.7,
    ],
}

What about the ground? There is a Ground boundary, but the thermal model does not support it yet (#152). For now, use an AmbientTemperature with your best estimate of the ground's temperature.

A heater

HVAC {
    type: "ElectricHeater",
    name: "Bedroom Heater",
    target_space: "Bedroom",
    max_heating_power: 1500, // W
    heating_setpoint: 19,    // C
}

This is an electric heater of 1500W. Hold that thought, because (spoiler alert) it will not heat anything in this chapter.

What we want to know

By default, SIMPLE reports everything it calculates: every temperature, heat flow, solar irradiance... which is a lot, even for a single bedroom. With Outputs, we can ask for specific values:

Output { SpaceDryBulbTemperature: "Bedroom" }
Output { HeatingCoolingPowerConsumption: "Bedroom Heater" }

The Output reference lists every value you can ask for.

Running the simulation

First, let's check that the model is OK, without simulating anything:

simple -i bedroom.spl --check

If nothing is printed, all is good. Otherwise, you will get an error telling you what is wrong. Now, the real thing:

simple -i bedroom.spl -w wellington.epw -o results.csv
OptionMeaning
-iThe input model (.spl or .json)
-wThe weather file (.epw)
-oWhere to write the results. If not given, they are printed on the terminal
-nThe number of timesteps per hour (from 1 to 60; 1 by default)
-cHow to control the building (see the next chapter)
-rResearch mode (see Research mode)
-sThe seed for random numbers in control scripts (see Randomness)

The simulation runs through the whole weather file, telling you what month it is in. For our bedroom, this takes less than a second.

Reading the results

results.csv is a normal CSV file you can open with Excel, Python, R, or whatever you like. It starts like this:

Date,{"SpaceDryBulbTemperature":"Bedroom"},{"HeatingCoolingPowerConsumption":"Bedroom Heater"}
01/01 - 1:00,21.298,0.000
01/01 - 2:00,20.992,0.000
01/01 - 3:00,20.551,0.000

Each column (after the date) is one of the Outputs, named the same way you asked for it. Each row is a timestep, and the date is the end of that timestep. For example, 01/01 - 1:00 is the hour between midnight and 1am. This is how EPW files (and EnergyPlus) do it too, so a year simulated at one timestep per hour has 8760 rows, from 01/01 - 1:00 to 12/31 - 24:00.

So, how did our bedroom do? Not great. In winter it gets down to 7.6°C. And the heater? It never consumed a single Watt. That is not a bug: in SIMPLE, a heater that nobody turns on does not heat. The next chapter is all about this.

Some more tricks

Translating between .spl and .json

.spl files are meant for humans. JSON files are better for machines (e.g., if you generate models with a script). SIMPLE reads both, and it can translate between them:

simple -i bedroom.spl -t bedroom.json

Saving the solar calculations

Before simulating, SIMPLE calculates how the sun and the sky reach each surface, which can take a while in bigger models. As long as the geometry and materials don't change, you can store these calculations and reuse them, with SolarOptions:

SolarOptions {
    optical_data_path: "./bedroom_optical_data.json",
}

If the file does not exist, SIMPLE calculates the data and saves it there. If it exists, it is just read. (So delete it if you change the geometry or the materials!)

SolarOptions also lets you trade accuracy for speed, and the other way around.

Where to go from here