Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 21-04-2016, 02:07   #46
Registered User

Join Date: Dec 2011
Boat: MC-Tec, Akilaria 950
Posts: 233
Re: Tack and Laylines Plugin - Beta?

Rick,

nice links ...
The formulas I used for TWS, TWD are basically the same. For the surface current, I'm using the same triangle calculation idea, but I made my life easy with triangle calculation by using 2 available subroutines
DistanceBearingMercator_Plugin & PositionBearingDistanceMercator_Plugin:
On the first one you give it 2 positions with lattitude/longitude (4 parameters), and it returns bearing and distance between the 2 points.
The second routine is the other way round, you input lat/lon + bearing + distance, and it spits out the destination lat/lon.
If you think in vectors / triangle calculation, you can simply see distance & bearing as speed & direction ...

Actually I did the same manual triangle calculation last year for testing but found no real difference in results, so I stuck to the above mentioned 2 routines.

The formula used to calculate leeway out of heel (first link)
leeway = K * heel / (meas_boat_speed * meas_boat_speed);
is the same I'm using, and if you look closely to the preferences screenshot in my post above, "Boat's Leeway factor [0-20]" is K in the formula. I think everyone uses this formula, I found it in my NKE instrument manuals ...
Looking at the code in the first link, the guys are limiting leeway hard coded to 45, on my code it's adjustable (see "fixed/max Leeway []" )

I did not yet include the heel compensation into the (also available) true wind calculation, although it makes absolutely sense and is easy enough. I'll add it if heel is available on the bus.

But what is missing on all those examples is the damping of the input values to get a somehow stable and reliable output reading.
If you look at this screenshot which I found on NKEs homepage
you can see what I'm talking about :
Click image for larger version

Name:	windspeed_noise.jpg
Views:	86
Size:	18.2 KB
ID:	122935

Especially the calculation of the surface current depends on a lot of input variables : position, cog, true heading, leeway, speed through water, sog, and leeway is calculated from heel and the K input. And any of these input values has to be seen as "error prone". On position/cog/sog we possibly can't do too much but still we have to rely on what the GPS gives us.

So Paul is absolutely right, it is crucial to set set up and tune your instruments right.

Anyway, in the end the result is quite noisy and needs to be filtered.
On the surface current, I experimented with Kalman filters, but found it too complicated also in terms of "availabe equipment and sensor accuracy on the various boats where O may be used". Finally the Kalman filtered results were not that much better than using a simple "exponential smoothing" filter, although there's a bit of a time lag (which I personally see not crucial for surface current).
I found another nice article on the net, which suggests "double exponential smoothing" (DES) as a replacement for kalman filters:
http://www.eecs.ucf.edu/isuelab/publ...al_laviola.pdf

The interesting thing on this article is, that they removed one of the 2 damping factors (alpha, beta) of DES by mathematical transformations.
So there's only alpha left over, which makes it easy to replace the single exp. smoothing by DES.
This is what I currently implemented, and from what I see from my VDR file testing it's working quite OK.

I'm in the comfortable situation that my NKE instruments are calculating current speed and direction (although I cannot export both via NMEA), so I have a really nice comparison to my own calculations in O, while I'm on my boat.

Oh yes, and another thing : filtering/damping a 0-359 output cost me quite some grief to get this working around the northerly directions (when the values jump from 0 to 359 ). But that's working as well now.

I planned to go sailing this weekend to test the DES in live conditions, but the weather forecast is really bad ... so I'm not sure if this is gonna happen this weekend.

Question:
Can someone explain to me, why everyone is using "speed through water" (from the "paddlewheel") instead of SOG for the True Wind calculations ?
Isn't everyone mixing up things (coordinate systems) ?
Simple example :
If you sail 5 knots (on the paddlewheel), with a 5 knot current against you, the boat does not move at all (SOG = 0) compared to the geografical position. But the calc is done with 5 knots of (paddlewheel-)boatspeed. Assuming we have a real, live TWA = 90 from port or starboard, the calculated (paddlewheel-) TWA will point
to somewhat 45...

Cheers,

Thomas

PS: I started writing a short manual of tactics_pi ...
__________________

__________________
tom_BigSpeedy is offline   Reply With Quote
Old 21-04-2016, 02:25   #47
Sponsoring Vendor
 
Neptune's Gear's Avatar

Community Sponsor

Join Date: Oct 2012
Location: Gulf Harbour, New Zealand
Boat: Farr Phase 4, 12.8m
Posts: 992
Re: Tack and Laylines Plugin - Beta?

Great stuff guys! Is it possible to get a copy to have a play with??

Thx
Matt
__________________
Matt Paulin
Neptunes Gear Ltd
www.neptunes-gear.com
Neptune's Gear is offline   Reply With Quote
Old 21-04-2016, 03:41   #48
Registered User

Join Date: Dec 2011
Boat: MC-Tec, Akilaria 950
Posts: 233
Re: Tack and Laylines Plugin - Beta?

Quote:
Originally Posted by Neptune's Gear View Post
Is it possible to get a copy to have a play with??

Thx
Matt
Matt,

as soon as I finished the (short) manual.
It'll make my life easier (and yours as well), as I don't have enough time to follow all posts in the forum (and answer questions) on a regular basis.
Normally I'm leaving the house at 6:30 am for work and I generally return at around 7:30 - 8 pm. And I don't have access to the forum at work...

I worked and compiled under Win7 / VC2013 only, and did not test it under Linuces yet (as it is basically a copy of dashboard, it should work though..). But it's running nicely with the last stable version of O (4.2 )

Thomas
__________________
tom_BigSpeedy is offline   Reply With Quote
Old 21-04-2016, 03:45   #49
Sponsoring Vendor
 
Neptune's Gear's Avatar

Community Sponsor

Join Date: Oct 2012
Location: Gulf Harbour, New Zealand
Boat: Farr Phase 4, 12.8m
Posts: 992
Re: Tack and Laylines Plugin - Beta?

All good Thomas, thanks for your work. I look forward to it! :-)
__________________
Matt Paulin
Neptunes Gear Ltd
www.neptunes-gear.com
Neptune's Gear is offline   Reply With Quote
Old 22-04-2016, 11:56   #50
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 9,421
Re: Tack and Laylines Plugin - Beta?

tom_BigSpeedy,
I think Matt (Neptune's Gear), Paul and certainly I are all looking forward to you plugin. If there is anything we can do to help, please let us know.

For a start, I think we should all try to get our instruments calibrated as accurately as possible, so that when Thomas releases we will be ready. Ockham's old webpage used to have some excellent instructions on calibrating instruments, but I find this tool now on their website DeWiggler - Ockam Sailing Instruments
and below that are testing boatspeed and wind instruments.

re: Dampening, I recall Paul writing in more detail in this forum about what the dampening functions he used for NavMonPC, and what seemed to work. Perhaps Paul can reiterate, as I have not found it yet. Paul?

I like the link to the kalman first order dampening article as it simplifies things. There are certainly many variables with the need for dampening, I can certainly understand that this first sailing console instrument will be an approximation.

We all look forward to using it.
__________________
rgleason is offline   Reply With Quote
Old 23-04-2016, 08:06   #51
Registered User

Join Date: Jul 2015
Posts: 22
Re: Tack and Laylines Plugin - Beta?

Quote:
Originally Posted by tom_BigSpeedy View Post
Rick,

nice links ...
The formulas I used for TWS, TWD are basically the same. For the surface current, I'm using the same triangle calculation idea, but I made my life easy with triangle calculation by using 2 available subroutines
DistanceBearingMercator_Plugin & PositionBearingDistanceMercator_Plugin:
On the first one you give it 2 positions with lattitude/longitude (4 parameters), and it returns bearing and distance between the 2 points.
The second routine is the other way round, you input lat/lon + bearing + distance, and it spits out the destination lat/lon.
If you think in vectors / triangle calculation, you can simply see distance & bearing as speed & direction ...

Actually I did the same manual triangle calculation last year for testing but found no real difference in results, so I stuck to the above mentioned 2 routines.

The formula used to calculate leeway out of heel (first link)
leeway = K * heel / (meas_boat_speed * meas_boat_speed);
is the same I'm using, and if you look closely to the preferences screenshot in my post above, "Boat's Leeway factor [0-20]" is K in the formula. I think everyone uses this formula, I found it in my NKE instrument manuals ...
Looking at the code in the first link, the guys are limiting leeway hard coded to 45, on my code it's adjustable (see "fixed/max Leeway []" )

I did not yet include the heel compensation into the (also available) true wind calculation, although it makes absolutely sense and is easy enough. I'll add it if heel is available on the bus.

But what is missing on all those examples is the damping of the input values to get a somehow stable and reliable output reading.
If you look at this screenshot which I found on NKEs homepage
you can see what I'm talking about :
Attachment 122935

Especially the calculation of the surface current depends on a lot of input variables : position, cog, true heading, leeway, speed through water, sog, and leeway is calculated from heel and the K input. And any of these input values has to be seen as "error prone". On position/cog/sog we possibly can't do too much but still we have to rely on what the GPS gives us.

So Paul is absolutely right, it is crucial to set set up and tune your instruments right.

Anyway, in the end the result is quite noisy and needs to be filtered.
On the surface current, I experimented with Kalman filters, but found it too complicated also in terms of "availabe equipment and sensor accuracy on the various boats where O may be used". Finally the Kalman filtered results were not that much better than using a simple "exponential smoothing" filter, although there's a bit of a time lag (which I personally see not crucial for surface current).
I found another nice article on the net, which suggests "double exponential smoothing" (DES) as a replacement for kalman filters:
http://www.eecs.ucf.edu/isuelab/publ...al_laviola.pdf

The interesting thing on this article is, that they removed one of the 2 damping factors (alpha, beta) of DES by mathematical transformations.
So there's only alpha left over, which makes it easy to replace the single exp. smoothing by DES.
This is what I currently implemented, and from what I see from my VDR file testing it's working quite OK.

I'm in the comfortable situation that my NKE instruments are calculating current speed and direction (although I cannot export both via NMEA), so I have a really nice comparison to my own calculations in O, while I'm on my boat.

Oh yes, and another thing : filtering/damping a 0-359 output cost me quite some grief to get this working around the northerly directions (when the values jump from 0 to 359 ). But that's working as well now.

I planned to go sailing this weekend to test the DES in live conditions, but the weather forecast is really bad ... so I'm not sure if this is gonna happen this weekend.

Question:
Can someone explain to me, why everyone is using "speed through water" (from the "paddlewheel") instead of SOG for the True Wind calculations ?
Isn't everyone mixing up things (coordinate systems) ?
Simple example :
If you sail 5 knots (on the paddlewheel), with a 5 knot current against you, the boat does not move at all (SOG = 0) compared to the geografical position. But the calc is done with 5 knots of (paddlewheel-)boatspeed. Assuming we have a real, live TWA = 90 from port or starboard, the calculated (paddlewheel-) TWA will point
to somewhat 45...

Cheers,

Thomas

PS: I started writing a short manual of tactics_pi ...
Regarding the 0.-359 problem, would it make sense to filter x and y separately? This way all calculus would remain continuous and defined within, e.g., -1 and +1. I have to admit that I've not thought about the possible other issues when using the Cartesian coordinate system.
__________________
citlab is offline   Reply With Quote
Old 23-04-2016, 08:29   #52
Registered User

Join Date: Dec 2011
Boat: MC-Tec, Akilaria 950
Posts: 233
Re: Tack and Laylines Plugin - Beta?

Quote:
Originally Posted by citlab View Post
Regarding the 0.-359 problem, would it make sense to filter x and y separately? This way all calculus would remain continuous and defined within, e.g., -1 and +1.
Hi citlab,

yes, that's how I did it in the end ...
The easiest way to get around the 0-359 jumping problem is to use "atan2 (sin(angle)/cos(angle))"
I run 2 filters in parallel for sin(angle) and cos(angle) before combining the filtered results to the output angle with atan2.

Works smoothely. and the output seems to be OK, at least it shows pretty much the same current data as the calculation in my NKE instruments ...

Thomas
__________________
tom_BigSpeedy is offline   Reply With Quote
Old 18-05-2016, 00:48   #53
Registered User

Join Date: Feb 2012
Location: Austria
Posts: 111
Re: Tack and Laylines Plugin - Beta?

had asked this question already in another thread but was pointed to this one.
will it be possible to show
%boatspeed to polar
%vmc to polar

in offshore racing this are most meaningful values to monitor

thanks for attention


Sent from my iPad using Cruisers Sailing Forum
__________________
skipperearly is offline   Reply With Quote
Old 18-05-2016, 11:54   #54
Registered User

Join Date: Dec 2011
Boat: MC-Tec, Akilaria 950
Posts: 233
Re: Tack and Laylines Plugin - Beta?

Quote:
Originally Posted by skipperearly View Post
had asked this question already in another thread but was pointed to this one.
will it be possible to show
%boatspeed to polar
%vmc to polar

in offshore racing this are most meaningful values to monitor

thanks for attention


Sent from my iPad using Cruisers Sailing Forum
Yes,
the % value is always the actual boat speed compared to the theoretical speed from the polar. This will be available for
VMC = also known as CMG, optimum speed towards a mark
VMG = optimum speed up- or downwind, without a mark
"polarspeed" = compares your current boat speed the the polar speed, based on the momentary TWA/TWS.

Thomas
__________________
tom_BigSpeedy is offline   Reply With Quote
Old 19-05-2016, 01:19   #55
Registered User

Join Date: Feb 2012
Location: Austria
Posts: 111
Re: Tack and Laylines Plugin - Beta?

great ! thanks for reply.
when can we expect a version for testing and where to dowload?

keep up the good work.


Sent from my iPad using Cruisers Sailing Forum
__________________
skipperearly is offline   Reply With Quote
Old 19-05-2016, 08:35   #56
Registered User

Join Date: Apr 2012
Location: Port Vila, Vanuatu
Boat: Van der Stadt Samoa 48
Posts: 128
Re: Tack and Laylines Plugin - Beta?

It is a very nice plugin. I would as a cruising sailor like it also to work for downwind sailing. We are most of the time sailing down wind, and the planning when and where is important
__________________
Taarnskov is offline   Reply With Quote
Old 20-05-2016, 20:41   #57
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 9,421
Re: Tack and Laylines Plugin - Beta?

It does downwind too, VMGdownwind, and polarspeed downwind, etc.
__________________

__________________
rgleason is offline   Reply With Quote
Reply

Tags
plug

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sail by lee and starport tack whoiswct Rules of the Road, Regulations & Red Tape 20 14-10-2014 12:54
OpenCPN to Android plugin - Beta tester required ! kobold27 Commercial Posts 10 17-04-2013 17:48
Bug: Grib plugin fails to load on beta Version 3.1.1319 Build 2013-01-19 AlainT OpenCPN 5 01-02-2013 04:09
400: Starboard Tack and Autopilot Fuse Life Aquatic Lagoon Catamarans 0 07-09-2011 12:49
Hard Tack and Swill smithy Provisioning: Food & Drink 15 31-07-2011 06:04



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 14:18.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.