Saturday, August 29, 2015

Coming back...

After a hiatus of almost one year, I am coming back to post articles of things I am learning, but this time around the articles will be Computer Science related. Hopefully my articles will teach some wandering Google searchers about the topic at hand.

Thursday, October 2, 2014

How To Plot Residuals in OpenFOAM

A sample script.

#!/bin/bash

foamLog log.simpleFoam >/dev/null

gnuplot -persist > /dev/null 2>&1 << EOF
        set logscale y
        set title "Residual vs. Iteration"
        set xlabel "Iteration"
        set ylabel "Residual"
        plot "logs/Ux_0" with lines,\
                "logs/p_0" with lines
EOF

The video:


Friday, July 11, 2014

English Measurement Rounding Tool, Version 2

The input text field is the raw measurement to be rounded.
The dropdown menus are to select the precision of the rounding.
The answers are the rounded measurement, and the difference from the raw measurement.


Tuesday, July 8, 2014

Making a Two-Stroke Engine Turn the Opposite Direction

I have been trying to couple two TR-111 engines together symmetrically, and to do that one of them has to turn the opposite direction of the other, in order for both of them to turn the same direction on the coupled shaft. The convention for 2 stroke engines is counter-clockwise, looking from the "front" (looking at it such that the propeller / driven device is closest to you).

Thus I started looking into ways to make the engine go clockwise. My engine uses a CDI electronic ignition. The only information this requires from the engine is a Hall effect sensor signal. The Hall effect sensor is very visible and accessible. To make the sparks turn on correctly for clockwise motion, I just have to relocate the Hall effect sensor to its mirror-image location, where the mirror line is the piston center line.


The next part I would not have guessed on my own but am doing based on the findings of one forum discussion:
http://www.rcuniverse.com/forum/gas-engines-142/10891299-dle-55-clockwise-rotating-engine-2.html

Within the forum there is some disagreement about what is necessary and what is not, but only one person has actually successfully reversed an engine. So I believe that person and will follow his procedure, which is to relocate the cylinder and piston 180 degrees. This way the engine is running exactly as it would in the normal counter-clockwise configuration.

One might ask why this is necessary, since the piston only moves up and down, and should not know anything about the rotation direction. However, the piston actually is affected by the rotation direction because the connecting pin to the crankshaft is angled with respect to the piston center line, so a side force is transmitted to the piston, which is then transmitted to the cylinder walls. The reason this is important is that the exhaust and intake ports are on the sides which receive the transmitted connecting pin side force. The ports are geometrically different, and therefore are designed to withstand different loads. Also the piston shape may be asymmetrically designed for the exhaust and intake sides. There are probably other reasons that the 180-degree relocation may be necessary that I do not know currently.

REMOVING THE CYLINDER
First unscrew the 4 bolts attaching the cylinder to the crankcase. Remove and replace them later in an x-pattern so that the tensions are better balanced.

Once the screws are removed, the cylinder is still stuck on quite tight. There is no glue on these gaskets between the cylinder and head, it is just that the gasket material bonds with the metal under the high pressure of the attachments screws. I had a bit of trouble figuring out how to remove the cylinder, as there is no space to allow for a wooden piece and hammer to nudge it out, as I have seen commonly done on various hobbyist forums. Looking inside the exhaust port however, you can see 2 divots on the other opposing cylinder wall. I lowered the piston, inserted 2 wooden dowels and turned the output shaft to raise the piston. This way, the cylinder came off very easily. If it still is too hard, you can try tapping the cylinder lightly using a rubber mallet with a piece of wood in between to try to loosen the gasket bond.



In removing the cylinders, the gaskets will probably rip to some degree. Both of mine ripped in one corner. I do not think it is good to reuse the gaskets, so you should buy replacement if you can. You can also buy gasket sheet at a local auto store and cut out a replacement, which is what I did.

The following are pictures of inside the cylinder. The loop-scavenged intake ports, boost ports, and exhaust ports can be seen.




The following are pictures of the piston. The exhaust side of the piston skirt is solid, while the opposite side has windows that correspond to the boost ports.


The following pictures show the connecting rod and the piston.





Looking inside the crankcase, I saw that a NSK 6203DU ball bearing sits in the housing that goes out to the propeller shaft. Here is a picture of the crankshaft and connecting rod.


REVERSING THE PISTON
Turning the piston 180 degrees is pretty straightforward. Two internal retaining rings, which can be removed with pliers, hold the assembly together. After the rings are removed, the connecting shaft can be removed, and the piston and connecting rod comes apart.



A needle bearing supports the connecting rod on the piston shaft.


The following picture shows a circular metal piece that keeps the piston ring ends at one position on the piston circumference.


After assembling the piston 180 degrees, put the internal retaining rings back on, and slide the cylinder back on 180 degrees from its original position. Before tightening the cylinder with bolts, slide the piston a few times to make sure it aligns freely.

So after these things are done, the engine should be able to run in the reverse direction. I have not run it yet, but I will update this post with any developments.

Saturday, July 5, 2014

Keyed Shaft Power Design Calculator

Because keyed shafts have rather sharp geometrical features, a significant stress concentration factor should be assumed when considering the results of this calculator.

GEOMETRY (SOLID SHAFT):
Shaft diameter:
Key width:
Key height:
Key length:

PERFORMANCE:
Power:
RPM:

ADDITIONAL LOADS:
External Shear Force:
External Tensile Force:




Monday, June 2, 2014

Pulley Belt Tension Calculator

This JavaScript calculator computes required belt tension for belt-driven pulley power transmission systems.



(Drawn to scale)
Drawing Scale Factor:
Small Diameter (in):
Large Diameter (in):
Center Distance (in):
Power (W):
Small Pulley Rotational Speed (rad/s):
Effective Friction Coefficient:

Thursday, May 15, 2014

English Measurement Rounding Tool

This simple calculator takes a measurement and rounds it to nearest standard English units.

I have used this when building my CAD designs. My designs in CAD have arbitrary, messy measurements (i.e. 1.734854" vs. 1 3/4"), and in order to measure and mark my raw materials I need to convert it to standard English units. I use this calculator for the conversion, and to determine whether the rounding is sufficiently accurate. My rule of thumb is to keep the difference between the exact and rounded measurements less than 10 thousandths of an inch. Depending on the precision requirements, more or less difference can be tolerated.



Measurement:
Precision:

Rounded Measurement:
Difference: