Trend log of the bus traffic - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Trend log of the bus traffic (/showthread.php?tid=2552) |
Trend log of the bus traffic - Trond Hoyem - 30.03.2020 Hi Is there a way to get the bus traffic value and write this to an object and then have a trend on it? I would like to have this to be able to monitor the bus traffic for longer period of time than the log already existing. RE: Trend log of the bus traffic - Daniel - 30.03.2020 knxlib.getstats() RE: Trend log of the bus traffic - Trond Hoyem - 31.03.2020 (30.03.2020, 14:15)Daniel. Wrote: knxlib.getstats() OK, so I got this working. I made a small resident script that tracks the busload and then writes the value to a group address. Then one can add a trend for the busload and see the bus load in % over time. As the getstats() is not giving the load as a percentage, but rather the number of telegrams in total, I have added a paramter for the number of telegrams pr second. This is of course not an exact value, as the length of the telegrams will vary. Normally, an average telegram time is 25ms, so that should give a theoretical max of 40/s.I have used a lower value in my script. The getstats() is also only updated every minute, so the values we get from it is only to be seen as an indication of the bus load. The trend will be able to give you a hint that there might be too high bus load, and then you will have to do a more detailed analyze of this in another tool. As the values are somewhat uncertain when it comes to actual bus load I have not seen the value in creating seperate GA for send, receive and repeats. I have only added them all together. If one want to split it, it should be fairly easy to modify the script accordingly. Anyways.. the code is as follows: Code: maxS = 15 --Highest accepted telegram rate pr second RE: Trend log of the bus traffic - AlexLV - 06.04.2020 Hi. I found that error appear from this script after rebooting of LM: Resident script:9: attempt to index global 'stats' (a nil value) stack traceback: What it could be? I think I can start this script not automatically but from init with delay, but may be other better solution? BR, Alex RE: Trend log of the bus traffic - admin - 07.04.2020 Stats are not available when system starts, add this to remove the error: Code: stats = knxlib.getstats() There's no point in running this script very often as trends values are updated once a minute. Use a scheduled script that runs every minute. RE: Trend log of the bus traffic - AlexLV - 07.04.2020 admin, thank you for correcting mistakes and improving scripts!! RE: Trend log of the bus traffic - manos@dynamitec - 21.04.2022 Hello admin, I have tried this script and compared the loged value with the KNX Stats in the system page but it seems that the calculated value by the script is around half of the value is displayed in the KNX stats. For the virtual object a datatype 1byte scale is used. Is this normal? Is there a better way to calculate the knx bus load in percentage? Thank you in advance for you reply. RE: Trend log of the bus traffic - admin - 21.04.2022 In KNX stats the maximum is set to 15 telegrams per second instead of 30 as in the example above. Repeats should not be counted as they are included in the received telegram count. RE: Trend log of the bus traffic - manos@dynamitec - 21.04.2022 Hello admin, Thanks for the quick help. After adjusting the parameters the values are the same. |