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: 

Monitoring does not start

Hello,

 

I would like to start and stop current/power monitoring upon receipt of a UDP message (start/stop). I used an event structure which should trigger the power monitoring code when it receives start message. But unfortunately, it does not get triggerred. What is possibly going wrong here?

Download All
0 Kudos
Message 1 of 12
(2,889 Views)

The event structure will fire whenever something happens to the control called "Start Montioring".  That would be a user entering data on the front panel (even if it is the same data), or the program writing a value to the "Value (Signalling)" property node.

 

I don't see where either of those things are happening in your VI.

 

You shouldn't be using an event structure here.  You should be using a case structure.

0 Kudos
Message 2 of 12
(2,884 Views)

I tried with the case structure. But it seem to fire only once. I need the monitoring to continue until I receive a stop message.

0 Kudos
Message 3 of 12
(2,837 Views)

Put a timeout on th UDP read message.  That will keep the loop iterating.  When it reads a start message, it sets a flag that is maintained in a shift register to tell it that it is in read mode.  When it reads a start message, it puts a false into the shift register to put it into "not read" mode.  When the UDP read times out, it just uses whatever value is in the shift register.

0 Kudos
Message 4 of 12
(2,827 Views)

Hi JohnDoe,

 

I need the monitoring to continue until I receive a stop message.

Then you need to program this algorithm!

All you need is a shift register keeping the last state of your routine…

 

WHILE
  data := UDPRead()
  IF data == "START" THEN state := TRUE
  IF data == "STOP" THEN state := FALSE
  IF state THEN
    do DAQ
  ENDIF
WEND

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 12
(2,823 Views)

I now understand that I need to keep the state persistant by using a shift register. Unfortunately, I could not find the shift register block in the express menu. Like the while loop I cannot even right click on the border and create a shift register. Do you suggest me to add another while loop around the case structure? or any other alternative way? I am using Labview 2009.

0 Kudos
Message 6 of 12
(2,808 Views)

Hi JohnDoe,

 

you cannot create a shift register at a while loop border? Or use a feedback node? Really?

Best regards,
GerdW


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

I am sorry, I misunderstood. I thought the shiftregister is suppossed to be inside the first while loop. Anyways, I added a shift register and get back.

0 Kudos
Message 8 of 12
(2,776 Views)

I have now added the shift register but still I do not see anything in the waveform chart. I did the highlight execution, retain wire values and single step. It looks like it seems to perform like it should, but still no waveform visible. Could you please check again and let me know the issues.

0 Kudos
Message 9 of 12
(2,767 Views)

First, get rid of the Rube Goldberg that you have where there is a Select statement and the True and False constants.  Just use the boolean wire, it does the same thing!

 

The second thing is that you forgot an important part of what I told you in my message.  You need to put a timeout value on the UDP Read.  The -1 timeout value means wait forever.  Pick a value that is comparable to how fast you want the loop to run.  You may need to experiment and make it either a little higher or lower.  It should probably be just a slightly smaller value than the time associated with the amount of data you are collecting in the DAQ functions.

0 Kudos
Message 10 of 12
(2,764 Views)