Hi all,
In our league the pre-qualification is based on the best average of 5 valid laps. I am therefore trying to make a dash, to help monitor exactly this.
Currently, I was able to extract the last 5 laps, and do an average of those. But I would like to do more. Since I am a beginner in creating stuff for simhub, I would have a few questions (iRacing & ACC). I'll start with the first one :).
1/ is there a function/way to determine if a lap was valid/invalid?
I have found the isValidLap property in ACC. I do not see something similar in iR yet.
Further question:
2/ Is there a way to store values? (like you would do when using variables in normal programming)
3/ How is the code in the editor run? Everything is "instant" and cannot work with any stored data?
I would like to:
- calculate average of 5 valid consecutive laps.
- with every new valid lap, the average gets updated. This is not ok, because if the average is worse (bigger), then I would like to keep the initial average. Until better lap times come, and the average would also improve.
No reply on the Discord. No reply on the forum.
Not sure if I'm not asking in the right place, not asking the right question, or simply support is not to be expected. 😑
Hello !
Currently ncalc is "stateless" but JavaScript offers some really basic storage capabilities : https://github.com/SHWotever/SimHub/wiki/Javascript-Formula-Enginebut
Overall it's not the most convenient way to make data analysis (that's what you are asking, store data, reject some, keep some, aggregate it etc...), That's a little out of the scope of the formula engine which is targeting instant data "transformation".
To create data analysis the best way is to use the c# plugin SDK and create a plugin (there is a sample inside simhub) but it requires c# development knowledge.
Nicolas
Salut Nicolas,
Thank you for the pointers. Will explore a bit. I have some (basic) knowledge of programming. Even if not explicitly in C#, it should not be that hard to find the syntax. Setting the framework (interfacing with Simhub) is the most difficult part - will look at your sample.