Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 14-04-2012, 08:05   #1
Registered User

Join Date: Dec 2008
Boat: Journeyman
Posts: 705
Feature suggestion: Geomagnetic Declination Calculator

I am about to sail from Rio de Janeiro to Punta del Este. A trip which, I just realized, will see magnetic declination changing by several degrees each day, from about -22 to -6 in 6 days of sailing...

So I thought, why not make OpenCPN tell me the declination at my position, so I know what declination to enter into my instrumentation configuration?

I have created an implementation of this feature. It takes the current cursor position and computes the current magnetic declination and displays it like this:



The calculations are based on the IGRF11 model, and are fairly accurate, but do not take local variations due to geological conditions etc into account, of course. Still a lot better than nothing...

The code is in Flyspray, FS#770

I hope you like it!
__________________

__________________
JesperWe is offline   Reply With Quote
Old 14-04-2012, 09:18   #2
Registered User

Join Date: Dec 2005
Location: WNA
Boat: Dufour 35
Posts: 3,247
Re: Feature suggestion: Geomagnetic Declination Calculator

JesperWe

Are you aware of the WMM plugin? PlugIns | Official OpenCPN Homepage

Thomas
__________________

__________________
cagney is offline   Reply With Quote
Old 14-04-2012, 13:41   #3
Registered User

Join Date: Dec 2008
Boat: Journeyman
Posts: 705
Re: Feature suggestion: Geomagnetic Declination Calculator

Quote:
Originally Posted by cagney View Post
Are you aware of the WMM plugin?
Bwa ha ha!! No I wasn't :-D

I'll just go back to hiding under a rock then....
(Serves me right for sailing too much and not surfing/researching enough...)

Except I guess I needed some project to get my coding environment up anyway, so nothing lost...
__________________
JesperWe is offline   Reply With Quote
Old 14-04-2012, 14:58   #4
mrm
Registered User

Join Date: Feb 2011
Location: Poland, EU
Boat: crew on Bavaria 38 Cruiser
Posts: 651
Re: Feature suggestion: Geomagnetic Declination Calculator

Jesper, if after discovering the WMM plugin you want to continue coding your version, I have a suggestion for a user interface for such a plugin I would _love_ to see.

Right now your plugin displays a message box with magnetic deviation value and a lot of other text which in this context may be considered redundant/unnecessary clutter. Besides, at the moment your user interface requires two clicks, one to call up the message box and one to make it go away. Maybe it is not a lot of work, but why not do away with it completely and have this information available instantly without cluttering the display? My proposal:

- when plugin is active, it replaces its icon on a taskbar with an icon displaying an actual magnetic deviation value in a current location and continues working in the background. On a defined time intervals icon is updated with a new deviation value for a then current location. Say - every five minutes? This assumes a plugin API allows notifying the core about plugin icon bitmap update.

- since plugin is now running in the background another feature is possible, it may periodically output a NMEA sentence with a calculated deviation to NMEA output port, for use by other attached hardware.

Just an idea for consideration..

Marius
__________________
mrm is offline   Reply With Quote
Old 14-04-2012, 14:59   #5
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,016
Re: Feature suggestion: Geomagnetic Declination Calculator

Jesper...
I (unsuccessfully ) try to prevent this and keep an incomplete and unordered list of stuff I already did, am working on or would like to try to work on at some point - those crossed items are done , those with the links to source sure can use contributions and those without are totally free to take by anybody who likes to implement them...

Very nice boat, BTW

Pavel
__________________
nohal is offline   Reply With Quote
Old 14-04-2012, 16:14   #6
Registered User

Join Date: Dec 2008
Boat: Journeyman
Posts: 705
Re: Feature suggestion: Geomagnetic Declination Calculator

@mrm:

Two issues with this:

In your scenario you say "a location"... The question is which location ;-) My first implementation had the declination permanently on screen, but in the status bar. I realized this was bad, because I displayed the decl at the current boat location, so I couldn't get decl from any other place. So I changed to a menu pick, to be able to get decl at any location I wanted. Pavels PI displays boat and cursor both, which kind of solves this by adding too much information...

Dynamic display of decl at the cursor position is also a waste of CPU anyway, since you typically require this info quite seldom.

Second issue is the PI API does not provide a way to update the tool icon. To get your desired result I would have to RemoveTool and AddTool again, which would be a very flickery and ugly operation.

Soo.... I think I just throw my code away and go off to do something more useful ;-D
__________________
JesperWe is offline   Reply With Quote
Old 15-04-2012, 04:56   #7
mrm
Registered User

Join Date: Feb 2011
Location: Poland, EU
Boat: crew on Bavaria 38 Cruiser
Posts: 651
Re: Feature suggestion: Geomagnetic Declination Calculator

Quote:
Originally Posted by JesperWe View Post
@mrm:
In your scenario you say "a location"... The question is which location ;-)
Yes, I defaulted to the current ship's location. I couldn't think of any scenario (except curiosity) which would require knowing the declination in a location different from that (and in the curiosity case I would probably just use the 'move ship' option).

Quote:
Dynamic display of decl at the cursor position is also a waste of CPU anyway, since you typically require this info quite seldom.
Yes and no. If you consider sending this information to other NMEA listeners, running this calculation periodically starts to make sense imho.

Quote:
Second issue is the PI API does not provide a way to update the tool icon.
I'll go and bug thee Developers for this feature in a more appropriate place then :-)

And yes, you have a fantastic boat...
__________________
mrm is offline   Reply With Quote
Old 15-04-2012, 20:12   #8
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,877
Re: Feature suggestion: Geomagnetic Declination Calculator

JesperWe...

I'll look into dynamic toolbar button update by PlugIn. Should not be too tough, and could be useful in many ways.

Thanks for the code....

Dave
__________________

__________________
bdbcat is offline   Reply With Quote
Reply

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




Copyright 2002- Social Knowledge, LLC All Rights Reserved.

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


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.