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
It will not work very well dead downwind when awa alternates from side to side
how I have to change the function to work?
It is a bit complicated https://rosettacode.org/wiki/Averages/Mean_angle
Rosetta Code
Mean angle
ok, i think that now is ok
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
Ok, something like this?
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
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
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.
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](https://cdn.answeroverflow.com/1240382767129432094/image.png)
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
Plugin looks useful. Was useful too to actually practice/learn some signalk to get this working, so pleased I've had the practice.
Could you share the node red flow?
Will try and go onboard tomorrow and get a copy. Actually found an error in the arctan calculation over the weekend, but fixed bown
Thank you. I'm waiting and reading