Simulation Mode

Discussion and support for the Nmea4Wifi multiplexer - a 4-input Nmea 0183 wifi multiplexer.
Even Keel
Posts: 7
Joined: Fri Oct 18, 2019 8:28 pm

Simulation Mode

Post by Even Keel » Wed Oct 23, 2019 2:50 pm

Hi Luis,
I upgraded my brand new unit to Firmware 3.0 . Everything went good. In order to have Ocpn and others tuned for Nmea4Wifi, I´ve tried the simulation mode and I could see your boat in the Greek Island surrounding by 2 other boats, light wind by 4m depth, aso.
My point is : As you give us the nmea sentences in the zip file, I'm wondering if there is a way to have my own file to play.
I tried to change the extract file .nmea by mine (copying and renaming mine) but, obviously, it´s not the way it works ;-).
Your file is 12Ko, mine is 5816Ko (that I would cut for sure) and contains all the nmea sentences I used with the old MUX during a few hours in the Canary Islands.
Knowing absolutely nothing about what happens when you start the simulation, I suspect it´s quite difficult to change the file and process (written temporarily in EEprom during the test ?, capacity issue ?).
Do you think of a way to do it : changing the NMEA sentences used for the simulation mode.
I tried to find it on the forum but, if so, I missed it.

I've another issue with Qtvlm I cannot connect to Nmea4Wifi, but - as it works with Ocpn - I´m sure the multiplexer is not involve and I will go thru the Qtvlm process to correct my mistakes.

I will check with Android Apps later on.

Luis Sa
Site Admin
Posts: 843
Joined: Thu May 04, 2017 4:12 am

Re: Simulation Mode

Post by Luis Sa » Wed Oct 23, 2019 3:55 pm

Hello,

Thank you for your feedback. I appreciate it and, if I can, I will help you with a more complete simulation file. As I have not released to the public the source files of the software, the only way is for you to prepare a file, and then I compile it here and link it to the rest of the software. Here are some notes to do that.

First of all, yes there space for a more complete simulation. Here is the result of the compiler:

Code: Select all

Sketch uses 843502 bytes (42%) of program storage space. Maximum is 1966080 bytes.
Global variables use 73056 bytes (22%) of dynamic memory, leaving 254624 bytes for local variables. Maximum is 327680 bytes.
Apparently we can go from the 843502 bytes up to 1966080 bytes. However, I am not sure how exact is this data as I have just added some more simulation sentences and, surprisingly, the compiler gives the same storage space!

The list of simulation sentences that are used in the multiplexer are listed below. If you want to prepare a different list just change the following code and I will try to compile it. If you go ahead, send me the list by email.

Code: Select all

// start simulation mode definitions
// =================================

unsigned long timer_ais = 0;             // used by ais generation
const unsigned long inter_ais = 2000;    // ais interval in miliseconds
const int number_ais = 13;               // number of AIS sentences (minus 1)
int index_ais = 0;

char ais01[] = "!AIVDM,1,1,,A,13sSO2U000QqTdHFGhnRF1pdP50l,0*4B";
char ais02[] = "!AIVDM,1,1,,A,1=T0M4U000QqTqlFGkAdq:DFP50l,0*04";
char ais03[] = "!AIVDM,1,1,,A,13sSO2U000QqTdHFGhnRF1pfP50l,0*49";
char ais04[] = "!AIVDM,1,1,,A,1=T0M4U000QqTqlFGkAdq:DJP50l,0*08";
char ais05[] = "!AIVDM,1,1,,A,13sSO2U000QqTdHFGhnRF1phP50l,0*47";
char ais06[] = "!AIVDM,1,1,,A,1=T0M4U000QqTqlFGkAdq:DLP50l,0*0E";
char ais07[] = "!AIVDM,1,1,,A,13sSO2U000QqTdHFGhnRF1pjP50l,0*45";
char ais08[] = "!AIVDM,1,1,,A,1=T0M4U000QqTqlFGkAdq:DLP50l,0*0E";
char ais09[] = "!AIVDM,1,1,,A,13sSO2U000QqTdHFGhnRF1plP50l,0*43";
char ais10[] = "!AIVDM,1,1,,A,1=T0M4U000QqTqlFGkAdq:DNP50l,0*0C";
char ais11[] = "!AIVDM,2,1,0,A,53sSO2T2qo;0=87SS;L8D5Dl58U>22222222220T,0*1B";
char ais12[] = "!AIVDM,2,2,0,A,10413396n4Q1APEC588888888888882,2*0D";
char ais13[] = "!AIVDM,2,1,0,A,5=T0M4T2JU59UCKO;R0L4hD4v22222222222220T,0*7E";
char ais14[] = "!AIVDM,2,2,0,A,104132Vi>511APEC588888888888882,2*0D";

char * ais[] = { ais01, ais02, ais03, ais04, ais05, ais06, ais07, 
       ais08, ais09, ais10, ais11, ais12, ais13, ais14 };

// now the  NMEA 0183 sentences

unsigned long timer_nmea = 0;            // used by Nmea generation
const unsigned long inter_nmea = 120;    // Nmea interval in miliseconds
const int number_nmea = 24;              // number of Nmea sentences (minus 1)
int index_nmea = 0;

char nmea01[] = "$GPRMC,120000.03,A,3905.84900,N,02633.42800,E,0000.0,330.0,011019,0.0,W,A,S*60";
char nmea02[] = "$IIDBT,13.1,f,04.0,M,02.2,F*26";
char nmea03[] = "$IIVHW,330.0,T,330.0,M,00.0,N,00.0,K*55";
char nmea04[] = "$WIMWV,090.6,R,009.6,N,A*23";
char nmea05[] = "$WIMTW,19.3,C*06";
char nmea06[] = "$GPRMC,120001.03,A,3905.84900,N,02633.42800,E,0000.0,330.0,011019,0.0,W,A,S*61";
char nmea07[] = "$IIDBT,13.1,f,04.0,M,02.2,F*26";
char nmea08[] = "$IIVHW,330.0,T,330.0,M,00.0,N,00.0,K*55";
char nmea09[] = "$WIMWV,093.2,R,010.2,N,A*28";
char nmea10[] = "$WIMTW,19.3,C*06";
char nmea11[] = "$GPRMC,120002.03,A,3905.84900,N,02633.42800,E,0000.0,330.0,011019,0.0,W,A,S*62";
char nmea12[] = "$IIDBT,13.2,f,04.0,M,02.2,F*25";
char nmea13[] = "$IIVHW,330.0,T,330.0,M,00.0,N,00.0,K*55";
char nmea14[] = "$WIMWV,091.8,R,009.9,N,A*23";
char nmea15[] = "$WIMTW,19.3,C*06";
char nmea16[] = "$GPRMC,120003.03,A,3905.84900,N,02633.42800,E,0000.0,330.0,011019,0.0,W,A,S*63";
char nmea17[] = "$IIDBT,13.4,f,04.1,M,02.2,F*22";
char nmea18[] = "$IIVHW,330.0,T,330.0,M,00.0,N,00.0,K*55";
char nmea19[] = "$WIMWV,085.7,R,010.2,N,A*2A";
char nmea20[] = "$WIMTW,19.3,C*06";
char nmea21[] = "$GPRMC,120004.03,A,3905.84900,N,02633.42800,E,0000.0,330.0,011019,0.0,W,A,S*64";
char nmea22[] = "$IIDBT,13.0,f,04.0,M,02.2,F*27";
char nmea23[] = "$IIVHW,330.0,T,330.0,M,00.0,N,00.0,K*55";
char nmea24[] = "$WIMWV,086.9,R,009.6,N,A*2B";
char nmea25[] = "$WIMTW,19.3,C*06";

char * nmea[] = { nmea01, nmea02, nmea03, nmea04, nmea05, nmea06, 
       nmea07, nmea08, nmea09, nmea10, nmea11, nmea12,
       nmea13, nmea14, nmea15, nmea16, nmea17, nmea18, 
       nmea19, nmea20, nmea21, nmea22, nmea23, nmea24,
       nmea25 };
       
// end of simulation mode definitions
// ==================================
Regards, Luis

Even Keel
Posts: 7
Joined: Fri Oct 18, 2019 8:28 pm

Re: Simulation Mode

Post by Even Keel » Wed Oct 23, 2019 5:45 pm

Thank you for the quick answer.
Indeed, the nmea file I got in the zip is an older one as the boat is close to Preveza entrance.
For a more complete simulation, I will need to sort the significant sentences and I´m not sure it can make any noticeable difference with the one you've already compiled.
If I understand correctly, the target of the simulation is to check that : "what was read by the client software is what was sent by the devices thru the multiplexer's ports". (i.e no lost or added data & port's speeds operational for the set up).

Luis Sa
Site Admin
Posts: 843
Joined: Thu May 04, 2017 4:12 am

Re: Simulation Mode

Post by Luis Sa » Wed Oct 23, 2019 6:15 pm

Hello,

To create a new file you start with the one on my post and add more lines like :

Code: Select all

char nmea26[] = "here goes the nmea sentence";
char nmea27[] = "here goes another";
If you just 2 sentences (26 and 27) then you need to change this one:

Code: Select all

char * nmea[] = { nmea01, nmea02, nmea03, nmea04, nmea05, nmea06, 
       nmea07, nmea08, nmea09, nmea10, nmea11, nmea12,
       nmea13, nmea14, nmea15, nmea16, nmea17, nmea18, 
       nmea19, nmea20, nmea21, nmea22, nmea23, nmea24,
       nmea25 };
to look like this:

Code: Select all

char * nmea[] = { nmea01, nmea02, nmea03, nmea04, nmea05, nmea06, 
       nmea07, nmea08, nmea09, nmea10, nmea11, nmea12,
       nmea13, nmea14, nmea15, nmea16, nmea17, nmea18, 
       nmea19, nmea20, nmea21, nmea22, nmea23, nmea24,
       nmea25, nmea26, nmea27 };
and change the constant number of sentences to show the new number:

Code: Select all

const int number_nmea = 26;              // number of Nmea sentences (minus 1)
and the same for AIS ... in the code you can also change the rate that the sentences are sent out.

THE PURPOSE - when a user receives the multiplexer at home, having the boat in a marina, it would be interesting (so I think) to get familiarity with the interface and test how the multiplexer works with laptop or android applications. Without sensors to connect to the input ports, the simulation makes that possible just with a 12V power supply or an USB cable supplying the power.

Regards, Luis

Even Keel
Posts: 7
Joined: Fri Oct 18, 2019 8:28 pm

Re: Simulation Mode

Post by Even Keel » Thu Oct 24, 2019 2:37 am

Luis ,
You´re right. I missed this point : simulation is more for the user to understand and get used to choose the good setup for user's applications.
I'm quite on the go now, with the end of hurricane season, but I'll try to choose some significant sentences to add in the very next weeks.
See you,
Serge

Even Keel
Posts: 7
Joined: Fri Oct 18, 2019 8:28 pm

Re: Simulation Mode

Post by Even Keel » Fri Nov 01, 2019 1:23 am

Luis,
It´s working as far as tonight.
I've tried to get back the sentences thru the USB port but, when you plug the USB cable, there´s no COM port defined in the Device Manager of W10 ( with or without simulation mode working) , so no transmission. How to fix that ? Is there a special driver to download and install ?
Reading the literature coming with the zip file, it appears there should be a function of overriding P1 input by USB input "If you set USB on the baud rate of port P#1". I understand the functionality but I really don´t know how to do that, without having a COM port (or else) defined.
Thank you for your continuous help,
Serge

Luis Sa
Site Admin
Posts: 843
Joined: Thu May 04, 2017 4:12 am

Re: Simulation Mode

Post by Luis Sa » Fri Nov 01, 2019 2:14 am

Hello,

The first thing that I recommend when using the USB port is to handle the cable and plug with care as the socket is delicate.

When you insert the USB cable in your computer a sound should be heard and the com port that was given should appear in a little pop up window. I just made this experience and got COM4. I went to the Windows Settings and, on Devices, I got it listed as shown:

usb-com4.gif

Note the Silicon Labs driver. I think this is a very common driver and Windows will install it quite easily. But please check just in case.

A final note - are you using a proper USB data cable? There are many cables that just have the power lines (to charge smartphones for example) and no data lines.

Regards, Luis

Even Keel
Posts: 7
Joined: Fri Oct 18, 2019 8:28 pm

Re: Simulation Mode

Post by Even Keel » Fri Nov 01, 2019 3:14 pm

Luis,
How stupid am I !
I was using a cable from Bluetooth Speakers made for DC only. Actually my wife had the same trouble with a Kobo reader two or three months ago, I should have think of it.
So I have the driver settled up.
But when I tried to read the simulation with OCpn or hyperterminal, nothing´s passing thru.
Driver is operational, Baud rate is OK.
When I use it with Hyperterminal it cut the connection as soon as I start the reading.
Any clue ?

PS : I don´t want to use the USB channel for a domestic usage , but I thought it could be a good backup in any "malfunctioning" Wifi case, when, at sea, you've to react first before going into.

Even Keel
Posts: 7
Joined: Fri Oct 18, 2019 8:28 pm

Re: Simulation Mode

Post by Even Keel » Sat Nov 02, 2019 2:06 am

I've,finally, found what´s wrong with the USB port...
USB = P5
P5 not settable in the simulation mode => USB = null

I've tried to set P5 on (using the P1 & P2 ports or the UDP port) under simulation but the simulation doesn't start.
So I will try when everything installed and setup done.
Sorry to make you loose your time and thanks for the support.

Best regards,
Serge

PS : Simulation help me a lot to understand how the NMEA4WIFI is working. Some functionalities could be added to the tool, but not fundamental stuff. To me, the way it' working today is sufficient for the user to ask itself what would be the best way to implement the multiplexer in his own navigation system.

Luis Sa
Site Admin
Posts: 843
Joined: Thu May 04, 2017 4:12 am

Re: Simulation Mode

Post by Luis Sa » Sat Nov 02, 2019 5:13 am

Hello,

At the moment of writing I could not confirm but I think that if check P1 or P2 to go out through P5 and then you press simulation, the P5 led will start to blink... I will look at it!

Regards Luis

Post Reply