From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Error List in Labview

Hi Forum,

 

I have an application where different Errors, Trigger, Events,.. can happend at the same time I would like to write this Events to a .txt file in the end of the application. Right now I am using the attached vi. 

This vi opens an array and every time an event happend for example ch0_rms_min_exeeded, it gets the timestamp and date and searching for the empty rows delete them and write the event to file.

It works fine until now but as soon I get more events it will get cunfusing as there will be a lot of case structures.

Capture.PNGSo mabye you have a better idea how to do this.

 

Thanks 
Martin

0 Kudos
Message 1 of 8
(3,600 Views)

The case structures are nearly identical, except for the strings at the bottom.  I'm assuming the false case is similarly idenitcal.  In any programming language, repetitive code like this is a prime candidate for a subroutine - or in this case, a subVI.  You should try to make a subVI identical to one of the case structures and make it fit universally for all the other cases.

 

Striahgten up all your wires.  Don't have them run behind structures so you cannot see where they go.  Don't have wires hiding other wires.    It doesn't affect performance but it does affect readability.  You wouldn't code in a text-based language with no indents or random indents, would you?  In later versions of LabVIEW, there is a "Clean Up Diagram" button on the block diagram tool bar.  It makes some pretty decent guesses at reorganization if your workflow doesn't include a cleanup step (but it really should!)

 

I can't really say much else without seeing actual code.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 8
(3,584 Views)

Hi Billko,

 

thanks for you answer. Yes your are right in a programming language i would not make this, but iam new in Labview so this was my first idea as the events can happend at the same time i dont know how i should set with a case structure. I attached my code mabye you have some ideas. 

thanks 
Martin

 

0 Kudos
Message 3 of 8
(3,577 Views)

I'd use an array of booleans to index through an array of events True means event happened.  use a conditional tunnel to build an array of events that occured

!1-1.png

 

And clean up that code its unreadable.  You may find the style guide a useful resource to improve your code http://www.ni.com/pdf/manuals/321393d.pdf#labview_style_guide


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 8
(3,553 Views)

Keeping in mind that I would've probably constructed the error handling totally different, this would be a very rudimentary example of what the subVI could look like.

 

In addition to the things I mentioned above...

 

For the same reason the engineers bundled the wires in your car together into trunks, so you should combine related wires into clusters.  It avoids a tangled mess.

 

Try to make your subVIs conform to the default pattern.  That way all your subVIs line up nicely and makes it easy to read because of it.  (The suggestion above is critical to this one.)

 

You could really benefit from doing this tutorial.  There are a lot more on the site if you look around a bit.

 

 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 8
(3,546 Views)

@JÞB wrote:

I'd use an array of booleans to index through an array of events True means event happened.  use a conditional tunnel to build an array of events that occured

!1-1.png

 

And clean up that code its unreadable.  You may find the style guide a useful resource to improve your code http://www.ni.com/pdf/manuals/321393d.pdf#labview_style_guide


You beat me to it.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 8
(3,544 Views)

Hi Billko,

 

thanks that helps a lot I will try it with you vi. I will also clean up my code and break it down to smaller vis:) 

0 Kudos
Message 7 of 8
(3,505 Views)

Hi Billko,

 

it works great thank you very much. But how i going to make it if i would like to just count the value change (True-False, False-True) because right now if i get an error over one hour i get ther error message continuously i would like to implement this event list like this: ch0_rms_exeeded_start (False-True) when it stopps ch0_rms_exeeded_end (True-False) thank you very much.

Martin

0 Kudos
Message 8 of 8
(3,442 Views)