Evaluation of wind data (wind)

functions for working with and converting wind data

Equations in this section are the equivalent to the equations in appendix E of ITTC. However, mostly the functions here are a wrapper over the functions found in the trig module

Remember that windspeed is ALWAYS positive, the direction tells you if it is helping or hindering the ship. Negative wind speeds are positive windspeeds rotated \(180^\circ\).

Understanding wind directions and speeds, aswell as their conversion into relative and true forms can be confusing, the below figures aim to clarify how this works

Basic ship position

Wind ship relations

Wind triangle

1 True Wind

The two functions in this section convert relative wind speed and direction to thier True equivalents.

1.1 Speed

Calculating true windspeed from relative windspeed and direction

\[V_\textrm{WR} = \sqrt{V_{WR}^2 + V_G^2 - 2V_{WR} V_G \cos(\psi_{WR})}\]

ITTC equations: E-2


source

1.2 rel2true_speed

 rel2true_speed (relative_windspeed:float, sog:float,
                 relative_wind_direction:float)

converts a relative wind speed and direction to a true wind speed

Type Details
relative_windspeed float speed of wind relative to ship
sog float speed over ground
relative_wind_direction float wind direction relative to ship
Returns float True windspeed

If the wind is blowing has a relative angle of 0, (meaning the wind is blowing from the bow to the stern) and has a relative windspeed of 2 knots, then the true windspeed can be calculated as

rel2true_speed(2, 20, 0)
18.0

Conversely if the wind is blowing from stern to bow this means the true windspeed is 22

rel2true_speed(2, 20, np.pi)
22.0

However if the relative angle is \(-45^\circ\) then the true windspeed is

rel2true_speed(2, 20, -np.pi/4)
18.63951333874026

Remember that windspeed is ALWAYS positive, the direction tells you if it is helping or hindering the ship

1.3 Direction

How to calculate the true direction from the relative direction.

$$ _ = ( )

$$

ITTC equations: E-3


source

1.4 rel2true_dir

 rel2true_dir (relative_wind_speed:float, sog:float,
               relative_wind_direction:float, vessel_heading:float,
               constrain_to_positive:bool=True)

converts relative wind direction to true wind direction

Type Default Details
relative_wind_speed float Speed of the wind relative to the ship
sog float Speed of the ship overground
relative_wind_direction float direction of wind in radians relative to the ship
vessel_heading float The direction of the ship through the water
constrain_to_positive bool True Should the function return a value between 0 and 2 pi
Returns float the true wind directionangle relative to north in radians.

Considering a ship where the relative wind direction is 0, the relative windspeed is 2, and the ships heading is \(45^\circ\) or \(\frac{\pi}{2}\), then the true wind speed is

rel2true_dir(2,20,0,2)
5.141592653589793

Although by default the wind direction is constrained to return only positive values between \(0\) and \(2\pi\), values between \(-\frac{\pi}{2}\) and \(\frac{\pi}{2}\), can be created using constrain_to_positive = False

rel2true_dir(2,20,0,2, False)
-1.1415926535897933
#### bug alert!
#does this make sense?
#should it be 180 or zero?
rel2true_dir(2,20,0,0, False)
3.141592653589793

2 Relative Wind

2.1 Speed

Calculating relative wind speed from true wind speed and direction as shown in the equation below

\[V_\textrm{WR} = \sqrt{V_{TW}^2 + V_G^2 + 2V_{TW} V_G \cos(\psi_{WT} - \psi)}\]

ITTC equations: E-7, E-10


source

2.2 true2rel_speed

 true2rel_speed (true_wind_speed:float, sog:float,
                 true_wind_direction:float, vessel_heading:float)

converts true windspeed to relative

Type Details
true_wind_speed float The windspeed over ground
sog float Speed over ground of the vessel
true_wind_direction float Direction of wind relative to north
vessel_heading float Direction of vessel in water relative to north
Returns float returns relative windspeed using the same units entered

As an example consider a ship travelling at 20 knots with a direction due north. The wind blows due north with a speed of 22 knots

true2rel_speed(22,20, 0,0)
42.0
true2rel_speed(22,20, 0, np.pi)
2.0

2.3 Direction

Caclulating relative windspeed from true windspeed and direction

\[\psi_\textrm{WR} = \text{arctan2}\left( \frac{ V_\textrm{WT} \textrm{sin}(\psi_\textrm{WT} - \psi)}{ V_\textrm{G} + V_\textrm{WT} \textrm{cos}(\psi_\textrm{WT} - \psi)} \right)\]

ITTC equations: E-6, E-9


source

2.4 true2rel_dir

 true2rel_dir (true_wind_speed:float, sog:float,
               true_wind_direction:float, vessel_heading:float,
               constrain_to_positive:bool=True)

converts true direction speed to relative

Type Default Details
true_wind_speed float The windspeed over ground
sog float Speed over ground of the vessel
true_wind_direction float Direction of wind relative to north
vessel_heading float Direction of vessel in water relative to north
constrain_to_positive bool True Should the function return a value between 0 and 2 pi
Returns float relative wind direction

We can see that if a ship is heading due north and the true windspeed is also due east. When the ship is at 20 knots and the wind is at 22 knots, the relative direction of the wind is as below

true2rel_dir(22,20, np.pi/2,0, constrain_to_positive=False)
0.8329812666744317

If the wind direction is due west, the relative wind direction is the negative of the previous value

true2rel_dir(22,20, -np.pi/2,0, constrain_to_positive=False)
-0.8329812666744317

Unless of course ‘constrain_to_positive’ is set to true

true2rel_dir(22,20, -np.pi/2,0, constrain_to_positive=True)
5.450204040505154

3 Average wind speed and direction across a double run

The ITTC method proposes taking the average windspeed across a double run to average for errors in readings This function is a wrapper round the ‘combine_vectors’ function from the trig module. \[c \; \text{cos}(\gamma) = a \; \text{cos}(\alpha) + b \; \text{cos}(\beta), \] \[c \; \text{sin}(\gamma) = a \; \text{sin}(\alpha) + b \; \text{sin}(\beta), \]

\[c = \sqrt{(\frac{c \; \text{cos}(\gamma)^2 + c \; \text{sin}(\gamma)^2}{2})} \]

\[\gamma = \text{arctan2} \left( \frac{c \; \text{cos}(\gamma)}{c \; \text{sin}(\gamma)} \right)\]

Where \(a\) and \(b\) are the true windspeeds of two paired runs and \(\alpha\) and \(\beta\) are there true direction.

The function takes the magnitude and angle of two vectors and outputs the magnitude and angle of the resultant vector.

One can question whether this approach makes physical sense under certain conditions, the user should consider what is happening in the test and consult the reasoning of the ITTC for further details.

ITTC equations: E-4, E-5


source

3.1 double_run_average

 double_run_average (a, b, alpha, beta)

In the example below on the first run a ship is faced with a wind of 13m/s blowing from the north, whilst on the second run the wind has dropped to 5m/s and is coming from the east. The function calculates the mean wind speed across both runs.

wind_speed, wind_direction = double_run_average(a = 13, b = 5, alpha = 0, beta = 1.6)

print("The wind speed is {0} m/s, the wind direction is {1} radians".format(round(wind_speed, 2), round(wind_direction, 2)))
The wind speed is 6.9 m/s, the wind direction is 0.37 radians

4 Correcting for the height of the Anemometer

Adjusts the windspeed taking into account the height of the anemometer on the ship relative to the reference height for windspeed

\[V_\textrm{WTref} = V_\textrm{WT} \left( \frac{Z_\textrm{ref}}{Z_a} \right)^\frac{1}{9}\]

ITTC equations: E-8


source

4.1 vertical_position_anemometer

 vertical_position_anemometer (true_wind_speed:float,
                               reference_height:float,
                               measured_height:float)

Adjusts the windspeed taking into account the height of the anemometer on the ship relative to the reference height for windspeed

Type Details
true_wind_speed float True windspeed [m/s]
reference_height float reference height [m]
measured_height float measured height [m]
Returns float The true windspeed corrected for measurement height

The adjusted wind speed differences are often small but the corrections can still influence the final result

vertical_position_anemometer(22,5, 10)
20.36924367032039