LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I create RT time-triggered events?

We have a RT VI running on a PXI.  One of the RT event loops handles turning on and off digital outputs at precise times.  Because we want high precision, the loop is running at a high rate (1 KHz) and every iteration, we check to see if it's time to do something.  But this seems inefficient to me because the vast majority of the time, we're sitting and spinning.  Is there a way to turn this from a polled system to an even-driven system?  I'd like to schedule events to occur at given times and use an event handler to process them.  But how do I schedule a time-triggered user event?

Thanks,
Keith.

0 Kudos
Message 1 of 9
(3,624 Views)
Do you have a lot of other stuff running on the PXI controller?  What controller are you using? How much of the CPU is being used?  I would guess a loop running at 1kHz is no problem and may be the best way to do it.  Where do the events that trigger the outputs come from?   Is it a predetermined continuous pattern that you generate, or do these events come as a result of another operation?  Another thing that you may consider is offloading it to an FPGA board.
SteveA
CLD

-------------------------------------
FPGA/RT/PDA/TP/DSC
-------------------------------------
0 Kudos
Message 2 of 9
(3,613 Views)
There are other RT timed loops running, but I'm not sure if it counts as "a lot of stuff."  As for what controller, I'm not sure (I inherited the system) but MAX says it's a PXI-8187 with a SCXI-1102 and a PXI-1052 (SCXI) SCI with a few cards in it.  Is that what you're asking?

How do I find out how much CPU is being used?

The time trigger is like this: The operator hits a "go" button on the host VI.  This signals a sequence of on/off timed events that are relative to the time when the button was pressed.  The relative timing sequence is fixed before the VI is run and does not change afterwards.  It's also a one-shot -- each digital output is turned on once and off once, just at different times.

If the way we're doing it is fine, I'm cool with that.  I'm just trying to see if I can simplify things.  The previous developer had mentioned doing a lot to optimize, so looking for inefficiencies is fresh in my mind, but I don't know (yet) for sure if there are current problems.

Thanks,
Keith.

0 Kudos
Message 3 of 9
(3,597 Views)

Why aren't you using a Timed loop to do this? The TImed loop can be configured to be driven from the PXI on board clock.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 9
(3,594 Views)
We are using a timed loop, and it's running at 1 kHz, busily spinning and checking to see if it's time to turn something on or off.  But I was wondering if there was a more efficient way to do this.  What about a timed sequence?  I've never used one and the LV help didn't really give an example, but at first glance it sure sounds like a better fit.  I want two frames: first one turns a DO on and the second one turns it off after a certain period of time.  Can I make a timed sequence trigger off a button being pressed on the host?

0 Kudos
Message 5 of 9
(3,591 Views)

Please post an image of the code that does this to make life simpler for you and the other readers. I'm thinking eitiher a timed sequence inside the loop to do the wire-jiggling deterministic.

Communicating between the host and the RT should really be in another thread since network traffic seldom has anything to do with determinism (unless you are using SCRAMNet Smiley Wink ).

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 9
(3,576 Views)
Timed sequence is EXACTLY what I wanted.  Now I just need to get one to work with an array of clusters that specify the start time and duration for each actuator as well as the DAQmx channel ...

Cool!

0 Kudos
Message 7 of 9
(3,568 Views)
BTW, for those who are curious, here's my test VI.

0 Kudos
Message 8 of 9
(3,565 Views)
Well crap.  I don't think I can use an array of actuators and then loop over them for the timed sequences because each iteration will wait until completion before moving onto the next.  This wouldn't work for me because I can have multiple actuators on at any given time (the event sequences must be in parallel).  So is there any way to programmatically execute an array of things in parallel?  If not, then I'm back to a single timed loop and checking the times manually (i.e. doing the job the OS scheduler should be doing).

0 Kudos
Message 9 of 9
(3,552 Views)