03-12-2024 01:58 AM - edited 03-12-2024 02:21 AM
Hello,
I am trying to execute two time loop one at a rate of 1000 Hz and other at rate of 200 Hz. The problem I am facing right now is when I am executing the code they are not operating at the assigned frequency. Also I wanted to stop the loop execution when the 1st loop (200) Hz stops, the 2nd should also stop.
Solved! Go to Solution.
03-12-2024 02:41 AM - edited 03-12-2024 02:42 AM
Hi rishab,
@rishab_kr wrote:
I am trying to execute two time loop one at a rate of 1000 Hz and other at rate of 200 Hz. The problem I am facing right now is when I am executing the code they are not operating at the assigned frequency.
Again you failed in attaching all subVIs…
The loops can only iterate as fast as the code inside can be executed: which loop rates do you achieve in comparison to the "assigned frequency"? (THINK DATAFLOW!)
@rishab_kr wrote:
Also I wanted to stop the loop execution when the 1st loop (200) Hz stops, the 2nd should also stop.
Then you need to change the stop condition of the 2nd loop…
(Maybe another program structure might be useful: why do you need to output the same values 5 times per calculation of those values?)
General recommendation:
Cleanup the block diagram to use straight wires.
Never hide labels in the block diagram.
03-12-2024 02:59 AM
Related to attaching VIs : I am not sure weather it will work or not in your system as it contain lots of file like FPGA and Sub VI.
I have shared the final one with one screenshot the upper time loop I executing at 1000 Hz and the lower one is at 200 Hz. Also I am not able to figure out how to stop the upper loop when the bottom one stops executing.
Also I am not able to understand your question about the " why do you need to output the same values 5 times per calculation of those values" ?
I wanted to understand the possible reasons of such behavior, like the loop rates ?
I am really learning a lot out of your comments. Your comments are really crisp and to the point . Waiting for your another valuable guidance.
Thanks in advanced.
03-12-2024 03:17 AM - edited 03-12-2024 03:20 AM
Hi rishab,
@rishab_kr wrote:
I have shared the final one with one screenshot the upper time loop I executing at 1000 Hz and the lower one is at 200 Hz.
I wanted to understand the possible reasons of such behavior, like the loop rates ?
You did not answer my question: which loop rates do you achieve?
@rishab_kr wrote:
Also I am not able to figure out how to stop the upper loop when the bottom one stops executing.
You already know how to stop the loops in the first two sequence frames using the STOP button using a boolean function.
You know how to stop the TimedLoops based on the STOP/Stop buttons.
But now you don't know how to stop those loops based on conditions calculated from several boolean values???
@rishab_kr wrote:
Also I am not able to understand your question about the " why do you need to output the same values 5 times per calculation of those values" ?
One loop is calculating a matrix at (desired) 5ms intervals.
The other loop is using that matrix at (desired) 1ms intervals.
What happens inside the subVI so you need to use the same calculation result 5 times per calculation?