06-13-2024 04:41 AM
Hi,
We are working in a HiL device and we want to speed up the execution time of the model. To do that, we have started taking just the most important parts of the model, which are the I/O and the clock calculation. We have seen that the execution time of the while loop is of 6.7 us. Is there a way to read write the modules in a faster way or we won't be able to speed up more the model?
We have a cRIO 9039 with a 40 MHz clock and the modules are 2x NI9401 and a NI9263.
Thanks a lot,
Beñat
06-13-2024 05:12 AM
You should use Timed Loop with 40 MHz source, then you will see that it iterates at 40 MHz:
Instead of per iteration time measurement you can add continuously incremented counter to that loop:
And then check how many increments you have within one second:
I have exactly 40 Millions cycles per second here.
06-13-2024 06:05 AM - edited 06-13-2024 06:05 AM
Hi Benata,
@BeñatA wrote:
Is there a way to read write the modules in a faster way or we won't be able to speed up more the model?
We have a cRIO 9039 with a 40 MHz clock and the modules are 2x NI9401 and a NI9263.
06-13-2024 07:39 AM
I believe NI-9263 is the limiting factor here.
According NI-9263 Specifications
06-13-2024 09:33 AM
@ZYOng wrote:
I believe NI-9263 is the limiting factor here.
According NI-9263 Specifications
I don't think that the inserted module will affect cycle time, at least in my case I have also "slow" modules, like 9472 which is 100µs, but the Timed Loop still working at 40 MHz, also when I read inputs or write outputs. If inserted Module is not fast enough I just will get same not updated values during multiple cycles, but execution speed is not affected. But may be I'm wrong, I have no experience with 9263.
06-13-2024 10:47 AM
Hi Andrey,
@Andrey_Dmitriev wrote:
I don't think that the inserted module will affect cycle time, at least in my case I have also "slow" modules, like 9472 which is 100µs, but the Timed Loop still working at 40 MHz, also when I read inputs or write outputs. If inserted Module is not fast enough I just will get same not updated values during multiple cycles, but execution speed is not affected. But may be I'm wrong, I have no experience with 9263.
In my experience I got compilation errors when trying to handle slow IO nodes inside fast timed loops (aka SCTLs).
That's why I put those IO nodes into plain while loops and added a wait function inside the loop to set the sample rate…
06-14-2024 03:07 AM
Some modules have nodes which require them to be in either normal while loops or explicitly in SCTLs. This is defined int he CLIP.
The speed of execution of your code and the speed with which the IO is updated are not neccessarily the same thing. One could theoretically have a loop generating data at 40MHz, but if your IO is limited to 100kHz, I would question the benefit of such a design.
06-14-2024 03:21 AM
@Intaris wrote:
Some modules have nodes which require them to be in either normal while loops or explicitly in SCTLs. This is defined int he CLIP.
The speed of execution of your code and the speed with which the IO is updated are not neccessarily the same thing. One could theoretically have a loop generating data at 40MHz, but if your IO is limited to 100kHz, I would question the benefit of such a design.
In my particular case if was necessary to generate precision pulse trains from 9401 with different frequencies and delays for high speed cams and xray sync, also reacting on inputs, and I just let run RT Loop running at 40 MHz, then just implemented simple trivial counter, so, in easiest words, if I keep output true for 1600 cycles, then drop low to next 1600 cycles, then get 12,5 kHz output. It was so easy and works like a charm, fully meet my requirements.