Replies: 2 comments 4 replies
-
Polling for updates in general is A plugin can write its own data files in a plugin specific data directory. See https://github.com/SignalK/signalk-server/blob/master/SERVERPLUGINS.md#appgetdatadirpath . You could write a simple text file or a JSON file with the latest number every once in a while. If you see PGNs that are not yet supported consider providing sample data, it could help adding support fo them in the future. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What are people doing to calculate fuel usage? The options that I see are you need one of the following:
If you have an engine capable of J1939 output, most likely you can obtain a fuel rate. Not very often do these output a fuel consumption/usage value. So to calculate out your actual fuel usage you can use something similar to a Navico - Fuel Data Manager. It will provide these details on your Navico MFD. From what I have seen so far I don't think CANboat converts these PGN's so is not available in signalk.
Maretrons ffm100 can also be used if the engine does not have a J1939 output. Its great for diesel engines as you can incorporate 2 senders for supply and return fuel. The ffm100 also calculates the fuel usage which I believe is available through CANboat.
So my question is - is anybody calculating there fuel consumption based on fuel rate?
I have used a node-red flow to to calculate fuel usage it based on a node called watt2kwh I figured the principle was the same between fuel flow and power usage. It stores the data in influxdb through the signalk-to-influxdb plugin. When signalk is restarted the last value for fuel.used is produced and then the calculations continue. I have found this is extremely accurate for recording fuel usage, it is within 0.5% of the fuel pumped from the bowser.
My plan is to create a signalk plugin to reproduce this node-red flow. I would like some input on the following:
Node-Red flow below...
[ { "id": "49fe94db.aa656c", "type": "tab", "label": "Port Engine - Fuel Used", "disabled": false, "info": "" }, { "id": "dfd9b0e1.cb01a", "type": "signalk-subscribe", "z": "49fe94db.aa656c", "name": "", "mode": "sendAll", "flatten": true, "context": "vessels.self", "path": "propulsion.port.fuel.rate", "source": "", "period": "200", "x": 200, "y": 80, "wires": [ [ "28b9ae40.d23872" ] ] }, { "id": "6201d889.cfcb98", "type": "function", "z": "49fe94db.aa656c", "name": "Record Fuel Usage", "func": "var inputVal = msg.payload;\nif (inputVal == \"reset\"){\n flow.set(\"energyVal\",0); \n } else {\nif (flow.get(\"dbconnect\")==1){\n var savedVal = flow.get('energyVal');\n savedVal += inputVal;\n flow.set(\"energyVal\",savedVal);\n msg.payload = savedVal;\n return msg;\n }\n}", "outputs": 1, "noerr": 0, "x": 910, "y": 140, "wires": [ [ "43f00aa2.658464" ] ] }, { "id": "7125619a.8988a", "type": "signalk-send-pathvalue", "z": "49fe94db.aa656c", "name": "", "source": "", "x": 1450, "y": 140, "wires": [] }, { "id": "43f00aa2.658464", "type": "function", "z": "49fe94db.aa656c", "name": "Set SignalK Path", "func": "msg.topic=\"propulsion.port.fuel.used\"\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 1190, "y": 140, "wires": [ [ "7125619a.8988a" ] ] }, { "id": "34361a88.fd9286", "type": "inject", "z": "49fe94db.aa656c", "name": "Inject after starting", "topic": "", "payload": "0", "payloadType": "num", "repeat": "", "crontab": "", "once": true, "onceDelay": "", "x": 190, "y": 200, "wires": [ [ "1e9366d3.c35b99" ] ] }, { "id": "38c54a35.ccce96", "type": "function", "z": "49fe94db.aa656c", "name": "Set Flow Variable", "func": "flow.set(\"energyVal\",msg.payload[0].last)\nflow.set(\"dbconnect\",1)\nreturn msg;", "outputs": 1, "noerr": 0, "x": 910, "y": 200, "wires": [ [] ] }, { "id": "4f26e088.5c45b", "type": "catch", "z": "49fe94db.aa656c", "name": "", "scope": [ "5889c453.1b773c" ], "uncaught": false, "x": 230, "y": 260, "wires": [ [ "98016193.d19cd" ] ] }, { "id": "1e9366d3.c35b99", "type": "function", "z": "49fe94db.aa656c", "name": "", "func": "flow.set(\"dbconnect\",0)\nreturn msg;", "outputs": 1, "noerr": 0, "x": 400, "y": 200, "wires": [ [ "5889c453.1b773c" ] ] }, { "id": "98016193.d19cd", "type": "delay", "z": "49fe94db.aa656c", "name": "", "pauseType": "delay", "timeout": "10", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "x": 400, "y": 260, "wires": [ [ "5889c453.1b773c" ] ] }, { "id": "60ac9f53.66755", "type": "inject", "z": "49fe94db.aa656c", "name": "**reset**", "topic": "", "payload": "reset", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 680, "y": 140, "wires": [ [ "6201d889.cfcb98" ] ] }, { "id": "28b9ae40.d23872", "type": "watt2kwh", "z": "49fe94db.aa656c", "format": "wh", "maximum": "1", "maximumunit": "mins", "name": "Covert to Fuel Used in Time Frame", "x": 600, "y": 80, "wires": [ [ "6201d889.cfcb98" ] ] }, { "id": "5889c453.1b773c", "type": "influxdb in", "z": "49fe94db.aa656c", "influxdb": "9ef625e9.d31cd8", "name": "Last Database Value", "query": "SELECT last(\"value\") FROM \"propulsion.port.fuel.used\" WHERE (\"source\" = 'signalk-node-red')", "rawOutput": false, "precision": "", "retentionPolicy": "", "x": 640, "y": 200, "wires": [ [ "38c54a35.ccce96" ] ] }, { "id": "9ef625e9.d31cd8", "type": "influxdb", "z": "", "hostname": "127.0.0.1", "port": "8086", "protocol": "http", "database": "vesseldata", "name": "", "usetls": false, "tls": "" } ]
Beta Was this translation helpful? Give feedback.
All reactions