LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with synchronous input output for PID implementation

Solved!
Go to solution

I have tried to implement a PID control  where a modulation timesieries is generated as output, a timeseries is acquired as input, then a single pont PID correction signal is calculated to be applied at the next cycle.

The output is the slave waiting for the trigger from the input.

Sampling rate 100 KS/s, numeber of point 1 kS, therefore the cycle is completed in 10 ms

The vi works fine for few minutes then the output stops being generated, but the vi continues acquiring without giving an error.

It is not clear to me if it is a problem of trigger, or a problem of clock source.

The key is the synchronization of the master  input and slave output . The same problem when the master is the output.

 

I attach a simplified scheme, where the PID is not reported for simplicity. 

 

What is the reason of the stop of the output?

Max

Thanks in advance

Download All
0 Kudos
Message 1 of 7
(468 Views)

Which model of DAQ hardware are you using?

Are you sure the loop is indeed running at 10ms interval? Try to benchmark it with Find My Loop Rate in LabVIEW

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
-------------------------------------------------------
https://github.com/ZhiYang-Ong
0 Kudos
Message 2 of 7
(431 Views)

Thank you for the fast reply.

1) The DAQ is X series USB-6366, WIN11 Pro 16Gb RAM

2) The Loop rate measured with "Tick count" is 10 ms in average. It looks like when there is activity with the PC (open file explorer or open another LV file) the loop rate changes a bit and then the output generation stops.

 

Is there a way to prioritize the activities in the LV loop with respect to the PC activity?

 

0 Kudos
Message 3 of 7
(404 Views)
Solution
Accepted by max_tomatis

@max_tomatis wrote:

It looks like when there is activity with the PC (open file explorer or open another LV file) the loop rate changes a bit and then the output generation stops.

 

 


Now, you're realizing the difference between RTOS and Windows OS.

 

On Windows OS, as it is designed for multi-tasking and not run time-critical applications, it is possible that an update or an application can use up all available computing resources making your critical application stuck/stall. Now, imagine if Windows or your IT decided to force update and restart your computer when it is running a PID loop and mid-way it restarted.

 

Typically, for PID application, you get a dedicated hardware and thereby guarantee its performance or in this case go with a cRIO to implement the PID loop to be reliable.

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
0 Kudos
Message 4 of 7
(397 Views)

I understand your point. I should use RT labview on a real-time embedded system like CRio.

 

To save time,  is there a way to translate directly the LV that I created and works (a part the windows interruptions) into a RT LV and usi in my CRio?

 

Massimo

0 Kudos
Message 5 of 7
(381 Views)

And.. would a "Timed loop" in LV solve the problem by using the maximum priority?

0 Kudos
Message 6 of 7
(374 Views)

Hi Massimo,

 


@max_tomatis wrote:

To save time,  is there a way to translate directly the LV that I created and works (a part the windows interruptions) into a RT LV and usi in my CRio?


Usually you can transfer VIs from "my computer" target to "realtime" target.

There are some points to consider:

  • check any external references/paths: you need to provide them on your cRIO in the correct fashion
  • check for functions/toolkits not supported on cRIO (like DAQmx support only for recent cRIOs)
  • cRIO usually works headless, so no UI to interact with!

@max_tomatis wrote:
would a "Timed loop" in LV solve the problem by using the maximum priority?

No.

It's a common mistake to use the TimedLoop on a Windows target to become (more) independent from Windows OS timings...

The TimedLoop is made for realtime targets! (It's mainly available on Windows to allow/support debugging of realtime VIs.)

Best regards,
GerdW


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