Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 01-04-2013, 17:46   #16
Marine Service Provider

Join Date: Oct 2009
Location: In the U.S.
Boat: FP Tobago 35 [sold]
Posts: 402
Re: O 3.2 and DSC

Quote:
Originally Posted by colemj View Post
You should have paid closer attention to the Standard Horizon installation instructions where they caution against mounting the unit upside down. Since you are now upside down, turn it over and see if that works.

(and check the date...)

Mark
Nope, turned the GX2100 over and still same issue.

Guess I should report it to SH at some point as well once I know the issue, but not likely they can fix it for me anyway....
__________________

__________________
Mark (It's Irie - Sailing Blog)
The Wirie AP+ and The Wirie pro - Long Range Marine WiFi and 2/3/4G Systems
kiltym is offline   Reply With Quote
Old 02-04-2013, 09:36   #17
Marine Service Provider

Join Date: Oct 2009
Location: In the U.S.
Boat: FP Tobago 35 [sold]
Posts: 402
Re: O 3.2 and DSC

So, I have another theory with this issue.

It may in fact still be OpenCPN.

Has anyone tested sending a DSC message with a lat=0 to OpenCPN and seeing the result?

I have not been able to find the sentence definitions for DSC and DSE anywhere online, does something have them? If so, can you post the definition?

Either the VHF is sending out an incorrect sentence, or OpenCPN is misinterpreting a DSC message with a Lat=0.

Cagney, can you create a dummy message at Lat 0 to test? If so, can we "reverse" engineer the DSC/DSE messages I posted so we can be sure where the problem is?
__________________

__________________
Mark (It's Irie - Sailing Blog)
The Wirie AP+ and The Wirie pro - Long Range Marine WiFi and 2/3/4G Systems
kiltym is offline   Reply With Quote
Old 02-04-2013, 12:11   #18
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 2,758
Re: O 3.2 and DSC

It will get a bit lengthy,

so here the pieces:
- descrption of the problem
- the definition of the DSC/DSE sentences
- the parser (part of it from ais.cpp) within OpenCPN with comments
The comments are taking the DSC/DSE data from the screenshot

Did not find any problem with the code but perhaps somebody who is more used to C++ might have a look as well
================================================== =====
The problem:

"..................
The issue is I think, I am at 00 latitude, but it is just a guess.

Can anyone simulate this to OpenCPN with my LatLong below to make sure its not an issue with OpenCPN, but I suspect it is not.
As in, create the correct DSC and DSE sentences for the position below, feed it to OpenCPN, and confirm it is OK?

Current position from the Pos report I sent, as displayed on the GX2100:
00 53.699S
089 36.782W

Target info on OpenCPN:
500 53.6997N
089 38.7824E.......................................... ....
/================================================== ================================================== ==
Here the description of the format of the DSC/DSE sentences including an example:

I send my position or my position is requested. The position my radio sends is 33.51.479 by 118.02.035, if you look at the DSC sentence below,
*you will see the code of only 3351, for LAT and 11802 for long. Then if you look at the DSE sentence, you will see only the seconds,
first the LAT 4790 and then LONG 0350.

DSC SENTENCE:

$CDDSC,20,3664251410,00,21,26,1335111802,0004,,,B, E*72

************MMSI^*************LAT^ LONG^

DSE SENTENCE:

$CDDSE,1,1,A,3664251410,00,47900350*1C

**************MMSI^*********LAT^ LONG^
/================================================== ================================================== =

/ And now the parser for the messages in ais.cpp:

if( str.Mid( 1, 2 ).IsSameAs( _T("CD") ) ) {
// parse a DSC Position message $CDDSx,.....
// Use a tokenizer to pull out the first 9 fields
wxString string( str );
wxStringTokenizer tkz( string, _T(",*") );

wxString token;
token = tkz.GetNextToken(); // !$CDDS

if( str.Mid( 3, 3 ).IsSameAs( _T("DSC") ) ) {
token = tkz.GetNextToken(); // format specifier (02-area,12-distress,16-allships,20-individual,...)
token.ToLong( &dsc_fmt );

token = tkz.GetNextToken(); // address i.e. mmsi*10 for received msg, or area spec
token.ToDouble( &dsc_addr );
dsc_mmsi = 0 - (int) ( dsc_addr / 10 ); // as per NMEA 0183 3.01

token = tkz.GetNextToken(); // category
token = tkz.GetNextToken(); // nature of distress or telecommand1
token = tkz.GetNextToken(); // comm type or telecommand2

token = tkz.GetNextToken(); // position or channel/freq
token.ToDouble( &dsc_tmp );

token = tkz.GetNextToken(); // time or tel. no.
token = tkz.GetNextToken(); // mmsi of ship in distress
token = tkz.GetNextToken(); // nature of distress
token = tkz.GetNextToken(); // acknowledgement
token = tkz.GetNextToken(); // expansion indicator

// Format position: Quadrant_lat_lon no seconds Q_llll_LLLLL: 3_0053_08936
//DSC does not contain seconds, these are transmitted in the DSE message
dsc_quadrant = (int) dsc_tmp / 1000000000.0; //first digit quadrant 3

dsc_lat = (int) ( dsc_tmp / 100000.0 ); //lat_raw 5 digits incl. quadrant: 30053
dsc_lon = dsc_tmp - dsc_lat * 100000.0; //lon resting lat_raw*100000: 8936
dsc_lat = dsc_lat - dsc_quadrant * 10000; //getting rid of Quadrant: 53
dsc_degs = (int) ( dsc_lat / 100.0 ); //stripping last 2 digits =Degrees Lat: 0
dsc_mins = dsc_lat - dsc_degs * 100.0; //getting Minutes: 53
dsc_lat = dsc_degs + dsc_mins / 60.0; //lat in degs.min

dsc_degs = (int) ( dsc_lon / 100.0 ); //stripping last two digits = DegreesLon: 89
dsc_mins = dsc_lon - dsc_degs * 100.0; //getting minutes: 36
dsc_lon = dsc_degs + dsc_mins / 60.0; //Lon in degs.min
switch( dsc_quadrant ) {
case 0: break; // NE
case 1: dsc_lon = -dsc_lon; break; // NW
case 2: dsc_lat = -dsc_lat; break; // SE
case 3: dsc_lon = -dsc_lon; dsc_lat = -dsc_lat; break; // SW our case 00S, 089W
default: break;
}
if( dsc_fmt != 02 ) mmsi = (int) dsc_mmsi;
// the DSE part
} else if( str.Mid( 3, 3 ).IsSameAs( _T("DSE") ) ) {

token = tkz.GetNextToken(); // total number of sentences
token = tkz.GetNextToken(); // sentence number
token = tkz.GetNextToken(); // query/rely flag
token = tkz.GetNextToken(); // vessel MMSI
token.ToDouble( &dse_addr );
dse_mmsi = 0 - (int) ( dse_addr / 10 ); // as per NMEA 0183 3.01

token = tkz.GetNextToken(); // code field
token = tkz.GetNextToken(); // data field - position - 2*4 digits latlon .mins
// in DSE the seconds are sent as llllLLLL seconds, or four digits of fraction of minutes: 72147670
// in our case: 72147670 or .7214 minlat .7670 minLon

token.ToDouble( &dse_tmp );
dse_lat = (int) ( dse_tmp / 10000.0 ); // getting lat
dse_lon = (int) ( dse_tmp - dse_lat * 10000.0 ); // getting lon
dse_lat = dse_lat / 600000.0; // in fractions of degrees
dse_lon = dse_lon / 600000.0;

mmsi = (int) dse_mmsi;
}
}
//================================================== ================================================== ===============
//Here the DSE values are merged with the DSC lat/Lon:

bool bdecode_result = false; // for CDDSE assume target is there
if( dse_mmsi ) bdecode_result = true;

if( dse_mmsi && !pTargetData->b_nameValid && pTargetData->b_positionOnceValid
&& ( ( now.GetTicks() - pTargetData->PositionReportTicks ) ) < 20 ) { // ignore stray CDDSE sentences
pTargetData->Lat = pTargetData->Lat
+ ( ( pTargetData->Lat ) >= 0 ? dse_lat : -dse_lat ); // if DSC lat>= 0 then add DSE lat (= the seconds) else subtract
pTargetData->Lon = pTargetData->Lon
+ ( ( pTargetData->Lon ) >= 0 ? dse_lon : -dse_lon ); // same with Lon
pTargetData->b_nameValid = true;
__________________
bcn is online now   Reply With Quote
Old 02-04-2013, 12:58   #19
Marine Service Provider

Join Date: Oct 2009
Location: In the U.S.
Boat: FP Tobago 35 [sold]
Posts: 402
Re: O 3.2 and DSC

Thanks, from my quick look it looks OK to me too.

Someone probably needs to step through the code in a debugger and confirm all the results are correct (as your comments show).

Seems something is wrong in there (or it would work as the NMEA sentence seems OK), but not overly apparent.

For reference, these are the sentences being stepped through in the comments above:
$CDDSC,20,3380673250,00,21,26,3005308936,2200,,,S, E*60
$CDDSE,1,1,A,3380673250,00,71537721*1A
__________________
Mark (It's Irie - Sailing Blog)
The Wirie AP+ and The Wirie pro - Long Range Marine WiFi and 2/3/4G Systems
kiltym is offline   Reply With Quote
Old 02-04-2013, 13:15   #20
Registered User

Join Date: Apr 2009
Location: Marina Del Rey
Boat: Hylas 44
Posts: 387
Re: O 3.2 and DSC

Mark..

When your vdr file runs I see no DSC targets with the existing code. I ran the debugger and found 2 fixes.

Here is the result.

So the problem is with OpenCPN.
Attached Thumbnails
Click image for larger version

Name:	dscvdrcap.JPG
Views:	62
Size:	121.5 KB
ID:	58466  
__________________
ChuckSK is offline   Reply With Quote
Old 02-04-2013, 13:21   #21
Registered User

Join Date: Apr 2009
Location: Marina Del Rey
Boat: Hylas 44
Posts: 387
Re: O 3.2 and DSC

There is still another problem. The DSE portion of the position is not being added in. I will keep looking.
__________________
ChuckSK is offline   Reply With Quote
Old 02-04-2013, 13:28   #22
Registered User

Join Date: Apr 2009
Location: Marina Del Rey
Boat: Hylas 44
Posts: 387
Re: O 3.2 and DSC

OK, there were 3 fixes.
Attached Thumbnails
Click image for larger version

Name:	dscvdrcap2.JPG
Views:	66
Size:	121.2 KB
ID:	58467  
__________________
ChuckSK is offline   Reply With Quote
Old 02-04-2013, 13:36   #23
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,883
Re: O 3.2 and DSC

Chuck....

Thanks for the debug effort.
So, the world wonders, "What are the 3 fixes?"

Maybe they could go into Flyspray Bug against the 3.2.0 Release, so they will be captured fairly and make it into the next version.

Thanks
Dave
__________________
bdbcat is offline   Reply With Quote
Old 02-04-2013, 13:58   #24
Registered User

Join Date: Apr 2009
Location: Marina Del Rey
Boat: Hylas 44
Posts: 387
Re: O 3.2 and DSC

Quote:
Originally Posted by bdbcat View Post
Chuck....

Thanks for the debug effort.
So, the world wonders, "What are the 3 fixes?"

Maybe they could go into Flyspray Bug against the 3.2.0 Release, so they will be captured fairly and make it into the next version.

Thanks
Dave
Code:
iff --git a/src/ais.cpp b/src/ais.cpp
index 8465961..d60059f 100644
--- a/src/ais.cpp
+++ b/src/ais.cpp
@@ -1474,7 +1474,7 @@ AIS_Error AIS_Decoder::Decode( const wxString& str )
 
             token = tkz.GetNextToken();       // address i.e. mmsi*10 for received msg, or area spec
             token.ToDouble( &dsc_addr );
-            dsc_mmsi = 0 - (int) ( dsc_addr / 10 ); // as per NMEA 0183 3.01
+            dsc_mmsi = (int) ( dsc_addr / 10 ); // as per NMEA 0183 3.01
 
             token = tkz.GetNextToken();         // category
             token = tkz.GetNextToken();         // nature of distress or telecommand1
@@ -1489,7 +1489,7 @@ AIS_Error AIS_Decoder::Decode( const wxString& str )
             token = tkz.GetNextToken();         // acknowledgement
             token = tkz.GetNextToken();         // expansion indicator
 
-            dsc_quadrant = (int) dsc_tmp / 1000000000.0;
+            dsc_quadrant = (int) (dsc_tmp / 1000000000.0);
 
             dsc_lat = (int) ( dsc_tmp / 100000.0 );
             dsc_lon = dsc_tmp - dsc_lat * 100000.0;
@@ -1516,7 +1516,7 @@ AIS_Error AIS_Decoder::Decode( const wxString& str )
             token = tkz.GetNextToken();         // query/rely flag
             token = tkz.GetNextToken();         // vessel MMSI
             token.ToDouble( &dse_addr );
-            dse_mmsi = 0 - (int) ( dse_addr / 10 ); // as per NMEA 0183 3.01
+            dse_mmsi = (int) ( dse_addr / 10 ); // as per NMEA 0183 3.01
 
             token = tkz.GetNextToken();         // code field
             token = tkz.GetNextToken();         // data field - position - 2*4 digits latlon .mins
__________________
ChuckSK is offline   Reply With Quote
Old 02-04-2013, 15:38   #25
Registered User

Join Date: Dec 2005
Location: WNA
Boat: Dufour 35
Posts: 3,247
Re: O 3.2 and DSC

ChuckSK's fix works!

Run this file in the VDR to compare before and after.
dsc3.txt.pdf

Look how the SW quadrant is treated

Thomas
__________________
cagney is offline   Reply With Quote
Old 02-04-2013, 15:58   #26
Marine Service Provider

Join Date: Oct 2009
Location: In the U.S.
Boat: FP Tobago 35 [sold]
Posts: 402
Thats great news.

Now I can turn my radio right-side-up again .

Thanks for everyone helping to narrow this down, certainly not a common test case I suppose, but good to get it working correctly regardless.

If people need me to enter a bug report, I am happy to do so, but will assume someone else will.
__________________
Mark (It's Irie - Sailing Blog)
The Wirie AP+ and The Wirie pro - Long Range Marine WiFi and 2/3/4G Systems
kiltym is offline   Reply With Quote
Old 02-04-2013, 19:47   #27
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,016
Re: O 3.2 and DSC

Commited the fix in https://github.com/OpenCPN/OpenCPN/c...d2eb6ac8a10220

Pavel
__________________
nohal is offline   Reply With Quote
Old 03-04-2013, 13:55   #28
Registered User

Join Date: Apr 2009
Location: Marina Del Rey
Boat: Hylas 44
Posts: 387
Re: O 3.2 and DSC

Actually there is only one fix. The first and third are not needed and in fact cause a problem. The DSC messages no longer appear at the top of the AIS Target List.

Next time I will slow down.

Chuck
__________________
ChuckSK is offline   Reply With Quote
Old 04-04-2013, 12:53   #29
Marine Service Provider

Join Date: Oct 2009
Location: In the U.S.
Boat: FP Tobago 35 [sold]
Posts: 402
Re: O 3.2 and DSC

Quote:
Originally Posted by ChuckSK View Post
Actually there is only one fix. The first and third are not needed and in fact cause a problem. The DSC messages no longer appear at the top of the AIS Target List.

Next time I will slow down.

Chuck
Not to beat a dead horse, just want to close the loop on the and make sure the correct change has been submitted for the next release.....?
__________________
Mark (It's Irie - Sailing Blog)
The Wirie AP+ and The Wirie pro - Long Range Marine WiFi and 2/3/4G Systems
kiltym is offline   Reply With Quote
Old 04-04-2013, 12:58   #30
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,016
Yep, it was...
__________________

__________________
nohal 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 00:02.


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.