LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using elapsed time or reset button to turn off digital output in a case structure 2021

Solved!
Go to solution

I have the alarm clock and countdown functions working the way I need. I am having issues getting my reset and elapsed time to work for the digital output to led and audible alarm.

 

Currently I know the elapsed time is sitting outside the case structure, which in my opinion needs to be inside but I am not sure on how to orient so if I push reset will work. 

 

What I am trying to do is trigger the audible alarm and LED and keep it on until one of two things happen.

1. Reset button is pushed by operator. This turns of the LED and audible and waits for next alarm. This is only happening on the half hour and hour time marks.

2. When alarm is triggered start the elapse time and if reset button is not pressed, turn off LED and audible, display a message to operator to restart vi.

 

Reasoning to alarm is the team felt a department alert system was needed to check the machines, to help reduce scrap. Instead of all machines individually acknowledging each operator, the alarm will direct all to do the task. Then the Lead supervisor will reset led and audible. The pop up and disable led and alarm is so if there is not a shift in the plant that the alarm is not sounding for hours till someone comes in.

 

Any help would be greatly appreciated.

0 Kudos
Message 1 of 11
(1,290 Views)

Attaching the VI will help us guide you and debug better than describing it in words.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 11
(1,280 Views)

Hi Brooks,

 


@Brooks.Nelson wrote:

I have the alarm clock and countdown functions working the way I need.

 

Currently I know the elapsed time is sitting outside the case structure, which in my opinion needs to be inside but I am not sure on how to orient so if I push reset will work. 

 

What I am trying to do is trigger the audible alarm and LED and keep it on until one of two things happen.

1. Reset button is pushed by operator. This turns of the LED and audible and waits for next alarm. This is only happening on the half hour and hour time marks.

2. When alarm is triggered start the elapse time and if reset button is not pressed, turn off LED and audible, display a message to operator to restart vi.


Wow, so many "items" in your message - but no source code…

 

So there is an "alarm clock"? And there are several "countdown functions"? Where are they?

And then there is an "audible alarm"?

And you need to "keep it", whatever "it" is?

Why is the user supposed to push a button "only happening on the half hour and hour time marks"?

 

Come on: you surely can explain your problem better!

(Recommendation: by explaining a problem in a better way one often can sketch a possible solution to this problem!)

 

Edit:

Thanks for posting your VI!

 

First steps to improve your VI:

Why are there so many local variables? Replace them ALL by wires!

Why are there two indicators with exactly the same label? How do you differ between them when also using local variables???

 

Now without case structures and no locals:

Have you heard about that "In Range and Coerce" function? Might be handy…

Why do you need to format the same timestamp three times into strings and convert all 3 strings back to numeric values?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 11
(1,273 Views)

My apologies, I had attached and had an error. attached to edited post.

0 Kudos
Message 4 of 11
(1,271 Views)

Thank you for the quick responses. I realize code is poor, learning.

 

Have you heard about that "In Range and Coerce" function? Might be handy…

--I have not and will look into them

Why do you need to format the same timestamp three times into strings and convert all 3 strings back to numeric values?

--Learning. If you would have seen my beginning venture on the program I feel I would have more loud responses back. Self taught and learning.

 

Thanks for the help. 

0 Kudos
Message 5 of 11
(1,233 Views)

thank you for the help although one question.

The alarm fires and the LED lights up but nothing from that point through the select function. It is only a moment that it stays true at the half-hour and hour. 

How do I hold that true to run the led and alarm and wait for the elapsed time/reset button to be triggered.

My original VI did the same in my posted question, just poor layout, case structures and local variables.

 

BrooksNelson_0-1664908637169.png

 

0 Kudos
Message 6 of 11
(1,201 Views)

Hi Brooks,

 


@Brooks.Nelson wrote:

BrooksNelson_0-1664908637169.png

 


Well, those boolean indicators do work - as programmed…

🙂

 


@Brooks.Nelson wrote:

It is only a moment that it stays true at the half-hour and hour. 

How do I hold that true to run the led and alarm and wait for the elapsed time/reset button to be triggered.


Why should they "stay TRUE"? They will either show the value of the TRUE or FALSE input of the select node - as they did before in your case structure when you set them to TRUE or FALSE using constants…

When you want to switch a boolean value based on another boolean value than you should think about using the XOR function - simple boolean math!

 

See this from your original VI:

You set those indicators to TRUE in the TRUE case, and to FALSE in the other case. So you can wire the output of the select node instead of those boolean constants - as I did…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 11
(1,193 Views)

I guess I am not explaining correctly. My original vi did not work after the alarm. I had tried multiple ways and did not function correctly.

 

When the alarm becomes true I need it to hold true for either the 5 minutes or until the reset button is pushed.

 

The way it is now the alarm triggers, yes then goes off because it is not true any more. I understand that. I would think at the point I might put it in a flat sequence or event structure to hold the led and alarm on then wait for the 5 minutes to pass and or reset button to be pushed. Then wait for next alarm.  

0 Kudos
Message 8 of 11
(1,172 Views)

Yes they are to become true. Just in the appended vi they did not become true nor did digital output fire.

 

I attached a snipped showing that it did not. I only altered when it would fire test.

 

BrooksNelson_0-1664910399601.png

 

0 Kudos
Message 9 of 11
(1,170 Views)

Hi Brooks,

 


@Brooks.Nelson wrote:

The way it is now the alarm triggers, yes then goes off because it is not true any more. I understand that. I would think at the point I might put it in a flat sequence or event structure to hold the led and alarm on then wait for the 5 minutes to pass and or reset button to be pushed. Then wait for next alarm.  


General advice: Using a sequence is never the solution.

Why do you think an event structure can help here?

 


@Brooks.Nelson wrote:

When the alarm becomes true I need it to hold true for either the 5 minutes or until the reset button is pushed.


  • When the alarm becomes true you should (re)start the ElapsedTime so it will start the 5min countdown.
  • You keep the state in a (boolean) shift register.
  • When the alarm becomes true you OR it with that value in the boolean shift register.
  • When the ElapsedTime becomes TRUE you set the boolean sift register to FALSE.
  • When reset button is pressed you swith the boolean shift register to FALSE.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 11
(1,161 Views)