## Writing binary bts files

Discuss the effects of turbulence on wind turbines and its simulation.

Moderator: Bonnie.Jonkman

Francesco.Perrone
Posts: 30
Joined: Wed Mar 30, 2011 10:07 am
Organization: Nordex Energy
Location: Germany
Location: Hamburg

### Writing binary bts files

Dear all,

in the last weeks I've been developing an alternative turbulent generator to TurbSim. For the time being, let's assume that the time series are generated correctly. The goal would now be saving the 4D velocity matrix as a FAST-compatible .bts file. Threfore, I've been writing the following Matlab function:

Code: Select all

`fwrite(fid, 7, 'int16'); % TurbSim format identifier (should = 7, just 'cause I like that number), INT(2)fwrite(fid, WindFileStruct.Nz, 'int32'); % the number of grid points vertically, INT(4)fwrite(fid, WindFileStruct.Ny, 'int32'); % the number of grid points laterally, INT(4)fwrite(fid, 0, 'int32'); % the number of tower points, INT(4)fwrite(fid, WindFileStruct.N, 'int32'); % the number of time steps, INT(4)fwrite(fid, WindFileStruct.dz, 'float32'); % grid spacing in vertical direction, REAL(4), in mfwrite(fid, WindFileStruct.dy, 'float32'); % grid spacing in lateral direction, REAL(4), in mfwrite(fid, WindFileStruct.dt, 'float32'); % grid spacing in delta time, REAL(4), in m/sfwrite(fid, WindFileStruct.U0, 'float32'); % the mean wind speed at hub height, REAL(4), in m/sfwrite(fid, WindFileStruct.HubHt, 'float32'); % height of the hub, REAL(4), in mfwrite(fid, WindFileStruct.Zbottom, 'float32'); % height of the bottom of the grid, REAL(4), in mfwrite(fid, 1000, 'float32'); % the U-component slope for scaling, REAL(4)fwrite(fid, 0, 'float32'); % the U-component offset for scaling, REAL(4)fwrite(fid, 1000, 'float32'); % the V-component slope for scaling, REAL(4)fwrite(fid, 0, 'float32'); % the V-component offset for scaling, REAL(4)fwrite(fid, 1000, 'float32'); % the W-component slope for scaling, REAL(4)fwrite(fid, 0, 'float32'); % the W-component offset for scaling, REAL(4)fwrite(fid, l, 'int32'); % the number of characters in the description string, max 200, INT(4)for ii = 1:l    fwrite(fid, Version(ii), 'int8'); % the ASCII integer representation of the character stringendv = zeros(1,3);cnt = 0;for it = 1:WindFileStruct.N    for iz = 1:WindFileStruct.Nz        for iy = 1:WindFileStruct.Ny            for ii = 1:3                cnt = cnt + 1;                v(ii) = WindFileStruct.WF(it,iy,iz,ii)*1000;            end            fwrite(fid, v, 'int16');        end    endend`

What I'd like to undestand is the following: is the chunk related to time-series saving correct? If not, could you please point out how to successfully save the time series?

At the state of writing, I have performed to sets of simulations: the one set with standard TurbSim wind, the second set with my turbulent generator. When running a fatigue post-process, the damage equivalent loads stemming from my turbulent generator are always lower than those with TurbSim windfiles. Wind speed power spectra overlap perfectly though.
I've done something similar with Bladed, and equivalent loads were within a +/- 2% range.

I thank you for the support you will be showing me.

Best regards from Germany,
Francesco Perrone
Mit freundlichen Grüßen / Best regards

Francesco Perrone
Researcher
ForWind - University of Oldenburg

Francesco.Perrone
Posts: 30
Joined: Wed Mar 30, 2011 10:07 am
Organization: Nordex Energy
Location: Germany
Location: Hamburg

### Re: Writing binary bts files

Dear all,

I answer myself: until yesterday I've been assuming a Davenport coherence function also for the v- and w- components of the wind field.
Today I turned that off and moved to a TurbSim implementation, where v- and w- components are independent time series.
Now, when running a fatigue analysis, the difference between loads derived from FAST+TurbSim and FAST+FrancescoGenerator has actually decreased.
So I'd say that the "main" error source was assuming this coherence function.

In case of other possible uncertainty sources, please give me notice .

Kindest regards,
Francesco
Mit freundlichen Grüßen / Best regards

Francesco Perrone
Researcher
ForWind - University of Oldenburg

Bonnie.Jonkman
Posts: 575
Joined: Thu Nov 10, 2005 10:51 am
Organization: Envision Energy USA
Location: Boulder, CO
Contact:

### Re: Writing binary bts files

Hi, Francesco.

Your code looks fine to me. We usually find the slope and intercept to allow for the maximum precision in our files, but using the values you've specified should be adequate for most cases.

Also, if you want TurbSim to use coherence in the v and w components, you can download an alpha version of TurbSim v2.0 here: https://nwtc.nrel.gov/alphas. This version gives you a little more flexibility for testing models.
Bonnie Jonkman

Envision Energy USA, 2016-
National Renewable Energy Laboratory, 2003-2016

Francesco.Perrone
Posts: 30
Joined: Wed Mar 30, 2011 10:07 am
Organization: Nordex Energy
Location: Germany
Location: Hamburg

### Re: Writing binary bts files

Hallo Bonnie,

In the meanwhile I've been checking what coherence function TurbSim supports, together with the possible time-series scaling.
When setting TurbSim standard coherence for a Kaimal model, together with scaling factor at the hub height (so that to get the right standard deviation at the hub height), the loads comparison has been showing promising results. In presence of 6 random seeds and 10 different Woehler coefficients, the relative error is located within -/+1.5% for pretty much all sensors. That means my generator does not diverge too much from TurbSim and that was exactly my goal .

Cheers from Hamburg,
Francesco Perrone
Mit freundlichen Grüßen / Best regards

Francesco Perrone
Researcher
ForWind - University of Oldenburg