Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • toolbox/WindEnergyToolbox
  • tlbl/WindEnergyToolbox
  • cpav/WindEnergyToolbox
  • frza/WindEnergyToolbox
  • borg/WindEnergyToolbox
  • mmpe/WindEnergyToolbox
  • ozgo/WindEnergyToolbox
  • dave/WindEnergyToolbox
  • mmir/WindEnergyToolbox
  • wluo/WindEnergyToolbox
  • welad/WindEnergyToolbox
  • chpav/WindEnergyToolbox
  • rink/WindEnergyToolbox
  • shfe/WindEnergyToolbox
  • shfe1/WindEnergyToolbox
  • acdi/WindEnergyToolbox
  • angl/WindEnergyToolbox
  • wliang/WindEnergyToolbox
  • mimc/WindEnergyToolbox
  • wtlib/WindEnergyToolbox
  • cmos/WindEnergyToolbox
  • fabpi/WindEnergyToolbox
22 results
Show changes
Commits on Source (1400)
Showing with 511 additions and 13 deletions
*.bin filter=lfs diff=lfs merge=lfs -text
......@@ -3,4 +3,30 @@ dist/*
*.pyc
*.pyd
*egg-info*
*.so
.eggs
doctrees
docs/_build
.project
.pydevproject
.settings/org.eclipse.core.resources.prefs
wetb/gtsdf/tests/tmp
wetb/dlc/tests/test_files/res_all
wetb/dlc/tests/test_files/res2_all
wetb/hawc2/ascii2bin/ascii2bin_dist
wetb/hawc2/tests/test_files/htcfiles/tmp.htc
wetb/hawc2/ascii2bin/tests/test_files/Hawc2ascii_bin.sel
wetb/hawc2/ascii2bin/tests/test_files/Hawc2ascii_bin.dat
wetb/prepost/tests/data/demo_dlc/remote*
wetb/*/*/*.c
.cache/
tests/temp.htc
**/tmp/*
/wetb/fatigue_tools/rainflowcounting/compile.py
/docs/api
/htmlcov
/docs/build
/docs/source_old
.ipynb_checkpoints
/.pytest_cache/
image: dtuwindenergy/wetb
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- when: always
test:
image: continuumio/anaconda3:latest
stage:
test
# except:
# - test_pypi
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
#- git submodule sync --recursive
#- git submodule update --init --recursive
- python -m pip install .[all]
script:
- python3 -m pytest --cov-report term-missing:skip-covered --cov-report xml:coverage.xml --cov=wetb
tags:
- docker, linux, shared
coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
# ===== build documentation =====
pages: # "pages" is a job specifically for GitLab pages [1]
stage: # build, test, deploy defined by default [2]
deploy
image: registry.windenergy.dtu.dk/hawc2/hawc2-binary/dockerimages/ubuntu_conda
script: # use sphinx to build docs, move to public page
- pip install --upgrade pip
- pip install sphinx --upgrade
- pip install sphinx sphinx_rtd_theme
- pip install nbsphinx==0.3.5
- pip install git+https://github.com/vidartf/nbsphinx-link.git
- pip install -e .
- cd docs; make html
- cd ../; mv docs/build/html public/
artifacts: # required for GitLab pages [1]
paths:
- public
only: # only run for these branches
- master
- /^test_doc.*/
tags: # only runners with this tag can do the job [3]
- python
allow_failure: true
# Deploy package to local repository
upload_package_local:
image: continuumio/anaconda3:latest
tags:
- docker, linux, shared
stage: deploy
needs:
- job: build_wheel
artifacts: true
- job: test
artifacts: false
script:
- pip install --upgrade twine packaging
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --verbose --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
rules:
- if: $CI_COMMIT_TAG != null
when: always
- if: $CI_COMMIT_BRANCH == "master"
when: always
- if: $CI_COMMIT_BRANCH != "master"
when: manual
allow_failure: true
# ===== BUILD WHEELS AND UPLOAD TO PYPI =====
upload_package_pypi:
image: continuumio/anaconda3:latest
tags:
- docker, linux, shared
stage: deploy
needs:
- job: build_wheel
artifacts: true
- job: test
artifacts: false
script:
- pip install --upgrade twine packaging
- twine upload dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD
only:
- tags
- test_pypi
build_wheel:
stage: build
tags:
- linux, docker, shared
image: registry.windenergy.dtu.dk/hawc2/hawc2-binary/dockerimages/ubuntu_conda
before_script:
- git config --global --add safe.directory ${CI_PROJECT_DIR}
script:
- pip wheel . --wheel-dir=dist
artifacts:
paths:
- dist/wetb*.whl
expire_in: "1d"
[submodule "TestFiles"]
path = TestFiles
url = https://gitlab.windenergy.dtu.dk/toolbox/TestFiles.git
[distutils]
index-servers=
pypi
#testpypi # include this line for testing
[testpypi]
#repository: https://test.pypi.org/legacy/ # use this line when testing
repository: https://upload.pypi.org/legacy/
username: DTUWindEnergy
......@@ -3,4 +3,5 @@ Developers
==========
* Mads Mølgaard Pedersen
* David Verelst
* David R.S. Verelst
* Carlo Tibaldi
Contributions
-------------
If you make a change in the toolbox, that others can benefit from please make a merge request.
If you can, please submit a merge request with the fix or improvements including tests.
The workflow to make a merge request is as follows:
-Create a feature branch, branch away from master
-Write tests and code
-Push the commit(s) to your fork
-Submit a merge request (MR) to the master branch of
-Link any relevant issues in the merge request description and leave a comment on them with a link back to the MR
-Your tests should run as fast as possible, and if it uses test files, these files should be as small as possible.
-Please keep the change in a single MR as small as possible. Split the functionality if you can
\ No newline at end of file
|build status| |coverage report|
Introduction
============
The Wind Energy Toolbox (or ``wetb``, pronounce as wee-tee-bee) is a
collection of Python scripts that facilitate working with (potentially a
lot) of HAWC2, HAWCStab2, FAST or other text input based simulation
tools.
Note that this toolbox is very much a WIP (work in progress). For
example, some of the functions in the `prepost <#prepost>`__ module have
a similar functions in `Hawc2io <wetb/hawc2/Hawc2io.py>`__. These
different implementations will be merged in due time.
Both Python2 and Python3 are supported.
Installation
============
- `Simple user <docs/install.md>`__
- `Developer/contributor <docs/developer-guide.md>`__
Contents of WindEnergyToolbox, `wetb <wetb>`__
==============================================
Overview
~~~~~~~~
- `hawc2 <#hawc2>`__
- `gtsdf <#gtsdf>`__
- `fatigue\_tools <#fatigue_tools>`__
- `wind <#wind>`__
- `dlc <#dlc>`__
- `prepost <#prepost>`__
- `fast <#fast>`__
- `utils <#utils>`__
`hawc2 <wetb/hawc2>`__
~~~~~~~~~~~~~~~~~~~~~~
- `Hawc2io <wetb/hawc2/Hawc2io.py>`__: Read binary, ascii and flex
result files
- `sel\_file <wetb/hawc2/sel_file.py>`__: Read/write \*.sel (sensor
list) files
- `htc\_file <wetb/hawc2/htc_file.py>`__: Read/write/manipulate htc
files
- `ae\_file <wetb/hawc2/ae_file.py>`__: Read AE (aerodynamic blade
layout) files
- `pc\_file <wetb/hawc2/pc_file.py>`__: Read PC (profile coefficient)
files
- `st\_file <wetb/hawc2/st_file.py>`__: Read ST (structural properties)
files
- `shear\_file <wetb/hawc2/shear_file.py>`__: Create user defined shear
file
- `at\_time\_file <wetb/hawc2/at_time_file.py>`__: Read at
output\_at\_time files
- `log\_file <wetb/hawc2/log_file.py>`__: Read and interpret log files
- `ascii2bin <wetb/hawc2/ascii2bin>`__: Compress HAWC2 ascii result
files to binary
`gtsdf <wetb/gtsdf>`__
~~~~~~~~~~~~~~~~~~~~~~
General Time Series Data Format, a binary hdf5 data format for storing
time series data. - `gtsdf <wetb/gtsdf/gtsdf.py>`__: read/write/append
gtsdf files - `unix\_time <wetb/gtsdf/unix_time.py>`__: convert between
datetime and unix time (seconds since 1/1/1970)
`fatigue\_tools <wetb/fatigue_tools>`__
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- `fatigue <wetb/fatigue_tools/fatigue.py>`__: Rainflow counting, cycle
matrix and equivalent loads
- `bearing\_damage <wetb/fatigue_tools/bearing_damage.py>`__: Calculate
a comparable measure of bearing damage
`wind <wetb/wind>`__
~~~~~~~~~~~~~~~~~~~~
- `shear <wetb/wind/shear.py>`__: Calculate and fit wind shear
`dlc <wetb/dlc>`__
~~~~~~~~~~~~~~~~~~
Module for working with "Design load cases" (Code independent) -
`high\_level <wetb/dlc/high_level.py>`__ Class for working with the
highlevel dlc excell sheet
`prepost <wetb/prepost>`__
~~~~~~~~~~~~~~~~~~~~~~~~~~
Module for creating an arbitrary number of HAWC2 simulations, and
optionally corresponding execution scripts for a PBS Torque cluster
(Linux), simple bash (Linux), or Windows batch scripts. A
post-processing module is also included that calculates statistical
parameters, performs rainflow counting for fatigue load calculations,
and create load envelopes.
Additional documentation can be found here:
- `Getting started with DLBs <docs/getting-started-with-dlbs.md>`__
- `Generate DLB spreadsheets <docs/generate-spreadsheet.md>`__
- `Auto-generation of Design Load Cases <docs/howto-make-dlcs.md>`__
- `House rules for storing results on
``mimer/hawc2sim`` <docs/houserules-mimerhawc2sim.md>`__
- `How to use the Statistics
DataFrame <docs/using-statistics-df.md>`__
`fast <wetb/fast>`__
~~~~~~~~~~~~~~~~~~~~
Tools for working with NREL's FAST code (An aeroelastic computer-aided
engineering (CAE) tool for horizontal axis wind turbines) -
`fast\_io <wetb/fast/fast_io.py>`__: Read binary and ascii result files
`utils <wetb/utils>`__
~~~~~~~~~~~~~~~~~~~~~~
Other functions - `geometry <wetb/utils/geometry.py>`__: Different kind
of geometry conversion functions -
`process\_exec <wetb/utils/process_exec.py>`__: Run system command in
subprocess - `timing <wetb/utils/timing.py>`__: Decorators for
evaluating execution time of functions -
`caching <wetb/utils/caching.py>`__: Decorators to create cached
(calculate once) functions and properties
.. |build status| image:: https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/badges/master/build.svg
:target: https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/commits/master
.. |coverage report| image:: https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/badges/master/coverage.svg
:target: https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/commits/master
[![build status](https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/badges/master/build.svg)](https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/commits/master)
[![coverage report](https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/badges/master/coverage.svg)](https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/commits/master)
[![pypi status](https://img.shields.io/pypi/v/wetb.png)](https://pypi.python.org/pypi/wetb)
# Introduction
The Wind Energy Toolbox (or ```wetb```, pronounce as wee-tee-bee) is a collection
of Python scripts that facilitate working with (potentially a lot) of HAWC2,
HAWCStab2, FAST or other text input based simulation tools.
Note that this toolbox is very much a WIP (work in progress). For example,
some of the functions in the [prepost](#prepost) module have a similar functions
in [Hawc2io](wetb/hawc2/Hawc2io.py). These different implementations will be
merged in due time.
Both Python2 and Python3 are supported.
# Installation
See documentation.
# Documentation
[https://toolbox.pages.windenergy.dtu.dk/WindEnergyToolbox/](https://toolbox.pages.windenergy.dtu.dk/WindEnergyToolbox/)
# Contents of WindEnergyToolbox, [wetb](wetb)
### Overview
- [hawc2](#hawc2)
- [gtsdf](#gtsdf)
- [fatigue_tools](#fatigue_tools)
- [wind](#wind)
- [dlc](#dlc)
- [prepost](#prepost)
- [fast](#fast)
- [functions](#functions)
- [utils](#utils)
------------------------------------------------------------------------------------
### [hawc2](wetb/hawc2)
### [hawc2](wetb/hawc2)
- [Hawc2io](wetb/hawc2/Hawc2io.py): Read binary, ascii and flex result files
- [sel_file](wetb/hawc2/sel_file.py): Read/write *.sel (sensor list) files
- [htc_file](wetb/hawc2/htc_file.py): Read/write/manipulate htc files
- [ae_file](wetb/hawc2/ae_file.py): Read AE (aerodynamic blade layout) files
- [pc_file](wetb/hawc2/pc_file.py): Read PC (profile coefficient) files
- [ae_file](wetb/hawc2/ae_file.py): Read/write/manipulate AE (aerodynamic blade layout) files
- [pc_file](wetb/hawc2/pc_file.py): Read/write/manipulate PC (profile coefficient) files
- [st_file](wetb/hawc2/st_file.py): Read/write/manipulate ST (structural properties) files
- [shear_file](wetb/hawc2/shear_file.py): Create user defined shear file
- [at_time_file](wetb/hawc2/at_time_file.py): Read at output_at_time files
- [log_file](wetb/hawc2/log_file.py): Read and interpret log files
......@@ -26,24 +56,39 @@ General Time Series Data Format, a binary hdf5 data format for storing time seri
- [unix_time](wetb/gtsdf/unix_time.py): convert between datetime and unix time (seconds since 1/1/1970)
### [fatigue_tools](wetb/fatigue_tools)
- [fatigue](wetb/fatigue_tools/fatigue.py): Rainflow counting, cycle matrix and equvivalent loads
- [fatigue](wetb/fatigue_tools/fatigue.py): Rainflow counting, cycle matrix and equivalent loads
- [bearing_damage](wetb/fatigue_tools/bearing_damage.py): Calculate a comparable measure of bearing damage
### [wind](wetb/wind)
- [shear](wetb/wind/shear.py): Calculate and fit wind shear
- [shear](wetb/wind/shear.py): Calculate and fit wind shear
### [dlc](wetb/dlc)
Module for working with "Design load cases" (Code independent)
- [high_level](wetb/dlc/high_level.py) Class for working with the highlevel dlc excell sheet
### [prepost](wetb/prepost)
Module for creating an arbitrary number of HAWC2 simulations, and optionally
corresponding execution scripts for a PBS Torque cluster (Linux), simple bash
(Linux), or Windows batch scripts. A post-processing module is also included
that calculates statistical parameters, performs rainflow counting for fatigue
load calculations, and create load envelopes.
Additional documentation can be found here:
- [Getting started with DLBs](docs/getting-started-with-dlbs.md)
- [Generate DLB spreadsheets](docs/generate-spreadsheet.md)
- [Auto-generation of Design Load Cases](docs/howto-make-dlcs.md)
- [House rules for storing results on ```mimer/hawc2sim```](docs/houserules-mimerhawc2sim.md)
- [How to use the Statistics DataFrame](docs/using-statistics-df.md)
### [fast](wetb/fast)
Tools for working with NREL's FAST code (An aeroelastic computer-aided engineering (CAE) tool for horizontal axis wind turbines)
- [fast_io](wetb/fast/fast_io.py): Read binary and ascii result files
### [functions](wetb/functions)
### [utils](wetb/utils)
Other functions
- [geometry](wetb/functions/geometry.py): Different kind of geometry conversion functions
- [process_exec](wetb/functions/process_exec.py): Run system command in subprocess
- [timing](wetb/functions/timing.py): Decorators for evaluating execution time of functions
- [caching](wetb/functions/caching.py): Decorators to create cached (calculate once) functions and properties
\ No newline at end of file
- [geometry](wetb/utils/geometry.py): Different kind of geometry conversion functions
- [process_exec](wetb/utils/process_exec.py): Run system command in subprocess
- [timing](wetb/utils/timing.py): Decorators for evaluating execution time of functions
- [caching](wetb/utils/caching.py): Decorators to create cached (calculate once) functions and properties
Subproject commit 167b16d8f1a26161ebc5a258c62389777d133489
FROM continuumio/anaconda3:latest
MAINTAINER Mikkel Friis-Møller <mikf@dtu.dk>
RUN apt-get update && \
apt-get install make && \
apt-get install libgl1-mesa-glx -y && \
apt-get install gcc gfortran -y
RUN conda update -y conda && \
conda install -y sphinx_rtd_theme && \
conda install setuptools_scm mock h5py pytables pytest pytest-cov nose sphinx blosc pbr paramiko && \
conda install scipy pandas matplotlib cython xlrd coverage xlwt openpyxl psutil pandoc twine pypandoc && \
conda install -c conda-forge pyscaffold sshtunnel --no-deps && \
conda clean -y --all
RUN pip install --upgrade pip && \
pip install --no-cache-dir git+https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox.git
# build image
docker build -t dtuwindenergy/wetb ./
# or pull from docker hub
# create container
docker create -it --name wetb dtuwindenergy/wetb
# start container
docker start wetb
# enter container with bash prompt
docker exec -it wetb bash
# push
docker push dtuwindenergy/wetb
#checkout single branch for testing:
git clone --single-branch --branch test_pypi https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox.git
#Copy local folder into docker container:
docker cp "C:\Sandbox\Git\WindEnergyToolbox\." wetb:/WETB/
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = TOPFARM
SOURCEDIR = .
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
\ No newline at end of file
docs/bladed/Bladed_airfoil.png

46.8 KiB

docs/bladed/Bladed_st_centers.png

43.6 KiB

docs/bladed/Bladed_turbine_coord.png

123 KiB

docs/bladed/HAWC2_c2_def_ccord.png

38.3 KiB

docs/bladed/HAWC2_st_centers.png

15.1 KiB

docs/bladed/HAWC2_turbine_coord.png

121 KiB

%% Cell type:markdown id: tags:
# Bladed to HAWC2 model conversion formulation
%% Cell type:markdown id: tags:
# Coordinate transformation: <br>
The parameters belonging to HAWC2 are showed by $*^H$ and the parameters belonging to Bladed are showed by $*^B$.
$ ----------------------------------$<br>
The blade root coordinate systems of the codes can be transfromed as:
\begin{equation}
\begin{bmatrix} x^H \\ y^H \\ z^H \end{bmatrix} = \begin{bmatrix} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x^B \\ y^B \\ z^B \end{bmatrix}
\end{equation}
The transformation matrix is called $R^{H2B}$.
$ ----------------------------------$<br>
The total rotation angle is expressed by $\theta_{CS}^{B}$ which is comupted as:<br>
$\theta_{CS}^{B}$ = -$\theta_p^B$ - $\beta_{\alpha}^B$ <br>
**BE CAREFUL !!!** -> Bladed positive pitch/twist definition are in negative z direction. <br>
Transformation matrix $R^{B2CS}$ from Bladed local cross-section coordinates to the rotor coordinate system. <br>
\begin{equation}
\begin{bmatrix} x^B \\ y^B \\ z^B \end{bmatrix} = \begin{bmatrix} cos(\theta_{CS}^{B}) & sin(\theta_{CS}^{B}) & 0 \\ -sin(\theta_{CS}^{B}) & cos(\theta_{CS}^{B}) & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x^B_{CS} \\ y^B_{CS} \\ z^B_{CS} \end{bmatrix}
\end{equation}
$ ----------------------------------$<br>
Total transformation from Bladed local coordinates to HAWC2 can be written as: <br>
\begin{equation}
\begin{bmatrix} x^H \\ y^H \\ z^H \end{bmatrix} = R^{H2B} R^{B2CS} \begin{bmatrix} x^B_{CS} \\ y^B_{CS} \\ z^B_{CS} \end{bmatrix}
\end{equation}
$ ----------------------------------$
%% Cell type:markdown id: tags:
## Center positions <br>
HAWC2 defines elastic, shear and mass center according to the half chord (*c2_def*) location in its st files
whereas Bladed measures center positions from leading edge position. The center positions ($x_{LE}^B$ and $y_{LE}^B$) can be defined with respect to the half chord ($x_{c2}^B$ and $y_{c2}^B$) in Bladed coordinate system as: <br>
$x_{c2}^B$ = $x_{LE}^B$ <br>
$y_{c2}^B$ = $y_{LE}^B$ - c/2 <br>
where *c* is the chord length. <br>
These coordinates can be transformed to HAWC2 coordinate system by multiplying them with $R^{H2B}$.
%% Cell type:markdown id: tags:
## Inertia conversion <br>
Bladed has total inertia value *Ip* and radius of gyration ratio *RGRATIO* in its input file. <br>
\begin{equation}
RGRATIO = \dfrac{RG_y}{RG_x}
\end{equation}
\begin{equation}
RG_x^2 = \dfrac{I_x}{m} \; , \; RG_y^2 = \dfrac{I_y}{m}
\end{equation}
where m is mass and $I_x$ is the mass moment of inertia with respect to x axis.
\begin{equation}
Ip = I_x + RGRATIO^2 \times I_x
\end{equation}
The *Ip* is defined with respec to mass center in Bladed whereas it is defined at elastic center in HAWC2. <br>
\begin{equation}
Ip^{ea} = Ip^{cg} + m \times (xyz^{cg} - xyz^{ea})^2
\end{equation}
**BE CAREFUL !!!** -> do not forget to transform inertia results from Bladed coordinate system to HAWC2 coordinate system.