SignalK / signalk-derived-data

Generates deltas for values derived from signalk values
Apache License 2.0
18 stars 30 forks source link

Wind Speed Over Ground #110

Closed Ric121 closed 1 year ago

Ric121 commented 1 year ago

Hi!

Sorry if this is not an issue, that's my first time reporting here. I use the derived data Wind Speed Over Ground, that (I guess) is calculated from Apparent Wind Speed (AWS) and probably Speed over Ground (SOG) as I don't have the loch feeding Signal-k, I know that is not exactly the same as True Wind Speed (TWS) but I understand that with no current it should be close. What I noticed is that when I'm upwind, WSoG is always higher than AWS, and when I'm downwind, WSoG is always lower than AWS. That's not the way it should be, so I wonder if there is not an issue here.

Upwind screenshot Screenshot_2022-07-30-02-47-53-219_com duckduckgo mobile android

joabakk commented 1 year ago

Not strange at all. If you look at https://github.com/SignalK/signalk-derived-data/blob/master/calcs/groundWind.js you will see that the calculation is done to correct apparent wind spoeed that your sensor sees, for your boat speed. Which I assume is the red line in the first graph.

Ric121 commented 1 year ago

I'll have a look to your formula (I use another one), but in any case when you are upwind can the True Wind Speed be greater than the Apparent Wind Speed. And when you are downwind the contrary. On the graph the Orange is the Speed over ground and Yellow the AWS (Yes the Red Line is SOG)

sbender9 commented 1 year ago

I wouldn't be too surprised if something is wrong with my calculation. It seems about right to me when I'm out, but I haven't scrutinized it as much as you.

Please let me know if you have a better formula.

Ric121 commented 1 year ago

I think I know where the problem is, but it's difficult to explain in English ;-). If you use the SIN law, you have to take care if the angle is less or more than 90 degrees. If you use the COS law (AL Kashi theorem) you don't have to care of the sign. Maybe that also explains why I have some strange 180 sudden changes in True Wind Angle when I tack (but I didn't check this part yet). If you use the COS law, the formula is TWS^2=SOW^2+AWS^2-2AWSSOG*COS(AWA)

(SOW Speed over Water, could use SOG if not available)

In the following file I compared the COS formula with your SIN formula changing the -SOG in +SOG. You can see that -SOG works for angles < 90º and +SOG works for angles > 90º. So I think it's easier to use the COS formula. For AWA I have to work out the right formula, in the excell this is wrong. https://app.box.com/s/47ufcqlua8vf618awu71gsmvjoxassor

Here is the theory in French https://www.maxicours.com/se/cours/trigonometrie-appliquee-aux-triangles-quelconques/

I'm starting a passage tomorrow and I have no time to change and test it (I don't know JS ;-).

tkurki commented 1 year ago

Here you can play with the way it is calculated: https://jsbin.com/dikekakesu/edit?js,console

You attached a graph that does not show the input and output data, just output data. Provide example values of navigation.speedOverGround, environment.wind.speedApparent, environment.wind.angleApparent and resulting environment.wind.speedOverGround if you think something's wrong. Reopen if you still think it is wrong.

Ric121 commented 1 year ago

The Green and Yellow are input data AWS (From amemometer, instantaneous and averaged) The Red is input SOG (From GPS and AIS) The Blue and Orange is output Derived Wind Speed Over Ground The only data missing here is AWA, I just put a screenshot when I was upwind at about 60º AWA.

But the fact is that when I am upwind, constantly I have TWS > AWS and when I am downwind I have TWS < AWS and that's not normal. In the excell I provided, I calculated with the formula from the pluggin for different AWA and SOG, and you can see that this formula is giving a wrong TWS upwind. If you need the bulk data to be convinced I'll dig in the database, but I think it's simpler for me to change the formula. I just wanted to help.

P.S. And I'm a bit surprised on the way you close directly the issue with no investigation further ;-)

tkurki commented 1 year ago

Sorry I forgot about your sheet, I was reading your mail without access to Excel.

First: your sheet is not using Radians but degrees. For example 45 degrees is 0.785398 in radians and 45 radians is 2578.31 degrees, equivalent to 58 degrees.

https://support.microsoft.com/en-us/office/sin-function-cf0e3432-8b9e-483c-bc55-a76651c95602

Second: the first line of your sheet is upwind with AWA of 58 degrees

image

and TWS 3.9 is less than AWS 5.