LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Real-Time ploting

Solved!
Go to solution

Hi,

I'm working on a tension project. I read data with the use of OPC. My variable is bunded to an OPC address. I want to plot this data with the resolution of 10ms. Is it possible?

I upload a sample code  , that I tried to solve this problem. but is is not accurate, and not working good.

Do you have any idea to plot a real-time data with the resolution of 10 ms?

 

 

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

Hi beginner,

 


but is is not accurate, and not working good.


 

Well, you heavily use the CPU just as heating element...

- Use a simple Wait function instead of comparing timestamps (btw your comparison is flowad...)

- put a wait function in the first loop.

- Write better error descriptions when asking for help, "not working good" is the same as "it works"...

Best regards,
GerdW


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

🙂

Well It's working as it's ploting something, but it's not working well as the time is not accurate. I used a wait of 10 ms in a single while loop. but problem still ramins. Is there any accurate structure to use?

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

Waits of 10 ms on a desktop OS are not very accurate as the OS often disrupts things for longer than that.

 

If you need accurate timing at the 10 ms level, you should do it in hardware. Does the device communicating via OPC have hardware timing?

 

A Producer/Consumer loop where the data is acquired in one loop and displayed in another loop is also useful in such applications.

 

Lynn

Message 4 of 8
(3,478 Views)

well, there is a timestamp variable between opc variables. I have never used it. I found a timed loop in labview. can I use it for accurate timing?

0 Kudos
Message 5 of 8
(3,466 Views)

Hi beginner,

 

the TWL might be more accurate than a normal while loop with a wait function, but it still suffers from multitasking of the OS...

Best regards,
GerdW


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

so you mean there is no way to have a accurate timed loop in a non real-time OS? what about the real-time module?

0 Kudos
Message 7 of 8
(3,449 Views)
Solution
Accepted by topic author labview-beginner

Hi beginner,

 

you really have to redesign your project!

 

1) Does the OPC data source really supply new data with sample rates of >100Hz?

2) Do you really need to plot new data with a rate of 100Hz? You can't watch the chart that fast!

 

If 1) applies: Make a separate loop to collect data at the needed rate In a shift register (or any other method to store data). If 1) does not apply: lower the rate at which you try to read new data!

2) applies (no alternative!): update your chart with a rate of (let's say) 5Hz. That is still fast enough when viewing your plot and is much less CPU consuming.

 

You have to separate the task of collecting data from the task of displaying them!

 

To your last question:

Any (standard) multitasking OS will imply a great jitter in your loop timings. With a RT-OS that jitter is much lower, but still non-zero. Look at the specifications...

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 8
(3,447 Views)