LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare 2 alarms and if they are the same, don't save the second one

Hi there,

 

I made a program with a logfile.

Everything that will happen in my program (Starting, Log in, Log out and alarms) will be saved in this file.

It's a .txt file.

 

I want to make a function that carries out that the file is maximum 100 lines.

And I also want to make the following:

When a action, for example an alarm, is the same as the action that was before, the second alarm has not to be saved in the logfile.

I want to build this in to prevent that there is 20 times the same alarm in a short time in the logfile.

 

I hope someone can help me.

 

Regards,

 

Kenny

0 Kudos
Message 1 of 12
(3,434 Views)

Use a shift register to store the last read alarm. Only log an alarm if the stored alarm does not equal the new alarm.

 

Rgs,

 

Lucither.

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 2 of 12
(3,429 Views)

Ok, but where can I find such a register?

Can you make a small project, just that I know how to make it and how the blocks look like.


Greetz

0 Kudos
Message 3 of 12
(3,419 Views)

Hi Cheese,

 

to add a shift register you right click on the loop and select add shift register. This is really day 1, lesson 1 of LabVIEW. I suggest that you do the online tutorials if you want to do a project. Being able to add a shift register is nearly always a must and something basic.

 

Rgs,

 

Lucither.

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 4 of 12
(3,412 Views)

I allready found how to do it.

But I'm not able to compare 2 states.

With the shift register, the output will become the same as the input, so not the alarm before the current alarm.

 

I know that it would be possible but and it should be easy, but I don't see how.

0 Kudos
Message 5 of 12
(3,408 Views)

Hi Cheese,

 

Have attached a small example.

 

Rgs,

 

Lucither

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 6 of 12
(3,403 Views)

Hi there,

 

I'm using Labview 8.2, and cannot open your file because you made it with a newer version of Labview.

Can you save it as an older version.


Regards,

 

Kenny

 

0 Kudos
Message 7 of 12
(3,400 Views)

Cheese,

 

The best bet would be to write all this into a Action Engine goto HERE. Ben did a great nugget on them which will tell you everything you need to know. I would wrap this functionality into it so when you call the vi it will write to a log file only if it is a new alarm. Have a go, if you get stuck show me what you have done and i will assist.

 

Rgs,

 

Lucither

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 8 of 12
(3,400 Views)

Here it is in 8.2

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 9 of 12
(3,397 Views)

Thanks, but I will explain my problem a little bit more clearer.

 

I have an array(string).

Out of this array I will filter a part with the "Index Array" function.

With "Index Array" I will get the state of the action.

This state I want to "save"(in a shift register, as you said) until a new action comes up, then I have to write this one to the logfile and save in the shift register.

And I don't want to put all the alarms in a scroll down menu, because I'm talking about a whole list of alarms.

 

Another thing, the maximum length of the logfile is 100 lines.

Do you also have a solution for this?

 

Regards,

 

Kenny

 

 

0 Kudos
Message 10 of 12
(3,384 Views)