Skip to content

Commit 0839dcf

Browse files
authored
Adds the QTF rotations feature (WEC-Sim#1511)
1 parent 88ff32c commit 0839dcf

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function f = secondOrderExt(time_vector,fastVaryingForce,slowVaryingForce,t)
1+
function f_rotated = secondOrderExt(time_vector, fastVaryingForce, slowVaryingForce, t, displacement)
22
% The second-order forces related to the Quadratic Transfer Functions (QTFs) are calculated
33
% in the frequency domain during the initialization step within the methods of the bodyClass.
44

@@ -10,14 +10,17 @@
1010
% (the time series can be obtained through an FFT).
1111
% - The time series of second-order forces will act on a single point at the origin
1212
% (similarly to the first-order forces).
13-
% - Wave forces and moments are fixed to a reference frame that translates
14-
% (but does not rotate) with the platform. This can be implemented using force rotations.
13+
% - The function assumes small X-Y displacments (To be done in future releases).
1514
% - Wavelengths are large compared to the motion of the platform.
16-
% - Current WEC-Sim version solves the Full QTFs.
1715
% - Single wave direction is assumed.
1816

19-
[~,Index] = min(abs(time_vector - t));
17+
[~, index] = min(abs(time_vector - t));
2018

21-
f = fastVaryingForce(Index,:)' + slowVaryingForce(Index,:)';
19+
f = fastVaryingForce(index,:)' + slowVaryingForce(index,:)';
20+
21+
% Apply rotation
22+
[phi, theta, psi] = deal(displacement(4), displacement(5), displacement(6));
23+
rotMat = eulXYZ2RotMat(phi, theta, psi);
24+
f_rotated = [rotMat*f(1:3) ; rotMat*f(4:end)];
2225

2326
end
480 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)