Cruisers Forum
 


Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 21-04-2016, 01:07   #46
Registered User

Join Date: Dec 2011
Boat: MC-Tec, Akilaria 950
Posts: 242
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:	355
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, 01:25   #47
Registered User

Join Date: Oct 2012
Location: Gulf Harbour, New Zealand
Boat: Farr Phase 4, 12.8m
Posts: 1,160
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
Neptune's Gear is offline   Reply With Quote
Old 21-04-2016, 02:41   #48
Registered User

Join Date: Dec 2011
Boat: MC-Tec, Akilaria 950
Posts: 242
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, 02:45   #49
Registered User

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

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

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,627
Images: 2
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, 07:06   #51
Registered User

Join Date: Jul 2015
Boat: GS 37 BC
Posts: 37
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, 07:29   #52
Registered User

Join Date: Dec 2011
Boat: MC-Tec, Akilaria 950
Posts: 242
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 17-05-2016, 23:48   #53
Registered User

Join Date: Feb 2012
Location: Austria
Posts: 320
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, 10:54   #54
Registered User

Join Date: Dec 2011
Boat: MC-Tec, Akilaria 950
Posts: 242
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, 00:19   #55
Registered User

Join Date: Feb 2012
Location: Austria
Posts: 320
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, 07:35   #56
Registered User

Join Date: Apr 2012
Location: Port Steven, NSW, Australia
Boat: Van der Stadt Samoa 48
Posts: 142
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, 19:41   #57
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,627
Images: 2
Re: Tack and Laylines Plugin - Beta?

It does downwind too, VMGdownwind, and polarspeed downwind, etc.
rgleason is offline   Reply With Quote
Reply

Tags
plug


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 11:54
Bug: Grib plugin fails to load on beta Version 3.1.1319 Build 2013-01-19 AlainT OpenCPN 5 01-02-2013 03:09
400: Starboard Tack and Autopilot Fuse Life Aquatic Lagoon Catamarans 0 07-09-2011 11:49
Hard Tack and Swill smithy Cooking and Provisioning: Food & Drink 15 31-07-2011 05:04

Advertise Here


All times are GMT -7. The time now is 20:01.


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

ShowCase vBulletin Plugins by Drive Thru Online, Inc.