• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Allow NMEA 0183 file input/output
#11
(05-30-2017, 05:12 PM)abarrow Wrote: I wonder if it would be possible to include "file" as a type of input or output on the KPLEX tab........

It's an old post but I agree that it would be a nice feature, also for creating and reading NMEA 0183 log files. 
I have written 2 posts regarding reading and creating log files which maybe could be to some help, but it don't solves Your checksum problem.
Reading from file
Writing to file
/Mats
  Reply
#12
(08-13-2017, 04:11 PM)MatsA Wrote:
(05-30-2017, 05:12 PM)abarrow Wrote: I wonder if it would be possible to include "file" as a type of input or output on the KPLEX tab........

It's an old post but I agree that it would be a nice feature, also for creating and reading NMEA 0183 log files. 
I have written 2 posts regarding reading and creating log files which maybe could be to some help, but it don't solves Your checksum problem.
Reading from file
Writing to file
/Mats

On point to remember is that there is an opencpn data recorder plug in which will record (and play back later) all NMEA data coming into Opencpn. https://opencpn.org/wiki/dokuwiki/doku.p...nslate:vdr

Also writing from node-red to a file is easy -

Code:
[
   {
       "id": "36d7cef4.ce9742",
       "type": "tcp in",
       "z": "f1a0cb4.fe86138",
       "name": "",
       "server": "client",
       "host": "192.168.43.98",
       "port": "10109",
       "datamode": "stream",
       "datatype": "utf8",
       "newline": "\\n",
       "topic": "",
       "base64": false,
       "x": 116.00001525878906,
       "y": 81.00001525878906,
       "wires": [
           [
               "2ec38e6f.de4e32"
           ]
       ]
   },
   {
       "id": "2ec38e6f.de4e32",
       "type": "switch",
       "z": "f1a0cb4.fe86138",
       "name": "Filter just ais",
       "property": "payload",
       "propertyType": "msg",
       "rules": [
           {
               "t": "regex",
               "v": "!AIVDM*",
               "vt": "str",
               "case": true
           }
       ],
       "checkall": "true",
       "outputs": 1,
       "x": 330,
       "y": 80,
       "wires": [
           [
               "b94ee7ad.e95078"
           ]
       ]
   },
   {
       "id": "b94ee7ad.e95078",
       "type": "file",
       "z": "f1a0cb4.fe86138",
       "name": "",
       "filename": "/home/pi/savedais2.txt",
       "appendNewline": true,
       "createDir": false,
       "overwriteFile": "false",
       "x": 540,
       "y": 80,
       "wires": []
   }
]


For data recording I've gone with SQLite, easy to install database , handy as everything is in one file then GnuPlot can read directly (or rather via sqlite) and plot some lovely graphs - this is 3 different temperature graphs while running the engine with the time offset so they are on top of each other -
[Image: XDBHLgC.png]

Writing isn't too hard from node-red using signalk data - 
(The link is to a websocket node receiving all the signalk data)
Code:
[
   {
       "id": "1297a3e2.92bf2c",
       "type": "link in",
       "z": "f1a0cb4.fe86138",
       "name": "from database",
       "links": [
           "8b385a5c.b0c248",
           "faa85eeb.a9f43"
       ],
       "x": 35,
       "y": 200,
       "wires": [
           [
               "ab86fbfb.82f1c8",
               "ae84828b.96ce4",
               "42138ed4.f3974"
           ]
       ]
   },
   {
       "id": "ae84828b.96ce4",
       "type": "switch",
       "z": "f1a0cb4.fe86138",
       "name": "Is it nav data?",
       "property": "msg.payload.updates.source.sentence",
       "propertyType": "jsonata",
       "rules": [
           {
               "t": "eq",
               "v": "RMC",
               "vt": "str"
           }
       ],
       "checkall": "false",
       "outputs": 1,
       "x": 140,
       "y": 360,
       "wires": [
           [
               "df4a7c79.5f02c"
           ]
       ]
   },
   {
       "id": "df4a7c79.5f02c",
       "type": "change",
       "z": "f1a0cb4.fe86138",
       "name": "create msg.eng etc",
       "rules": [
           {
               "t": "set",
               "p": "SOG",
               "pt": "msg",
               "to": "msg.payload.updates.values[path=\"navigation.speedOverGround\"].value*1.94384",
               "tot": "jsonata"
           },
           {
               "t": "set",
               "p": "COG",
               "pt": "msg",
               "to": "msg.payload.updates.values[path=\"navigation.courseOverGroundTrue\"].value*180/3.14",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 170,
       "y": 400,
       "wires": [
           [
               "3f01efd9.4b7b3"
           ]
       ]
   },
   {
       "id": "3f01efd9.4b7b3",
       "type": "function",
       "z": "f1a0cb4.fe86138",
       "name": "create INSERT topic SOG, COG",
       "func": "\n    msg.SOG=msg.SOG.toFixed(1);\n    msg.COG=msg.COG.toFixed(1);\n    msg.topic = \"INSERT INTO navdata  (SOG, COG) VALUES (\"  + msg.SOG + \",\" + msg.COG + \" );\";\n   \n    return msg;",
       "outputs": "1",
       "noerr": 0,
       "x": 390,
       "y": 360,
       "wires": [
           [
               "1e400b7c.ee0d55"
           ]
       ]
   },
   {
       "id": "1e400b7c.ee0d55",
       "type": "delay",
       "z": "f1a0cb4.fe86138",
       "name": "",
       "pauseType": "rate",
       "timeout": "5",
       "timeoutUnits": "seconds",
       "rate": "1",
       "nbRateUnits": "1",
       "rateUnits": "minute",
       "randomFirst": "1",
       "randomLast": "5",
       "randomUnits": "seconds",
       "drop": true,
       "x": 390,
       "y": 400,
       "wires": [
           [
               "14bb1d02.077ee3"
           ]
       ]
   },
   {
       "id": "14bb1d02.077ee3",
       "type": "sqlite",
       "z": "f1a0cb4.fe86138",
       "mydb": "fe279cd9.bbe82",
       "name": "",
       "x": 670,
       "y": 400,
       "wires": [
           []
       ]
   },
   {
       "id": "fe279cd9.bbe82",
       "type": "sqlitedb",
       "z": "",
       "db": "/home/pi/database/boatdata.db"
   }
]


Battery voltage is interesting to watch -- 
[Image: 8lbywya.png]


HTH
  Reply
#13
Thanks @PaddyB
Didn’t know about the OpenCPN plugin will check that. 
Out with the boat but Will check Your Node-Red Application when home again.
Thanks for charing !!!
/Mats
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)