Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8317205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:32:24+00:00 2026-06-08T21:32:24+00:00

I have a quite special problem and it is hard to break it down

  • 0

I have a quite special problem and it is hard to break it down to a few lines of code and a few sentences but I will try to do so.
I am currently working on a software for real time optimization for alarms in process plants. The software receives new alarms from a server every time new alarms appear. Several of these alarms have the same root cause and my software analyses these alarms and groups them if they are related to each other.
My problem is comparing new alarms with old ones. I store the old alarms in a global list and append new alarms to this list when they appear.
The new alarms have to be analyzed whether they can be grouped with themselves and with the old alarms. The old alarms don’t need to be regrouped again.
As an example I have three old (o) alarms and three new ones (n).
The list will look like o1 o2 o3 n1 n2 n3. Now n1 has to be compared to o1, o2, o3, n2 and n3. n2 has to be compared to o1,o2,o3 and n3 and so on.

I used the following code to do this:

    List<ALARM_ITEM> puffer = new List<ALARM_ITEM>();
            puffer.AddRange(localOldAlarmList);
            puffer.AddRange(localNewAlarmList);
            localMergedList = puffer;



    int mainListCounter = localOldAlarmList.Count;

    for (; mainListCounter < localMergedList.Count; mainListCounter++)
                {
                    /*if there are new elements just these elemnts will be used as static items*/
                    ALARM_ITEM staticAlarmItem = localMergedList[mainListCounter];

        for (int j = -1; j <= 1; j += 2)
        {

                            if (j < 0)
                                counterRunner = localOldAlarmListLength - 1;
                            else
                                counterRunner = mainListCounter + 1;



                            //Check against any ALARM_ITEM in timeframe
                            bool inTimeframe = true;

                            while (inTimeframe)
                            {

                                if ((counterRunner >= localMergedList.Count) || (counterRunner) < 0)
                                        break;

                                 ALARM_ITEM groupCandidate = new ALARM_ITEM();
                                    groupCandidate = localMergedList[counterRunner];


                                 //... several if clauses

                                MergeTwoAlarmGroups(staticAlarmItem, groupCandidate);

                                 if (j < 0)
                                        counterRunner -= 1;
                                    else
                                        counterRunner += 1;

                }
            }
        } 

Now what shall I say… I modified this approach working about 36 working hours now but still the software does just compare new alarms between each other and does not link it to the old alarms. The grouping algorithm is several pages long and I tried to break it down as far as I can. If anyone can give me an advice what I’m doing wrong I would be really glad because I’m getting mad over this problem. It’s the first time I’m really stuck in this project and I’m programming this software for more than three month now.

Kind regards
Larimow

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:32:26+00:00Added an answer on June 8, 2026 at 9:32 pm

    I don’t fully understand your algorithm. I would use a

    Dictionary<ALARM_ITEM, HashSet<ALARM_ITEM>>
    

    as the data structure, where the values are groups of events and the keys are representatives of each group. When a new alarm a arrives, the algorithm would be

    1. for each key k, check whether a is grouped with k
      • if so, add it to the hashset stored at k and break
    2. otherwise, create a new hashset values containing just a, and add (a, values) to the dictionary

    In other words, you store the groups of alarm in a dict whose keys are “representative” alarms for the groups. To add a new alarm, you only have to compare it against the representative alarms.


    This assumes that if a groups with b and b groups with c then a groups with c. If that is not the case, there isn’t necessarily a consistent way of grouping the alarms. And if it is the case then the grouping relation is an equivalence, so the algorithm will work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have quite a complex piece of code (JQuery and HTML5 Web SQL) that
I have quite a few buttons in my application, they vary in sizes based
I have quite a problem concerning the use of relational database concepts in Delphi
I have quite a lot of music files but their title attributes have the
I have quite a few situations where I have database structures similar to: TABLE
I have quite a lot of C++ legacy code modules from my colleagues, unfortunately
I have a feeling I'm doing something wrong here, but I'm not quite sure
The problem is quite simple, I have a method that returns a list. I
I'm having a problem similar to but not quite the same as one I've
I am quite new to svn. The following is my problem. I have the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.