Deviation
Typical Deviation Table for a Magnetic Compass
Goals
(Coefficients are not mentioned only because I am not knowledgeable enough to clearly describe them. However, including coefficients appears to be a good idea, as you have already done.)
Provide Compass Course (CC) calculated from True-Variation-Magnetic-Deviation-Compass (TVMDC) values. Provide for entry of a Deviation Table. Since OpenCPN 'knows' True and Variation (from WMM plugin), with Deviation we can have the Compass course to steer. Possibly integrate some of the functionality into OpenCPN core with WMM_pi.
While working on a new Compass Deviation plugin, What there is now:
-
Possible to use multiple compasses on multiple ships
-
Make your one Deviation Table by taking Compass Bearings. (Als sun’s azimuth possible)
-
TO DO but on my list is re-sending a nmea headg (HDG) sentence including True North Course.
-
Production of a Table of Coefficient
-
Show additional curves for each bearing with an offset of +-1 degree error
-
Print the Deviation Table.
-
For Dead Reckoning Mode (no GPS available) a Compass Course (CC) is needed in OpenCPN.
-
Possible separation of developing a deviation table(s) plugin from automating the creation of deviation tables (swinging a compass). A plugin that provides a compass course from known deviation tables would be immediately useful and it simplifies the development process and will become available sooner perhaps.
A cellphone does have a fluxgate sensor just as most electronic compasses on board. And most fluxgate sensors are nowadays 3D that means they are actually three sensors (for x,y and z directions). A fluxgate is a way to measure magnetic field strength. For a compass we can forget about the z direction.
If we have a compass on board our ship, the reading is likely to be influenced by the ships own magnetic field. Think of this ships magnetic field as being a magnetic of some strength and in some direction. What an electronic compass does if the auto compensate feature is 'on', while steaming in a circle, measure the strength of the magnetic field. The field that is measured is the combination of earth and ships field. It is clear that if ships field and earth field are working in the same direction, the resulting total field will be high. Also if working in opposite direction the result will be low. Then the Compass computer starts calculating and makes an internal Correction Table based on the high and low course and a sinewave like correction between them. From then on it takes the compass readings, adds the Correction and outputs the Corrected Compass Course.
This works rather well for a lot of circumstances. But it could be that the ships magnetic field is equal or even stronger then the earth field. Then it is not possible to calulate a correction table. (your compass will warn you to find another place for the sensor). And especially on steel ships there is something like 'induced magnetic'. This is if the earth magnetic field 'sea’s' a iron bar then, as the iron bar is a better magnetic conductor then air, the earth field will run trough the bar. Unfortunately we have now a bar with on one side magnetic field 'lines' going in and the other side coming out. ** that IS a magnet. Only a magnet not constant and even changing N/S poles on different courses.
Self Compensating Fluxgate compasses can’t correct for these induced fields. Then there is still the Z direction. As long the vessel is upright this won’t do anything to the compass reading. If sailing however it will cause a heeling error. And again an auto compensate can’t fix this.
If you 'Compensate' (with magnets) a compass, or only make a 'Deviation Table', you need the true ships course (some way or another) and compare this with the compass reading.
-
The modern way is bring your own GPS compass, but a gyro will also do. Most of us won’t have either of them, so we need something else.
-
A very good and accurate one is the sun (if you have a correct time). A good compass will have a shadow pin to make it easy to take a sun bearing. But a thin line with a small weight could also throw a nice shadow line over the compass rose. A leading line (lights) is also a good true course if you steam right into it.
-
What I often use is OpenCPN. Make a route to a point some distance away. Make a heading straight to that point and compare the compass course with the true course.
In my Plugin (in progress) all three could be used and the PI will take care of the calculation and drawing of the deviation table. Dirk
Thanks for the specs. We are more or less on one line. As a point from your doc it will make it easier to add from an existing deviation table.
Calculations
About your remarks about curve fitting and sine wave, the deviation is always a result of the formula
Dev=A + B.sin(CC) + C.cos(CC) + D.sin(2.CC) + E.cos(2.CC).
Where CC is Compass Course and A to E constant values.
I do curve fitting following above formula and calculate the A..E values. In the preview the Curve including original points are visible, so you can see how accurate your input is/was.
Future OpenCPN Core Code?
Having the compass course in the route steering popup window is in the core code, and can’t be changed from the plugin. But maybe in the future it is possible to merge with the variation plugin. Then it would be a standard addon for OpenCPN and the core code setting for magnetic-readings could be changed in compass-readings.
Documentation
First Menu, Enter Ship and Compass Name
Enter Compass Bearing and True Bearing
Calculation of Deviation Table and Graph
User Guide
3. Standard actions
What are basic (standard) actions you have to do to make the pi work Example: “how to set up a Watchdog Alarm”.
4. Options
What options are there after performing the standard actions Examples: 1. Choice for a specific type of Watchdog Alarm (anchor, boundary, speed, course, deadman, NMEA etc.) 2. Choice for a specific type of alarm-signal (pop-up message, sound, command) 3. Setting various parameters (range in meters, degrees, time in seconds or minutes, speed etc.)
5. FAQ
Will this plugin help determine the deviation, or is it just for making the corrections? Will the compass indications include deviation with the assumption we are using a magnetic compass rather than a GPS compass?:: * The plan is both. For a regular compass it will help to make a deviation table on paper. (in theory taking as less as 5 bearings should be enough) And for an electronic (nmea) compass it can, in cooperation with the variation PI, correct the magnetic course up to a true course. * Mind you, an electronic compass with auto compensation doesn’t mean that the deviation is zero. It has, just as an ordinary compass has, a remaining deviation after compensation. * Need to be a little careful here or one could get a false sense of accuracy. Only 5 compass errors will not allow a deviation table to be made. We need the vessel to be heading on all the cardinal points, North, South, East and West. And also the inter-cardinals, NE, SE, SW, NW, as a minimum, taking the deviation on each heading. Recording the deviation on courses within about 5 degrees of each of those headings will not affect the result too much. So perhaps build up the information but not allow the table to be made until the minimum number of readings have been taken. * A useful addition could be the production of a Table of Coefficients. If you see an 'A' coefficient this would indicate a lubber line not aligned with the fore and aft line of the boat. * Agreed, 5 is the theoretic mathematical minimum., but for praxis the more the better and at least in every quadrant. I do show the coefficients. (see last picture) I believe it is a good idea to show additional curves for each bearing with an offset of +-1 degree error. That should give a nice idea of the accuracy of the result.
Wouldn’t a cellphone be useful to calibrate a compass? Their Compass often requires calibration by twisting in 3 directions?:: * A cellphone will be of no help. Compass deviation is caused by the vessels own magnetism. * By compensating you try to add a few magnets that will be just as strong but in opposite direction then the ships magnetism. The ships magnetism influence will be different for each place onboard. This means if you have a movable compass you cant compensate it.
What I try to do is allow to take bearings to a known point (is known bearing), and so find the misreading of the compass. The misreading is
deviation + variation * For a known bearing you could choose from a leading line(lights), a fixed point or a bearing of the sun. * George Winthur our compass adjuster uses an electric gyroscope to adjust our Ritche magnetic compass by comparisons. He got it close enough to call it zero deviation but we’ve removed an alu housing for old radar around the pedestal so it must be checked. * Furthermore, while deviation can be reduced by 'correction' as Rooiedirk describes, it cannot be completed eliminated. Maybe it can be -0- on one or a few headings, but there will be some residual deviation on other headings. Thus a deviation table for each compass that is used for navigation or piloting is required. Being careful with stowage can help reduce deviation and random changes in deviation, e.g. don’t stow tinned foods near the fluxgate compass.
6. Resources & Sources
For more detail here download the Handbook of Magnetic Compass Adjustment here