| FAST MEXing with Eclipse, Photran and G95 Compiler |
|
|
|
|
FAST is a very useful software for the simulation of Wind Turbine Generator systems, developed at the National Renewable Energy Laboratory (NREL); the program core consists of a non-linear multi-body model written in FORTRAN that can be also implemented in MATLAB/Simulink® as a S-Function.
The FAST software package can be downloaded from NWTC Design Codes page and already contains a good set of example WTG; along with the command line Windows version of the program, a couple of Simulink model, based on a MEXed version of FAST (that is a .dll or mexw32/mexw64 depending on new/old releases), is also available.
FAST is "ready to go" but can happen that you want to change some parts of the code to satisfy certain requirements; the complete source code is available and the following steps can be used to build an executable file or a dynamic library.
INDEX First of all I've to say the methods described here are intended for Windows users, but I really don't have spent time to figure out compatibility on other OS that could be present.
Compiling FORTRAN code means that at least one FORTRAN compiler is setup on your system; two free compilers, GFortran and G95 are available and I've choosen the second. These compilers need a UNIX-like C development environment, provided on Windows by Cygwin or MinGW. The latter will be used for this purpose. Install first MinGW (MSYS is recomended too) and then G95. Instructions, how-to, installers and other resources are available from the respective web pages and are frequently updated (that's why not directly linked from here).
The Mathworks grants compatibility with most commercial FORTRAN compilers like Compaq/HP and Intel; there is no supporting documentation for the free G95 compiler(GNU) but has been succesfully tested too.
Last thing we need to speed up coding/debugging phase is a full featured FORTRAN IDE; Eclipse + Photran plugin will do the job. If it is your first time using Eclipse download Eclipse IDE for C/C++ Developers otherwise you can simply downloand/install the Photran plugin.
I found some very helpful pages on the net and here they go as a reference for you too: How to compile Matlab-compatible (or Simulink-compatible) MEX files? Assuming you have downloaded FAST and AeroDyn packages from the NWTC repository, create a new FORTRAN project in Eclipse with whatever name you want (FAST602c for me)and import the source files (this creates a copy, not affecting your original). This is done by right-clicking within the Project Explorer and selecting Import->General->File System and browsing to the correct file/folder. A destination subfolder can be specified in Into folder textfield (for the purpose AeroDyn will be copied to FAST602c/AeroDyn, and FAST source to FAST602c/Source, FASTDynamics.f90 and FASTGateway.f90, used for the S-Function only, will be copied to FAST602c). Then we need to prepare the output folder, by right-clicking on the Project Explorer then New->Folder and name it SFunc; create also two SFunc subfolders named Modules and Objects (just to keep the workspace clean) Next, we create the makefile by right-clicking on the SFunc folder inside the Project Explorer then New->File and choosing makefile (no extension) as filename and finally copying the following lines, or simply downloading and importing the makefile into SFunc dir: MAKEFILE
Photran has a view called Make targets in which you can link all targets from a makefile; once you have your makefile inside the SFunc folder just right-click on it then go to Make targets->Create and fill in with a name of your choice (FAST SFunc for me) and fasts for the target. Double clicking on the target hopefully should build FAST602c_SFunc.mexw32 and put it inside SFunc folder NB: the proposed makefile has no optimization; to force hard optimization or customize the process a bit more follow G95 Manual instructions. B. Managed MAKEFILE This option creates a makefile starting from project dependent settings (toolchain, compiler, linker, etc...) At the time of writing, this is unusable feature for projects with multiple source files (so with FAST too) due to an error on compile/link dependencies order.
|
||
| Ultimo aggiornamento Martedì 31 Marzo 2009 12:32 |





Comments
Thanks,
With some effort I have my version of FAST compiled with G95 through Eclipse. My new problem is getting turbulent wind files read. Would you please let me know if you have problems reading full-field wind files.
Thanks,
good to see you verbalise from the heart and your clarity on this important subject
can be easily observed. Thanks again!
wonderring if i can contact you via email when i meet problems?
store.com]prada store[/url] it's worth buying!
Talk about [URL=http://www.hotsalewatch.com]discount watches[/URL] .My mum goto buy
[URL=http://www.myceramicwatch.org]ceramic watch[/URL].But I like
[URL=http://www.mydiscounthandb ags.com]discount handbags[/URL] more.
Where do I could buy
[URL=http://www.mydiscountwatch es.org]discount watch[/URL].
Let's go to buy
[URL=http://www.thedesignerwatc hes.org]Designer Watches[/URL].
Find the
[URL=http://www.theledmanufactu rer.org]led manufacturer[/URL] from China.
Do you want to purchase for low price
[URL=http://www.wholesalejewelr ywatches.net]wholesale jewelry[/URL]
that is what I want.
I want to be [URL=http://www.benwon.com]led strip lights[/URL] designer.
My father want to find [URL=http://chinaelectrade.com]China Electronics[/URL] supplier.
[URL=http://www.themarcjacobsha ndbags.org]Marc Jacobs Handbags[/URL] This is the one I want to
buy.