So, this was actually the first time I was allowed, or rather, told that I could write a program in a group. For this, we used issue based project management by hosting a project on Google Code. The point behind this was to teach us how to program as a team, by defining issues for us as a team to solve. The issues should be things that could be fixed and have enough issues in where the use is relatively always busy; maybe about a weeks worth of work or so.
For this project, we were to construct a command line interface that queries the WattDepot server and return some information about energy and power; similar to what we did with the WattDepot kata. The use of project management allowed us to put into practice using Google project hosting, Ant (as a use to build the system), automated quality assurance, and simple testing to accomplish a large goal by creating smaller goals that each group member tries to accomplish to complete the final task.
For this project our group was named hale-aloha-cli-tiger, a command line interface that queries the WattDepot server and gets various types of information. We set up our project management by first assigning a different command for each of the group members to work on and get working locally. Once that was finished and well tested, we created an interface to make sure the programs both contained a run method and a verify method to make sure they only ran if the parameters were right. This was probably not the best way to go as small problems with parameters occurred later in the process. Maybe we should have created the Main class,Command Processor class, and the interface first. This way, we would have been able to skip the step of modifying some of our methods in the commands.
I think it was because of the concept of issue driven project management, we thought the best thing to do is break down the program into smaller program (the individual commands). This worked, but I feel like it would have been more efficient for the group if the dependencies were created first. In the end however, we got it all to work, but testing was quite difficult as the results that were printed out were always different.
Overall, I felt that this was a very good experience. It was pretty nice being able to write code from other and ask for input without getting into trouble. The only downside I think is that because we as students had a mess load of work for other classes, communication was very difficult a lot of cramming was actually done, even though we were not supposed to. Issue driven project management is something I will definitely try implementing in future projects both in school and in my professional field.
Tuesday, November 29, 2011
Tuesday, November 8, 2011
Can You Feel the Power?
WattDepot is an open source application developed to monitor the power usage of the Hale Aloha freshman dorms at the University of Hawaii at Manoa. In the Hale Aloha system, there are four identical towers: Ilima, Mokihana, Lehua, and Lokelani. In each of these buildings in the same place, there are sensors that monitor the power usage of the residents. The data provided will assist us in pushing for a more sustainable campus.
Similar to Robocode, I attempted a few kata in assist in familiarizing myself with manipulating data received from WattDepot. The following kata were given:
Similar to Robocode, I attempted a few kata in assist in familiarizing myself with manipulating data received from WattDepot. The following kata were given:
Kata 1: SourceListing
Implement a class called SourceListing, whose main() method accepts one argument (the URL of the WattDepot server) and which writes out the URL argument and a list of all sources defined on that server and their descriptions, sorted in alphabetical order by source name. Use the System.out.format method to provide a nicely formatted list. For example:
Server: http://server.wattdepot.org:8190/wattdepot/
Source Description
Bar Represents the energy consumed by the Bar building.
Baz Represents the energy consumed by the Baz floor of the Bar building.
Foo Energy generated by the Foo power plant.
Qux The energy meter associated with the Qux household.
Kata 2: SourceLatency
Implement a class called SourceLatency, whose main() method accepts one argument (the URL of the WattDepot server) and which writes out the URL argument and a list of all sources defined on that server and the number of seconds since data was received for that source, sorted in ascending order by this latency value. If no data has every been received for that source, indicate that. Use the System.out.format method to provide a nicely formatted list. For example:
Server: http://server.wattdepot.org:8190/wattdepot/
Source Latency (in seconds, as of 12-Oct-2011 14:32:12)
Baz 9
Bar 10
Foo 14
Qux No data received.
Kata 3: SourceHierarchy
Implement a class called SourceHierarchy, whose main() method accepts one argument (the URL of the WattDepot server) and which writes out the URL argument and a hierarchical list of all sources defined on that server. The hierarchy represents the source and subsource relationship between sources. For example:
Server: http://server.wattdepot.org:8190/wattdepot/
Source Hierarchy
Baz
Bar
Zob
Zob-A
Zob-B
Foo
Qux
Thus, the source Baz has two subsources, Bar and Zob. The source Zob has two subsources, Zob-A and Zob-B. Foo and Qux have no subsources. The hierarchy is represented by two space indentation.
Kata 4: EnergyYesterday
Implement a class called EnergyYesterday, whose main() method accepts one argument (the URL of the WattDepot server) and which writes out the URL argument and a list of all sources defined on that server and the amount of energy in watt-hours consumed by that source during the previous day, sorted in ascending order by watt-hours of consumption. If no energy has every been consumed by that source, indicate zero. Use the System.out.format method to provide a nicely formatted list. For example:
Server: http://server.wattdepot.org:8190/wattdepot/
Source Energy consumed in watt-hours (19-Oct-2011)
Baz 932
Bar 1025
Foo 1436
Qux 2357
Kata 5: HighestRecordedPowerYesterday
Implement a class called HighestRecordedPowerYesterday, whose main() method accepts one argument (the URL of the WattDepot server) and which writes out the URL argument and a list of all sources defined on that server and the highest recorded power associated with that source during the previous day, sorted in ascending order by watts. Also indicate the time when that power value was observed. If no power data is associated with that source, indicate that. Use the System.out.format method to provide a nicely formatted list. For example:
Server: http://server.wattdepot.org:8190/wattdepot/
Source Highest recorded power in watts (12-Oct-2011)
Baz 10,034 10:30am
Bar 10,456 2:45pm
Foo 14,876 12:30pm
Qux 23,578 4:15pm
This is a little tricky due to the presence of both virtual and non-virtual sources. For non-virtual sources, you could retrieve all of the sensor data and just iterate through to find the maximum power value. However, virtual sources represent an aggregate of non-virtual sources, so there is no sensor data associated with them directly, and it is unlikely that the sensor data timestamps for its constituent sources will be synchronized exactly.
One reasonable way to deal with this is to request the computed power at (say) 15 minute intervals for the entire day, which provides 96 data points per source whether it is virtual or non-virtual.
Kata 6: MondayAverageEnergy
Implement a class called MondayAverageEnergy, whose main() method accepts one argument (the URL of the WattDepot server) and which writes out the URL argument and a list of all sources defined on that server and the average energy consumed by that source during the previous two Mondays, sorted in ascending order by watt-hours. Use the System.out.format method to provide a nicely formatted list. For example:
Server: http://server.wattdepot.org:8190/wattdepot/
Source Average energy for last two Mondays in watt-hours (24-Oct-2011, 17-Oct-2011)
Baz 10,034
Bar 10,456
Foo 14,876
Qux 23,578
Kata 1 was fairly straight forward and did not take much time; maybe around 15 minutes. This is because the provided SimpleApplication.java file provided nearly all the method calls needed to solve it. All it took was slight formatting.
Kata 2 took a little longer; maybe around 30 minutes mainly because I was not familiar with Java's Calendar, Date, and XMLGregorianCalendar classes. After much reading into the API and a lot of guess and check works, I was able to format the outputs to correctly show the current date and time.
Kata 3 is where it started getting a bit difficult and took me a couple of hours to complete, mainly because I was reading through the API trying to figure out how to find the subsources. The formatting was also quite difficult and was not able to get it to work very nicely and resulted in me hardcoding the indentations. It works nicely for this problem, but if the code were to be used where a subsource contains a subsource, the indentations may be off.
Kata 4 was even more difficult than Kata 3 and also took me a few hours to complete, mainly because it took me some time to get used to the XMLGregorianCalendar class required in one of the methods. It also took me quite some time to figure out how to set the days correctly so it would get "yesterday's" data, rather than "today's".
Kata 5 was a bit confusing at first because a lot of problems happened while writing it. The first thing wrong (I guess you could say) is the fact that the system times out after a certain amount of time because it takes too long run run the queries if the increment time was small (ie. 5 or 15 minutes). Because of this, I had to set my intervals to 60 minutes so that it the program stopped timing out. Another problem I had and was unable to fix was not being able to display the actual time where the most energy was consumed.
The final kata, kata 6 was the one I was unable to finish. I am currently still working on manipulating the time based variables and was unable to manipulate it so that it would give me the time for "Monday". The could seemed simple enough, but I would always get errors when I tried passing it my variables as arguments and/or trying to get the manipulation to work.
Like Robocode, I learned quite a bit from doing these Kata. It was my first time really dealing with real world data that was always changing. I also learned that because the data is coming from real time, the results can sometimes be insanely slow and even time out, which can frustrate even the most patient programmer since you aren't always able to check if the outputs are correct. I hope to continue working on these Kata to really practice manipulating the times.
Isolated
It seems like whenever people think of "paradise", the first thing that comes to mind is Hawaii. The weather is nearly perfect all year around and the people make it even better. However, what many don't really know is how expensive it really is to maintain this "paradise" and the fact that it affects the cost of living for the residents of the state so greatly, which pretty much adds insult to injury where everything else in the state tends to cost around 20% more than on the mainland.
Alternative energy sources have been the topic of numerous debates; especially in the university setting. I have done some research on the Hawaii 2050 sustainability plan that focuses on a sustainable Hawaii, by the year 2050, and a huge portion of that plan is based around alternative power sources. What I found quite interesting from the presentation was the fact that the best places to build alternative energy plants is on a separate island.
The capital city of Honolulu is located on the island of Oahu and is the most power hungry city in the state. There have been recent plans to build windmill farms on the island of Molokai because of the amount of land available, but also because of how windy the island generally is. However, plans have faced problems due to the locals protesting about protecting the land. Geothermal energy from the volcano located on the big island of Hawaii was another possibility brought up in the presentation that could possibly bring similar problems as on Molokai. The locals here seem to have a strong appreciation for "keeping the country, country", but at the same time complain about how expensive the cost of living is. Perhaps a compromise is in order?
The potential for renewable energy in Hawaii seems to be limitless. Hawaii offers a surplus of natural resources for various types of renewable energy rather it be from the wind, lava, ocean, or sunlight. It may however, take time for us to get used to these changes and many may be totally against it, but we must realize the fossil fuels are a finite supply that some theorize may be past the half way point of the world supply. It is definitely time for a change and once we set the example (hopefully with the Hawaii 2050 sustainability plan), the rest of the world will follow.
Resources:
Hawaii 2050 Sustainability Plan
Alternative energy sources have been the topic of numerous debates; especially in the university setting. I have done some research on the Hawaii 2050 sustainability plan that focuses on a sustainable Hawaii, by the year 2050, and a huge portion of that plan is based around alternative power sources. What I found quite interesting from the presentation was the fact that the best places to build alternative energy plants is on a separate island.
The capital city of Honolulu is located on the island of Oahu and is the most power hungry city in the state. There have been recent plans to build windmill farms on the island of Molokai because of the amount of land available, but also because of how windy the island generally is. However, plans have faced problems due to the locals protesting about protecting the land. Geothermal energy from the volcano located on the big island of Hawaii was another possibility brought up in the presentation that could possibly bring similar problems as on Molokai. The locals here seem to have a strong appreciation for "keeping the country, country", but at the same time complain about how expensive the cost of living is. Perhaps a compromise is in order?
The potential for renewable energy in Hawaii seems to be limitless. Hawaii offers a surplus of natural resources for various types of renewable energy rather it be from the wind, lava, ocean, or sunlight. It may however, take time for us to get used to these changes and many may be totally against it, but we must realize the fossil fuels are a finite supply that some theorize may be past the half way point of the world supply. It is definitely time for a change and once we set the example (hopefully with the Hawaii 2050 sustainability plan), the rest of the world will follow.
Resources:
Hawaii 2050 Sustainability Plan
Subscribe to:
Posts (Atom)