2011年4月26日星期二

ARCH 653 Final Project

           1. What I want to realize in my final project
When Dr. Yan introduce API to me, I felt I can use it create something cool. Based on the layout of my model, I found I could add natural ventilation on this house. If we use natural ventilation in a proper way, we can achieve the economic and healthy purpose for sustainable design.
Based on others finding on nature ventilation, and what I have learned about it. I have the idea similar with the picture as followed:
                                             this pic comes from : http://cmiserver.mit.edu/natvent//nvdescription.htm

As we know, the cool air is heavier than the warm air. Therefore, I decide to open the windows on the top of my model when I need to use natural ventilation. What is more, due to the different direction of the wind, we should adjust the open strategy. That means depend on different direction of the wind, we should open the corresponding windows. Besides that, the comfortable wind speed is another important element we should consider.


2.    Collect wind data


 This is the wind wheel (also named wind rose) in June in College Station. From that, we can see wind comes from south and east a lot in summer. I observed the day-by-day wind direction and speed in June and I create the general wind speed and direction spreadsheet based on my observation.
I use 1,2,3,4 to represent different direction, in this way C# can understand what I want directly. This data was been created based on my observation for June, so it is not the real data.


3.      Analysis building model
I get ids for the windows on different walls, and I chose two pieces window on the top of this house
for letting the hot air out.

 4.      Programming
Following is the structure of my code
4.1  Code for getting objects
 #region 2. Get objects
// use id to get the WindowWind family instance
ElementId id;
Parameter open;

int[] IDSN = new int[] { 510867, 510870, 510873, 510876, 510879,
510882, 503988, 505065 };
int[] IDSS = new int[] { 509929, 510026, 510075, 510104, 510146,
510189, 503988, 505065 };
int[] IDSW = new int[] { 470384, 470388, 470392, 470395, 470208,
470211, 470215, 470218, 470272, 470276,
470280, 470283, 470320, 470323, 470327,
470330, 503988, 505065 };
int[] IDSE = new int[] { 470953, 503828, 504230, 504388, 504414,
504464, 504498, 504544, 504674, 504770,
504796, 503988, 505065 };
int[] IDSUP = new int[] { 503988, 505065 };
#endregion
After that, I assigned each curtain panel to each variable : IDSN ( windows on the north wall), IDSS (windows on the south wall), IDSW (windows on the West wall), IDSE (windows on the east wall), IDSUP ( windows on the top).

  4.2 Create form interface
  #region 3. Get user input from a pop up dialog window and use it
to update the model
            Form1 form1 = new Form1(); //Create the form instance
            form1.ShowDialog(); //Show the form. Upon OK, the user input value will update Windows open situation

What I used in coding form perform is as following:

comboBox1.Items.Add(new userData("1AM", 1));
            comboBox1.Items.Add(new userData("2AM", 2));
            comboBox1.Items.Add(new userData("3AM", 3));
            comboBox1.Items.Add(new userData("4AM", 4));
            comboBox1.Items.Add(new userData("5AM", 5));
            comboBox1.Items.Add(new userData("6AM", 6));
            comboBox1.Items.Add(new userData("7AM", 7));
            comboBox1.Items.Add(new userData("8AM", 8));
            comboBox1.Items.Add(new userData("9AM", 9));
            comboBox1.Items.Add(new userData("10AM", 10));
            comboBox1.Items.Add(new userData("11AM", 11));
            comboBox1.Items.Add(new userData("12PM", 12));
            comboBox1.Items.Add(new userData("1PM", 13));
            comboBox1.Items.Add(new userData("2PM", 14));
            comboBox1.Items.Add(new userData("3PM", 15));
            comboBox1.Items.Add(new userData("4PM", 16));
            comboBox1.Items.Add(new userData("5PM", 17));
            comboBox1.Items.Add(new userData("6PM", 18));
            comboBox1.Items.Add(new userData("7PM", 19));
            comboBox1.Items.Add(new userData("8PM", 20));
            comboBox1.Items.Add(new userData("9PM", 21));
            comboBox1.Items.Add(new userData("10PM", 22));
            comboBox1.Items.Add(new userData("11PM", 23));
 comboBox1.Items.Add(new userData("12AM", 24));
That means, when people chose 1AM, it will returen 1 to C#.

   4.3 Code for open windows

I use the way I open the windows on the south as an example. The ways I opened other windows on remaining walls are almost same.

I use Open as my parameter to determine whether to open or not. Because I add the Yes/No parameter to decide curtain panel’s visibility and I assigned this Yes/No parameter to the parameter open. So when open=1 , that means we can see the curtain panel that is to say the windows closed. While when open=0 when cannot see the curtain panel, that means the windows are be opened. 

#region 3.1.1 south
            else if (speed <= 15)
            {
                if (direction == 1)
                {
                    MessageBox.Show("The windows on the south wall have been opened");
                    for (int n = 0; n < IDSS.Length; n++)
                    {
                        id = new ElementId(IDSS[n]);
                        FamilyInstance panelInstance = doc.get_Element(id) as FamilyInstance;
                        open = panelInstance.get_Parameter("visible");
                        open.Set(0);
                    }
Above means when the wind speed is small than 15 km/h, C# will go to my spreadsheet find the wind direction fot that time, if the direction number is 1 (1=means South), the windows on the south wall will be opened.


                    for (int n = 0; n < IDSUP.Length; n++)
                    {
                        id = new ElementId(IDSUP[n]);
                        FamilyInstance panelInstance = doc.get_Element(id) as FamilyInstance;
                        open = panelInstance.get_Parameter("visible");
                        open.Set(0);

The code above means when we need natural ventilation, the windows on the top will  be opened.
                    }
The following code means windows on other walls will be closed.
                    for (int n = 0; n < IDSN.Length; n++)
                    {
                        id = new ElementId(IDSN[n]);
                        FamilyInstance panelInstance = doc.get_Element(id) as FamilyInstance;
                        open = panelInstance.get_Parameter("visible");
                        open.Set(1);
                    }

                    for (int n = 0; n < IDSE.Length; n++)
                    {
                        id = new ElementId(IDSE[n]);
                        FamilyInstance panelInstance = doc.get_Element(id) as FamilyInstance;
                        open = panelInstance.get_Parameter("visible");
                        open.Set(1);
                    }

                    for (int n = 0; n < IDSW.Length; n++)
                    {
                        id = new ElementId(IDSW[n]);
                        FamilyInstance panelInstance = doc.get_Element(id) as FamilyInstance;
                        open = panelInstance.get_Parameter("visible");
                        open.Set(1);
                    }


                }

 
 
               4.4  Code for close the widows


#region 3.3.5 close the windows
           
if (speed > 15)
            {
                for (int n = 0; n < IDSW.Length; n++)
                {
                    id = new ElementId(IDSW[n]);
 FamilyInstance panelInstance = doc.get_Element(id) as FamilyInstance;
                    open = panelInstance.get_Parameter("visible");
                    open.Set(1);
                }
                for (int n = 0; n < IDSE.Length; n++)
                {
                    id = new ElementId(IDSE[n]);
 FamilyInstance panelInstance = doc.get_Element(id) as FamilyInstance;
                    open = panelInstance.get_Parameter("visible");
                    open.Set(1);
                }
                for (int n = 0; n < IDSS.Length; n++)
                {
                    id = new ElementId(IDSS[n]);
 FamilyInstance panelInstance = doc.get_Element(id) as FamilyInstance;
                    open = panelInstance.get_Parameter("visible");
                    open.Set(1);
                }
                for (int n = 0; n < IDSN.Length; n++)
                {
                    id = new ElementId(IDSN[n]);
 FamilyInstance panelInstance = doc.get_Element(id) as FamilyInstance;
                    open = panelInstance.get_Parameter("visible");
                    open.Set(1);
                }

                MessageBox.Show("The wind outside is too heavy to open the windows");
               
            }
# endregion




           5.  Result




          5.1  Colse all of the windows
 In that time, the windows was opened for vitilation




The wind speed is increasing in the next hour, so the pop window come out showing the information ”the outside wind speed is too high to open the windows”.


All of the windows are closed due to the heavy wind speed.



5.2  open windows on one wall while close remaining windows on other walls
An hour before, the windows on the south wall were opened, if you chose the next hour, the window on the east will be opened. We can see , when the windows on the east be opened, the windows on the south has been closed.