LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

retain intermittend value

ok, attached a vi, for the interested reader.

0 Kudos
Message 11 of 19
(264 Views)

like so, works as a concept. I did 2 options, keep for 10 iterations and timestamp. If someone wants to use the snippet

Steffen01_0-1709762313852.png

 

0 Kudos
Message 12 of 19
(264 Views)

Ah, what a mess. You certainly don't need a stack of loops for any of this. See if this can give you some ideas....

 

 

(What if there is a new value and it is the same as the previous value? Wouldn't that require a time update?)

Message 13 of 19
(251 Views)

thanks!

 

(What if there is a new value and it is the same as the previous value? Wouldn't that require a time update?)

 

this is why I want to keep it for 1 s only. Sometime the master does not send a write for a few seconds and then continues again. This way I recorded that behavior as well.

This is why I put 2 things to try, timer and just count 10 iterations since last value change, then reset the latch. 1s will be enough, anything we log is in 1 s steps, so can reference things nicely. PLC and everything else in the line only cycles about 1 s or so anyway. Some of the read registers change, the response is 1 cycle later only anyway.

0 Kudos
Message 14 of 19
(245 Views)

Why not write the Read and Writes to separate tables? The Write should just have the Timestamp and Value.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 15 of 19
(233 Views)

because then I have to merge 3 tables. Its much easier if they all run at the same frequency. I made it so the timestamp in SQL does not have milliseconds. Then I can align all the tables at full seconds. I just need to know what events are happening when. Can be hours worth of logs in 1 s intervals. And on top of it there could be the modbus log, which is endless as well

0 Kudos
Message 16 of 19
(225 Views)

ok, did this

-if nothing is read, then set to 65535

-if something is read, put into shift register and send to SQL

-for 1.1s check if next array is empty, send content of shift register to SQL

-for 1.1s if some new value is read, populate shift register and send this to SQL

Steffen01_0-1710397828277.png

getting the result I wanted. Timestamp matches

Steffen01_1-1710397887691.png

Steffen01_2-1710397946180.png

time to go home.

 

0 Kudos
Message 17 of 19
(201 Views)

@Steffen01 wrote:

 

Steffen01_0-1710397828277.png

getting the result I wanted. Timestamp matches


It is is hard to judge a highly truncated image, but...

 

  • shouldn't the shift register be initialize with 65535?
  • Why all these coercion dots?
  • To get the first element, you don't need to wire the index
  • It seems incorrect to look at the first element of an empty array.
  • We cannot tell what's in the other case of the case structure or why there are two output tunnels.
0 Kudos
Message 18 of 19
(194 Views)

-coercion dots because anything modbus is 16 bit unsigned

-the array is sometimes empty and sometimes its not. Because the modbus read happens at least once per second but the write just at random

-the 65535 is in the false statement. The first few lines in the SQL do not matter anyway, have to start the vi first and then start the modbus sniffer

 

thanks for all the help!

0 Kudos
Message 19 of 19
(186 Views)