Monday, October 31, 2011

Down with Oil: Renewing Hawaii's Energy Future

     It must a dream to live in Hawaii for most people, but the cost of living and lack of space would deter people from doing so. One of the more costly expenses in Hawaii is the source of energy. Hawaii has the most expensive power rate in the United States due to our heavily dependence on imported oil. Governor Linda Lingle signed the Hawaii Clean Energy Initiative that would achieve 70% Clean Energy in Hawaii by 2030. In order to promote clean energy and bring down the cost of energy, Hawaii has to change its way on getting its energy beside using oil, such as using renewable energy, use local resources and lower the overall power consumption of the state. By doing these tasks, Hawaii could become the leader in clean energy development.
     Using renewable energy will make Hawaii less dependent on imported sources of energy. In fact, Hawaii has almost every source or renewable energy such as wind, waves, solar, ocean thermal and geo thermal energies. The problem with this is that the state is divided into several islands and not all islands provide all these natural resources. For example, The Island of Lana'i would be a viral place to produce wind energy due to strong wind currents over the island, but the island doesn't need all the power. Other islands such as O'ahu needs this power, but the problem is how does it retrieve the power from Lana’i since the ocean is separating them both. The mainland consists of one giant main power grid and regions can produce or even sell its energy to other regions. In Hawai'i, each island has its own power grid and can't share it with others. If Hawaii can solve this problem and find a way to share energy with the other islands, using renewable energy will lower the over cost of power.
     Oil accounts for 77% of energy in Hawaii. This a very large portion of the energy consumption of Hawaii. Due to oil being imported, the cost to bring the oil to Hawaii effects the overall price of not just energy, but practically everything such as gas, food, clothes and jobs. When the price for oil goes up, the prices of all goods goes up along with it. By breaking this dependency on imported resources like oil and coal, the cost of living in Hawaii can be significantly lower if the state uses local resources just like the mainland.
     Local consumption of energy is high and will continue to grow, unless Hawaii finds a way to use energy efficiently. Currently Hawaii uses about 1000 Megawatts of energy everyday and is projected to rise to 1200 Megawatts in the near future. This would probably mean if Hawaii does indeed produce renewable clean energy but also increases its power consumption, the cost of energy might be less the same. If Hawaii can keep the power consumption at the same level or even decrease the demand for power, that's when the state can expect to see a decrease of price in energy. To promote lower power consumption, the state will have to work together and use power efficient devices such as replacing old lightbulbs with new CFL's or LED lights. It might be a small change for one person, but if everyone in Hawaii contributes, efficient use of power will lower the over power demand for the state.
     Hawaii has the potential to provide the state with most of its energy needs without the dependency of oil as an energy source. Using renewable energy, local resources and lowering the power consumption of the state, Hawaii can achieve it's Hawaii Clean Energy Initiative that would achieve 70% Clean Energy in Hawaii by 2030 and could significantly lower the cost of energy and consumer goods of the state.

Links:
Hawaii Clean Energy Initiative: http://www.hawaiicleanenergyinitiative.org/

Friday, October 21, 2011

Study, Stress, Study, Stress, Study, Pass The Test!

     It's the middle of the semester. Guess what time it is? Yup. Midterms!!! I know you're thinking: "noooooooooooo" times 100 while rolling on the floor stressing out, but it doesn't have to be this way. In one class of mine (Software Engineering) our professor let us students create questions for our upcoming midterm. This is what all you students should be doing anyways. Studying does equal stress, but in the end, it helps you pass the test. Now grab those box of kleenex and wipe your tears. It's time to study!
     In this blog, I've been writing about the experiences I've been through and all the new things I've learned under the subject of Software Engineering. The following are five study guide questions I've created for the upcoming midterm. It might give you some time to look back at what was learned to see if you've been up to date. Not sure if I am, but who is anyways. Keep that spirit up and see you after you pass that midterm of yours!!!

1. When generating JavaDoc for your projects, what 2 files must be created and where do they need to be placed?
     overview.html in the top-level of your system implementation. 
     package.html in the package.

2. When designing a Robocode robot, there are 3 basic moves. Name one and write the method that enables that function.
     Movement: ahead(), back();
     Radar: scan()
     Shoot its gun: fire();

3. We are using the Apache Ant build system for assignments in this class. Name one feature of Ant.
     Java-Based
     Cross-platform
     Extensible
     XML configuration files
     Open Source
     Defacto standard for Java Projects
     File-Level, but not library-level dependency management.

4. When running an Ant build file, what argument must you put before the file name to execute the build file.
     -f = Use given build file.

5. Given the following program below, which of the following automated quality assurance tool (Checkstyle, PMD, FindBugs) will produce an error?
Checkstyle will produce an error. There is no package 

Thursday, October 20, 2011

Changes Made Simple. Now Commit!

       With Robocode somewhat aside, let's move away from coding and look at projects as a whole. When working on a project alone, it's simple to keep the project up to date. When sharing And distributing projects, we ran into the problem of getting the project to work on other user systems. That's where we were introduced to Build Systems such as Apache Ant to help distribute, compile, test and debug projects. So now, how can we take projects further? Well, first step was to work on projects alone, second was to share them with others, so I guess the third logical step is to work on projects together. Many of you may think that it's just like group work where everyone splits up and do their share then come back together to piece it up. Sounds simple right? In theory it does, but there are some issues we do have to address in this situation. Having the same project on different systems causes every copy of the project being slightly different from one another after the changes that are committed. The problem with this is that how do all the developers of the project merge all there files together without overwriting everyone's changes? This is where I introduce to you Configuration Management, *Applause*. What is it? Magic? A life saver? Something that will bore you if I explain in too deep? I guess all is true. Let's summarize and say that configuration management allows users to work on a project and they could update the project that is hosted online with what they locally on their systems. When users update (Commit) the project, only the. Hanged in the project are changed, for example, one line of code rewrittenI set as Users or a renamed file. Configuration Management makes multi user projects easier to handle. 
       After being introduced to Configuration Management myself, I decided to try it out  using my Robocode project. For this experiment I used Google Project Hosting as my hosting site for my project and Smart VN as the Configuration Managment. After some speed bumps trying to get my project to upload into the server, I finally got it to work. While playing around with the system, I made some updates to my projects such as formatting and better javadoc. These changes causes the revision number to change and I can use this to see what changes were made since the original upload. With Google Project Hosting, it was simple to create some wiki pages that I set as user and developer guides. The SVN client SmartSVN was also simple to use to upload and commit changes to the project. The only initial problem was setting it up, but most of what I needed to know was listed in the Google Project Hosting site. Overall with my experience, I thought it was a simple process. I can see why this is another handy tool for many developers.

Link:
Robocode-cel-wayfarer Project: http://code.google.com/p/robocode-cel-wayfarer/

Monday, October 10, 2011

Your Robot's Way Far! Errr...

     Hey, it's robot's again! Have you been perfecting your's since my last post? I guess you did since you're here. Well, I too have been working on making my robot better. By utilizing some of the things I learned from the katas, I experimented ways to make a robot that could compete with some of the included sample robots of robocode. In my opinion, it's not the best robot, but it's decent and I call it WayFarer! (No, not sunglasses, but thought it sounded to cool to name it after it.)

     For my robot, I took some note from the code katas from the other blog. The design is basically my robot moving back and fourth along an axis. When the robot moves, it scans for enemies, turn its gun towards the enemy and fires every other turn. When the robot hits another robot, it moves away and when the robot gets hit by a bullet, it turns 90 degrees and traverses that axis. So how does this robot perform? Let's see!

     Moving on to testing. I put my robot against 8 of the sample robots:(Corners, Crazy, Fire, RamFire, SittingDuck, SpinBot, Tracker and Walls.) For this test, I ran 100 battles each and recorded the scores. Here are the outcomes:

Enemy Challenged
Rank Against Enemy
Total Score
Survival
Survival Bonus
Bullet Damage
Bullet Bonus
Ram Damage
(x2)
Ram Bonus
1sts
2nds
Corners 1st 15493 (87%) 4850 970 8033 1579 31 0 97 3
Crazy 1st 9380 (69%) 2800 560 5196 700 124 0 60 40
Fire 1st 13177 (92%) 4900 980 9417 1852 29 0 98 2
RamFire 1st 15027 (53%) 3100 620 9492 1201 450 163 62 38
SittingDuck 1st 18034 (100%) 5000 1000 9966 2000 68 0 100 0
SpinBot 1st 9988 (61%) 2900 580 5668 791 49 0 59 41
Tracker 1st 17209 (71%) 4050 810 10366 1742 208 34 81 19
Walls 2nd 3060 (22%) 100 20 2815 41 86 0 2 98

     As you can see, WayFarer is a decent robot, but definitely not the best. It can only defeat one sample robot 100% of the time, but majority, it comes in first place. It;s not perfect, but good. WayFarer is a good robot because it moves constantly and changes direction to dodge incoming bullets. This might be a good strategy, but one robot isn't affected by it, meaning the walls robot as you see on the table. WayFarer doesn't go well against walls because it travels along the "walls" of the battlefield while tracking and shoot. Walls also moves in constant motion, so many bullets shot by WayFarer miss the target. What could be implemented to make WayFarer better is to predict the future location of the enemy to ensure that bullets will hit the target all the time.

     Building more on testing is some JUnit tests I created to tests some robot behaviors. My 4 tests include testing if WayFarer hits a wall, changing direction after being hit, turning its radar to scan enemies and seeing if bullets shot hit the enemy. When WayFarer hits the wall, it confirms that the robot traverses an axis. When WayFarer get's hit by a bullet, it should change directions of the traverse. When WayFarer turns its radar, it ensures that it is scanning and when a shot bullet hits an enemy, it ensures that the gun is pointed at the enemy.

     Overall, designing the perfect robot is not easy. There are some robots that are easier to defeat while others require more thinking. During this development using the Ant build system, inning testing and checking for errors are simple to do and faster than running them manually. Creating projects are now easier to transport for other users to use since the build system automatically installs and downloads required files. I can now see why build systems are viral to many projects and I intend to use it for future projects.