Thursday, September 30, 2010
Tuesday, September 28, 2010
UPDATE: Sage vs Mathematica
Sage is the winner. Period. It accomplishes the same thing that Mathematica does except it does so for free. Sage is also open source. It appears to integrate nicely with python (as does the Arduino). Since I have experience using Tkinter to build GUIs in python, we should be able to get the desktop application complete on schedule.
Below is a graph I generated using Sage. The data was generated using the (updated) java script I wrote before. Just as in Mathematica, the graph is interactive and can be rotated with the mouse.
Below is a graph I generated using Sage. The data was generated using the (updated) java script I wrote before. Just as in Mathematica, the graph is interactive and can be rotated with the mouse.
Below is the updated java code that generates a sample dataset for Mathematica and Sage.
import java.util.Random;
public class datamake {
public static void main(String[] args) {
Random gen = new Random();
int rdm = 0;
String mathematica = "";
String sage ="";
mathematica += ("ListSurfacePlot3D[{");
sage += ("list_plot3d([");
for(int i = 0; i < 10; i++){
for(int j = 0; j < 10; j++){
if(gen.nextInt() %4 == 0){
rdm = gen.nextInt(5);
mathematica += ("{" + i + "," + j + "," + rdm + "},");
sage += "(" + i + "," + j + "," + rdm + "),";
}
}
}
mathematica = mathematica.substring(0,mathematica.length()-1);
mathematica += ("}]");
sage = sage.substring(0, sage.length()-1);
sage += "])";
System.out.println(mathematica);
System.out.println(sage);
}
}
Saturday, September 25, 2010
Sage vs Mathematica
I found this program called Sage that claims to be an open source alternative to Mathematica. It runs natively in Linux and inside a VMWare virtual machine in Windows. The documentation makes it appear as if Sage will accomplish the same thing we are trying to use Mathematica for. I'm installing it now (about a 20 min process) and I'll post an update later today explaining the outcome.
Thursday, September 23, 2010
Visualizing Data
I sent Dr. Goddard an e-mail explaining how I wanted to create a 3d surface plot using an incomplete data set. He mentioned several solutions, but his first choice was to use Mathematica instead of trying to create a graph using just java. One of my goals was to have the Desktop application be competently free and open source, and relying on Mathematica violates this. However, the solution is so simple and elegant that I'm not going to reinvent the wheel just to keep things open source.
I wrote a quick script to generate a set of sample data
import java.util.Random;
public class datamake {
public static void main(String[] args) {
Random gen = new Random();
String output = "";
output += ("ListSurfacePlot3D[{");
for(int i = 0; i < 10; i++){
for(int j = 0; j < 10; j++){
if(gen.nextInt() %4 == 0)
output += ("{" + i + "," + j + "," + gen.nextInt(5) + "},");
}
}
output = output.substring(0,output.length()-1);
output += ("}]");
System.out.println(output);
}
}
and Mathematica generated this surface plot.
If you look closely a the code, you will notice that it only generates approximately 25% of the data required. The algorithm automatically interpolates the missing data. Pretty sweet huh?
I wrote a quick script to generate a set of sample data
import java.util.Random;
public class datamake {
public static void main(String[] args) {
Random gen = new Random();
String output = "";
output += ("ListSurfacePlot3D[{");
for(int i = 0; i < 10; i++){
for(int j = 0; j < 10; j++){
if(gen.nextInt() %4 == 0)
output += ("{" + i + "," + j + "," + gen.nextInt(5) + "},");
}
}
output = output.substring(0,output.length()-1);
output += ("}]");
System.out.println(output);
}
}
and Mathematica generated this surface plot.
If you look closely a the code, you will notice that it only generates approximately 25% of the data required. The algorithm automatically interpolates the missing data. Pretty sweet huh?
Thursday, September 16, 2010
We Have Sonar!
We have acquired 2 marine echosounder transducers complements of Dr. Preston Wilson. They came with very little instruction and documentation and thus, we are having a bit of difficulty interfacing them with the Arduino. However, most of us are smart so I'm sure we'll figure it out. They use standard BNC connectors which makes them easy to test with our lab equipment.
Boat Body Construction
The basic boat body is complete. The body consists of 2 pieces of PVC pipe that are 30 inches in length and 4 inches in diameter. The pontoons are attached by a platform made of plywood that has been covered with acrylic on one side. The reason for the acrylic is to provide a non-porous surface for us to create a sealed, waterproof housing for our electronic equipment.
Below is an image of the inside of one of the pontoons. You can see the bolt protruding through the PVC pontoon. This bolt, which is secured with a washer and nut, secures the platform to the pontoon. The hole in the pontoon that the bolt passes through has been sealed with marine epoxy to ensure that the pontoon remains waterproof.
Below is an image of the inside of one of the pontoons. You can see the bolt protruding through the PVC pontoon. This bolt, which is secured with a washer and nut, secures the platform to the pontoon. The hole in the pontoon that the bolt passes through has been sealed with marine epoxy to ensure that the pontoon remains waterproof.
Tuesday, September 7, 2010
Visualizing Data
Since we have yet to acquire a sonar, I have been developing a set of test data to use to test the software. In order to create a mathematically realistic lake (ie. a lake where the depth changes are gradual) I visualized the lake as a set of XYZ coordinates. X and Y are evenly spaced, and I let Z = ABS(SIN(X)) which creates a gradual, psudo-realistic contour for the bottom of the lake and keeps Z values between 0 and 1.
Below is a screenshot of the 3d graph I was able to make in excel.
If we can manage to use the data that we collect to come up with evenly spaced X and Y points (easy through interpolation, weighted averages, etc...) we should be able to generate these graphs easily. We could even use OLE controls to make the process transparent to the end user (of course this would require the user to have excel and windows installed, and we'd have to use ruby or something because Java doesn't support OLE to my knowledge).
Below is a screenshot of the 3d graph I was able to make in excel.
If we can manage to use the data that we collect to come up with evenly spaced X and Y points (easy through interpolation, weighted averages, etc...) we should be able to generate these graphs easily. We could even use OLE controls to make the process transparent to the end user (of course this would require the user to have excel and windows installed, and we'd have to use ruby or something because Java doesn't support OLE to my knowledge).
Sunday, September 5, 2010
Home Depot and Flotation Test
The entire group made a run to Home Depot on Sunday, August 29th. We purchased the following:
- Aqua Epoxy (for waterproofing)
- 4" diameter 10' length PVC pipe (boat pontoons)
- 4 4" diameter removable cover fittings (caps for pontoons)
- Wooden platform
- Assorted nuts, washers, and bolts
Using these supplies we will be able to build a simple boat body for initial testing of components.
Before selecting the PVC pipe length and diameter we did a few simple load calculations. The max load for a length of PVC pipe is given by this equation:
maxLoad = pi * radius^2 * length * (mass of water per unit volume)
This equation basically states that the maximum load of the pipe is equal to the mass of water being displaced by the pipe while fully submerged.
The PVC pipe we purchased can hold a maximum load of about 54 pounds (22 pounds if we use only half of the pipe).
After purchasing these supplies we did an initial flotation test in a pool, as can be seen in the embedded video below. This test was successful.
Saturday, September 4, 2010
Acquired some batteries
We found 2 UB1280(datasheet) batteries laying around in the machine shop. Daryl gave us permission to take them for the semester. They are only 8Ah but they should be perfect. A measurement with a volt meter shows that they are holding a charge at about 12.41 V which indicates that they should be relatively healthy.
We still need a way to charge these batteries. I was looking at building this battery charger. At first, it seems completely ridiculous, but after doing a bit of research, I think it may work. The advantage it the cost is low (the article says $3, I think it will be closer to $10) but there is no overcharge protection so we will either have to incorporate a timer, an Arduino controlled auto-shutoff, or take constant measurements during charging.
While these batteries are not ideal (very heavy, smaller capacity than desired), they were free, and they work so this is a good find!
We still need a way to charge these batteries. I was looking at building this battery charger. At first, it seems completely ridiculous, but after doing a bit of research, I think it may work. The advantage it the cost is low (the article says $3, I think it will be closer to $10) but there is no overcharge protection so we will either have to incorporate a timer, an Arduino controlled auto-shutoff, or take constant measurements during charging.
While these batteries are not ideal (very heavy, smaller capacity than desired), they were free, and they work so this is a good find!
Wednesday, September 1, 2010
Choosing a battery
I've been researching VLRA batteries. This type of lead-acid battery can safely be inverted without damaging the battery by spilling electrolyte. There is also a safety valve that will vent built up hydrogen gas should we overcharge the battery. While our application is weight sensitive, and these batteries are exceptionally heavy (the one I'm contemplating purchasing weighs about 8 pounds), the power to cost ratio is very high. Since we are on a budget, lead-acid is a better solution than, say, Li-Ion or lithium polymer. The battery I selected, which is intended for use in wheelchairs and UPSs, should be able to be discharged(to about 10%) and recharged many many times. The data sheet specifies the dimensions and charging specifications as well.
Subscribe to:
Posts (Atom)