Monday, January 25, 2010

Exercise 2

The objective of this exercise is to do a sketch design for an office building. The criteria are as follows:

The Site
  • The plot is 85m x 170m, rotated at 45 deg, with the long axis in the NW - SE direction
  • The site is surrounded on all sides by category 3/4/5  roads, with no other surrounding structures
  • The site is somewhere in Singapore
The Developmental Constraints
The Evaluation Criteria
  • Maximise daylight autonomy
    Using EnergyPlus, see 'Daylighting:Controls'
  • Minimise cooling load
    Using EnergyPlus, see 'ZoneHVAC:IdealLoadAirSystem'
  • Maximise lettable floor area

Friday, January 22, 2010

BIG | Bjarke Ingels Group

BIG is coming to town! - this coming Friday January 29th, 2010 at 4pm LR 423 speaking on “Yes is More”. RSVP by 27 Jan 2010 to Clara at akicwkm@nus.edu.sg

Thursday, January 21, 2010

Custom Python operators

Here is the script that we did today:

# Get the data
this_node_obj = hou.node(".") #this is the same as hou.pwd()
geom_obj = this_node_obj.geometry()
points_list = geom_obj.points()

# Find the average
average = [0,0,0]
for point_obj in points_list:
    average[0] = average[0] + point_obj.position()[0] # could use +=
    average[1] = average[1] + point_obj.position()[1]
    average[2] = average[2] + point_obj.position()[2]
num = len(points_list)
average = [average[0] / num, average[1] / num, average[2] / num]

# Save the data
new_point_obj = geom_obj.createPoint()
new_point_obj.setPosition(average)

Monday, January 18, 2010

Houdini Python parameter expressions

When scripting in Houdini, there are two languages that you can use. The old scripting language is called hscript, and the new one (gradually replacing hscript) is Python. When scripting in Python, there are many different places where you can insert Python scripts - the two most important are:
  • Parameter expressions: these are Python scripts inside the parameter input fields. You can right click on an input filed, and select Expressions > Edit Expressions. You need to make sure that your scripting language is set to Python. These scripts are saved as part of you Houdini model, in you .hip (or .hipnc) file.
  • Python operators: these are custom nodes implemented from scratch in Python. These are saved in .otl files, and can be used the same way as the built in nodes.

In yesterdays workshop, we focused on parameter expressions, and we wrote some expressions to find the average of a set of input points. Here is the script:
# Get the data
this_node = hou.node(".")
inputs = this_node.inputs()
first_input = inputs[0]
input_geometry = first_input.geometry()
points = input_geometry.points()

# Loop through add add up all the points
x = 0
for point in points:
    point_pos = point.position()
    x += point_pos[0]

# Divide the values by the number of points
num_points = len(points)
x = x / num_points

# Return the value
return x
The Houdini functions and classes are all in the hou module. When scripting in Houdini, the hou module is imported automatically, so there is no need to have 'import hou' in your scripts. The key ones to loo at from todays sessions are the following:
In order to better understand what is going when using the Houdini classes above, review Python classes in one of the tutorials. For example, in the Instant Hacking  tutorial , scroll down to the last section "More Abstraction — Objects and Object-Oriented Programming". This gives a quick explanation of classes.

    Friday, January 15, 2010

    Python Introduction

    I am doing a Introduction to Python workshop on monday morning 10am to 1pm.

    This is mainly for the people who missed thePython workshops in week zero. However, for those who think they need a refresher, you can also come.

    Please make sure that you have done these two tutorials before Monday morning:

    Wednesday, January 13, 2010

    Semester Schedule

    •  Week 1 Mon 11 Jan: Studio intro, followed by Houdini intro
    Exercise: Flying object
    • Week 1 Thu 14 Jan: Houdini workshop
    • Week 2 Mon 18 Jan: Houdini workshop
    • Week 2 Thu 21 Jan: Houdini workshop
    • Week 3 Mon 25 Jan: Presentation of exercise 1
    Exercise: A room
    • Week 3 Thu 27 Jan: Tutorials
    • Week 4 Mon 01 Feb: Tutorials
    • Week 4 Thu 04 Feb: Tutorials
    • Week 5 Mon 08 Feb: Presentation of exercise 2
    Project: design site and design brief
    • Week 5 Thu 11 Feb: Introduction to design site and brief, followed by site visit
    Recess week and non-studio week:
    •  Recess week Mon 15 Feb
    •  Recess week Thu 18 Feb
    • Week 6 Mon 22 Feb: Non-studio week
    • Week 6 Thu 25 Feb: Non-studio week
    Project: the design idea:
    • Week 7 Mon 01 Mar: Tutorials
    • Week 7 Thu 04 Mar: Tutorials
    • Week 8 Mon 08 Mar: Presentation (Interim crit 1)
    Project: iterative design process:
    • Week 8 Thu 11 Mar: Tutorials
    • Week 9 Mon 15 Mar: Tutorials
    • Week 9 Thu 18 Mar: Tutorials
    • Week 10 Mon 22 Mar: Tutorials
    • Week 10 Thu 25 Mar: Tutorials
    • Week 11 Mon 29 Mar: Presentation (Interim crit 2)
    Project: presentation production 
    • Week 11 Thu 01 Apr: Tutorials
    • Week 12 Mon 05 Apr: Drawing up
    • Week 12 Thu 081 Apr: Drawing up
    Hand in
    • Week 13 Tue 13 Apr: Drawing Submission & Pin up 3pm to 4pm
    • Week 13 Wed 14 Apr: Model Submission 3pm to 4pm
    • Week 13 Thu 15 Apr: Crit Session
    • Week 13 Fri 16 Apr: Crit Session

    Exercise 1: Flying Object

    The first exercise is an Iterative Physical Prototyping exercise. The aim of this exercise is to investigate the iterative design process using non-digital tools and techniques on a highly simplified design problem.

    The problem is as follows:
    • Design a flying object made of A4 paper. Your design must start with your core idea or concept for the design. This is your creative leap, a moment where past experience and intuition result in some new possibilities... Note that the flying object does not necessarily need to be a plane. It can be like a floating object, or it can spin as you drop it,... Some seeds float in the wind in interesting ways.
    • Create a developmental diagram for the design. This diagram should specify parameters that can be vary within a certain range. Different designs can then be generated by specifying different values for the parameters.
    • Create a evaluation diagram for the design. The evaluation diagram will specify certain performance criteria. These performance criteria can then be used to calculate the fitness of the design relative to other designs. Possible performance criteria could be distance travelled, time in the air, number of loops, maximum height, ... etc.
    Once you have created your diagrams, you then need to start the process of generating and testing different design variants. After a while you may find that your original idea is not working so well, and that you have some new ideas. In such a case, you can update the diagrams, and then start generating and testing new variants.

    The deadline for this exercise is Monday 25th January. This is a group exercise - so get into groups of 2 or 3. Your final presentation should focus on the process - so we want to see a series of diagrams, and for each diagram, a set of variants. Try and map out what happened, and why you made certain decisions.

    Another aspect of this exercise is to start practicing generating clear diagrams. The diagrams need to be as clear and simple as possible. I.e.  - there should be nothing on the diagram that is superfluous. The best way to learn these type of graphic skills is to copy other people - look at other diagrams such as origami. Also, some architects also use diagrams in an interesting way - e.g. look at BIG | Bjarke Ingels Group

    Tuesday, January 12, 2010

    Some light reading

    To get you into the right frame of mind, it may be useful to read the AD issue, called 'Programming Cultures'. It is accessible here:

    Monday, January 11, 2010

    Houdini Modelling 101 v2

    I have created an introduction to modelling with Houdini for beginners. This is version 2, and I will update it every now and then. There will also be an introductio to Houdini Scripting coming soon.
    This intro is to be used in conjunction with the videos available on line - not as a replacement. The intro focuses mainly on the concepts you need to get started with Houdini. It does not teach you in detail where to click and how to use specific tools.

    Friday, January 8, 2010

    Python and EnergyPlus

    Here is the script from todays session. This script generates the IDF input file for EnergyPlus. Note that this script requires a base file, i.e. rather than generating the whole IDF file, the script only generates the surfaces and appends these to the base file. To run this script, you will have to make the base file - just open 1ZoneEvapCooler.idf, save it as base.idf, and delete all the BuildingSurface objects in this file.

    #======================================================================
    # Imports
    #======================================================================
    
    
    #======================================================================
    # Functions
    #======================================================================
    #Function to write a ep surface
    def write_ep_surface(
        idf_file, name, srf_type,
        const,zone,boundry,boundry_obj,
        sun_exp,wind_exp,view_fact,
        points):
    
        idf_file.write("! Building Surface\n")
        idf_file.write("BuildingSurface:Detailed,\n")
        idf_file.write("  "+name+",\n")
        idf_file.write("  "+srf_type+",\n")
        idf_file.write("  "+const+",\n")
        idf_file.write("  "+zone+",\n")
        idf_file.write("  "+boundry+",\n")    
        idf_file.write("  "+boundry_obj+",\n")
        idf_file.write("  "+sun_exp+",\n")
        idf_file.write("  "+wind_exp+",\n")   
        idf_file.write("  "+view_fact+",\n")
        idf_file.write("  "+str(len(points))+",\n")
        for counter in range(len(points)):
            point = points[counter]
            text_point = str(point[0])+","+str(point[1])+","+str(point[2])
            if counter < len(points)-1:
                idf_file.write("  "+text_point+",\n" )
            else:
                idf_file.write("  "+text_point+";\n\n" )
        
    #======================================================================
    # Main Script
    #======================================================================
    # Create a simple box
    box = (
        (0,0,0),(15,0,0),(15,15,0),(0,15,0),
        (0,0,10),(15,0,10),(15,15,10),(0,15,10),    
        )
    
    floor_points = (box[3], box[2], box[1], box[0])
    wall1_points = (box[1], box[5], box[4], box[0])
    wall2_points = (box[2], box[6], box[5], box[1])
    wall3_points = (box[3], box[7], box[6], box[2])
    wall4_points = (box[0], box[4], box[7], box[3])
    roof_points = (box[4], box[5], box[6], box[7])
    
    #Create the idf file
    idf_file_1 = open("D:/box.idf", "w")
    base_file = open("D:/base.idf", "r")
    base_stuff = base_file.read()
    idf_file_1.write(base_stuff)
    idf_file_1.write("!- ========================= \n\n\n")
    
    # Add the surfaces
    write_ep_surface(idf_file_1,
                     "zn001:floor", "Floor", "FLOOR", "Main Zone", "Surface",
                     "zn001:floor", "NoSun", "NoWind", "1.00", floor_points)
    write_ep_surface(idf_file_1,
                     "zn001:wall1", "Wall", "R13WALL", "Main Zone", "Outdoors",
                     "", "SunExposed", "WindExposed", "0.50", wall1_points)
    write_ep_surface(idf_file_1,
                     "zn001:wall2", "Wall", "R13WALL", "Main Zone", "Outdoors",
                     "", "SunExposed", "WindExposed", "0.50", wall2_points)
    write_ep_surface(idf_file_1,
                     "zn001:wall3", "Wall", "R13WALL", "Main Zone", "Outdoors",
                     "", "SunExposed", "WindExposed", "0.50", wall3_points)
    write_ep_surface(idf_file_1,
                     "zn001:wall4", "Wall", "R13WALL", "Main Zone", "Outdoors",
                     "", "SunExposed", "WindExposed", "0.50", wall4_points)
    write_ep_surface(idf_file_1,
                     "zn001:roof", "Roof", "ROOF31", "Main Zone", "Outdoors",
                     "", "SunExposed", "WindExposed", "0.00", roof_points)
    #Close the file
    idf_file_1.close()
    base_file.close()
    
    

    Two ways of looping

    Here are two ways of looping...
    Lets say you have a list like this:
    x = ("a", "b", "c", "d")
    
    One way to loop through the list is like this:
    for item in x:
        print "item = ", item
    
    Another way of looping is like this:
    for counter in range(len(x)):
        print "item = ", x[counter]
    

    Thursday, January 7, 2010

    Python and Radiance

    Here is the script from todays session:
    #======================================================================
    # Imports
    #======================================================================
    import os
    import random
    
    #======================================================================
    # Functions
    #======================================================================
    #Function to write a light
    def write_material_light(rad_file, name, rgb_e):
        rad_file.write("# Light material\n")
        rad_file.write("void light " + name + "\n")
        rad_file.write("0\n")
        rad_file.write("0\n")
        rad_file.write("3 " +
                   str(rgb_e[0])+ " "  +
                   str(rgb_e[1]) + " " +
                   str(rgb_e[2]) + " " + "\n\n")
    
    def write_material_plastic(rad_file, name, rgb, spec, rough):
        rad_file.write("# Plastic material\n")
        rad_file.write("void plastic " + name + "\n")
        rad_file.write("0\n")
        rad_file.write("0\n")
        rad_file.write("5 " +
                   str(rgb[0])+ " "  +
                   str(rgb[1]) + " " +
                   str(rgb[2]) + " " +
                   str(spec) + " " +
                   str(rough) + "\n\n")
    
    def write_surf_sphere(rad_file, name, material, position, radius):
        rad_file.write("# Sphere \n")
        rad_file.write(material + " sphere " + name + "\n")
        rad_file.write("0\n")
        rad_file.write("0\n")
        rad_file.write("4 " +
                   str(position[0])+ " "  +
                   str(position[1]) + " " +
                   str(position[2]) + " " +
                   str(radius) + "\n\n")
    #======================================================================
    # Main script
    #======================================================================
    
    #Create the scene file
    rad_file_1 = open("D:/scene.rad", "w")
    
    write_material_light( rad_file_1, "mat_light_1", (100, 100, 100))
    write_material_plastic( rad_file_1, "mat_red", (0.7, 0.05, 0.05), 0.05, 0.05)
    
    for i in range(2):
        position = (random.random() * 5, random.random() * 5, random.random() * 5)
        radius = random.random()
        write_surf_sphere(rad_file_1, "light_"+str(i), "mat_light_1", position, radius)
    
    for i in range(20):
        position = (random.random() * 5, random.random() * 5, random.random() * 5)
        radius = random.random()    
        write_surf_sphere(rad_file_1, "ball_"+str(i), "mat_red", position, radius)
    
    rad_file_1.close()
    
    #Run radiance using oconv and rpict
    
    #os.system("C:/Radiance/bin/oconv D:/scene.rad > D:/scene.oct")
    #os.system("C:/Radiance/bin/rpict -vp 10 10 10 -vd -10 -10 -10 -av .5 .5 .5 D:/scene.oct > D:/scene.pic")
    
    #Run radiance using rad
    
    rif_file_1 = open("D:/scene.rif", "w")
    rif_file_1.write("ZONE = I  0 5 0 5 0 5\n")
    rif_file_1.write("scene = D:/scene.rad\n")
    rif_file_1.close()
    
    os.system("C:/Radiance/bin/rad D:/scene.rif")
    

    Wednesday, January 6, 2010

    Python functions

    Here is the example of creating a Python function from todays workshop:
    rec1 = [20,2]
    rec2 = [24,9]
    rec3 = [6,2]
    
    def area(rec):
        area = rec[0] * rec[1]
        print(area)
        return area
    
    area1 = area(rec1)
    area2 = area(rec2)
    area3 = area(rec3)
    
    print("===")
    
    print(area1)
    print(area2)
    print(area3)
    

    Tuesday, January 5, 2010

    Learning Python

    Python is the scripting language we will be using.  You can download Python for free and install it on your own computer. We will be using version 2.5.4

    There is lots of online help for Python.There is a list of the most popular tutorials for beginners, and here are a few good ones:
    The standard Python docs are also useful. Although we are using version 2.5, we will use the documentation for 2.6. The 2.6 docs are formatted in a better way, so it makes our life easier:

    Monday, January 4, 2010

    Houdini

    The version of Houdini we will be using is the apprentice version 10.0.

    The installation is straightforward - just download and keep clicking Next. The best way to get started with Houdini is through the videos - see the DDM site for more info.

    Be warned - it is not a normal CAD system, so it takes time to understand how things are done.

    EnergyPlus

    The version of EnergyPlus we will be using is version 4.

    If you are installing EnergyPlus on your own computer, then you should avoid folders with spaces in the path. For example, something like C:\EnergyPlusV4-0-0 is a good place (which is the default). When you have downloaded EnergyPlus, note that you will need to wait for a password to be emailed to you. This email can take a while - up to 24 hours.

    The help docs are here: 

    EnergyPlus Reference:

    Radiance

    The version of Radiance that we need to use is the latest version  - 2.0 Beta.

    When installing Radiance,  you don't need all the AutoCAD stuff. All you need is the Radiance for Windows Rendering Engine. If you are installing this on your own computer, then you should avoid folders with spaces in the path. For example, something like C:\Radiance is a good place.

    For the help docs you also need to avoid all the stuff about AutoCAD. Here are the links to the most useful help docs:

    Radiance Reference:

    Semester 2, 2010

    So a new semester starts. Last semester, we explored the potential of scripting using Rhino and Ecotect. The result was a great set of projects...

    For this semester, we will be continuing with a similar studio brief, focusing of teh Iterative Virtual Prototyping process. The idea of this is as follows:

    1. Propose an design idea and encode it as an algorithmic design schema:
    • Create a developmental diagram
    • Create an evaluation diagram
    • Encode the diagrams in the form of a script
    • Parameterize the script
    2. Generate and optimise variants based on the design schema:
    • Develop a set of design variants by specifying parameters
    • Evaluate the design variants using simulation software
    • Feed the results from evaluation back to the next stage of development
    However, we will be changing the tools. The scripting language will still be in Python, but...
    • For the evaluation part, we will be moving away from Ecotect and focusing more on Radiance and EnergyPlus. (Part of the reason for this is that you have already completed YiChun's simulation module, and so you should already be familiar with these tools.)
    • For the modelling part, we will be using Houdini. This is an advanced procedural modelling package that allows you to dynamically interact with your scripts. There is a free version of Houdini that can be used, called Houdini Apprentice.
    For the vehicle, last semester the brief was for a high rise building in Singapore CBD. This semester the brief will be similar - more details will be given on the site and brief in due course.

    We will start with a scripting workshop this week on Wednesday, Thursday, and Friday morning. So if you are in my studio, please come at 10am on Wednesday in Oceania.