MoI discussion forum
MoI discussion forum

Full Version: Anyone wish to develop a custom script?

Show messages:  1-20  …  41-60  61-80  81-100  101-120  121-140  141-160  161-180  …  221-223

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.)
From: Unknown user
2 Jan 2012   [#114] In reply to [#113]
hi brian,

i didn't realize the tangent points i added were wrong until you pointed it out. i did two checks, but was zoomed out to much to see the error. they had round-off error because i reduced them to the naca three decimal format. so i increased them to the max moi allows. that should fix the problem. but doing it the way you have it now is fine. it should be just as accurate. sorry i was too late to save you all the added coding. but it seems like you enjoyed the process of learning moi scripting.

i look forward to the next version.

anthony
From: Frenchy Pilou (PILOU)
2 Jan 2012   [#115]
Does this srcipt can be used also for boats' propeller blades ?
From: Unknown user
2 Jan 2012   [#116] In reply to [#115]
Hi,

No, sorry. However, if anyone knows enough about marine propellers, it should be a pretty easy code update. I don't know anything about them, but I think you would need to use a hydrofoil model rather than an airfoil model, account for cavitation, chord distribution options appropriate for marine propellers, and use water properties rather than an atmospheric model. Other than that, PROP_DESIGN probably would work for marine propellers. But you would need to consult with an expert or be an expert in that area to know for sure.

I have a version of PROP_DESIGN, that I haven't released, that you can enter any fluid properties. So that part is already done. I looked into hydrofoil properties at one time, but not having any experience with that, I didn't pursue it too much. If that is something you know a lot about, the two of us should be able to get the update done.

I only have expertise with aircraft propellers. Which is why I haven't adapted PROP_DESIGN for helicopters either. I could adapt it to wind turbines but have no desire to. Just not into wind turbines. I have been interested in propellers since college. Studied them for years and then took jobs in that industry to learn more. So a lot of man hours went into PROP_DESIGN. I am not the kind of person to just code something I don't know anything about.

PROP_DESIGN is open source though. I released it as public domain software. So you could do anything you like with it. No need for my permission or anything. My hope is people will develop it more and make it even better. I wanted to give students something better than I had to go through to learn about propellers. I accomplished that. However, as far as software goes, PROP_DESIGN could use the love/development attention of many types of engineers (marine, aerospace, structural, software).

Anthony
From: bemfarmer
2 Jan 2012   [#117]
Custom distance script can be used to measure the Y and Z coordinates of a point, (distance to axi.)
First increase the number of digits, as previously posted on the forum.
From: bemfarmer
4 Jan 2012   [#118]
Here is an update to the MoI script version, PropDesignGeoOptionA.
It uses Option A, pre-calculated "tangent" points, which is probably better than trying
to find the points by arc, or circle interception, as there could be zero or two intersection points.

Most of the coding for the previous version was re-used, with slight change, except for the four arc intercept coding.

The mirrored tangent points were easy to get, just negate the y values. The arcs are on both sides, no need to mirror them.

I think it would be easy to script mirror the airfoil spline, with the mirror factory...

On a side note, still trying to figure out how to extract the x, y, and z values, from a given point.
Either vector math, or the "get" method in point?
From: Unknown user
4 Jan 2012   [#119] In reply to [#118]
thanks brian,

i'll check it out. i was just about to post a hack i did of your script to give you and idea of what i was thinking. but let me see what you have here. i noticed one thing with the previous scripts. they don't use the hub end point input. what that input is for is to make a circle at the point specified. the circle would be in the top view and use the point on the 1/4 chord line. the first point being counted as 1. so it should be relatively easy. since that input would just be making a circle. i was able to use trial and error and beat the script into submission. however, i don't know enough to actually add something to it. i was just editing what existed.

anthony
From: Unknown user
4 Jan 2012   [#120]
hi brian,

i like what you got. its a little better than what i did. the only thing i changed form what you have now is removing the points from the le and te rails. the points are only needed on the 1/4 rail for reference. i also tried taking the curve off the 1/4 rail but that made it graphically hard to look at. so i ended up putting the curve back on the rail along with the points.

if you do go about mirroring the airfoil spline, would it be possible to join all four curves of the airfoil definition, so that it was one joined curve. if so, it would be reading to sweep, with no work.

great job.

anthony

Show messages:  1-20  …  41-60  61-80  81-100  101-120  121-140  141-160  161-180  …  221-223