nidas v1.2.3
|
WindTilter is used to apply a 3d rotation matrix to a wind vector. More...
#include <WindTilter.h>
Public Member Functions | |
WindTilter () | |
double | getLeanDegrees () const |
void | setLeanDegrees (double val) |
double | getLeanAzimuthDegrees () const |
void | setLeanAzimuthDegrees (double val) |
bool | isIdentity () const |
void | rotate (float *u, float *v, float *w) const |
Private Member Functions | |
void | computeMatrix () |
Private Attributes | |
double | _lean |
double | _leanaz |
bool | _identity |
double | _mat [3][3] |
bool | UP_IS_SONIC_W |
WindTilter is used to apply a 3d rotation matrix to a wind vector.
WindTilter generates a matrix for rotating 3d wind vectors from an orthogonal sonic coordinate system to a new coordinate system whose w axis is defined by two angles, lean and leanaz. It is commonly used to rotate sonic wind data to mean flow coordinates, whose w axis is normal to the plane of the observed flow.
lean is the angle in radians between the flow normal and the sonic w axis (0 <= lean <= 180)
leanaz is the clock angle in radians from the sonic u axis to the projection of the flow normal in the sonic uv plane, positive toward the sonic v axis. (0 <= leanaz < 360)
The unit axes of sonic coordinates: Us, Vs, Ws The unix axes of the flow coordiate system: Uf, Vf, Wf
This is primarily a rotation of the W axis. The Uf axis remains in the plane of Us and an "up" direction.
In sonic (aka instrument coordinates) the Wf axis is sin(lean) * cos(leanaz) sin(lean) * sin(leanaz) cos(lean)
Once you have the Wf axis defining the Uf,Vf plane, there is some uncertainty about where to put the Uf axis on that plane.
If Uf is the intersection of the normal plane with the old Us,Ws plane, then Uf = Vs X Wf cross product of Vs and Wf = (0 1 0) X Wf In sonic coords Vs is just (0 1 0) Then normalize Uf. The above method is used when UP_IS_SONIC_W == true
If Uf is the intersection of the flow normal plane with the Wf,Us plane, then
Uf = (Wf X Us) X Wf (normalized)
The above method is used when UP_IS_SONIC_W == false
Right now the default value of UP_IS_SONIC_W is false.
I suppose if you had your sonic on the side of a steep hill you may want "up" to be the sonic W axis.
How to determine the flow normal from sonic wind data.
The value of W in flow coordinates (Wf) is the dot product of the corrected sonic wind vector (us-uoff,vs-voff,ws-woff) with the Wf unit vector, in sonic coordinates. uoff, voff and woff are the sonic biases.
Wf = (us-uoff) * sin(lean)cos(leanaz) + (vs-voff)*sin(lean)sin(leanaz)
An averaged Wf is by definition zero, which gives an equation for wsbar in terms of usbar and vsbar.
wsbar = woff - (usbar-uoff)*tan(lean)cos(leanaz)
Therefore wsbar should look like a linear function of the corrected and averaged U and V components from the sonic, (uscor=usbar-uoff):
wsbar = b1 + b2 * uscor + b3 * vscor
One can determine these b coefficients with a minimum variance fit, and
b1 = woff b2 = -tan(lean)cos(leanaz) b3 = -tan(lean)sin(leanaz)
lean and leanaz are therefore: lean = atan(sqrt(b2*b2 + b3*b3)) leanaz = atan2(-b3,-b2)
WindTilter::WindTilter | ( | ) |
References _mat.
|
private |
References _identity, _lean, _leanaz, _mat, nidas::core::getSample(), and UP_IS_SONIC_W.
Referenced by setLeanAzimuthDegrees(), and setLeanDegrees().
|
inline |
References _leanaz, and nidas::core::getSample().
Referenced by nidas::dynld::isff::Wind3D::getLeanAzimuthDegrees().
|
inline |
References _lean, and nidas::core::getSample().
Referenced by nidas::dynld::isff::Wind3D::getLeanDegrees().
References _identity, _mat, and nidas::core::getSample().
References _identity, _leanaz, and computeMatrix().
Referenced by nidas::dynld::isff::Wind3D::setLeanAzimuthDegrees().
References _lean, and computeMatrix().
Referenced by nidas::dynld::isff::Wind3D::setLeanDegrees().
|
private |
Referenced by computeMatrix(), isIdentity(), rotate(), and setLeanAzimuthDegrees().
|
private |
Referenced by computeMatrix(), getLeanDegrees(), and setLeanDegrees().
|
private |
Referenced by computeMatrix(), getLeanAzimuthDegrees(), and setLeanAzimuthDegrees().
|
private |
Referenced by computeMatrix(), rotate(), and WindTilter().
|
private |
Referenced by computeMatrix().