SK
Signal K6mo ago
petsi

petsi - I have create this node-red flow. It ta...

I have create this node-red flow. It takes the AWA and put it again on the flow with a smooth path. It works with negative and positive values. anybody can try this flow and sayme if it works fine?
22 Replies
Teppo Kurki
Teppo Kurki6mo ago
It will not work very well dead downwind when awa alternates from side to side
petsi
petsiOP6mo ago
how I have to change the function to work?
Teppo Kurki
Teppo Kurki6mo ago
petsi
petsiOP6mo ago
ok, i think that now is ok
Teppo Kurki
Teppo Kurki6mo ago
you could optimise it so that sin and cos is calculated once for each input. now they are called every time there is new input for all the old values
petsi
petsiOP6mo ago
Ok, something like this?
Teppo Kurki
Teppo Kurki6mo ago
I don't think that works - for each new wind value you get a new message object hmm, i just looked at the json, did not put this in node-red, so i may be mistaken... anyway, convert the angle first to [sin, cos], then keep a window buffer of them, then calculate the average by summing the sin and cos values
Henry
Henry6mo ago
Following this thread with interest. Actually the maths for Yamartino’s method isn't too bad (sin, cos, sum and arctan). https://www.flyingcoloursmaths.co.uk/dictionary-of-mathematical-eponymy-yamartinos-method/ Plus this buffer array looks useful https://flows.nodered.org/node/node-red-contrib-buffer-array
petsi
petsiOP6mo ago
I understand the method, I understand how it works but I don't know how to make it work with node red. I'm using chat gpt for create the instructions and I know why it don´t work, I'm not able.
Henry
Henry6mo ago
Managed to get a process that seems to work. Is all in radians, but working on a KIP dashboard too. Is a buffer/array of 10.
No description
Teppo Kurki
Teppo Kurki6mo ago
looks good to me! i actually managed to create a prototype for a standalone plugin that does this, see https://discord.com/channels/1170433917761892493/1240386036757168168
Henry
Henry6mo ago
Plugin looks useful. Was useful too to actually practice/learn some signalk to get this working, so pleased I've had the practice.
petsi
petsiOP6mo ago
Could you share the node red flow?
Henry
Henry6mo ago
Will try and go onboard tomorrow and get a copy. Actually found an error in the arctan calculation over the weekend, but fixed bown
petsi
petsiOP6mo ago
Thank you. I'm waiting and reading
Henry
Henry6mo ago
This is the JSON BUT you need to edit the arctan function. Should be x,y not x/y
petsi
petsiOP6mo ago
something like this? var apparentSin = msg.payload.angleApparentSIN var apparentCos = msg.payload.angleApparentCOS msg.payload = Math.atan(apparentSin) / Math.atan (apparentCos); return msg;
Henry
Henry6mo ago
petsi
petsiOP6mo ago
I have made an update of your code. I used at the start a input hgandler and a input handler next node and change the topic to environment.wind.angleApparent
petsi
petsiOP6mo ago
Wind speed Apparent to wind speed apparent smooth. I use this flow to use with smooth polar performance plugin. with 5 average values gives good performances. what do you think about it? it's ok?
Henry
Henry6mo ago
I think I took something like 10 but same principle.
petsi
petsiOP6mo ago
And the same with yaw, pitch and roll
Want results from more Discord servers?
Add your server