RFILE 0.0 release notes

Author: Sandro Fergnani

Dear B2Streamlines,

I wrote rfile mainly because the CAD software I use to plot the templates of the airfoils for my models does include a sophisticated programming language, but too sophisticated and difficult to learn and master. I knew C and I decided it wasn't time to learn another programming language. I learned C by myself and, as a result, I'm not a good programmer, but I enjoy myself. As you will see, no user interface at all. Rfile is a DOS program. You can run it in a DOS shell of Windows 95 if you want, but it's a DOS program.

What does rfile do?? Rfile takes a file with airfoil coordinates and produces another ASCII file that contains:
1) the airfoil described in segments;
2) the coefficient of moment Cm0;
3) the 0 lift angle of the airfoil;
4) the mean line described by points.

Obviously the results are not as accurate as the ones you can get from the wind tunnel, but for my purposes they are enough, and, after all, nobody can forbid to make the calculation more accurate in the future.

INPUT FILE REQUIREMENTS

- The airfoil MUST be described with a length of 1 unit.
- The coordinates must describe a curve that begins from trailing edge, to leading edge describing the upper surface, and then back to trailing edge describing the lower surface.
- Empty rows are ignored.
- Rows starting with the character '*' are treated as comments.

Example: file describing the Eppler E222 airfoil. Dashed lines are used to mark the data. They are not included in the file.

---------------------------------

* Airfoil Eppler 222 (E222)
1.00000 0.00000
0.99669 0.00071
0.98722 0.00291
0.97241 0.00645
0.95270 0.01078
0.92812 0.01560
0.89889 0.02092
0.86547 0.02666
0.82830 0.03269
0.78784 0.03883
0.74458 0.04492
0.69901 0.05079
0.65162 0.05630
0.60292 0.06127
0.55342 0.06558
0.50361 0.06908
0.45399 0.07167
0.40503 0.07326
0.35719 0.07378
0.31091 0.07319
0.26662 0.07147
0.22471 0.06864
0.18555 0.06473
0.14947 0.05981
0.11678 0.05395
0.08774 0.04728
0.06258 0.03994
0.04149 0.03210
0.02461 0.02396
0.01203 0.01578
0.00382 0.00792
0.00007 0.00100
0.00199 -0.00470
0.00990 -0.00993
0.02291 -0.01499
0.04083 -0.01953
0.06351 -0.02340
0.09078 -0.02648
0.12243 -0.02872
0.15821 -0.03010
0.19779 -0.03064
0.24083 -0.03035
0.28690 -0.02932
0.33557 -0.02760
0.38634 -0.02531
0.43867 -0.02254
0.49201 -0.01942
0.54578 -0.01608
0.59935 -0.01266
0.65212 -0.00928
0.70344 -0.00609
0.75268 -0.00320
0.79920 -0.00075
0.84238 0.00118
0.88157 0.00249
0.91618 0.00313
0.94560 0.00306
0.96916 0.00234
0.98625 0.00128
0.99656 0.00036
1.00000 0.00000

---------------------------------

USING RFILE

The program tries to interpolate the coordinates to get a smooth curve using spline algorithms that are quite complicated, but it works. By default the program calculates the airfoil using 100 segments for each surface of the airfoil (upper and lower), and the output (more on output options later) will contain the coordinates of starting and ending points of the segments. You can increase the number of segments up to 2048 with a command line switch.

Why segments?? There is a reason. The calculated segments are a single chain starting from trailing edge to leading edge and then back to trailing edge. Imported in my CAD program with little editing I obtain a file that can be sent to a plotter. I was lucky to find an old A3 plotter by Panasonic. I modified it to use not only pencils, but a steel tool that I took from my Dremel. So I can cut templates directly to phenolic boards!!! This is why I use segments.

The program computes the Cm0 and zero lift angle. This is the part that needs more improvement, but the first results are not bad (at least for me). One of the output options is the mean line, that is described by points.

The syntax of rfile is:
C:\>rfile inp_file [options] outp_file

where:
inp_file = file that contains the coordinates
outp_file = file that contain the results (if omitted stdout is taken)

Options:
-n number = number of segments to be used to describe the airfoil. By default is 100 but up to 2048 is supported.
-fu number = scale factor to be applied to the upper surface of the airfoil. Useful to "play" with airfoils to get various versions. Number must be not negative. If > 1 it will be use as enlarging factor. If < 1 a reducing factor.
-fl number = the same as -fu, but it's applied to the lower surface of the airfoil.
-f number = value to be applied to both upper and lower surface.
-ml = print the mean line too.

Examples of use:
C:\>rfile e222 -n 1000 foobar Use the file e222 as input. Output goes into the file foobar. The airfoil will be described by 1000 segments.
C:\>rfile e222 -ml foobar As before, but 100 segments will be used (the default). The output file will contain the coordinates of the mean line.
C:\>rfile e222 -n 500 -fu 1.23 foobar 500 segments will be used and the upper surface of the airfoil will be 23% bigger.

OUTPUT

I'm proud of the output options of the program because they are totally designed by me. Since the main design goal was to obtain "something" that can be imported in a CAD program, the output is highly customizable.

Rfile uses a template file called rfile.tpl that contain sections. A section begins with the character '#' followed by the section name. The section is ended by the token "$end". In each section there are some special tokens. Tokens start with the character '^'. There is no limit to the rows that can be present in a section (in theory). The program substitutes the tokens with the output values that it computes.

Actually, there are the following sections:
#airf_data --- Used to define how to print the values of Cm0 and zero lift angle. The two recognized tokens are ^cm0 and ^alfa0.
#print_upper --- The program uses this section before printing the segments that describe the upper surfaces. There are no tokens recognized in this section. I use it to put in the output file some instructions for my CAD program, for example set the color and/or the input layer.
#print_lower --- As before, but the contents of this section are printed in the output file before printing the segments that describe the lower surface of the airfoil. Nice place to put instructions for changing the color and or the input layer.
#after_lower --- This section does not contain recognized tokens, and it's printed after the segments that describe the lower surface.
#segments --- This is the most important section. The recognized tokens are:
^x1 --> X value of starting point of the segment
^y1 --> Y value of the starting point of the segment
^x2 --> X value of the ending point of the segment
^y2 --> Y value of the ending point of the segment

For example: In my CAD program the command that draws a single segment is "segmento singolo." Such command takes the coordinates of two points as parameters. In the syntax of my CAD, each couple of coordinates must be preceded by the character '/'. So, what is the content of my #segments section?

Here we go:
#segments segmento singolo / ^x1 ^y1 / ^x2 ^y2
(Please note that tokens don't need to be isolated. They can be mixed within other words. For example if the token is bla_bla^x1_bla_bla, the output could be bla_bla34.33434_bla_bla. Tokens can be repeated in the same line too. I don't see how this could be useful, but it's free !!)
#mean_line --- Rfile uses this section to print the points that describe the mean line. There are two recognized tokens: ^x and ^y that are the coordinates of the point.
#before_mean_line --- This section doesn't have any tokens but it's printed before the points of the mean line.

I think that the template file can be customized for almost any CAD. The sequence of section processing is:
1) #airf_data -> rfile prints the values of CM0 and zero lift angle.
2) #print_upper -> rfile prints this section.
3) #segments -> use this section to print the segments of the upper surface.
4) #print_lower -> rfile prints this section.
5) #segments -> use this section to print the segments of the lower surface.
6) #after_lower -> rfile prints this section.
7) #mean line -> use this to print the point of the mean line


Download rfile.zip


plotters and helpers main page.
links page for conventional aircraft
links page for tailless aircraft
B2Streamlines home page.