1. INTRODUCTION
The Revit model for the Gallery Building with PV on the roof has been developed at the previous project, project 1. At the project 2, I added PV parametric model in the program using the Revit API (Application Programming Interface) so that the PV can track the sun path by the time changes.
Figure 1. Exterior view of the project building with PV on the roof
· The goal of the project:
To create the sun tracking PV parametric model using the Revit API by entering three parameters into the pop-up dialog: month, day, and hour.
· The objective of the project:
- To create a CSVdatabase includes PV angles by the parameters: ith day of year (from month, and day), and hour.
- To create the Revit API program to get PV angles from the CSV database.
2. PROCESS
2.1.Install the ‘Revit 2011 SDK’ to use Add-In (External Tools) function of the Revit.
2.2.Modify ‘UserDefinedParameterReadWrite V4’ files provided from the ARCH 653 class using MS Visual C# program to create the PV parametric model.
2.2.1. Assign the parameters
2.2.2. Create pop-up dialog windows to enter the parameters
Figure 2. Pop-up dialog windows for entering the parameters
2.2.3. Calculate the PV angle by the time changes in College Station, Texas, and create the CSV database.
Figure 3. The CSV database calculated PV angles by month, day, and hour
2.2.4. Link the CSV database to the Revit API.
2.2.5. Find the PV angle user entered and extract the PV angle from the CSV database.
2.3.Bring the modified ‘UserDefinedParameterReadWrite V4’ files from the Revit. User can enter the time (month, day, and hour) into the pop-up dialogs, and PV angle on the roof will be changed to face the sun.
3. RESULTS
3.1.Open the project file.
Figure 4. The project building with the PV on the roof
3.2.Open the parametric model: External Tools in Add-In panel can bring the modified parametric file into the Revit program. Then, pop-up dialog appears after another.
3.2.1. Select month
Figure 5. Select month from the pop-up dialog
3.2.2. Select day
Figure 6. Select day from the pop-up dialog
3.2.3. Select hour
Figure 7. Select day from the pop-up dialog
3.2.4. PV angle extracted from the CSV database pop up
Figure 8. PV angle extracted from the CSV database
3.2.5. The PV angle on the roof changes
Figure 9. The PV angle on the roof changes
4. ADDITIONAL RESULTS
Figure 10. May 5 (a) 10:00, (b) 12:00, (c) 14:00, (d) 16:00
5. ADDITIONAL INFORMATION: C# source code
· Default values for the variables (newday, newhour, pvelevation, newmonth, and newtotalday) are defined as below. The values will be changed when user select the value through the pop-up dialogs.
public static int newday = 20;
public static string newhour = "13";
public static double pvelevation = 50;
public static int newmonth = 1;
public static int newtotalday = 30;
· PV id (30679) in the Revid is defined as below. The id can be obtained from the Revit model by selecting the PV and selecing IDs of Selection, Manage panel.
#region Assigning variables
ElementId id;
id = new ElementId(30679);
FamilyInstance pv = doc.get_Element(id) as FamilyInstance;
· Three pop-up dialogs will appear after another when user starts the Revit API. When user selects the month, day, and hour from the dialogs, user can get message box.
#region Get user input from a pop up dialog window
Form4 form4 = new UserDefinedParameterReadWrite.CS.Form4();
form4.ShowDialog();
MessageBox.Show("Month = " + newmonth);
Form2 form2 = new UserDefinedParameterReadWrite.CS.Form2();
form2.ShowDialog();
MessageBox.Show("Day = " + newday);
Form3 form3 = new UserDefinedParameterReadWrite.CS.Form3();
form3.ShowDialog();
MessageBox.Show("Hour = " + newhour);
· Since the CSV database includes only ith day of year and hour, I need to use IF statement to calculate ith day of year from the month, and day. The logic used here is same as the one used for the project 1 parametric model. The selected PV angle will be shown by the message box after calculating the ith day of year, and extracting the PV angle from the CSV databse.
#region Demonstration function of reading data from Csv
if (newmonth == 1)
{
newtotalday = newday - 1;
}
else if (newmonth == 2)
{
newtotalday = 31 + newday - 1;
}
else if (newmonth == 3)
{
newtotalday = 59 + newday - 1;
}
else if (newmonth == 4)
{
newtotalday = 90 + newday - 1;
}
else if (newmonth == 5)
{
newtotalday = 120 + newday - 1;
}
else if (newmonth == 6)
{
newtotalday = 151 + newday - 1;
}
else if (newmonth == 7)
{
newtotalday = 181 + newday - 1;
}
else if (newmonth == 8)
{
newtotalday = 212 + newday - 1;
}
else if (newmonth == 9)
{
newtotalday = 243 + newday - 1;
}
else if (newmonth == 10)
{
newtotalday = 273 + newday - 1;
}
else if (newmonth == 11)
{
newtotalday = 304 + newday - 1;
}
else if (newmonth == 12)
{
newtotalday = 334 + newday - 1;
}
double pvelevation = CsvDB(newtotalday, newhour);
MessageBox.Show("PV Angle is: " + pvelevation + " degree");
#endregion