Get count of entries / used memory in MpAlarmXHistory

Hello everyone

I need to export the alarm history to a file which is then read/processed from our visualization.

To not miss any alarms I need to know when I have to export the history before the oldest value is overwritten. Is there a way to do that?

Thanks

Hi @Jurg_Heiniger ,
Welcome to the community.
Theoretically you have all information on MpAlarmXHistoryUIAlarmList:


with PageUp/Down StepUp/Down you can navigate in all circular buffer and store the latest entry when you export the data.
Based on a timer/new alarm you trigger your search on the buffer, if that “latest entry“ is no more in the buffer you have found the condition to export again your data.
If you think: “Good, ready to implement that…” well be sure to test your implementation on real hw and monitor CPU usage with SDM.

Just an idea.
Ciao
Valerio

Answer from @PatrickS :


We faced the same challenge a few years ago and did exactly as @valerio.manenti
suggested.
However, with this implementation, we have unpleasant utilization peaks caused by the HistoryUI module, especially when the history is “full.”
In addition, you have to be careful that no alarms are lost when too many alarms are added within one cycle of the timer.
So it is inevitable to export “too early” to avoid loosing alarms, but this causes some alarms to be exported twice.

For these reasons, we switched to a solution with two queries, which is basically an SQL query.
This has enabled us to significantly reduce the utilization peaks:
(On the left is the implementation with HistoryUI, on the right with queries and manual writing of the file) and also avoid the duplication issues.

Solution is described in this wiki post: How we fixed alarm export issues with SQL queries

I do not think that someone can provide a better explanation of this topic than you. Thanks, @PatrickS

Thanks so much @PatrickS for sharing your smart idea + code + traces.
You already spent time on writing your answer, but I would like to ask you a favor, when you have time,: “Could you create a post for this topic on ‘Share info & Ideas’?“

Thanks again
Ciao
Valerio

Hi @Jurg_Heiniger , Could you mark the Patrick’s answer as a solution? Query feature was not ready at the beginning when R&D has released mapp Services,
they developed that as Patrick showed us for improving the performance on our system.

Thanks
Ciao
Valerio

Thank you very much for your effort to show and explain your solution! This helps me a lot (not just a little).

1 Like

I took content of @PatrickS reply and created new wiki post from it.

2 Likes

Thank you for the positive feedback!

@alexander.hefner also deserves a special mention here.
He came up with the idea, or rather gave us the idea, when he was still our contact at B&R months ago.

Thank you Alex, it works :wink:

1 Like

Thank you very much, @PatrickS

It’s great to see you and your colleguages actively contributing in our Community, and giving very valuable feedback and help, together we’re strong!

My warmest greetings to you all!

2 Likes