Skip to content
Snippets Groups Projects
Commit 67b7eba8 authored by Mads M. Pedersen's avatar Mads M. Pedersen Committed by Mads M. Pedersen
Browse files

examples/01_modify_htcfile.py

parent 6dc69a58
No related branches found
No related tags found
No related merge requests found
Showing
with 1628 additions and 0 deletions
from wetb.hawc2.htc_file import HTCFile
from wetb.hawc2.tests import test_files
import os
def main():
if __name__ == '__main__':
# ======================================================================
# load existing htc file
# ======================================================================
path = os.path.dirname(test_files.__file__) + "/simulation_setup/DTU10MWRef6.0/"
htc = HTCFile(path + "htc/DTU_10MW_RWT.htc")
# ======================================================================
# modify wind speed and turbulence intensity
# ======================================================================
htc.wind.wsp = 10
# access wind section and change turbulence intensity
wind = htc.wind
wind.tint = .1
#=======================================================================
# print contents
#=======================================================================
print(htc) # print htc file
print(htc.keys()) # print htc sections
print(wind) # print wind section
#=======================================================================
# change tilt angle
#=======================================================================
orientation = htc.new_htc_structure.orientation
# Two ways to access the relative orientation between towertop and shaft
# 1) Knowning that it is the second relative section:
rel_tt_shaft = orientation.relative__2
# 2) Knowning that the section contains a field "body1" with value "topertop"
rel_tt_shaft = orientation.get_subsection_by_name(name='towertop', field='body1')
rel_tt_shaft.body2_eulerang__2 = 6, 0, 0
print(rel_tt_shaft.body2_eulerang__2)
# ======================================================================
# set time, name and save
# ======================================================================
# set time of simulation, first output section and wind.scale_time_start
htc.set_time(start=5, stop=10, step=0.1)
# change name of logfile, animation, visualization and first output section
htc.set_name("tmp_wsp10_tint0.1_tilt6")
htc.save() # Save htc modified htcfile as "tmp_wsp10_tint0.1_tilt6"
# ======================================================================
# run simulation
# ======================================================================
# htc.simulate("<path2hawc2>/hawc2mb.exe")
main()
import importlib
import os
import pkgutil
import warnings
import mock
import pytest
import matplotlib.pyplot as plt
import sys
import examples
def get_main_modules():
package = examples
modules = []
for _, modname, _ in pkgutil.walk_packages(package.__path__, package.__name__ + '.'):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
m = importlib.import_module(modname)
if 'main' in dir(m):
modules.append(m)
return modules
def print_main_modules():
print("\n".join([m.__name__ for m in get_main_modules()]))
@pytest.mark.parametrize("module", get_main_modules())
def test_main(module):
# check that all main module examples run without errors
if os.name == 'posix' and "DISPLAY" not in os.environ:
pytest.xfail("No display")
def no_show(*args, **kwargs):
pass
plt.show = no_show # disable plt show that requires the user to close the plot
def no_print(s):
pass
try:
with mock.patch.object(module, "__name__", "__main__"):
with mock.patch.object(module, "print", no_print):
getattr(module, 'main')()
except Exception as e:
raise type(e)(str(e) +
' in %s.main' % module.__name__).with_traceback(sys.exc_info()[2])
if __name__ == '__main__':
print_main_modules()
#1 Hub Changed 5.11.2012 by MHHA: Mass per unit-length should not be too low
r m x_cg y_cg ri_x ri_y x_sh y_sh E G I_x I_y I_p k_x k_y A pitch x_e y_e
$1 2 hub. flexible
0 1.0 0 0 1.50E+00 1.50E+00 0 0 2.10E+11 8.08E+10 5.52E-00 5.52E-00 1.10E+00 0.5 0.5 2.98E-01 0 0 0
2.8 1.0 0 0 1.50E+00 1.50E+00 0 0 2.10E+11 8.08E+10 5.52E-00 5.52E-00 1.10E+00 0.5 0.5 2.98E-01 0 0 0
r m x_cg y_cg ri_x ri_y x_sh y_sh E G I_x I_y I_p k_x k_y A pitch x_e y_e
$2 2 hub. stiff
0 1.0 0 0 1.50E+00 1.50E+00 0 0 2.10E+16 8.08E+15 5.52E-00 5.52E-00 1.10E+00 0.5 0.5 2.98E-01 0 0 0
2.8 1.0 0 0 1.50E+00 1.50E+00 0 0 2.10E+16 8.08E+15 5.52E-00 5.52E-00 1.10E+00 0.5 0.5 2.98E-01 0 0 0
#1 Shaft
r m x_cg y_cg ri_x ri_y x_sh y_sh E G I_x I_y I_p k_x k_y A pitch x_e y_e
$1 2 shaft with hub mass on last element. flexible
0.0 1.00E+00 0 0 0.2 0.2 0 0 2.10E+11 8.08E+10 1.00E+00 1.00E+00 0.2036 0.5 0.5 10 0 0 0
7.1 1.00E+00 0 0 0.2 0.2 0 0 2.10E+11 8.08E+10 1.00E+00 1.00E+00 0.2036 0.5 0.5 10 0 0 0
r m x_cg y_cg ri_x ri_y x_sh y_sh E G I_x I_y I_p k_x k_y A pitch x_e y_e
$2 2 shaft with hub mass on last element. stiff
0.0 1.00E+00 0 0 0.2 0.2 0 0 2.10E+16 8.08E+17 1.00E+00 1.00E+00 0.2036 0.5 0.5 10 0 0 0
7.1 1.00E+00 0 0 0.2 0.2 0 0 2.10E+16 8.08E+17 1.00E+00 1.00E+00 0.2036 0.5 0.5 10 0 0 0
#1 Tower made by anyd 25.02.2013
r m x_cg y_cg ri_x ri_y x_sh y_sh E G I_x I_y I_p k_x k_y A pitch x_e y_e
$1 20
0.000 8.3837E+03 0.0000E+00 0.0000E+00 2.9211E+00 2.9211E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 8.4160E+00 8.4160E+00 1.6832E+01 5.0000E-01 5.0000E-01 9.8632E-01 0.0000E+00 0.0000E+00 0.0000E+00
11.500 8.1012E+03 0.0000E+00 0.0000E+00 2.8226E+00 2.8226E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 7.5934E+00 7.5934E+00 1.5187E+01 5.0000E-01 5.0000E-01 9.5308E-01 0.0000E+00 0.0000E+00 0.0000E+00
11.501 7.6767E+03 0.0000E+00 0.0000E+00 2.8233E+00 2.8233E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 7.1991E+00 7.1991E+00 1.4398E+01 5.0000E-01 5.0000E-01 9.0314E-01 0.0000E+00 0.0000E+00 0.0000E+00
23.000 7.4090E+03 0.0000E+00 0.0000E+00 2.7249E+00 2.7249E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 6.4720E+00 6.4720E+00 1.2944E+01 5.0000E-01 5.0000E-01 8.7165E-01 0.0000E+00 0.0000E+00 0.0000E+00
23.001 6.9992E+03 0.0000E+00 0.0000E+00 2.7256E+00 2.7256E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 6.1171E+00 6.1171E+00 1.2234E+01 5.0000E-01 5.0000E-01 8.2343E-01 0.0000E+00 0.0000E+00 0.0000E+00
34.500 6.7464E+03 0.0000E+00 0.0000E+00 2.6271E+00 2.6271E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 5.4779E+00 5.4779E+00 1.0956E+01 5.0000E-01 5.0000E-01 7.9369E-01 0.0000E+00 0.0000E+00 0.0000E+00
34.501 6.3512E+03 0.0000E+00 0.0000E+00 2.6278E+00 2.6278E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 5.1598E+00 5.1598E+00 1.0320E+01 5.0000E-01 5.0000E-01 7.4720E-01 0.0000E+00 0.0000E+00 0.0000E+00
46.000 6.1133E+03 0.0000E+00 0.0000E+00 2.5294E+00 2.5294E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 4.6013E+00 4.6013E+00 9.2027E+00 5.0000E-01 5.0000E-01 7.1921E-01 0.0000E+00 0.0000E+00 0.0000E+00
46.001 5.7328E+03 0.0000E+00 0.0000E+00 2.5301E+00 2.5301E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 4.3173E+00 4.3173E+00 8.6346E+00 5.0000E-01 5.0000E-01 6.7444E-01 0.0000E+00 0.0000E+00 0.0000E+00
57.500 5.5097E+03 0.0000E+00 0.0000E+00 2.4316E+00 2.4316E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 3.8327E+00 3.8327E+00 7.6654E+00 5.0000E-01 5.0000E-01 6.4820E-01 0.0000E+00 0.0000E+00 0.0000E+00
57.501 5.1439E+03 0.0000E+00 0.0000E+00 2.4323E+00 2.4323E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 3.5803E+00 3.5803E+00 7.1605E+00 5.0000E-01 5.0000E-01 6.0516E-01 0.0000E+00 0.0000E+00 0.0000E+00
69.000 4.9357E+03 0.0000E+00 0.0000E+00 2.3339E+00 2.3339E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 3.1629E+00 3.1629E+00 6.3258E+00 5.0000E-01 5.0000E-01 5.8067E-01 0.0000E+00 0.0000E+00 0.0000E+00
69.001 4.5845E+03 0.0000E+00 0.0000E+00 2.3346E+00 2.3346E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 2.9396E+00 2.9396E+00 5.8792E+00 5.0000E-01 5.0000E-01 5.3935E-01 0.0000E+00 0.0000E+00 0.0000E+00
80.500 4.3912E+03 0.0000E+00 0.0000E+00 2.2361E+00 2.2361E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 2.5832E+00 2.5832E+00 5.1664E+00 5.0000E-01 5.0000E-01 5.1661E-01 0.0000E+00 0.0000E+00 0.0000E+00
80.501 4.0547E+03 0.0000E+00 0.0000E+00 2.2368E+00 2.2368E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 2.3867E+00 2.3867E+00 4.7734E+00 5.0000E-01 5.0000E-01 4.7702E-01 0.0000E+00 0.0000E+00 0.0000E+00
92.000 3.8762E+03 0.0000E+00 0.0000E+00 2.1384E+00 2.1384E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 2.0852E+00 2.0852E+00 4.1705E+00 5.0000E-01 5.0000E-01 4.5602E-01 0.0000E+00 0.0000E+00 0.0000E+00
92.001 3.5543E+03 0.0000E+00 0.0000E+00 2.1391E+00 2.1391E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 1.9133E+00 1.9133E+00 3.8267E+00 5.0000E-01 5.0000E-01 4.1816E-01 0.0000E+00 0.0000E+00 0.0000E+00
103.500 3.3908E+03 0.0000E+00 0.0000E+00 2.0406E+00 2.0406E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 1.6611E+00 1.6611E+00 3.3223E+00 5.0000E-01 5.0000E-01 3.9891E-01 0.0000E+00 0.0000E+00 0.0000E+00
103.501 3.0836E+03 0.0000E+00 0.0000E+00 2.0413E+00 2.0413E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 1.5117E+00 1.5117E+00 3.0234E+00 5.0000E-01 5.0000E-01 3.6277E-01 0.0000E+00 0.0000E+00 0.0000E+00
115.630 2.9267E+03 0.0000E+00 0.0000E+00 1.9375E+00 1.9375E+00 0.0000E+00 0.0000E+00 2.1000E+11 8.0769E+10 1.2925E+00 1.2925E+00 2.5850E+00 5.0000E-01 5.0000E-01 3.4432E-01 0.0000E+00 0.0000E+00 0.0000E+00
$2 20
0.000 8.3837E+03 0.0000E+00 0.0000E+00 2.9211E+00 2.9211E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 8.4160E+00 8.4160E+00 1.6832E+01 5.0000E-01 5.0000E-01 9.8632E-01 0.0000E+00 0.0000E+00 0.0000E+00
11.500 8.1012E+03 0.0000E+00 0.0000E+00 2.8226E+00 2.8226E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 7.5934E+00 7.5934E+00 1.5187E+01 5.0000E-01 5.0000E-01 9.5308E-01 0.0000E+00 0.0000E+00 0.0000E+00
11.501 7.6767E+03 0.0000E+00 0.0000E+00 2.8233E+00 2.8233E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 7.1991E+00 7.1991E+00 1.4398E+01 5.0000E-01 5.0000E-01 9.0314E-01 0.0000E+00 0.0000E+00 0.0000E+00
23.000 7.4090E+03 0.0000E+00 0.0000E+00 2.7249E+00 2.7249E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 6.4720E+00 6.4720E+00 1.2944E+01 5.0000E-01 5.0000E-01 8.7165E-01 0.0000E+00 0.0000E+00 0.0000E+00
23.001 6.9992E+03 0.0000E+00 0.0000E+00 2.7256E+00 2.7256E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 6.1171E+00 6.1171E+00 1.2234E+01 5.0000E-01 5.0000E-01 8.2343E-01 0.0000E+00 0.0000E+00 0.0000E+00
34.500 6.7464E+03 0.0000E+00 0.0000E+00 2.6271E+00 2.6271E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 5.4779E+00 5.4779E+00 1.0956E+01 5.0000E-01 5.0000E-01 7.9369E-01 0.0000E+00 0.0000E+00 0.0000E+00
34.501 6.3512E+03 0.0000E+00 0.0000E+00 2.6278E+00 2.6278E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 5.1598E+00 5.1598E+00 1.0320E+01 5.0000E-01 5.0000E-01 7.4720E-01 0.0000E+00 0.0000E+00 0.0000E+00
46.000 6.1133E+03 0.0000E+00 0.0000E+00 2.5294E+00 2.5294E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 4.6013E+00 4.6013E+00 9.2027E+00 5.0000E-01 5.0000E-01 7.1921E-01 0.0000E+00 0.0000E+00 0.0000E+00
46.001 5.7328E+03 0.0000E+00 0.0000E+00 2.5301E+00 2.5301E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 4.3173E+00 4.3173E+00 8.6346E+00 5.0000E-01 5.0000E-01 6.7444E-01 0.0000E+00 0.0000E+00 0.0000E+00
57.500 5.5097E+03 0.0000E+00 0.0000E+00 2.4316E+00 2.4316E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 3.8327E+00 3.8327E+00 7.6654E+00 5.0000E-01 5.0000E-01 6.4820E-01 0.0000E+00 0.0000E+00 0.0000E+00
57.501 5.1439E+03 0.0000E+00 0.0000E+00 2.4323E+00 2.4323E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 3.5803E+00 3.5803E+00 7.1605E+00 5.0000E-01 5.0000E-01 6.0516E-01 0.0000E+00 0.0000E+00 0.0000E+00
69.000 4.9357E+03 0.0000E+00 0.0000E+00 2.3339E+00 2.3339E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 3.1629E+00 3.1629E+00 6.3258E+00 5.0000E-01 5.0000E-01 5.8067E-01 0.0000E+00 0.0000E+00 0.0000E+00
69.001 4.5845E+03 0.0000E+00 0.0000E+00 2.3346E+00 2.3346E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 2.9396E+00 2.9396E+00 5.8792E+00 5.0000E-01 5.0000E-01 5.3935E-01 0.0000E+00 0.0000E+00 0.0000E+00
80.500 4.3912E+03 0.0000E+00 0.0000E+00 2.2361E+00 2.2361E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 2.5832E+00 2.5832E+00 5.1664E+00 5.0000E-01 5.0000E-01 5.1661E-01 0.0000E+00 0.0000E+00 0.0000E+00
80.501 4.0547E+03 0.0000E+00 0.0000E+00 2.2368E+00 2.2368E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 2.3867E+00 2.3867E+00 4.7734E+00 5.0000E-01 5.0000E-01 4.7702E-01 0.0000E+00 0.0000E+00 0.0000E+00
92.000 3.8762E+03 0.0000E+00 0.0000E+00 2.1384E+00 2.1384E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 2.0852E+00 2.0852E+00 4.1705E+00 5.0000E-01 5.0000E-01 4.5602E-01 0.0000E+00 0.0000E+00 0.0000E+00
92.001 3.5543E+03 0.0000E+00 0.0000E+00 2.1391E+00 2.1391E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 1.9133E+00 1.9133E+00 3.8267E+00 5.0000E-01 5.0000E-01 4.1816E-01 0.0000E+00 0.0000E+00 0.0000E+00
103.500 3.3908E+03 0.0000E+00 0.0000E+00 2.0406E+00 2.0406E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 1.6611E+00 1.6611E+00 3.3223E+00 5.0000E-01 5.0000E-01 3.9891E-01 0.0000E+00 0.0000E+00 0.0000E+00
103.501 3.0836E+03 0.0000E+00 0.0000E+00 2.0413E+00 2.0413E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 1.5117E+00 1.5117E+00 3.0234E+00 5.0000E-01 5.0000E-01 3.6277E-01 0.0000E+00 0.0000E+00 0.0000E+00
115.630 2.9267E+03 0.0000E+00 0.0000E+00 1.9375E+00 1.9375E+00 0.0000E+00 0.0000E+00 2.1000E+17 8.0769E+17 1.2925E+00 1.2925E+00 2.5850E+00 5.0000E-01 5.0000E-01 3.4432E-01 0.0000E+00 0.0000E+00 0.0000E+00
\ No newline at end of file
#1 Tower top
r m x_cg y_cg ri_x ri_y x_sh y_sh E G I_x I_y I_p k_x k_y A pitch x_e y_e
$1 2 towertop with nacelle mass on bottom element. flexible
0.0 1.00E-04 0 0 1.36E+00 1.36E+00 0 0 2.10E+11 8.08E+10 5.52E-01 5.52E-01 1.10E+00 0.5 0.5 2.98E-01 0 0 0
2.75 1.00E-04 0 0 1.36E+00 1.36E+00 0 0 2.10E+11 8.08E+10 5.52E-01 5.52E-01 1.10E+00 0.5 0.5 2.98E-01 0 0 0
r m x_cg y_cg ri_x ri_y x_sh y_sh E G I_x I_y I_p k_x k_y A pitch x_e y_e
$2 2 towertop with nacelle mass on bottom element. Stiff
0.0 1.00E-04 0 0 1.36E+00 1.36E+00 0 0 2.10E+17 8.08E+17 5.52E-01 5.52E-01 1.10E+00 0.5 0.5 2.98E-01 0 0 0
2.75 1.00E-04 0 0 1.36E+00 1.36E+00 0 0 2.10E+17 8.08E+17 5.52E-01 5.52E-01 1.10E+00 0.5 0.5 2.98E-01 0 0 0
\ No newline at end of file
1
1 40
0.0000E+00 5.3800E+00 1.0000E+02 1 ;
2.0000E+00 5.3800E+00 1.0000E+02 1 ;
4.7120E+00 5.3800E+00 9.6915E+01 1 ;
5.3960E+00 5.3800E+00 9.5291E+01 1 ;
6.3190E+00 5.3886E+00 9.2664E+01 1 ;
7.4750E+00 5.4212E+00 8.8775E+01 1 ;
8.8580E+00 5.4865E+00 8.3448E+01 1 ;
1.0458E+01 5.5887E+00 7.6689E+01 1 ;
1.2268E+01 5.7247E+00 6.8754E+01 1 ;
1.4275E+01 5.8817E+00 6.0273E+01 1 ;
1.6467E+01 6.0346E+00 5.2291E+01 1 ;
1.8833E+01 6.1478E+00 4.5826E+01 1 ;
2.1356E+01 6.2020E+00 4.0950E+01 1 ;
2.4023E+01 6.1950E+00 3.7343E+01 1 ;
2.6817E+01 6.1292E+00 3.4518E+01 1 ;
2.9721E+01 6.0096E+00 3.2270E+01 1 ;
3.2719E+01 5.8432E+00 3.0488E+01 1 ;
3.5791E+01 5.6400E+00 2.9020E+01 1 ;
3.8920E+01 5.4107E+00 2.7756E+01 1 ;
4.2086E+01 5.1613E+00 2.6693E+01 1 ;
4.5272E+01 4.8974E+00 2.5829E+01 1 ;
4.8457E+01 4.6255E+00 2.5157E+01 1 ;
5.1623E+01 4.3519E+00 2.4665E+01 1 ;
5.4750E+01 4.0827E+00 2.4338E+01 1 ;
5.7820E+01 3.8220E+00 2.4156E+01 1 ;
6.0815E+01 3.5724E+00 2.4100E+01 1 ;
6.3716E+01 3.3364E+00 2.4100E+01 1 ;
6.6506E+01 3.1161E+00 2.4100E+01 1 ;
6.9168E+01 2.9130E+00 2.4100E+01 1 ;
7.1687E+01 2.7275E+00 2.4100E+01 1 ;
7.4047E+01 2.5595E+00 2.4100E+01 1 ;
7.6234E+01 2.4087E+00 2.4100E+01 1 ;
7.8234E+01 2.2660E+00 2.4100E+01 1 ;
8.0037E+01 2.1175E+00 2.4100E+01 1 ;
8.1631E+01 1.9588E+00 2.4100E+01 1 ;
8.3006E+01 1.7913E+00 2.4100E+01 1 ;
8.4155E+01 1.6013E+00 2.4100E+01 1 ;
8.5070E+01 1.3858E+00 2.4100E+01 1 ;
8.5746E+01 1.1384E+00 2.4100E+01 1 ;
8.6366E+01 8.3354E-01 2.4100E+01 1 ;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment