Updated OpenFAST User Manual Windows 10

Download as pdf or txt
Download as pdf or txt
You are on page 1of 51

USHE DEEP TECHNOLOGY WIND TURBINE PROJECT

OPENFAST WIND TURBINE SIMULATION USER MANUAL


Matt Thomas, Noah Boettcher and Abdennour Seibi

Introduction

Open-fast wind turbine simulation is an open-source analytic software to calculate blade

loads, power generation, torque, and roughly 2900 other types of outputs selected from an

excel file. This document will serve as a guide to installation and basic usage of the

software. MATLAB will be used to generate plots and graphical data as well as PyDatView.

All commands will be provided as well as the most current links to the software at this time

of writing. Default inputs of 12m/s wind speed and a 63-meter blade are used. Tower

height is 90 meters. It is recommended to download Notepad++, vscode, and PyDatView to


read and edit files. Instructional videos covering this report have been uploaded to

youtube. (65) How to use OpenFast wind turbine simulation software - YouTube
Downloading and Installing for Windows 10 (have not tested on 11)

Installing and using OpenFAST can be challenging. The first challenge that is encountered is

to make the user environment structure easy to follow and find. To mitigate this challenge,

it is recommended to create a new folder in “My Documents” with a label/name that is easy

to understand, such as “open fast”. This newly created folder is where you will download all

the necessary files to use and run OpenFAST.

Please visit the following link to download the files:

OpenFAST/openfast: Main repository for the NREL-supported OpenFAST whole-turbine and

FAST.Farm wind farm simulation codes. (github.com)

Once the page has loaded, click the green code button near the top right corner as

displayed in the screenshot below. It will open a drop-down menu. Select “download zip”

Save the zip file to the newly created folder as previously mentioned. Once the download

has completed, click the blue folder on the website called “reg_tests” and then click the blue

2
folder named “r-test @ef6ab57” or similar. Once in this folder, click the green code button

and download the zip file to the same location as the OpenFAST files. Use the link below to

navigate to the r-test folder.

OpenFAST/r-test at ef6ab575919f1db597702f1c3f86a16bdc2b4338 (github.com)

Unzip (uncompress) each downloaded folder by right clicking on it and selecting “extract

here” Once that is done, please pay close attention to the next steps. This is very important,

or it will not work correctly.

The next challenge is to have OpenFAST run properly without any fatal errors. The most

common issue to occur, is not downloading and using the .dll files required for the

program to run

Click the link below and scroll down to the section named “assets” from here you want to

download the list below, into the same location as previously aforementioned “My

documents/OpenFast”.

Release v3.5.0 · OpenFAST/openfast (github.com)

Discon.dll
Discon_ITIBarge.dll

Discon_OC3hywind.dll

DisconSC.dll

openfast_x64.exe

Once the files and folders have been downloaded and extracted, navigate to the r-test

folder followed by a string of characters as shown in the image.

3
Open the second nested r-test folder, then open glue codes, then finally openfast. In the

OpenFAST folder resides many test folders for a standard 5MW wind turbine with a blade

length of 63 meters and a tower height of 90 meters.

This next step is crucial. Copy the discon.dll file you downloaded and paste it into the

“ServoData” folder within the 5MW_Baseline directory. Without this .dll file, the program will

not run. Notice my file path in the address bar of the window in the image below.

4
Now that the .dll has been copied into the correct folder, its time to run a test. The easiest

and most accurate test to run for testing purposes, is in the 5MW_Land_DLL_Wturb folder.

Do not edit any of the files yet. This is just a basic test. To do this, right click on file explorer

( the yellow folder in your windows taksbar) and select file explorer. This will open another

window that we will need.

Navigate to the OpenFast folder where the openfast_x64.exe was downloaded too. Now,

snap the window containing the .exe file to the left side of the screen, and then snap the

5mw_land_dll_wturb window to the right of the screen as shown in the image below.

5
Next, drag the 5MW_Land_DLL_Wturb.fst file on top of the openfast_x64.exe file. Once this

is done, it will open a command prompt and run the simulation. Do not touch any keys at

this time or click the mouse, it will cancel the simulation. If the .dll file was copied to the

correct folder, the program will finish with no errors. If the file is not copied, it will tell you

in the command prompt that it is missing the required dll in the current location.

The command prompt sometimes closes too fast to see the error. To mitigate this, re-run

the .fst file and as soon as the command prompt opens, click the mouse cursor anywhere

on the command interface. This will cause it to freeze, allowing you to see any errors.

After a successful completion of running OpenFAST, it will create a few files ending in .sum

and .outb. Please verify that the file size is greater than 0. This file size check verifies that

there is data in the file. If you want to, you can right click on any of the .sum files, open with
Notepad++ and see the time series data that was collected. This summary file will not tell

you anything useful. The useful information is located in the binary file with a .outb file

extension. It is noted to the reader that Notepad++ cannot view binary files and must either

use MATLAB or PydatView software app.

6
Results and MATLAB plots (refer to the next section if you do not have MATLAB)

For those wanting to use MATLAB to view the results, please follow this section.

Once the first test has run and completed, MATLAB can be used to read the binary output

file with the extension of .outb. This file contains all the basic default outputs and channel

name. Each channel is a specific category that was calculated such as windspeed or torque

generation. To read the .outb file, download the ReadFASTbinary.m file from the following

link and make sure its in the SAME folder as the .fst file that was originally executed.

matlab-toolbox/Utilities at main · OpenFAST/matlab-toolbox (github.com)

Open this file in MATLAB but do not edit anything in the file. In the command window, copy

and paste the code below into the MATLAB command window. Once you hit ENTER, it will
automatically generate the matrices:

--------

%% Run this command first

%% Read a binary output file

% Read file

outbfile = '5MW_Land_DLL_WTurb.outb';

[Channels, ChanName, ChanUnit, FileID, DescStr] = ReadFASTbinary(outbfile);

time = Channels(:,1);

-------

7
This will produce a set of matrices that you can see on the right hand side or bottom left,

depending on the MATLAB configuration. Notice the matrix named “channel names”

double click that and it will show all the tests run as shown in the figure below:

The matrix ChanName is 59 units in length, meaning it has 59 variables that can be

examined using the MATLAB plot function. Using the code below, change the channel

number to the desired output. For example, lets look at wind speed in x direction on

channel 2:

--------

%%Change the plot number to reflect the parameter in channel names matrix generated

from above command.

% Plot Channel 5

iChan=5

figure()

plot(time, Channels(:,iChan))

xlabel('Time (s)')

ylabel([ChanName(iChan) ChanUnit(iChan)])

8
Below is the output of the wind speed in the x direction. By default, it is an average of

12m/s on a 63 meter length blade with a 90 meter tower height.

From here, you can use the same code to generate more graphs, just be sure to change the

ichan to the correct name to view the results.

9
Using PyDatView to Read and Display OpenFAST Plots

MATLAB is not needed to view the plots or results from the .outb binary file. MATLAB is an

excellent tool to use, however, not every user or company has MATLAB or wants to spend

the cash on a license.

To download PyDatView, visit the link below, and scrol down to the assest section.

Download the pydatview.exe file. It may have a simular name, but for windows, make sure

to download the .exe

Release version v0.3 (latest stable version) · ebranlard/pyDatView (github.com)

Once it has been installed, Open pydatview and then drag and drop the .outb file onto the

empty pydatview window. It will now be displaying all the information calculated by
OpenFAST. To the left are all the channel names and data types. On the right-hand side, it

will display the plot and associated information contained in said plot as shown in the

image below.

10
Adding Inputs to the Outlist Section for Testing

This section of the document explains the process of adding more inputs to the .dat files

for testing. Each wind turbine folder contains several .dat files. For this example, using the

5MW_Land_DLL_Wturb folder, it has the following input files:

Each one of these input files contains a section called the “outlist” as highlighted in the

photo below. You can open and edit these files with Notepad++.

For example, this is the ElastoDyn.dat file. The primary ElastoDyn input file defines

modeling options and geometries for the OpenFAST structure including the tower, nacelle,

drivetrain, and blades. It also sets the initial conditions for the structure.

The items highlighted last such as “LsSGaGMya” are the input parameters. Usually, a

description is provided to the right of these. To find the list of inputs, download the excel

sheet below and click on the ElastoDyn tab at the bottom. This will have roughly 900 entries

of input codes that can be used to add to the outlists section. Some of them may return

11
INVALID when run. When this happens, make sure its not an input code for a wind turbine

with more than 3 blades. Download the outlistparameters excel file below:

OutListParameters.xlsx (live.com)

As mentioned before, open the ElastoDyn tab and look at the formatting of the excel sheet.

The code under “Name” or “Other Names” is the code that will be copied and pasted into

the elastodyn.dat file. Be sure to surround it in quotes as shown in the image above (not

below).

If you are planning on using Mlife to test for fatigue analysis in the future, you will need to

change line 50 in the .fst file to a value of 3 as shown in the figure below. This tells

openFAST to output the file in a binary (.outb) ad well as an asci file (.out). Mlife can read

both, however, its good practice to have both output files. Pydatview can view the results

from either the .outb or .out file.

12
Changing the Wind-speed via the InflowWind Input File

Sometimes the default 12m/s wind speed is not enough for some test simulations. To

change this parameter, it can be very tricky due to the .fst file using 3 other files to call wind

parameters into play.

Examining the .fst file in the image below, the highlighted portion is the MAIN input file for

the wind. It is found in the 5MW_Baseline folder. This InflowWind dat file will be used to

edit the windspeed for the turbine.

Navigate to this folder, right click on the .dat file highlighted above and edit with

Notepad++. This will then open up the InflowWind file for editing. The most importatnt

section of this file is at the very top where it mentions “Wind Type”. There are 6 different

values to choose from. For this paper, we will be sticking with values (1) and (3).

13
A switch value of 1, tells the software to use a steady, constant stream of windspeed, such

as 15m/s with no fluctuations. The default value of 3, is to use ANOTHER input file

generated by TurbSim to create turbulent windspeeds at a default of 12m/s. Compare the 2

images below of turbulent vs steady.

If using a switch value of 1, you will need to change the Hwindspeed parameter highlighted

in blue above and below, to the desired value. You can see that 25m/s is being used for this

example.

Each wind type has its purpose, but the 2 best, easiest and accurate values to use are 1,

and 3. The next section will cover how to use TurbSim to change the default 12m/s

turbulent windspeed to another value.

14
Using TurbSim To Generate BTS files for Wind Turbulence

TurbSim is used to generate the .bts file which contains all the wind data needed for

openFAST to calculate loads etc. This .bts file contains parameters such as hub height, wind

speed, grid length and grid width, number of grid nodes, and how long to move wind

across the blade.

Grid width and Grid length refers to the size of the section, like a sheet of paper, of wind

that will flow across the wind turbine. This sheet of paper, for lack of a better word,

contains all the necessary wind information such as vector fields, velocities, wind

turbulence type, and many others that are above the scope of this paper.

In order to use TurbSim, we need to download it and then generate some files. It’s a simple

process. Create a new folder anywhere you have access to, and name it TurbSim. Click the
link below to download the executable file. It is also highly recommended to download a

binary viewer named PyDATView by scrolling down to the assets section and downloading

the .exe file from the supplied page.

Releases · ebranlard/pyDatView (github.com)

TurbSim | Wind Research | NREL

Find the TurbSim_v1.50.exe and download that to the newly created TurbSIm folder.

Double click the .exe file and hit the unzip button to allow the operating system to unzip

and extract the files and folders. Once it has finished this process, Open up the TurbSIm.inp

(input file) in notepad++.

15
Under the runtime options, line 9, turn that value from false to true. This will generate a

.bts file for use to map in the InflowWind.dat file. Line 9 may be something different for

other users, so just make sure to read the comment to the right and ensure that the value

you are turning to “True” is indeed for the Rootname.bts generation.

Once the value from false to true has been changed, save the file by using CTRL+S on the

keyboard.

The next set of values to change are extremely important. If they are wrong, the program

will crash with a fatal error, stating that the grid in the z direction is too small. Follow the

image below to change the Turbine model specifications section of the TurbSim.inp file in

notepade++

It is important that the grid height is 155, any lower and the program fails stating that the

grid is short by 8.23 meters, any higher, may cause similar issues. You can always test a

larger number, but 155 works just fine. The error happens because in the aerodyn15.dat

file, there are aerodynamic nodes placed along the tower below the blades, thus needing a

big enough grid to cover said nodes with a full wind field. Be sure to save any new changes.

16
Next, we need to open a power shell from the current working directory. Do this simply by

holding the shift key and right clicking on the empty white space of the opened TurbSim

directory as shown in the image below. Make sure you do not have any files selected while

doing this or it will open a different set of options.

Once the power shell has opened, run the following command:

.\TurbSim64.exe .\TurbSim.inp

This will tell TurbSim to run the input file and generate the new .bts file to use for wind

turbulence in the InflowWind.dat file. Do not drag and drop the .inp file over the .exe as we

did for the openFAST program. We need to see if any errors occur and the only way to view

this is via the command line as shown below.

Notice TurbSim had a fatal error and aborted. If you check the newly created .bts file, it will

show a file size of 0Kb. This is due to line 30 being set to “SMOOTH”. This parameter

17
requires a different EVENT structure that openFAST cannot read or support.

Switching line 30 to a value of “IECKAI” will provide an input that is supported by openFAST.

Once you have made the changes, save the file and re-run the command.

Notice it completes successfully?

18
Now open up PyDATView then drag and drop the newly created .bts file into the PyDATView

window. This will then show the list of outputs. Clicking on the “u” will show the average

wind speed generated by TurbSim.

Once you have verified that there is data in the .bts file, copy and paste it to the wind

directory in the 5MW_Baseline folder. Now navigate one directory back and open the

NRELOffshrBsline5MW_InflowWind_12mps in notepad++.

Find line 22 and edit the path (“Wind/90m_12mps_twr.bts) to reflect the name of your

TurbSim.bts file “Wind/TurbSim.bts”. By default, the name should be TurbSim.bts.

line 22 should reflect the following edit: “Wind/TurbSim.bts”

The above input will now read your created turbulent wind file and generate data based

from this file. Once you have saved the edits, go ahead, and run the

5MW_Land_DLL_Wturb.fst file again to generate data. It is recommended to do a minimum

of 10 minutes for analysis time for both TurbSim and openFAST.

19
Changing Wind-speed in TurbSim

Changing the wind speed in TurbSim is easy. Line 37, under the “Meteorological Boundary

Conditions” has a default value of 18.2 m/s. Change this value to the desired input, save the

file, and then re-run the commands above to generate the new .bts file. It is recommended

to also change the “Useable Time” input from 60 seconds to at least 1000 seconds for

better analysis.

Once the .bts file is created, be sure to verify it by viewing it in pydatview to make sure the

parameters are correct. Once verification is done, be sure to copy and paste the new .bts

file into the “Wind” directory and re-run the .fst file by dragging and dropping it onto the

openfast64.exe.

Following these basic and intermediate steps will result in an OpenFast binary file that you

can then use MATLAB to view as previously demonstrated. There are many options and

inputs to add to the “outlists” section of the .dat input files for most or any type of analysis

and presentations. If you want to change the average windspeed while keeping the Uref at

a particular speed, such as 18.2 in the above image, change the random seed number

which controls the instantaneous turbulence at a given moment. This will produce a

different average each time. This allows you to make multiple files with different average
speeds to calculate a better fatigue number.

20
Using Python to Predict Fatigue and Cycles to Failure

The next section will use the data calculated from these last sections and use it to calculate

fatigue and cycles to failure. Once those values have been calculated, one could create S-N

curves and formulas to help predict the life cycle of wind turbine blades.

This is by far the most complicated section thus far. It is very easy to get lost and very easy

to run into errors. It is recommended that you have someone with python experience help

with this process.

The first step is to download and install VS code for windows 10. The link below will take

you to the current version:

Download Visual Studio Code - Mac, Linux, Windows

After installing VS code. Make a folder on your C: called fatigue. We will be downloading an

entire python environment to this location. Next, go to the windows store and search for

python 3.11. This is the current version as of this writing.

21
Once python has installed, you will want to download the openFAST python tool box from

the following link. Please click on the green code button, and click “Download zip”. This will

download the scripts and the environment needed to calculate the Damage Equivalent

Load or DEL. Please ensure to download it to the C:\\fatigue folder that was created a few

steps previously.

OpenFAST/python-toolbox at dev (github.com)

Unzip the python toolbox in the fatigue folder. It will create a new folder named “python-

toolbox-dev” Double click this folder , it will open up and you will see a singl folder named

“python-toolbox-dev” navigate into this directory and you will see the following with some

exceptions.

Ok, now comes the challenging part. We need to create a script called EquivLoad.py in

order to run and calculate all the functions. This EquivLoad.py script will call upon the

fatigue.py script that is under the pyFAST>tools directory. This fatigue.py script in the tools

directory is many many lines of code that will calculate the DEL for us based off of

information found in out generated .outb file. I will explain the theory and mathematics

after this section.

22
Navigate to this page below and you will see a script with about 35 lines of code. Highlight

the code, copy it and paste it into a empty Notepad++ file. Save it as EquivLoad.py in

python-toolbox-dev folder that CONTAINS the pyFAST directory as shown in the image

below.

python-toolbox/pyFAST/postpro/examples/Example_EquivalentLoad.py at dev ·

OpenFAST/python-toolbox (github.com)

Here is the code in case github or the author has moved the files:

"""

- Open and OpenFAST binary file

- Convert it to a pandas dataframe

- Compute damage equivalent load for a given Wohler exponent

"""

import os

import numpy as np

23
import matplotlib.pyplot as plt

from pyFAST.input_output import FASTOutputFile

from pyFAST.postpro import equivalent_load

# Get current directory so this script can be called from any location

scriptDir = os.path.dirname(__file__)

# Read an openFAST binary

fastoutFilename = os.path.join(scriptDir, '../../../data/example_files/fastout_allnodes.outb')

df = FASTOutputFile(fastoutFilename).toDataFrame()

# Compute equivalent load for one signal and Wohler slope

m = 1 # Wohler slope

Leq = equivalent_load(df['Time_[s]'], df['RootMyc1_[kN-m]'], m=m)

print('Leq ',Leq)

# Leq = equivalent_load(df['Time_[s]'], df['RootMyc1_[kN-m]'], m=m, method='fatpack') #

requires package fatpack

if __name__ == '__main__':

plt.show()

24
if __name__ == '__test__':

np.testing.assert_almost_equal(Leq , 284.30398, 3)

And here is the code pasted in an empty Notepad++ file.

Now that the EquivLoad.py file is saved in the correct location, or it will fail and cause major

headaches, it’s now time to setup VS code and the fatigue.py script to calculate the results.

25
With vs code open, click the top left icon named Explorer that looks like two pieces of paper

on top of each other (in the image below, it is underlined in red). It will then ask for you to

open a folder, select the C:\\fatigue folder created earlier. Vs code will now populate the

left window pane with the file structure needed to run the scripts.

You can see how the FATIGUE folder was imported into vs code. Click the arrow next to

python-toolbox-dev, to expand that directory.

26
Notice the EquivLoad.py script that we created earlier by copying the lines of code? This is

the script that we will run in order to calculate the DEL. But before we do that, we need to

install some things.

Bellow all the lines of code, there is a section labeld “Terminal” click on that and you may

have to drag the windo up slightly in order to see the terminal. Next you will want to install

the following packages using a packet manager called pip:

numpy

matplotlib

pandas

do this by using the syntax pip install numpy. The italics or just for emphasis. Do this for

each of the 3 packages. It will download and install the packages needed for the

calculations. If you try to run the EquivLoad.py script without these packages, it will fail.

27
Once they have finished downloading. Its time to look at line 24 of the EquivLoad.py file.

It should say the following:

Leq = equivalent_load(df['Time_[s]'], df[‘RootMyc1_[kn-m]’], m=m)

Notice the ‘RootMyc1_[kn-m]’ Do you recognize that as one of the parameters we can add

to the outlists section of the Elastodyn.dat file of the 5MW_Land_DLL_Wturb example at the

beginning of the document? This python script uses the data from the root moment along

‘y’ to generate loads and compute the DEL value. This can be changed to other parameters,

but I will discuss that later. If your generated .outb file does NOT contain the ‘RootMyc1’

parameter in the outlists section, please refer back to that section and re simulate the

turbine with that parameter.

Next, we need to calculate some things and then change it in the script. Roughly line 40 of

the fatigue.py script, you should see a line that contains the definition of equivalent load. It

should look like the image below:

28
We need to change two of these to get the most accurate results. Teq is the first value to

change. It represents the equivalent period of the time series. Mathematically, period is

1/freq, but we need to find the frequency first. To do this, open the .outb file in pydatview.

Locate the RootFxb1 or RootMyc1 channel name on the left window. Once you see the

graph, click the FFT button for graph type. This will convert it to a Fast Fourier Transform

where we can easily find the peak frequency of the first harmonic. In the case of this

document, our current frequency is 2.11 Hrz as shown in the image.

Now, we can compute 1/f to be 1/2.11 or 0.5 for the Teq variable. Changing this as well as

setting m equal to 3, we will now be able to run our first test with decent results. You may

have to change line 25 in the equivload.py script for m to equal 3 as well, if it has not

already been changed.

To run our first test, copy the .outb file and place it in the C:\\fatigue folder (or wherever
you have created your environment). Next, on the EquivLoad.py script, edit line 16 to reflect

the following changes:

file_path = 'C:\\fatigue\\5MW_Land_DLL_WTurb.outb'

29
Once the path has been changed on line 16, save the changes. With EquivLoad.py still

selected, click the “Run” button at the top and then “Run Without Debugging”

This will run the script and calculate Damage Equivalent Load or Load Equivalent Damage.

Both LEQ ad DEL mean the same thing. The output will look like the following:

The units of this output will be the same units as whatever parameter was used, in our

case, the ‘RootMyc1’ parameter was used for the calculations, meaning the units will be in

Kn-m as a moment. Please read the next section to learn how to change the parameter to

get outputs in Newtons.

To analyze fatigue, engineers often use the concept of an "equivalent load." This is a single

static load that, if applied continuously, would result in the same damage to the structure

as the actual cyclic loading that it experiences. The damage is typically quantified using a

fatigue life estimation method, such as the stress-life (S-N) curve, which relates the number

of cycles to failure for a given stress range. If you want to find the cycles to failure, convert

30
the force into a stress, stress=F/A where F is the loading force from DEL, if using RootFxb1,

and A is the cross-sectional area of interest. This will produce a stress in Pa and then you

can use a S-N curve of GFRP, CFRP or of a wind turbine blade made of these materials. Lets

look at an example below:

If our stress were 200Mpa, then our cycles to failure would be slightly higher than 10 0000

cycles. If you want to do hand calculations or use excel, you will need to get the “Ultimate

Load” of the material from a table, then use a formula to find cycles to failure based on the

DEL. For example, the ultimate load for A130 GFRP is 858 MPa or 124.442 Kpsi, and the

associated DEL is 68Kn, we can use the equation below to find cycles to failure if we know

the Fixed Mean Load (LMF) or if we let LMF = 0, meaning the mean stress is 0.

31
There is another method to find cycles to failure based off the fatigue strength fraction as

well as the ultimate tensile strength as outlined in Shigleys Mechanical Engineering Design

9th edition as follows:

A basic example of this is as follows: If we use the same material as previously, A130 GFRP

with an ultimate strength (Lult) of 124.442 Kpsi where S`e is half the ultimate strength. We

can see from the chart above that the fatigue fraction is 0.801. Solving for a, and b in the

equations, a = 165.314Kpsi, b = -0.0707, and using N = 10^6 cycles to failure, we will see

32
that the blade can handle a continuous load of 62.24574Lpsi for 1,000,000 cycles. To find

cycles to failure, if we know the MAX kpsi the blade experiences during use, that is our Sf

and then we can solve for N. IE, imagine the max load the root of the blade feels is 444kN,

we can convert that to a stress and then use that as Sf and solve for N and in our case, this

will most likely have an “infinite” life cycle and wont fail to fatigue, however, environmental

factors will contribute greatly to failure, such as bird strikes, dirt and debris in the wind,

rain, corrosion, drone strikes, etc etc.

If you have received an output for Leq or DEL, congratulations. You can now move to the

next section of getting more outputs and loads from the script. If you do not get any

output, please read the errors carefully. It is highly recommended to have a mentor

available that knows python to help with any troubleshooting.

33
Calculating and Showing More Outputs Using The print() Function

In order to calculate the LEQ of the .outb file, the python script named “fatigue.py” located

in the pyFAST tools directory, runs through a series of calculations using information from

the ’RootMyc1’ data generated by openFAST. This means our output of LEQ will be a

moment and have the units of Kn-m.

To change the parameter and see the LEQ in force rather than a moment, we need to add a

“print” function to the EquivLoad.py script to see what the Leq function is calling from a list

of parameter options. Line 26 or similar, will be the line that reads as follows:

print('Leq',Leq)

Below this line, add the following code to view the available list of parameters to choose

from:

print(f'>>>>>>>>>> df.keys: {df.keys()}')

This will now print to the screen the available options when you run the EquivLoad.py script

as shown in the image below:

34
Using the print() function in python is highly valuable. IE, you can view many parameters of

the python script to see what data it is using. For example, the image below shows where I

have used the print function so I can see the time, cycles, etc etc.

The next step is to pick a parameter that was generated in the .outb file previously created

by openFAST. If none of the above exist, please add one to the “outlists” section of the

elastodyn.dat file as previously shown in the beginning of this manual.

By default, the ‘RootFxb1’ is calculated in the 5MW_Land_DLL_Wturb.outb file. Change line

24 of the EquivLoad.py script to contain the new parameter as shown below by copying the

‘RootFxb1_[Kn]’ parameter from the generated values in vscode from using the print

function.

Leq = equivalent_load(df['Time_[s]'], df[‘RootFxb1_[kn]’], m=m)

This will now calculate the DEL in Kn from a load force rather than a loading moment. If you

want the most accurate loading and fatigue analysis, it is recommended to make 10

TurbSim.inp files that each have a different random seed, but the same average reference

speed such as 10m/s as well as a 10 minute time frame (600 seconds). Do this for a series

of speeds IE; 10mps, 12mps, 14mps, 16mps, 18mps, and 20mps. At higher wind speeds, the

tip deflection is too great and causes a “Tower Strike” error.

35
Once you have the 10 sets of wind files for each speed, you will have a total of 60 files, Now

use this to create 60 openFAST.outb files. Finally, use the python script to generate the 10

DEL’s per speed (IE 10mps), and find the average DEL. This will produce accurate results.

You can then calculate the standard deviation (SD). Knowing the empirical rule of normal

distributions in statistics, 95% of the data falls within 2 standard deviations, meaning, that if

our mean was 50Kn, and our SD were 3, then 2 SD’s is 6, thus 95% of all the data falls

between 44Kn and 56Kn.

The Basic Theory of How DEL Is Calculated

The EquivLoad.py and fatigue.py scripts go through a series of calculations and iterations to

find the Damage Equivalent Load or DEL. It uses the idea of a counting algorithm named

“Rain Flow Count”. This is a mathematical way to calculate the fatigue life of a component to

convert a uniaxial loading (along the primary axis) of stresses into an equivalent set of

constant amplitude and constant loading conditions. In all actuality and real-world testing,

wind turbine blades are set on a hub and spoke like structure, and then an off-center

weight is spun to produce a constant loading force which causes the blade to bounce up

and down, causing deflection, for a million cycles.

36
37
The python script does its best to simulate this behavior by analyzing the RootFxb1 or other

fatigue parameters that we had the script list previously. It then takes the time series data,

the frequency and the Woehler exponent values and uses the equation below from the

mlife theory manual, to calculate DEL. This is equation 30 in the theory manual.

mlife-theory.pdf (nrel.gov)

38
Using Mlife to Find Fatigue and Lifetime Analysis

Mlife is an open-source software tool designed for conducting fatigue analysis in structural

engineering for wind turbine blade design. This powerful tool provides engineers and

researchers with the capability to assess the durability and long-term performance of

various blade designs that are subjected to cyclic loading conditions. This set of MATLAB

scripts provides more advanced information than the python script used above such as

rose loading, a type of cyclic loading pattern that resembles the shape of a rose or flower

petals when plotted on a graph. This loading pattern is characterized by variations in the

applied load or stress levels over time, with distinct peaks and troughs in a cyclical manner.

Rose loading patterns are often used in fatigue testing and analysis to simulate real-world

loading conditions that structures or components may experience during their operational

life. By subjecting a material or structure to cyclic loading that resembles the expected

service conditions, engineers can assess its fatigue life and predict how many loading cycles

it can withstand before experiencing fatigue failure.

Mlife uses the extreme values from the time series data, such as the max loading value

from RootFxb1, to calculate the long term DEL, short term DEL, lifetime damage, as well as

time to failure.

It is recommended to make a separate folder on your hard drive that will house all the files

and scripts. IE C:\Mlife. Visit the link below to download the .exe file that will be unzipped to

the folder that was created.

MLife | Wind Research | NREL

To unzip the executable, just double click the file and it will automatically extract all the

folders and scripts needed to run Mlife.

39
Once the process of unzipping has finished, navigate to the source folder and double check

to make sure it contains both the datatablepackage and rainflow directories. These are

essential for Mlife to run correctly. At this time, copy and paste your .out file created by

openFAST documented at the end of the section labeled Adding Inputs to the Outlist

Section for Testing. You can see this file and the 2 directories in the image below.

Next, double click the MATLAB script in the sources directory named mlife. We will not be

running this script, but it’s the fastest way to get the sources folder to be the current

working directory of MATLAB.

In order for Mlife to work, the current working directory has to be the sources folder, and

the 2 other directories in the sources location must be added to the path. With MATLAB

open, you will notice in the left hand window pane, that the 2 folders in the sources

directory are “greyed” out, this means they have not been added to the path yet.

To add them to the MATLAB path, select the home ribbon tab, then to the far right side,

there will be a button labeled “set path” as seen in the figure below.

40
A new window will pop up, click add folder and navigate to the sources directory and add

both folders to the path as highlighted in the following image.

You will notice that the folders in the left-hand pane of MATLAB are now their normal color

and not greyed out.

Once this step has completed, we need to install the “Statistics and Machine Learning” add

on. Click the “Add On” button that is next to the “Set Path” option. Search for the

aforementioned add on and install it. MATLAB will need to restart.

41
The next step is to copy a basic setting files from the CertTest folder. In this document, the

Test01.mlif file was copied and pasted to the sources folder. It was then renamed to

settingfiles.mlif

Next, under the home tab, select “New Live Script”. This will allow us to run commands and

save them without always having to re-type them in the command window each time we

open MATLAB. For Mlife to run, it needs a varible setup that points to the settingsfile.mlif, a

data directory so it can read all the scripts, and an output directory to dump all the files to,

and then finally to call the function to run. Use the image below as a template. Once the

script has been set up, save the live script to the sources folder with an easy to remember

name such as run_mlife.

Just be sure to set the name of the setting file correctly for the settingsFile variable. Mlife

uses the variable settingsFile in its scripts, so the syntax for that variable must be the same,

however, the file it points to can be named whatever you want it to be, as long as it is a

legitimate settings file such as Tes01.mlif. In fact, you could just copy and paste the

Test01.mlif file to the sources folder and use the following:

settingsFile = ‘Tes01.mlif’

42
Theoretically it should work. Just remember, we have not changed any settings at all so the

output will be for something entirely different. At this stage, if you hit “Run” it will not work

due to an error stating the array list can only have up to 54 indexes. This error will be fixed

in the next section.

The most common errors are if the sources folder is NOT the current working directory, so

make sure to be in the sources folder as current working directory, not current folder, there

is a big difference. Another common error is that the 2 directories in the sources folder are

not added to the path or were not saved.

In the image below, MATLAB shows the current working directory in RED. Notice the line

below it says current folder, that’s just where you happen to be viewing, not necessarily

working.

The other common issue that could occur is that the user forgot to install the proper add

on for Mlife to function correctly.

43
The Mlife Settings File

Mlife has a settings file which contains all the necessary information for it to calculate the

fatigue, rose loading and other parameters. It takes all the time series data from openfast,

usually the “RootFxb1, RootFyb1, RootMxb1, and RootMyb1” outputs which contain the max

loading and moments on the blade based on the current initial conditions such as wind

speed, pitch angle, etc.

Once you have the settings file open in matlab or notepad++, navigate to the section

labeled “Calculated Channels” roughly line 16. This is where you input the name of the time

series field that you want Mlife to calculate, IE “RootFMxy1” which is nothing more than a

combination for RoorFxb1 and RootFyb1 into a single name You also need to supply the

channel name number that matches RootFxb1, such as 29, and 30 for my testing purposes.

Then for “RootMMxy1” my time series data for the RootMxb1 and RootMyb1 were

associated with channel numbers of 32 and 33. Remember, these numbers are the

associated row number for that particular output.

If you forget to change the number, lets say you leave it at 54, MATLAB will complain saying

that the number is out of the array. All MATLAB is saying is that the number you picked is

not in your time series data. For example, I have 52 outputs in the out-list section, so having

54 in my settings file is out of the array.

44
Next, we need to add our openfast file to the settings file, so Mlife knows what data to use

to calculate fatigue, or other parameters. Scroll to the bottom of the settings page and you

will find the section labeled “Input File” The first line indicates what type of file format to

use. By default, Mlife uses flag number 1, which is an ascii file, or .out from openfast. This is

why previously in the openfast section, made sure to output the data as both .out and

.outb. However, Mlife can use flag number 2 which will read a binary file. Make sure your

.out or .outb file from openfast is saved in the source directory of Mlife, the same place as

the settings file. Now, all you must do is put the name of your openfast file in quotes on line

3 of the input section as shown in the image below.

Now that we have our input file, lets focus on the fatigue section of the settings. In the

image below, you will see 17 different fields of options to change. Make sure the WriLifexls

is set to true for lifetime and short term damage. This writes the data to an excel file which
is easier to read. Set your Equivalent Frequency to your value found from using the python

script.

45
This next section can be a little confusing. This is where we now add in our ultimate loading

conditions, L_ult, for Mlife to calculate its values. First, take your peak loading from

RootFxb1(444kN) and multiply it by 1.5 (Factor of safety), then add 173kN (weight of the

blade) For me, this is 840kN. You will want to do this same process for both directional

forces and moments.

You will want to start with this value and put it in the L_ult section, however, the numbers

do not align with the columns headers. So follow the image below. You will notice mine is

set to 806kN. I will discuss this in a moment.

Notice the 806kN is under the “Type LMF” column, this is not the correct heading do to how

long the column name for “MaxBinWidth/Number” is. TypeLMF is the “fixed mean load” and
you can choose from either giving it a specific fixed mean load, or have Mlife use the

Weibull Distribution (WM) or Aggregate Mean (AM).

Ok, now time for the slightly odd portion of the fatigue. Take the above value you

calculated, for me that is 840kN, and I will use that for my channel 29, RootFxb1 Lult value.

Now fill in the other values of Lult for the other 3 channels as shown above.

Now go ahead and execute the .mlx script we created above. If everything goes well, it will

write the data to some excel files. Take a peek at them, especially the time until failure

section. The time will be represented in seconds, so you will have to convert to years. If you

do not get any lifetime excel files, be sure to set line 52 of the settings file to true.

46
For my results using 840kN as the Lult, it had a lifetime of 30 years. This was out of my

scope of lifetime. I am aiming for 20 years. So I adjusted each individual Lult value until it

calculated 20 years.

Next topic of testing is what is known as “Rose Loading” This is where the loading pattern is

randomized along the axis to simulate a more realistic pattern of loading conditions. This

can be a challenging setup, mostly due to MATLAB sometimes not liking the syntax of the

input. You may have to join the MATLAB forums for additional help or ask a mentor.

Here is a snippet of how the options should be set in the settings file:

Once Mlife has run, the ouput of the load roases will be given the name as well as a

number afterward such as RootFxyc1_1 or RootFxyc1_2, depending on how many load

roses you generate.

47
Other Testing and Validation Techniques

It was mentioned earlier that you could use FEA software to find the ultimate load, stresses,

and deflections to aid in the fatigue process from Mlife. I have found a few simple, and easy

applications for FEA. I will first list the more streamlined software’s, then move into the

more advanced ones that can handle crack propagation etc.

The first open-source software that I used for FEA, is a free website (Intact.Design) that uses

meshless testing. This allows a person to upload an STL for stress testing such as pressure

loads, vibrations, twisting, bending, and compression. It is free for basic use with a limited

number of tests, meaning, after a certain limit of testing, you just need to delete an older

test, however, if you are a student, you can have unlimited FEA.

Please visit the link below to get an account. If you want to learn how to use the online
application, please watch the following YouTube Video I created:

Intact (https://intact.design)

fea with sketchup (youtube.com) (https://www.youtube.com/watch?v=ah1M8Zq1A4w)

The Screenshot of Intact.Design above shows its capabilities You can also see the exact

solution at any given point by holding left shift + left mouse clicking. A full list of materials is

offered as a spreadsheet on this page:

https://www.intactsolutions.com/learning/doku.php?id=wiki:id:supported_materials

48
This next piece of software is a full suit of workbenches that includes FEM, solid modeling,

drafting, STL editing, and many more. In fact, you can install other work benches such as

open-foam CFD for more advanced analysis. It goes by the name of FreeCAD. The help

forums are an excellent place to ask questions, and there are many youtube videos

showing how to use the application.

FreeCAD uses the Gmsh program to create the FEM of the solid body. You can fine-tune the

mesh by controlling the size of the elements, and if it’s a first or second order mesh. Being

able to control these features allows a user to do what is called a “Mesh Convergence

Analysis” to find the optimal mesh size where deflections remain similar. For example, the

image below shows how a mesh size between 5mm and 7mm, all deflections converged to

39mm. We would think that a smaller mesh size produces more accurate results, but often,

it causes instability due to the Jacobian Matrix not being able to fully compute. This can
lead to holes in the mesh or becoming numerically unstable.

49
I have also added some YouTube videos of my own creation on how to do basic FEA with

FreeCAD:

https://www.youtube.com/watch?v=-uZuI4KkKGg&t=1s

https://www.youtube.com/watch?v=KVgId1R65Dk&t=491s

https://www.youtube.com/watch?v=m9uT-8AHPek&t=15s

Bare in mind these videos are basic coverage of the software and introductions. Please see

the FreeCAD documentation and forums for more advanced help.

FreeCAD does use the CalculiX solver, which if run in standalone mode, can be used to

compute crack propagation and Paris Law. Refer to chapter 6.9.27 of the following PDF:

http://www.dhondt.de/ccx_2.21.pdf

50
Thank you for taking the time to read this unofficial user guide to OpenFAST and Mlife. I

have published some basic usage videos on YouTube to help give another approach to

using the software.

https://www.youtube.com/watch?v=33IqCq0UnQE&t=120s

https://www.youtube.com/watch?v=UTsR-feCNhc

https://youtu.be/mbVlS-zZa3E

https://youtu.be/Ag-6XsxkWh0

I hope this document has sparked your engineering curiosity and equipped you with the

knowledge to explore new possibilities. Remember, learning is a continuous journey, so

keep exploring, keep questioning, and keep building!

51

You might also like