MoI discussion forum
MoI discussion forum

Full Version: Anyone wish to develop a custom script?

Show messages:  1-13  …  34-53  54-73  74-93  94-113  114-133  134-153  154-173  …  214-223

From: BurrMan
30 Dec 2011   [#94] In reply to [#93]
Hey Anthony,
Here's a quick shot of it for Brian. Using an Arc is just slightly off where he was at, but his new blue point looked like it may relate.. Showing a quick tool to see it. Maybe he can make the points make sense with this info...


From: Unknown user
30 Dec 2011   [#95]
Here is an update removing the tangent points and adding the point I previously omitted on purpose. The ler and ter definition points are still the last four. I tried burrman's method and it works fine. In this case you can use all the naca points and the ter definition but ignore the ler definition. I don't really care which way you go here. I am keeping the ler and ter and loosening the data point definition. The difference I have been allowing is small. However, if you want to redefine the ler, its fine by mean. Comparing the leading edge you get with burrman's method and using the naca defined radius, the difference is small. I'll let brian and whoever else works on the actual script to decide how they want to do it. I don't plan on using this myself. I just wanted it for others. I have finished all my work on PROP_DESIGN, this was just a loose end I thought could be improved. Either way you go, its about the same for all intensive purposes. The data points, as defined now, should allow you to create the airfoil spline however you like. The main thing is to create a blade that transitions smoothly and follows the naca file i'm referencing as close as possible, since PROP_DESIGN utilizes the performance data for this specific airfoil.

Edit; Latest version is available in a later post.
From: Unknown user
31 Dec 2011   [#96]
Hi Brian,

I tried out your latest update. Very nice. I see the error you found and can duplicate it. I determined it is indeed round-off error. Here are the arrays including the tangent points with as much precision as I can have with the tools available to me:

DATA AFXTAB
& /0.50D0, 1.250D0, 2.50D0, 5.0D0, 7.50D0, 10.0D0, 15.0D0, 20.0D0,
& 25.0D0, 30.0D0, 35.0D0, 40.0D0, 45.0D0, 50.0D0, 55.0D0, 60.0D0,
& 65.0D0, 70.0D0, 75.0D0, 80.0D0, 85.0D0, 90.0D0, 95.0D0,
& 0.2051137930D0, 99.981193170D0, 0.0D0, 0.5750D0, 100.0D0,
& 99.9790D0/
C
DATA AFYTAB
& /0.6880D0, 1.0650D0, 1.460D0, 1.9640D0, 2.3850D0, 2.7360D0,
& 3.2920D0, 3.7140D0, 4.0360D0, 4.2680D0, 4.4210D0, 4.4950D0,
& 4.4850D0, 4.3770D0, 4.1690D0, 3.8740D0, 3.5090D0, 3.0890D0,
& 2.620D0, 2.1170D0, 1.5940D0, 1.0690D0, 0.5440D0, 0.4402377380D0,
& 0.0208850310D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0/

They do not have the one point I take off to have the curve fit work out. So at this point you have a couple of options you can follow. I compared what burrman did to what I did and the difference is small. I am fine with either one. They both make a nice solid with no ripples or any other distortions. Both deviate from the naca definition to make everything work out, as the naca definition contains some error. I am keeping the le and te radius definitions and relaxing the data points by using a curve fit. With burrmans method you can keep the data points using a control point spline and then modify the le definition. The te definition is fine as is.

Very nice work.

Anthony
From: bemfarmer
31 Dec 2011   [#97] In reply to [#96]
Thank you Anthony.
I'll try out the new numbers.
(I previously used the MoI distance script on the two close points, for Y and Z difference, and tried to reverse calculate, and got two multidecimal numbers, but must have messed up the math...)
Also it is possible to drag the spline "tangent" control point, over a tiny bit to meet the arc radius...

Currently trying to script a couple of 3 point arcs, for an intersection. I think "ring circle" script has the techniques to assign a frame, and script enter the
3 points, or two points and an angle.

I'm using this code:
var arcfactory1 = moi.command.createFactory( 'arccenter' );
// angle of +/- _ degrees.
var angleinput = 180.0 ;
arcfactory1.setInput( 0, pt_leArccenter );
arcfactory1.setInput( 1, pt_leArcStart );
arcfactory1.setInput( 3, angleinput );
arcfactory1.update();
arcfactory1.commit();
(repeat for second arc.)

It does not draw anything on the screen. I think the "frame" has to be set?

Next step to create the tangent point, maybe something like this: ?

var myArcList = moi.geometryDatabase.createObjectList();
myArcList.addObject( arcfactory1 );
myArcList.addObject( arcfactory2 );
var tanPtfactory = moi.command.createFactory( 'intersect' )'
tanPtfactory.setInput( 0, myArcList );
tanPtfactory.commit();
?

Still have to study burrman's method...
From: Unknown user
31 Dec 2011   [#98] In reply to [#97]
Hi Brian,

Mainly just to keep files straight on my computer I made two separate versions of the Fortran code. Option A, the way I have been doing it. Includes tangent points. You don't have to use them. I was just trying to help out if finding them via a script was too much trouble. I believe they are working now. Thanks for finding that error. I made two examples but missed the fact that the chord expanded by a small amount. This version also removes one naca point to aid the curve fit.

The second version, option b, is for use with burrman's method. This uses a different method to create the leading edge arc. You can use all the naca data points with the control point spline. The trailing edge still gets defined the same way. However, the leading edge is defined differently than the naca specification.

I compared the two methods and they are very similar. Whichever you choose is fine by mean. They both yield something close to the naca definition that I need. They also make smooth solids with no ripples or anything.

The naca coordinates reference file has always been in a folder called airfoil model.zip, available on my website. Rather than copy that file into the other folders, I am providing the entire zip file.

Anthony

Edit; Attachments have been removed to save server space and because they are out of date. See later posts for the updated information.
From: Unknown user
31 Dec 2011   [#99]
for anyone that is interested,

i added a link, on my website, to a collection of information regarding naca airfois:

http://propdesign.weebly.com/optional-downloads.html

the file is too big to post here or on my website directly, so i have it on my microsoft skydrive.

anthony
From: bemfarmer
31 Dec 2011   [#100] In reply to [#99]
The last one has lots of points.
Is the fortran program still available?
From: Unknown user
31 Dec 2011   [#101] In reply to [#100]
hi brian,

I'm sorry I don't understand your last post, where you say the last one has lots of points. I posted the latest Fortran codes. Are you refering to one of those?

anthony
From: Unknown user
31 Dec 2011   [#102] In reply to [#100]
hi brian,

i think i know what you mean now. are you referring to the updated tangent points having more significant digits? if so, the added numbers are for the added precision needed to fix the error you found. i was previously using the same precision as the naca points. but to get it to work out, i had to add as much precision as i could with the tools I have available (i.e. MoI and a pocket calculator). though, even that precision is far less than that which i normally use.

normally i use double precision (16 significant decimal digits). the updated tangent points are single precision (7 significant decimal digits). the naca points are only three significant decimal digits. as i eluded to in a previous post, they were using slide rules back then. no pocket calculators or computers, since they hadn't been invented yet. so this is why i have been curve fitting their numbers, rather than taking them literally. they don't have enough precision to be taken literally. the rail points, on the other hand, i compute with double precision. so they can be fitted using the control point option.

also, keep in mind, you do not need to use the tangent points. i thought it would make things easier for you by adding them. but if you want to calculate the tangent points yourself, with the theorem you found, that is fine with me. so you really have three options right now. any option you choose should work out. so pick whichever option is most appropriate for you.

hopefully, you found the latest version of the Fortran codes and they help you out. hope you have a happy new year.

anthony
From: bemfarmer
31 Dec 2011   [#103]
By using Ring Circle script as a "template" guide for Frame, have succeeded in creating
arcFactory1 and arcFactory2, by script, showing on screen as two intersecting semicircles of 180 degrees.

Now I have a type mismatch in the following:

var myArcList = moi.geometryDatabase.createObjectList();
//NEXT LINE TYPE MISMATCH
myArcList.addObject( arcFactory1 );
myArcList.addObject( arcFactory2 );
var tanPtfactory = moi.command.createFactory( 'intersect' );
tanPtfactory.setInput( 0, myArcList );
tanPtfactory.commit();

I need to turn arcFactory1, an array ?, into a curve. ??

Maybe I need to use Factory '.calculate' method instead of update or commit, on arcFactory1. ?
Will try again tomorrow...
From: Michael Gibson
1 Jan 2012   [#104] In reply to [#103]
Hi Brian, yeah if you want to generate an object that will only be used for further actions within the script then you can call the .calculate() method on the factory instead of doing update() and commit() like regular commands do.

The .calculate() method generates the output objects from the factory in the form of an object list, but does not add them to the geometry database so they won't be displayed like the regular output of the arc command is.

The other method of calling update() and commit() do add the generated object to the geometry database, so if you are generating arcs and you want the arc to show up as in the regular arc command then you would want to do it that way like the regular arc command does, but if you're only wanting to use the arc factory to generate an arc that will then be used as input for some next internal stage of the script then calculate() is more suited for that.

Eventually there will probably be some more simplified calls to generate some basic curves rather than setting up a factory and setting inputs and all of that, the factory mechanism is more set up to work with the UI inside of a command where the UI controls correspond to the factory inputs.

- Michael
From: Unknown user
1 Jan 2012   [#105]
I found a Fortran source code and executable file that generates NACA 6 and 6A series airfoil ordinates on the PDAS website. I recompiled it, because the exe file they provided wouldn't run on my computer. It contained a program to create a postsript plot of the airfoil. I updated that. Lastly, I made an input file for the NACA 65A009 airfoil file. I am attaching this program here, for those that are interested.

It satisfies questions by Steve and Burrman. Moreover, you get the elliptical fit for the le and the sharp te. Also, you get lots of data points with a bit more significant digits. I looked over the output but haven't had a chance to compare it to the existing options. I don't plan on implementing this method. Some of the reasons being; I would have to remove the sharp trailing edge and put in the radius, I already have a method I prefer, the airfoil was defined and tested long before this code was created, the original definition uses a circle for the le and te that is tangent to the rest of the definition (whereas this version does not). The most important thing for me is to create an airfoil that represents the test data I am using. However, I thought some of you may enjoy having this information for your own work, since you have brought it up. I do plan on comparing it to what I'm doing, just to make sure they are in reasonable agreement, which I expect that they are.

Note, the Fortran code to do the ordinates is over 3,000 lines of code (about the same amount as PROP_DESIGN). Thus the reason I did not want to attempt programming it from scratch. Since I found it on the PDAS site, it was basically no work for me to provide this to you.

Enjoy,

Anthony

Edit; I got a chance to compare all methods and the error is roughly .035 in terms of 100 * x/c and 100 * y/c values. With the majority of the error being contained in the LE transition. Well within the margin of error, considering how the original points were obtained (with slide rules, drafting, charts, etc...). The only option that sticks to the NACA specs is the one I demonstrated with the screencast on my YouTube page. Burrman's method is acceptable as well. I wasn't impressed with the Fortran results. However, they could be beaten into a more usable form if so desired.

Edit 01/04/11: I just noticed in the summary of NASA TM X-3069 they get the same amount of error I am seeing (.035 in terms of percent x/c and y/c). Martin Hepperle's site makes use of this code apparently too. He notes, in the JavaFoil User Manual, not to use the output for the 6 series and instead use the original data sheets, which is what I have been doing. From what I can gather the 6 and 6A series can be traced back to NACA Report 383 by Theodorsen. This work could probably be translated to SMath Studio. A free Mathcad clone.

update; have since determined it is best to use the data points from NACA RM L51I12 for the 65A009 definition.
From: bemfarmer
1 Jan 2012   [#106] In reply to [#104]
Thank you Michael.
Interactive creation of two arcs and their intersection is very easy in MoI.
Doing so by Script has been hard, about 50 lines of code, that still doesn't quite work.

Successfully created two arcs, using Frame, Startpoint(s), and angle.
Created one object list by: var arc1List = arcFactory1.calculate();
Created second object by: var arc2List = arcFactory2.calculate();

How is it possible to combine the two lists into one list, with the two arcs in it?

Or create one list in some other script way?

I do not understand the difference between an Object, and the Object List created by
a factory.calculate();

(I need the object list, in order to run intersect script, non-interactively. Then I think the point created can be pushed into the control point array for a curve factory.)
(All this just to find one point.)

(I tried a bunch of permutations, but kept getting type mismatch errors.)

Thank You.
From: bemfarmer
1 Jan 2012   [#107]
Thought of an alternative method.
Use the script to draw the two arcs.
Modify the menu .htm to request the user to pick the intersection point(s).
Recalculate the control "spline."
Delete arcs, and redraw smaller arcs, or user can do the trims and deletions...
From: Michael Gibson
1 Jan 2012   [#108] In reply to [#106]
Hi Brian,

> Created one object list by: var arc1List = arcFactory1.calculate();
> Created second object by: var arc2List = arcFactory2.calculate();
>
> How is it possible to combine the two lists into one list, with the two arcs in it?

An object list has a method addObject( obj ) that you can call to add the given object to the end of the list.

And you can retrieve an object from a list by using the item( index ) method.

So what you are talking about would be something like (assuming each has 1 object in it currently):

arc1List.addObject( arc2List.item(0) );



> Or create one list in some other script way?

You could also create a completely new list by calling moi.geometryDatabase.createObjectList() and then add both arcs to it.


> I do not understand the difference between an Object, and the Object
> List created by a factory.calculate();

Well, an object list is a container that can hold multiple objects - since some geometry factories may generate multiple objects the .calculate() method cannot just return a single object since that would then not work for those kinds of factories that generate multiple outputs.

So in order to be consistent across any kind of use, the calculate() method always returns an object list, even if the output was only a single object like it often is in most of the draw-type commands. So in cases like that it's a list but it contains just 1 object which you can access using the .item() method on the object list.

That's one of the details that's kind of more complicated currently with the factory system being oriented towards working with a number of different commands, at some point in the future it is likely that I'll add some more kinds of geometry creation methods that will just pass all the different parameters to a creation function rather than setting up factory inputs like the current system - the factory input system is more oriented towards each different input being wired up to some kind of UI control.


Check out this previous post for a plug-in command that creates a couple of circles and intersects them to create a point - it sounds like that is pretty close to what you are trying to do currently:
http://moi3d.com/forum/index.php?webtag=MOI&msg=3832.15


- Michael
From: bemfarmer
1 Jan 2012   [#109] In reply to [#108]
Thank you very much Michael. :-))
It Worked. Have created the leading edge arc, and the spline, for the AirFoil.

Now need to "duplicate" the code for the trailing edge...
From: bemfarmer
1 Jan 2012   [#110]
Attached is "provisory culmination" (just read that in a book...) of the Prop_Design_Geo Script for MoI.
There may still be errors.

The "tangent" points, and the two edge radius arcs, are created non-interactively.
Dealing with the leading edge and trailing edge, non-interactively, took about 100 lines of code.
This might be reduced a bit by calling a few functions..
Creating the points with interactive MoI takes perhaps 10 actions +/-.

Michaels help was invaluable.

Learned a great deal about MoI scripting, on this project.
:-))

Attachments:
PROP_DESIGN_GEO_1_1_2012.7z


From: Unknown user
2 Jan 2012   [#111] In reply to [#110]
thanks brian,

can't wait to check it out.

anthony
From: Unknown user
2 Jan 2012   [#112] In reply to [#111]
hey brian,

got a chance to try it out. works good. a few things though. with the le the way you are doing it you have to take out point .75, .835. Otherwise the curve fit gets messed up. I just manually deleted it and the curve adjusted, however, most people wouldn't know to do that. Also a long time ago burrman and Michael found that you couldn't have the le and te be two arcs. Which is what I had. It would be like mirroring the two that you have in there. So I mirror the spline then make the arcs, so that they are one arc for the le and one for the te. You can do this easily from what you have generated. But most people wouldn't know to do that. I'm curious if its taking 100 lines of code to find the tangent points, wouldn't it have been easier to just enter the tangent point i added into the array?

anthony
From: bemfarmer
2 Jan 2012   [#113] In reply to [#112]
Hi Anthony, :-)

I'll remove the .75 and .835 from the code for the spline.


>Also a long time ago burrman and Michael found that you couldn't have the le and te be two arcs. Which is what I had. It would be like mirroring the two that you have in there. So I mirror the spline then make the arcs, so that they are one arc for the le and one for the te. You can do this easily from what you have generated.

Edit: Okay, I think I see your point now. A mirrored half arc (even if joined,) has different control points from one full arc.
It should be possible to easily adjust the arc creation code, to do so. Just start on the tangent point, and make the stop point the tangent point adjusted with negative Y value.

>wouldn't it have been easier to just enter the tangent point i added into the array?
Yes, this is true, if the points are on the arc, (or within .001 ?). But initially, did not have the data point, and later the two points did not quite lie on the arc, so got started trying to figure out how to script the arcs and tangent points, to be more or less "exact".
If you like, I can make a version using your given tangent points, if they are within "tolerance"? (for a reduced code linecount.)

Show messages:  1-13  …  34-53  54-73  74-93  94-113  114-133  134-153  154-173  …  214-223