01-28-2011 02:48 AM
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
01-28-2011 02:55 AM
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.
01-28-2011 04:30 AM
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
01-28-2011 05:06 AM
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.
01-28-2011 05:10 AM
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.
01-28-2011 05:27 AM
Hi Cheese,
Have attached a small example.
Rgs,
Lucither
01-28-2011 05:31 AM
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
01-28-2011 05:32 AM
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
01-28-2011 05:32 AM
Here it is in 8.2
01-28-2011 06:32 AM
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