Commit 163d6512 authored by Mikkel Friis-Møller's avatar Mikkel Friis-Møller Committed by famen
Browse files

added pytest

added tests and submission to hawc2 binary

fixed runner-name
parent 8f3fde57
Pipeline #7199 passed with stage
in 50 seconds
stages:
- pull
- build
- test
- deploy
pull_win32:
test:
stage:
pull
variables:
GIT_SUBMODULE_STRATEGY: normal
test
script:
- cd "C:\hawc2-win32"
- git pull
- devenv src/dtu_controller.sln /build "Release|win32"
- git clone -b master --depth 1 https://gitlab.windenergy.dtu.dk/HAWC2/hawc2-binary/hawc2-win32.git
- c:/Anaconda3/envs/pyHawc2/python hawc2-win32/update_module.py src/release/dtu_we_controller.dll master-test
- c:/Anaconda3/envs/pyHawc2/python.exe -m pytest
tags:
- CPAV_old_PC
only:
- test_compile_win32
- master
except:
- test_build
- tags
compile_win32:
build_test_deploy_win32:
stage:
build
variables:
GIT_SUBMODULE_STRATEGY: normal
build
script:
- devenv src/dtu_controller.sln /build "Release|win32"
- xcopy /y/r "src\release\dtu_we_controller.dll" "C:\hawc2-win32"
- xcopy /y/r "src\release\dtu_we_controller_bladed.dll" "C:\hawc2-win32"
- cd "C:\hawc2-win32"
- git commit -a -m "DTUBasicController updated"
- git push
- git clone -b master --depth 1 https://gitlab.windenergy.dtu.dk/HAWC2/hawc2-binary/hawc2-win32.git
- c:/Anaconda3/envs/pyHawc2/python hawc2-win32/update_module.py src/release/dtu_we_controller.dll
- c:/Anaconda3/envs/pyHawc2/python.exe -m pytest
- c:/Anaconda3/envs/pyHawc2/python hawc2-win32/update_module.py push
tags:
- CPAV_old_PC
only:
- test_compile_win32
- master
- test_build
- tags
7 Wind speed [m/s] Pitch [deg]
0.0 2.680706
4.0 2.680706
5.0 1.896366
6.0 0.862669
7.0 0.000078
8.0 0.000048
50.0 0.000048
\ No newline at end of file
......@@ -106,5 +106,4 @@ $2 51
8.15767E+01 5.4472336943700E+01 1.4331849630200E-01 1.6575702766900E-02 1.7310403257700E-01 4.8374157752900E-01 3.9175770750800E-01 2.5443974484700E-02 1.1655512835000E+17 2.6753543076700E+18 2.4314511382800E-03 1.3298443997100E-02 4.2582446566400E-03 6.1742687532900E-01 2.7741524816700E-01 6.6844473212900E-02 -5.9343789093200E-01 2.0148043073400E-01 1.4401562934300E-02
8.33430E+01 4.0650223382200E+01 1.0136181289700E-01 1.5402536123200E-02 1.4762816069600E-01 4.4569857148700E-01 3.4142911468500E-01 2.2261415051200E-02 1.1039319669300E+17 2.7702167161500E+18 1.3117952217400E-03 9.0920876998100E-03 2.6040534509000E-03 6.7595771736300E-01 2.7038621169100E-01 5.0172142945500E-02 -6.8774796218000E-01 1.3759696132200E-01 1.3848749710400E-02
8.50712E+01 2.5203987686600E+01 4.7444236865700E-02 1.3232007723600E-02 1.1057756238200E-01 3.7522671548200E-01 2.7092927703800E-01 1.7296215940000E-02 8.7020618876500E+17 2.5541534143000E+18 5.1676828652800E-04 4.7938390658900E-03 1.1493908905300E-03 7.1661128383900E-01 2.5507790440300E-01 3.5325331574900E-02 -7.9326366953800E-01 6.8887947528100E-02 1.2195780995700E-02
8.63660E+01 1.5424386826700E+01 1.4977437285700E-02 9.6772078146300E-03 7.2485884256900E-02 2.6978743301300E-01 1.8115448297600E-01 1.1928398382200E-02 6.8496387278100E+ 2.2405486509300E+18 1.5000347815300E-04 1.8562282673700E-03 3.5406704445100E-04 6.8561274475800E-01 2.1749241825900E-01 2.5140405217300E-02 -9.5490574931100E-01 2.0912754777200E-02 9.1410476845300E-03
18
\ No newline at end of file
8.63660E+01 1.5424386826700E+01 1.4977437285700E-02 9.6772078146300E-03 7.2485884256900E-02 2.6978743301300E-01 1.8115448297600E-01 1.1928398382200E-02 6.8496387278100E+17 2.2405486509300E+18 1.5000347815300E-04 1.8562282673700E-03 3.5406704445100E-04 6.8561274475800E-01 2.1749241825900E-01 2.5140405217300E-02 -9.5490574931100E-01 2.0912754777200E-02 9.1410476845300E-03
\ No newline at end of file
21 wind speed [m/s] pitch [deg] rot. speed [rpm]
5.0 1.52 6.00
6.0 0.46 6.00
7.0 0.00 6.37
8.0 0.00 7.28
9.0 0.00 8.19
10.0 0.00 9.10
11.0 0.00 9.60
12.0 4.10 9.60
13.0 6.69 9.60
14.0 8.62 9.60
15.0 10.26 9.60
16.0 11.74 9.60
17.0 13.10 9.60
18.0 14.38 9.60
19.0 15.59 9.60
20.0 16.76 9.60
21.0 17.88 9.60
22.0 18.97 9.60
23.0 20.03 9.60
24.0 21.05 9.60
25.0 22.05 9.60
This diff is collapsed.
This diff is collapsed.
export MKL_CBWR = AVX2
\ No newline at end of file
import os
from wetb.hawc2.htc_file import HTCFile
from wetb.hawc2 import Hawc2io
from numpy import testing as npt
from scipy import stats
h2_path = os.path.dirname(__file__) + '/../' + 'hawc2-win32/hawc2mb.exe'
h2_path = os.path.abspath(h2_path)
m_path = os.path.dirname(__file__) + '/../' + 'examples/HAWC2/DTU10MW'
m_path = os.path.abspath(m_path)
f_path = os.path.join(m_path, 'htc/DTU_10MW_RWT_short.htc')
res_path = os.path.join(m_path, 'tmp/dtu_10mw_rwt_short')
ref_path = os.path.join(os.path.dirname(__file__), 'test_files', 'DTU_10MW_RWT_short')
htc = HTCFile(f_path, m_path)
def test_10mw_short():
stdout, log = htc.simulate(h2_path)
if "error" in log.lower():
raise Exception(log.replace("\r\n", '\n'))
res = Hawc2io.ReadHawc2(res_path)
ref = Hawc2io.ReadHawc2(ref_path)
ress = stats.describe(res())._asdict()
refs = stats.describe(ref())._asdict()
for ref, res in zip(refs['mean'], ress['mean']):
npt.assert_approx_equal(ref, res, significant=4)
________________________________________________________________________________________________________________________
Version ID : HAWC2MB 12.6
Time : 09:49:34
Date : 01:03.2019
________________________________________________________________________________________________________________________
Result file : ./tmp/dtu_10mw_rwt_short.dat
________________________________________________________________________________________________________________________
Scans Channels Time [sec] Format
1000 108 10.000 BINARY
Channel Variable Description
1 Time s Time
2 bea1 angle deg shaft_rot angle
3 bea1 angle_speed rpm shaft_rot angle speed
4 bea2 angle deg pitch1 angle
5 bea2 angle_speed deg/s pitch1 angle speed
6 bea2 angle deg pitch2 angle
7 bea2 angle_speed deg/s pitch2 angle speed
8 bea2 angle deg pitch3 angle
9 bea2 angle_speed deg/s pitch3 angle speed
10 Omega rad/s Rotor speed
11 Ae rot. torque kNm Aero rotor torque
12 Ae rot. power kW Aero rotor power
13 Ae rot. thrust kN Aero rotor thrust
14 WSP gl. coo.,Vx m/s Free wind speed Vx, gl. coo, of gl. pos 0.00, 0.00,-119.00
15 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 0.00,-119.00
16 WSP gl. coo.,Vz m/s Free wind speed Vz, gl. coo, of gl. pos 0.00, 0.00,-119.00
17 Mx coo: tower kNm MomentMx Mbdy:tower nodenr: 1 coo: tower tower base
18 My coo: tower kNm MomentMy Mbdy:tower nodenr: 1 coo: tower tower base
19 Mz coo: tower kNm MomentMz Mbdy:tower nodenr: 1 coo: tower tower base
20 Mx coo: tower kNm MomentMx Mbdy:tower nodenr: 11 coo: tower tower yaw bearing
21 My coo: tower kNm MomentMy Mbdy:tower nodenr: 11 coo: tower tower yaw bearing
22 Mz coo: tower kNm MomentMz Mbdy:tower nodenr: 11 coo: tower tower yaw bearing
23 Mx coo: shaft kNm MomentMx Mbdy:shaft nodenr: 4 coo: shaft main bearing
24 My coo: shaft kNm MomentMy Mbdy:shaft nodenr: 4 coo: shaft main bearing
25 Mz coo: shaft kNm MomentMz Mbdy:shaft nodenr: 4 coo: shaft main bearing
26 Mx coo: blade1 kNm MomentMx Mbdy:blade1 nodenr: 3 coo: blade1 blade 1 root
27 My coo: blade1 kNm MomentMy Mbdy:blade1 nodenr: 3 coo: blade1 blade 1 root
28 Mz coo: blade1 kNm MomentMz Mbdy:blade1 nodenr: 3 coo: blade1 blade 1 root
29 Mx coo: blade2 kNm MomentMx Mbdy:blade2 nodenr: 3 coo: blade2 blade 2 root
30 My coo: blade2 kNm MomentMy Mbdy:blade2 nodenr: 3 coo: blade2 blade 2 root
31 Mz coo: blade2 kNm MomentMz Mbdy:blade2 nodenr: 3 coo: blade2 blade 2 root
32 Mx coo: blade3 kNm MomentMx Mbdy:blade3 nodenr: 3 coo: blade3 blade 3 root
33 My coo: blade3 kNm MomentMy Mbdy:blade3 nodenr: 3 coo: blade3 blade 3 root
34 Mz coo: blade3 kNm MomentMz Mbdy:blade3 nodenr: 3 coo: blade3 blade 3 root
35 Mx coo: local kNm MomentMx Mbdy:blade1 nodenr: 13 coo: local blade 1 50% local e coo
36 My coo: local kNm MomentMy Mbdy:blade1 nodenr: 13 coo: local blade 1 50% local e coo
37 Mz coo: local kNm MomentMz Mbdy:blade1 nodenr: 13 coo: local blade 1 50% local e coo
38 Mx coo: local kNm MomentMx Mbdy:blade2 nodenr: 13 coo: local blade 2 50% local e coo
39 My coo: local kNm MomentMy Mbdy:blade2 nodenr: 13 coo: local blade 2 50% local e coo
40 Mz coo: local kNm MomentMz Mbdy:blade2 nodenr: 13 coo: local blade 2 50% local e coo
41 Mx coo: local kNm MomentMx Mbdy:blade3 nodenr: 13 coo: local blade 3 50% local e coo
42 My coo: local kNm MomentMy Mbdy:blade3 nodenr: 13 coo: local blade 3 50% local e coo
43 Mz coo: local kNm MomentMz Mbdy:blade3 nodenr: 13 coo: local blade 3 50% local e coo
44 State pos x coo: global m State pos x Mbdy:tower E-nr: 10 Z-rel:1.00 coo: global tower top fa displ
45 State pos y coo: global m State pos y Mbdy:tower E-nr: 10 Z-rel:1.00 coo: global tower top ss displ
46 State acc x coo: global m/s^2 State acc x Mbdy:tower E-nr: 10 Z-rel:1.00 coo: global tower top fa acc
47 State acc y coo: global m/s^2 State acc y Mbdy:tower E-nr: 10 Z-rel:1.00 coo: global tower top ss acc
48 State pos x coo: blade1 m State pos x Mbdy:blade1 E-nr: 26 Z-rel:1.00 coo: blade1 blade 1 tip pos
49 State pos y coo: blade1 m State pos y Mbdy:blade1 E-nr: 26 Z-rel:1.00 coo: blade1 blade 1 tip pos
50 State pos z coo: blade1 m State pos z Mbdy:blade1 E-nr: 26 Z-rel:1.00 coo: blade1 blade 1 tip pos
51 State pos x coo: blade2 m State pos x Mbdy:blade2 E-nr: 26 Z-rel:1.00 coo: blade2 blade 2 tip pos
52 State pos y coo: blade2 m State pos y Mbdy:blade2 E-nr: 26 Z-rel:1.00 coo: blade2 blade 2 tip pos
53 State pos z coo: blade2 m State pos z Mbdy:blade2 E-nr: 26 Z-rel:1.00 coo: blade2 blade 2 tip pos
54 State pos x coo: blade3 m State pos x Mbdy:blade3 E-nr: 26 Z-rel:1.00 coo: blade3 blade 3 tip pos
55 State pos y coo: blade3 m State pos y Mbdy:blade3 E-nr: 26 Z-rel:1.00 coo: blade3 blade 3 tip pos
56 State pos z coo: blade3 m State pos z Mbdy:blade3 E-nr: 26 Z-rel:1.00 coo: blade3 blade 3 tip pos
57 State pos x coo: global m State pos x Mbdy:blade1 E-nr: 26 Z-rel:1.00 coo: global gl blade 1 tip pos
58 State pos y coo: global m State pos y Mbdy:blade1 E-nr: 26 Z-rel:1.00 coo: global gl blade 1 tip pos
59 State pos z coo: global m State pos z Mbdy:blade1 E-nr: 26 Z-rel:1.00 coo: global gl blade 1 tip pos
60 WSP Vx, glco, R= 72.3 m/s Wind speed Vx of blade 1 at radius 72.33, global coo.
61 Alfa, R= 72.3 deg Angle of attack of blade 1 at radius 72.33
62 Alfa, R= 72.3 deg Angle of attack of blade 2 at radius 72.33
63 Alfa, R= 72.3 deg Angle of attack of blade 3 at radius 72.33
64 Cl, R= 72.5 deg Cl of blade 1 at radius 72.33
65 Cl, R= 72.5 deg Cl of blade 2 at radius 72.33
66 Cl, R= 72.5 deg Cl of blade 3 at radius 72.33
67 Cd, R= 72.5 deg Cd of blade 1 at radius 72.33
68 Cd, R= 72.5 deg Cd of blade 2 at radius 72.33
69 Cd, R= 72.5 deg Cd of blade 3 at radius 72.33
70 DLL inp 1: 1 - DLL : 1 inpvec : 1 generator torque reference [nm]
71 DLL inp 1: 2 - DLL : 1 inpvec : 2 pitch angle reference of blade 1 [rad]
72 DLL inp 1: 3 - DLL : 1 inpvec : 3 pitch angle reference of blade 2 [rad]
73 DLL inp 1: 4 - DLL : 1 inpvec : 4 pitch angle reference of blade 3 [rad]
74 DLL inp 1: 5 - DLL : 1 inpvec : 5 power reference [w]
75 DLL inp 1: 6 - DLL : 1 inpvec : 6 filtered wind speed [m/s]
76 DLL inp 1: 7 - DLL : 1 inpvec : 7 filtered rotor speed [rad/s]
77 DLL inp 1: 8 - DLL : 1 inpvec : 8 filtered rotor speed error for torque [rad/s]
78 DLL inp 1: 9 - DLL : 1 inpvec : 9 bandpass filtered rotor speed [rad/s]
79 DLL inp 1: 10 - DLL : 1 inpvec : 10 proportional term of torque contr. [nm]
80 DLL inp 1: 11 - DLL : 1 inpvec : 11 integral term of torque controller [nm]
81 DLL inp 1: 12 - DLL : 1 inpvec : 12 minimum limit of torque [nm]
82 DLL inp 1: 13 - DLL : 1 inpvec : 13 maximum limit of torque [nm]
83 DLL inp 1: 14 - DLL : 1 inpvec : 14 torque limit switch based on pitch [-]
84 DLL inp 1: 15 - DLL : 1 inpvec : 15 filtered rotor speed error for pitch [rad/s]
85 DLL inp 1: 16 - DLL : 1 inpvec : 16 power error for pitch [w]
86 DLL inp 1: 17 - DLL : 1 inpvec : 17 proportional term of pitch controller [rad]
87 DLL inp 1: 18 - DLL : 1 inpvec : 18 integral term of pitch controller [rad]
88 DLL inp 1: 19 - DLL : 1 inpvec : 19 minimum limit of pitch [rad]
89 DLL inp 1: 20 - DLL : 1 inpvec : 20 maximum limit of pitch [rad]
90 DLL inp 1: 21 - DLL : 1 inpvec : 21 torque reference from dt dammper [nm]
91 DLL inp 1: 22 - DLL : 1 inpvec : 22 status signal [-]
92 DLL inp 1: 23 - DLL : 1 inpvec : 23 total added pitch rate [rad/s]
93 DLL inp 1: 24 - DLL : 1 inpvec : 24 filtered mean pitch for gain sch [rad]
94 DLL inp 1: 25 - DLL : 1 inpvec : 25 flag for mechnical brake [0=off/1=on]
95 DLL inp 1: 26 - DLL : 1 inpvec : 26 flag for emergency pitch stop [0=off/1=on]
96 DLL inp 1: 27 - DLL : 1 inpvec : 27 lp filtered acceleration level [m/s^2]
97 DLL inp 1: 31 - DLL : 1 inpvec : 31 monitored average of reference pitch [rad]
98 DLL inp 1: 32 - DLL : 1 inpvec : 32 monitored ave. of actual pitch (blade 1) [rad]
99 DLL inp 2: 1 - DLL : 2 inpvec : 1 mgen lss [nm]
100 DLL inp 2: 2 - DLL : 2 inpvec : 2 pelec [w]
101 DLL inp 2: 3 - DLL : 2 inpvec : 3 mframe [nm]
102 DLL inp 2: 4 - DLL : 2 inpvec : 4 mgen hss [nm]
103 DLL inp 2: 8 - DLL : 2 inpvec : 8 grid flag [0=run/1=stop]
104 DLL inp 3: 1 - DLL : 3 inpvec : 1 brake torque [nm]
105 DLL inp 4: 1 - DLL : 4 inpvec : 1 pitch 1 [rad]
106 DLL inp 4: 2 - DLL : 4 inpvec : 2 pitch 2 [rad]
107 DLL inp 4: 3 - DLL : 4 inpvec : 3 pitch 3 [rad]
108 DLL inp 5: 1 - DLL : 5 inpvec : 1 bltip tow min d [m]
________________________________________________________________________________________________________________________
Scale factors:
3.12500E-04
3.96111E-03
7.85736E-05
8.70585E-05
1.58651E-04
8.70229E-05
1.58503E-04
8.70265E-05
1.58501E-04
8.24049E-06
5.20423E-02
1.27319E-02
4.29189E-03
1.00000E+00
1.25000E-04
1.00000E+00
7.25119E-01
1.13617E-01
1.08648E-01
3.73746E-01
3.45394E-02
1.04936E-01
3.24321E-01
3.08189E-01
3.87772E-02
1.23479E-01
3.05233E-01
4.47055E-03
9.84139E-02
4.61156E-01
9.01031E-03
1.46136E-01
4.31220E-01
7.33781E-03
7.61749E-02
1.12676E-01
8.85973E-04
5.23037E-02
2.05454E-01
3.01763E-03
7.22307E-02
1.79528E-01
2.71601E-03
3.33994E-07
2.89513E-06
7.35259E-06
2.36481E-05
2.59997E-05
1.05927E-04
2.70086E-03
4.06546E-05
1.13771E-04
2.70043E-03
3.41423E-05
1.08524E-04
2.70090E-03
2.78208E-03
5.53401E-04
6.50697E-03
1.00000E+00
4.40520E-04
5.00647E-04
4.65648E-04
5.61280E-05
6.68836E-05
6.21603E-05
1.17190E-06
1.12157E-06
2.17601E-06
2.54582E+01
1.46210E-06
1.46210E-06
1.46210E-06
5.02338E+00
1.25000E-04
8.07526E-06
1.34424E-05
1.00000E+00
9.28398E+02
9.51198E+02
2.54582E+01
4.02570E+01
1.63194E-06
2.52237E-05
3.12587E+02
2.80950E-05
2.94697E-05
1.46210E-06
4.47241E-05
1.00000E+00
1.00000E+00
1.00000E+00
1.14357E-06
1.00000E+00
1.00000E+00
3.87094E-06
1.46383E-06
1.46774E-06
2.70798E+01
5.04625E+00
1.00000E+00
2.70798E+01
1.00000E+00
1.00000E+00
1.51946E-06
1.51884E-06
1.51890E-06
2.36986E-03
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment